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 visitAwait(HAwait node); |
9 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
10 R visitBitNot(HBitNot node); | 11 R visitBitNot(HBitNot node); |
11 R visitBitOr(HBitOr node); | 12 R visitBitOr(HBitOr node); |
12 R visitBitXor(HBitXor node); | 13 R visitBitXor(HBitXor node); |
13 R visitBoolify(HBoolify node); | 14 R visitBoolify(HBoolify node); |
14 R visitBoundsCheck(HBoundsCheck node); | 15 R visitBoundsCheck(HBoundsCheck node); |
15 R visitBreak(HBreak node); | 16 R visitBreak(HBreak node); |
16 R visitConstant(HConstant node); | 17 R visitConstant(HConstant node); |
17 R visitContinue(HContinue node); | 18 R visitContinue(HContinue node); |
18 R visitDivide(HDivide node); | 19 R visitDivide(HDivide node); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 R visitStringify(HStringify node); | 65 R visitStringify(HStringify node); |
65 R visitSubtract(HSubtract node); | 66 R visitSubtract(HSubtract node); |
66 R visitSwitch(HSwitch node); | 67 R visitSwitch(HSwitch node); |
67 R visitThis(HThis node); | 68 R visitThis(HThis node); |
68 R visitThrow(HThrow node); | 69 R visitThrow(HThrow node); |
69 R visitThrowExpression(HThrowExpression node); | 70 R visitThrowExpression(HThrowExpression node); |
70 R visitTruncatingDivide(HTruncatingDivide node); | 71 R visitTruncatingDivide(HTruncatingDivide node); |
71 R visitTry(HTry node); | 72 R visitTry(HTry node); |
72 R visitTypeConversion(HTypeConversion node); | 73 R visitTypeConversion(HTypeConversion node); |
73 R visitTypeKnown(HTypeKnown node); | 74 R visitTypeKnown(HTypeKnown node); |
| 75 R visitYield(HYield node); |
74 R visitReadTypeVariable(HReadTypeVariable node); | 76 R visitReadTypeVariable(HReadTypeVariable node); |
75 R visitFunctionType(HFunctionType node); | 77 R visitFunctionType(HFunctionType node); |
76 R visitVoidType(HVoidType node); | 78 R visitVoidType(HVoidType node); |
77 R visitInterfaceType(HInterfaceType node); | 79 R visitInterfaceType(HInterfaceType node); |
78 R visitDynamicType(HDynamicType node); | 80 R visitDynamicType(HDynamicType node); |
79 } | 81 } |
80 | 82 |
81 abstract class HGraphVisitor { | 83 abstract class HGraphVisitor { |
82 visitDominatorTree(HGraph graph) { | 84 visitDominatorTree(HGraph graph) { |
83 void visitBasicBlockAndSuccessors(HBasicBlock block) { | 85 void visitBasicBlockAndSuccessors(HBasicBlock block) { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 visitTry(HTry node) => visitControlFlow(node); | 349 visitTry(HTry node) => visitControlFlow(node); |
348 visitIs(HIs node) => visitInstruction(node); | 350 visitIs(HIs node) => visitInstruction(node); |
349 visitIsViaInterceptor(HIsViaInterceptor node) => visitInstruction(node); | 351 visitIsViaInterceptor(HIsViaInterceptor node) => visitInstruction(node); |
350 visitTypeConversion(HTypeConversion node) => visitCheck(node); | 352 visitTypeConversion(HTypeConversion node) => visitCheck(node); |
351 visitTypeKnown(HTypeKnown node) => visitCheck(node); | 353 visitTypeKnown(HTypeKnown node) => visitCheck(node); |
352 visitReadTypeVariable(HReadTypeVariable node) => visitInstruction(node); | 354 visitReadTypeVariable(HReadTypeVariable node) => visitInstruction(node); |
353 visitFunctionType(HFunctionType node) => visitInstruction(node); | 355 visitFunctionType(HFunctionType node) => visitInstruction(node); |
354 visitVoidType(HVoidType node) => visitInstruction(node); | 356 visitVoidType(HVoidType node) => visitInstruction(node); |
355 visitInterfaceType(HInterfaceType node) => visitInstruction(node); | 357 visitInterfaceType(HInterfaceType node) => visitInstruction(node); |
356 visitDynamicType(HDynamicType node) => visitInstruction(node); | 358 visitDynamicType(HDynamicType node) => visitInstruction(node); |
| 359 visitAwait(HAwait node) => visitInstruction(node); |
| 360 visitYield(HYield node) => visitInstruction(node); |
357 } | 361 } |
358 | 362 |
359 class SubGraph { | 363 class SubGraph { |
360 // The first and last block of the sub-graph. | 364 // The first and last block of the sub-graph. |
361 final HBasicBlock start; | 365 final HBasicBlock start; |
362 final HBasicBlock end; | 366 final HBasicBlock end; |
363 | 367 |
364 const SubGraph(this.start, this.end); | 368 const SubGraph(this.start, this.end); |
365 | 369 |
366 bool contains(HBasicBlock block) { | 370 bool contains(HBasicBlock block) { |
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 } | 2231 } |
2228 | 2232 |
2229 class HThrowExpression extends HInstruction { | 2233 class HThrowExpression extends HInstruction { |
2230 HThrowExpression(value) | 2234 HThrowExpression(value) |
2231 : super(<HInstruction>[value], const TypeMask.nonNullEmpty()); | 2235 : super(<HInstruction>[value], const TypeMask.nonNullEmpty()); |
2232 toString() => 'throw expression'; | 2236 toString() => 'throw expression'; |
2233 accept(HVisitor visitor) => visitor.visitThrowExpression(this); | 2237 accept(HVisitor visitor) => visitor.visitThrowExpression(this); |
2234 bool canThrow() => true; | 2238 bool canThrow() => true; |
2235 } | 2239 } |
2236 | 2240 |
| 2241 class HAwait extends HInstruction { |
| 2242 HAwait(HInstruction value, TypeMask type) |
| 2243 : super(<HInstruction>[value], type); |
| 2244 toString() => 'await'; |
| 2245 accept(HVisitor visitor) => visitor.visitAwait(this); |
| 2246 // An await will throw if its argument is not a real future. |
| 2247 bool canThrow() => true; |
| 2248 SideEffects sideEffects = new SideEffects(); |
| 2249 } |
| 2250 |
| 2251 class HYield extends HInstruction { |
| 2252 HYield(HInstruction value, this.hasStar) |
| 2253 : super(<HInstruction>[value], const TypeMask.nonNullEmpty()); |
| 2254 bool hasStar; |
| 2255 toString() => 'yield'; |
| 2256 accept(HVisitor visitor) => visitor.visitYield(this); |
| 2257 bool canThrow() => false; |
| 2258 SideEffects sideEffects = new SideEffects(); |
| 2259 } |
| 2260 |
2237 class HThrow extends HControlFlow { | 2261 class HThrow extends HControlFlow { |
2238 final bool isRethrow; | 2262 final bool isRethrow; |
2239 HThrow(value, {this.isRethrow: false}) : super(<HInstruction>[value]); | 2263 HThrow(value, {this.isRethrow: false}) : super(<HInstruction>[value]); |
2240 toString() => 'throw'; | 2264 toString() => 'throw'; |
2241 accept(HVisitor visitor) => visitor.visitThrow(this); | 2265 accept(HVisitor visitor) => visitor.visitThrow(this); |
2242 } | 2266 } |
2243 | 2267 |
2244 class HStatic extends HInstruction { | 2268 class HStatic extends HInstruction { |
2245 final Element element; | 2269 final Element element; |
2246 HStatic(this.element, type) : super(<HInstruction>[], type) { | 2270 HStatic(this.element, type) : super(<HInstruction>[], type) { |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3100 class HDynamicType extends HRuntimeType { | 3124 class HDynamicType extends HRuntimeType { |
3101 HDynamicType(DynamicType dartType, TypeMask instructionType) | 3125 HDynamicType(DynamicType dartType, TypeMask instructionType) |
3102 : super(const <HInstruction>[], dartType, instructionType); | 3126 : super(const <HInstruction>[], dartType, instructionType); |
3103 | 3127 |
3104 accept(HVisitor visitor) => visitor.visitDynamicType(this); | 3128 accept(HVisitor visitor) => visitor.visitDynamicType(this); |
3105 | 3129 |
3106 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | 3130 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; |
3107 | 3131 |
3108 bool typeEquals(HInstruction other) => other is HDynamicType; | 3132 bool typeEquals(HInstruction other) => other is HDynamicType; |
3109 } | 3133 } |
OLD | NEW |