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