dart2js cps: Fix translation of local constants.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1211393003.
This commit is contained in:
Asger Feldthaus 2015-06-29 14:32:49 +02:00
parent d24580087d
commit ec55d46148
9 changed files with 28 additions and 98 deletions

View file

@ -339,24 +339,19 @@ abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
ir.Primitive visitVariableDefinitions(ast.VariableDefinitions node) {
assert(irBuilder.isOpen);
if (node.modifiers.isConst) {
// Do nothing.
// handleLocalConstantGet inlines the constant at use-site.
} else {
for (ast.Node definition in node.definitions.nodes) {
Element element = elements[definition];
ir.Primitive initialValue;
// Definitions are either SendSets if there is an initializer, or
// Identifiers if there is no initializer.
if (definition is ast.SendSet) {
assert(!definition.arguments.isEmpty);
assert(definition.arguments.tail.isEmpty);
initialValue = visit(definition.arguments.head);
} else {
assert(definition is ast.Identifier);
}
irBuilder.declareLocalVariable(element, initialValue: initialValue);
for (ast.Node definition in node.definitions.nodes) {
Element element = elements[definition];
ir.Primitive initialValue;
// Definitions are either SendSets if there is an initializer, or
// Identifiers if there is no initializer.
if (definition is ast.SendSet) {
assert(!definition.arguments.isEmpty);
assert(definition.arguments.tail.isEmpty);
initialValue = visit(definition.arguments.head);
} else {
assert(definition is ast.Identifier);
}
irBuilder.declareLocalVariable(element, initialValue: initialValue);
}
return null;
}

View file

@ -162,8 +162,7 @@ analyzer/test/generated/compile_time_error_code_test: Crash # Invalid argument(s
analyzer/test/generated/element_test: Crash # Invalid argument(s)
analyzer/test/generated/incremental_resolver_test: Crash # Invalid argument(s)
analyzer/test/generated/incremental_scanner_test: Crash # Invalid argument(s)
analyzer/test/generated/java_core_test: Crash # Invalid argument(s)
analyzer/test/generated/java_io_test: Crash # Invalid argument(s)
analyzer/test/generated/java_core_test : RuntimeError # TypeError: receiver.get$_nums is not a function
analyzer/test/generated/non_error_resolver_test: Crash # Invalid argument(s)
analyzer/test/generated/parser_test: Crash # Invalid argument(s)
analyzer/test/generated/resolver_test: Crash # Invalid argument(s)
@ -193,6 +192,6 @@ analyzer/test/src/util/lru_map_test: Crash # Invalid argument(s)
fixnum/test/int_32_test: Crash # Invalid argument(s)
fixnum/test/int_64_test: Crash # Invalid argument(s)
typed_data/test/typed_buffers_test/01: Crash # Invalid argument(s)
typed_data/test/typed_buffers_test/none: Crash # Invalid argument(s)
typed_data/test/typed_buffers_test/none : RuntimeError # TypeError: receiver.get$_nums is not a function
typed_mock/test/typed_mock_test: Crash # Invalid argument(s)
analyzer/test/generated/source_factory_test : Crash # Invalid argument(s)

View file

@ -25,4 +25,3 @@ sample_extension/test/sample_extension_test: Skip # Issue 14705
*: Skip
[ $compiler == dart2js && $cps_ir ]
sample_extension/test/sample_extension_test: Crash # Invalid argument(s)

View file

@ -9664,8 +9664,6 @@ Language/15_Types/5_Function_Types_A03_t13: RuntimeError # Cannot read property
Language/15_Types/5_Function_Types_A05_t02: RuntimeError # Cannot read property 'prototype' of undefined
Language/15_Types/5_Function_Types_A05_t05: RuntimeError # Cannot read property 'prototype' of undefined
Language/15_Types/5_Function_Types_A06_t01: RuntimeError # Cannot read property 'prototype' of undefined
LayoutTests/fast/canvas/webgl/compressed-tex-image_t01: Crash # Invalid argument(s)
LayoutTests/fast/canvas/webgl/framebuffer-object-attachment_t01: Crash # Invalid argument(s)
LayoutTests/fast/events/clipboard-dataTransferItemList_t01: Crash # Internal Error: No default constructor available.
LayoutTests/fast/forms/date/date-interactive-validation-required_t01: Crash # Invalid argument(s)
LayoutTests/fast/forms/datetimelocal/datetimelocal-interactive-validation-required_t01: Crash # Invalid argument(s)
@ -9751,7 +9749,7 @@ LibTest/async/Stream/Stream.fromFuture_A02_t02: RuntimeError # receiver.get$_col
LibTest/async/Stream/Stream.fromIterable_A01_t01: RuntimeError # receiver.get$_collection$_nums is not a function
LibTest/async/Stream/Stream.fromIterable_A01_t02: RuntimeError # receiver.get$_collection$_nums is not a function
LibTest/async/Stream/Stream.fromIterable_A02_t01: RuntimeError # receiver.get$_collection$_nums is not a function
LibTest/async/Stream/Stream.periodic_A01_t01: Crash # Invalid argument(s)
LibTest/async/Stream/Stream.periodic_A01_t01 : RuntimeError # TypeError: receiver.get$_nums is not a function
LibTest/async/Stream/Stream.periodic_A02_t01: RuntimeError # receiver.get$_collection$_nums is not a function
LibTest/async/Stream/Stream.periodic_A03_t01: RuntimeError # receiver.get$_collection$_nums is not a function
LibTest/async/Stream/Stream_A01_t01: RuntimeError # receiver.get$_collection$_nums is not a function
@ -9774,7 +9772,7 @@ LibTest/async/Stream/contains_A03_t01: RuntimeError # receiver.get$_collection$_
LibTest/async/Stream/distinct_A01_t01: RuntimeError # receiver.get$_collection$_nums is not a function
LibTest/async/Stream/distinct_A01_t02: RuntimeError # receiver.get$_collection$_nums is not a function
LibTest/async/Stream/drain_A01_t01: RuntimeError # receiver.get$_collection$_nums is not a function
LibTest/async/Stream/drain_A02_t01: Crash # Invalid argument(s)
LibTest/async/Stream/drain_A02_t01 : RuntimeError # TypeError: receiver.get$_nums is not a function
LibTest/async/Stream/drain_A02_t02: RuntimeError # receiver.get$_collection$_nums is not a function
LibTest/async/Stream/elementAt_A01_t01: RuntimeError # receiver.get$_collection$_nums is not a function
LibTest/async/Stream/elementAt_A01_t02: RuntimeError # receiver.get$_collection$_nums is not a function
@ -9999,34 +9997,9 @@ LibTest/core/Stopwatch/start_A01_t03: RuntimeError # receiver.get$_collection$_n
LibTest/core/Stopwatch/stop_A01_t01: RuntimeError # receiver.get$_collection$_nums is not a function
LibTest/core/Symbol/Symbol_A01_t03: RuntimeError # Please triage this failure.
LibTest/core/Symbol/Symbol_A01_t05: RuntimeError # Please triage this failure.
LibTest/core/Uri/authority_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/hasAuthority_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/host_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/isAbsolute_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/operator_eq_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/origin_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/parse_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/parse_A02_t01: Crash # Invalid argument(s)
LibTest/core/Uri/parse_A03_t01: Crash # Invalid argument(s)
LibTest/core/Uri/pathSegments_A01_t02: Crash # Invalid argument(s)
LibTest/core/Uri/pathSegments_A02_t01: Crash # Invalid argument(s)
LibTest/core/Uri/path_A02_t01: Crash # Invalid argument(s)
LibTest/core/Uri/port_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/queryParameters_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/queryParameters_A01_t02: Crash # Invalid argument(s)
LibTest/core/Uri/queryParameters_A01_t03: Crash # Invalid argument(s)
LibTest/core/Uri/query_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/query_A01_t02: Crash # Invalid argument(s)
LibTest/core/Uri/resolveUri_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/resolve_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/scheme_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/toFilePath_A01_t01: Crash # Invalid argument(s)
LibTest/core/Uri/toFilePath_A01_t02: Crash # Invalid argument(s)
LibTest/core/Uri/toFilePath_A01_t03: Crash # Invalid argument(s)
LibTest/core/Uri/toFilePath_A02_t01: Crash # Invalid argument(s)
LibTest/core/Uri/toFilePath_A03_t01: Crash # Invalid argument(s)
LibTest/core/Uri/toFilePath_A04_t01: Crash # Invalid argument(s)
LibTest/core/Uri/userInfo_A01_t01: Crash # Invalid argument(s)
LibTest/core/double/INFINITY_A01_t04: Pass # Please triage this failure.
LibTest/core/double/NEGATIVE_INFINITY_A01_t04: Pass # Please triage this failure.
LibTest/core/int/parse_A01_t01: RuntimeError # Cannot read property 'prototype' of undefined
@ -10064,7 +10037,7 @@ LibTest/isolate/ReceivePort/close_A02_t01: RuntimeError # receiver.get$_collecti
LibTest/isolate/ReceivePort/contains_A01_t01: RuntimeError # receiver.get$_nums is not a function
LibTest/isolate/ReceivePort/distinct_A01_t01: RuntimeError # receiver.get$_nums is not a function
LibTest/isolate/ReceivePort/distinct_A01_t02: RuntimeError # receiver.get$_nums is not a function
LibTest/isolate/ReceivePort/drain_A02_t01: Crash # Invalid argument(s)
LibTest/isolate/ReceivePort/drain_A02_t01 : RuntimeError # TypeError: receiver.get$_nums is not a function
LibTest/isolate/ReceivePort/drain_A02_t02: RuntimeError # receiver.get$_nums is not a function
LibTest/isolate/ReceivePort/elementAt_A01_t01: RuntimeError # receiver.get$_nums is not a function
LibTest/isolate/ReceivePort/elementAt_A03_t01: RuntimeError # receiver.get$_nums is not a function

View file

@ -222,7 +222,6 @@ error_stack_trace1_test: Pass # H.unwrapException(...).get$stackTrace is not a f
hashcode_test: RuntimeError # Please triage this failure.
int_parse_radix_test/01: Crash # Invalid argument(s)
int_parse_radix_test/02: Crash # Invalid argument(s)
int_parse_radix_test/none: Crash # Invalid argument(s)
iterable_empty_test: RuntimeError # Please triage this failure.
iterable_return_type_test/none: RuntimeError # Please triage this failure.
iterable_to_list_test: RuntimeError # Please triage this failure.
@ -259,14 +258,7 @@ symbol_reserved_word_test/06: RuntimeError # Please triage this failure.
symbol_reserved_word_test/09: RuntimeError # Please triage this failure.
symbol_reserved_word_test/12: RuntimeError # Please triage this failure.
symbol_test/none: Crash # The null object does not have a getter '_element'.
uri_base_test: Crash # Invalid argument(s)
uri_file_test: Crash # Invalid argument(s)
uri_http_test: Crash # Invalid argument(s)
uri_ipv6_test: Crash # Invalid argument(s)
uri_parse_test: Crash # Invalid argument(s)
uri_path_test: Crash # Invalid argument(s)
uri_query_test: Crash # Internal Error: No default constructor available.
uri_scheme_test: Crash # Invalid argument(s)
uri_test: Crash # Invalid argument(s)
apply2_test : Crash # Internal Error: No default constructor available.
apply3_test : Crash # Internal Error: No default constructor available.

View file

@ -158,7 +158,7 @@ message_enum_test: RuntimeError # receiver.get$_collection$_nums is not a functi
message_test: Crash # Invalid argument(s)
mint_maker_test: Crash # Invalid argument(s)
nested_spawn2_test: Crash # Invalid argument(s)
nested_spawn_test: Crash # Invalid argument(s)
nested_spawn_test : RuntimeError # TypeError: receiver.get$_nums is not a function
object_leak_test: RuntimeError # receiver.get$_collection$_nums is not a function
ondone_test: RuntimeError # receiver.get$_nums is not a function
pause_test: RuntimeError # receiver.get$_nums is not a function
@ -168,10 +168,10 @@ port_test: RuntimeError # receiver.get$_collection$_nums is not a function
raw_port_test: Crash # Invalid argument(s)
request_reply_test: Crash # Invalid argument(s)
simple_message_test/none: RuntimeError # receiver.get$_collection$_nums is not a function
spawn_function_custom_class_test: Crash # Invalid argument(s)
spawn_function_custom_class_test : RuntimeError # TypeError: receiver.get$_nums is not a function
spawn_function_test: Crash # Invalid argument(s)
spawn_uri_missing_from_isolate_test: Crash # Invalid argument(s)
spawn_uri_missing_test: Crash # Invalid argument(s)
spawn_uri_missing_from_isolate_test : RuntimeError # TypeError: receiver.get$_collection$_nums is not a function
spawn_uri_missing_test : RuntimeError # TypeError: receiver.get$_collection$_nums is not a function
spawn_uri_multi_test/01: Crash # Invalid argument(s)
spawn_uri_multi_test/none: Crash # Invalid argument(s)
stacktrace_message_test: Crash # Invalid argument(s)

View file

@ -373,7 +373,6 @@ closure_shared_state_test: RuntimeError # Cannot read property 'prototype' of un
closure_type_variables_test: Crash # Invalid argument(s)
closures_initializer2_test: RuntimeError # Cannot read property 'prototype' of undefined
const_evaluation_test/01: Crash # Internal Error: No default constructor available.
const_nested_test: Crash # Invalid argument(s)
constructor12_test: RuntimeError # Please triage this failure.
constructor_with_mixin_test: Crash # Internal Error: No default constructor available.
crash_6725_test/01: Crash # The null object does not have a getter '_element'.
@ -544,7 +543,6 @@ range_analysis_test: RuntimeError # Cannot read property 'prototype' of undefine
recursive_calls_test: RuntimeError # Cannot read property 'prototype' of undefined
reg_ex2_test: RuntimeError # Cannot read property 'prototype' of undefined
reg_exp2_test: RuntimeError # Cannot read property 'prototype' of undefined
regress_18435_test: Crash # Invalid argument(s)
regress_18535_test: Crash # Internal Error: No default constructor available.
regress_22438_test: Crash # (main()async{var err... cannot handle async/sync*/async* functions
regress_22443_test: RuntimeError # receiver.get$_collection$_nums is not a function
@ -649,3 +647,6 @@ no_such_method_subtype_test : Crash # Internal Error: No default constructor ava
static_setter_get_test/01 : Crash # Internal Error: No default constructor available.
abstract_exact_selector_test/none : Crash # Internal Error: No default constructor available.
abstract_exact_selector_test/01 : Crash # Internal Error: No default constructor available.
async_await_syntax_test/a05h : Crash # bailout: (a05h()async{yield*st;}): cannot handle async/sync*/async* functions
async_await_syntax_test/c11a : Crash # bailout: (c11a()async{yield-5;}): cannot handle async/sync*/async* functions
async_await_syntax_test/c11b : Crash # bailout: (c11b()async{yield*st;}): cannot handle async/sync*/async* functions

View file

@ -385,7 +385,7 @@ async/run_zoned9_test/none: RuntimeError # receiver.get$_nums is not a function
async/schedule_microtask2_test: Crash # Invalid argument(s)
async/schedule_microtask3_test: Crash # Invalid argument(s)
async/schedule_microtask5_test: Crash # Invalid argument(s)
async/schedule_microtask_test: Crash # Invalid argument(s)
async/schedule_microtask_test : RuntimeError # TypeError: receiver.get$_nums is not a function
async/slow_consumer2_test: RuntimeError # receiver.get$_collection$_nums is not a function
async/slow_consumer3_test: RuntimeError # receiver.get$_collection$_nums is not a function
async/slow_consumer_test: RuntimeError # receiver.get$_collection$_nums is not a function
@ -481,7 +481,7 @@ convert/json_test: Crash # Internal Error: No default constructor available.
convert/json_toEncodable_reviver_test: Crash # Internal Error: No default constructor available.
convert/json_util_test: Crash # Internal Error: No default constructor available.
convert/latin1_test: RuntimeError # Please triage this failure.
convert/line_splitter_test: Crash # Invalid argument(s)
convert/line_splitter_test : RuntimeError # TypeError: receiver.get$_nums is not a function
convert/streamed_conversion_json_decode1_test: RuntimeError # receiver.get$_collection$_nums is not a function
convert/streamed_conversion_json_encode1_test: Crash # Internal Error: No default constructor available.
convert/streamed_conversion_json_utf8_decode_test: RuntimeError # receiver.get$_collection$_nums is not a function
@ -491,8 +491,8 @@ convert/streamed_conversion_utf8_encode_test: RuntimeError # receiver.get$_colle
js/datetime_roundtrip_test: Crash # Internal Error: No default constructor available.
js/null_test: Crash # Invalid argument(s)
math/pi_test: RuntimeError # receiver.get$_collection$_nums is not a function
math/point_test: Crash # Invalid argument(s)
math/rectangle_test: Crash # Invalid argument(s)
math/point_test : RuntimeError # TypeError: receiver.get$_nums is not a function
math/rectangle_test : RuntimeError # TypeError: receiver.get$_nums is not a function
mirrors/abstract_class_test/00: Crash # Internal Error: No default constructor available.
mirrors/abstract_class_test/none: Crash # Internal Error: No default constructor available.
mirrors/abstract_test: Crash # Internal Error: No default constructor available.

View file

@ -170,16 +170,7 @@ io/test_runner_test: Skip # Timeout.
io/http_client_stays_alive_test: Skip # Timeout.
[ $compiler == dart2js && $cps_ir ]
coverage_test: Crash # Invalid argument(s)
io/addlatexhash_test: Crash # Invalid argument(s)
io/create_recursive_test: Crash # Invalid argument(s)
io/directory_list_pause_test: Crash # Invalid argument(s)
io/directory_uri_test: Crash # Invalid argument(s)
io/file_lock_test: Crash # Invalid argument(s)
io/file_stat_test: Crash # Invalid argument(s)
io/file_test: Crash # Invalid argument(s)
io/file_typed_data_test: Crash # Invalid argument(s)
io/file_uri_test: Crash # Invalid argument(s)
io/file_write_only_test: Crash # (main()async{asyncSt... cannot handle async/sync*/async* functions
io/http_10_test: Crash # Internal Error: No default constructor available.
io/http_advanced_test: Crash # Internal Error: No default constructor available.
@ -197,10 +188,8 @@ io/http_connection_close_test: Crash # Invalid argument(s)
io/http_connection_header_test: Crash # Internal Error: No default constructor available.
io/http_connection_info_test: Crash # Internal Error: No default constructor available.
io/http_content_length_test: Crash # Internal Error: No default constructor available.
io/http_cookie_date_test: Crash # Invalid argument(s)
io/http_cookie_test: Crash # Internal Error: No default constructor available.
io/http_cross_process_test: Crash # Internal Error: No default constructor available.
io/http_date_test: Crash # Invalid argument(s)
io/http_detach_socket_test: Crash # Internal Error: No default constructor available.
io/http_head_test: Crash # Internal Error: No default constructor available.
io/http_headers_state_test: Crash # Internal Error: No default constructor available.
@ -234,11 +223,7 @@ io/https_server_test: Crash # Internal Error: No default constructor available.
io/https_unauthorized_test: Crash # Internal Error: No default constructor available.
io/issue_22636_test: Crash # (test()async{server=... cannot handle async/sync*/async* functions
io/issue_22637_test: Crash # (test()async{server=... cannot handle async/sync*/async* functions
io/link_async_test: Crash # Invalid argument(s)
io/link_test: Crash # Invalid argument(s)
io/link_uri_test: Crash # Invalid argument(s)
io/observatory_test: Crash # Invalid argument(s)
io/parent_test: Crash # Invalid argument(s)
io/platform_resolved_executable_test/00: Crash # Internal Error: No default constructor available.
io/platform_resolved_executable_test/01: Crash # Invalid argument(s)
io/platform_resolved_executable_test/02: Crash # Invalid argument(s)
@ -250,37 +235,23 @@ io/platform_resolved_executable_test/none: Crash # Internal Error: No default co
io/platform_test: Crash # Internal Error: No default constructor available.
io/process_environment_test: Crash # Internal Error: No default constructor available.
io/process_path_environment_test: Crash # Internal Error: No default constructor available.
io/raw_secure_server_closing_test: Crash # Invalid argument(s)
io/raw_secure_server_socket_test: Crash # Invalid argument(s)
io/raw_secure_socket_pause_test: Crash # Internal Error: No default constructor available.
io/raw_secure_socket_test: Crash # Internal Error: No default constructor available.
io/raw_socket_test: Crash # Invalid argument(s)
io/raw_socket_typed_data_test: Crash # Invalid argument(s)
io/regress_8828_test: Crash # Internal Error: No default constructor available.
io/regress_9194_test: Crash # Internal Error: No default constructor available.
io/resolve_symbolic_links_test: Crash # Invalid argument(s)
io/secure_builtin_roots_test: Crash # Invalid argument(s)
io/secure_server_closing_test: Crash # Invalid argument(s)
io/secure_server_socket_test: Crash # Invalid argument(s)
io/secure_socket_test: Crash # Internal Error: No default constructor available.
io/skipping_dart2js_compilations_test: Crash # Invalid argument(s)
io/socket_bind_test: Crash # (testListenCloseList... cannot handle async/sync*/async* functions
io/socket_exception_test: Crash # Invalid argument(s)
io/socket_source_address_test: Crash # (Future testConnect(... cannot handle async/sync*/async* functions
io/socket_upgrade_to_secure_test: Crash # Invalid argument(s)
io/stdin_sync_test: Crash # Internal Error: No default constructor available.
io/test_extension_fail_test: Crash # Invalid argument(s)
io/test_extension_test: Crash # Invalid argument(s)
io/test_runner_test: Crash # Internal Error: No default constructor available.
io/uri_platform_test: Crash # Invalid argument(s)
io/web_socket_error_test: Crash # Internal Error: No default constructor available.
io/web_socket_ping_test: Crash # Internal Error: No default constructor available.
io/web_socket_pipe_test: Crash # Internal Error: No default constructor available.
io/web_socket_protocol_test: Crash # Internal Error: No default constructor available.
io/web_socket_test: Crash # Internal Error: No default constructor available.
io/web_socket_typed_data_test: Crash # Internal Error: No default constructor available.
io/windows_environment_test: Crash # Invalid argument(s)
priority_queue_stress_test: RuntimeError # receiver.get$_collection$_nums is not a function
slowpath_safepoints_test: RuntimeError # Cannot read property 'prototype' of undefined
typed_array_test: RuntimeError # receiver.get$_collection$_nums is not a function
verbose_gc_to_bmu_test: Crash # Invalid argument(s)