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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 ConstantValue constant = | 128 ConstantValue constant = |
129 new InterceptorConstantValue(constantInterceptor.thisType); | 129 new InterceptorConstantValue(constantInterceptor.thisType); |
130 return graph.addConstant(constant, compiler); | 130 return graph.addConstant(constant, compiler); |
131 } | 131 } |
132 | 132 |
133 ClassElement tryComputeConstantInterceptorFromType( | 133 ClassElement tryComputeConstantInterceptorFromType( |
134 TypeMask type, | 134 TypeMask type, |
135 Set<ClassElement> interceptedClasses) { | 135 Set<ClassElement> interceptedClasses) { |
136 | 136 |
137 if (type.isNullable) { | 137 if (type.isNullable) { |
138 if (type.isEmpty) { | 138 if (type.isNull) { |
139 return helpers.jsNullClass; | 139 return helpers.jsNullClass; |
140 } | 140 } |
141 } else if (type.containsOnlyInt(classWorld)) { | 141 } else if (type.containsOnlyInt(classWorld)) { |
142 return helpers.jsIntClass; | 142 return helpers.jsIntClass; |
143 } else if (type.containsOnlyDouble(classWorld)) { | 143 } else if (type.containsOnlyDouble(classWorld)) { |
144 return helpers.jsDoubleClass; | 144 return helpers.jsDoubleClass; |
145 } else if (type.containsOnlyBool(classWorld)) { | 145 } else if (type.containsOnlyBool(classWorld)) { |
146 return helpers.jsBoolClass; | 146 return helpers.jsBoolClass; |
147 } else if (type.containsOnlyString(classWorld)) { | 147 } else if (type.containsOnlyString(classWorld)) { |
148 return helpers.jsStringClass; | 148 return helpers.jsStringClass; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 instruction = new HInvokeDynamicMethod( | 402 instruction = new HInvokeDynamicMethod( |
403 selector, mask, inputs, node.instructionType, true); | 403 selector, mask, inputs, node.instructionType, true); |
404 } | 404 } |
405 | 405 |
406 HBasicBlock block = node.block; | 406 HBasicBlock block = node.block; |
407 block.addAfter(node, instruction); | 407 block.addAfter(node, instruction); |
408 block.rewrite(node, instruction); | 408 block.rewrite(node, instruction); |
409 return true; | 409 return true; |
410 } | 410 } |
411 } | 411 } |
OLD | NEW |