OLD | NEW |
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 Loading... |
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 HType type = instruction.propagatedType; | 168 switch (instruction.type) { |
169 switch (type) { | |
170 case HType.MUTABLE_ARRAY: prefix = 'a'; break; | 169 case HType.MUTABLE_ARRAY: prefix = 'a'; break; |
171 case HType.READABLE_ARRAY: prefix = 'roa'; break; | 170 case HType.READABLE_ARRAY: prefix = 'roa'; break; |
172 case HType.BOOLEAN: prefix = 'b'; break; | 171 case HType.BOOLEAN: prefix = 'b'; break; |
173 case HType.INTEGER: prefix = 'i'; break; | 172 case HType.INTEGER: prefix = 'i'; break; |
174 case HType.DOUBLE: prefix = 'd'; break; | 173 case HType.DOUBLE: prefix = 'd'; break; |
175 case HType.NUMBER: prefix = 'n'; break; | 174 case HType.NUMBER: prefix = 'n'; break; |
176 case HType.STRING: prefix = 's'; break; | 175 case HType.STRING: prefix = 's'; break; |
177 case HType.UNKNOWN: prefix = 'v'; break; | 176 case HType.UNKNOWN: prefix = 'v'; break; |
178 case HType.CONFLICTING: prefix = 'c'; break; | 177 case HType.CONFLICTING: prefix = 'c'; break; |
179 case HType.STRING_OR_ARRAY: prefix = 'sa'; break; | 178 case HType.STRING_OR_ARRAY: prefix = 'sa'; break; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 finallyBlock = 'B${node.finallyBlock.id}'; | 395 finallyBlock = 'B${node.finallyBlock.id}'; |
397 } else { | 396 } else { |
398 catchBlocks.add('B${successors[successors.length - 1].id}'); | 397 catchBlocks.add('B${successors[successors.length - 1].id}'); |
399 finallyBlock = 'none'; | 398 finallyBlock = 'none'; |
400 } | 399 } |
401 return "Try: $tryBlock, Catch: $catchBlocks, Finally: $finallyBlock"; | 400 return "Try: $tryBlock, Catch: $catchBlocks, Finally: $finallyBlock"; |
402 } | 401 } |
403 | 402 |
404 String visitTypeGuard(HTypeGuard node) { | 403 String visitTypeGuard(HTypeGuard node) { |
405 String type; | 404 String type; |
406 switch (node.propagatedType) { | 405 switch (node.type) { |
407 case HType.MUTABLE_ARRAY: type = "mutable_array"; break; | 406 case HType.MUTABLE_ARRAY: type = "mutable_array"; break; |
408 case HType.READABLE_ARRAY: type = "readable_array"; break; | 407 case HType.READABLE_ARRAY: type = "readable_array"; break; |
409 case HType.BOOLEAN: type = "bool"; break; | 408 case HType.BOOLEAN: type = "bool"; break; |
410 case HType.INTEGER: type = "integer"; break; | 409 case HType.INTEGER: type = "integer"; break; |
411 case HType.DOUBLE: type = "double"; break; | 410 case HType.DOUBLE: type = "double"; break; |
412 case HType.NUMBER: type = "number"; break; | 411 case HType.NUMBER: type = "number"; break; |
413 case HType.STRING: type = "string"; break; | 412 case HType.STRING: type = "string"; break; |
414 case HType.STRING_OR_ARRAY: type = "string_or_array"; break; | 413 case HType.STRING_OR_ARRAY: type = "string_or_array"; break; |
415 case HType.UNKNOWN: type = 'unknown'; break; | 414 case HType.UNKNOWN: type = 'unknown'; break; |
416 default: unreachable(); | 415 default: unreachable(); |
417 } | 416 } |
418 return "TypeGuard: ${temporaryId(node.inputs[0])} is $type"; | 417 return "TypeGuard: ${temporaryId(node.inputs[0])} is $type"; |
419 } | 418 } |
420 | 419 |
421 String visitIs(HIs node) { | 420 String visitIs(HIs node) { |
422 String type = node.typeExpression.toString(); | 421 String type = node.typeExpression.toString(); |
423 return "TypeTest: ${temporaryId(node.expression)} is $type"; | 422 return "TypeTest: ${temporaryId(node.expression)} is $type"; |
424 } | 423 } |
425 } | 424 } |
OLD | NEW |