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

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

Issue 1417103002: Add ElementKind for factory constructors. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 void onQueueClosed() { 2521 void onQueueClosed() {
2522 lookupMapAnalysis.onQueueClosed(); 2522 lookupMapAnalysis.onQueueClosed();
2523 jsInteropAnalysis.onQueueClosed(); 2523 jsInteropAnalysis.onQueueClosed();
2524 } 2524 }
2525 2525
2526 void onCodegenStart() { 2526 void onCodegenStart() {
2527 lookupMapAnalysis.onCodegenStart(); 2527 lookupMapAnalysis.onCodegenStart();
2528 } 2528 }
2529 2529
2530 void onElementResolved(Element element, TreeElements elements) { 2530 void onElementResolved(Element element, TreeElements elements) {
2531 if ((element.isFunction || element.isGenerativeConstructor) && 2531 if ((element.isFunction || element.isConstructor) &&
2532 annotations.noInline(element)) { 2532 annotations.noInline(element)) {
2533 inlineCache.markAsNonInlinable(element); 2533 inlineCache.markAsNonInlinable(element);
2534 } 2534 }
2535 2535
2536 LibraryElement library = element.library; 2536 LibraryElement library = element.library;
2537 if (!library.isPlatformLibrary && !library.canUseNative) return; 2537 if (!library.isPlatformLibrary && !library.canUseNative) return;
2538 bool hasNoInline = false; 2538 bool hasNoInline = false;
2539 bool hasForceInline = false; 2539 bool hasForceInline = false;
2540 bool hasNoThrows = false; 2540 bool hasNoThrows = false;
2541 bool hasNoSideEffects = false; 2541 bool hasNoSideEffects = false;
(...skipping 17 matching lines...) Expand all
2559 hasNoInline = true; 2559 hasNoInline = true;
2560 if (VERBOSE_OPTIMIZER_HINTS) { 2560 if (VERBOSE_OPTIMIZER_HINTS) {
2561 reporter.reportHintMessage( 2561 reporter.reportHintMessage(
2562 element, 2562 element,
2563 MessageKind.GENERIC, 2563 MessageKind.GENERIC,
2564 {'text': "Cannot inline"}); 2564 {'text': "Cannot inline"});
2565 } 2565 }
2566 inlineCache.markAsNonInlinable(element); 2566 inlineCache.markAsNonInlinable(element);
2567 } else if (cls == noThrowsClass) { 2567 } else if (cls == noThrowsClass) {
2568 hasNoThrows = true; 2568 hasNoThrows = true;
2569 if (!Elements.isStaticOrTopLevelFunction(element)) { 2569 if (!Elements.isStaticOrTopLevelFunction(element) &&
2570 !element.isFactoryConstructor) {
2570 reporter.internalError(element, 2571 reporter.internalError(element,
2571 "@NoThrows() is currently limited to top-level" 2572 "@NoThrows() is currently limited to top-level"
2572 " or static functions"); 2573 " or static functions and factory constructors.");
2573 } 2574 }
2574 if (VERBOSE_OPTIMIZER_HINTS) { 2575 if (VERBOSE_OPTIMIZER_HINTS) {
2575 reporter.reportHintMessage( 2576 reporter.reportHintMessage(
2576 element, 2577 element,
2577 MessageKind.GENERIC, 2578 MessageKind.GENERIC,
2578 {'text': "Cannot throw"}); 2579 {'text': "Cannot throw"});
2579 } 2580 }
2580 compiler.world.registerCannotThrow(element); 2581 compiler.world.registerCannotThrow(element);
2581 } else if (cls == noSideEffectsClass) { 2582 } else if (cls == noSideEffectsClass) {
2582 hasNoSideEffects = true; 2583 hasNoSideEffects = true;
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
3033 } 3034 }
3034 3035
3035 /// Records that [constant] is used by the element behind [registry]. 3036 /// Records that [constant] is used by the element behind [registry].
3036 class Dependency { 3037 class Dependency {
3037 final ConstantValue constant; 3038 final ConstantValue constant;
3038 final Element annotatedElement; 3039 final Element annotatedElement;
3039 3040
3040 const Dependency(this.constant, this.annotatedElement); 3041 const Dependency(this.constant, this.annotatedElement);
3041 } 3042 }
3042 3043
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart ('k') | pkg/compiler/lib/src/parser/member_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698