| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * This phase simplifies interceptors in multiple ways: | 8 * This phase simplifies interceptors in multiple ways: |
| 9 * | 9 * |
| 10 * 1) If the interceptor is for an object whose type is known, it | 10 * 1) If the interceptor is for an object whose type is known, it |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // interceptor directly. | 160 // interceptor directly. |
| 161 | 161 |
| 162 // TODO(sra): Key DOM classes like Node, Element and Event are not leaf | 162 // TODO(sra): Key DOM classes like Node, Element and Event are not leaf |
| 163 // classes. When the receiver type is not a leaf class, we might still be | 163 // classes. When the receiver type is not a leaf class, we might still be |
| 164 // able to use the receiver class as a constant interceptor. It is | 164 // able to use the receiver class as a constant interceptor. It is |
| 165 // usually the case that methods defined on a non-leaf class don't test | 165 // usually the case that methods defined on a non-leaf class don't test |
| 166 // for a subclass or call methods defined on a subclass. Provided the | 166 // for a subclass or call methods defined on a subclass. Provided the |
| 167 // code is completely insensitive to the specific instance subclasses, we | 167 // code is completely insensitive to the specific instance subclasses, we |
| 168 // can use the non-leaf class directly. | 168 // can use the non-leaf class directly. |
| 169 ClassElement element = type.singleClass(classWorld); | 169 ClassElement element = type.singleClass(classWorld); |
| 170 if (element != null && element.isNative) { | 170 if (element != null && backend.isNative(element)) { |
| 171 return element; | 171 return element; |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 return null; | 175 return null; |
| 176 } | 176 } |
| 177 | 177 |
| 178 HInstruction findDominator(Iterable<HInstruction> instructions) { | 178 HInstruction findDominator(Iterable<HInstruction> instructions) { |
| 179 HInstruction result; | 179 HInstruction result; |
| 180 L1: for (HInstruction candidate in instructions) { | 180 L1: for (HInstruction candidate in instructions) { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 instruction = new HInvokeDynamicMethod( | 403 instruction = new HInvokeDynamicMethod( |
| 404 selector, mask, inputs, node.instructionType, true); | 404 selector, mask, inputs, node.instructionType, true); |
| 405 } | 405 } |
| 406 | 406 |
| 407 HBasicBlock block = node.block; | 407 HBasicBlock block = node.block; |
| 408 block.addAfter(node, instruction); | 408 block.addAfter(node, instruction); |
| 409 block.rewrite(node, instruction); | 409 block.rewrite(node, instruction); |
| 410 return true; | 410 return true; |
| 411 } | 411 } |
| 412 } | 412 } |
| OLD | NEW |