| OLD | NEW |
| 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 #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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 prefix = 'r'; | 197 prefix = 'r'; |
| 198 } else if (type == HType.NULL) { | 198 } else if (type == HType.NULL) { |
| 199 prefix = 'u'; | 199 prefix = 'u'; |
| 200 } else { | 200 } else { |
| 201 prefix = 'x'; | 201 prefix = 'x'; |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 return "$prefix${instruction.id}"; | 204 return "$prefix${instruction.id}"; |
| 205 } | 205 } |
| 206 | 206 |
| 207 String visitBailoutTarget(HBailoutTarget node) { |
| 208 StringBuffer envBuffer = new StringBuffer(); |
| 209 List<HInstruction> inputs = node.inputs; |
| 210 for (int i = 0; i < inputs.length; i++) { |
| 211 envBuffer.add(" ${temporaryId(inputs[i])}"); |
| 212 } |
| 213 String on = node.isEnabled ? "enabled" : "disabled"; |
| 214 return "BailoutTarget($on): id: ${node.state} env: $envBuffer"; |
| 215 } |
| 216 |
| 207 String visitBoolify(HBoolify node) { | 217 String visitBoolify(HBoolify node) { |
| 208 return "Boolify: ${temporaryId(node.inputs[0])}"; | 218 return "Boolify: ${temporaryId(node.inputs[0])}"; |
| 209 } | 219 } |
| 210 | 220 |
| 211 String visitAdd(HAdd node) => visitInvokeStatic(node); | 221 String visitAdd(HAdd node) => visitInvokeStatic(node); |
| 212 | 222 |
| 213 String visitBitAnd(HBitAnd node) => visitInvokeStatic(node); | 223 String visitBitAnd(HBitAnd node) => visitInvokeStatic(node); |
| 214 | 224 |
| 215 String visitBitNot(HBitNot node) => visitInvokeStatic(node); | 225 String visitBitNot(HBitNot node) => visitInvokeStatic(node); |
| 216 | 226 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 type = "number"; | 482 type = "number"; |
| 473 } else if (guardedType == HType.STRING) { | 483 } else if (guardedType == HType.STRING) { |
| 474 type = "string"; | 484 type = "string"; |
| 475 } else if (guardedType == HType.INDEXABLE_PRIMITIVE) { | 485 } else if (guardedType == HType.INDEXABLE_PRIMITIVE) { |
| 476 type = "string_or_array"; | 486 type = "string_or_array"; |
| 477 } else if (guardedType == HType.UNKNOWN) { | 487 } else if (guardedType == HType.UNKNOWN) { |
| 478 type = 'unknown'; | 488 type = 'unknown'; |
| 479 } else { | 489 } else { |
| 480 throw new CompilerCancelledException('Unexpected type guard: $type'); | 490 throw new CompilerCancelledException('Unexpected type guard: $type'); |
| 481 } | 491 } |
| 492 HInstruction guarded = node.guarded; |
| 493 HInstruction bailoutTarget = node.bailoutTarget; |
| 482 StringBuffer envBuffer = new StringBuffer(); | 494 StringBuffer envBuffer = new StringBuffer(); |
| 483 List<HInstruction> inputs = node.inputs; | 495 List<HInstruction> inputs = node.inputs; |
| 484 for (int i = 0; i < inputs.length; i++) { | 496 assert(inputs.length >= 2); |
| 485 if (inputs[i] !== node.guarded) { | 497 assert(inputs[0] == guarded); |
| 486 envBuffer.add(" ${temporaryId(inputs[i])}"); | 498 assert(inputs[1] == bailoutTarget); |
| 487 } | 499 for (int i = 2; i < inputs.length; i++) { |
| 500 envBuffer.add(" ${temporaryId(inputs[i])}"); |
| 488 } | 501 } |
| 489 String on = node.isEnabled ? "enabled" : "disabled"; | 502 String on = node.isEnabled ? "enabled" : "disabled"; |
| 490 String id = temporaryId(node.guarded); | 503 String guardedId = temporaryId(node.guarded); |
| 491 return "TypeGuard($on): $id is $type env: $envBuffer"; | 504 String bailoutId = temporaryId(node.bailoutTarget); |
| 505 return "TypeGuard($on): $guardedId is $type bailout: $bailoutId " |
| 506 "env: $envBuffer"; |
| 492 } | 507 } |
| 493 | 508 |
| 494 String visitIs(HIs node) { | 509 String visitIs(HIs node) { |
| 495 String type = node.typeExpression.toString(); | 510 String type = node.typeExpression.toString(); |
| 496 return "TypeTest: ${temporaryId(node.expression)} is $type"; | 511 return "TypeTest: ${temporaryId(node.expression)} is $type"; |
| 497 } | 512 } |
| 498 | 513 |
| 499 String visitTypeConversion(HTypeConversion node) { | 514 String visitTypeConversion(HTypeConversion node) { |
| 500 String type = node.propagatedType.toString(); | 515 String type = node.propagatedType.toString(); |
| 501 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type"; | 516 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type"; |
| 502 } | 517 } |
| 503 } | 518 } |
| OLD | NEW |