Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library tree_ir_builder; | 5 library tree_ir_builder; |
| 6 | 6 |
| 7 import '../dart2jslib.dart' as dart2js; | 7 import '../dart2jslib.dart' as dart2js; |
| 8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; | 9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; |
| 10 import '../util/util.dart' show CURRENT_ELEMENT_SPANNABLE; | 10 import '../util/util.dart' show CURRENT_ELEMENT_SPANNABLE; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 if (variable == null) return visit(node.body); | 313 if (variable == null) return visit(node.body); |
| 314 | 314 |
| 315 Expression value = visit(node.primitive); | 315 Expression value = visit(node.primitive); |
| 316 return Assign.makeStatement(variable, value, visit(node.body)); | 316 return Assign.makeStatement(variable, value, visit(node.body)); |
| 317 } | 317 } |
| 318 | 318 |
| 319 Statement visitLetCont(cps_ir.LetCont node) { | 319 Statement visitLetCont(cps_ir.LetCont node) { |
| 320 // Introduce labels for continuations that need them. | 320 // Introduce labels for continuations that need them. |
| 321 int safeForInliningLengthOnEntry = safeForInlining.length; | 321 int safeForInliningLengthOnEntry = safeForInlining.length; |
| 322 for (cps_ir.Continuation continuation in node.continuations) { | 322 for (cps_ir.Continuation continuation in node.continuations) { |
| 323 if (continuation.hasMultipleUses) { | 323 if (continuation.hasMultipleUses || continuation.isRecursive) { |
|
asgerf
2015/06/29 14:09:12
If the continuation is marked as recursive, but al
Kevin Millikin (Google)
2015/06/29 14:43:28
The way we do it now has always seemed brittle; we
| |
| 324 labels[continuation] = new Label(); | 324 labels[continuation] = new Label(); |
| 325 } else { | 325 } else { |
| 326 safeForInlining.add(continuation); | 326 safeForInlining.add(continuation); |
| 327 } | 327 } |
| 328 } | 328 } |
| 329 Statement body = visit(node.body); | 329 Statement body = visit(node.body); |
| 330 safeForInlining.length = safeForInliningLengthOnEntry; | 330 safeForInlining.length = safeForInliningLengthOnEntry; |
| 331 // Continuations are bound at the same level, but they have to be | 331 // Continuations are bound at the same level, but they have to be |
| 332 // translated as if nested. This is because the body can invoke any | 332 // translated as if nested. This is because the body can invoke any |
| 333 // of them from anywhere, so it must be nested inside all of them. | 333 // of them from anywhere, so it must be nested inside all of them. |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 623 return new ForeignStatement( | 623 return new ForeignStatement( |
| 624 node.codeTemplate, | 624 node.codeTemplate, |
| 625 node.type, | 625 node.type, |
| 626 node.arguments.map(getVariableUse).toList(growable: false), | 626 node.arguments.map(getVariableUse).toList(growable: false), |
| 627 node.nativeBehavior, | 627 node.nativeBehavior, |
| 628 node.dependency); | 628 node.dependency); |
| 629 } | 629 } |
| 630 } | 630 } |
| 631 } | 631 } |
| 632 | 632 |
| OLD | NEW |