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

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

Issue 1134063002: dart2js cps: Introduce GetStatic/SetStatic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file Created 5 years, 7 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
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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 /// Node child = node.body; 207 /// Node child = node.body;
208 /// InteriorNode parent = node.parent; 208 /// InteriorNode parent = node.parent;
209 /// 209 ///
210 /// child.parent = parent; 210 /// child.parent = parent;
211 /// parent.body = child; 211 /// parent.body = child;
212 abstract class InteriorNode extends Node { 212 abstract class InteriorNode extends Node {
213 Expression get body; 213 Expression get body;
214 void set body(Expression body); 214 void set body(Expression body);
215 } 215 }
216 216
217 /// Invoke a static function or static field getter/setter. 217 /// Invoke a static function or static getter/setter.
218 class InvokeStatic extends Expression implements Invoke { 218 class InvokeStatic extends Expression implements Invoke {
219 /// [FunctionElement] or [FieldElement]. 219 /// [FunctionElement] or [FieldElement].
220 final Entity target; 220 final Entity target;
221 221
222 /** 222 /**
223 * The selector encodes how the function is invoked: number of positional 223 * The selector encodes how the function is invoked: number of positional
224 * arguments, names used in named arguments. This information is required 224 * arguments, names used in named arguments. This information is required
225 * to build the [StaticCallSiteTypeInformation] for the inference graph. 225 * to build the [StaticCallSiteTypeInformation] for the inference graph.
226 */ 226 */
227 final Selector selector; 227 final Selector selector;
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 class GetField extends Primitive implements JsSpecificNode { 614 class GetField extends Primitive implements JsSpecificNode {
615 final Reference<Primitive> object; 615 final Reference<Primitive> object;
616 Element field; 616 Element field;
617 617
618 GetField(Primitive object, this.field) 618 GetField(Primitive object, this.field)
619 : this.object = new Reference<Primitive>(object); 619 : this.object = new Reference<Primitive>(object);
620 620
621 accept(Visitor visitor) => visitor.visitGetField(this); 621 accept(Visitor visitor) => visitor.visitGetField(this);
622 } 622 }
623 623
624 /// Reads the value of a static field or tears off a static method.
625 class GetStatic extends Primitive {
626 final Element element;
627 final SourceInformation sourceInformation;
628
629 GetStatic(this.element, this.sourceInformation);
630
631 accept(Visitor visitor) => visitor.visitGetStatic(this);
632 }
633
634 /// Sets the value of a static field.
635 class SetStatic extends Expression implements InteriorNode {
636 final Element element;
637 final Reference<Primitive> value;
638 Expression body;
639 final SourceInformation sourceInformation;
640
641 SetStatic(this.element, Primitive value, this.sourceInformation)
642 : this.value = new Reference<Primitive>(value);
643
644 Expression plug(Expression expr) {
645 assert(body == null);
646 return body = expr;
647 }
648
649 accept(Visitor visitor) => visitor.visitSetStatic(this);
650 }
651
624 /// Creates an object for holding boxed variables captured by a closure. 652 /// Creates an object for holding boxed variables captured by a closure.
625 class CreateBox extends Primitive implements JsSpecificNode { 653 class CreateBox extends Primitive implements JsSpecificNode {
626 accept(Visitor visitor) => visitor.visitCreateBox(this); 654 accept(Visitor visitor) => visitor.visitCreateBox(this);
627 } 655 }
628 656
629 /// Creates an instance of a class and initializes its fields and runtime type 657 /// Creates an instance of a class and initializes its fields and runtime type
630 /// information. 658 /// information.
631 class CreateInstance extends Primitive implements JsSpecificNode { 659 class CreateInstance extends Primitive implements JsSpecificNode {
632 final ClassElement classElement; 660 final ClassElement classElement;
633 661
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 T visitInvokeMethod(InvokeMethod node); 1023 T visitInvokeMethod(InvokeMethod node);
996 T visitInvokeMethodDirectly(InvokeMethodDirectly node); 1024 T visitInvokeMethodDirectly(InvokeMethodDirectly node);
997 T visitInvokeConstructor(InvokeConstructor node); 1025 T visitInvokeConstructor(InvokeConstructor node);
998 T visitConcatenateStrings(ConcatenateStrings node); 1026 T visitConcatenateStrings(ConcatenateStrings node);
999 T visitThrow(Throw node); 1027 T visitThrow(Throw node);
1000 T visitRethrow(Rethrow node); 1028 T visitRethrow(Rethrow node);
1001 T visitBranch(Branch node); 1029 T visitBranch(Branch node);
1002 T visitTypeOperator(TypeOperator node); 1030 T visitTypeOperator(TypeOperator node);
1003 T visitSetMutableVariable(SetMutableVariable node); 1031 T visitSetMutableVariable(SetMutableVariable node);
1004 T visitDeclareFunction(DeclareFunction node); 1032 T visitDeclareFunction(DeclareFunction node);
1033 T visitSetStatic(SetStatic node);
1005 1034
1006 // Definitions. 1035 // Definitions.
1007 T visitLiteralList(LiteralList node); 1036 T visitLiteralList(LiteralList node);
1008 T visitLiteralMap(LiteralMap node); 1037 T visitLiteralMap(LiteralMap node);
1009 T visitConstant(Constant node); 1038 T visitConstant(Constant node);
1010 T visitReifyTypeVar(ReifyTypeVar node); 1039 T visitReifyTypeVar(ReifyTypeVar node);
1011 T visitCreateFunction(CreateFunction node); 1040 T visitCreateFunction(CreateFunction node);
1012 T visitGetMutableVariable(GetMutableVariable node); 1041 T visitGetMutableVariable(GetMutableVariable node);
1013 T visitParameter(Parameter node); 1042 T visitParameter(Parameter node);
1014 T visitContinuation(Continuation node); 1043 T visitContinuation(Continuation node);
1015 T visitMutableVariable(MutableVariable node); 1044 T visitMutableVariable(MutableVariable node);
1016 T visitNonTailThrow(NonTailThrow node); 1045 T visitNonTailThrow(NonTailThrow node);
1046 T visitGetStatic(GetStatic node);
1017 1047
1018 // JavaScript specific nodes. 1048 // JavaScript specific nodes.
1019 1049
1020 // Conditions. 1050 // Conditions.
1021 T visitIsTrue(IsTrue node); 1051 T visitIsTrue(IsTrue node);
1022 1052
1023 // Expressions. 1053 // Expressions.
1024 T visitSetField(SetField node); 1054 T visitSetField(SetField node);
1025 1055
1026 // Definitions. 1056 // Definitions.
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 processReference(node.value); 1333 processReference(node.value);
1304 visit(node.body); 1334 visit(node.body);
1305 } 1335 }
1306 1336
1307 processGetField(GetField node) {} 1337 processGetField(GetField node) {}
1308 visitGetField(GetField node) { 1338 visitGetField(GetField node) {
1309 processGetField(node); 1339 processGetField(node);
1310 processReference(node.object); 1340 processReference(node.object);
1311 } 1341 }
1312 1342
1343 processGetStatic(GetStatic node) {}
1344 visitGetStatic(GetStatic node) {
1345 processGetStatic(node);
1346 }
1347
1348 processSetStatic(SetStatic node) {}
1349 visitSetStatic(SetStatic node) {
1350 processSetStatic(node);
1351 processReference(node.value);
1352 visit(node.body);
1353 }
1354
1313 processCreateBox(CreateBox node) {} 1355 processCreateBox(CreateBox node) {}
1314 visitCreateBox(CreateBox node) { 1356 visitCreateBox(CreateBox node) {
1315 processCreateBox(node); 1357 processCreateBox(node);
1316 } 1358 }
1317 1359
1318 processReifyRuntimeType(ReifyRuntimeType node) {} 1360 processReifyRuntimeType(ReifyRuntimeType node) {}
1319 visitReifyRuntimeType(ReifyRuntimeType node) { 1361 visitReifyRuntimeType(ReifyRuntimeType node) {
1320 processReifyRuntimeType(node); 1362 processReifyRuntimeType(node);
1321 processReference(node.value); 1363 processReference(node.value);
1322 } 1364 }
(...skipping 15 matching lines...) Expand all
1338 processNonTailThrow(node); 1380 processNonTailThrow(node);
1339 processReference(node.value); 1381 processReference(node.value);
1340 } 1382 }
1341 1383
1342 processCreateInvocationMirror(CreateInvocationMirror node) {} 1384 processCreateInvocationMirror(CreateInvocationMirror node) {}
1343 visitCreateInvocationMirror(CreateInvocationMirror node) { 1385 visitCreateInvocationMirror(CreateInvocationMirror node) {
1344 processCreateInvocationMirror(node); 1386 processCreateInvocationMirror(node);
1345 node.arguments.forEach(processReference); 1387 node.arguments.forEach(processReference);
1346 } 1388 }
1347 } 1389 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698