Chromium Code Reviews| Index: dart/frog/leg/ssa/builder.dart |
| diff --git a/dart/frog/leg/ssa/builder.dart b/dart/frog/leg/ssa/builder.dart |
| index 9d022554f50a5c631849663b5998dbe9b58f2436..45043b4c0a9af7e155515bcb9ee46d8253cd9b48 100644 |
| --- a/dart/frog/leg/ssa/builder.dart |
| +++ b/dart/frog/leg/ssa/builder.dart |
| @@ -1089,11 +1089,7 @@ class SsaBuilder implements Visitor { |
| open(bodyBlock); |
| localsHandler.enterLoopBody(loop); |
| - visit(body); |
| - if (isAborted()) { |
| - compiler.unimplemented("SsaBuilder for loop with aborting body", |
| - node: body); |
| - } |
| + hackAroundPossiblyAbortingBody(body); |
| bodyBlock = close(new HGoto()); |
| // Update. |
| @@ -1138,10 +1134,7 @@ class SsaBuilder implements Visitor { |
| HBasicBlock loopEntryBlock = current; |
| localsHandler.enterLoopBody(node); |
| - visit(node.body); |
| - if (isAborted()) { |
| - compiler.unimplemented("SsaBuilder for loop with aborting body"); |
| - } |
| + hackAroundPossiblyAbortingBody(node.body); |
| // If there are no continues we could avoid the creation of the condition |
| // block. This could also lead to a block having multiple entries and exits. |
| @@ -2201,11 +2194,7 @@ class SsaBuilder implements Visitor { |
| } |
| localsHandler.updateLocal(variable, pop()); |
| - visit(node.body); |
| - if (isAborted()) { |
| - compiler.unimplemented("SsaBuilder for loop with aborting body", |
| - node: node); |
| - } |
| + hackAroundPossiblyAbortingBody(node.body); |
| bodyBlock = close(new HGoto()); |
| // Update. |
| @@ -2249,12 +2238,8 @@ class SsaBuilder implements Visitor { |
| HBasicBlock entryBlock = graph.addNewBlock(); |
| goto(current, entryBlock); |
| open(entryBlock); |
| - visit(body); |
| + hackAroundPossiblyAbortingBody(body); |
| SubGraph bodyGraph = new SubGraph(entryBlock, lastOpenedBlock); |
| - if (isAborted()) { |
| - compiler.unimplemented( |
| - "SsaBuilder for labeled statement with aborting body", node: node); |
| - } |
| HBasicBlock joinBlock = graph.addNewBlock(); |
| List<LocalsHandler> breakLocals = <LocalsHandler>[]; |
| @@ -2492,4 +2477,16 @@ class SsaBuilder implements Visitor { |
| stack.add(graph.addConstantNull()); |
| } |
| } |
| + |
| + /** HACK HACK HACK */ |
| + void hackAroundPossiblyAbortingBody(Node body) { |
| + stack.add(graph.addConstantBool(true)); |
| + buildBody() { |
| + visit(body); |
| + if (isAborted()) { |
|
floitsch
2012/03/12 15:48:24
Add TODO that this will need to take into account
ahe
2012/03/12 16:55:34
Done.
|
| + compiler.reportWarning(body, "aborting loop body"); |
| + } |
| + } |
| + handleIf(buildBody, (){}); |
|
floitsch
2012/03/12 15:48:24
you should be able to pass 'null' for the else bra
ahe
2012/03/12 16:55:34
Done.
|
| + } |
| } |