OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 '../closure.dart'; | 5 import '../closure.dart'; |
6 import '../common.dart'; | 6 import '../common.dart'; |
7 import '../compiler.dart' show Compiler; | 7 import '../compiler.dart' show Compiler; |
8 import '../elements/resolution_types.dart'; | 8 import '../elements/resolution_types.dart'; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../io/source_information.dart'; | 10 import '../io/source_information.dart'; |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 475 } |
476 } | 476 } |
477 | 477 |
478 /// Create phis at the loop entry for local variables (ready for the values | 478 /// Create phis at the loop entry for local variables (ready for the values |
479 /// from the back edge). Populate the phis with the current values. | 479 /// from the back edge). Populate the phis with the current values. |
480 void beginLoopHeader(HBasicBlock loopEntry) { | 480 void beginLoopHeader(HBasicBlock loopEntry) { |
481 // Create a copy because we modify the map while iterating over it. | 481 // Create a copy because we modify the map while iterating over it. |
482 Map<Local, HInstruction> savedDirectLocals = | 482 Map<Local, HInstruction> savedDirectLocals = |
483 new Map<Local, HInstruction>.from(directLocals); | 483 new Map<Local, HInstruction>.from(directLocals); |
484 | 484 |
485 JavaScriptBackend backend = _compiler.backend; | |
486 // Create phis for all elements in the definitions environment. | 485 // Create phis for all elements in the definitions environment. |
487 savedDirectLocals.forEach((Local local, HInstruction instruction) { | 486 savedDirectLocals.forEach((Local local, HInstruction instruction) { |
488 if (isAccessedDirectly(local)) { | 487 if (isAccessedDirectly(local)) { |
489 // We know 'this' cannot be modified. | 488 // We know 'this' cannot be modified. |
490 if (local != closureData.thisLocal) { | 489 if (local != closureData.thisLocal) { |
491 HPhi phi = | 490 HPhi phi = |
492 new HPhi.singleInput(local, instruction, commonMasks.dynamicType); | 491 new HPhi.singleInput(local, instruction, commonMasks.dynamicType); |
493 loopEntry.addPhi(phi); | 492 loopEntry.addPhi(phi); |
494 directLocals[local] = phi; | 493 directLocals[local] = phi; |
495 } else { | 494 } else { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 final ExecutableElement executableContext; | 661 final ExecutableElement executableContext; |
663 | 662 |
664 // Avoid slow Object.hashCode. | 663 // Avoid slow Object.hashCode. |
665 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); | 664 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); |
666 static int _nextHashCode = 0; | 665 static int _nextHashCode = 0; |
667 | 666 |
668 SyntheticLocal(this.name, this.executableContext); | 667 SyntheticLocal(this.name, this.executableContext); |
669 | 668 |
670 toString() => 'SyntheticLocal($name)'; | 669 toString() => 'SyntheticLocal($name)'; |
671 } | 670 } |
OLD | NEW |