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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 if (constantInterceptor == null) return null; | 141 if (constantInterceptor == null) return null; |
142 | 142 |
143 // If we just happen to be in an instance method of the constant | 143 // If we just happen to be in an instance method of the constant |
144 // interceptor, `this` is a shorter alias. | 144 // interceptor, `this` is a shorter alias. |
145 if (constantInterceptor == work.element.enclosingClass && | 145 if (constantInterceptor == work.element.enclosingClass && |
146 graph.thisInstruction != null) { | 146 graph.thisInstruction != null) { |
147 return graph.thisInstruction; | 147 return graph.thisInstruction; |
148 } | 148 } |
149 | 149 |
150 Constant constant = new InterceptorConstant(constantInterceptor.thisType); | 150 ConstantValue constant = |
| 151 new InterceptorConstantValue(constantInterceptor.thisType); |
151 return graph.addConstant(constant, compiler); | 152 return graph.addConstant(constant, compiler); |
152 } | 153 } |
153 | 154 |
154 HInstruction findDominator(Iterable<HInstruction> instructions) { | 155 HInstruction findDominator(Iterable<HInstruction> instructions) { |
155 HInstruction result; | 156 HInstruction result; |
156 L1: for (HInstruction candidate in instructions) { | 157 L1: for (HInstruction candidate in instructions) { |
157 for (HInstruction current in instructions) { | 158 for (HInstruction current in instructions) { |
158 if (current != candidate && !candidate.dominates(current)) continue L1; | 159 if (current != candidate && !candidate.dominates(current)) continue L1; |
159 } | 160 } |
160 result = candidate; | 161 result = candidate; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 instruction = new HInvokeDynamicMethod( | 296 instruction = new HInvokeDynamicMethod( |
296 selector, inputs, node.instructionType, true); | 297 selector, inputs, node.instructionType, true); |
297 } | 298 } |
298 | 299 |
299 HBasicBlock block = node.block; | 300 HBasicBlock block = node.block; |
300 block.addAfter(node, instruction); | 301 block.addAfter(node, instruction); |
301 block.rewrite(node, instruction); | 302 block.rewrite(node, instruction); |
302 return true; | 303 return true; |
303 } | 304 } |
304 } | 305 } |
OLD | NEW |