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

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

Issue 1220193003: dart2js cps: Fuse tear-off and call invocation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
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 '../constants/values.dart' as values show ConstantValue; 6 import '../constants/values.dart' as values show ConstantValue;
7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; 7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../io/source_information.dart' show SourceInformation; 9 import '../io/source_information.dart' show SourceInformation;
10 import '../types/types.dart' show TypeMask; 10 import '../types/types.dart' show TypeMask;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 /// Unlinks this reference from the list of occurrences. 117 /// Unlinks this reference from the list of occurrences.
118 void unlink() { 118 void unlink() {
119 if (previous == null) { 119 if (previous == null) {
120 assert(definition.firstRef == this); 120 assert(definition.firstRef == this);
121 definition.firstRef = next; 121 definition.firstRef = next;
122 } else { 122 } else {
123 previous.next = next; 123 previous.next = next;
124 } 124 }
125 if (next != null) next.previous = previous; 125 if (next != null) next.previous = previous;
126 } 126 }
127
128 void changeTo(Definition<T> newDefinition) {
floitsch 2015/07/02 18:02:40 Add a comment. is this a "replaceWith" ?
asgerf 2015/07/03 08:44:46 I wanted a name that doesn't give the impression t
129 unlink();
130 definition = newDefinition;
131 previous = null;
132 next = definition.firstRef;
133 if (next != null) next.previous = this;
134 definition.firstRef = this;
135 }
127 } 136 }
128 137
129 /// Evaluates a primitive and binds it to variable: `let val x = V in E`. 138 /// Evaluates a primitive and binds it to variable: `let val x = V in E`.
130 /// 139 ///
131 /// The bound value is in scope in the body. 140 /// The bound value is in scope in the body.
132 /// 141 ///
133 /// During one-pass construction a LetPrim with an empty body is used to 142 /// During one-pass construction a LetPrim with an empty body is used to
134 /// represent the one-hole context `let val x = V in []`. 143 /// represent the one-hole context `let val x = V in []`.
135 class LetPrim extends Expression implements InteriorNode { 144 class LetPrim extends Expression implements InteriorNode {
136 Primitive primitive; 145 Primitive primitive;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 final SourceInformation sourceInformation; 268 final SourceInformation sourceInformation;
260 269
261 InvokeStatic(this.target, 270 InvokeStatic(this.target,
262 this.selector, 271 this.selector,
263 List<Primitive> args, 272 List<Primitive> args,
264 Continuation cont, 273 Continuation cont,
265 [this.sourceInformation]) 274 [this.sourceInformation])
266 : arguments = _referenceList(args), 275 : arguments = _referenceList(args),
267 continuation = new Reference<Continuation>(cont); 276 continuation = new Reference<Continuation>(cont);
268 277
278 InvokeStatic.byReference(this.target,
279 this.selector,
280 this.arguments,
281 this.continuation,
282 [this.sourceInformation]);
283
269 accept(Visitor visitor) => visitor.visitInvokeStatic(this); 284 accept(Visitor visitor) => visitor.visitInvokeStatic(this);
270 } 285 }
271 286
272 /// Invoke a method on an object. 287 /// Invoke a method on an object.
273 /// 288 ///
274 /// This includes getters, setters, operators, and index getter/setters. 289 /// This includes getters, setters, operators, and index getter/setters.
275 /// 290 ///
276 /// Tearing off a method is treated like a getter invocation (getters and 291 /// Tearing off a method is treated like a getter invocation (getters and
277 /// tear-offs cannot be distinguished at compile-time). 292 /// tear-offs cannot be distinguished at compile-time).
278 /// 293 ///
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 const RemovalVisitor(); 1282 const RemovalVisitor();
1268 1283
1269 processReference(Reference reference) { 1284 processReference(Reference reference) {
1270 reference.unlink(); 1285 reference.unlink();
1271 } 1286 }
1272 1287
1273 static void remove(Node node) { 1288 static void remove(Node node) {
1274 (const RemovalVisitor()).visit(node); 1289 (const RemovalVisitor()).visit(node);
1275 } 1290 }
1276 } 1291 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698