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

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

Issue 12049036: Cleanup the namer, and add a test with fields that used to clash with internal names used by the co… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * The [LiveRange] class covers a range where an instruction is live. 8 * The [LiveRange] class covers a range where an instruction is live.
9 */ 9 */
10 class LiveRange { 10 class LiveRange {
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 String name = names.getName(instruction); 465 String name = names.getName(instruction);
466 if (name != null) { 466 if (name != null) {
467 usedNames.add(name); 467 usedNames.add(name);
468 names.addNameUsed(name); 468 names.addNameUsed(name);
469 } 469 }
470 }); 470 });
471 } 471 }
472 472
473 String allocateWithHint(String originalName) { 473 String allocateWithHint(String originalName) {
474 int i = 0; 474 int i = 0;
475 String name = JsNames.getValid(originalName); 475 JavaScriptBackend backend = compiler.backend;
476 String name = backend.namer.safeName(originalName);
476 while (usedNames.contains(name)) { 477 while (usedNames.contains(name)) {
477 name = JsNames.getValid('$originalName${i++}'); 478 name = backend.namer.safeName('$originalName${i++}');
478 } 479 }
479 return name; 480 return name;
480 } 481 }
481 482
482 String allocateTemporary() { 483 String allocateTemporary() {
483 while (!freeTemporaryNames.isEmpty) { 484 while (!freeTemporaryNames.isEmpty) {
484 String name = freeTemporaryNames.removeLast(); 485 String name = freeTemporaryNames.removeLast();
485 if (!usedNames.contains(name)) return name; 486 if (!usedNames.contains(name)) return name;
486 } 487 }
487 String name = 't${temporaryIndex++}'; 488 String name = 't${temporaryIndex++}';
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 if (!needsName(input)) { 660 if (!needsName(input)) {
660 names.addAssignment(predecessor, input, phi); 661 names.addAssignment(predecessor, input, phi);
661 } else { 662 } else {
662 names.addCopy(predecessor, input, phi); 663 names.addCopy(predecessor, input, phi);
663 } 664 }
664 } 665 }
665 666
666 namer.allocateName(phi); 667 namer.allocateName(phi);
667 } 668 }
668 } 669 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698