Chromium Code Reviews| 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 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2370 | 2370 |
| 2371 HBasicBlock get start() => body.start; | 2371 HBasicBlock get start() => body.start; |
| 2372 HBasicBlock get end() => body.end; | 2372 HBasicBlock get end() => body.end; |
| 2373 | 2373 |
| 2374 bool accept(HStatementInformationVisitor visitor) => | 2374 bool accept(HStatementInformationVisitor visitor) => |
| 2375 visitor.visitLabeledBlockInfo(this); | 2375 visitor.visitLabeledBlockInfo(this); |
| 2376 } | 2376 } |
| 2377 | 2377 |
| 2378 class LoopTypeVisitor extends AbstractVisitor { | 2378 class LoopTypeVisitor extends AbstractVisitor { |
| 2379 const LoopTypeVisitor(); | 2379 const LoopTypeVisitor(); |
| 2380 int visitNode(Node node) { | 2380 int visitNode(Node node) => -1; |
|
karlklose
2012/06/04 11:54:32
NOT_A_LOOP?
Lasse Reichstein Nielsen
2012/06/04 12:09:17
Done.
| |
| 2381 // TODO(lrn): Need a compiler object here. | |
| 2382 compiler.internalError('visitNode should not be called', node: node); | |
| 2383 } | |
| 2384 int visitWhile(While node) => HLoopBlockInformation.WHILE_LOOP; | 2381 int visitWhile(While node) => HLoopBlockInformation.WHILE_LOOP; |
| 2385 int visitFor(For node) => HLoopBlockInformation.FOR_LOOP; | 2382 int visitFor(For node) => HLoopBlockInformation.FOR_LOOP; |
| 2386 int visitDoWhile(DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; | 2383 int visitDoWhile(DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; |
| 2387 int visitForIn(ForIn node) => HLoopBlockInformation.FOR_IN_LOOP; | 2384 int visitForIn(ForIn node) => HLoopBlockInformation.FOR_IN_LOOP; |
| 2388 } | 2385 } |
| 2389 | 2386 |
| 2390 class HLoopBlockInformation implements HStatementInformation { | 2387 class HLoopBlockInformation implements HStatementInformation { |
| 2391 static final int WHILE_LOOP = 0; | 2388 static final int WHILE_LOOP = 0; |
| 2392 static final int FOR_LOOP = 1; | 2389 static final int FOR_LOOP = 1; |
| 2393 static final int DO_WHILE_LOOP = 2; | 2390 static final int DO_WHILE_LOOP = 2; |
| 2394 static final int FOR_IN_LOOP = 3; | 2391 static final int FOR_IN_LOOP = 3; |
| 2392 static final int NOT_A_LOOP = -1; | |
| 2395 | 2393 |
| 2396 final int kind; | 2394 final int kind; |
| 2397 final HExpressionInformation initializer; | 2395 final HExpressionInformation initializer; |
| 2398 final HExpressionInformation condition; | 2396 final HExpressionInformation condition; |
| 2399 final HStatementInformation body; | 2397 final HStatementInformation body; |
| 2400 final HExpressionInformation updates; | 2398 final HExpressionInformation updates; |
| 2401 final TargetElement target; | 2399 final TargetElement target; |
| 2402 final List<LabelElement> labels; | 2400 final List<LabelElement> labels; |
| 2403 | 2401 |
| 2404 HLoopBlockInformation(this.kind, | 2402 HLoopBlockInformation(this.kind, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2454 final HExpressionInformation right; | 2452 final HExpressionInformation right; |
| 2455 HAndOrBlockInformation(this.isAnd, | 2453 HAndOrBlockInformation(this.isAnd, |
| 2456 this.left, | 2454 this.left, |
| 2457 this.right); | 2455 this.right); |
| 2458 | 2456 |
| 2459 HBasicBlock get start() => left.start; | 2457 HBasicBlock get start() => left.start; |
| 2460 HBasicBlock get end() => right.end; | 2458 HBasicBlock get end() => right.end; |
| 2461 | 2459 |
| 2462 // We don't currently use HAndOrBlockInformation. | 2460 // We don't currently use HAndOrBlockInformation. |
| 2463 HInstruction get conditionExpression() { | 2461 HInstruction get conditionExpression() { |
| 2464 // TODO(lrn): Need a compiler object. | 2462 return null; |
| 2465 compiler.internalError('conditionExpression should not be called', | |
| 2466 instruction: this); | |
| 2467 } | 2463 } |
| 2468 bool accept(HExpressionInformationVisitor visitor) => | 2464 bool accept(HExpressionInformationVisitor visitor) => |
| 2469 visitor.visitAndOrInfo(this); | 2465 visitor.visitAndOrInfo(this); |
| 2470 } | 2466 } |
| 2471 | 2467 |
| 2472 class HTryBlockInformation implements HStatementInformation { | 2468 class HTryBlockInformation implements HStatementInformation { |
| 2473 final HStatementInformation body; | 2469 final HStatementInformation body; |
| 2474 final HParameterValue catchVariable; | 2470 final HParameterValue catchVariable; |
| 2475 final HStatementInformation catchBlock; | 2471 final HStatementInformation catchBlock; |
| 2476 final HStatementInformation finallyBlock; | 2472 final HStatementInformation finallyBlock; |
| 2477 HTryBlockInformation(this.body, | 2473 HTryBlockInformation(this.body, |
| 2478 this.catchVariable, | 2474 this.catchVariable, |
| 2479 this.catchBlock, | 2475 this.catchBlock, |
| 2480 this.finallyBlock); | 2476 this.finallyBlock); |
| 2481 | 2477 |
| 2482 HBasicBlock get start() => body.start; | 2478 HBasicBlock get start() => body.start; |
| 2483 HBasicBlock get end() => | 2479 HBasicBlock get end() => |
| 2484 finallyBlock === null ? catchBlock.end : finallyBlock.end; | 2480 finallyBlock === null ? catchBlock.end : finallyBlock.end; |
| 2485 | 2481 |
| 2486 bool accept(HStatementInformationVisitor visitor) => | 2482 bool accept(HStatementInformationVisitor visitor) => |
| 2487 visitor.visitTryInfo(this); | 2483 visitor.visitTryInfo(this); |
| 2488 } | 2484 } |
| OLD | NEW |