Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 2590913002: Add WorkItemBuilder to abstract WorkItem creation from the enqueuers. (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 library js_backend.backend; 5 library js_backend.backend;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
10 10
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 bool mayGenerateInstanceofCheck(DartType type) { 1754 bool mayGenerateInstanceofCheck(DartType type) {
1755 // We can use an instanceof check for raw types that have no subclass that 1755 // We can use an instanceof check for raw types that have no subclass that
1756 // is mixed-in or in an implements clause. 1756 // is mixed-in or in an implements clause.
1757 1757
1758 if (!type.isRaw) return false; 1758 if (!type.isRaw) return false;
1759 ClassElement classElement = type.element; 1759 ClassElement classElement = type.element;
1760 if (isInterceptorClass(classElement)) return false; 1760 if (isInterceptorClass(classElement)) return false;
1761 return _closedWorld.hasOnlySubclasses(classElement); 1761 return _closedWorld.hasOnlySubclasses(classElement);
1762 } 1762 }
1763 1763
1764 WorldImpact registerUsedElement(Element element, {bool forResolution}) { 1764 WorldImpact registerUsedElement(MemberElement element, {bool forResolution}) {
1765 WorldImpactBuilderImpl worldImpact = new WorldImpactBuilderImpl(); 1765 WorldImpactBuilderImpl worldImpact = new WorldImpactBuilderImpl();
1766 if (element == helpers.disableTreeShakingMarker) { 1766 if (element == helpers.disableTreeShakingMarker) {
1767 isTreeShakingDisabled = true; 1767 isTreeShakingDisabled = true;
1768 } else if (element == helpers.preserveNamesMarker) { 1768 } else if (element == helpers.preserveNamesMarker) {
1769 mustPreserveNames = true; 1769 mustPreserveNames = true;
1770 } else if (element == helpers.preserveMetadataMarker) { 1770 } else if (element == helpers.preserveMetadataMarker) {
1771 mustRetainMetadata = true; 1771 mustRetainMetadata = true;
1772 } else if (element == helpers.preserveUrisMarker) { 1772 } else if (element == helpers.preserveUrisMarker) {
1773 if (compiler.options.preserveUris) mustPreserveUris = true; 1773 if (compiler.options.preserveUris) mustPreserveUris = true;
1774 } else if (element == helpers.preserveLibraryNamesMarker) { 1774 } else if (element == helpers.preserveLibraryNamesMarker) {
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 } 2132 }
2133 } 2133 }
2134 } 2134 }
2135 } 2135 }
2136 // We also need top-level non-class elements like static functions and 2136 // We also need top-level non-class elements like static functions and
2137 // global fields. We use the resolution queue to decide which elements are 2137 // global fields. We use the resolution queue to decide which elements are
2138 // part of the live world. 2138 // part of the live world.
2139 for (LibraryElement lib in compiler.libraryLoader.libraries) { 2139 for (LibraryElement lib in compiler.libraryLoader.libraries) {
2140 if (lib.isInternalLibrary) continue; 2140 if (lib.isInternalLibrary) continue;
2141 lib.forEachLocalMember((Element member) { 2141 lib.forEachLocalMember((Element member) {
2142 if (!member.isClass && 2142 if (!(member.isClass || member.isTypedef) &&
2143 resolution.hasBeenProcessed(member) && 2143 resolution.hasBeenProcessed(member) &&
2144 referencedFromMirrorSystem(member)) { 2144 referencedFromMirrorSystem(member)) {
2145 reflectableMembers.add(member); 2145 reflectableMembers.add(member);
2146 } 2146 }
2147 }); 2147 });
2148 } 2148 }
2149 // And closures inside top-level elements that do not have a surrounding 2149 // And closures inside top-level elements that do not have a surrounding
2150 // class. These will be in the [:null:] bucket of the [closureMap]. 2150 // class. These will be in the [:null:] bucket of the [closureMap].
2151 if (closureMap.containsKey(null)) { 2151 if (closureMap.containsKey(null)) {
2152 for (Element closure in closureMap[null]) { 2152 for (Element closure in closureMap[null]) {
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3269 @override 3269 @override
3270 bool isInterceptorClass(ClassElement cls) { 3270 bool isInterceptorClass(ClassElement cls) {
3271 return helpers.backend.isInterceptorClass(cls); 3271 return helpers.backend.isInterceptorClass(cls);
3272 } 3272 }
3273 3273
3274 @override 3274 @override
3275 bool isNative(Element element) { 3275 bool isNative(Element element) {
3276 return helpers.backend.isNative(element); 3276 return helpers.backend.isNative(element);
3277 } 3277 }
3278 } 3278 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698