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

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

Issue 808553004: Revert "cps-ir: Add support for intercepted calls." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.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) 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 4
5 // IrNodes are kept in a separate library to have precise control over their 5 // IrNodes are kept in a separate library to have precise control over their
6 // dependencies on other parts of the system. 6 // dependencies on other parts of the system.
7 library dart2js.ir_nodes; 7 library dart2js.ir_nodes;
8 8
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../constants/values.dart' as values show ConstantValue; 10 import '../constants/values.dart' as values show ConstantValue;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 /// Invoke a method, operator, getter, setter, or index getter/setter. 187 /// Invoke a method, operator, getter, setter, or index getter/setter.
188 /// Converting a method to a function object is treated as a getter invocation. 188 /// Converting a method to a function object is treated as a getter invocation.
189 class InvokeMethod extends Expression implements Invoke { 189 class InvokeMethod extends Expression implements Invoke {
190 final Reference<Primitive> receiver; 190 final Reference<Primitive> receiver;
191 final Selector selector; 191 final Selector selector;
192 final Reference<Continuation> continuation; 192 final Reference<Continuation> continuation;
193 final List<Reference<Primitive>> arguments; 193 final List<Reference<Primitive>> arguments;
194 194
195 InvokeMethod(Primitive receiver, 195 InvokeMethod(Primitive receiver,
196 Selector selector, 196 this.selector,
197 Continuation cont, 197 Continuation cont,
198 List<Primitive> args) 198 List<Primitive> args)
199 : this.internal(new Reference<Primitive>(receiver), 199 : receiver = new Reference<Primitive>(receiver),
200 selector, 200 continuation = new Reference<Continuation>(cont),
201 new Reference<Continuation>(cont), 201 arguments = _referenceList(args) {
202 _referenceList(args));
203
204 InvokeMethod.internal(this.receiver,
205 this.selector,
206 this.continuation,
207 this.arguments) {
208 assert(selector != null); 202 assert(selector != null);
209 assert(selector.kind == SelectorKind.CALL || 203 assert(selector.kind == SelectorKind.CALL ||
210 selector.kind == SelectorKind.OPERATOR || 204 selector.kind == SelectorKind.OPERATOR ||
211 (selector.kind == SelectorKind.GETTER && arguments.isEmpty) || 205 (selector.kind == SelectorKind.GETTER && arguments.isEmpty) ||
212 (selector.kind == SelectorKind.SETTER && arguments.length == 1) || 206 (selector.kind == SelectorKind.SETTER && arguments.length == 1) ||
213 (selector.kind == SelectorKind.INDEX && arguments.length == 1) || 207 (selector.kind == SelectorKind.INDEX && arguments.length == 1) ||
214 (selector.kind == SelectorKind.INDEX && arguments.length == 2)); 208 (selector.kind == SelectorKind.INDEX && arguments.length == 2));
215 } 209 }
216 210
217 bool get isIntercepted => receiver.definition is Interceptor;
218
219 accept(Visitor visitor) => visitor.visitInvokeMethod(this); 211 accept(Visitor visitor) => visitor.visitInvokeMethod(this);
220 } 212 }
221 213
222 /// Invoke a method, operator, getter, setter, or index getter/setter from the 214 /// Invoke a method, operator, getter, setter, or index getter/setter from the
223 /// super class in tail position. 215 /// super class in tail position.
224 class InvokeSuperMethod extends Expression implements Invoke { 216 class InvokeSuperMethod extends Expression implements Invoke {
225 final Selector selector; 217 final Selector selector;
226 final Reference<Continuation> continuation; 218 final Reference<Continuation> continuation;
227 final List<Reference<Primitive>> arguments; 219 final List<Reference<Primitive>> arguments;
228 220
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 448
457 class Identical extends Primitive { 449 class Identical extends Primitive {
458 final Reference<Primitive> left; 450 final Reference<Primitive> left;
459 final Reference<Primitive> right; 451 final Reference<Primitive> right;
460 Identical(Primitive left, Primitive right) 452 Identical(Primitive left, Primitive right)
461 : left = new Reference<Primitive>(left), 453 : left = new Reference<Primitive>(left),
462 right = new Reference<Primitive>(right); 454 right = new Reference<Primitive>(right);
463 accept(Visitor visitor) => visitor.visitIdentical(this); 455 accept(Visitor visitor) => visitor.visitIdentical(this);
464 } 456 }
465 457
466 class Interceptor extends Primitive {
467 final Reference<Primitive> input;
468 final Set<ClassElement> interceptedClasses;
469 Interceptor(Primitive input, this.interceptedClasses)
470 : this.input = new Reference<Primitive>(input);
471 accept(Visitor visitor) => visitor.visitInterceptor(this);
472 }
473
474 class Constant extends Primitive { 458 class Constant extends Primitive {
475 final ConstantExpression expression; 459 final ConstantExpression expression;
476 460
477 Constant(this.expression); 461 Constant(this.expression);
478 462
479 values.ConstantValue get value => expression.value; 463 values.ConstantValue get value => expression.value;
480 464
481 accept(Visitor visitor) => visitor.visitConstant(this); 465 accept(Visitor visitor) => visitor.visitConstant(this);
482 } 466 }
483 467
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 T visitGetClosureVariable(GetClosureVariable node) => visitPrimitive(node); 683 T visitGetClosureVariable(GetClosureVariable node) => visitPrimitive(node);
700 T visitParameter(Parameter node) => visitPrimitive(node); 684 T visitParameter(Parameter node) => visitPrimitive(node);
701 T visitContinuation(Continuation node) => visitDefinition(node); 685 T visitContinuation(Continuation node) => visitDefinition(node);
702 T visitClosureVariable(ClosureVariable node) => visitDefinition(node); 686 T visitClosureVariable(ClosureVariable node) => visitDefinition(node);
703 687
704 // Conditions. 688 // Conditions.
705 T visitIsTrue(IsTrue node) => visitCondition(node); 689 T visitIsTrue(IsTrue node) => visitCondition(node);
706 690
707 // JavaScript specific nodes. 691 // JavaScript specific nodes.
708 T visitIdentical(Identical node) => visitPrimitive(node); 692 T visitIdentical(Identical node) => visitPrimitive(node);
709 T visitInterceptor(Interceptor node) => visitPrimitive(node);
710 } 693 }
711 694
712 /// Recursively visits the entire CPS term, and calls abstract `process*` 695 /// Recursively visits the entire CPS term, and calls abstract `process*`
713 /// (i.e. `processLetPrim`) functions in pre-order. 696 /// (i.e. `processLetPrim`) functions in pre-order.
714 abstract class RecursiveVisitor extends Visitor { 697 abstract class RecursiveVisitor extends Visitor {
715 const RecursiveVisitor(); 698 const RecursiveVisitor();
716 699
717 // Ensures that RecursiveVisitor contains overrides for all relevant nodes. 700 // Ensures that RecursiveVisitor contains overrides for all relevant nodes.
718 // As a rule of thumb, nodes with structure to traverse should be overridden 701 // As a rule of thumb, nodes with structure to traverse should be overridden
719 // with the appropriate visits in this class (for example, visitLetCont), 702 // with the appropriate visits in this class (for example, visitLetCont),
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 processReference(node.value); 872 processReference(node.value);
890 } 873 }
891 874
892 // JavaScript specific nodes. 875 // JavaScript specific nodes.
893 processIdentical(Identical node) {} 876 processIdentical(Identical node) {}
894 visitIdentical(Identical node) { 877 visitIdentical(Identical node) {
895 processIdentical(node); 878 processIdentical(node);
896 processReference(node.left); 879 processReference(node.left);
897 processReference(node.right); 880 processReference(node.right);
898 } 881 }
899
900 processInterceptor(Interceptor node) {}
901 visitInterceptor(Interceptor node) {
902 processInterceptor(node);
903 processReference(node.input);
904 }
905 } 882 }
906 883
907 /// Keeps track of currently unused register indices. 884 /// Keeps track of currently unused register indices.
908 class RegisterArray { 885 class RegisterArray {
909 int nextIndex = 0; 886 int nextIndex = 0;
910 final List<int> freeStack = <int>[]; 887 final List<int> freeStack = <int>[];
911 888
912 /// Returns an index that is currently unused. 889 /// Returns an index that is currently unused.
913 int makeIndex() { 890 int makeIndex() {
914 if (freeStack.isEmpty) { 891 if (freeStack.isEmpty) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 void visitIsTrue(IsTrue node) { 1056 void visitIsTrue(IsTrue node) {
1080 visitReference(node.value); 1057 visitReference(node.value);
1081 } 1058 }
1082 1059
1083 // JavaScript specific nodes. 1060 // JavaScript specific nodes.
1084 1061
1085 void visitIdentical(Identical node) { 1062 void visitIdentical(Identical node) {
1086 visitReference(node.left); 1063 visitReference(node.left);
1087 visitReference(node.right); 1064 visitReference(node.right);
1088 } 1065 }
1066 }
1089 1067
1090 void visitInterceptor(Interceptor node) {
1091 visitReference(node.input);
1092 }
1093 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698