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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 23204007: Fix casts and type assertions on mixins used in native classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.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 class JavaScriptItemCompilationContext extends ItemCompilationContext { 7 class JavaScriptItemCompilationContext extends ItemCompilationContext {
8 final Set<HInstruction> boundsChecked; 8 final Set<HInstruction> boundsChecked;
9 9
10 JavaScriptItemCompilationContext() 10 JavaScriptItemCompilationContext()
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 ClassElement cls, Enqueuer enqueuer) { 608 ClassElement cls, Enqueuer enqueuer) {
609 if (enqueuer.isResolutionQueue) { 609 if (enqueuer.isResolutionQueue) {
610 cls.ensureResolved(compiler); 610 cls.ensureResolved(compiler);
611 cls.forEachMember((ClassElement classElement, Element member) { 611 cls.forEachMember((ClassElement classElement, Element member) {
612 if (member.isSynthesized) return; 612 if (member.isSynthesized) return;
613 // All methods on [Object] are shadowed by [Interceptor]. 613 // All methods on [Object] are shadowed by [Interceptor].
614 if (classElement == compiler.objectClass) return; 614 if (classElement == compiler.objectClass) return;
615 Set<Element> set = interceptedElements.putIfAbsent( 615 Set<Element> set = interceptedElements.putIfAbsent(
616 member.name, () => new Set<Element>()); 616 member.name, () => new Set<Element>());
617 set.add(member); 617 set.add(member);
618 if (classElement == jsInterceptorClass) return; 618 },
619 if (classElement.isMixinApplication) { 619 includeSuperAndInjectedMembers: true);
620 MixinApplicationElement mixinApplication = classElement; 620
621 assert(member.getEnclosingClass() == mixinApplication.mixin); 621 // Walk superclass chain to find mixins.
622 for (; cls != null; cls = cls.superclass) {
623 if (cls.isMixinApplication) {
624 MixinApplicationElement mixinApplication = cls;
622 classesMixedIntoNativeClasses.add(mixinApplication.mixin); 625 classesMixedIntoNativeClasses.add(mixinApplication.mixin);
623 } 626 }
624 }, 627 }
625 includeSuperAndInjectedMembers: true);
626 } 628 }
627 } 629 }
628 630
629 void addInterceptors(ClassElement cls, 631 void addInterceptors(ClassElement cls,
630 Enqueuer enqueuer, 632 Enqueuer enqueuer,
631 TreeElements elements) { 633 TreeElements elements) {
632 if (enqueuer.isResolutionQueue) { 634 if (enqueuer.isResolutionQueue) {
633 cls.ensureResolved(compiler); 635 cls.ensureResolved(compiler);
634 cls.forEachMember((ClassElement classElement, Element member) { 636 cls.forEachMember((ClassElement classElement, Element member) {
635 // All methods on [Object] are shadowed by [Interceptor]. 637 // All methods on [Object] are shadowed by [Interceptor].
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 } 750 }
749 751
750 JavaScriptItemCompilationContext createItemCompilationContext() { 752 JavaScriptItemCompilationContext createItemCompilationContext() {
751 return new JavaScriptItemCompilationContext(); 753 return new JavaScriptItemCompilationContext();
752 } 754 }
753 755
754 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements) { 756 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements) {
755 jsIndexingBehaviorInterface = 757 jsIndexingBehaviorInterface =
756 compiler.findHelper(const SourceString('JavaScriptIndexingBehavior')); 758 compiler.findHelper(const SourceString('JavaScriptIndexingBehavior'));
757 if (jsIndexingBehaviorInterface != null) { 759 if (jsIndexingBehaviorInterface != null) {
760 jsIndexingBehaviorInterface.ensureResolved(compiler);
758 world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler), 761 world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler),
759 elements); 762 elements);
760 enqueue( 763 enqueue(
761 world, 764 world,
762 compiler.findHelper(const SourceString('isJsIndexable')), 765 compiler.findHelper(const SourceString('isJsIndexable')),
763 elements); 766 elements);
764 enqueue( 767 enqueue(
765 world, 768 world,
766 compiler.findInterceptor(const SourceString('dispatchPropertyName')), 769 compiler.findInterceptor(const SourceString('dispatchPropertyName')),
767 elements); 770 elements);
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 copy(constant.values); 1624 copy(constant.values);
1622 copy(constant.protoValue); 1625 copy(constant.protoValue);
1623 copy(constant); 1626 copy(constant);
1624 } 1627 }
1625 1628
1626 void visitConstructed(ConstructedConstant constant) { 1629 void visitConstructed(ConstructedConstant constant) {
1627 copy(constant.fields); 1630 copy(constant.fields);
1628 copy(constant); 1631 copy(constant);
1629 } 1632 }
1630 } 1633 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698