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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 2464103002: Introduce ClassLike, MemberLike, FieldLike and FunctionLike (Closed)
Patch Set: Updated cf. comments. Created 4 years, 1 month 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/codegen.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
9 import '../common/names.dart'; 9 import '../common/names.dart';
10 import '../common/tasks.dart' show CompilerTask; 10 import '../common/tasks.dart' show CompilerTask;
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 567
568 @override 568 @override
569 void visitStaticGet(ir.StaticGet staticGet) { 569 void visitStaticGet(ir.StaticGet staticGet) {
570 var staticTarget = staticGet.target; 570 var staticTarget = staticGet.target;
571 if (staticTarget is ir.Procedure && 571 if (staticTarget is ir.Procedure &&
572 staticTarget.kind == ir.ProcedureKind.Getter) { 572 staticTarget.kind == ir.ProcedureKind.Getter) {
573 // Invoke the getter 573 // Invoke the getter
574 _pushStaticInvocation(staticTarget, const <HInstruction>[], 574 _pushStaticInvocation(staticTarget, const <HInstruction>[],
575 astAdapter.returnTypeOf(staticTarget)); 575 astAdapter.returnTypeOf(staticTarget));
576 } else { 576 } else {
577 Element element = astAdapter.getElement(staticTarget).declaration; 577 push(new HStatic(astAdapter.getMember(staticTarget),
578 push(new HStatic(element, astAdapter.inferredTypeOf(staticTarget))); 578 astAdapter.inferredTypeOf(staticTarget)));
579 } 579 }
580 } 580 }
581 581
582 @override 582 @override
583 void visitStaticSet(ir.StaticSet staticSet) { 583 void visitStaticSet(ir.StaticSet staticSet) {
584 staticSet.value.accept(this); 584 staticSet.value.accept(this);
585 HInstruction value = pop(); 585 HInstruction value = pop();
586 586
587 var staticTarget = staticSet.target; 587 var staticTarget = staticSet.target;
588 if (staticTarget is ir.Procedure) { 588 if (staticTarget is ir.Procedure) {
589 // Invoke the setter 589 // Invoke the setter
590 _pushStaticInvocation(staticTarget, <HInstruction>[value], 590 _pushStaticInvocation(staticTarget, <HInstruction>[value],
591 astAdapter.returnTypeOf(staticTarget)); 591 astAdapter.returnTypeOf(staticTarget));
592 pop(); 592 pop();
593 } else { 593 } else {
594 // TODO(het): check or trust type 594 // TODO(het): check or trust type
595 add(new HStaticStore(astAdapter.getElement(staticTarget), value)); 595 add(new HStaticStore(astAdapter.getMember(staticTarget), value));
596 } 596 }
597 stack.add(value); 597 stack.add(value);
598 } 598 }
599 599
600 @override 600 @override
601 void visitPropertyGet(ir.PropertyGet propertyGet) { 601 void visitPropertyGet(ir.PropertyGet propertyGet) {
602 propertyGet.receiver.accept(this); 602 propertyGet.receiver.accept(this);
603 HInstruction receiver = pop(); 603 HInstruction receiver = pop();
604 604
605 _pushDynamicInvocation(propertyGet, astAdapter.typeOfGet(propertyGet), 605 _pushDynamicInvocation(propertyGet, astAdapter.typeOfGet(propertyGet),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 TypeMask typeMask = astAdapter.returnTypeOf(target); 674 TypeMask typeMask = astAdapter.returnTypeOf(target);
675 675
676 List<HInstruction> arguments = _visitArguments(invocation.arguments); 676 List<HInstruction> arguments = _visitArguments(invocation.arguments);
677 677
678 _pushStaticInvocation(target, arguments, typeMask); 678 _pushStaticInvocation(target, arguments, typeMask);
679 } 679 }
680 680
681 void _pushStaticInvocation( 681 void _pushStaticInvocation(
682 ir.Node target, List<HInstruction> arguments, TypeMask typeMask) { 682 ir.Node target, List<HInstruction> arguments, TypeMask typeMask) {
683 HInstruction instruction = new HInvokeStatic( 683 HInstruction instruction = new HInvokeStatic(
684 astAdapter.getElement(target).declaration, arguments, typeMask, 684 astAdapter.getMember(target), arguments, typeMask,
685 targetCanThrow: astAdapter.getCanThrow(target)); 685 targetCanThrow: astAdapter.getCanThrow(target));
686 instruction.sideEffects = astAdapter.getSideEffects(target); 686 instruction.sideEffects = astAdapter.getSideEffects(target);
687 687
688 push(instruction); 688 push(instruction);
689 } 689 }
690 690
691 void _pushDynamicInvocation( 691 void _pushDynamicInvocation(
692 ir.Node node, TypeMask mask, List<HInstruction> arguments, 692 ir.Node node, TypeMask mask, List<HInstruction> arguments,
693 {Selector selector}) { 693 {Selector selector}) {
694 HInstruction receiver = arguments.first; 694 HInstruction receiver = arguments.first;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 ir.Class surroundingClass = _containingClass(invocation); 750 ir.Class surroundingClass = _containingClass(invocation);
751 751
752 List<HInstruction> inputs = <HInstruction>[]; 752 List<HInstruction> inputs = <HInstruction>[];
753 if (astAdapter.isIntercepted(invocation)) { 753 if (astAdapter.isIntercepted(invocation)) {
754 inputs.add(_interceptorFor(receiver)); 754 inputs.add(_interceptorFor(receiver));
755 } 755 }
756 inputs.add(receiver); 756 inputs.add(receiver);
757 inputs.addAll(arguments); 757 inputs.addAll(arguments);
758 758
759 HInstruction instruction = new HInvokeSuper( 759 HInstruction instruction = new HInvokeSuper(
760 astAdapter.getElement(invocation.interfaceTarget), 760 astAdapter.getMethod(invocation.interfaceTarget),
761 astAdapter.getElement(surroundingClass), 761 astAdapter.getClass(surroundingClass),
762 selector, 762 selector,
763 inputs, 763 inputs,
764 astAdapter.returnTypeOf(invocation.interfaceTarget), 764 astAdapter.returnTypeOf(invocation.interfaceTarget),
765 null, 765 null,
766 isSetter: selector.isSetter || selector.isIndexSet); 766 isSetter: selector.isSetter || selector.isIndexSet);
767 instruction.sideEffects = 767 instruction.sideEffects =
768 compiler.closedWorld.getSideEffectsOfSelector(selector, null); 768 compiler.closedWorld.getSideEffectsOfSelector(selector, null);
769 push(instruction); 769 push(instruction);
770 } 770 }
771 771
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 push(new HNot(popBoolified(), backend.boolType)); 817 push(new HNot(popBoolified(), backend.boolType));
818 } 818 }
819 819
820 @override 820 @override
821 void visitStringConcatenation(ir.StringConcatenation stringConcat) { 821 void visitStringConcatenation(ir.StringConcatenation stringConcat) {
822 KernelStringBuilder stringBuilder = new KernelStringBuilder(this); 822 KernelStringBuilder stringBuilder = new KernelStringBuilder(this);
823 stringConcat.accept(stringBuilder); 823 stringConcat.accept(stringBuilder);
824 stack.add(stringBuilder.result); 824 stack.add(stringBuilder.result);
825 } 825 }
826 } 826 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698