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

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

Issue 1346093003: Revert "Add optional message to assert in Dart2js - continued" (Closed) Base URL: https://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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 FunctionInlineCache inlineCache = new FunctionInlineCache(); 271 FunctionInlineCache inlineCache = new FunctionInlineCache();
272 272
273 LibraryElement jsHelperLibrary; 273 LibraryElement jsHelperLibrary;
274 LibraryElement asyncLibrary; 274 LibraryElement asyncLibrary;
275 LibraryElement interceptorsLibrary; 275 LibraryElement interceptorsLibrary;
276 LibraryElement foreignLibrary; 276 LibraryElement foreignLibrary;
277 LibraryElement isolateHelperLibrary; 277 LibraryElement isolateHelperLibrary;
278 278
279 ClassElement closureClass; 279 ClassElement closureClass;
280 ClassElement boundClosureClass; 280 ClassElement boundClosureClass;
281 Element assertTestMethod; 281 Element assertMethod;
282 Element assertThrowMethod;
283 Element assertHelperMethod;
284 Element invokeOnMethod; 282 Element invokeOnMethod;
285 283
286 ClassElement jsInterceptorClass; 284 ClassElement jsInterceptorClass;
287 ClassElement jsStringClass; 285 ClassElement jsStringClass;
288 ClassElement jsArrayClass; 286 ClassElement jsArrayClass;
289 ClassElement jsNumberClass; 287 ClassElement jsNumberClass;
290 ClassElement jsIntClass; 288 ClassElement jsIntClass;
291 ClassElement jsDoubleClass; 289 ClassElement jsDoubleClass;
292 ClassElement jsNullClass; 290 ClassElement jsNullClass;
293 ClassElement jsBoolClass; 291 ClassElement jsBoolClass;
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 Element element = find(isolateHelperLibrary, name); 1350 Element element = find(isolateHelperLibrary, name);
1353 enqueuer.addToWorkList(element); 1351 enqueuer.addToWorkList(element);
1354 compiler.globalDependencies.registerDependency(element); 1352 compiler.globalDependencies.registerDependency(element);
1355 helpersUsed.add(element.declaration); 1353 helpersUsed.add(element.declaration);
1356 } 1354 }
1357 } else { 1355 } else {
1358 enqueuer.addToWorkList(find(isolateHelperLibrary, START_ROOT_ISOLATE)); 1356 enqueuer.addToWorkList(find(isolateHelperLibrary, START_ROOT_ISOLATE));
1359 } 1357 }
1360 } 1358 }
1361 1359
1360 bool isAssertMethod(Element element) => element == assertMethod;
1361
1362 void registerRequiredType(DartType type, Element enclosingElement) { 1362 void registerRequiredType(DartType type, Element enclosingElement) {
1363 // If [argument] has type variables or is a type variable, this method 1363 // If [argument] has type variables or is a type variable, this method
1364 // registers a RTI dependency between the class where the type variable is 1364 // registers a RTI dependency between the class where the type variable is
1365 // defined (that is the enclosing class of the current element being 1365 // defined (that is the enclosing class of the current element being
1366 // resolved) and the class of [type]. If the class of [type] requires RTI, 1366 // resolved) and the class of [type]. If the class of [type] requires RTI,
1367 // then the class of the type variable does too. 1367 // then the class of the type variable does too.
1368 ClassElement contextClass = Types.getClassContext(type); 1368 ClassElement contextClass = Types.getClassContext(type);
1369 if (contextClass != null) { 1369 if (contextClass != null) {
1370 assert(contextClass == enclosingElement.enclosingClass.declaration); 1370 assert(contextClass == enclosingElement.enclosingClass.declaration);
1371 rti.registerRtiDependency(type.element, contextClass); 1371 rti.registerRtiDependency(type.element, contextClass);
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 jsMutableArrayClass = findClass('JSMutableArray'); 2114 jsMutableArrayClass = findClass('JSMutableArray');
2115 jsFixedArrayClass = findClass('JSFixedArray'); 2115 jsFixedArrayClass = findClass('JSFixedArray');
2116 jsExtendableArrayClass = findClass('JSExtendableArray'); 2116 jsExtendableArrayClass = findClass('JSExtendableArray');
2117 jsUnmodifiableArrayClass = findClass('JSUnmodifiableArray'); 2117 jsUnmodifiableArrayClass = findClass('JSUnmodifiableArray');
2118 jsPlainJavaScriptObjectClass = findClass('PlainJavaScriptObject'); 2118 jsPlainJavaScriptObjectClass = findClass('PlainJavaScriptObject');
2119 jsUnknownJavaScriptObjectClass = findClass('UnknownJavaScriptObject'); 2119 jsUnknownJavaScriptObjectClass = findClass('UnknownJavaScriptObject');
2120 jsIndexableClass = findClass('JSIndexable'); 2120 jsIndexableClass = findClass('JSIndexable');
2121 jsMutableIndexableClass = findClass('JSMutableIndexable'); 2121 jsMutableIndexableClass = findClass('JSMutableIndexable');
2122 } else if (uri == DART_JS_HELPER) { 2122 } else if (uri == DART_JS_HELPER) {
2123 initializeHelperClasses(); 2123 initializeHelperClasses();
2124 assertTestMethod = findHelper('assertTest'); 2124 assertMethod = findHelper('assertHelper');
2125 assertThrowMethod = findHelper('assertThrow');
2126 assertHelperMethod = findHelper('assertHelper');
2127 2125
2128 typeLiteralClass = findClass('TypeImpl'); 2126 typeLiteralClass = findClass('TypeImpl');
2129 constMapLiteralClass = findClass('ConstantMap'); 2127 constMapLiteralClass = findClass('ConstantMap');
2130 typeVariableClass = findClass('TypeVariable'); 2128 typeVariableClass = findClass('TypeVariable');
2131 2129
2132 jsIndexingBehaviorInterface = findClass('JavaScriptIndexingBehavior'); 2130 jsIndexingBehaviorInterface = findClass('JavaScriptIndexingBehavior');
2133 2131
2134 noSideEffectsClass = findClass('NoSideEffects'); 2132 noSideEffectsClass = findClass('NoSideEffects');
2135 noThrowsClass = findClass('NoThrows'); 2133 noThrowsClass = findClass('NoThrows');
2136 noInlineClass = findClass('NoInline'); 2134 noInlineClass = findClass('NoInline');
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
2916 void registerBackendStaticInvocation(Element element, Registry registry) { 2914 void registerBackendStaticInvocation(Element element, Registry registry) {
2917 registry.registerStaticInvocation(backend.registerBackendUse(element)); 2915 registry.registerStaticInvocation(backend.registerBackendUse(element));
2918 } 2916 }
2919 2917
2920 void registerBackendInstantiation(ClassElement element, Registry registry) { 2918 void registerBackendInstantiation(ClassElement element, Registry registry) {
2921 backend.registerBackendUse(element); 2919 backend.registerBackendUse(element);
2922 element.ensureResolved(backend.compiler); 2920 element.ensureResolved(backend.compiler);
2923 registry.registerInstantiation(element.rawType); 2921 registry.registerInstantiation(element.rawType);
2924 } 2922 }
2925 2923
2926 void onAssert(bool hasMessage, Registry registry) { 2924 void onAssert(Send node, Registry registry) {
2927 if (hasMessage) { 2925 registerBackendStaticInvocation(backend.assertMethod, registry);
2928 registerBackendStaticInvocation(backend.assertTestMethod, registry);
2929 registerBackendStaticInvocation(backend.assertThrowMethod, registry);
2930 } else {
2931 registerBackendStaticInvocation(backend.assertHelperMethod, registry);
2932 }
2933 } 2926 }
2934 2927
2935 void onAsyncForIn(AsyncForIn node, Registry registry) { 2928 void onAsyncForIn(AsyncForIn node, Registry registry) {
2936 registerBackendStaticInvocation(backend.getStreamIteratorConstructor(), 2929 registerBackendStaticInvocation(backend.getStreamIteratorConstructor(),
2937 registry); 2930 registry);
2938 } 2931 }
2939 2932
2940 void onStringInterpolation(Registry registry) { 2933 void onStringInterpolation(Registry registry) {
2941 assert(registry.isForResolution); 2934 assert(registry.isForResolution);
2942 registerBackendStaticInvocation( 2935 registerBackendStaticInvocation(
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3170 } 3163 }
3171 } 3164 }
3172 3165
3173 /// Records that [constant] is used by the element behind [registry]. 3166 /// Records that [constant] is used by the element behind [registry].
3174 class Dependency { 3167 class Dependency {
3175 final ConstantValue constant; 3168 final ConstantValue constant;
3176 final Element annotatedElement; 3169 final Element annotatedElement;
3177 3170
3178 const Dependency(this.constant, this.annotatedElement); 3171 const Dependency(this.constant, this.annotatedElement);
3179 } 3172 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart ('k') | pkg/compiler/lib/src/parser/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698