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 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 const TypeMask.nonNullEmpty()); | 1633 const TypeMask.nonNullEmpty()); |
1634 | 1634 |
1635 accept(HVisitor visitor) => visitor.visitLocalSet(this); | 1635 accept(HVisitor visitor) => visitor.visitLocalSet(this); |
1636 | 1636 |
1637 HLocalValue get local => inputs[0]; | 1637 HLocalValue get local => inputs[0]; |
1638 HInstruction get value => inputs[1]; | 1638 HInstruction get value => inputs[1]; |
1639 bool isJsStatement() => true; | 1639 bool isJsStatement() => true; |
1640 } | 1640 } |
1641 | 1641 |
1642 class HForeign extends HInstruction { | 1642 class HForeign extends HInstruction { |
1643 final js.Node codeAst; | 1643 final js.Template codeTemplate; |
1644 final bool isStatement; | 1644 final bool isStatement; |
1645 final bool _canThrow; | 1645 final bool _canThrow; |
1646 final native.NativeBehavior nativeBehavior; | 1646 final native.NativeBehavior nativeBehavior; |
1647 | 1647 |
1648 HForeign(this.codeAst, | 1648 HForeign(this.codeTemplate, |
1649 TypeMask type, | 1649 TypeMask type, |
1650 List<HInstruction> inputs, | 1650 List<HInstruction> inputs, |
1651 {this.isStatement: false, | 1651 {this.isStatement: false, |
1652 SideEffects effects, | 1652 SideEffects effects, |
1653 native.NativeBehavior nativeBehavior, | 1653 native.NativeBehavior nativeBehavior, |
1654 canThrow: false}) | 1654 canThrow: false}) |
1655 : this.nativeBehavior = nativeBehavior, | 1655 : this.nativeBehavior = nativeBehavior, |
1656 this._canThrow = canThrow, | 1656 this._canThrow = canThrow, |
1657 super(inputs, type) { | 1657 super(inputs, type) { |
1658 if (effects == null && nativeBehavior != null) { | 1658 if (effects == null && nativeBehavior != null) { |
1659 effects = nativeBehavior.sideEffects; | 1659 effects = nativeBehavior.sideEffects; |
1660 } | 1660 } |
1661 if (effects != null) sideEffects.add(effects); | 1661 if (effects != null) sideEffects.add(effects); |
1662 } | 1662 } |
1663 | 1663 |
1664 HForeign.statement(codeAst, List<HInstruction> inputs, | 1664 HForeign.statement(codeTemplate, List<HInstruction> inputs, |
1665 SideEffects effects, | 1665 SideEffects effects, |
1666 native.NativeBehavior nativeBehavior, | 1666 native.NativeBehavior nativeBehavior, |
1667 TypeMask type) | 1667 TypeMask type) |
1668 : this(codeAst, type, inputs, isStatement: true, | 1668 : this(codeTemplate, type, inputs, isStatement: true, |
1669 effects: effects, nativeBehavior: nativeBehavior); | 1669 effects: effects, nativeBehavior: nativeBehavior); |
1670 | 1670 |
1671 accept(HVisitor visitor) => visitor.visitForeign(this); | 1671 accept(HVisitor visitor) => visitor.visitForeign(this); |
1672 | 1672 |
1673 bool isJsStatement() => isStatement; | 1673 bool isJsStatement() => isStatement; |
1674 bool canThrow() { | 1674 bool canThrow() { |
1675 return _canThrow | 1675 return _canThrow |
1676 || sideEffects.hasSideEffects() | 1676 || sideEffects.hasSideEffects() |
1677 || sideEffects.dependsOnSomething(); | 1677 || sideEffects.dependsOnSomething(); |
1678 } | 1678 } |
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3025 class HDynamicType extends HRuntimeType { | 3025 class HDynamicType extends HRuntimeType { |
3026 HDynamicType(DynamicType dartType, TypeMask instructionType) | 3026 HDynamicType(DynamicType dartType, TypeMask instructionType) |
3027 : super(const <HInstruction>[], dartType, instructionType); | 3027 : super(const <HInstruction>[], dartType, instructionType); |
3028 | 3028 |
3029 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 3029 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
3030 | 3030 |
3031 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 3031 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
3032 | 3032 |
3033 bool typeEquals(HInstruction other) => other is HDynamicType; | 3033 bool typeEquals(HInstruction other) => other is HDynamicType; |
3034 } | 3034 } |
OLD | NEW |