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