| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 class SsaCodeGeneratorTask extends CompilerTask { | 7 class SsaCodeGeneratorTask extends CompilerTask { |
| 8 | 8 |
| 9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
| 10 | 10 |
| (...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 // branches, and is not the join block. | 1465 // branches, and is not the join block. |
| 1466 // Depending on how the then/else branches terminate | 1466 // Depending on how the then/else branches terminate |
| 1467 // (e.g., return/throw/break) there can be any number of these. | 1467 // (e.g., return/throw/break) there can be any number of these. |
| 1468 List<HBasicBlock> dominated = node.block.dominatedBlocks; | 1468 List<HBasicBlock> dominated = node.block.dominatedBlocks; |
| 1469 for (int i = 2; i < dominated.length; i++) { | 1469 for (int i = 2; i < dominated.length; i++) { |
| 1470 visitBasicBlock(dominated[i]); | 1470 visitBasicBlock(dominated[i]); |
| 1471 } | 1471 } |
| 1472 } | 1472 } |
| 1473 | 1473 |
| 1474 void visitInterceptor(HInterceptor node) { | 1474 void visitInterceptor(HInterceptor node) { |
| 1475 registry.registerSpecializedGetInterceptor(node.interceptedClasses); | 1475 if (node.isConditionalConstantInterceptor) { |
| 1476 String name = backend.namer.nameForGetInterceptor(node.interceptedClasses); | 1476 assert(node.inputs.length == 2); |
| 1477 var isolate = new js.VariableUse( | 1477 use(node.receiver); |
| 1478 backend.namer.globalObjectFor(backend.interceptorsLibrary)); | 1478 js.Expression receiverExpression = pop(); |
| 1479 use(node.receiver); | 1479 use(node.conditionalConstantInterceptor); |
| 1480 List<js.Expression> arguments = <js.Expression>[pop()]; | 1480 js.Expression constant = pop(); |
| 1481 push(js.propertyCall(isolate, name, arguments), node); | 1481 push(js.js('# && #', [receiverExpression, constant])); |
| 1482 registry.registerUseInterceptor(); | 1482 } else { |
| 1483 assert(node.inputs.length == 1); |
| 1484 registry.registerSpecializedGetInterceptor(node.interceptedClasses); |
| 1485 String name = |
| 1486 backend.namer.nameForGetInterceptor(node.interceptedClasses); |
| 1487 var isolate = new js.VariableUse( |
| 1488 backend.namer.globalObjectFor(backend.interceptorsLibrary)); |
| 1489 use(node.receiver); |
| 1490 List<js.Expression> arguments = <js.Expression>[pop()]; |
| 1491 push(js.propertyCall(isolate, name, arguments), node); |
| 1492 registry.registerUseInterceptor(); |
| 1493 } |
| 1483 } | 1494 } |
| 1484 | 1495 |
| 1485 visitInvokeDynamicMethod(HInvokeDynamicMethod node) { | 1496 visitInvokeDynamicMethod(HInvokeDynamicMethod node) { |
| 1486 use(node.receiver); | 1497 use(node.receiver); |
| 1487 js.Expression object = pop(); | 1498 js.Expression object = pop(); |
| 1488 String name = node.selector.name; | 1499 String name = node.selector.name; |
| 1489 String methodName; | 1500 String methodName; |
| 1490 List<js.Expression> arguments = visitArguments(node.inputs); | 1501 List<js.Expression> arguments = visitArguments(node.inputs); |
| 1491 Element target = node.element; | 1502 Element target = node.element; |
| 1492 | 1503 |
| (...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2667 js.PropertyAccess accessHelper(String name) { | 2678 js.PropertyAccess accessHelper(String name) { |
| 2668 Element helper = backend.findHelper(name); | 2679 Element helper = backend.findHelper(name); |
| 2669 if (helper == null) { | 2680 if (helper == null) { |
| 2670 // For mocked-up tests. | 2681 // For mocked-up tests. |
| 2671 return js.js('(void 0).$name'); | 2682 return js.js('(void 0).$name'); |
| 2672 } | 2683 } |
| 2673 registry.registerStaticUse(helper); | 2684 registry.registerStaticUse(helper); |
| 2674 return backend.emitter.staticFunctionAccess(helper); | 2685 return backend.emitter.staticFunctionAccess(helper); |
| 2675 } | 2686 } |
| 2676 } | 2687 } |
| OLD | NEW |