Chromium Code Reviews| 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 visitBailoutTarget(HBailoutTarget node); | 9 R visitBailoutTarget(HBailoutTarget node); |
| 10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 R visitReturn(HReturn node); | 57 R visitReturn(HReturn node); |
| 58 R visitShiftLeft(HShiftLeft node); | 58 R visitShiftLeft(HShiftLeft 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 visitTry(HTry node); | 68 R visitTry(HTry node); |
| 68 R visitTypeGuard(HTypeGuard node); | 69 R visitTypeGuard(HTypeGuard node); |
| 69 R visitTypeConversion(HTypeConversion node); | 70 R visitTypeConversion(HTypeConversion node); |
| 70 } | 71 } |
| 71 | 72 |
| 72 abstract class HGraphVisitor { | 73 abstract class HGraphVisitor { |
| 73 visitDominatorTree(HGraph graph) { | 74 visitDominatorTree(HGraph graph) { |
| 74 void visitBasicBlockAndSuccessors(HBasicBlock block) { | 75 void visitBasicBlockAndSuccessors(HBasicBlock block) { |
| 75 visitBasicBlock(block); | 76 visitBasicBlock(block); |
| 76 List dominated = block.dominatedBlocks; | 77 List dominated = block.dominatedBlocks; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 visitReturn(HReturn node) => visitControlFlow(node); | 333 visitReturn(HReturn node) => visitControlFlow(node); |
| 333 visitShiftLeft(HShiftLeft node) => visitBinaryBitOp(node); | 334 visitShiftLeft(HShiftLeft node) => visitBinaryBitOp(node); |
| 334 visitSubtract(HSubtract node) => visitBinaryArithmetic(node); | 335 visitSubtract(HSubtract node) => visitBinaryArithmetic(node); |
| 335 visitSwitch(HSwitch node) => visitControlFlow(node); | 336 visitSwitch(HSwitch node) => visitControlFlow(node); |
| 336 visitStatic(HStatic node) => visitInstruction(node); | 337 visitStatic(HStatic node) => visitInstruction(node); |
| 337 visitStaticStore(HStaticStore node) => visitInstruction(node); | 338 visitStaticStore(HStaticStore node) => visitInstruction(node); |
| 338 visitStringConcat(HStringConcat node) => visitInstruction(node); | 339 visitStringConcat(HStringConcat node) => visitInstruction(node); |
| 339 visitStringify(HStringify node) => visitInstruction(node); | 340 visitStringify(HStringify node) => visitInstruction(node); |
| 340 visitThis(HThis node) => visitParameterValue(node); | 341 visitThis(HThis node) => visitParameterValue(node); |
| 341 visitThrow(HThrow node) => visitControlFlow(node); | 342 visitThrow(HThrow node) => visitControlFlow(node); |
| 343 visitThrowExpression(HThrowExpression node) => visitInstruction(node); | |
| 342 visitTry(HTry node) => visitControlFlow(node); | 344 visitTry(HTry node) => visitControlFlow(node); |
| 343 visitTypeGuard(HTypeGuard node) => visitCheck(node); | 345 visitTypeGuard(HTypeGuard node) => visitCheck(node); |
| 344 visitIs(HIs node) => visitInstruction(node); | 346 visitIs(HIs node) => visitInstruction(node); |
| 345 visitTypeConversion(HTypeConversion node) => visitCheck(node); | 347 visitTypeConversion(HTypeConversion node) => visitCheck(node); |
| 346 } | 348 } |
| 347 | 349 |
| 348 class SubGraph { | 350 class SubGraph { |
| 349 // The first and last block of the sub-graph. | 351 // The first and last block of the sub-graph. |
| 350 final HBasicBlock start; | 352 final HBasicBlock start; |
| 351 final HBasicBlock end; | 353 final HBasicBlock end; |
| (...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2011 bool typeEquals(other) => other is HLessEqual; | 2013 bool typeEquals(other) => other is HLessEqual; |
| 2012 bool dataEquals(HInstruction other) => true; | 2014 bool dataEquals(HInstruction other) => true; |
| 2013 } | 2015 } |
| 2014 | 2016 |
| 2015 class HReturn extends HControlFlow { | 2017 class HReturn extends HControlFlow { |
| 2016 HReturn(value) : super(<HInstruction>[value]); | 2018 HReturn(value) : super(<HInstruction>[value]); |
| 2017 toString() => 'return'; | 2019 toString() => 'return'; |
| 2018 accept(HVisitor visitor) => visitor.visitReturn(this); | 2020 accept(HVisitor visitor) => visitor.visitReturn(this); |
| 2019 } | 2021 } |
| 2020 | 2022 |
| 2023 class HThrowExpression extends HInstruction { | |
|
karlklose
2013/04/09 11:58:46
Shouldn't this extends HControlFlow?
ngeoffray
2013/04/10 12:06:39
Wouldn't it be simpler to have HTrow be treated as
erikcorry
2013/04/10 12:52:32
I don't think so.
erikcorry
2013/04/10 12:52:32
No, we can't do control flow (closing the block wi
| |
| 2024 HThrowExpression(value) : super(<HInstruction>[value]); | |
| 2025 toString() => 'throwexpression'; | |
| 2026 accept(HVisitor visitor) => visitor.visitThrowExpression(this); | |
| 2027 bool canThrow() => true; | |
| 2028 } | |
| 2029 | |
| 2021 class HThrow extends HControlFlow { | 2030 class HThrow extends HControlFlow { |
| 2022 final bool isRethrow; | 2031 final bool isRethrow; |
| 2023 HThrow(value, {this.isRethrow: false}) : super(<HInstruction>[value]); | 2032 HThrow(value, {this.isRethrow: false}) : super(<HInstruction>[value]); |
| 2024 toString() => 'throw'; | 2033 toString() => 'throw'; |
| 2025 accept(HVisitor visitor) => visitor.visitThrow(this); | 2034 accept(HVisitor visitor) => visitor.visitThrow(this); |
| 2026 } | 2035 } |
| 2027 | 2036 |
| 2028 class HStatic extends HInstruction { | 2037 class HStatic extends HInstruction { |
| 2029 final Element element; | 2038 final Element element; |
| 2030 HStatic(this.element) : super(<HInstruction>[]) { | 2039 HStatic(this.element) : super(<HInstruction>[]) { |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2638 HBasicBlock get start => expression.start; | 2647 HBasicBlock get start => expression.start; |
| 2639 HBasicBlock get end { | 2648 HBasicBlock get end { |
| 2640 // We don't create a switch block if there are no cases. | 2649 // We don't create a switch block if there are no cases. |
| 2641 assert(!statements.isEmpty); | 2650 assert(!statements.isEmpty); |
| 2642 return statements.last.end; | 2651 return statements.last.end; |
| 2643 } | 2652 } |
| 2644 | 2653 |
| 2645 bool accept(HStatementInformationVisitor visitor) => | 2654 bool accept(HStatementInformationVisitor visitor) => |
| 2646 visitor.visitSwitchInfo(this); | 2655 visitor.visitSwitchInfo(this); |
| 2647 } | 2656 } |
| OLD | NEW |