Hack to fix incorrect getMightBePassedToApply under --disable-type-inference

R=sigmund@google.com

Bug:
Change-Id: Ie0378a923473e2b5ff7eaabdff499ddb01050f3e
Reviewed-on: https://dart-review.googlesource.com/7489
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Stephen Adams 2017-09-22 02:47:23 +00:00
parent ec19f432cf
commit aa0d5a428e
6 changed files with 55 additions and 33 deletions

View file

@ -1159,12 +1159,23 @@ abstract class ClosedWorldBase implements ClosedWorld, ClosedWorldRefiner {
} }
bool getMightBePassedToApply(FunctionEntity element) { bool getMightBePassedToApply(FunctionEntity element) {
// We assume all functions reach Function.apply if no functions are
// registered so. We get an empty set in two circumstances (1) a trivial
// program and (2) when compiling without type inference
// (i.e. --disable-type-inference). Returning `true` has consequences (extra
// metadata for Function.apply) only when Function.apply is also part of the
// program. It is an unusual trivial program that includes Function.apply
// but does not call it on a function.
//
// TODO(sra): We should reverse the sense of this set and register functions
// that we have proven do not reach Function.apply.
if (_functionsThatMightBePassedToApply.isEmpty) return true;
return _functionsThatMightBePassedToApply.contains(element); return _functionsThatMightBePassedToApply.contains(element);
} }
@override @override
bool getCurrentlyKnownMightBePassedToApply(FunctionEntity element) { bool getCurrentlyKnownMightBePassedToApply(FunctionEntity element) {
return getMightBePassedToApply(element); return _functionsThatMightBePassedToApply.contains(element);
} }
@override @override

View file

@ -165,7 +165,9 @@ js_dispatch_property_test: Crash # Issue 27394
regress/4562_test/01: Crash # Issue 27394 regress/4562_test/01: Crash # Issue 27394
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ] [ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
19191_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
21666_test: RuntimeError 21666_test: RuntimeError
22917_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
closure_capture2_test: RuntimeError closure_capture2_test: RuntimeError
closure_capture4_test: RuntimeError closure_capture4_test: RuntimeError
closure_type_reflection2_test: RuntimeError closure_type_reflection2_test: RuntimeError
@ -233,7 +235,9 @@ unconditional_dartio_import_test: CompileTimeError
useful_error_message_1_test: RuntimeError useful_error_message_1_test: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel && $minified ] [ $compiler == dart2js && $dart2js_with_kernel && $minified ]
19191_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
21666_test: RuntimeError 21666_test: RuntimeError
22917_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
closure_capture4_test: RuntimeError closure_capture4_test: RuntimeError
closure_type_reflection2_test: RuntimeError closure_type_reflection2_test: RuntimeError
closure_type_reflection_test: RuntimeError closure_type_reflection_test: RuntimeError

View file

@ -284,10 +284,11 @@ string_from_environment_test: Fail # Flutter Issue 9111
string_trimlr_test/02: RuntimeError # Flutter Issue 9111 string_trimlr_test/02: RuntimeError # Flutter Issue 9111
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ] [ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
apply2_test: RuntimeError apply2_test: Crash # 'file:*/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart': Failed assertion: line 877 pos 18: 'defaultValue != null': is not true.
apply3_test: RuntimeError apply3_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
apply5_test: RuntimeError apply4_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
apply_test: RuntimeError apply5_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
apply_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
big_integer_arith_vm_test/add: RuntimeError big_integer_arith_vm_test/add: RuntimeError
big_integer_arith_vm_test/div: RuntimeError big_integer_arith_vm_test/div: RuntimeError
big_integer_arith_vm_test/gcd: RuntimeError big_integer_arith_vm_test/gcd: RuntimeError
@ -352,10 +353,11 @@ symbol_test/03: MissingCompileTimeError
symbol_test/none: RuntimeError # Issue 27394 symbol_test/none: RuntimeError # Issue 27394
[ $compiler == dart2js && $dart2js_with_kernel && $minified ] [ $compiler == dart2js && $dart2js_with_kernel && $minified ]
apply2_test: RuntimeError apply2_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
apply3_test: RuntimeError apply3_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
apply5_test: RuntimeError apply4_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
apply_test: RuntimeError apply5_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
apply_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
big_integer_arith_vm_test/add: RuntimeError big_integer_arith_vm_test/add: RuntimeError
big_integer_arith_vm_test/div: RuntimeError big_integer_arith_vm_test/div: RuntimeError
big_integer_arith_vm_test/gcd: RuntimeError big_integer_arith_vm_test/gcd: RuntimeError
@ -419,3 +421,4 @@ symbol_test/01: Crash # Assertion failure: Unexpected constant value in const Sy
symbol_test/02: MissingCompileTimeError symbol_test/02: MissingCompileTimeError
symbol_test/03: MissingCompileTimeError symbol_test/03: MissingCompileTimeError
symbol_test/none: RuntimeError # Issue 27394 symbol_test/none: RuntimeError # Issue 27394

View file

@ -505,10 +505,11 @@ string_split_test: RuntimeError # does not return List<String>
list_test/*: RuntimeError # VM doesn't implement strong mode covariance checks list_test/*: RuntimeError # VM doesn't implement strong mode covariance checks
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ] [ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
apply2_test: RuntimeError apply2_test: Crash # 'file:*/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart': Failed assertion: line 877 pos 18: 'defaultValue != null': is not true.
apply3_test: RuntimeError apply3_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
apply5_test: RuntimeError apply4_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
apply_test: RuntimeError apply5_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
apply_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
bool_from_environment2_test/01: MissingCompileTimeError bool_from_environment2_test/01: MissingCompileTimeError
bool_from_environment2_test/02: MissingCompileTimeError bool_from_environment2_test/02: MissingCompileTimeError
bool_from_environment2_test/03: MissingCompileTimeError bool_from_environment2_test/03: MissingCompileTimeError
@ -550,10 +551,11 @@ symbol_test/none: RuntimeError
uri_base_test: Crash # RangeError (index): Invalid value: Valid value range is empty: 0 uri_base_test: Crash # RangeError (index): Invalid value: Valid value range is empty: 0
[ $compiler == dart2js && $dart2js_with_kernel && $minified ] [ $compiler == dart2js && $dart2js_with_kernel && $minified ]
apply2_test: RuntimeError apply2_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
apply3_test: RuntimeError apply3_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
apply5_test: RuntimeError apply4_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
apply_test: RuntimeError apply5_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
apply_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
bool_from_environment2_test/01: MissingCompileTimeError bool_from_environment2_test/01: MissingCompileTimeError
bool_from_environment2_test/02: MissingCompileTimeError bool_from_environment2_test/02: MissingCompileTimeError
bool_from_environment2_test/03: MissingCompileTimeError bool_from_environment2_test/03: MissingCompileTimeError

View file

@ -512,7 +512,7 @@ constructor_redirect2_negative_test: Crash # Issue 30856
constructor_redirect2_test/01: MissingCompileTimeError constructor_redirect2_test/01: MissingCompileTimeError
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2). constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
cyclic_constructor_test/01: Crash # Issue 30856 cyclic_constructor_test/01: Crash # Issue 30856
cyclic_default_values_test: RuntimeError cyclic_default_values_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
deferred_call_empty_before_load_test: RuntimeError deferred_call_empty_before_load_test: RuntimeError
deferred_closurize_load_library_test: CompileTimeError deferred_closurize_load_library_test: CompileTimeError
deferred_constant_list_test: CompileTimeError deferred_constant_list_test: CompileTimeError
@ -625,7 +625,7 @@ malformed_test/03: Crash # 'package:front_end/src/fasta/kernel/kernel_class_buil
malformed_test/04: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true. malformed_test/04: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
malformed_test/06: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true. malformed_test/06: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
malformed_test/none: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true. malformed_test/none: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
many_named_arguments_test: RuntimeError many_named_arguments_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
map_literal4_test: RuntimeError map_literal4_test: RuntimeError
method_name_test: CompileTimeError method_name_test: CompileTimeError
method_override4_test: RuntimeError method_override4_test: RuntimeError
@ -769,9 +769,9 @@ named_parameters_with_conversions_test: RuntimeError
nan_identical_test: RuntimeError nan_identical_test: RuntimeError
nested_switch_label_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/locals_handler.dart': Failed assertion: line 296 pos 12: 'local != null': is not true. nested_switch_label_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/locals_handler.dart': Failed assertion: line 296 pos 12: 'local != null': is not true.
no_main_test/01: CompileTimeError no_main_test/01: CompileTimeError
null_test/02: MissingCompileTimeError null_test/02: Crash # 'file:*/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart': Failed assertion: line 877 pos 18: 'defaultValue != null': is not true.
null_test/03: MissingCompileTimeError null_test/03: Crash # 'file:*/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart': Failed assertion: line 877 pos 18: 'defaultValue != null': is not true.
null_test/none: RuntimeError null_test/none: Crash # 'file:*/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart': Failed assertion: line 877 pos 18: 'defaultValue != null': is not true.
number_identity2_test: RuntimeError number_identity2_test: RuntimeError
numbers_test: RuntimeError numbers_test: RuntimeError
override_field_method1_negative_test: Fail override_field_method1_negative_test: Fail
@ -906,7 +906,7 @@ constructor_redirect2_negative_test: Crash # Issue 30856
constructor_redirect2_test/01: MissingCompileTimeError constructor_redirect2_test/01: MissingCompileTimeError
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2). constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
cyclic_constructor_test/01: Crash # Issue 30856 cyclic_constructor_test/01: Crash # Issue 30856
cyclic_default_values_test: RuntimeError cyclic_default_values_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
cyclic_type2_test: RuntimeError cyclic_type2_test: RuntimeError
cyclic_type_test/00: RuntimeError cyclic_type_test/00: RuntimeError
cyclic_type_test/01: RuntimeError cyclic_type_test/01: RuntimeError
@ -1022,7 +1022,7 @@ local_function3_test: RuntimeError
local_function_test: RuntimeError local_function_test: RuntimeError
main_not_a_function_test/01: CompileTimeError main_not_a_function_test/01: CompileTimeError
malformed_test/none: RuntimeError malformed_test/none: RuntimeError
many_named_arguments_test: RuntimeError many_named_arguments_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
map_literal4_test: RuntimeError map_literal4_test: RuntimeError
method_name_test: CompileTimeError method_name_test: CompileTimeError
method_override4_test: RuntimeError method_override4_test: RuntimeError
@ -1167,9 +1167,9 @@ named_parameters_with_conversions_test: RuntimeError
nan_identical_test: RuntimeError nan_identical_test: RuntimeError
nested_switch_label_test: Crash # NoSuchMethodError: The method 'generateBreak' was called on null. nested_switch_label_test: Crash # NoSuchMethodError: The method 'generateBreak' was called on null.
no_main_test/01: CompileTimeError no_main_test/01: CompileTimeError
null_test/02: MissingCompileTimeError null_test/02: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
null_test/03: MissingCompileTimeError null_test/03: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
null_test/none: RuntimeError null_test/none: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
number_identity2_test: RuntimeError number_identity2_test: RuntimeError
numbers_test: RuntimeError numbers_test: RuntimeError
override_field_method1_negative_test: Fail override_field_method1_negative_test: Fail

View file

@ -605,8 +605,9 @@ bool_check_test: RuntimeError
bool_condition_check_test: RuntimeError bool_condition_check_test: RuntimeError
branch_canonicalization_test: RuntimeError branch_canonicalization_test: RuntimeError
call_closurization_test: RuntimeError call_closurization_test: RuntimeError
call_function_apply_test: RuntimeError call_function_apply_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
call_test: RuntimeError call_test: RuntimeError
call_with_no_such_method_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
canonical_const2_test: RuntimeError canonical_const2_test: RuntimeError
cast_test/02: MissingRuntimeError cast_test/02: MissingRuntimeError
cast_test/03: MissingRuntimeError cast_test/03: MissingRuntimeError
@ -615,7 +616,7 @@ cha_deopt2_test: CompileTimeError
cha_deopt3_test: CompileTimeError cha_deopt3_test: CompileTimeError
class_cycle_test/02: MissingCompileTimeError class_cycle_test/02: MissingCompileTimeError
class_cycle_test/03: MissingCompileTimeError class_cycle_test/03: MissingCompileTimeError
classes_static_method_clash_test: RuntimeError classes_static_method_clash_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
closure_in_constructor_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(A.T) in (local(A.factory#))in j:closure_call(A_A$factory_closure.call). closure_in_constructor_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(A.T) in (local(A.factory#))in j:closure_call(A_A$factory_closure.call).
closure_in_initializer_test: Crash # Assertion failure: Cannot find value local(A.#a) in (local(C.#a), BoxLocal(_box_0), local(C.#a), BoxLocal(_box_0)) for j:constructor(C.). closure_in_initializer_test: Crash # Assertion failure: Cannot find value local(A.#a) in (local(C.#a), BoxLocal(_box_0), local(C.#a), BoxLocal(_box_0)) for j:constructor(C.).
closure_invoked_through_interface_target_field_test: MissingCompileTimeError closure_invoked_through_interface_target_field_test: MissingCompileTimeError
@ -649,7 +650,7 @@ covariant_subtyping_unsafe_call1_test: RuntimeError
covariant_subtyping_unsafe_call2_test: RuntimeError covariant_subtyping_unsafe_call2_test: RuntimeError
covariant_subtyping_unsafe_call3_test: RuntimeError covariant_subtyping_unsafe_call3_test: RuntimeError
cyclic_constructor_test/01: Crash # Issue 30856 cyclic_constructor_test/01: Crash # Issue 30856
cyclic_default_values_test: RuntimeError cyclic_default_values_test: Crash # type 'JMethod' is not a subtype of type 'MethodElement' of 'function' where
deferred_call_empty_before_load_test: RuntimeError deferred_call_empty_before_load_test: RuntimeError
deferred_closurize_load_library_test: CompileTimeError deferred_closurize_load_library_test: CompileTimeError
deferred_constant_list_test: CompileTimeError deferred_constant_list_test: CompileTimeError
@ -774,8 +775,9 @@ bool_check_test: RuntimeError
bool_condition_check_test: RuntimeError bool_condition_check_test: RuntimeError
branch_canonicalization_test: RuntimeError branch_canonicalization_test: RuntimeError
call_closurization_test: RuntimeError call_closurization_test: RuntimeError
call_function_apply_test: RuntimeError call_function_apply_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
call_test: RuntimeError call_test: RuntimeError
call_with_no_such_method_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
canonical_const2_test: RuntimeError canonical_const2_test: RuntimeError
cast_test/02: MissingRuntimeError cast_test/02: MissingRuntimeError
cast_test/03: MissingRuntimeError cast_test/03: MissingRuntimeError
@ -784,7 +786,7 @@ cha_deopt2_test: CompileTimeError
cha_deopt3_test: CompileTimeError cha_deopt3_test: CompileTimeError
class_cycle_test/02: MissingCompileTimeError class_cycle_test/02: MissingCompileTimeError
class_cycle_test/03: MissingCompileTimeError class_cycle_test/03: MissingCompileTimeError
classes_static_method_clash_test: RuntimeError classes_static_method_clash_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
closure_in_constructor_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(A.T) in (local(A.factory#))in j:closure_call(A_A$factory_closure.call). closure_in_constructor_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(A.T) in (local(A.factory#))in j:closure_call(A_A$factory_closure.call).
closure_in_initializer_test: Crash # Assertion failure: Cannot find value local(A.#a) in (local(C.#a), BoxLocal(_box_0), local(C.#a), BoxLocal(_box_0)) for j:constructor(C.). closure_in_initializer_test: Crash # Assertion failure: Cannot find value local(A.#a) in (local(C.#a), BoxLocal(_box_0), local(C.#a), BoxLocal(_box_0)) for j:constructor(C.).
closure_invoked_through_interface_target_field_test: MissingCompileTimeError closure_invoked_through_interface_target_field_test: MissingCompileTimeError
@ -817,7 +819,7 @@ covariant_subtyping_unsafe_call1_test: RuntimeError
covariant_subtyping_unsafe_call2_test: RuntimeError covariant_subtyping_unsafe_call2_test: RuntimeError
covariant_subtyping_unsafe_call3_test: RuntimeError covariant_subtyping_unsafe_call3_test: RuntimeError
cyclic_constructor_test/01: Crash # Issue 30856 cyclic_constructor_test/01: Crash # Issue 30856
cyclic_default_values_test: RuntimeError cyclic_default_values_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
cyclic_type2_test: RuntimeError cyclic_type2_test: RuntimeError
cyclic_type_test/00: RuntimeError cyclic_type_test/00: RuntimeError
cyclic_type_test/01: RuntimeError cyclic_type_test/01: RuntimeError