| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 String temporaryId(HInstruction instruction) { | 166 String temporaryId(HInstruction instruction) { |
| 167 String prefix; | 167 String prefix; |
| 168 HType type = instruction.propagatedType; | 168 HType type = instruction.propagatedType; |
| 169 switch (type) { | 169 switch (type) { |
| 170 case HType.MUTABLE_ARRAY: prefix = 'm'; break; | 170 case HType.MUTABLE_ARRAY: prefix = 'm'; break; |
| 171 case HType.READABLE_ARRAY: prefix = 'a'; break; | 171 case HType.READABLE_ARRAY: prefix = 'a'; break; |
| 172 case HType.BOOLEAN: prefix = 'b'; break; | 172 case HType.BOOLEAN: prefix = 'b'; break; |
| 173 case HType.INTEGER: prefix = 'i'; break; | 173 case HType.INTEGER: prefix = 'i'; break; |
| 174 case HType.DOUBLE: prefix = 'd'; break; | 174 case HType.DOUBLE: prefix = 'd'; break; |
| 175 case HType.NUMBER: prefix = 'n'; break; | 175 case HType.INTEGER_OR_DOUBLE: prefix = 'n'; break; |
| 176 case HType.STRING: prefix = 's'; break; | 176 case HType.STRING: prefix = 's'; break; |
| 177 case HType.UNKNOWN: prefix = 'v'; break; | 177 case HType.UNKNOWN: prefix = 'v'; break; |
| 178 case HType.CONFLICTING: prefix = 'c'; break; | 178 case HType.CONFLICTING: prefix = 'c'; break; |
| 179 case HType.STRING_OR_ARRAY: prefix = 'r'; break; | 179 case HType.STRING_OR_ARRAY: prefix = 'r'; break; |
| 180 default: unreachable(); | 180 default: unreachable(); |
| 181 } | 181 } |
| 182 return "$prefix${instruction.id}"; | 182 return "$prefix${instruction.id}"; |
| 183 } | 183 } |
| 184 | 184 |
| 185 String visitBoolify(HBoolify node) { | 185 String visitBoolify(HBoolify node) { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 402 } |
| 403 | 403 |
| 404 String visitTypeGuard(HTypeGuard node) { | 404 String visitTypeGuard(HTypeGuard node) { |
| 405 String type; | 405 String type; |
| 406 switch (node.guardedType) { | 406 switch (node.guardedType) { |
| 407 case HType.MUTABLE_ARRAY: type = "mutable_array"; break; | 407 case HType.MUTABLE_ARRAY: type = "mutable_array"; break; |
| 408 case HType.READABLE_ARRAY: type = "readable_array"; break; | 408 case HType.READABLE_ARRAY: type = "readable_array"; break; |
| 409 case HType.BOOLEAN: type = "bool"; break; | 409 case HType.BOOLEAN: type = "bool"; break; |
| 410 case HType.INTEGER: type = "integer"; break; | 410 case HType.INTEGER: type = "integer"; break; |
| 411 case HType.DOUBLE: type = "double"; break; | 411 case HType.DOUBLE: type = "double"; break; |
| 412 case HType.NUMBER: type = "number"; break; | 412 case HType.INTEGER_OR_DOUBLE: type = "integer_or_double"; break; |
| 413 case HType.STRING: type = "string"; break; | 413 case HType.STRING: type = "string"; break; |
| 414 case HType.STRING_OR_ARRAY: type = "string_or_array"; break; | 414 case HType.STRING_OR_ARRAY: type = "string_or_array"; break; |
| 415 case HType.UNKNOWN: type = 'unknown'; break; | 415 case HType.UNKNOWN: type = 'unknown'; break; |
| 416 default: unreachable(); | 416 default: unreachable(); |
| 417 } | 417 } |
| 418 StringBuffer envBuffer = new StringBuffer(); | 418 StringBuffer envBuffer = new StringBuffer(); |
| 419 List<HInstruction> inputs = node.inputs; | 419 List<HInstruction> inputs = node.inputs; |
| 420 // The last input is the guarded expression. | 420 // The last input is the guarded expression. |
| 421 for (int i = 0; i < inputs.length - 1; i++) { | 421 for (int i = 0; i < inputs.length - 1; i++) { |
| 422 envBuffer.add(" ${temporaryId(inputs[i])}"); | 422 envBuffer.add(" ${temporaryId(inputs[i])}"); |
| 423 } | 423 } |
| 424 String on = node.isOn ? "on" : "off"; | 424 String on = node.isOn ? "on" : "off"; |
| 425 String id = temporaryId(node.guarded); | 425 String id = temporaryId(node.guarded); |
| 426 return "TypeGuard($on): $id is $type env: $envBuffer"; | 426 return "TypeGuard($on): $id is $type env: $envBuffer"; |
| 427 } | 427 } |
| 428 | 428 |
| 429 String visitIs(HIs node) { | 429 String visitIs(HIs node) { |
| 430 String type = node.typeName.toString(); | 430 String type = node.typeName.toString(); |
| 431 return "TypeTest: ${temporaryId(node.expression)} is $type"; | 431 return "TypeTest: ${temporaryId(node.expression)} is $type"; |
| 432 } | 432 } |
| 433 } | 433 } |
| OLD | NEW |