| 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 369 } |
| 370 | 370 |
| 371 ConstantSystem get constantSystem => constants.constantSystem; | 371 ConstantSystem get constantSystem => constants.constantSystem; |
| 372 | 372 |
| 373 /// Returns constant environment for the JavaScript interpretation of the | 373 /// Returns constant environment for the JavaScript interpretation of the |
| 374 /// constants. | 374 /// constants. |
| 375 JavaScriptConstantCompiler get constants { | 375 JavaScriptConstantCompiler get constants { |
| 376 return constantCompilerTask.jsConstantCompiler; | 376 return constantCompilerTask.jsConstantCompiler; |
| 377 } | 377 } |
| 378 | 378 |
| 379 // TODO(karlklose): split into findHelperFunction and findHelperClass and | 379 // TODO(karlklose): Split into findHelperFunction and findHelperClass and |
| 380 // add a check that the element has the expected kind. | 380 // add a check that the element has the expected kind. |
| 381 Element findHelper(String name) | 381 Element findHelper(String name) => find(jsHelperLibrary, name); |
| 382 => jsHelperLibrary.findLocal(name); | 382 Element findInterceptor(String name) => find(interceptorsLibrary, name); |
| 383 Element findInterceptor(String name) | 383 |
| 384 => interceptorsLibrary.findLocal(name); | 384 Element find(LibraryElement library, String name) { |
| 385 Element element = library.findLocal(name); |
| 386 assert(invariant(library, element != null, |
| 387 message: "Element '$name' not found in '${library.canonicalUri}'.")); |
| 388 return element; |
| 389 } |
| 385 | 390 |
| 386 bool isForeign(Element element) => element.library == foreignLibrary; | 391 bool isForeign(Element element) => element.library == foreignLibrary; |
| 387 | 392 |
| 388 bool isBackendLibrary(LibraryElement library) { | 393 bool isBackendLibrary(LibraryElement library) { |
| 389 return library == interceptorsLibrary || | 394 return library == interceptorsLibrary || |
| 390 library == jsHelperLibrary; | 395 library == jsHelperLibrary; |
| 391 } | 396 } |
| 392 | 397 |
| 393 static Namer determineNamer(Compiler compiler) { | 398 static Namer determineNamer(Compiler compiler) { |
| 394 return compiler.enableMinification ? | 399 return compiler.enableMinification ? |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 addInterceptors(jsPlainJavaScriptObjectClass, enqueuer, registry); | 778 addInterceptors(jsPlainJavaScriptObjectClass, enqueuer, registry); |
| 774 } else if (cls == jsUnknownJavaScriptObjectClass) { | 779 } else if (cls == jsUnknownJavaScriptObjectClass) { |
| 775 addInterceptors(jsUnknownJavaScriptObjectClass, enqueuer, registry); | 780 addInterceptors(jsUnknownJavaScriptObjectClass, enqueuer, registry); |
| 776 } else if (Elements.isNativeOrExtendsNative(cls)) { | 781 } else if (Elements.isNativeOrExtendsNative(cls)) { |
| 777 addInterceptorsForNativeClassMembers(cls, enqueuer); | 782 addInterceptorsForNativeClassMembers(cls, enqueuer); |
| 778 } else if (cls == jsIndexingBehaviorInterface) { | 783 } else if (cls == jsIndexingBehaviorInterface) { |
| 779 // These two helpers are used by the emitter and the codegen. | 784 // These two helpers are used by the emitter and the codegen. |
| 780 // Because we cannot enqueue elements at the time of emission, | 785 // Because we cannot enqueue elements at the time of emission, |
| 781 // we make sure they are always generated. | 786 // we make sure they are always generated. |
| 782 enqueue(enqueuer, findHelper('isJsIndexable'), registry); | 787 enqueue(enqueuer, findHelper('isJsIndexable'), registry); |
| 783 enqueue(enqueuer, findInterceptor('dispatchPropertyName'), registry); | |
| 784 } | 788 } |
| 785 | 789 |
| 786 customElementsAnalysis.registerInstantiatedClass(cls, enqueuer); | 790 customElementsAnalysis.registerInstantiatedClass(cls, enqueuer); |
| 787 } | 791 } |
| 788 | 792 |
| 789 void registerUseInterceptor(Enqueuer enqueuer) { | 793 void registerUseInterceptor(Enqueuer enqueuer) { |
| 790 assert(!enqueuer.isResolutionQueue); | 794 assert(!enqueuer.isResolutionQueue); |
| 791 if (!enqueuer.nativeEnqueuer.hasInstantiatedNativeClasses()) return; | 795 if (!enqueuer.nativeEnqueuer.hasInstantiatedNativeClasses()) return; |
| 792 Registry registry = compiler.globalDependencies; | 796 Registry registry = compiler.globalDependencies; |
| 793 enqueue(enqueuer, getNativeInterceptorMethod, registry); | 797 enqueue(enqueuer, getNativeInterceptorMethod, registry); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 void enableNoSuchMethod(Enqueuer world) { | 931 void enableNoSuchMethod(Enqueuer world) { |
| 928 enqueue(world, getCreateInvocationMirror(), compiler.globalDependencies); | 932 enqueue(world, getCreateInvocationMirror(), compiler.globalDependencies); |
| 929 world.registerInvocation(compiler.noSuchMethodSelector); | 933 world.registerInvocation(compiler.noSuchMethodSelector); |
| 930 } | 934 } |
| 931 | 935 |
| 932 void enableIsolateSupport(Enqueuer enqueuer) { | 936 void enableIsolateSupport(Enqueuer enqueuer) { |
| 933 if (enqueuer.isResolutionQueue) { | 937 if (enqueuer.isResolutionQueue) { |
| 934 for (String name in const [START_ROOT_ISOLATE, | 938 for (String name in const [START_ROOT_ISOLATE, |
| 935 '_currentIsolate', | 939 '_currentIsolate', |
| 936 '_callInIsolate']) { | 940 '_callInIsolate']) { |
| 937 Element element = isolateHelperLibrary.find(name); | 941 Element element = find(isolateHelperLibrary, name); |
| 938 enqueuer.addToWorkList(element); | 942 enqueuer.addToWorkList(element); |
| 939 compiler.globalDependencies.registerDependency(element); | 943 compiler.globalDependencies.registerDependency(element); |
| 940 } | 944 } |
| 941 } else { | 945 } else { |
| 942 enqueuer.addToWorkList(isolateHelperLibrary.find(START_ROOT_ISOLATE)); | 946 enqueuer.addToWorkList(find(isolateHelperLibrary, START_ROOT_ISOLATE)); |
| 943 } | 947 } |
| 944 } | 948 } |
| 945 | 949 |
| 946 bool isAssertMethod(Element element) => element == assertMethod; | 950 bool isAssertMethod(Element element) => element == assertMethod; |
| 947 | 951 |
| 948 void registerRequiredType(DartType type, Element enclosingElement) { | 952 void registerRequiredType(DartType type, Element enclosingElement) { |
| 949 // If [argument] has type variables or is a type variable, this method | 953 // If [argument] has type variables or is a type variable, this method |
| 950 // registers a RTI dependency between the class where the type variable is | 954 // registers a RTI dependency between the class where the type variable is |
| 951 // defined (that is the enclosing class of the current element being | 955 // defined (that is the enclosing class of the current element being |
| 952 // resolved) and the class of [type]. If the class of [type] requires RTI, | 956 // resolved) and the class of [type]. If the class of [type] requires RTI, |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 } else if (uri == DART_FOREIGN_HELPER) { | 1522 } else if (uri == DART_FOREIGN_HELPER) { |
| 1519 foreignLibrary = library; | 1523 foreignLibrary = library; |
| 1520 } else if (uri == DART_ISOLATE_HELPER) { | 1524 } else if (uri == DART_ISOLATE_HELPER) { |
| 1521 isolateHelperLibrary = library; | 1525 isolateHelperLibrary = library; |
| 1522 } | 1526 } |
| 1523 } | 1527 } |
| 1524 | 1528 |
| 1525 void initializeHelperClasses() { | 1529 void initializeHelperClasses() { |
| 1526 final List missingHelperClasses = []; | 1530 final List missingHelperClasses = []; |
| 1527 ClassElement lookupHelperClass(String name) { | 1531 ClassElement lookupHelperClass(String name) { |
| 1528 ClassElement result = jsHelperLibrary.find(name); | 1532 ClassElement result = findHelper(name); |
| 1529 if (result == null) { | 1533 if (result == null) { |
| 1530 missingHelperClasses.add(name); | 1534 missingHelperClasses.add(name); |
| 1531 } | 1535 } |
| 1532 return result; | 1536 return result; |
| 1533 } | 1537 } |
| 1534 jsInvocationMirrorClass = lookupHelperClass('JSInvocationMirror'); | 1538 jsInvocationMirrorClass = lookupHelperClass('JSInvocationMirror'); |
| 1535 boundClosureClass = lookupHelperClass('BoundClosure'); | 1539 boundClosureClass = lookupHelperClass('BoundClosure'); |
| 1536 closureClass = lookupHelperClass('Closure'); | 1540 closureClass = lookupHelperClass('Closure'); |
| 1537 if (!missingHelperClasses.isEmpty) { | 1541 if (!missingHelperClasses.isEmpty) { |
| 1538 compiler.internalError(jsHelperLibrary, | 1542 compiler.internalError(jsHelperLibrary, |
| 1539 'dart:_js_helper library does not contain required classes: ' | 1543 'dart:_js_helper library does not contain required classes: ' |
| 1540 '$missingHelperClasses'); | 1544 '$missingHelperClasses'); |
| 1541 } | 1545 } |
| 1542 } | 1546 } |
| 1543 | 1547 |
| 1544 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) { | 1548 Future onLibraryScanned(LibraryElement library, LibraryLoader loader) { |
| 1545 return super.onLibraryScanned(library, loader).then((_) { | 1549 return super.onLibraryScanned(library, loader).then((_) { |
| 1546 Uri uri = library.canonicalUri; | 1550 Uri uri = library.canonicalUri; |
| 1547 | 1551 |
| 1548 // TODO(johnniwinther): Assert that the elements are found. | |
| 1549 VariableElement findVariable(String name) { | 1552 VariableElement findVariable(String name) { |
| 1550 return library.find(name); | 1553 return find(library, name); |
| 1551 } | 1554 } |
| 1552 | 1555 |
| 1553 FunctionElement findMethod(String name) { | 1556 FunctionElement findMethod(String name) { |
| 1554 return library.find(name); | 1557 return find(library, name); |
| 1555 } | 1558 } |
| 1556 | 1559 |
| 1557 ClassElement findClass(String name) { | 1560 ClassElement findClass(String name) { |
| 1558 return library.find(name); | 1561 return find(library, name); |
| 1559 } | 1562 } |
| 1560 | 1563 |
| 1561 if (uri == DART_INTERCEPTORS) { | 1564 if (uri == DART_INTERCEPTORS) { |
| 1562 getInterceptorMethod = findMethod('getInterceptor'); | 1565 getInterceptorMethod = findMethod('getInterceptor'); |
| 1563 interceptedNames = findVariable('interceptedNames'); | 1566 interceptedNames = findVariable('interceptedNames'); |
| 1564 mapTypeToInterceptor = findVariable('mapTypeToInterceptor'); | 1567 mapTypeToInterceptor = findVariable('mapTypeToInterceptor'); |
| 1565 getNativeInterceptorMethod = findMethod('getNativeInterceptor'); | 1568 getNativeInterceptorMethod = findMethod('getNativeInterceptor'); |
| 1566 | 1569 |
| 1567 List<ClassElement> classes = [ | 1570 List<ClassElement> classes = [ |
| 1568 jsInterceptorClass = findClass('Interceptor'), | 1571 jsInterceptorClass = findClass('Interceptor'), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1582 jsFixedArrayClass = findClass('JSFixedArray'), | 1585 jsFixedArrayClass = findClass('JSFixedArray'), |
| 1583 jsExtendableArrayClass = findClass('JSExtendableArray'), | 1586 jsExtendableArrayClass = findClass('JSExtendableArray'), |
| 1584 jsPlainJavaScriptObjectClass = findClass('PlainJavaScriptObject'), | 1587 jsPlainJavaScriptObjectClass = findClass('PlainJavaScriptObject'), |
| 1585 jsUnknownJavaScriptObjectClass = findClass('UnknownJavaScriptObject'), | 1588 jsUnknownJavaScriptObjectClass = findClass('UnknownJavaScriptObject'), |
| 1586 ]; | 1589 ]; |
| 1587 | 1590 |
| 1588 jsIndexableClass = findClass('JSIndexable'); | 1591 jsIndexableClass = findClass('JSIndexable'); |
| 1589 jsMutableIndexableClass = findClass('JSMutableIndexable'); | 1592 jsMutableIndexableClass = findClass('JSMutableIndexable'); |
| 1590 } else if (uri == DART_JS_HELPER) { | 1593 } else if (uri == DART_JS_HELPER) { |
| 1591 initializeHelperClasses(); | 1594 initializeHelperClasses(); |
| 1592 assertMethod = jsHelperLibrary.find('assertHelper'); | 1595 assertMethod = findHelper('assertHelper'); |
| 1593 | 1596 |
| 1594 typeLiteralClass = findClass('TypeImpl'); | 1597 typeLiteralClass = findClass('TypeImpl'); |
| 1595 constMapLiteralClass = findClass('ConstantMap'); | 1598 constMapLiteralClass = findClass('ConstantMap'); |
| 1596 typeVariableClass = findClass('TypeVariable'); | 1599 typeVariableClass = findClass('TypeVariable'); |
| 1597 | 1600 |
| 1598 jsIndexingBehaviorInterface = findClass('JavaScriptIndexingBehavior'); | 1601 jsIndexingBehaviorInterface = findClass('JavaScriptIndexingBehavior'); |
| 1599 | 1602 |
| 1600 noSideEffectsClass = findClass('NoSideEffects'); | 1603 noSideEffectsClass = findClass('NoSideEffects'); |
| 1601 noThrowsClass = findClass('NoThrows'); | 1604 noThrowsClass = findClass('NoThrows'); |
| 1602 noInlineClass = findClass('NoInline'); | 1605 noInlineClass = findClass('NoInline'); |
| 1603 irRepresentationClass = findClass('IrRepresentation'); | 1606 irRepresentationClass = findClass('IrRepresentation'); |
| 1604 | 1607 |
| 1605 getIsolateAffinityTagMarker = library.find('getIsolateAffinityTag'); | 1608 getIsolateAffinityTagMarker = findMethod('getIsolateAffinityTag'); |
| 1606 | 1609 |
| 1607 requiresPreambleMarker = library.find('requiresPreamble'); | 1610 requiresPreambleMarker = findMethod('requiresPreamble'); |
| 1608 } else if (uri == DART_JS_MIRRORS) { | 1611 } else if (uri == DART_JS_MIRRORS) { |
| 1609 disableTreeShakingMarker = library.find('disableTreeShaking'); | 1612 disableTreeShakingMarker = find(library, 'disableTreeShaking'); |
| 1610 preserveMetadataMarker = library.find('preserveMetadata'); | 1613 preserveMetadataMarker = find(library, 'preserveMetadata'); |
| 1611 } else if (uri == DART_JS_NAMES) { | 1614 } else if (uri == DART_JS_NAMES) { |
| 1612 preserveNamesMarker = library.find('preserveNames'); | 1615 preserveNamesMarker = find(library, 'preserveNames'); |
| 1613 } else if (uri == DART_HTML) { | 1616 } else if (uri == DART_HTML) { |
| 1614 htmlLibraryIsLoaded = true; | 1617 htmlLibraryIsLoaded = true; |
| 1615 } | 1618 } |
| 1616 }); | 1619 }); |
| 1617 } | 1620 } |
| 1618 | 1621 |
| 1619 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { | 1622 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { |
| 1620 if (!loadedLibraries.containsKey(Compiler.DART_CORE)) { | 1623 if (!loadedLibraries.containsKey(Compiler.DART_CORE)) { |
| 1621 return new Future.value(); | 1624 return new Future.value(); |
| 1622 } | 1625 } |
| 1623 | 1626 |
| 1624 assert(loadedLibraries.containsKey(Compiler.DART_CORE)); | 1627 assert(loadedLibraries.containsKey(Compiler.DART_CORE)); |
| 1625 assert(loadedLibraries.containsKey(DART_INTERCEPTORS)); | 1628 assert(loadedLibraries.containsKey(DART_INTERCEPTORS)); |
| 1626 assert(loadedLibraries.containsKey(DART_JS_HELPER)); | 1629 assert(loadedLibraries.containsKey(DART_JS_HELPER)); |
| 1627 | 1630 |
| 1628 if (jsInvocationMirrorClass != null) { | 1631 if (jsInvocationMirrorClass != null) { |
| 1629 jsInvocationMirrorClass.ensureResolved(compiler); | 1632 jsInvocationMirrorClass.ensureResolved(compiler); |
| 1630 invokeOnMethod = jsInvocationMirrorClass.lookupLocalMember(INVOKE_ON); | 1633 invokeOnMethod = jsInvocationMirrorClass.lookupLocalMember(INVOKE_ON); |
| 1631 } | 1634 } |
| 1632 | 1635 |
| 1633 // [LinkedHashMap] is reexported from dart:collection and can therefore not | 1636 // [LinkedHashMap] is reexported from dart:collection and can therefore not |
| 1634 // be loaded from dart:core in [onLibraryScanned]. | 1637 // be loaded from dart:core in [onLibraryScanned]. |
| 1635 mapLiteralClass = compiler.coreLibrary.find('LinkedHashMap'); | 1638 mapLiteralClass = compiler.coreLibrary.find('LinkedHashMap'); |
| 1639 assert(invariant(compiler.coreLibrary, mapLiteralClass != null, |
| 1640 message: "Element 'LinkedHashMap' not found in 'dart:core'.")); |
| 1636 | 1641 |
| 1637 implementationClasses = <ClassElement, ClassElement>{}; | 1642 implementationClasses = <ClassElement, ClassElement>{}; |
| 1638 implementationClasses[compiler.intClass] = jsIntClass; | 1643 implementationClasses[compiler.intClass] = jsIntClass; |
| 1639 implementationClasses[compiler.boolClass] = jsBoolClass; | 1644 implementationClasses[compiler.boolClass] = jsBoolClass; |
| 1640 implementationClasses[compiler.numClass] = jsNumberClass; | 1645 implementationClasses[compiler.numClass] = jsNumberClass; |
| 1641 implementationClasses[compiler.doubleClass] = jsDoubleClass; | 1646 implementationClasses[compiler.doubleClass] = jsDoubleClass; |
| 1642 implementationClasses[compiler.stringClass] = jsStringClass; | 1647 implementationClasses[compiler.stringClass] = jsStringClass; |
| 1643 implementationClasses[compiler.listClass] = jsArrayClass; | 1648 implementationClasses[compiler.listClass] = jsArrayClass; |
| 1644 implementationClasses[compiler.nullClass] = jsNullClass; | 1649 implementationClasses[compiler.nullClass] = jsNullClass; |
| 1645 | 1650 |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 backend.getCheckSubtypeOfRuntimeType(), registry); | 2189 backend.getCheckSubtypeOfRuntimeType(), registry); |
| 2185 if (inCheckedMode) { | 2190 if (inCheckedMode) { |
| 2186 registerBackendStaticInvocation( | 2191 registerBackendStaticInvocation( |
| 2187 backend.getAssertSubtypeOfRuntimeType(), registry); | 2192 backend.getAssertSubtypeOfRuntimeType(), registry); |
| 2188 } | 2193 } |
| 2189 } | 2194 } |
| 2190 registerBackendInstantiation(backend.compiler.listClass, registry); | 2195 registerBackendInstantiation(backend.compiler.listClass, registry); |
| 2191 } | 2196 } |
| 2192 if (type is FunctionType) { | 2197 if (type is FunctionType) { |
| 2193 registerBackendStaticInvocation( | 2198 registerBackendStaticInvocation( |
| 2194 backend.findHelper('functionTypeTestMetaHelper'), registry); | 2199 backend.find(backend.jsHelperLibrary, 'functionTypeTestMetaHelper'), |
| 2200 registry); |
| 2195 } | 2201 } |
| 2196 if (type.element != null && type.element.isNative) { | 2202 if (type.element != null && type.element.isNative) { |
| 2197 // We will neeed to add the "$is" and "$as" properties on the | 2203 // We will neeed to add the "$is" and "$as" properties on the |
| 2198 // JavaScript object prototype, so we make sure | 2204 // JavaScript object prototype, so we make sure |
| 2199 // [:defineProperty:] is compiled. | 2205 // [:defineProperty:] is compiled. |
| 2200 registerBackendStaticInvocation( | 2206 registerBackendStaticInvocation( |
| 2201 backend.findHelper('defineProperty'), registry); | 2207 backend.find(backend.jsHelperLibrary, 'defineProperty'), registry); |
| 2202 } | 2208 } |
| 2203 } | 2209 } |
| 2204 | 2210 |
| 2205 void onTypeVariableBoundCheck(Registry registry) { | 2211 void onTypeVariableBoundCheck(Registry registry) { |
| 2206 assert(registry.isForResolution); | 2212 assert(registry.isForResolution); |
| 2207 registerBackendStaticInvocation(backend.getThrowTypeError(), registry); | 2213 registerBackendStaticInvocation(backend.getThrowTypeError(), registry); |
| 2208 registerBackendStaticInvocation(backend.getAssertIsSubtype(), registry); | 2214 registerBackendStaticInvocation(backend.getAssertIsSubtype(), registry); |
| 2209 } | 2215 } |
| 2210 | 2216 |
| 2211 void onAbstractClassInstantiation(Registry registry) { | 2217 void onAbstractClassInstantiation(Registry registry) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2247 backend.getCreateInvocationMirror(), registry); | 2253 backend.getCreateInvocationMirror(), registry); |
| 2248 registerBackendStaticInvocation( | 2254 registerBackendStaticInvocation( |
| 2249 backend.compiler.objectClass.lookupLocalMember(Compiler.NO_SUCH_METHOD), | 2255 backend.compiler.objectClass.lookupLocalMember(Compiler.NO_SUCH_METHOD), |
| 2250 registry); | 2256 registry); |
| 2251 registerBackendInstantiation(backend.compiler.listClass, registry); | 2257 registerBackendInstantiation(backend.compiler.listClass, registry); |
| 2252 } | 2258 } |
| 2253 | 2259 |
| 2254 void onConstantMap(Registry registry) { | 2260 void onConstantMap(Registry registry) { |
| 2255 assert(registry.isForResolution); | 2261 assert(registry.isForResolution); |
| 2256 void enqueue(String name) { | 2262 void enqueue(String name) { |
| 2257 Element e = backend.findHelper(name); | 2263 Element e = backend.find(backend.jsHelperLibrary, name); |
| 2258 registerBackendInstantiation(e, registry); | 2264 registerBackendInstantiation(e, registry); |
| 2259 } | 2265 } |
| 2260 | 2266 |
| 2261 enqueue(JavaScriptMapConstant.DART_CLASS); | 2267 enqueue(JavaScriptMapConstant.DART_CLASS); |
| 2262 enqueue(JavaScriptMapConstant.DART_PROTO_CLASS); | 2268 enqueue(JavaScriptMapConstant.DART_PROTO_CLASS); |
| 2263 enqueue(JavaScriptMapConstant.DART_STRING_CLASS); | 2269 enqueue(JavaScriptMapConstant.DART_STRING_CLASS); |
| 2264 enqueue(JavaScriptMapConstant.DART_GENERAL_CLASS); | 2270 enqueue(JavaScriptMapConstant.DART_GENERAL_CLASS); |
| 2265 } | 2271 } |
| 2266 | 2272 |
| 2267 /// Called when resolving the `Symbol` constructor. | 2273 /// Called when resolving the `Symbol` constructor. |
| 2268 void onSymbolConstructor(Registry registry) { | 2274 void onSymbolConstructor(Registry registry) { |
| 2269 assert(registry.isForResolution); | 2275 assert(registry.isForResolution); |
| 2270 // Make sure that _internals.Symbol.validated is registered. | 2276 // Make sure that _internals.Symbol.validated is registered. |
| 2271 assert(backend.compiler.symbolValidatedConstructor != null); | 2277 assert(backend.compiler.symbolValidatedConstructor != null); |
| 2272 registerBackendStaticInvocation( | 2278 registerBackendStaticInvocation( |
| 2273 backend.compiler.symbolValidatedConstructor, registry); | 2279 backend.compiler.symbolValidatedConstructor, registry); |
| 2274 } | 2280 } |
| 2275 } | 2281 } |
| 2276 | 2282 |
| 2277 /// Records that [constant] is used by the element behind [registry]. | 2283 /// Records that [constant] is used by the element behind [registry]. |
| 2278 class Dependency { | 2284 class Dependency { |
| 2279 final Constant constant; | 2285 final Constant constant; |
| 2280 // TODO(johnniwinther): Change to [Element] when dependency nodes are added. | 2286 // TODO(johnniwinther): Change to [Element] when dependency nodes are added. |
| 2281 final Registry registry; | 2287 final Registry registry; |
| 2282 | 2288 |
| 2283 const Dependency(this.constant, this.registry); | 2289 const Dependency(this.constant, this.registry); |
| 2284 } | 2290 } |
| OLD | NEW |