Chromium Code Reviews| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 FunctionInlineCache inlineCache = new FunctionInlineCache(); | 273 FunctionInlineCache inlineCache = new FunctionInlineCache(); |
| 274 | 274 |
| 275 LibraryElement jsHelperLibrary; | 275 LibraryElement jsHelperLibrary; |
| 276 LibraryElement asyncLibrary; | 276 LibraryElement asyncLibrary; |
| 277 LibraryElement interceptorsLibrary; | 277 LibraryElement interceptorsLibrary; |
| 278 LibraryElement foreignLibrary; | 278 LibraryElement foreignLibrary; |
| 279 LibraryElement isolateHelperLibrary; | 279 LibraryElement isolateHelperLibrary; |
| 280 | 280 |
| 281 ClassElement closureClass; | 281 ClassElement closureClass; |
| 282 ClassElement boundClosureClass; | 282 ClassElement boundClosureClass; |
| 283 Element assertMethod; | 283 Element assertConditionHelperMethod; |
| 284 Element assertThrowMethod; | |
| 284 Element invokeOnMethod; | 285 Element invokeOnMethod; |
| 285 | 286 |
| 286 ClassElement jsInterceptorClass; | 287 ClassElement jsInterceptorClass; |
| 287 ClassElement jsStringClass; | 288 ClassElement jsStringClass; |
| 288 ClassElement jsArrayClass; | 289 ClassElement jsArrayClass; |
| 289 ClassElement jsNumberClass; | 290 ClassElement jsNumberClass; |
| 290 ClassElement jsIntClass; | 291 ClassElement jsIntClass; |
| 291 ClassElement jsDoubleClass; | 292 ClassElement jsDoubleClass; |
| 292 ClassElement jsNullClass; | 293 ClassElement jsNullClass; |
| 293 ClassElement jsBoolClass; | 294 ClassElement jsBoolClass; |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1325 Element element = find(isolateHelperLibrary, name); | 1326 Element element = find(isolateHelperLibrary, name); |
| 1326 enqueuer.addToWorkList(element); | 1327 enqueuer.addToWorkList(element); |
| 1327 compiler.globalDependencies.registerDependency(element); | 1328 compiler.globalDependencies.registerDependency(element); |
| 1328 helpersUsed.add(element.declaration); | 1329 helpersUsed.add(element.declaration); |
| 1329 } | 1330 } |
| 1330 } else { | 1331 } else { |
| 1331 enqueuer.addToWorkList(find(isolateHelperLibrary, START_ROOT_ISOLATE)); | 1332 enqueuer.addToWorkList(find(isolateHelperLibrary, START_ROOT_ISOLATE)); |
| 1332 } | 1333 } |
| 1333 } | 1334 } |
| 1334 | 1335 |
| 1335 bool isAssertMethod(Element element) => element == assertMethod; | |
| 1336 | |
| 1337 void registerRequiredType(DartType type, Element enclosingElement) { | 1336 void registerRequiredType(DartType type, Element enclosingElement) { |
| 1338 // If [argument] has type variables or is a type variable, this method | 1337 // If [argument] has type variables or is a type variable, this method |
| 1339 // registers a RTI dependency between the class where the type variable is | 1338 // registers a RTI dependency between the class where the type variable is |
| 1340 // defined (that is the enclosing class of the current element being | 1339 // defined (that is the enclosing class of the current element being |
| 1341 // resolved) and the class of [type]. If the class of [type] requires RTI, | 1340 // resolved) and the class of [type]. If the class of [type] requires RTI, |
| 1342 // then the class of the type variable does too. | 1341 // then the class of the type variable does too. |
| 1343 ClassElement contextClass = Types.getClassContext(type); | 1342 ClassElement contextClass = Types.getClassContext(type); |
| 1344 if (contextClass != null) { | 1343 if (contextClass != null) { |
| 1345 assert(contextClass == enclosingElement.enclosingClass.declaration); | 1344 assert(contextClass == enclosingElement.enclosingClass.declaration); |
| 1346 rti.registerRtiDependency(type.element, contextClass); | 1345 rti.registerRtiDependency(type.element, contextClass); |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2101 jsMutableArrayClass = findClass('JSMutableArray'); | 2100 jsMutableArrayClass = findClass('JSMutableArray'); |
| 2102 jsFixedArrayClass = findClass('JSFixedArray'); | 2101 jsFixedArrayClass = findClass('JSFixedArray'); |
| 2103 jsExtendableArrayClass = findClass('JSExtendableArray'); | 2102 jsExtendableArrayClass = findClass('JSExtendableArray'); |
| 2104 jsUnmodifiableArrayClass = findClass('JSUnmodifiableArray'); | 2103 jsUnmodifiableArrayClass = findClass('JSUnmodifiableArray'); |
| 2105 jsPlainJavaScriptObjectClass = findClass('PlainJavaScriptObject'); | 2104 jsPlainJavaScriptObjectClass = findClass('PlainJavaScriptObject'); |
| 2106 jsUnknownJavaScriptObjectClass = findClass('UnknownJavaScriptObject'); | 2105 jsUnknownJavaScriptObjectClass = findClass('UnknownJavaScriptObject'); |
| 2107 jsIndexableClass = findClass('JSIndexable'); | 2106 jsIndexableClass = findClass('JSIndexable'); |
| 2108 jsMutableIndexableClass = findClass('JSMutableIndexable'); | 2107 jsMutableIndexableClass = findClass('JSMutableIndexable'); |
| 2109 } else if (uri == DART_JS_HELPER) { | 2108 } else if (uri == DART_JS_HELPER) { |
| 2110 initializeHelperClasses(); | 2109 initializeHelperClasses(); |
| 2111 assertMethod = findHelper('assertHelper'); | 2110 assertConditionHelperMethod = findHelper('assertConditionHelper'); |
| 2111 assertThrowMethod = findHelper('assertThrowHelper'); | |
|
sra1
2015/09/03 18:31:18
I would expect that you need to add declarations f
Lasse Reichstein Nielsen
2015/09/09 12:02:45
Done.
| |
| 2112 | 2112 |
| 2113 typeLiteralClass = findClass('TypeImpl'); | 2113 typeLiteralClass = findClass('TypeImpl'); |
| 2114 constMapLiteralClass = findClass('ConstantMap'); | 2114 constMapLiteralClass = findClass('ConstantMap'); |
| 2115 typeVariableClass = findClass('TypeVariable'); | 2115 typeVariableClass = findClass('TypeVariable'); |
| 2116 | 2116 |
| 2117 jsIndexingBehaviorInterface = findClass('JavaScriptIndexingBehavior'); | 2117 jsIndexingBehaviorInterface = findClass('JavaScriptIndexingBehavior'); |
| 2118 | 2118 |
| 2119 noSideEffectsClass = findClass('NoSideEffects'); | 2119 noSideEffectsClass = findClass('NoSideEffects'); |
| 2120 noThrowsClass = findClass('NoThrows'); | 2120 noThrowsClass = findClass('NoThrows'); |
| 2121 noInlineClass = findClass('NoInline'); | 2121 noInlineClass = findClass('NoInline'); |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2881 void registerBackendStaticInvocation(Element element, Registry registry) { | 2881 void registerBackendStaticInvocation(Element element, Registry registry) { |
| 2882 registry.registerStaticInvocation(backend.registerBackendUse(element)); | 2882 registry.registerStaticInvocation(backend.registerBackendUse(element)); |
| 2883 } | 2883 } |
| 2884 | 2884 |
| 2885 void registerBackendInstantiation(ClassElement element, Registry registry) { | 2885 void registerBackendInstantiation(ClassElement element, Registry registry) { |
| 2886 backend.registerBackendUse(element); | 2886 backend.registerBackendUse(element); |
| 2887 element.ensureResolved(backend.compiler); | 2887 element.ensureResolved(backend.compiler); |
| 2888 registry.registerInstantiation(element.rawType); | 2888 registry.registerInstantiation(element.rawType); |
| 2889 } | 2889 } |
| 2890 | 2890 |
| 2891 void onAssert(Send node, Registry registry) { | 2891 void onAssert(Registry registry) { |
| 2892 registerBackendStaticInvocation(backend.assertMethod, registry); | 2892 registerBackendStaticInvocation(backend.assertConditionHelperMethod, |
| 2893 registry); | |
| 2894 registerBackendStaticInvocation(backend.assertThrowMethod, | |
| 2895 registry); | |
| 2893 } | 2896 } |
| 2894 | 2897 |
| 2895 void onAsyncForIn(AsyncForIn node, Registry registry) { | 2898 void onAsyncForIn(AsyncForIn node, Registry registry) { |
| 2896 registerBackendStaticInvocation(backend.getStreamIteratorConstructor(), | 2899 registerBackendStaticInvocation(backend.getStreamIteratorConstructor(), |
| 2897 registry); | 2900 registry); |
| 2898 } | 2901 } |
| 2899 | 2902 |
| 2900 void onStringInterpolation(Registry registry) { | 2903 void onStringInterpolation(Registry registry) { |
| 2901 assert(registry.isForResolution); | 2904 assert(registry.isForResolution); |
| 2902 registerBackendStaticInvocation( | 2905 registerBackendStaticInvocation( |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3090 } | 3093 } |
| 3091 } | 3094 } |
| 3092 | 3095 |
| 3093 /// Records that [constant] is used by the element behind [registry]. | 3096 /// Records that [constant] is used by the element behind [registry]. |
| 3094 class Dependency { | 3097 class Dependency { |
| 3095 final ConstantValue constant; | 3098 final ConstantValue constant; |
| 3096 final Element annotatedElement; | 3099 final Element annotatedElement; |
| 3097 | 3100 |
| 3098 const Dependency(this.constant, this.annotatedElement); | 3101 const Dependency(this.constant, this.annotatedElement); |
| 3099 } | 3102 } |
| OLD | NEW |