| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 * A special element for the extra parameter taken by intercepted | 8 * A special element for the extra parameter taken by intercepted |
| 9 * methods. We need to override [Element.computeType] because our | 9 * methods. We need to override [Element.computeType] because our |
| 10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
| (...skipping 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3100 value = compiler.constantHandler.getConstantForVariable(element); | 3100 value = compiler.constantHandler.getConstantForVariable(element); |
| 3101 } | 3101 } |
| 3102 if (value != null) { | 3102 if (value != null) { |
| 3103 HInstruction instruction = graph.addConstant(value, compiler); | 3103 HInstruction instruction = graph.addConstant(value, compiler); |
| 3104 stack.add(instruction); | 3104 stack.add(instruction); |
| 3105 // The inferrer may have found a better type than the constant | 3105 // The inferrer may have found a better type than the constant |
| 3106 // handler in the case of lists, because the constant handler | 3106 // handler in the case of lists, because the constant handler |
| 3107 // does not look at elements in the list. | 3107 // does not look at elements in the list. |
| 3108 TypeMask type = | 3108 TypeMask type = |
| 3109 TypeMaskFactory.inferredTypeForElement(element, compiler); | 3109 TypeMaskFactory.inferredTypeForElement(element, compiler); |
| 3110 if (!type.containsAll(compiler)) instruction.instructionType = type; | 3110 if (!type.containsAll(compiler)) { |
| 3111 // TODO(13429): The inferrer should know that an element |
| 3112 // cannot be null. |
| 3113 instruction.instructionType = type.nonNullable(); |
| 3114 } |
| 3111 } else if (element.isField() && isLazilyInitialized(element)) { | 3115 } else if (element.isField() && isLazilyInitialized(element)) { |
| 3112 HInstruction instruction = new HLazyStatic( | 3116 HInstruction instruction = new HLazyStatic( |
| 3113 element, | 3117 element, |
| 3114 TypeMaskFactory.inferredTypeForElement(element, compiler)); | 3118 TypeMaskFactory.inferredTypeForElement(element, compiler)); |
| 3115 push(instruction); | 3119 push(instruction); |
| 3116 } else { | 3120 } else { |
| 3117 if (element.isGetter()) { | 3121 if (element.isGetter()) { |
| 3118 pushInvokeStatic(send, element, <HInstruction>[]); | 3122 pushInvokeStatic(send, element, <HInstruction>[]); |
| 3119 } else { | 3123 } else { |
| 3120 // TODO(5346): Try to avoid the need for calling [declaration] before | 3124 // TODO(5346): Try to avoid the need for calling [declaration] before |
| (...skipping 3261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6382 DartType unaliased = type.unalias(builder.compiler); | 6386 DartType unaliased = type.unalias(builder.compiler); |
| 6383 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6387 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6384 unaliased.accept(this, builder); | 6388 unaliased.accept(this, builder); |
| 6385 } | 6389 } |
| 6386 | 6390 |
| 6387 void visitDynamicType(DynamicType type, SsaFromAstMixin builder) { | 6391 void visitDynamicType(DynamicType type, SsaFromAstMixin builder) { |
| 6388 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType'); | 6392 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType'); |
| 6389 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); | 6393 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); |
| 6390 } | 6394 } |
| 6391 } | 6395 } |
| OLD | NEW |