| 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 /** | 7 /** |
| 8 * A special element for the extra parameter taken by intercepted | 8 * A special element for the extra parameter taken by intercepted |
| 9 * methods. We need to override [Element.computeType] because our | 9 * methods. We need to override [Element.computeType] because our |
| 10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
| (...skipping 4256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4267 } | 4267 } |
| 4268 handleLoop(node, buildInitializer, buildCondition, () {}, buildBody); | 4268 handleLoop(node, buildInitializer, buildCondition, () {}, buildBody); |
| 4269 } | 4269 } |
| 4270 | 4270 |
| 4271 visitLabel(Label node) { | 4271 visitLabel(Label node) { |
| 4272 compiler.internalError('SsaBuilder.visitLabel', node: node); | 4272 compiler.internalError('SsaBuilder.visitLabel', node: node); |
| 4273 } | 4273 } |
| 4274 | 4274 |
| 4275 visitLabeledStatement(LabeledStatement node) { | 4275 visitLabeledStatement(LabeledStatement node) { |
| 4276 Statement body = node.statement; | 4276 Statement body = node.statement; |
| 4277 if (body is Loop || body is SwitchStatement) { | 4277 if (body is Loop |
| 4278 || body is SwitchStatement |
| 4279 || Elements.isUnusedLabel(node, elements)) { |
| 4278 // Loops and switches handle their own labels. | 4280 // Loops and switches handle their own labels. |
| 4279 visit(body); | 4281 visit(body); |
| 4280 return; | 4282 return; |
| 4281 } | 4283 } |
| 4282 // Non-loop statements can only be break targets, not continue targets. | |
| 4283 TargetElement targetElement = elements[body]; | 4284 TargetElement targetElement = elements[body]; |
| 4284 if (targetElement == null || !identical(targetElement.statement, body)) { | |
| 4285 // Labeled statements with no element on the body have no breaks. | |
| 4286 // A different target statement only happens if the body is itself | |
| 4287 // a break or continue for a different target. In that case, this | |
| 4288 // label is also always unused. | |
| 4289 visit(body); | |
| 4290 return; | |
| 4291 } | |
| 4292 LocalsHandler beforeLocals = new LocalsHandler.from(localsHandler); | 4285 LocalsHandler beforeLocals = new LocalsHandler.from(localsHandler); |
| 4293 assert(targetElement.isBreakTarget); | 4286 assert(targetElement.isBreakTarget); |
| 4294 JumpHandler handler = new JumpHandler(this, targetElement); | 4287 JumpHandler handler = new JumpHandler(this, targetElement); |
| 4295 // Introduce a new basic block. | 4288 // Introduce a new basic block. |
| 4296 HBasicBlock entryBlock = openNewBlock(); | 4289 HBasicBlock entryBlock = openNewBlock(); |
| 4297 visit(body); | 4290 visit(body); |
| 4298 SubGraph bodyGraph = new SubGraph(entryBlock, lastOpenedBlock); | 4291 SubGraph bodyGraph = new SubGraph(entryBlock, lastOpenedBlock); |
| 4299 | 4292 |
| 4300 HBasicBlock joinBlock = graph.addNewBlock(); | 4293 HBasicBlock joinBlock = graph.addNewBlock(); |
| 4301 List<LocalsHandler> breakHandlers = <LocalsHandler>[]; | 4294 List<LocalsHandler> breakHandlers = <LocalsHandler>[]; |
| (...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5417 new HSubGraphBlockInformation(elseBranch.graph)); | 5410 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5418 | 5411 |
| 5419 HBasicBlock conditionStartBlock = conditionBranch.block; | 5412 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5420 conditionStartBlock.setBlockFlow(info, joinBlock); | 5413 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5421 SubGraph conditionGraph = conditionBranch.graph; | 5414 SubGraph conditionGraph = conditionBranch.graph; |
| 5422 HIf branch = conditionGraph.end.last; | 5415 HIf branch = conditionGraph.end.last; |
| 5423 assert(branch is HIf); | 5416 assert(branch is HIf); |
| 5424 branch.blockInformation = conditionStartBlock.blockFlow; | 5417 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5425 } | 5418 } |
| 5426 } | 5419 } |
| OLD | NEW |