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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 HInstruction constantInterceptor = | 248 HInstruction constantInterceptor = |
249 tryComputeConstantInterceptor(receiver, interceptedClasses); | 249 tryComputeConstantInterceptor(receiver, interceptedClasses); |
250 if (constantInterceptor != null) { | 250 if (constantInterceptor != null) { |
251 node.block.rewrite(node, constantInterceptor); | 251 node.block.rewrite(node, constantInterceptor); |
252 return false; | 252 return false; |
253 } | 253 } |
254 | 254 |
255 node.interceptedClasses = interceptedClasses; | 255 node.interceptedClasses = interceptedClasses; |
256 | 256 |
257 // Try creating a one-shot interceptor. | 257 // Try creating a one-shot interceptor. |
| 258 if (compiler.hasIncrementalSupport) return false; |
258 if (node.usedBy.length != 1) return false; | 259 if (node.usedBy.length != 1) return false; |
259 if (node.usedBy[0] is !HInvokeDynamic) return false; | 260 if (node.usedBy[0] is !HInvokeDynamic) return false; |
260 | 261 |
261 HInvokeDynamic user = node.usedBy[0]; | 262 HInvokeDynamic user = node.usedBy[0]; |
262 | 263 |
263 // If [node] was loop hoisted, we keep the interceptor. | 264 // If [node] was loop hoisted, we keep the interceptor. |
264 if (!user.hasSameLoopHeaderAs(node)) return false; | 265 if (!user.hasSameLoopHeaderAs(node)) return false; |
265 | 266 |
266 // Replace the user with a [HOneShotInterceptor]. | 267 // Replace the user with a [HOneShotInterceptor]. |
267 HConstant nullConstant = graph.addConstantNull(compiler); | 268 HConstant nullConstant = graph.addConstantNull(compiler); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 instruction = new HInvokeDynamicMethod( | 322 instruction = new HInvokeDynamicMethod( |
322 selector, inputs, node.instructionType, true); | 323 selector, inputs, node.instructionType, true); |
323 } | 324 } |
324 | 325 |
325 HBasicBlock block = node.block; | 326 HBasicBlock block = node.block; |
326 block.addAfter(node, instruction); | 327 block.addAfter(node, instruction); |
327 block.rewrite(node, instruction); | 328 block.rewrite(node, instruction); |
328 return true; | 329 return true; |
329 } | 330 } |
330 } | 331 } |
OLD | NEW |