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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 R visitShiftRight(HShiftRight node); | 58 R visitShiftRight(HShiftRight node); |
59 R visitStatic(HStatic node); | 59 R visitStatic(HStatic node); |
60 R visitStaticStore(HStaticStore node); | 60 R visitStaticStore(HStaticStore node); |
61 R visitStringConcat(HStringConcat node); | 61 R visitStringConcat(HStringConcat node); |
62 R visitStringify(HStringify node); | 62 R visitStringify(HStringify node); |
63 R visitSubtract(HSubtract node); | 63 R visitSubtract(HSubtract node); |
64 R visitSwitch(HSwitch node); | 64 R visitSwitch(HSwitch node); |
65 R visitThis(HThis node); | 65 R visitThis(HThis node); |
66 R visitThrow(HThrow node); | 66 R visitThrow(HThrow node); |
67 R visitThrowExpression(HThrowExpression node); | 67 R visitThrowExpression(HThrowExpression node); |
| 68 R visitTruncatingDivide(HTruncatingDivide node); |
68 R visitTry(HTry node); | 69 R visitTry(HTry node); |
69 R visitTypeConversion(HTypeConversion node); | 70 R visitTypeConversion(HTypeConversion node); |
70 R visitTypeKnown(HTypeKnown node); | 71 R visitTypeKnown(HTypeKnown node); |
71 R visitReadTypeVariable(HReadTypeVariable node); | 72 R visitReadTypeVariable(HReadTypeVariable node); |
72 R visitFunctionType(HFunctionType node); | 73 R visitFunctionType(HFunctionType node); |
73 R visitVoidType(HVoidType node); | 74 R visitVoidType(HVoidType node); |
74 R visitInterfaceType(HInterfaceType node); | 75 R visitInterfaceType(HInterfaceType node); |
75 R visitDynamicType(HDynamicType node); | 76 R visitDynamicType(HDynamicType node); |
76 } | 77 } |
77 | 78 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 visitShiftRight(HShiftRight node) => visitBinaryBitOp(node); | 325 visitShiftRight(HShiftRight node) => visitBinaryBitOp(node); |
325 visitSubtract(HSubtract node) => visitBinaryArithmetic(node); | 326 visitSubtract(HSubtract node) => visitBinaryArithmetic(node); |
326 visitSwitch(HSwitch node) => visitControlFlow(node); | 327 visitSwitch(HSwitch node) => visitControlFlow(node); |
327 visitStatic(HStatic node) => visitInstruction(node); | 328 visitStatic(HStatic node) => visitInstruction(node); |
328 visitStaticStore(HStaticStore node) => visitInstruction(node); | 329 visitStaticStore(HStaticStore node) => visitInstruction(node); |
329 visitStringConcat(HStringConcat node) => visitInstruction(node); | 330 visitStringConcat(HStringConcat node) => visitInstruction(node); |
330 visitStringify(HStringify node) => visitInstruction(node); | 331 visitStringify(HStringify node) => visitInstruction(node); |
331 visitThis(HThis node) => visitParameterValue(node); | 332 visitThis(HThis node) => visitParameterValue(node); |
332 visitThrow(HThrow node) => visitControlFlow(node); | 333 visitThrow(HThrow node) => visitControlFlow(node); |
333 visitThrowExpression(HThrowExpression node) => visitInstruction(node); | 334 visitThrowExpression(HThrowExpression node) => visitInstruction(node); |
| 335 visitTruncatingDivide(HTruncatingDivide node) => visitBinaryArithmetic(node); |
334 visitTry(HTry node) => visitControlFlow(node); | 336 visitTry(HTry node) => visitControlFlow(node); |
335 visitIs(HIs node) => visitInstruction(node); | 337 visitIs(HIs node) => visitInstruction(node); |
336 visitTypeConversion(HTypeConversion node) => visitCheck(node); | 338 visitTypeConversion(HTypeConversion node) => visitCheck(node); |
337 visitTypeKnown(HTypeKnown node) => visitCheck(node); | 339 visitTypeKnown(HTypeKnown node) => visitCheck(node); |
338 visitReadTypeVariable(HReadTypeVariable node) => visitInstruction(node); | 340 visitReadTypeVariable(HReadTypeVariable node) => visitInstruction(node); |
339 visitFunctionType(HFunctionType node) => visitInstruction(node); | 341 visitFunctionType(HFunctionType node) => visitInstruction(node); |
340 visitVoidType(HVoidType node) => visitInstruction(node); | 342 visitVoidType(HVoidType node) => visitInstruction(node); |
341 visitInterfaceType(HInterfaceType node) => visitInstruction(node); | 343 visitInterfaceType(HInterfaceType node) => visitInstruction(node); |
342 visitDynamicType(HDynamicType node) => visitInstruction(node); | 344 visitDynamicType(HDynamicType node) => visitInstruction(node); |
343 } | 345 } |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 static const int INVOKE_STATIC_TYPECODE = 26; | 793 static const int INVOKE_STATIC_TYPECODE = 26; |
792 static const int INDEX_TYPECODE = 27; | 794 static const int INDEX_TYPECODE = 27; |
793 static const int IS_TYPECODE = 28; | 795 static const int IS_TYPECODE = 28; |
794 static const int INVOKE_DYNAMIC_TYPECODE = 29; | 796 static const int INVOKE_DYNAMIC_TYPECODE = 29; |
795 static const int SHIFT_RIGHT_TYPECODE = 30; | 797 static const int SHIFT_RIGHT_TYPECODE = 30; |
796 static const int READ_TYPE_VARIABLE_TYPECODE = 31; | 798 static const int READ_TYPE_VARIABLE_TYPECODE = 31; |
797 static const int FUNCTION_TYPE_TYPECODE = 32; | 799 static const int FUNCTION_TYPE_TYPECODE = 32; |
798 static const int VOID_TYPE_TYPECODE = 33; | 800 static const int VOID_TYPE_TYPECODE = 33; |
799 static const int INTERFACE_TYPE_TYPECODE = 34; | 801 static const int INTERFACE_TYPE_TYPECODE = 34; |
800 static const int DYNAMIC_TYPE_TYPECODE = 35; | 802 static const int DYNAMIC_TYPE_TYPECODE = 35; |
| 803 static const int TRUNCATING_DIVIDE_TYPECODE = 36; |
801 | 804 |
802 HInstruction(this.inputs, this.instructionType) | 805 HInstruction(this.inputs, this.instructionType) |
803 : id = idCounter++, usedBy = <HInstruction>[] { | 806 : id = idCounter++, usedBy = <HInstruction>[] { |
804 assert(inputs.every((e) => e != null)); | 807 assert(inputs.every((e) => e != null)); |
805 } | 808 } |
806 | 809 |
807 int get hashCode => id; | 810 int get hashCode => id; |
808 | 811 |
809 bool useGvn() => _useGvn; | 812 bool useGvn() => _useGvn; |
810 void setUseGvn() { _useGvn = true; } | 813 void setUseGvn() { _useGvn = true; } |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 HSubtract(left, right, selector, type) : super(left, right, selector, type); | 1675 HSubtract(left, right, selector, type) : super(left, right, selector, type); |
1673 accept(HVisitor visitor) => visitor.visitSubtract(this); | 1676 accept(HVisitor visitor) => visitor.visitSubtract(this); |
1674 | 1677 |
1675 BinaryOperation operation(ConstantSystem constantSystem) | 1678 BinaryOperation operation(ConstantSystem constantSystem) |
1676 => constantSystem.subtract; | 1679 => constantSystem.subtract; |
1677 int typeCode() => HInstruction.SUBTRACT_TYPECODE; | 1680 int typeCode() => HInstruction.SUBTRACT_TYPECODE; |
1678 bool typeEquals(other) => other is HSubtract; | 1681 bool typeEquals(other) => other is HSubtract; |
1679 bool dataEquals(HInstruction other) => true; | 1682 bool dataEquals(HInstruction other) => true; |
1680 } | 1683 } |
1681 | 1684 |
| 1685 class HTruncatingDivide extends HBinaryArithmetic { |
| 1686 HTruncatingDivide(left, right, selector, type) |
| 1687 : super(left, right, selector, type); |
| 1688 accept(HVisitor visitor) => visitor.visitTruncatingDivide(this); |
| 1689 |
| 1690 BinaryOperation operation(ConstantSystem constantSystem) |
| 1691 => constantSystem.truncatingDivide; |
| 1692 int typeCode() => HInstruction.TRUNCATING_DIVIDE_TYPECODE; |
| 1693 bool typeEquals(other) => other is HTruncatingDivide; |
| 1694 bool dataEquals(HInstruction other) => true; |
| 1695 } |
| 1696 |
1682 /** | 1697 /** |
1683 * An [HSwitch] instruction has one input for the incoming | 1698 * An [HSwitch] instruction has one input for the incoming |
1684 * value, and one input per constant that it can switch on. | 1699 * value, and one input per constant that it can switch on. |
1685 * Its block has one successor per constant, and one for the default. | 1700 * Its block has one successor per constant, and one for the default. |
1686 */ | 1701 */ |
1687 class HSwitch extends HControlFlow { | 1702 class HSwitch extends HControlFlow { |
1688 HSwitch(List<HInstruction> inputs) : super(inputs); | 1703 HSwitch(List<HInstruction> inputs) : super(inputs); |
1689 | 1704 |
1690 HConstant constant(int index) => inputs[index + 1]; | 1705 HConstant constant(int index) => inputs[index + 1]; |
1691 HInstruction get expression => inputs[0]; | 1706 HInstruction get expression => inputs[0]; |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2884 class HDynamicType extends HRuntimeType { | 2899 class HDynamicType extends HRuntimeType { |
2885 HDynamicType(DynamicType dartType, TypeMask instructionType) | 2900 HDynamicType(DynamicType dartType, TypeMask instructionType) |
2886 : super(const <HInstruction>[], dartType, instructionType); | 2901 : super(const <HInstruction>[], dartType, instructionType); |
2887 | 2902 |
2888 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 2903 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
2889 | 2904 |
2890 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 2905 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
2891 | 2906 |
2892 bool typeEquals(HInstruction other) => other is HDynamicType; | 2907 bool typeEquals(HInstruction other) => other is HDynamicType; |
2893 } | 2908 } |
OLD | NEW |