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

Side by Side Diff: pkg/compiler/lib/src/native/enqueue.dart

Issue 954253002: dart2js: add compiler builtins to the core-runtime. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 native; 5 part of native;
6 6
7 /** 7 /**
8 * This could be an abstract class but we use it as a stub for the dart_backend. 8 * This could be an abstract class but we use it as a stub for the dart_backend.
9 */ 9 */
10 class NativeEnqueuer { 10 class NativeEnqueuer {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 * types. 47 * types.
48 * 48 *
49 * For example, the following code instantiates and returns a String class 49 * For example, the following code instantiates and returns a String class
50 * 50 *
51 * JS_EMBEDDED_GLOBAL('String', 'foo') 51 * JS_EMBEDDED_GLOBAL('String', 'foo')
52 * 52 *
53 */ 53 */
54 // TODO(sra): The entry from codegen will not have a resolver. 54 // TODO(sra): The entry from codegen will not have a resolver.
55 void registerJsEmbeddedGlobalCall(Send node, ResolverVisitor resolver) {} 55 void registerJsEmbeddedGlobalCall(Send node, ResolverVisitor resolver) {}
56 56
57 /**
58 * Handles JS-compiler macro calls, which can be an instantiation point for
59 * types.
60 *
61 * For example, the following code instantiates and returns a String class
62 *
63 * JS_EMBEDDED_GLOBAL('String', 'int2stringMacro', 0)
64 *
65 */
66 // TODO(sra): The entry from codegen will not have a resolver.
67 void registerJsCompilerMacroCall(Send node, ResolverVisitor resolver) {}
68
57 /// Emits a summary information using the [log] function. 69 /// Emits a summary information using the [log] function.
58 void logSummary(log(message)) {} 70 void logSummary(log(message)) {}
59 71
60 // Do not use annotations in dart2dart. 72 // Do not use annotations in dart2dart.
61 ClassElement get annotationCreatesClass => null; 73 ClassElement get annotationCreatesClass => null;
62 ClassElement get annotationReturnsClass => null; 74 ClassElement get annotationReturnsClass => null;
63 ClassElement get annotationJsNameClass => null; 75 ClassElement get annotationJsNameClass => null;
64 } 76 }
65 77
66 78
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } 466 }
455 467
456 void registerJsEmbeddedGlobalCall(Send node, ResolverVisitor resolver) { 468 void registerJsEmbeddedGlobalCall(Send node, ResolverVisitor resolver) {
457 NativeBehavior behavior = 469 NativeBehavior behavior =
458 NativeBehavior.ofJsEmbeddedGlobalCall(node, compiler, resolver); 470 NativeBehavior.ofJsEmbeddedGlobalCall(node, compiler, resolver);
459 processNativeBehavior(behavior, node); 471 processNativeBehavior(behavior, node);
460 nativeBehaviors[node] = behavior; 472 nativeBehaviors[node] = behavior;
461 flushQueue(); 473 flushQueue();
462 } 474 }
463 475
476 void registerJsCompilerMacroCall(Send node, ResolverVisitor resolver) {
477 NativeBehavior behavior =
478 NativeBehavior.ofJsCompilerMacroCall(node, compiler, resolver);
479 processNativeBehavior(behavior, node);
480 nativeBehaviors[node] = behavior;
481 flushQueue();
482 }
483
464 NativeBehavior getNativeBehaviorOf(Send node) => nativeBehaviors[node]; 484 NativeBehavior getNativeBehaviorOf(Send node) => nativeBehaviors[node];
465 485
466 processNativeBehavior(NativeBehavior behavior, cause) { 486 processNativeBehavior(NativeBehavior behavior, cause) {
467 // TODO(ahe): Is this really a global dependency? 487 // TODO(ahe): Is this really a global dependency?
468 Registry registry = compiler.globalDependencies; 488 Registry registry = compiler.globalDependencies;
469 bool allUsedBefore = unusedClasses.isEmpty; 489 bool allUsedBefore = unusedClasses.isEmpty;
470 for (var type in behavior.typesInstantiated) { 490 for (var type in behavior.typesInstantiated) {
471 if (matchedTypeConstraints.contains(type)) continue; 491 if (matchedTypeConstraints.contains(type)) continue;
472 matchedTypeConstraints.add(type); 492 matchedTypeConstraints.add(type);
473 if (type is SpecialType) { 493 if (type is SpecialType) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 superclass, 652 superclass,
633 () => <ClassElement>[]); 653 () => <ClassElement>[]);
634 directSubtypes.add(cls); 654 directSubtypes.add(cls);
635 } 655 }
636 656
637 void logSummary(log(message)) { 657 void logSummary(log(message)) {
638 log('Compiled ${registeredClasses.length} native classes, ' 658 log('Compiled ${registeredClasses.length} native classes, '
639 '${unusedClasses.length} native classes omitted.'); 659 '${unusedClasses.length} native classes omitted.');
640 } 660 }
641 } 661 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698