| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 interface HVisitor<R> { | 5 interface HVisitor<R> { |
| 6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
| 7 R visitBitAnd(HBitAnd node); | 7 R visitBitAnd(HBitAnd node); |
| 8 R visitBitNot(HBitNot node); | 8 R visitBitNot(HBitNot node); |
| 9 R visitBitOr(HBitOr node); | 9 R visitBitOr(HBitOr node); |
| 10 R visitBitXor(HBitXor node); | 10 R visitBitXor(HBitXor node); |
| (...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2377 | 2377 |
| 2378 HBasicBlock get start() => body.start; | 2378 HBasicBlock get start() => body.start; |
| 2379 HBasicBlock get end() => body.end; | 2379 HBasicBlock get end() => body.end; |
| 2380 | 2380 |
| 2381 bool accept(HStatementInformationVisitor visitor) => | 2381 bool accept(HStatementInformationVisitor visitor) => |
| 2382 visitor.visitLabeledBlockInfo(this); | 2382 visitor.visitLabeledBlockInfo(this); |
| 2383 } | 2383 } |
| 2384 | 2384 |
| 2385 class LoopTypeVisitor extends AbstractVisitor { | 2385 class LoopTypeVisitor extends AbstractVisitor { |
| 2386 const LoopTypeVisitor(); | 2386 const LoopTypeVisitor(); |
| 2387 int visitNode(Node node) { | 2387 int visitNode(Node node) => HLoopBlockInformation.NOT_A_LOOP; |
| 2388 // TODO(lrn): Need a compiler object here. | |
| 2389 compiler.internalError('visitNode should not be called', node: node); | |
| 2390 } | |
| 2391 int visitWhile(While node) => HLoopBlockInformation.WHILE_LOOP; | 2388 int visitWhile(While node) => HLoopBlockInformation.WHILE_LOOP; |
| 2392 int visitFor(For node) => HLoopBlockInformation.FOR_LOOP; | 2389 int visitFor(For node) => HLoopBlockInformation.FOR_LOOP; |
| 2393 int visitDoWhile(DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; | 2390 int visitDoWhile(DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; |
| 2394 int visitForIn(ForIn node) => HLoopBlockInformation.FOR_IN_LOOP; | 2391 int visitForIn(ForIn node) => HLoopBlockInformation.FOR_IN_LOOP; |
| 2395 } | 2392 } |
| 2396 | 2393 |
| 2397 class HLoopBlockInformation implements HStatementInformation { | 2394 class HLoopBlockInformation implements HStatementInformation { |
| 2398 static final int WHILE_LOOP = 0; | 2395 static final int WHILE_LOOP = 0; |
| 2399 static final int FOR_LOOP = 1; | 2396 static final int FOR_LOOP = 1; |
| 2400 static final int DO_WHILE_LOOP = 2; | 2397 static final int DO_WHILE_LOOP = 2; |
| 2401 static final int FOR_IN_LOOP = 3; | 2398 static final int FOR_IN_LOOP = 3; |
| 2399 static final int NOT_A_LOOP = -1; |
| 2402 | 2400 |
| 2403 final int kind; | 2401 final int kind; |
| 2404 final HExpressionInformation initializer; | 2402 final HExpressionInformation initializer; |
| 2405 final HExpressionInformation condition; | 2403 final HExpressionInformation condition; |
| 2406 final HStatementInformation body; | 2404 final HStatementInformation body; |
| 2407 final HExpressionInformation updates; | 2405 final HExpressionInformation updates; |
| 2408 final TargetElement target; | 2406 final TargetElement target; |
| 2409 final List<LabelElement> labels; | 2407 final List<LabelElement> labels; |
| 2410 | 2408 |
| 2411 HLoopBlockInformation(this.kind, | 2409 HLoopBlockInformation(this.kind, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2461 final HExpressionInformation right; | 2459 final HExpressionInformation right; |
| 2462 HAndOrBlockInformation(this.isAnd, | 2460 HAndOrBlockInformation(this.isAnd, |
| 2463 this.left, | 2461 this.left, |
| 2464 this.right); | 2462 this.right); |
| 2465 | 2463 |
| 2466 HBasicBlock get start() => left.start; | 2464 HBasicBlock get start() => left.start; |
| 2467 HBasicBlock get end() => right.end; | 2465 HBasicBlock get end() => right.end; |
| 2468 | 2466 |
| 2469 // We don't currently use HAndOrBlockInformation. | 2467 // We don't currently use HAndOrBlockInformation. |
| 2470 HInstruction get conditionExpression() { | 2468 HInstruction get conditionExpression() { |
| 2471 // TODO(lrn): Need a compiler object. | 2469 return null; |
| 2472 compiler.internalError('conditionExpression should not be called', | |
| 2473 instruction: this); | |
| 2474 } | 2470 } |
| 2475 bool accept(HExpressionInformationVisitor visitor) => | 2471 bool accept(HExpressionInformationVisitor visitor) => |
| 2476 visitor.visitAndOrInfo(this); | 2472 visitor.visitAndOrInfo(this); |
| 2477 } | 2473 } |
| 2478 | 2474 |
| 2479 class HTryBlockInformation implements HStatementInformation { | 2475 class HTryBlockInformation implements HStatementInformation { |
| 2480 final HStatementInformation body; | 2476 final HStatementInformation body; |
| 2481 final HParameterValue catchVariable; | 2477 final HParameterValue catchVariable; |
| 2482 final HStatementInformation catchBlock; | 2478 final HStatementInformation catchBlock; |
| 2483 final HStatementInformation finallyBlock; | 2479 final HStatementInformation finallyBlock; |
| 2484 HTryBlockInformation(this.body, | 2480 HTryBlockInformation(this.body, |
| 2485 this.catchVariable, | 2481 this.catchVariable, |
| 2486 this.catchBlock, | 2482 this.catchBlock, |
| 2487 this.finallyBlock); | 2483 this.finallyBlock); |
| 2488 | 2484 |
| 2489 HBasicBlock get start() => body.start; | 2485 HBasicBlock get start() => body.start; |
| 2490 HBasicBlock get end() => | 2486 HBasicBlock get end() => |
| 2491 finallyBlock === null ? catchBlock.end : finallyBlock.end; | 2487 finallyBlock === null ? catchBlock.end : finallyBlock.end; |
| 2492 | 2488 |
| 2493 bool accept(HStatementInformationVisitor visitor) => | 2489 bool accept(HStatementInformationVisitor visitor) => |
| 2494 visitor.visitTryInfo(this); | 2490 visitor.visitTryInfo(this); |
| 2495 } | 2491 } |
| OLD | NEW |