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

Side by Side Diff: lib/compiler/implementation/ssa/variable_allocator.dart

Issue 11186048: Fix bad mangling of environment parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update comments. Created 8 years, 2 months 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 | Annotate | Revision Log
OLDNEW
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 /** 5 /**
6 * The [LiveRange] class covers a range where an instruction is live. 6 * The [LiveRange] class covers a range where an instruction is live.
7 */ 7 */
8 class LiveRange { 8 class LiveRange {
9 final int start; 9 final int start;
10 // [end] is not final because it can be updated due to loops. 10 // [end] is not final because it can be updated due to loops.
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 class VariableNamer { 425 class VariableNamer {
426 final VariableNames names; 426 final VariableNames names;
427 final Set<String> usedNames; 427 final Set<String> usedNames;
428 final Map<Element, String> parameterNames; 428 final Map<Element, String> parameterNames;
429 final List<String> freeTemporaryNames; 429 final List<String> freeTemporaryNames;
430 int temporaryIndex = 0; 430 int temporaryIndex = 0;
431 431
432 VariableNamer(LiveEnvironment environment, this.names, this.parameterNames) 432 VariableNamer(LiveEnvironment environment, this.names, this.parameterNames)
433 : usedNames = new Set<String>(), 433 : usedNames = new Set<String>(),
434 freeTemporaryNames = new List<String>() { 434 freeTemporaryNames = new List<String>() {
435 // [VariableNames.swapTemp] and [VariableNames.stateName] are being used 435 // [VariableNames.swapTemp] is used when there is a cycle in a copy handler.
436 // throughout the function. Therefore we make sure no one uses it at any 436 // Therefore we make sure no one uses it.
437 // time.
438 usedNames.add(names.swapTemp); 437 usedNames.add(names.swapTemp);
438 // [VariableNames.stateName] is being used throughout a bailout function.
439 // Whenever a bailout-target is reached we set the state-variable to 0. We
440 // must therefore not have any local variable that could clash with the
441 // state variable.
442 // Therefore we make sure no one uses it at any time.
439 usedNames.add(names.stateName); 443 usedNames.add(names.stateName);
440 444
441 // All liveIns instructions must have a name at this point, so we 445 // All liveIns instructions must have a name at this point, so we
442 // add them to the list of used names. 446 // add them to the list of used names.
443 environment.liveInstructions.forEach((HInstruction instruction, int index) { 447 environment.liveInstructions.forEach((HInstruction instruction, int index) {
444 String name = names.getName(instruction); 448 String name = names.getName(instruction);
445 if (name != null) { 449 if (name != null) {
446 usedNames.add(name); 450 usedNames.add(name);
447 } 451 }
448 }); 452 });
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 if (!needsName(input)) { 654 if (!needsName(input)) {
651 names.addAssignment(predecessor, input, phi); 655 names.addAssignment(predecessor, input, phi);
652 } else { 656 } else {
653 names.addCopy(predecessor, input, phi); 657 names.addCopy(predecessor, input, phi);
654 } 658 }
655 } 659 }
656 660
657 namer.allocateName(phi); 661 namer.allocateName(phi);
658 } 662 }
659 } 663 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698