Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(954)

Side by Side Diff: pkg/compiler/lib/src/ssa/locals_handler.dart

Issue 2581143003: implement LabeledStatement and Break in kernel (Closed)
Patch Set: fix some tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 '../dart_types.dart'; 8 import '../dart_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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } 568 }
569 569
570 /// When control flow merges, this method can be used to merge several 570 /// When control flow merges, this method can be used to merge several
571 /// localsHandlers into a new one using phis. The new localsHandler is 571 /// localsHandlers into a new one using phis. The new localsHandler is
572 /// returned. Unless it is also in the list, the current localsHandler is not 572 /// returned. Unless it is also in the list, the current localsHandler is not
573 /// used for its values, only for its declared variables. This is a way to 573 /// used for its values, only for its declared variables. This is a way to
574 /// exclude local values from the result when they are no longer in scope. 574 /// exclude local values from the result when they are no longer in scope.
575 LocalsHandler mergeMultiple( 575 LocalsHandler mergeMultiple(
576 List<LocalsHandler> localsHandlers, HBasicBlock joinBlock) { 576 List<LocalsHandler> localsHandlers, HBasicBlock joinBlock) {
577 assert(localsHandlers.length > 0); 577 assert(localsHandlers.length > 0);
578 if (localsHandlers.length == 1) return localsHandlers[0]; 578 if (localsHandlers.length == 1) return localsHandlers.single;
579 Map<Local, HInstruction> joinedLocals = new Map<Local, HInstruction>(); 579 Map<Local, HInstruction> joinedLocals = new Map<Local, HInstruction>();
580 HInstruction thisValue = null; 580 HInstruction thisValue = null;
581 directLocals.forEach((Local local, HInstruction instruction) { 581 directLocals.forEach((Local local, HInstruction instruction) {
582 if (local != closureData.thisLocal) { 582 if (local != closureData.thisLocal) {
583 HPhi phi = new HPhi.noInputs(local, commonMasks.dynamicType); 583 HPhi phi = new HPhi.noInputs(local, commonMasks.dynamicType);
584 joinedLocals[local] = phi; 584 joinedLocals[local] = phi;
585 joinBlock.addPhi(phi); 585 joinBlock.addPhi(phi);
586 } else { 586 } else {
587 // We know that "this" never changes, if it's there. 587 // We know that "this" never changes, if it's there.
588 // Save it for later. While merging, there is no phi for "this", 588 // Save it for later. While merging, there is no phi for "this",
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 final ExecutableElement executableContext; 663 final ExecutableElement executableContext;
664 664
665 // Avoid slow Object.hashCode. 665 // Avoid slow Object.hashCode.
666 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); 666 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30);
667 static int _nextHashCode = 0; 667 static int _nextHashCode = 0;
668 668
669 SyntheticLocal(this.name, this.executableContext); 669 SyntheticLocal(this.name, this.executableContext);
670 670
671 toString() => 'SyntheticLocal($name)'; 671 toString() => 'SyntheticLocal($name)';
672 } 672 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698