| 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 2978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2989 if (element != null && element.isForeign(compiler)) { | 2989 if (element != null && element.isForeign(compiler)) { |
| 2990 visitForeignGetter(send); | 2990 visitForeignGetter(send); |
| 2991 } else if (Elements.isStaticOrTopLevelField(element)) { | 2991 } else if (Elements.isStaticOrTopLevelField(element)) { |
| 2992 Constant value; | 2992 Constant value; |
| 2993 if (element.isField && !element.isAssignable) { | 2993 if (element.isField && !element.isAssignable) { |
| 2994 // A static final or const. Get its constant value and inline it if | 2994 // A static final or const. Get its constant value and inline it if |
| 2995 // the value can be compiled eagerly. | 2995 // the value can be compiled eagerly. |
| 2996 value = backend.constants.getConstantForVariable(element); | 2996 value = backend.constants.getConstantForVariable(element); |
| 2997 } | 2997 } |
| 2998 if (value != null) { | 2998 if (value != null) { |
| 2999 HConstant instruction = graph.addConstant(value, compiler); | 2999 HConstant instruction; |
| 3000 // Constants that are referred via a deferred prefix should be referred |
| 3001 // by reference. |
| 3002 PrefixElement prefix = compiler.deferredLoadTask |
| 3003 .deferredPrefixElement(send, elements); |
| 3004 if (prefix != null) { |
| 3005 instruction = graph.addDeferredConstant(value, prefix, compiler); |
| 3006 } else { |
| 3007 instruction = graph.addConstant(value, compiler); |
| 3008 } |
| 3000 stack.add(instruction); | 3009 stack.add(instruction); |
| 3001 // The inferrer may have found a better type than the constant | 3010 // The inferrer may have found a better type than the constant |
| 3002 // handler in the case of lists, because the constant handler | 3011 // handler in the case of lists, because the constant handler |
| 3003 // does not look at elements in the list. | 3012 // does not look at elements in the list. |
| 3004 TypeMask type = | 3013 TypeMask type = |
| 3005 TypeMaskFactory.inferredTypeForElement(element, compiler); | 3014 TypeMaskFactory.inferredTypeForElement(element, compiler); |
| 3006 if (!type.containsAll(compiler) && !instruction.isConstantNull()) { | 3015 if (!type.containsAll(compiler) && !instruction.isConstantNull()) { |
| 3007 // TODO(13429): The inferrer should know that an element | 3016 // TODO(13429): The inferrer should know that an element |
| 3008 // cannot be null. | 3017 // cannot be null. |
| 3009 instruction.instructionType = type.nonNullable(); | 3018 instruction.instructionType = type.nonNullable(); |
| (...skipping 3333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6343 DartType unaliased = type.unalias(builder.compiler); | 6352 DartType unaliased = type.unalias(builder.compiler); |
| 6344 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6353 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6345 unaliased.accept(this, builder); | 6354 unaliased.accept(this, builder); |
| 6346 } | 6355 } |
| 6347 | 6356 |
| 6348 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6357 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6349 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType'); | 6358 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType'); |
| 6350 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); | 6359 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); |
| 6351 } | 6360 } |
| 6352 } | 6361 } |
| OLD | NEW |