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

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

Issue 898463002: Rename ClosureVariable, use separate IR forms for declaration and assignment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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;
11 import '../dart2jslib.dart' as dart2js show invariant; 11 import '../dart2jslib.dart' as dart2js show invariant;
12 import '../elements/elements.dart'; 12 import '../elements/elements.dart';
13 import '../universe/universe.dart' show Selector, SelectorKind; 13 import '../universe/universe.dart' show Selector, SelectorKind;
14 import '../dart_types.dart' show DartType, GenericType; 14 import '../dart_types.dart' show DartType, GenericType;
15 import '../cps_ir/optimizers.dart'; 15 import '../cps_ir/optimizers.dart';
16 import '../closure.dart' show ClosureClassElement;
17 16
18 abstract class Node { 17 abstract class Node {
19 /// A pointer to the parent node. Is null until set by optimization passes. 18 /// A pointer to the parent node. Is null until set by optimization passes.
20 Node parent; 19 Node parent;
21 20
22 accept(Visitor visitor); 21 accept(Visitor visitor);
23 } 22 }
24 23
25 abstract class Expression extends Node { 24 abstract class Expression extends Node {
26 Expression plug(Expression expr) => throw 'impossible'; 25 Expression plug(Expression expr) => throw 'impossible';
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } else { 100 } else {
102 previous.next = next; 101 previous.next = next;
103 } 102 }
104 if (next != null) next.previous = previous; 103 if (next != null) next.previous = previous;
105 } 104 }
106 } 105 }
107 106
108 /// Binding a value (primitive or constant): 'let val x = V in E'. The bound 107 /// Binding a value (primitive or constant): 'let val x = V in E'. The bound
109 /// value is in scope in the body. 108 /// value is in scope in the body.
110 /// During one-pass construction a LetVal with an empty body is used to 109 /// During one-pass construction a LetVal with an empty body is used to
111 /// represent one-level context 'let val x = V in []'. 110 /// represent the one-hole context 'let val x = V in []'.
112 class LetPrim extends Expression implements InteriorNode { 111 class LetPrim extends Expression implements InteriorNode {
113 final Primitive primitive; 112 final Primitive primitive;
114 Expression body; 113 Expression body;
115 114
116 LetPrim(this.primitive, [this.body = null]); 115 LetPrim(this.primitive, [this.body = null]);
117 116
118 Expression plug(Expression expr) { 117 Expression plug(Expression expr) {
119 assert(body == null); 118 assert(body == null);
120 return body = expr; 119 return body = expr;
121 } 120 }
122 121
123 accept(Visitor visitor) => visitor.visitLetPrim(this); 122 accept(Visitor visitor) => visitor.visitLetPrim(this);
124 } 123 }
125 124
126 125
127 /// Binding continuations. 126 /// Binding continuations.
128 /// 127 ///
129 /// let cont k0(v0 ...) = E0 128 /// let cont k0(v0 ...) = E0
130 /// k1(v1 ...) = E1 129 /// k1(v1 ...) = E1
131 /// ... 130 /// ...
132 /// in E 131 /// in E
133 /// 132 ///
134 /// The bound continuations are in scope in the body and the continuation 133 /// The bound continuations are in scope in the body and the continuation
135 /// parameters are in scope in the respective continuation bodies. 134 /// parameters are in scope in the respective continuation bodies.
136 /// During one-pass construction a LetCont whose first continuation has an empty 135 /// During one-pass construction a LetCont whose first continuation has an empty
137 /// body is used to represent the one-level context 136 /// body is used to represent the one-hole context
138 /// 'let cont ... k(v) = [] ... in E'. 137 /// 'let cont ... k(v) = [] ... in E'.
139 class LetCont extends Expression implements InteriorNode { 138 class LetCont extends Expression implements InteriorNode {
140 List<Continuation> continuations; 139 List<Continuation> continuations;
141 Expression body; 140 Expression body;
142 141
143 LetCont(Continuation continuation, this.body) 142 LetCont(Continuation continuation, this.body)
144 : continuations = <Continuation>[continuation]; 143 : continuations = <Continuation>[continuation];
145 144
146 LetCont.many(this.continuations, this.body); 145 LetCont.many(this.continuations, this.body);
147 146
148 Expression plug(Expression expr) { 147 Expression plug(Expression expr) {
149 assert(continuations != null && 148 assert(continuations != null &&
150 continuations.isNotEmpty && 149 continuations.isNotEmpty &&
151 continuations.first.body == null); 150 continuations.first.body == null);
152 return continuations.first.body = expr; 151 return continuations.first.body = expr;
153 } 152 }
154 153
155 accept(Visitor visitor) => visitor.visitLetCont(this); 154 accept(Visitor visitor) => visitor.visitLetCont(this);
156 } 155 }
157 156
157 /// Binding mutable variables.
158 ///
159 /// let mutable v = P in E
160 ///
161 /// [MutableVariable]s can be seen as ref cells that are not first-class
162 /// values. They are therefore not [Primitive]s and not bound by [LetPrim]
163 /// to prevent unrestricted use of references to them. During one-pass
karlklose 2015/02/03 09:56:16 Would it make sense to share the context (maybe on
Kevin Millikin (Google) 2015/02/03 14:11:48 It's not always a field named body that gets plugg
164 /// construction, a [LetMutable} with an empty body is use to represent the
karlklose 2015/02/03 09:56:16 '[LetMutable}' -> '[LetMutable]'.
Kevin Millikin (Google) 2015/02/03 14:11:49 Done.
165 /// one-hole context 'let mutable v = P in []'.
166 class LetMutable extends Expression implements InteriorNode {
167 final MutableVariable variable;
168 final Reference<Primitive> value;
169 Expression body;
170
171 LetMutable(this.variable, Primitive value)
172 : this.value = new Reference<Primitive>(value);
173
174 Expression plug(Expression expr) {
175 return body = expr;
176 }
177
178 accept(Visitor visitor) => visitor.visitLetMutable(this);
179 }
180
158 abstract class Invoke { 181 abstract class Invoke {
159 Selector get selector; 182 Selector get selector;
160 List<Reference<Primitive>> get arguments; 183 List<Reference<Primitive>> get arguments;
161 } 184 }
162 185
163 /// Represents a node with a child node, which can be accessed through the 186 /// Represents a node with a child node, which can be accessed through the
164 /// `body` member. A typical usage is when removing a node from the CPS graph: 187 /// `body` member. A typical usage is when removing a node from the CPS graph:
165 /// 188 ///
166 /// Node child = node.body; 189 /// Node child = node.body;
167 /// InteriorNode parent = node.parent; 190 /// InteriorNode parent = node.parent;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 final Reference<Continuation> continuation; 367 final Reference<Continuation> continuation;
345 final List<Reference<Primitive>> arguments; 368 final List<Reference<Primitive>> arguments;
346 369
347 ConcatenateStrings(Continuation cont, List<Primitive> args) 370 ConcatenateStrings(Continuation cont, List<Primitive> args)
348 : continuation = new Reference<Continuation>(cont), 371 : continuation = new Reference<Continuation>(cont),
349 arguments = _referenceList(args); 372 arguments = _referenceList(args);
350 373
351 accept(Visitor visitor) => visitor.visitConcatenateStrings(this); 374 accept(Visitor visitor) => visitor.visitConcatenateStrings(this);
352 } 375 }
353 376
354 /// Gets the value from a closure variable. 377 /// Gets the value from a [MutableVariable].
355 /// 378 ///
356 /// Closure variables can be seen as ref cells that are not first-class values. 379 /// [MutableVariable]s can be seen as ref cells that are not first-class
357 /// A [LetPrim] with a [GetClosureVariable] can then be seen as: 380 /// values. A [LetPrim] with a [GetMutableVariable] can then be seen as:
358 /// 381 ///
359 /// let prim p = ![variable] in [body] 382 /// let prim p = ![variable] in [body]
360 /// 383 ///
361 class GetClosureVariable extends Primitive { 384 class GetMutableVariable extends Primitive {
362 final Reference<ClosureVariable> variable; 385 final Reference<MutableVariable> variable;
363 386
364 GetClosureVariable(ClosureVariable variable) 387 GetMutableVariable(MutableVariable variable)
365 : this.variable = new Reference<ClosureVariable>(variable); 388 : this.variable = new Reference<MutableVariable>(variable);
366 389
367 accept(Visitor visitor) => visitor.visitGetClosureVariable(this); 390 accept(Visitor visitor) => visitor.visitGetMutableVariable(this);
368 } 391 }
369 392
370 /// Assign or declare a closure variable. 393 /// Assign a [MutableVariable].
371 /// 394 ///
372 /// Closure variables can be seen as ref cells that are not first-class values. 395 /// [MutableVariable]s can be seen as ref cells that are not first-class
373 /// If [isDeclaration], this can seen as a let binding: 396 /// values. This can be seen as a dereferencing assignment:
374 /// 397 ///
375 /// let [variable] = ref [value] in [body] 398 /// { [variable] := [value]; [body] }
376 /// 399 class SetMutableVariable extends Expression implements InteriorNode {
377 /// And otherwise, it can be seen as a dereferencing assignment: 400 final Reference<MutableVariable> variable;
378 ///
379 /// { ![variable] := [value]; [body] }
380 ///
381 /// Closure variables without a declaring [SetClosureVariable] are implicitly
382 /// declared at the entry to the [variable]'s enclosing function.
383 class SetClosureVariable extends Expression implements InteriorNode {
384 final Reference<ClosureVariable> variable;
385 final Reference<Primitive> value; 401 final Reference<Primitive> value;
386 Expression body; 402 Expression body;
387 403
388 /// If true, this declares a new copy of the closure variable. If so, all 404 SetMutableVariable(MutableVariable variable, Primitive value)
389 /// uses of the closure variable must occur in the [body]. 405 : this.variable = new Reference<MutableVariable>(variable),
390 /// 406 this.value = new Reference<Primitive>(value);
391 /// There can be at most one declaration per closure variable. If there is no
392 /// declaration, only one copy exists (per function execution). It is best to
393 /// avoid declaring closure variables if it is not necessary.
394 final bool isDeclaration;
395 407
396 SetClosureVariable(ClosureVariable variable, Primitive value, 408 accept(Visitor visitor) => visitor.visitSetMutableVariable(this);
397 {this.isDeclaration : false })
398 : this.value = new Reference<Primitive>(value),
399 this.variable = new Reference<ClosureVariable>(variable);
400
401 accept(Visitor visitor) => visitor.visitSetClosureVariable(this);
402 409
403 Expression plug(Expression expr) { 410 Expression plug(Expression expr) {
404 assert(body == null); 411 assert(body == null);
405 return body = expr; 412 return body = expr;
406 } 413 }
407 } 414 }
408 415
409 /// Create a potentially recursive function and store it in a closure variable. 416 /// Create a potentially recursive function and store it in a [MutableVariable].
410 /// The function can access itself using [GetClosureVariable] on [variable]. 417 /// The function can access itself using [GetMutableVariable] on [variable].
411 /// There must not exist a [SetClosureVariable] to [variable]. 418 /// There must not exist a [SetMutableVariable] to [variable].
412 /// 419 ///
413 /// This can be seen as a let rec binding: 420 /// This can be seen as a let rec binding:
414 /// 421 ///
415 /// let rec [variable] = [definition] in [body] 422 /// let rec [variable] = [definition] in [body]
416 /// 423 ///
417 class DeclareFunction extends Expression implements InteriorNode { 424 class DeclareFunction extends Expression implements InteriorNode {
418 final Reference<ClosureVariable> variable; 425 final MutableVariable variable;
419 final FunctionDefinition definition; 426 final FunctionDefinition definition;
420 Expression body; 427 Expression body;
421 428
422 DeclareFunction(ClosureVariable variable, this.definition) 429 DeclareFunction(this.variable, this.definition);
423 : this.variable = new Reference<ClosureVariable>(variable);
424 430
425 Expression plug(Expression expr) { 431 Expression plug(Expression expr) {
426 assert(body == null); 432 assert(body == null);
427 return body = expr; 433 return body = expr;
428 } 434 }
429 435
430 accept(Visitor visitor) => visitor.visitDeclareFunction(this); 436 accept(Visitor visitor) => visitor.visitDeclareFunction(this);
431 } 437 }
432 438
433 /// Invoke a continuation in tail position. 439 /// Invoke a continuation in tail position.
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 /// Class.c(); 703 /// Class.c();
698 /// } 704 /// }
699 /// 705 ///
700 /// If `field` had an initializer, possibly `null`, constructors `Class.a` and 706 /// If `field` had an initializer, possibly `null`, constructors `Class.a` and
701 /// `Class.b` would be invalid, and since `field` has no initializer 707 /// `Class.b` would be invalid, and since `field` has no initializer
702 /// constructor `Class.c` is invalid. We therefore need to distinguish the two 708 /// constructor `Class.c` is invalid. We therefore need to distinguish the two
703 /// cases. 709 /// cases.
704 bool get hasInitializer => body != null; 710 bool get hasInitializer => body != null;
705 } 711 }
706 712
707 /// Identifies a closure variable. 713 /// Identifies a mutable variable.
708 class ClosureVariable extends Definition { 714 class MutableVariable extends Definition {
709 /// Body of code that declares this closure variable. 715 /// Body of source code that declares this mutable variable.
710 ExecutableElement host; 716 ExecutableElement host;
711 Entity hint; 717 Entity hint;
712 718
713 ClosureVariable(this.host, this.hint); 719 MutableVariable(this.host, this.hint);
714 720
715 accept(Visitor v) => v.visitClosureVariable(this); 721 accept(Visitor v) => v.visitMutableVariable(this);
716 } 722 }
717 723
718 class RunnableBody extends InteriorNode { 724 class RunnableBody extends InteriorNode {
719 Expression body; 725 Expression body;
720 final Continuation returnContinuation; 726 final Continuation returnContinuation;
721 RunnableBody(this.body, this.returnContinuation); 727 RunnableBody(this.body, this.returnContinuation);
722 accept(Visitor visitor) => visitor.visitRunnableBody(this); 728 accept(Visitor visitor) => visitor.visitRunnableBody(this);
723 } 729 }
724 730
725 /// A function definition, consisting of parameters and a body. The parameters 731 /// A function definition, consisting of parameters and a body. The parameters
726 /// include a distinguished continuation parameter (held by the body). 732 /// include a distinguished continuation parameter (held by the body).
727 class FunctionDefinition extends Node 733 class FunctionDefinition extends Node
728 implements ExecutableDefinition { 734 implements ExecutableDefinition {
729 final FunctionElement element; 735 final FunctionElement element;
730 /// Mixed list of [Parameter]s and [ClosureVariable]s. 736 /// Mixed list of [Parameter]s and [MutableVariable]s.
731 final List<Definition> parameters; 737 final List<Definition> parameters;
732 final RunnableBody body; 738 final RunnableBody body;
733 final List<ConstDeclaration> localConstants; 739 final List<ConstDeclaration> localConstants;
734 740
735 /// Values for optional parameters. 741 /// Values for optional parameters.
736 final List<ConstantExpression> defaultParameterValues; 742 final List<ConstantExpression> defaultParameterValues;
737 743
738 FunctionDefinition(this.element, 744 FunctionDefinition(this.element,
739 this.parameters, 745 this.parameters,
740 this.body, 746 this.body,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 } 829 }
824 830
825 // Initializers 831 // Initializers
826 T visitInitializer(Initializer node) => visitNode(node); 832 T visitInitializer(Initializer node) => visitNode(node);
827 T visitFieldInitializer(FieldInitializer node) => visitInitializer(node); 833 T visitFieldInitializer(FieldInitializer node) => visitInitializer(node);
828 T visitSuperInitializer(SuperInitializer node) => visitInitializer(node); 834 T visitSuperInitializer(SuperInitializer node) => visitInitializer(node);
829 835
830 // Expressions. 836 // Expressions.
831 T visitLetPrim(LetPrim node) => visitExpression(node); 837 T visitLetPrim(LetPrim node) => visitExpression(node);
832 T visitLetCont(LetCont node) => visitExpression(node); 838 T visitLetCont(LetCont node) => visitExpression(node);
839 T visitLetMutable(LetMutable node) => visitExpression(node);
833 T visitInvokeStatic(InvokeStatic node) => visitExpression(node); 840 T visitInvokeStatic(InvokeStatic node) => visitExpression(node);
834 T visitInvokeContinuation(InvokeContinuation node) => visitExpression(node); 841 T visitInvokeContinuation(InvokeContinuation node) => visitExpression(node);
835 T visitInvokeMethod(InvokeMethod node) => visitExpression(node); 842 T visitInvokeMethod(InvokeMethod node) => visitExpression(node);
836 T visitInvokeMethodDirectly(InvokeMethodDirectly node) => visitExpression(node ); 843 T visitInvokeMethodDirectly(InvokeMethodDirectly node) => visitExpression(node );
837 T visitInvokeConstructor(InvokeConstructor node) => visitExpression(node); 844 T visitInvokeConstructor(InvokeConstructor node) => visitExpression(node);
838 T visitConcatenateStrings(ConcatenateStrings node) => visitExpression(node); 845 T visitConcatenateStrings(ConcatenateStrings node) => visitExpression(node);
839 T visitBranch(Branch node) => visitExpression(node); 846 T visitBranch(Branch node) => visitExpression(node);
840 T visitTypeOperator(TypeOperator node) => visitExpression(node); 847 T visitTypeOperator(TypeOperator node) => visitExpression(node);
841 T visitSetClosureVariable(SetClosureVariable node) => visitExpression(node); 848 T visitSetMutableVariable(SetMutableVariable node) => visitExpression(node);
842 T visitDeclareFunction(DeclareFunction node) => visitExpression(node); 849 T visitDeclareFunction(DeclareFunction node) => visitExpression(node);
843 T visitSetField(SetField node) => visitExpression(node); 850 T visitSetField(SetField node) => visitExpression(node);
844 851
845 // Definitions. 852 // Definitions.
846 T visitLiteralList(LiteralList node) => visitPrimitive(node); 853 T visitLiteralList(LiteralList node) => visitPrimitive(node);
847 T visitLiteralMap(LiteralMap node) => visitPrimitive(node); 854 T visitLiteralMap(LiteralMap node) => visitPrimitive(node);
848 T visitConstant(Constant node) => visitPrimitive(node); 855 T visitConstant(Constant node) => visitPrimitive(node);
849 T visitThis(This node) => visitPrimitive(node); 856 T visitThis(This node) => visitPrimitive(node);
850 T visitReifyTypeVar(ReifyTypeVar node) => visitPrimitive(node); 857 T visitReifyTypeVar(ReifyTypeVar node) => visitPrimitive(node);
851 T visitCreateFunction(CreateFunction node) => visitPrimitive(node); 858 T visitCreateFunction(CreateFunction node) => visitPrimitive(node);
852 T visitGetClosureVariable(GetClosureVariable node) => visitPrimitive(node); 859 T visitGetMutableVariable(GetMutableVariable node) => visitPrimitive(node);
853 T visitParameter(Parameter node) => visitPrimitive(node); 860 T visitParameter(Parameter node) => visitPrimitive(node);
854 T visitContinuation(Continuation node) => visitDefinition(node); 861 T visitContinuation(Continuation node) => visitDefinition(node);
855 T visitClosureVariable(ClosureVariable node) => visitDefinition(node); 862 T visitMutableVariable(MutableVariable node) => visitDefinition(node);
856 T visitGetField(GetField node) => visitDefinition(node); 863 T visitGetField(GetField node) => visitDefinition(node);
857 T visitCreateBox(CreateBox node) => visitDefinition(node); 864 T visitCreateBox(CreateBox node) => visitDefinition(node);
858 T visitCreateInstance(CreateInstance node) => visitDefinition(node); 865 T visitCreateInstance(CreateInstance node) => visitDefinition(node);
859 866
860 // Conditions. 867 // Conditions.
861 T visitIsTrue(IsTrue node) => visitCondition(node); 868 T visitIsTrue(IsTrue node) => visitCondition(node);
862 869
863 // JavaScript specific nodes. 870 // JavaScript specific nodes.
864 T visitIdentical(Identical node) => visitPrimitive(node); 871 T visitIdentical(Identical node) => visitPrimitive(node);
865 T visitInterceptor(Interceptor node) => visitPrimitive(node); 872 T visitInterceptor(Interceptor node) => visitPrimitive(node);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 visit(node.body); 941 visit(node.body);
935 } 942 }
936 943
937 processLetCont(LetCont node) {} 944 processLetCont(LetCont node) {}
938 visitLetCont(LetCont node) { 945 visitLetCont(LetCont node) {
939 processLetCont(node); 946 processLetCont(node);
940 node.continuations.forEach(visit); 947 node.continuations.forEach(visit);
941 visit(node.body); 948 visit(node.body);
942 } 949 }
943 950
951 processLetMutable(LetMutable node) {}
952 visitLetMutable(LetMutable node) {
953 processLetMutable(node);
954 visit(node.variable);
955 processReference(node.value);
956 visit(node.body);
957 }
958
944 processInvokeStatic(InvokeStatic node) {} 959 processInvokeStatic(InvokeStatic node) {}
945 visitInvokeStatic(InvokeStatic node) { 960 visitInvokeStatic(InvokeStatic node) {
946 processInvokeStatic(node); 961 processInvokeStatic(node);
947 processReference(node.continuation); 962 processReference(node.continuation);
948 node.arguments.forEach(processReference); 963 node.arguments.forEach(processReference);
949 } 964 }
950 965
951 processInvokeContinuation(InvokeContinuation node) {} 966 processInvokeContinuation(InvokeContinuation node) {}
952 visitInvokeContinuation(InvokeContinuation node) { 967 visitInvokeContinuation(InvokeContinuation node) {
953 processInvokeContinuation(node); 968 processInvokeContinuation(node);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 visit(node.condition); 1008 visit(node.condition);
994 } 1009 }
995 1010
996 processTypeOperator(TypeOperator node) {} 1011 processTypeOperator(TypeOperator node) {}
997 visitTypeOperator(TypeOperator node) { 1012 visitTypeOperator(TypeOperator node) {
998 processTypeOperator(node); 1013 processTypeOperator(node);
999 processReference(node.continuation); 1014 processReference(node.continuation);
1000 processReference(node.receiver); 1015 processReference(node.receiver);
1001 } 1016 }
1002 1017
1003 processSetClosureVariable(SetClosureVariable node) {} 1018 processSetMutableVariable(SetMutableVariable node) {}
1004 visitSetClosureVariable(SetClosureVariable node) { 1019 visitSetMutableVariable(SetMutableVariable node) {
1005 processSetClosureVariable(node); 1020 processSetMutableVariable(node);
1021 processReference(node.variable);
1006 processReference(node.value); 1022 processReference(node.value);
1007 visit(node.body); 1023 visit(node.body);
1008 } 1024 }
1009 1025
1010 processDeclareFunction(DeclareFunction node) {} 1026 processDeclareFunction(DeclareFunction node) {}
1011 visitDeclareFunction(DeclareFunction node) { 1027 visitDeclareFunction(DeclareFunction node) {
1012 processDeclareFunction(node); 1028 processDeclareFunction(node);
1029 visit(node.variable);
1013 visit(node.definition); 1030 visit(node.definition);
1014 visit(node.body); 1031 visit(node.body);
1015 } 1032 }
1016 1033
1017 // Definitions. 1034 // Definitions.
1018 1035
1019 processLiteralList(LiteralList node) {} 1036 processLiteralList(LiteralList node) {}
1020 visitLiteralList(LiteralList node) { 1037 visitLiteralList(LiteralList node) {
1021 processLiteralList(node); 1038 processLiteralList(node);
1022 node.values.forEach(processReference); 1039 node.values.forEach(processReference);
(...skipping 16 matching lines...) Expand all
1039 1056
1040 processReifyTypeVar(ReifyTypeVar node) {} 1057 processReifyTypeVar(ReifyTypeVar node) {}
1041 visitReifyTypeVar(ReifyTypeVar node) => processReifyTypeVar(node); 1058 visitReifyTypeVar(ReifyTypeVar node) => processReifyTypeVar(node);
1042 1059
1043 processCreateFunction(CreateFunction node) {} 1060 processCreateFunction(CreateFunction node) {}
1044 visitCreateFunction(CreateFunction node) { 1061 visitCreateFunction(CreateFunction node) {
1045 processCreateFunction(node); 1062 processCreateFunction(node);
1046 visit(node.definition); 1063 visit(node.definition);
1047 } 1064 }
1048 1065
1049 processClosureVariable(node) {} 1066 processMutableVariable(node) {}
1050 visitClosureVariable(ClosureVariable node) { 1067 visitMutableVariable(MutableVariable node) {
1051 processClosureVariable(node); 1068 processMutableVariable(node);
1052 } 1069 }
1053 1070
1054 processGetClosureVariable(GetClosureVariable node) {} 1071 processGetMutableVariable(GetMutableVariable node) {}
1055 visitGetClosureVariable(GetClosureVariable node) { 1072 visitGetMutableVariable(GetMutableVariable node) {
1056 processGetClosureVariable(node); 1073 processGetMutableVariable(node);
1057 } 1074 }
1058 1075
1059 processParameter(Parameter node) {} 1076 processParameter(Parameter node) {}
1060 visitParameter(Parameter node) => processParameter(node); 1077 visitParameter(Parameter node) => processParameter(node);
1061 1078
1062 processContinuation(Continuation node) {} 1079 processContinuation(Continuation node) {}
1063 visitContinuation(Continuation node) { 1080 visitContinuation(Continuation node) {
1064 processContinuation(node); 1081 processContinuation(node);
1065 node.parameters.forEach(visitParameter); 1082 node.parameters.forEach(visitParameter);
1066 if (node.body != null) visit(node.body); 1083 if (node.body != null) visit(node.body);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 visit(node.body); 1235 visit(node.body);
1219 release(node.primitive); 1236 release(node.primitive);
1220 visit(node.primitive); 1237 visit(node.primitive);
1221 } 1238 }
1222 1239
1223 void visitLetCont(LetCont node) { 1240 void visitLetCont(LetCont node) {
1224 node.continuations.forEach(visit); 1241 node.continuations.forEach(visit);
1225 visit(node.body); 1242 visit(node.body);
1226 } 1243 }
1227 1244
1245 void visitLetMutable(LetMutable node) {
1246 visit(node.body);
1247 visitReference(node.value);
1248 }
1249
1228 void visitInvokeStatic(InvokeStatic node) { 1250 void visitInvokeStatic(InvokeStatic node) {
1229 node.arguments.forEach(visitReference); 1251 node.arguments.forEach(visitReference);
1230 } 1252 }
1231 1253
1232 void visitInvokeContinuation(InvokeContinuation node) { 1254 void visitInvokeContinuation(InvokeContinuation node) {
1233 node.arguments.forEach(visitReference); 1255 node.arguments.forEach(visitReference);
1234 } 1256 }
1235 1257
1236 void visitInvokeMethod(InvokeMethod node) { 1258 void visitInvokeMethod(InvokeMethod node) {
1237 visitReference(node.receiver); 1259 visitReference(node.receiver);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 void visitThis(This node) { 1298 void visitThis(This node) {
1277 } 1299 }
1278 1300
1279 void visitReifyTypeVar(ReifyTypeVar node) { 1301 void visitReifyTypeVar(ReifyTypeVar node) {
1280 } 1302 }
1281 1303
1282 void visitCreateFunction(CreateFunction node) { 1304 void visitCreateFunction(CreateFunction node) {
1283 new RegisterAllocator().visit(node.definition); 1305 new RegisterAllocator().visit(node.definition);
1284 } 1306 }
1285 1307
1286 void visitGetClosureVariable(GetClosureVariable node) { 1308 void visitGetMutableVariable(GetMutableVariable node) {
1287 } 1309 }
1288 1310
1289 void visitSetClosureVariable(SetClosureVariable node) { 1311 void visitSetMutableVariable(SetMutableVariable node) {
1290 visit(node.body); 1312 visit(node.body);
1291 visitReference(node.value); 1313 visitReference(node.value);
1292 } 1314 }
1293 1315
1294 void visitDeclareFunction(DeclareFunction node) { 1316 void visitDeclareFunction(DeclareFunction node) {
1295 new RegisterAllocator().visit(node.definition); 1317 new RegisterAllocator().visit(node.definition);
1296 visit(node.body); 1318 visit(node.body);
1297 } 1319 }
1298 1320
1299 void visitParameter(Parameter node) { 1321 void visitParameter(Parameter node) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 1358
1337 void visitIdentical(Identical node) { 1359 void visitIdentical(Identical node) {
1338 visitReference(node.left); 1360 visitReference(node.left);
1339 visitReference(node.right); 1361 visitReference(node.right);
1340 } 1362 }
1341 1363
1342 void visitInterceptor(Interceptor node) { 1364 void visitInterceptor(Interceptor node) {
1343 visitReference(node.input); 1365 visitReference(node.input);
1344 } 1366 }
1345 } 1367 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698