| 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 js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
| 8 | 8 |
| 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
| 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 if (constant.isFunction) { | 982 if (constant.isFunction) { |
| 983 FunctionConstantValue function = constant; | 983 FunctionConstantValue function = constant; |
| 984 registry.registerGetOfStaticFunction(function.element); | 984 registry.registerGetOfStaticFunction(function.element); |
| 985 } else if (constant.isInterceptor) { | 985 } else if (constant.isInterceptor) { |
| 986 // An interceptor constant references the class's prototype chain. | 986 // An interceptor constant references the class's prototype chain. |
| 987 InterceptorConstantValue interceptor = constant; | 987 InterceptorConstantValue interceptor = constant; |
| 988 registerInstantiatedConstantType(interceptor.dispatchedType, registry); | 988 registerInstantiatedConstantType(interceptor.dispatchedType, registry); |
| 989 } else if (constant.isType) { | 989 } else if (constant.isType) { |
| 990 enqueueInResolution(getCreateRuntimeType(), registry); | 990 enqueueInResolution(getCreateRuntimeType(), registry); |
| 991 registry.registerInstantiation(typeImplementation.rawType); | 991 registry.registerInstantiation(typeImplementation.rawType); |
| 992 TypeConstantValue typeConstant = constant; | |
| 993 DartType representedType = typeConstant.representedType; | |
| 994 if (representedType != const DynamicType()) { | |
| 995 lookupMapAnalysis.registerTypeConstant(representedType.element); | |
| 996 } | |
| 997 } | 992 } |
| 993 lookupMapAnalysis.registerConstantKey(constant); |
| 998 } | 994 } |
| 999 | 995 |
| 1000 void registerInstantiatedConstantType(DartType type, Registry registry) { | 996 void registerInstantiatedConstantType(DartType type, Registry registry) { |
| 1001 DartType instantiatedType = | 997 DartType instantiatedType = |
| 1002 type.isFunctionType ? compiler.functionClass.rawType : type; | 998 type.isFunctionType ? compiler.functionClass.rawType : type; |
| 1003 if (type is InterfaceType) { | 999 if (type is InterfaceType) { |
| 1004 registry.registerInstantiation(instantiatedType); | 1000 registry.registerInstantiation(instantiatedType); |
| 1005 if (!type.treatAsRaw && classNeedsRti(type.element)) { | 1001 if (!type.treatAsRaw && classNeedsRti(type.element)) { |
| 1006 registry.registerStaticInvocation(getSetRuntimeTypeInfo()); | 1002 registry.registerStaticInvocation(getSetRuntimeTypeInfo()); |
| 1007 } | 1003 } |
| (...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3132 } | 3128 } |
| 3133 } | 3129 } |
| 3134 | 3130 |
| 3135 /// Records that [constant] is used by the element behind [registry]. | 3131 /// Records that [constant] is used by the element behind [registry]. |
| 3136 class Dependency { | 3132 class Dependency { |
| 3137 final ConstantValue constant; | 3133 final ConstantValue constant; |
| 3138 final Element annotatedElement; | 3134 final Element annotatedElement; |
| 3139 | 3135 |
| 3140 const Dependency(this.constant, this.annotatedElement); | 3136 const Dependency(this.constant, this.annotatedElement); |
| 3141 } | 3137 } |
| OLD | NEW |