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

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

Issue 10446098: Avoid generating empty else. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | 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 /** 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 void addCopy(HInstruction source, HInstruction destination) { 328 void addCopy(HInstruction source, HInstruction destination) {
329 copies.add(new Copy(source, destination)); 329 copies.add(new Copy(source, destination));
330 } 330 }
331 331
332 void addAssignment(HInstruction source, HInstruction destination) { 332 void addAssignment(HInstruction source, HInstruction destination) {
333 assignments.add(new Copy(source, destination)); 333 assignments.add(new Copy(source, destination));
334 } 334 }
335 335
336 String toString() => 'Copies: $copies, assignments: $assignments'; 336 String toString() => 'Copies: $copies, assignments: $assignments';
337 bool isEmpty() => copies.isEmpty() && assignments.isEmpty();
337 } 338 }
338 339
339 /** 340 /**
340 * Contains the mapping between instructions and their names for code 341 * Contains the mapping between instructions and their names for code
341 * generation, as well as the [CopyHandler] for each basic block. 342 * generation, as well as the [CopyHandler] for each basic block.
342 */ 343 */
343 class VariableNames { 344 class VariableNames {
344 final Map<HInstruction, String> ownName; 345 final Map<HInstruction, String> ownName;
345 final Map<HBasicBlock, CopyHandler> copyHandlers; 346 final Map<HBasicBlock, CopyHandler> copyHandlers;
346 /** 347 /**
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 if (!needsName(input)) { 564 if (!needsName(input)) {
564 names.addAssignment(predecessor, input, phi); 565 names.addAssignment(predecessor, input, phi);
565 } else { 566 } else {
566 names.addCopy(predecessor, input, phi); 567 names.addCopy(predecessor, input, phi);
567 } 568 }
568 } 569 }
569 570
570 namer.allocateName(phi); 571 namer.allocateName(phi);
571 } 572 }
572 } 573 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698