| 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 class BailoutInfo { | 5 class BailoutInfo { |
| 6 int instructionId; | 6 int instructionId; |
| 7 int bailoutId; | 7 int bailoutId; |
| 8 BailoutInfo(this.instructionId, this.bailoutId); | 8 BailoutInfo(this.instructionId, this.bailoutId); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 * Propagates bailout information to blocks that need it. This visitor | 364 * Propagates bailout information to blocks that need it. This visitor |
| 365 * is run before codegen, to know which blocks have to deal with | 365 * is run before codegen, to know which blocks have to deal with |
| 366 * bailouts. | 366 * bailouts. |
| 367 */ | 367 */ |
| 368 class SsaBailoutPropagator extends HBaseVisitor { | 368 class SsaBailoutPropagator extends HBaseVisitor { |
| 369 final Compiler compiler; | 369 final Compiler compiler; |
| 370 final List<HBasicBlock> blocks; | 370 final List<HBasicBlock> blocks; |
| 371 final List<HLabeledBlockInformation> labeledBlockInformations; | 371 final List<HLabeledBlockInformation> labeledBlockInformations; |
| 372 final Set<HInstruction> generateAtUseSite; | 372 final Set<HInstruction> generateAtUseSite; |
| 373 SubGraph subGraph; | 373 SubGraph subGraph; |
| 374 int maxBailoutParameters = 0; |
| 374 | 375 |
| 375 /** | 376 /** |
| 376 * If set to true, the graph has either multiple bailouts in | 377 * If set to true, the graph has either multiple bailouts in |
| 377 * different places, or a bailout inside an if or a loop. For such a | 378 * different places, or a bailout inside an if or a loop. For such a |
| 378 * graph, the code generator will emit a generic switch. | 379 * graph, the code generator will emit a generic switch. |
| 379 */ | 380 */ |
| 380 bool hasComplexTypeGuards = false; | 381 bool hasComplexTypeGuards = false; |
| 381 | 382 |
| 382 /** | 383 /** |
| 383 * The first type guard in the graph. | 384 * The first type guard in the graph. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 visitBasicBlock(branchBlock.successors[1]); | 502 visitBasicBlock(branchBlock.successors[1]); |
| 502 // With labeled breaks we can have more dominated blocks. | 503 // With labeled breaks we can have more dominated blocks. |
| 503 if (dominated.length >= 3) { | 504 if (dominated.length >= 3) { |
| 504 for (int i = 2; i < dominated.length; i++) { | 505 for (int i = 2; i < dominated.length; i++) { |
| 505 visitBasicBlock(dominated[i]); | 506 visitBasicBlock(dominated[i]); |
| 506 } | 507 } |
| 507 } | 508 } |
| 508 } | 509 } |
| 509 | 510 |
| 510 visitTypeGuard(HTypeGuard guard) { | 511 visitTypeGuard(HTypeGuard guard) { |
| 512 int inputLength = guard.inputs.length; |
| 513 if (inputLength > maxBailoutParameters) { |
| 514 maxBailoutParameters = inputLength; |
| 515 } |
| 511 if (blocks.isEmpty()) { | 516 if (blocks.isEmpty()) { |
| 512 if (firstTypeGuard === null || firstTypeGuard.state === guard.state) { | 517 if (firstTypeGuard === null || firstTypeGuard.state === guard.state) { |
| 513 firstTypeGuard = guard; | 518 firstTypeGuard = guard; |
| 514 } else { | 519 } else { |
| 515 hasComplexTypeGuards = true; | 520 hasComplexTypeGuards = true; |
| 516 } | 521 } |
| 517 } else { | 522 } else { |
| 518 hasComplexTypeGuards = true; | 523 hasComplexTypeGuards = true; |
| 519 blocks.forEach((HBasicBlock block) { | 524 blocks.forEach((HBasicBlock block) { |
| 520 block.guards.add(guard); | 525 block.guards.add(guard); |
| 521 }); | 526 }); |
| 522 } | 527 } |
| 523 } | 528 } |
| 524 } | 529 } |
| OLD | NEW |