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

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

Issue 1312943007: Add version validation for LookupMap, also add unittest directly in LookupMap. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 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 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 preserveUrisMarker = find(library, 'preserveUris'); 2152 preserveUrisMarker = find(library, 'preserveUris');
2153 preserveLibraryNamesMarker = find(library, 'preserveLibraryNames'); 2153 preserveLibraryNamesMarker = find(library, 'preserveLibraryNames');
2154 } else if (uri == DART_JS_NAMES) { 2154 } else if (uri == DART_JS_NAMES) {
2155 preserveNamesMarker = find(library, 'preserveNames'); 2155 preserveNamesMarker = find(library, 'preserveNames');
2156 } else if (uri == DART_EMBEDDED_NAMES) { 2156 } else if (uri == DART_EMBEDDED_NAMES) {
2157 jsGetNameEnum = find(library, 'JsGetName'); 2157 jsGetNameEnum = find(library, 'JsGetName');
2158 jsBuiltinEnum = find(library, 'JsBuiltin'); 2158 jsBuiltinEnum = find(library, 'JsBuiltin');
2159 } else if (uri == Uris.dart_html) { 2159 } else if (uri == Uris.dart_html) {
2160 htmlLibraryIsLoaded = true; 2160 htmlLibraryIsLoaded = true;
2161 } else if (uri == PACKAGE_LOOKUP_MAP) { 2161 } else if (uri == PACKAGE_LOOKUP_MAP) {
2162 lookupMapAnalysis.initRuntimeClass(find(library, 'LookupMap')); 2162 lookupMapAnalysis.init(library);
2163 } 2163 }
2164 annotations.onLibraryScanned(library); 2164 annotations.onLibraryScanned(library);
2165 }); 2165 });
2166 } 2166 }
2167 2167
2168 Future onLibrariesLoaded(LoadedLibraries loadedLibraries) { 2168 Future onLibrariesLoaded(LoadedLibraries loadedLibraries) {
2169 if (!loadedLibraries.containsLibrary(Uris.dart_core)) { 2169 if (!loadedLibraries.containsLibrary(Uris.dart_core)) {
2170 return new Future.value(); 2170 return new Future.value();
2171 } 2171 }
2172 2172
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 new CodegenRegistry(compiler, 2598 new CodegenRegistry(compiler,
2599 dependency.annotatedElement.analyzableElement.treeElements), 2599 dependency.annotatedElement.analyzableElement.treeElements),
2600 addForEmission: false); 2600 addForEmission: false);
2601 } 2601 }
2602 metadataConstants.clear(); 2602 metadataConstants.clear();
2603 } 2603 }
2604 } 2604 }
2605 return true; 2605 return true;
2606 } 2606 }
2607 2607
2608 void onQueueClosed() => lookupMapAnalysis.onQueueClosed(); 2608 void onQueueClosed() {
2609 lookupMapAnalysis.onQueueClosed();
2610 }
2611
2612 void onCodegenStart() {
2613 lookupMapAnalysis.onCodegenStart();
2614 }
2609 2615
2610 void onElementResolved(Element element, TreeElements elements) { 2616 void onElementResolved(Element element, TreeElements elements) {
2611 if ((element.isFunction || element.isGenerativeConstructor) && 2617 if ((element.isFunction || element.isGenerativeConstructor) &&
2612 annotations.noInline(element)) { 2618 annotations.noInline(element)) {
2613 inlineCache.markAsNonInlinable(element); 2619 inlineCache.markAsNonInlinable(element);
2614 } 2620 }
2615 2621
2616 LibraryElement library = element.library; 2622 LibraryElement library = element.library;
2617 if (!library.isPlatformLibrary && !library.canUseNative) return; 2623 if (!library.isPlatformLibrary && !library.canUseNative) return;
2618 bool hasNoInline = false; 2624 bool hasNoInline = false;
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
3128 } 3134 }
3129 } 3135 }
3130 3136
3131 /// Records that [constant] is used by the element behind [registry]. 3137 /// Records that [constant] is used by the element behind [registry].
3132 class Dependency { 3138 class Dependency {
3133 final ConstantValue constant; 3139 final ConstantValue constant;
3134 final Element annotatedElement; 3140 final Element annotatedElement;
3135 3141
3136 const Dependency(this.constant, this.annotatedElement); 3142 const Dependency(this.constant, this.annotatedElement);
3137 } 3143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698