Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart

Issue 11366085: Fix control flow graph in the presence of aborting instructions in a try/catch/finally. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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);
11 R visitBitNot(HBitNot node); 11 R visitBitNot(HBitNot node);
12 R visitBitOr(HBitOr node); 12 R visitBitOr(HBitOr node);
13 R visitBitXor(HBitXor node); 13 R visitBitXor(HBitXor node);
14 R visitBoolify(HBoolify node); 14 R visitBoolify(HBoolify node);
15 R visitBoundsCheck(HBoundsCheck node); 15 R visitBoundsCheck(HBoundsCheck node);
16 R visitBreak(HBreak node); 16 R visitBreak(HBreak node);
17 R visitConstant(HConstant node); 17 R visitConstant(HConstant node);
18 R visitContinue(HContinue node); 18 R visitContinue(HContinue node);
19 R visitDivide(HDivide node); 19 R visitDivide(HDivide node);
20 R visitEquals(HEquals node); 20 R visitEquals(HEquals node);
21 R visitExit(HExit node); 21 R visitExit(HExit node);
22 R visitExitTry(HExitTry node);
22 R visitFieldGet(HFieldGet node); 23 R visitFieldGet(HFieldGet node);
23 R visitFieldSet(HFieldSet node); 24 R visitFieldSet(HFieldSet node);
24 R visitForeign(HForeign node); 25 R visitForeign(HForeign node);
25 R visitForeignNew(HForeignNew node); 26 R visitForeignNew(HForeignNew node);
26 R visitGoto(HGoto node); 27 R visitGoto(HGoto node);
27 R visitGreater(HGreater node); 28 R visitGreater(HGreater node);
28 R visitGreaterEqual(HGreaterEqual node); 29 R visitGreaterEqual(HGreaterEqual node);
29 R visitIdentity(HIdentity node); 30 R visitIdentity(HIdentity node);
30 R visitIf(HIf node); 31 R visitIf(HIf node);
31 R visitIndex(HIndex node); 32 R visitIndex(HIndex node);
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 visitBitXor(HBitXor node) => visitBinaryBitOp(node); 273 visitBitXor(HBitXor node) => visitBinaryBitOp(node);
273 visitBoolify(HBoolify node) => visitInstruction(node); 274 visitBoolify(HBoolify node) => visitInstruction(node);
274 visitBoundsCheck(HBoundsCheck node) => visitCheck(node); 275 visitBoundsCheck(HBoundsCheck node) => visitCheck(node);
275 visitBreak(HBreak node) => visitJump(node); 276 visitBreak(HBreak node) => visitJump(node);
276 visitContinue(HContinue node) => visitJump(node); 277 visitContinue(HContinue node) => visitJump(node);
277 visitCheck(HCheck node) => visitInstruction(node); 278 visitCheck(HCheck node) => visitInstruction(node);
278 visitConstant(HConstant node) => visitInstruction(node); 279 visitConstant(HConstant node) => visitInstruction(node);
279 visitDivide(HDivide node) => visitBinaryArithmetic(node); 280 visitDivide(HDivide node) => visitBinaryArithmetic(node);
280 visitEquals(HEquals node) => visitRelational(node); 281 visitEquals(HEquals node) => visitRelational(node);
281 visitExit(HExit node) => visitControlFlow(node); 282 visitExit(HExit node) => visitControlFlow(node);
283 visitExitTry(HExitTry node) => visitControlFlow(node);
282 visitFieldGet(HFieldGet node) => visitFieldAccess(node); 284 visitFieldGet(HFieldGet node) => visitFieldAccess(node);
283 visitFieldSet(HFieldSet node) => visitFieldAccess(node); 285 visitFieldSet(HFieldSet node) => visitFieldAccess(node);
284 visitForeign(HForeign node) => visitInstruction(node); 286 visitForeign(HForeign node) => visitInstruction(node);
285 visitForeignNew(HForeignNew node) => visitForeign(node); 287 visitForeignNew(HForeignNew node) => visitForeign(node);
286 visitGoto(HGoto node) => visitControlFlow(node); 288 visitGoto(HGoto node) => visitControlFlow(node);
287 visitGreater(HGreater node) => visitRelational(node); 289 visitGreater(HGreater node) => visitRelational(node);
288 visitGreaterEqual(HGreaterEqual node) => visitRelational(node); 290 visitGreaterEqual(HGreaterEqual node) => visitRelational(node);
289 visitIdentity(HIdentity node) => visitRelational(node); 291 visitIdentity(HIdentity node) => visitRelational(node);
290 visitIf(HIf node) => visitConditionalBranch(node); 292 visitIf(HIf node) => visitConditionalBranch(node);
291 visitIndex(HIndex node) => visitInvokeStatic(node); 293 visitIndex(HIndex node) => visitInvokeStatic(node);
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 class HTry extends HControlFlow { 2028 class HTry extends HControlFlow {
2027 HParameterValue exception; 2029 HParameterValue exception;
2028 HBasicBlock catchBlock; 2030 HBasicBlock catchBlock;
2029 HBasicBlock finallyBlock; 2031 HBasicBlock finallyBlock;
2030 HTry() : super(const <HInstruction>[]); 2032 HTry() : super(const <HInstruction>[]);
2031 toString() => 'try'; 2033 toString() => 'try';
2032 accept(HVisitor visitor) => visitor.visitTry(this); 2034 accept(HVisitor visitor) => visitor.visitTry(this);
2033 HBasicBlock get joinBlock => this.block.successors.last; 2035 HBasicBlock get joinBlock => this.block.successors.last;
2034 } 2036 }
2035 2037
2038 // An [HExitTry] control flow node is used when the body of a try or
2039 // the body of a catch contains a return, break or continue. To build
2040 // the control flow graph, we explicitely mark the body that
2041 // leads to one of this instruction a predecessor of catch and
2042 // finally.
2043 class HExitTry extends HControlFlow {
2044 HExitTry() : super(const <HInstruction>[]);
2045 toString() => 'exit try';
2046 accept(HVisitor visitor) => visitor.visitExitTry(this);
2047 HBasicBlock get bodyTrySuccessor => block.successors[0];
2048 }
2049
2036 class HIf extends HConditionalBranch { 2050 class HIf extends HConditionalBranch {
2037 HBlockFlow blockInformation = null; 2051 HBlockFlow blockInformation = null;
2038 HIf(HInstruction condition) : super(<HInstruction>[condition]); 2052 HIf(HInstruction condition) : super(<HInstruction>[condition]);
2039 toString() => 'if'; 2053 toString() => 'if';
2040 accept(HVisitor visitor) => visitor.visitIf(this); 2054 accept(HVisitor visitor) => visitor.visitIf(this);
2041 2055
2042 HBasicBlock get thenBlock { 2056 HBasicBlock get thenBlock {
2043 assert(identical(block.dominatedBlocks[0], block.successors[0])); 2057 assert(identical(block.dominatedBlocks[0], block.successors[0]));
2044 return block.successors[0]; 2058 return block.successors[0];
2045 } 2059 }
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 HBasicBlock get start => expression.start; 3016 HBasicBlock get start => expression.start;
3003 HBasicBlock get end { 3017 HBasicBlock get end {
3004 // We don't create a switch block if there are no cases. 3018 // We don't create a switch block if there are no cases.
3005 assert(!statements.isEmpty); 3019 assert(!statements.isEmpty);
3006 return statements.last.end; 3020 return statements.last.end;
3007 } 3021 }
3008 3022
3009 bool accept(HStatementInformationVisitor visitor) => 3023 bool accept(HStatementInformationVisitor visitor) =>
3010 visitor.visitSwitchInfo(this); 3024 visitor.visitSwitchInfo(this);
3011 } 3025 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/codegen.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698