| 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 implement [TypedElement.type] because our | 9 * methods. We need to implement [TypedElement.type] because our |
| 10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
| (...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2950 if (element != null && element.isForeign(compiler)) { | 2950 if (element != null && element.isForeign(compiler)) { |
| 2951 visitForeignGetter(send); | 2951 visitForeignGetter(send); |
| 2952 } else if (Elements.isStaticOrTopLevelField(element)) { | 2952 } else if (Elements.isStaticOrTopLevelField(element)) { |
| 2953 Constant value; | 2953 Constant value; |
| 2954 if (element.isField() && !element.isAssignable()) { | 2954 if (element.isField() && !element.isAssignable()) { |
| 2955 // A static final or const. Get its constant value and inline it if | 2955 // A static final or const. Get its constant value and inline it if |
| 2956 // the value can be compiled eagerly. | 2956 // the value can be compiled eagerly. |
| 2957 value = backend.constants.getConstantForVariable(element); | 2957 value = backend.constants.getConstantForVariable(element); |
| 2958 } | 2958 } |
| 2959 if (value != null) { | 2959 if (value != null) { |
| 2960 HConstant instruction = graph.addConstant(value, compiler); | 2960 HConstant instruction; |
| 2961 // Constants that are referred via a deferred prefix should be referred |
| 2962 // by reference. |
| 2963 PrefixElement prefix = compiler.deferredLoadTask |
| 2964 .deferredPrefixElement(send, elements); |
| 2965 if (prefix != null) { |
| 2966 instruction = graph.addDeferredConstant(value, prefix, compiler); |
| 2967 } else { |
| 2968 instruction = graph.addConstant(value, compiler); |
| 2969 } |
| 2961 stack.add(instruction); | 2970 stack.add(instruction); |
| 2962 // The inferrer may have found a better type than the constant | 2971 // The inferrer may have found a better type than the constant |
| 2963 // handler in the case of lists, because the constant handler | 2972 // handler in the case of lists, because the constant handler |
| 2964 // does not look at elements in the list. | 2973 // does not look at elements in the list. |
| 2965 TypeMask type = | 2974 TypeMask type = |
| 2966 TypeMaskFactory.inferredTypeForElement(element, compiler); | 2975 TypeMaskFactory.inferredTypeForElement(element, compiler); |
| 2967 if (!type.containsAll(compiler) && !instruction.isConstantNull()) { | 2976 if (!type.containsAll(compiler) && !instruction.isConstantNull()) { |
| 2968 // TODO(13429): The inferrer should know that an element | 2977 // TODO(13429): The inferrer should know that an element |
| 2969 // cannot be null. | 2978 // cannot be null. |
| 2970 instruction.instructionType = type.nonNullable(); | 2979 instruction.instructionType = type.nonNullable(); |
| (...skipping 3321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6292 DartType unaliased = type.unalias(builder.compiler); | 6301 DartType unaliased = type.unalias(builder.compiler); |
| 6293 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6302 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6294 unaliased.accept(this, builder); | 6303 unaliased.accept(this, builder); |
| 6295 } | 6304 } |
| 6296 | 6305 |
| 6297 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6306 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6298 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType'); | 6307 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType'); |
| 6299 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); | 6308 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); |
| 6300 } | 6309 } |
| 6301 } | 6310 } |
| OLD | NEW |