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

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

Issue 10098001: Refactor type propagation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and add new test. 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #library('tracer'); 5 #library('tracer');
6 6
7 #import('dart:io'); 7 #import('dart:io');
8 #import('ssa.dart'); 8 #import('ssa.dart');
9 #import('../leg.dart'); 9 #import('../leg.dart');
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 HInstructionStringifier(this.currentBlock); 158 HInstructionStringifier(this.currentBlock);
159 159
160 visit(HInstruction node) => node.accept(this); 160 visit(HInstruction node) => node.accept(this);
161 161
162 visitBasicBlock(HBasicBlock node) { 162 visitBasicBlock(HBasicBlock node) {
163 unreachable(); 163 unreachable();
164 } 164 }
165 165
166 String temporaryId(HInstruction instruction) { 166 String temporaryId(HInstruction instruction) {
167 String prefix; 167 String prefix;
168 switch (instruction.type) { 168 HType type = instruction.propagatedType;
169 switch (type) {
169 case HType.MUTABLE_ARRAY: prefix = 'a'; break; 170 case HType.MUTABLE_ARRAY: prefix = 'a'; break;
170 case HType.READABLE_ARRAY: prefix = 'roa'; break; 171 case HType.READABLE_ARRAY: prefix = 'roa'; break;
171 case HType.BOOLEAN: prefix = 'b'; break; 172 case HType.BOOLEAN: prefix = 'b'; break;
172 case HType.INTEGER: prefix = 'i'; break; 173 case HType.INTEGER: prefix = 'i'; break;
173 case HType.DOUBLE: prefix = 'd'; break; 174 case HType.DOUBLE: prefix = 'd'; break;
174 case HType.NUMBER: prefix = 'n'; break; 175 case HType.NUMBER: prefix = 'n'; break;
175 case HType.STRING: prefix = 's'; break; 176 case HType.STRING: prefix = 's'; break;
176 case HType.UNKNOWN: prefix = 'v'; break; 177 case HType.UNKNOWN: prefix = 'v'; break;
177 case HType.CONFLICTING: prefix = 'c'; break; 178 case HType.CONFLICTING: prefix = 'c'; break;
178 case HType.STRING_OR_ARRAY: prefix = 'sa'; break; 179 case HType.STRING_OR_ARRAY: prefix = 'sa'; break;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 finallyBlock = 'B${node.finallyBlock.id}'; 396 finallyBlock = 'B${node.finallyBlock.id}';
396 } else { 397 } else {
397 catchBlocks.add('B${successors[successors.length - 1].id}'); 398 catchBlocks.add('B${successors[successors.length - 1].id}');
398 finallyBlock = 'none'; 399 finallyBlock = 'none';
399 } 400 }
400 return "Try: $tryBlock, Catch: $catchBlocks, Finally: $finallyBlock"; 401 return "Try: $tryBlock, Catch: $catchBlocks, Finally: $finallyBlock";
401 } 402 }
402 403
403 String visitTypeGuard(HTypeGuard node) { 404 String visitTypeGuard(HTypeGuard node) {
404 String type; 405 String type;
405 switch (node.type) { 406 switch (node.propagatedType) {
406 case HType.MUTABLE_ARRAY: type = "mutable_array"; break; 407 case HType.MUTABLE_ARRAY: type = "mutable_array"; break;
407 case HType.READABLE_ARRAY: type = "readable_array"; break; 408 case HType.READABLE_ARRAY: type = "readable_array"; break;
408 case HType.BOOLEAN: type = "bool"; break; 409 case HType.BOOLEAN: type = "bool"; break;
409 case HType.INTEGER: type = "integer"; break; 410 case HType.INTEGER: type = "integer"; break;
410 case HType.DOUBLE: type = "double"; break; 411 case HType.DOUBLE: type = "double"; break;
411 case HType.NUMBER: type = "number"; break; 412 case HType.NUMBER: type = "number"; break;
412 case HType.STRING: type = "string"; break; 413 case HType.STRING: type = "string"; break;
413 case HType.STRING_OR_ARRAY: type = "string_or_array"; break; 414 case HType.STRING_OR_ARRAY: type = "string_or_array"; break;
414 case HType.UNKNOWN: type = 'unknown'; break; 415 case HType.UNKNOWN: type = 'unknown'; break;
415 default: unreachable(); 416 default: unreachable();
416 } 417 }
417 return "TypeGuard: ${temporaryId(node.inputs[0])} is $type"; 418 return "TypeGuard: ${temporaryId(node.inputs[0])} is $type";
418 } 419 }
419 420
420 String visitIs(HIs node) { 421 String visitIs(HIs node) {
421 String type = node.typeExpression.toString(); 422 String type = node.typeExpression.toString();
422 return "TypeTest: ${temporaryId(node.expression)} is $type"; 423 return "TypeTest: ${temporaryId(node.expression)} is $type";
423 } 424 }
424 } 425 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/optimize.dart ('k') | lib/compiler/implementation/ssa/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698