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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1562253003: dart2js cps: Copy calling convention for InvokeMethodDirectly. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.ir_nodes; 4 library dart2js.ir_nodes;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'cps_fragment.dart' show CpsFragment; 7 import 'cps_fragment.dart' show CpsFragment;
8 import '../constants/values.dart' as values; 8 import '../constants/values.dart' as values;
9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; 9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 /// 627 ///
628 /// All optional arguments declared by [target] are passed in explicitly, and 628 /// All optional arguments declared by [target] are passed in explicitly, and
629 /// occur at the end of [arguments] list, in normalized order. 629 /// occur at the end of [arguments] list, in normalized order.
630 class InvokeMethodDirectly extends InvocationPrimitive { 630 class InvokeMethodDirectly extends InvocationPrimitive {
631 Reference<Primitive> receiver; 631 Reference<Primitive> receiver;
632 final FunctionElement target; 632 final FunctionElement target;
633 final Selector selector; 633 final Selector selector;
634 final List<Reference<Primitive>> arguments; 634 final List<Reference<Primitive>> arguments;
635 final SourceInformation sourceInformation; 635 final SourceInformation sourceInformation;
636 636
637 CallingConvention callingConvention = CallingConvention.Normal; 637 CallingConvention callingConvention;
638 638
639 Reference<Primitive> get dartReceiverReference { 639 Reference<Primitive> get dartReceiverReference {
640 return callingConvention == CallingConvention.Intercepted 640 return callingConvention == CallingConvention.Intercepted
641 ? arguments[0] 641 ? arguments[0]
642 : receiver; 642 : receiver;
643 } 643 }
644 644
645 Primitive get dartReceiver => dartReceiverReference.definition; 645 Primitive get dartReceiver => dartReceiverReference.definition;
646 646
647 Reference<Primitive> dartArgumentReference(int n) { 647 Reference<Primitive> dartArgumentReference(int n) {
648 return callingConvention == CallingConvention.Normal 648 return callingConvention == CallingConvention.Normal
649 ? arguments[n] 649 ? arguments[n]
650 : arguments[n + 1]; 650 : arguments[n + 1];
651 } 651 }
652 652
653 Primitive dartArgument(int n) => dartArgumentReference(n).definition; 653 Primitive dartArgument(int n) => dartArgumentReference(n).definition;
654 654
655 InvokeMethodDirectly(Primitive receiver, 655 InvokeMethodDirectly(Primitive receiver,
656 this.target, 656 this.target,
657 this.selector, 657 this.selector,
658 List<Primitive> arguments, 658 List<Primitive> arguments,
659 this.sourceInformation) 659 this.sourceInformation,
660 {this.callingConvention: CallingConvention.Normal})
660 : this.receiver = new Reference<Primitive>(receiver), 661 : this.receiver = new Reference<Primitive>(receiver),
661 this.arguments = _referenceList(arguments); 662 this.arguments = _referenceList(arguments);
662 663
663 accept(Visitor visitor) => visitor.visitInvokeMethodDirectly(this); 664 accept(Visitor visitor) => visitor.visitInvokeMethodDirectly(this);
664 665
665 bool get hasValue => true; 666 bool get hasValue => true;
666 667
667 void setParentPointers() { 668 void setParentPointers() {
668 receiver.parent = this; 669 receiver.parent = this;
669 _setParentsOnList(arguments, this); 670 _setParentsOnList(arguments, this);
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after
2530 return new InvokeMethod(getCopy(node.receiver), node.selector, node.mask, 2531 return new InvokeMethod(getCopy(node.receiver), node.selector, node.mask,
2531 getList(node.arguments), 2532 getList(node.arguments),
2532 sourceInformation: node.sourceInformation, 2533 sourceInformation: node.sourceInformation,
2533 callingConvention: node.callingConvention); 2534 callingConvention: node.callingConvention);
2534 } 2535 }
2535 2536
2536 Definition visitInvokeMethodDirectly(InvokeMethodDirectly node) { 2537 Definition visitInvokeMethodDirectly(InvokeMethodDirectly node) {
2537 return new InvokeMethodDirectly(getCopy(node.receiver), node.target, 2538 return new InvokeMethodDirectly(getCopy(node.receiver), node.target,
2538 node.selector, 2539 node.selector,
2539 getList(node.arguments), 2540 getList(node.arguments),
2540 node.sourceInformation); 2541 node.sourceInformation,
2542 callingConvention: node.callingConvention);
2541 } 2543 }
2542 2544
2543 Definition visitInvokeConstructor(InvokeConstructor node) { 2545 Definition visitInvokeConstructor(InvokeConstructor node) {
2544 return new InvokeConstructor(node.dartType, node.target, node.selector, 2546 return new InvokeConstructor(node.dartType, node.target, node.selector,
2545 getList(node.arguments), 2547 getList(node.arguments),
2546 node.sourceInformation); 2548 node.sourceInformation);
2547 } 2549 }
2548 2550
2549 Definition visitTypeCast(TypeCast node) { 2551 Definition visitTypeCast(TypeCast node) {
2550 return new TypeCast(getCopy(node.value), node.dartType, 2552 return new TypeCast(getCopy(node.value), node.dartType,
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
2835 plug(new Branch.loose(_definitions.getCopy(node.condition), 2837 plug(new Branch.loose(_definitions.getCopy(node.condition),
2836 _copies[node.trueContinuation.definition], 2838 _copies[node.trueContinuation.definition],
2837 _copies[node.falseContinuation.definition]) 2839 _copies[node.falseContinuation.definition])
2838 ..isStrictCheck = node.isStrictCheck); 2840 ..isStrictCheck = node.isStrictCheck);
2839 } 2841 }
2840 2842
2841 visitUnreachable(Unreachable node) { 2843 visitUnreachable(Unreachable node) {
2842 plug(new Unreachable()); 2844 plug(new Unreachable());
2843 } 2845 }
2844 } 2846 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698