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

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

Issue 1957343002: Register NativeBehavior from WorldImpact. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment. Created 4 years, 7 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) 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 import 'dart:collection' show Queue; 5 import 'dart:collection' show Queue;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/backend_api.dart' show ForeignResolver; 8 import '../common/backend_api.dart' show ForeignResolver;
9 import '../common/registry.dart' show Registry; 9 import '../common/registry.dart' show Registry;
10 import '../common/resolution.dart' show Resolution; 10 import '../common/resolution.dart' show Resolution;
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 /** 599 /**
600 * Handles JS-calls, which can be an instantiation point for types. 600 * Handles JS-calls, which can be an instantiation point for types.
601 * 601 *
602 * For example, the following code instantiates and returns native classes 602 * For example, the following code instantiates and returns native classes
603 * that are `_DOMWindowImpl` or a subtype. 603 * that are `_DOMWindowImpl` or a subtype.
604 * 604 *
605 * JS('_DOMWindowImpl', 'window') 605 * JS('_DOMWindowImpl', 'window')
606 * 606 *
607 */ 607 */
608 NativeBehavior resolveJsCall(Send node, ForeignResolver resolver) { 608 NativeBehavior resolveJsCall(Send node, ForeignResolver resolver) {
609 NativeBehavior behavior = NativeBehavior.ofJsCall( 609 return NativeBehavior.ofJsCall(
610 node, reporter, compiler.parsingContext, compiler.coreTypes, resolver); 610 node, reporter, compiler.parsingContext, compiler.coreTypes, resolver);
611 // TODO(johnniwinther): Move registration to the world impact application.
612 registerNativeBehavior(behavior, node);
613 return behavior;
614 } 611 }
615 612
616 /** 613 /**
617 * Handles JS-embedded global calls, which can be an instantiation point for 614 * Handles JS-embedded global calls, which can be an instantiation point for
618 * types. 615 * types.
619 * 616 *
620 * For example, the following code instantiates and returns a String class 617 * For example, the following code instantiates and returns a String class
621 * 618 *
622 * JS_EMBEDDED_GLOBAL('String', 'foo') 619 * JS_EMBEDDED_GLOBAL('String', 'foo')
623 * 620 *
624 */ 621 */
625 NativeBehavior resolveJsEmbeddedGlobalCall( 622 NativeBehavior resolveJsEmbeddedGlobalCall(
626 Send node, ForeignResolver resolver) { 623 Send node, ForeignResolver resolver) {
627 NativeBehavior behavior = NativeBehavior.ofJsEmbeddedGlobalCall( 624 return NativeBehavior.ofJsEmbeddedGlobalCall(
628 node, reporter, compiler.parsingContext, compiler.coreTypes, resolver); 625 node, reporter, compiler.parsingContext, compiler.coreTypes, resolver);
629 // TODO(johnniwinther): Move registration to the world impact application.
630 registerNativeBehavior(behavior, node);
631 return behavior;
632 } 626 }
633 627
634 /** 628 /**
635 * Handles JS-compiler builtin calls, which can be an instantiation point for 629 * Handles JS-compiler builtin calls, which can be an instantiation point for
636 * types. 630 * types.
637 * 631 *
638 * For example, the following code instantiates and returns a String class 632 * For example, the following code instantiates and returns a String class
639 * 633 *
640 * JS_BUILTIN('String', 'int2string', 0) 634 * JS_BUILTIN('String', 'int2string', 0)
641 * 635 *
642 */ 636 */
643 NativeBehavior resolveJsBuiltinCall(Send node, ForeignResolver resolver) { 637 NativeBehavior resolveJsBuiltinCall(Send node, ForeignResolver resolver) {
644 NativeBehavior behavior = NativeBehavior.ofJsBuiltinCall( 638 return NativeBehavior.ofJsBuiltinCall(
645 node, reporter, compiler.parsingContext, compiler.coreTypes, resolver); 639 node, reporter, compiler.parsingContext, compiler.coreTypes, resolver);
646 // TODO(johnniwinther): Move registration to the world impact application.
647 registerNativeBehavior(behavior, node);
648 return behavior;
649 } 640 }
650 } 641 }
651 642
652 class NativeCodegenEnqueuer extends NativeEnqueuerBase { 643 class NativeCodegenEnqueuer extends NativeEnqueuerBase {
653 final CodeEmitterTask emitter; 644 final CodeEmitterTask emitter;
654 645
655 final Set<ClassElement> doneAddSubtypes = new Set<ClassElement>(); 646 final Set<ClassElement> doneAddSubtypes = new Set<ClassElement>();
656 647
657 NativeCodegenEnqueuer(Enqueuer world, Compiler compiler, this.emitter) 648 NativeCodegenEnqueuer(Enqueuer world, Compiler compiler, this.emitter)
658 : super(world, compiler, compiler.options.enableNativeLiveTypeAnalysis); 649 : super(world, compiler, compiler.options.enableNativeLiveTypeAnalysis);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 List<Element> directSubtypes = 695 List<Element> directSubtypes =
705 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]); 696 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]);
706 directSubtypes.add(cls); 697 directSubtypes.add(cls);
707 } 698 }
708 699
709 void logSummary(log(message)) { 700 void logSummary(log(message)) {
710 log('Compiled ${registeredClasses.length} native classes, ' 701 log('Compiled ${registeredClasses.length} native classes, '
711 '${unusedClasses.length} native classes omitted.'); 702 '${unusedClasses.length} native classes omitted.');
712 } 703 }
713 } 704 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/resolution/registry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698