@@ -1235,9 +1235,6 @@ abstract class HInstruction implements SpannableWithEntity {
12351235 /// Can this node throw an exception?
12361236 bool canThrow (AbstractValueDomain domain) => false ;
12371237
1238- /// Does this node potentially affect control flow.
1239- bool isControlFlow () => false ;
1240-
12411238 bool isValue (AbstractValueDomain domain) =>
12421239 domain.isPrimitiveValue (instructionType);
12431240
@@ -1477,6 +1474,12 @@ abstract class HInstruction implements SpannableWithEntity {
14771474
14781475 bool isCodeMotionInvariant () => false ;
14791476
1477+ /// Returns `true` when this HInstruction might be compiled to a JavaScript
1478+ /// statement, `false` when always compiled to a JavaScript expression.
1479+ ///
1480+ /// Some checks are marked as statements even though the generated code is an
1481+ /// expression. This is done when the value of the generated expression does
1482+ /// not correspond to the value of the check (usually one of its inputs).
14801483 bool isJsStatement () => false ;
14811484
14821485 bool dominates (HInstruction other) {
@@ -1782,8 +1785,6 @@ class HBoundsCheck extends HCheck {
17821785 // There can be an additional fourth input which is the index to report to
17831786 // [ioore]. This is used by the expansion of [JSArray.removeLast].
17841787 HInstruction get reportedIndex => inputs.length > 3 ? inputs[3 ] : index;
1785- @override
1786- bool isControlFlow () => true ;
17871788
17881789 @override
17891790 R accept <R >(HVisitor <R > visitor) => visitor.visitBoundsCheck (this );
@@ -1806,8 +1807,7 @@ abstract class HConditionalBranch extends HControlFlow {
18061807
18071808abstract class HControlFlow extends HInstruction {
18081809 HControlFlow () : super ._noType ();
1809- @override
1810- bool isControlFlow () => true ;
1810+
18111811 @override
18121812 bool isJsStatement () => true ;
18131813
@@ -2357,10 +2357,6 @@ class HFieldSet extends HFieldAccess {
23572357 @override
23582358 R accept <R >(HVisitor <R > visitor) => visitor.visitFieldSet (this );
23592359
2360- // HFieldSet is an expression if it has a user.
2361- @override
2362- bool isJsStatement () => usedBy.isEmpty;
2363-
23642360 @override
23652361 String toString () => "FieldSet(element=$element ,type=$instructionType )" ;
23662362}
@@ -2489,8 +2485,6 @@ class HReadModifyWrite extends HInstruction implements HLateInstruction {
24892485 @override
24902486 R accept <R >(HVisitor <R > visitor) => visitor.visitReadModifyWrite (this );
24912487
2492- @override
2493- bool isJsStatement () => isAssignOp;
24942488 @override
24952489 String toString () => "ReadModifyWrite $jsOp $opKind $element " ;
24962490}
@@ -2538,8 +2532,6 @@ class HLocalSet extends HLocalAccess {
25382532
25392533 HLocalValue get local => inputs[0 ] as HLocalValue ;
25402534 HInstruction get value => inputs[1 ];
2541- @override
2542- bool isJsStatement () => true ;
25432535}
25442536
25452537/// Invocation of a native or JS-interop method.
@@ -2699,6 +2691,7 @@ class HForeignCode extends HForeign {
26992691
27002692 @override
27012693 bool isJsStatement () => isStatement;
2694+
27022695 @override
27032696 bool canThrow (AbstractValueDomain domain) {
27042697 if (inputs.isNotEmpty) {
@@ -3648,8 +3641,6 @@ class HStaticStore extends HInstruction {
36483641 bool typeEquals (other) => other is HStaticStore ;
36493642 @override
36503643 bool dataEquals (HStaticStore other) => element == other.element;
3651- @override
3652- bool isJsStatement () => usedBy.isEmpty;
36533644}
36543645
36553646class HLiteralList extends HInstruction {
@@ -3833,8 +3824,6 @@ class HPrimitiveCheck extends HCheck {
38333824
38343825 @override
38353826 bool isJsStatement () => true ;
3836- @override
3837- bool isControlFlow () => true ;
38383827
38393828 @override
38403829 _GvnType get _gvnType => _GvnType .primitiveCheck;
@@ -3919,8 +3908,6 @@ class HNullCheck extends HCheck {
39193908 HNullCheck (super .input, super .type, {this .sticky = false })
39203909 : super ._oneInput ();
39213910
3922- @override
3923- bool isControlFlow () => true ;
39243911 @override
39253912 bool isJsStatement () => true ;
39263913
@@ -3973,9 +3960,6 @@ abstract class HLateCheck extends HCheck {
39733960 throw StateError ('HLateCheck.name: no name' );
39743961 }
39753962
3976- @override
3977- bool isControlFlow () => true ;
3978-
39793963 @override
39803964 bool isCodeMotionInvariant () => false ;
39813965}
@@ -4111,8 +4095,7 @@ class HTypeKnown extends HCheck {
41114095
41124096 @override
41134097 bool isJsStatement () => false ;
4114- @override
4115- bool isControlFlow () => false ;
4098+
41164099 @override
41174100 bool canThrow (AbstractValueDomain domain) => false ;
41184101
@@ -5017,7 +5000,7 @@ class HArrayFlagsCheck extends HCheck {
50175000 AbstractValue inputType,
50185001 AbstractValueDomain domain,
50195002 ) {
5020- // TODO(sra): Depening on the checked flags, the output is fixed-length or
5003+ // TODO(sra): Depending on the checked flags, the output is fixed-length or
50215004 // unmodifiable. Refine the type to the degree an AbstractValue can express
50225005 // that.
50235006 return inputType;
@@ -5036,8 +5019,6 @@ class HArrayFlagsCheck extends HCheck {
50365019 @override
50375020 R accept <R >(HVisitor <R > visitor) => visitor.visitArrayFlagsCheck (this );
50385021
5039- @override
5040- bool isControlFlow () => true ;
50415022 @override
50425023 bool isJsStatement () => true ;
50435024
0 commit comments