diff --git a/pkg/compiler/lib/src/js_backend/field_analysis.dart b/pkg/compiler/lib/src/js_backend/field_analysis.dart index c35ba76a58d..44c6a412afe 100644 --- a/pkg/compiler/lib/src/js_backend/field_analysis.dart +++ b/pkg/compiler/lib/src/js_backend/field_analysis.dart @@ -371,10 +371,7 @@ class JFieldAnalysis { assert(value != null); if (!memberUsage.hasWrite && canBeElided(kField)) { isEffectivelyConstant = true; - } else if (value is NullConstantValue || - value is IntConstantValue || - value is BoolConstantValue || - value is StringConstantValue || + } else if (value is PrimitiveConstantValue || value is LateSentinelConstantValue) { // TODO(johnniwinther,sra): Support non-primitive constants in // allocators when it does cause allocators to deoptimized diff --git a/pkg/compiler/test/field_analysis/jdata/marker.options b/pkg/compiler/test/field_analysis/jdata/marker.options index c5938f057dc..04a69cffafe 100644 --- a/pkg/compiler/test/field_analysis/jdata/marker.options +++ b/pkg/compiler/test/field_analysis/jdata/marker.options @@ -1,2 +1 @@ spec=pkg/compiler/test/field_analysis/jfield_analysis_test.dart -prod=pkg/compiler/test/field_analysis/jfield_analysis_test.dart diff --git a/pkg/compiler/test/field_analysis/jdata/simple_initializers.dart b/pkg/compiler/test/field_analysis/jdata/simple_initializers.dart index 94daff83e2f..be2902af4ed 100644 --- a/pkg/compiler/test/field_analysis/jdata/simple_initializers.dart +++ b/pkg/compiler/test/field_analysis/jdata/simple_initializers.dart @@ -166,7 +166,10 @@ class Class1 { /*member: Class1.field7b:constant=StringConstant("foo")*/ var field7b = 'foo'; - /*member: Class1.field8a:initial=DoubleConstant(0.5)*/ + /*member: Class1.field8a: + allocator, + initial=DoubleConstant(0.5) + */ var field8a = 0.5; /*member: Class1.field8b:constant=DoubleConstant(0.5)*/ @@ -178,10 +181,10 @@ class Class1 { /*member: Class1.field9b:constant=ListConstant([])*/ var field9b = const []; - /*spec.member: Class1.field9c:initial=ListConstant([IntConstant(0), IntConstant(1)])*/ + /*member: Class1.field9c:initial=ListConstant([IntConstant(0), IntConstant(1)])*/ var field9c = const [0, 1]; - /*spec.member: Class1.field9d:constant=ListConstant([IntConstant(0), IntConstant(1), IntConstant(2)])*/ + /*member: Class1.field9d:constant=ListConstant([IntConstant(0), IntConstant(1), IntConstant(2)])*/ var field9d = const [0, 1, 2]; /*member: Class1.field10a:initial=MapConstant({})*/ @@ -190,10 +193,10 @@ class Class1 { /*member: Class1.field10b:constant=MapConstant({})*/ var field10b = const {}; - /*spec.member: Class1.field10c:initial=MapConstant({IntConstant(0): IntConstant(1), IntConstant(2): IntConstant(3)})*/ + /*member: Class1.field10c:initial=MapConstant({IntConstant(0): IntConstant(1), IntConstant(2): IntConstant(3)})*/ var field10c = const {0: 1, 2: 3}; - /*spec.member: Class1.field10d:constant=MapConstant({IntConstant(0): IntConstant(1), IntConstant(2): IntConstant(3), IntConstant(4): IntConstant(5)})*/ + /*member: Class1.field10d:constant=MapConstant({IntConstant(0): IntConstant(1), IntConstant(2): IntConstant(3), IntConstant(4): IntConstant(5)})*/ var field10d = const {0: 1, 2: 3, 4: 5}; /*member: Class1.field11a:initial=ConstructedConstant(Symbol(_name=StringConstant("foo")))*/ @@ -258,7 +261,10 @@ class Class2 { /*member: Class2.field7b:constant=StringConstant("foo")*/ var field7b; - /*member: Class2.field8a:initial=DoubleConstant(0.5)*/ + /*member: Class2.field8a: + allocator, + initial=DoubleConstant(0.5) + */ var field8a; /*member: Class2.field8b:constant=DoubleConstant(0.5)*/ @@ -270,10 +276,10 @@ class Class2 { /*member: Class2.field9b:constant=ListConstant([])*/ var field9b; - /*spec.member: Class2.field9c:initial=ListConstant([IntConstant(0), IntConstant(1)])*/ + /*member: Class2.field9c:initial=ListConstant([IntConstant(0), IntConstant(1)])*/ var field9c; - /*spec.member: Class2.field9d:constant=ListConstant([IntConstant(0), IntConstant(1), IntConstant(2)])*/ + /*member: Class2.field9d:constant=ListConstant([IntConstant(0), IntConstant(1), IntConstant(2)])*/ var field9d; /*member: Class2.field10a:initial=MapConstant({})*/ @@ -282,10 +288,10 @@ class Class2 { /*member: Class2.field10b:constant=MapConstant({})*/ var field10b; - /*spec.member: Class2.field10c:initial=MapConstant({IntConstant(0): IntConstant(1), IntConstant(2): IntConstant(3)})*/ + /*member: Class2.field10c:initial=MapConstant({IntConstant(0): IntConstant(1), IntConstant(2): IntConstant(3)})*/ var field10c; - /*spec.member: Class2.field10d:constant=MapConstant({IntConstant(0): IntConstant(1), IntConstant(2): IntConstant(3), IntConstant(4): IntConstant(5)})*/ + /*member: Class2.field10d:constant=MapConstant({IntConstant(0): IntConstant(1), IntConstant(2): IntConstant(3), IntConstant(4): IntConstant(5)})*/ var field10d; /*member: Class2.field11a:initial=ConstructedConstant(Symbol(_name=StringConstant("foo")))*/ diff --git a/pkg/compiler/test/field_analysis/kdata/marker.options b/pkg/compiler/test/field_analysis/kdata/marker.options index 495daf6234f..0cfee702b07 100644 --- a/pkg/compiler/test/field_analysis/kdata/marker.options +++ b/pkg/compiler/test/field_analysis/kdata/marker.options @@ -1,2 +1 @@ spec=pkg/compiler/test/field_analysis/kfield_analysis_test.dart -prod=pkg/compiler/test/field_analysis/kfield_analysis_test.dart