| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 ssa.tracer; | 5 library ssa.tracer; |
| 6 | 6 |
| 7 import 'dart:async' show EventSink; | 7 import 'dart:async' show EventSink; |
| 8 | 8 |
| 9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
| 10 import '../diagnostics/invariant.dart' show DEBUG_MODE; | 10 import '../diagnostics/invariant.dart' show DEBUG_MODE; |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 String visitInvokeSuper(HInvokeSuper invoke) { | 327 String visitInvokeSuper(HInvokeSuper invoke) { |
| 328 String target = invoke.element.name; | 328 String target = invoke.element.name; |
| 329 return handleGenericInvoke("InvokeSuper", target, invoke.inputs); | 329 return handleGenericInvoke("InvokeSuper", target, invoke.inputs); |
| 330 } | 330 } |
| 331 | 331 |
| 332 String visitInvokeConstructorBody(HInvokeConstructorBody invoke) { | 332 String visitInvokeConstructorBody(HInvokeConstructorBody invoke) { |
| 333 String target = invoke.element.name; | 333 String target = invoke.element.name; |
| 334 return handleGenericInvoke("InvokeConstructorBody", target, invoke.inputs); | 334 return handleGenericInvoke("InvokeConstructorBody", target, invoke.inputs); |
| 335 } | 335 } |
| 336 | 336 |
| 337 String visitForeignCode(HForeignCode foreign) { | 337 String visitForeignCode(HForeignCode node) { |
| 338 return handleGenericInvoke( | 338 var template = node.codeTemplate; |
| 339 "ForeignCode", "${foreign.codeTemplate.ast}", foreign.inputs); | 339 String code = '${template.ast}'; |
| 340 var inputs = node.inputs.map(temporaryId).join(', '); |
| 341 return "ForeignCode: $code ($inputs)"; |
| 340 } | 342 } |
| 341 | 343 |
| 342 String visitLess(HLess node) => handleInvokeBinary(node, 'Less'); | 344 String visitLess(HLess node) => handleInvokeBinary(node, 'Less'); |
| 343 String visitLessEqual(HLessEqual node) => | 345 String visitLessEqual(HLessEqual node) => |
| 344 handleInvokeBinary(node, 'LessEqual'); | 346 handleInvokeBinary(node, 'LessEqual'); |
| 345 | 347 |
| 346 String visitLiteralList(HLiteralList node) { | 348 String visitLiteralList(HLiteralList node) { |
| 347 StringBuffer elementsString = new StringBuffer(); | 349 StringBuffer elementsString = new StringBuffer(); |
| 348 for (int i = 0; i < node.inputs.length; i++) { | 350 for (int i = 0; i < node.inputs.length; i++) { |
| 349 if (i != 0) elementsString.write(", "); | 351 if (i != 0) elementsString.write(", "); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 String type = node.typeExpression.toString(); | 477 String type = node.typeExpression.toString(); |
| 476 return "Is: ${temporaryId(node.expression)} is $type"; | 478 return "Is: ${temporaryId(node.expression)} is $type"; |
| 477 } | 479 } |
| 478 | 480 |
| 479 String visitIsViaInterceptor(HIsViaInterceptor node) { | 481 String visitIsViaInterceptor(HIsViaInterceptor node) { |
| 480 String type = node.typeExpression.toString(); | 482 String type = node.typeExpression.toString(); |
| 481 return "IsViaInterceptor: ${temporaryId(node.inputs[0])} is $type"; | 483 return "IsViaInterceptor: ${temporaryId(node.inputs[0])} is $type"; |
| 482 } | 484 } |
| 483 | 485 |
| 484 String visitTypeConversion(HTypeConversion node) { | 486 String visitTypeConversion(HTypeConversion node) { |
| 485 assert(node.inputs.length <= 2); | 487 String checkedInput = temporaryId(node.checkedInput); |
| 486 String otherInput = | 488 String rest; |
| 487 (node.inputs.length == 2) ? temporaryId(node.inputs[1]) : ''; | 489 if (node.usesMethodOnType) { |
| 488 return "TypeConversion: ${temporaryId(node.checkedInput)} to " | 490 assert(node.inputs.length == 2); |
| 489 "${node.instructionType} $otherInput"; | 491 assert(identical(node.checkedInput, node.inputs.last)); |
| 492 rest = " ${temporaryId(node.inputs.first)}"; |
| 493 } else if (node.inputs.length == 2) { |
| 494 rest = " ${temporaryId(node.inputs.last)}"; |
| 495 } else { |
| 496 assert(node.inputs.length == 1); |
| 497 rest = ""; |
| 498 } |
| 499 return "TypeConversion: $checkedInput to ${node.instructionType}$rest"; |
| 490 } | 500 } |
| 491 | 501 |
| 492 String visitTypeKnown(HTypeKnown node) { | 502 String visitTypeKnown(HTypeKnown node) { |
| 493 assert(node.inputs.length <= 2); | 503 assert(node.inputs.length <= 2); |
| 494 String result = | 504 String result = |
| 495 "TypeKnown: ${temporaryId(node.checkedInput)} is ${node.knownType}"; | 505 "TypeKnown: ${temporaryId(node.checkedInput)} is ${node.knownType}"; |
| 496 if (node.witness != null) { | 506 if (node.witness != null) { |
| 497 result += " witnessed by ${temporaryId(node.witness)}"; | 507 result += " witnessed by ${temporaryId(node.witness)}"; |
| 498 } | 508 } |
| 499 return result; | 509 return result; |
| 500 } | 510 } |
| 501 | 511 |
| 502 String visitRangeConversion(HRangeConversion node) { | 512 String visitRangeConversion(HRangeConversion node) { |
| 503 return "RangeConversion: ${node.checkedInput}"; | 513 return "RangeConversion: ${node.checkedInput}"; |
| 504 } | 514 } |
| 505 | 515 |
| 506 String visitTypeInfoReadRaw(HTypeInfoReadRaw node) { | 516 String visitTypeInfoReadRaw(HTypeInfoReadRaw node) { |
| 507 return "TypeInfoReadRaw"; | 517 var inputs = node.inputs.map(temporaryId).join(', '); |
| 518 return "TypeInfoReadRaw: $inputs"; |
| 508 } | 519 } |
| 509 | 520 |
| 510 String visitTypeInfoReadVariable(HTypeInfoReadVariable node) { | 521 String visitTypeInfoReadVariable(HTypeInfoReadVariable node) { |
| 511 return "TypeInfoReadVariable ${node.variable}"; | 522 return "TypeInfoReadVariable: " |
| 523 "${temporaryId(node.inputs.single)}.${node.variable}"; |
| 512 } | 524 } |
| 513 | 525 |
| 514 String visitTypeInfoExpression(HTypeInfoExpression node) { | 526 String visitTypeInfoExpression(HTypeInfoExpression node) { |
| 515 return "TypeInfoExpression ${node.kindAsString} ${node.dartType}"; | 527 var inputs = node.inputs.map(temporaryId).join(', '); |
| 528 return "TypeInfoExpression: ${node.kindAsString} ${node.dartType}" |
| 529 " ($inputs)"; |
| 516 } | 530 } |
| 517 | 531 |
| 518 String visitReadTypeVariable(HReadTypeVariable node) { | 532 String visitReadTypeVariable(HReadTypeVariable node) { |
| 519 return "ReadTypeVariable: ${node.dartType} ${node.hasReceiver}"; | 533 var inputs = node.inputs.map(temporaryId).join(', '); |
| 534 return "ReadTypeVariable: ${node.dartType} ${node.hasReceiver} $inputs"; |
| 520 } | 535 } |
| 521 | 536 |
| 522 String visitFunctionType(HFunctionType node) { | 537 String visitFunctionType(HFunctionType node) { |
| 523 return "FunctionType: ${node.dartType}"; | 538 var inputs = node.inputs.map(temporaryId).join(', '); |
| 539 return "FunctionType: ${node.dartType} $inputs"; |
| 524 } | 540 } |
| 525 | 541 |
| 526 String visitVoidType(HVoidType node) { | 542 String visitVoidType(HVoidType node) { |
| 527 return "VoidType"; | 543 return "VoidType"; |
| 528 } | 544 } |
| 529 | 545 |
| 530 String visitInterfaceType(HInterfaceType node) { | 546 String visitInterfaceType(HInterfaceType node) { |
| 531 return "InterfaceType: ${node.dartType}"; | 547 return "InterfaceType: ${node.dartType}"; |
| 532 } | 548 } |
| 533 | 549 |
| 534 String visitDynamicType(HDynamicType node) { | 550 String visitDynamicType(HDynamicType node) { |
| 535 return "DynamicType"; | 551 return "DynamicType"; |
| 536 } | 552 } |
| 537 | 553 |
| 538 String visitAwait(HAwait node) { | 554 String visitAwait(HAwait node) { |
| 539 return "Await: ${temporaryId(node.inputs[0])}"; | 555 return "Await: ${temporaryId(node.inputs[0])}"; |
| 540 } | 556 } |
| 541 | 557 |
| 542 String visitYield(HYield node) { | 558 String visitYield(HYield node) { |
| 543 return "Yield${node.hasStar ? "*" : ""}: ${temporaryId(node.inputs[0])}"; | 559 return "Yield${node.hasStar ? "*" : ""}: ${temporaryId(node.inputs[0])}"; |
| 544 } | 560 } |
| 545 } | 561 } |
| OLD | NEW |