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

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

Issue 9963005: Fix bug where a parameter was mutated while it was still used. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | tests/language/src/LivenessTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA code generator'; 7 String get name() => 'SSA code generator';
8 8
9 9
10 String generateMethod(WorkItem work, HGraph graph) { 10 String generateMethod(WorkItem work, HGraph graph) {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 166
167 String temporary(HInstruction instruction) { 167 String temporary(HInstruction instruction) {
168 int id = instruction.id; 168 int id = instruction.id;
169 String name = names[id]; 169 String name = names[id];
170 if (name !== null) return name; 170 if (name !== null) return name;
171 171
172 if (instruction is HPhi) { 172 if (instruction is HPhi) {
173 HPhi phi = instruction; 173 HPhi phi = instruction;
174 Element element = phi.element; 174 Element element = phi.element;
175 if (element != null && element.kind == ElementKind.PARAMETER) {
176 name = parameterNames[element];
177 names[id] = name;
178 return name;
179 }
180
181 String prefix; 175 String prefix;
182 if (element !== null && !element.name.isEmpty()) { 176 if (element !== null && !element.name.isEmpty()) {
183 prefix = element.name.slowToString(); 177 prefix = element.name.slowToString();
184 } else { 178 } else {
185 prefix = 'v'; 179 prefix = 'v';
186 } 180 }
187 if (!prefixes.containsKey(prefix)) { 181 if (!prefixes.containsKey(prefix)) {
188 prefixes[prefix] = 0; 182 prefixes[prefix] = 0;
189 return newName(id, prefix); 183 return newName(id, prefix);
190 } else { 184 } else {
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 startBailoutSwitch(); 1555 startBailoutSwitch();
1562 } 1556 }
1563 } 1557 }
1564 1558
1565 void endElse(HIf node) { 1559 void endElse(HIf node) {
1566 if (node.elseBlock.hasGuards()) { 1560 if (node.elseBlock.hasGuards()) {
1567 endBailoutSwitch(); 1561 endBailoutSwitch();
1568 } 1562 }
1569 } 1563 }
1570 } 1564 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/src/LivenessTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698