| 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 import 'dart:collection'; | 5 import 'dart:collection'; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart'; | 7 import 'package:js_runtime/shared/embedded_names.dart'; |
| 8 | 8 |
| 9 import '../closure.dart'; | 9 import '../closure.dart'; |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 box = createBox(); | 276 box = createBox(); |
| 277 } | 277 } |
| 278 // Add the box to the known locals. | 278 // Add the box to the known locals. |
| 279 directLocals[scopeData.boxElement] = box; | 279 directLocals[scopeData.boxElement] = box; |
| 280 // Make sure that accesses to the boxed locals go into the box. We also | 280 // Make sure that accesses to the boxed locals go into the box. We also |
| 281 // need to make sure that parameters are copied into the box if necessary. | 281 // need to make sure that parameters are copied into the box if necessary. |
| 282 scopeData.forEachCapturedVariable( | 282 scopeData.forEachCapturedVariable( |
| 283 (LocalVariableElement from, BoxFieldElement to) { | 283 (LocalVariableElement from, BoxFieldElement to) { |
| 284 // The [from] can only be a parameter for function-scopes and not | 284 // The [from] can only be a parameter for function-scopes and not |
| 285 // loop scopes. | 285 // loop scopes. |
| 286 if (from.isParameter && !element.isGenerativeConstructorBody) { | 286 if (from.isRegularParameter && !element.isGenerativeConstructorBody) { |
| 287 // Now that the redirection is set up, the update to the local will | 287 // Now that the redirection is set up, the update to the local will |
| 288 // write the parameter value into the box. | 288 // write the parameter value into the box. |
| 289 // Store the captured parameter in the box. Get the current value | 289 // Store the captured parameter in the box. Get the current value |
| 290 // before we put the redirection in place. | 290 // before we put the redirection in place. |
| 291 // We don't need to update the local for a generative | 291 // We don't need to update the local for a generative |
| 292 // constructor body, because it receives a box that already | 292 // constructor body, because it receives a box that already |
| 293 // contains the updates as the last parameter. | 293 // contains the updates as the last parameter. |
| 294 HInstruction instruction = readLocal(from); | 294 HInstruction instruction = readLocal(from); |
| 295 redirectElement(from, to); | 295 redirectElement(from, to); |
| 296 updateLocal(from, instruction); | 296 updateLocal(from, instruction); |
| (...skipping 8328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8625 const _LoopTypeVisitor(); | 8625 const _LoopTypeVisitor(); |
| 8626 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP; | 8626 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP; |
| 8627 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP; | 8627 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP; |
| 8628 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP; | 8628 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP; |
| 8629 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; | 8629 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; |
| 8630 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; | 8630 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; |
| 8631 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; | 8631 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; |
| 8632 int visitSwitchStatement(ast.SwitchStatement node) => | 8632 int visitSwitchStatement(ast.SwitchStatement node) => |
| 8633 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; | 8633 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; |
| 8634 } | 8634 } |
| OLD | NEW |