| OLD | NEW |
| 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 /** | 577 /** |
| 578 * Handles JS-calls, which can be an instantiation point for types. | 578 * Handles JS-calls, which can be an instantiation point for types. |
| 579 * | 579 * |
| 580 * For example, the following code instantiates and returns native classes | 580 * For example, the following code instantiates and returns native classes |
| 581 * that are `_DOMWindowImpl` or a subtype. | 581 * that are `_DOMWindowImpl` or a subtype. |
| 582 * | 582 * |
| 583 * JS('_DOMWindowImpl', 'window') | 583 * JS('_DOMWindowImpl', 'window') |
| 584 * | 584 * |
| 585 */ | 585 */ |
| 586 NativeBehavior resolveJsCall(Send node, ForeignResolver resolver) { | 586 NativeBehavior resolveJsCall(Send node, ForeignResolver resolver) { |
| 587 return NativeBehavior.ofJsCallSend( | 587 return NativeBehavior.ofJsCall( |
| 588 node, reporter, compiler.parsingContext, compiler.coreTypes, resolver); | 588 node, reporter, compiler.parsingContext, compiler.coreTypes, resolver); |
| 589 } | 589 } |
| 590 | 590 |
| 591 /** | 591 /** |
| 592 * Handles JS-embedded global calls, which can be an instantiation point for | 592 * Handles JS-embedded global calls, which can be an instantiation point for |
| 593 * types. | 593 * types. |
| 594 * | 594 * |
| 595 * For example, the following code instantiates and returns a String class | 595 * For example, the following code instantiates and returns a String class |
| 596 * | 596 * |
| 597 * JS_EMBEDDED_GLOBAL('String', 'foo') | 597 * JS_EMBEDDED_GLOBAL('String', 'foo') |
| 598 * | 598 * |
| 599 */ | 599 */ |
| 600 NativeBehavior resolveJsEmbeddedGlobalCall( | 600 NativeBehavior resolveJsEmbeddedGlobalCall( |
| 601 Send node, ForeignResolver resolver) { | 601 Send node, ForeignResolver resolver) { |
| 602 return NativeBehavior.ofJsEmbeddedGlobalCallSend( | 602 return NativeBehavior.ofJsEmbeddedGlobalCall( |
| 603 node, reporter, compiler.coreTypes, resolver); | 603 node, reporter, compiler.parsingContext, compiler.coreTypes, resolver); |
| 604 } | 604 } |
| 605 | 605 |
| 606 /** | 606 /** |
| 607 * Handles JS-compiler builtin calls, which can be an instantiation point for | 607 * Handles JS-compiler builtin calls, which can be an instantiation point for |
| 608 * types. | 608 * types. |
| 609 * | 609 * |
| 610 * For example, the following code instantiates and returns a String class | 610 * For example, the following code instantiates and returns a String class |
| 611 * | 611 * |
| 612 * JS_BUILTIN('String', 'int2string', 0) | 612 * JS_BUILTIN('String', 'int2string', 0) |
| 613 * | 613 * |
| 614 */ | 614 */ |
| 615 NativeBehavior resolveJsBuiltinCall(Send node, ForeignResolver resolver) { | 615 NativeBehavior resolveJsBuiltinCall(Send node, ForeignResolver resolver) { |
| 616 return NativeBehavior.ofJsBuiltinCallSend( | 616 return NativeBehavior.ofJsBuiltinCall( |
| 617 node, reporter, compiler.coreTypes, resolver); | 617 node, reporter, compiler.parsingContext, compiler.coreTypes, resolver); |
| 618 } | 618 } |
| 619 } | 619 } |
| 620 | 620 |
| 621 class NativeCodegenEnqueuer extends NativeEnqueuerBase { | 621 class NativeCodegenEnqueuer extends NativeEnqueuerBase { |
| 622 final CodeEmitterTask emitter; | 622 final CodeEmitterTask emitter; |
| 623 | 623 |
| 624 final Set<ClassElement> doneAddSubtypes = new Set<ClassElement>(); | 624 final Set<ClassElement> doneAddSubtypes = new Set<ClassElement>(); |
| 625 | 625 |
| 626 NativeCodegenEnqueuer(Enqueuer world, Compiler compiler, this.emitter) | 626 NativeCodegenEnqueuer(Enqueuer world, Compiler compiler, this.emitter) |
| 627 : super(world, compiler, compiler.options.enableNativeLiveTypeAnalysis); | 627 : super(world, compiler, compiler.options.enableNativeLiveTypeAnalysis); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 List<Element> directSubtypes = | 673 List<Element> directSubtypes = |
| 674 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]); | 674 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]); |
| 675 directSubtypes.add(cls); | 675 directSubtypes.add(cls); |
| 676 } | 676 } |
| 677 | 677 |
| 678 void logSummary(log(message)) { | 678 void logSummary(log(message)) { |
| 679 log('Compiled ${registeredClasses.length} native classes, ' | 679 log('Compiled ${registeredClasses.length} native classes, ' |
| 680 '${unusedClasses.length} native classes omitted.'); | 680 '${unusedClasses.length} native classes omitted.'); |
| 681 } | 681 } |
| 682 } | 682 } |
| OLD | NEW |