| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 abstract class HVisitor<R> { | 7 abstract class HVisitor<R> { |
| 8 R visitAdd(HAdd node); | 8 R visitAdd(HAdd node); |
| 9 R visitBitAnd(HBitAnd node); | 9 R visitBitAnd(HBitAnd node); |
| 10 R visitBitNot(HBitNot node); | 10 R visitBitNot(HBitNot node); |
| (...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 accept(HVisitor visitor) => visitor.visitLocalSet(this); | 1564 accept(HVisitor visitor) => visitor.visitLocalSet(this); |
| 1565 | 1565 |
| 1566 HLocalValue get local => inputs[0]; | 1566 HLocalValue get local => inputs[0]; |
| 1567 HInstruction get value => inputs[1]; | 1567 HInstruction get value => inputs[1]; |
| 1568 bool isJsStatement() => true; | 1568 bool isJsStatement() => true; |
| 1569 } | 1569 } |
| 1570 | 1570 |
| 1571 class HForeign extends HInstruction { | 1571 class HForeign extends HInstruction { |
| 1572 final js.Node codeAst; | 1572 final js.Node codeAst; |
| 1573 final bool isStatement; | 1573 final bool isStatement; |
| 1574 final bool _canThrow; |
| 1574 final native.NativeBehavior nativeBehavior; | 1575 final native.NativeBehavior nativeBehavior; |
| 1575 | 1576 |
| 1576 HForeign(this.codeAst, | 1577 HForeign(this.codeAst, |
| 1577 TypeMask type, | 1578 TypeMask type, |
| 1578 List<HInstruction> inputs, | 1579 List<HInstruction> inputs, |
| 1579 {this.isStatement: false, | 1580 {this.isStatement: false, |
| 1580 SideEffects effects, | 1581 SideEffects effects, |
| 1581 native.NativeBehavior nativeBehavior}) | 1582 native.NativeBehavior nativeBehavior, |
| 1582 : this.nativeBehavior = nativeBehavior, super(inputs, type) { | 1583 canThrow: false}) |
| 1584 : this.nativeBehavior = nativeBehavior, |
| 1585 this._canThrow = canThrow, |
| 1586 super(inputs, type) { |
| 1583 if (effects == null && nativeBehavior != null) { | 1587 if (effects == null && nativeBehavior != null) { |
| 1584 effects = nativeBehavior.sideEffects; | 1588 effects = nativeBehavior.sideEffects; |
| 1585 } | 1589 } |
| 1586 if (effects != null) sideEffects.add(effects); | 1590 if (effects != null) sideEffects.add(effects); |
| 1587 } | 1591 } |
| 1588 | 1592 |
| 1589 HForeign.statement(codeAst, List<HInstruction> inputs, | 1593 HForeign.statement(codeAst, List<HInstruction> inputs, |
| 1590 SideEffects effects, | 1594 SideEffects effects, |
| 1591 native.NativeBehavior nativeBehavior, | 1595 native.NativeBehavior nativeBehavior, |
| 1592 TypeMask type) | 1596 TypeMask type) |
| 1593 : this(codeAst, type, inputs, isStatement: true, | 1597 : this(codeAst, type, inputs, isStatement: true, |
| 1594 effects: effects, nativeBehavior: nativeBehavior); | 1598 effects: effects, nativeBehavior: nativeBehavior); |
| 1595 | 1599 |
| 1596 accept(HVisitor visitor) => visitor.visitForeign(this); | 1600 accept(HVisitor visitor) => visitor.visitForeign(this); |
| 1597 | 1601 |
| 1598 bool isJsStatement() => isStatement; | 1602 bool isJsStatement() => isStatement; |
| 1599 bool canThrow() { | 1603 bool canThrow() { |
| 1600 return sideEffects.hasSideEffects() || sideEffects.dependsOnSomething(); | 1604 return _canThrow |
| 1605 || sideEffects.hasSideEffects() |
| 1606 || sideEffects.dependsOnSomething(); |
| 1601 } | 1607 } |
| 1602 } | 1608 } |
| 1603 | 1609 |
| 1604 class HForeignNew extends HForeign { | 1610 class HForeignNew extends HForeign { |
| 1605 ClassElement element; | 1611 ClassElement element; |
| 1606 | 1612 |
| 1607 /// If this field is not `null`, this call is from an inlined constructor and | 1613 /// If this field is not `null`, this call is from an inlined constructor and |
| 1608 /// we have to register the instantiated type in the code generator. | 1614 /// we have to register the instantiated type in the code generator. |
| 1609 /// The [instructionType] of this node is not enough, because we also need | 1615 /// The [instructionType] of this node is not enough, because we also need |
| 1610 /// the type arguments. See also [SsaBuilder.currentInlinedInstantiations]. | 1616 /// the type arguments. See also [SsaBuilder.currentInlinedInstantiations]. |
| (...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2820 HBasicBlock get start => expression.start; | 2826 HBasicBlock get start => expression.start; |
| 2821 HBasicBlock get end { | 2827 HBasicBlock get end { |
| 2822 // We don't create a switch block if there are no cases. | 2828 // We don't create a switch block if there are no cases. |
| 2823 assert(!statements.isEmpty); | 2829 assert(!statements.isEmpty); |
| 2824 return statements.last.end; | 2830 return statements.last.end; |
| 2825 } | 2831 } |
| 2826 | 2832 |
| 2827 bool accept(HStatementInformationVisitor visitor) => | 2833 bool accept(HStatementInformationVisitor visitor) => |
| 2828 visitor.visitSwitchInfo(this); | 2834 visitor.visitSwitchInfo(this); |
| 2829 } | 2835 } |
| OLD | NEW |