| 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 class Interceptors { | 7 class Interceptors { |
| 8 Compiler compiler; | 8 Compiler compiler; |
| 9 Interceptors(Compiler this.compiler); | 9 Interceptors(Compiler this.compiler); |
| 10 | 10 |
| (...skipping 3731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3742 // a break or continue for a different target. In that case, this | 3742 // a break or continue for a different target. In that case, this |
| 3743 // label is also always unused. | 3743 // label is also always unused. |
| 3744 visit(body); | 3744 visit(body); |
| 3745 return; | 3745 return; |
| 3746 } | 3746 } |
| 3747 LocalsHandler beforeLocals = new LocalsHandler.from(localsHandler); | 3747 LocalsHandler beforeLocals = new LocalsHandler.from(localsHandler); |
| 3748 assert(targetElement.isBreakTarget); | 3748 assert(targetElement.isBreakTarget); |
| 3749 JumpHandler handler = new JumpHandler(this, targetElement); | 3749 JumpHandler handler = new JumpHandler(this, targetElement); |
| 3750 // Introduce a new basic block. | 3750 // Introduce a new basic block. |
| 3751 HBasicBlock entryBlock = openNewBlock(); | 3751 HBasicBlock entryBlock = openNewBlock(); |
| 3752 hackAroundPossiblyAbortingBody(node, () { visit(body); }); | 3752 visit(body); |
| 3753 SubGraph bodyGraph = new SubGraph(entryBlock, lastOpenedBlock); | 3753 SubGraph bodyGraph = new SubGraph(entryBlock, lastOpenedBlock); |
| 3754 | 3754 |
| 3755 HBasicBlock joinBlock = graph.addNewBlock(); | 3755 HBasicBlock joinBlock = graph.addNewBlock(); |
| 3756 List<LocalsHandler> breakLocals = <LocalsHandler>[]; | 3756 List<LocalsHandler> breakLocals = <LocalsHandler>[]; |
| 3757 handler.forEachBreak((HBreak breakInstruction, LocalsHandler locals) { | 3757 handler.forEachBreak((HBreak breakInstruction, LocalsHandler locals) { |
| 3758 breakInstruction.block.addSuccessor(joinBlock); | 3758 breakInstruction.block.addSuccessor(joinBlock); |
| 3759 breakLocals.add(locals); | 3759 breakLocals.add(locals); |
| 3760 }); | 3760 }); |
| 3761 bool hasBreak = breakLocals.length > 0; | 3761 bool hasBreak = breakLocals.length > 0; |
| 3762 if (!isAborted()) { | 3762 if (!isAborted()) { |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4379 ClassElement element = concreteType.getUniqueType(); | 4379 ClassElement element = concreteType.getUniqueType(); |
| 4380 if (element == null) return HType.UNKNOWN; | 4380 if (element == null) return HType.UNKNOWN; |
| 4381 if (element == builder.compiler.boolClass) return HType.BOOLEAN; | 4381 if (element == builder.compiler.boolClass) return HType.BOOLEAN; |
| 4382 if (element == builder.compiler.doubleClass) return HType.DOUBLE; | 4382 if (element == builder.compiler.doubleClass) return HType.DOUBLE; |
| 4383 if (element == builder.compiler.intClass) return HType.INTEGER; | 4383 if (element == builder.compiler.intClass) return HType.INTEGER; |
| 4384 if (element == builder.compiler.listClass) return HType.READABLE_ARRAY; | 4384 if (element == builder.compiler.listClass) return HType.READABLE_ARRAY; |
| 4385 if (element == builder.compiler.nullClass) return HType.NULL; | 4385 if (element == builder.compiler.nullClass) return HType.NULL; |
| 4386 if (element == builder.compiler.stringClass) return HType.STRING; | 4386 if (element == builder.compiler.stringClass) return HType.STRING; |
| 4387 return HType.UNKNOWN; | 4387 return HType.UNKNOWN; |
| 4388 } | 4388 } |
| 4389 | |
| 4390 /** HACK HACK HACK */ | |
| 4391 void hackAroundPossiblyAbortingBody(Node statement, void body()) { | |
| 4392 visitCondition() { | |
| 4393 stack.add(graph.addConstantBool(true, constantSystem)); | |
| 4394 } | |
| 4395 buildBody() { | |
| 4396 // TODO(lrn): Make sure to take continue into account. | |
| 4397 body(); | |
| 4398 } | |
| 4399 handleIf(statement, visitCondition, buildBody, null); | |
| 4400 } | |
| 4401 } | 4389 } |
| 4402 | 4390 |
| 4403 /** | 4391 /** |
| 4404 * Visitor that handles generation of string literals (LiteralString, | 4392 * Visitor that handles generation of string literals (LiteralString, |
| 4405 * StringInterpolation), and otherwise delegates to the given visitor for | 4393 * StringInterpolation), and otherwise delegates to the given visitor for |
| 4406 * non-literal subexpressions. | 4394 * non-literal subexpressions. |
| 4407 * TODO(lrn): Consider whether to handle compile time constant int/boolean | 4395 * TODO(lrn): Consider whether to handle compile time constant int/boolean |
| 4408 * expressions as well. | 4396 * expressions as well. |
| 4409 */ | 4397 */ |
| 4410 class StringBuilderVisitor extends Visitor { | 4398 class StringBuilderVisitor extends Visitor { |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4775 new HSubGraphBlockInformation(elseBranch.graph)); | 4763 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4776 | 4764 |
| 4777 HBasicBlock conditionStartBlock = conditionBranch.block; | 4765 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4778 conditionStartBlock.setBlockFlow(info, joinBlock); | 4766 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4779 SubGraph conditionGraph = conditionBranch.graph; | 4767 SubGraph conditionGraph = conditionBranch.graph; |
| 4780 HIf branch = conditionGraph.end.last; | 4768 HIf branch = conditionGraph.end.last; |
| 4781 assert(branch is HIf); | 4769 assert(branch is HIf); |
| 4782 branch.blockInformation = conditionStartBlock.blockFlow; | 4770 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4783 } | 4771 } |
| 4784 } | 4772 } |
| OLD | NEW |