[dart2js] Use experimental type strategy from compiler based on flag.

Change-Id: I3b79750691792f8f4cc7a8c09d2d4cc9b142f074
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260240
Reviewed-by: Mayank Patke <fishythefish@google.com>
This commit is contained in:
Nate Biggs 2022-09-20 19:54:35 +00:00 committed by Commit Bot
parent 4eda3397f3
commit e96a0f6c98
4 changed files with 17 additions and 13 deletions

View file

@ -38,8 +38,12 @@ import 'inferrer/powersets/powersets.dart' show PowersetStrategy;
import 'inferrer/typemasks/masks.dart' show TypeMaskStrategy; import 'inferrer/typemasks/masks.dart' show TypeMaskStrategy;
import 'inferrer/types.dart' import 'inferrer/types.dart'
show GlobalTypeInferenceResults, GlobalTypeInferenceTask; show GlobalTypeInferenceResults, GlobalTypeInferenceTask;
import 'inferrer_experimental/trivial.dart' as experimentalInferrer
show TrivialAbstractValueStrategy;
import 'inferrer_experimental/types.dart' as experimentalInferrer import 'inferrer_experimental/types.dart' as experimentalInferrer
show GlobalTypeInferenceTask; show GlobalTypeInferenceTask;
import 'inferrer_experimental/typemasks/masks.dart' as experimentalInferrer
show TypeMaskStrategy;
import 'inferrer/wrapped.dart' show WrappedAbstractValueStrategy; import 'inferrer/wrapped.dart' show WrappedAbstractValueStrategy;
import 'ir/modular.dart'; import 'ir/modular.dart';
import 'js_backend/backend.dart' show CodegenInputs; import 'js_backend/backend.dart' show CodegenInputs;
@ -158,9 +162,13 @@ class Compiler
options.deriveOptions(); options.deriveOptions();
options.validate(); options.validate();
abstractValueStrategy = options.useTrivialAbstractValueDomain abstractValueStrategy = options.experimentalInferrer
? const TrivialAbstractValueStrategy() ? (options.useTrivialAbstractValueDomain
: const TypeMaskStrategy(); ? const experimentalInferrer.TrivialAbstractValueStrategy()
: const experimentalInferrer.TypeMaskStrategy())
: (options.useTrivialAbstractValueDomain
? const TrivialAbstractValueStrategy()
: const TypeMaskStrategy());
if (options.experimentalWrapped || options.testMode) { if (options.experimentalWrapped || options.testMode) {
abstractValueStrategy = abstractValueStrategy =
WrappedAbstractValueStrategy(abstractValueStrategy); WrappedAbstractValueStrategy(abstractValueStrategy);

View file

@ -271,9 +271,9 @@ abstract class TypeMask implements AbstractValue {
/// If [mask] is forwarding, returns the first non-forwarding [TypeMask] in /// If [mask] is forwarding, returns the first non-forwarding [TypeMask] in
/// [mask]'s forwarding chain. /// [mask]'s forwarding chain.
static TypeMask nonForwardingMask(mask) { static TypeMask nonForwardingMask(TypeMask mask) {
while (mask.isForwarding) { while (mask is ForwardingTypeMask) {
mask = mask.forwardTo; mask = (mask as ForwardingTypeMask).forwardTo;
} }
return mask; return mask;
} }

View file

@ -271,9 +271,9 @@ abstract class TypeMask implements AbstractValue {
/// If [mask] is forwarding, returns the first non-forwarding [TypeMask] in /// If [mask] is forwarding, returns the first non-forwarding [TypeMask] in
/// [mask]'s forwarding chain. /// [mask]'s forwarding chain.
static TypeMask nonForwardingMask(mask) { static TypeMask nonForwardingMask(TypeMask mask) {
while (mask.isForwarding) { while (mask is ForwardingTypeMask) {
mask = mask.forwardTo; mask = (mask as ForwardingTypeMask).forwardTo;
} }
return mask; return mask;
} }

View file

@ -25,10 +25,6 @@
"Dynamic access of 'memberContext'.": 1, "Dynamic access of 'memberContext'.": 1,
"Dynamic access of 'name'.": 1 "Dynamic access of 'name'.": 1
}, },
"pkg/compiler/lib/src/inferrer/typemasks/type_mask.dart": {
"Dynamic access of 'forwardTo'.": 1,
"Dynamic access of 'isForwarding'.": 1
},
"pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart": { "pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart": {
"Dynamic invocation of '[]='.": 1, "Dynamic invocation of '[]='.": 1,
"Dynamic invocation of 'add'.": 1 "Dynamic invocation of 'add'.": 1