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

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

Issue 912223003: Support @NoInlining in the ssa-builder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update old test with new name. Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR");
10 10
(...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after
2298 new CodegenRegistry(compiler, 2298 new CodegenRegistry(compiler,
2299 dependency.annotatedElement.analyzableElement.treeElements)); 2299 dependency.annotatedElement.analyzableElement.treeElements));
2300 } 2300 }
2301 metadataConstants.clear(); 2301 metadataConstants.clear();
2302 } 2302 }
2303 } 2303 }
2304 return true; 2304 return true;
2305 } 2305 }
2306 2306
2307 void onElementResolved(Element element, TreeElements elements) { 2307 void onElementResolved(Element element, TreeElements elements) {
2308 if (element.isFunction && annotations.noInline(element)) {
2309 // TODO(floitsch): restrict to test directory?
Johnni Winther 2015/02/16 11:18:05 Move this TODO to the [noInline] method. I think w
floitsch 2015/02/16 11:50:02 Done.
2310 inlineCache.markAsNonInlinable(element);
2311 }
2312
2308 LibraryElement library = element.library; 2313 LibraryElement library = element.library;
2309 if (!library.isPlatformLibrary && !library.canUseNative) return; 2314 if (!library.isPlatformLibrary && !library.canUseNative) return;
2310 bool hasNoInline = false; 2315 bool hasNoInline = false;
2311 bool hasNoThrows = false; 2316 bool hasNoThrows = false;
2312 bool hasNoSideEffects = false; 2317 bool hasNoSideEffects = false;
2313 for (MetadataAnnotation metadata in element.metadata) { 2318 for (MetadataAnnotation metadata in element.metadata) {
2314 metadata.ensureResolved(compiler); 2319 metadata.ensureResolved(compiler);
2315 if (!metadata.constant.value.isConstructedObject) continue; 2320 if (!metadata.constant.value.isConstructedObject) continue;
2316 ObjectConstantValue value = metadata.constant.value; 2321 ObjectConstantValue value = metadata.constant.value;
2317 ClassElement cls = value.type.element; 2322 ClassElement cls = value.type.element;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2423 enqueue(enqueuer, getStreamIteratorConstructor(), registry); 2428 enqueue(enqueuer, getStreamIteratorConstructor(), registry);
2424 } 2429 }
2425 } 2430 }
2426 } 2431 }
2427 2432
2428 /// Handling of special annotations for tests. 2433 /// Handling of special annotations for tests.
2429 class Annotations { 2434 class Annotations {
2430 static final Uri PACKAGE_EXPECT = 2435 static final Uri PACKAGE_EXPECT =
2431 new Uri(scheme: 'package', path: 'expect/expect.dart'); 2436 new Uri(scheme: 'package', path: 'expect/expect.dart');
2432 2437
2433 ClassElement expectNoInliningClass; 2438 ClassElement expectNoInlineClass;
2434 ClassElement expectTrustTypeAnnotationsClass; 2439 ClassElement expectTrustTypeAnnotationsClass;
2435 ClassElement expectAssumeDynamicClass; 2440 ClassElement expectAssumeDynamicClass;
2436 2441
2437 void onLibraryScanned(LibraryElement library) { 2442 void onLibraryScanned(LibraryElement library) {
2438 if (library.canonicalUri == PACKAGE_EXPECT) { 2443 if (library.canonicalUri == PACKAGE_EXPECT) {
2439 expectNoInliningClass = library.find('NoInlining'); 2444 expectNoInlineClass = library.find('NoInline');
2440 expectTrustTypeAnnotationsClass = library.find('TrustTypeAnnotations'); 2445 expectTrustTypeAnnotationsClass = library.find('TrustTypeAnnotations');
2441 expectAssumeDynamicClass = library.find('AssumeDynamic'); 2446 expectAssumeDynamicClass = library.find('AssumeDynamic');
2442 if (expectNoInliningClass == null || 2447 if (expectNoInlineClass == null ||
2443 expectTrustTypeAnnotationsClass == null || 2448 expectTrustTypeAnnotationsClass == null ||
2444 expectAssumeDynamicClass == null) { 2449 expectAssumeDynamicClass == null) {
2445 // This is not the package you're looking for. 2450 // This is not the package you're looking for.
2446 expectNoInliningClass = null; 2451 expectNoInlineClass = null;
2447 expectTrustTypeAnnotationsClass = null; 2452 expectTrustTypeAnnotationsClass = null;
2448 expectAssumeDynamicClass = null; 2453 expectAssumeDynamicClass = null;
2449 } 2454 }
2450 } 2455 }
2451 } 2456 }
2452 2457
2453 /// Returns `true` if inlining is disabled for [element]. 2458 /// Returns `true` if inlining is disabled for [element].
2454 bool noInlining(Element element) { 2459 bool noInline(Element element) {
2455 return _hasAnnotation(element, expectNoInliningClass); 2460 return _hasAnnotation(element, expectNoInlineClass);
2456 } 2461 }
2457 2462
2458 /// Returns `true` if parameter and returns types should be trusted for 2463 /// Returns `true` if parameter and returns types should be trusted for
2459 /// [element]. 2464 /// [element].
2460 bool trustTypeAnnotations(Element element) { 2465 bool trustTypeAnnotations(Element element) {
2461 return _hasAnnotation(element, expectTrustTypeAnnotationsClass); 2466 return _hasAnnotation(element, expectTrustTypeAnnotationsClass);
2462 } 2467 }
2463 2468
2464 /// Returns `true` if inference of parameter types is disabled for [element]. 2469 /// Returns `true` if inference of parameter types is disabled for [element].
2465 bool assumeDynamic(Element element) { 2470 bool assumeDynamic(Element element) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2681 } 2686 }
2682 } 2687 }
2683 2688
2684 /// Records that [constant] is used by the element behind [registry]. 2689 /// Records that [constant] is used by the element behind [registry].
2685 class Dependency { 2690 class Dependency {
2686 final ConstantValue constant; 2691 final ConstantValue constant;
2687 final Element annotatedElement; 2692 final Element annotatedElement;
2688 2693
2689 const Dependency(this.constant, this.annotatedElement); 2694 const Dependency(this.constant, this.annotatedElement);
2690 } 2695 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698