| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 // [interceptedClasses] is sparse - it is just the classes that define some | 80 // [interceptedClasses] is sparse - it is just the classes that define some |
| 81 // intercepted method. Their subclasses (that inherit the method) are | 81 // intercepted method. Their subclasses (that inherit the method) are |
| 82 // implicit, so we have to extend them. | 82 // implicit, so we have to extend them. |
| 83 | 83 |
| 84 TypeMask receiverMask = receiverType.computeMask(compiler); | 84 TypeMask receiverMask = receiverType.computeMask(compiler); |
| 85 return interceptedClasses | 85 return interceptedClasses |
| 86 .where((cls) => cls != compiler.objectClass) | 86 .where((cls) => cls != compiler.objectClass) |
| 87 .map((cls) => backend.classesMixedIntoNativeClasses.contains(cls) | 87 .map((cls) => backend.classesMixedIntoNativeClasses.contains(cls) |
| 88 ? new TypeMask.subtype(cls.rawType) | 88 ? new TypeMask.subtype(cls) |
| 89 : new TypeMask.subclass(cls.rawType)) | 89 : new TypeMask.subclass(cls)) |
| 90 .every((mask) => receiverMask.intersection(mask, compiler).isEmpty); | 90 .every((mask) => receiverMask.intersection(mask, compiler).isEmpty); |
| 91 } | 91 } |
| 92 | 92 |
| 93 HInstruction tryComputeConstantInterceptor( | 93 HInstruction tryComputeConstantInterceptor( |
| 94 HInstruction input, | 94 HInstruction input, |
| 95 Set<ClassElement> interceptedClasses) { | 95 Set<ClassElement> interceptedClasses) { |
| 96 if (input == graph.explicitReceiverParameter) { | 96 if (input == graph.explicitReceiverParameter) { |
| 97 // If `explicitReceiverParameter` is set it means the current method is an | 97 // If `explicitReceiverParameter` is set it means the current method is an |
| 98 // interceptor method, and `this` is the interceptor. The caller just did | 98 // interceptor method, and `this` is the interceptor. The caller just did |
| 99 // `getInterceptor(foo).currentMethod(foo)` to enter the current method. | 99 // `getInterceptor(foo).currentMethod(foo)` to enter the current method. |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 inputs[0] = constant; | 292 inputs[0] = constant; |
| 293 instruction = new HInvokeDynamicMethod(selector, inputs, true); | 293 instruction = new HInvokeDynamicMethod(selector, inputs, true); |
| 294 } | 294 } |
| 295 | 295 |
| 296 HBasicBlock block = node.block; | 296 HBasicBlock block = node.block; |
| 297 block.addAfter(node, instruction); | 297 block.addAfter(node, instruction); |
| 298 block.rewrite(node, instruction); | 298 block.rewrite(node, instruction); |
| 299 return true; | 299 return true; |
| 300 } | 300 } |
| 301 } | 301 } |
| OLD | NEW |