| 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 : this.object = new Reference<Primitive>(object); | 521 : this.object = new Reference<Primitive>(object); |
| 522 | 522 |
| 523 accept(Visitor visitor) => visitor.visitGetField(this); | 523 accept(Visitor visitor) => visitor.visitGetField(this); |
| 524 } | 524 } |
| 525 | 525 |
| 526 /// Creates an object for holding boxed variables captured by a closure. | 526 /// Creates an object for holding boxed variables captured by a closure. |
| 527 class CreateBox extends Primitive implements JsSpecificNode { | 527 class CreateBox extends Primitive implements JsSpecificNode { |
| 528 accept(Visitor visitor) => visitor.visitCreateBox(this); | 528 accept(Visitor visitor) => visitor.visitCreateBox(this); |
| 529 } | 529 } |
| 530 | 530 |
| 531 /// Instantiates a synthetic class created by closure conversion. | 531 /// Creates an instance of a class and initializes its fields. |
| 532 class CreateClosureClass extends Primitive implements JsSpecificNode { | 532 class CreateInstance extends Primitive implements JsSpecificNode { |
| 533 final ClosureClassElement classElement; | 533 final ClassElement classElement; |
| 534 | 534 |
| 535 /// Values and boxes for locals captured by the closure. | 535 /// Initial values for the fields on the class. |
| 536 /// The order corresponds to [ClosureClassElement.closureFields]. | 536 /// The order corresponds to the order of fields on the class. |
| 537 final List<Reference<Primitive>> arguments; | 537 final List<Reference<Primitive>> arguments; |
| 538 | 538 |
| 539 CreateClosureClass(this.classElement, List<Primitive> arguments) | 539 CreateInstance(this.classElement, List<Primitive> arguments) |
| 540 : this.arguments = _referenceList(arguments); | 540 : this.arguments = _referenceList(arguments); |
| 541 | 541 |
| 542 accept(Visitor visitor) => visitor.visitCreateClosureClass(this); | 542 accept(Visitor visitor) => visitor.visitCreateInstance(this); |
| 543 } | 543 } |
| 544 | 544 |
| 545 class Identical extends Primitive implements JsSpecificNode { | 545 class Identical extends Primitive implements JsSpecificNode { |
| 546 final Reference<Primitive> left; | 546 final Reference<Primitive> left; |
| 547 final Reference<Primitive> right; | 547 final Reference<Primitive> right; |
| 548 Identical(Primitive left, Primitive right) | 548 Identical(Primitive left, Primitive right) |
| 549 : left = new Reference<Primitive>(left), | 549 : left = new Reference<Primitive>(left), |
| 550 right = new Reference<Primitive>(right); | 550 right = new Reference<Primitive>(right); |
| 551 accept(Visitor visitor) => visitor.visitIdentical(this); | 551 accept(Visitor visitor) => visitor.visitIdentical(this); |
| 552 } | 552 } |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 T visitConstant(Constant node) => visitPrimitive(node); | 849 T visitConstant(Constant node) => visitPrimitive(node); |
| 850 T visitThis(This node) => visitPrimitive(node); | 850 T visitThis(This node) => visitPrimitive(node); |
| 851 T visitReifyTypeVar(ReifyTypeVar node) => visitPrimitive(node); | 851 T visitReifyTypeVar(ReifyTypeVar node) => visitPrimitive(node); |
| 852 T visitCreateFunction(CreateFunction node) => visitPrimitive(node); | 852 T visitCreateFunction(CreateFunction node) => visitPrimitive(node); |
| 853 T visitGetClosureVariable(GetClosureVariable node) => visitPrimitive(node); | 853 T visitGetClosureVariable(GetClosureVariable node) => visitPrimitive(node); |
| 854 T visitParameter(Parameter node) => visitPrimitive(node); | 854 T visitParameter(Parameter node) => visitPrimitive(node); |
| 855 T visitContinuation(Continuation node) => visitDefinition(node); | 855 T visitContinuation(Continuation node) => visitDefinition(node); |
| 856 T visitClosureVariable(ClosureVariable node) => visitDefinition(node); | 856 T visitClosureVariable(ClosureVariable node) => visitDefinition(node); |
| 857 T visitGetField(GetField node) => visitDefinition(node); | 857 T visitGetField(GetField node) => visitDefinition(node); |
| 858 T visitCreateBox(CreateBox node) => visitDefinition(node); | 858 T visitCreateBox(CreateBox node) => visitDefinition(node); |
| 859 T visitCreateClosureClass(CreateClosureClass node) => visitDefinition(node); | 859 T visitCreateInstance(CreateInstance node) => visitDefinition(node); |
| 860 | 860 |
| 861 // Conditions. | 861 // Conditions. |
| 862 T visitIsTrue(IsTrue node) => visitCondition(node); | 862 T visitIsTrue(IsTrue node) => visitCondition(node); |
| 863 | 863 |
| 864 // JavaScript specific nodes. | 864 // JavaScript specific nodes. |
| 865 T visitIdentical(Identical node) => visitPrimitive(node); | 865 T visitIdentical(Identical node) => visitPrimitive(node); |
| 866 T visitInterceptor(Interceptor node) => visitPrimitive(node); | 866 T visitInterceptor(Interceptor node) => visitPrimitive(node); |
| 867 } | 867 } |
| 868 | 868 |
| 869 /// Recursively visits the entire CPS term, and calls abstract `process*` | 869 /// Recursively visits the entire CPS term, and calls abstract `process*` |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 processReference(node.left); | 1081 processReference(node.left); |
| 1082 processReference(node.right); | 1082 processReference(node.right); |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 processInterceptor(Interceptor node) {} | 1085 processInterceptor(Interceptor node) {} |
| 1086 visitInterceptor(Interceptor node) { | 1086 visitInterceptor(Interceptor node) { |
| 1087 processInterceptor(node); | 1087 processInterceptor(node); |
| 1088 processReference(node.input); | 1088 processReference(node.input); |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 processCreateClosureClass(CreateClosureClass node) {} | 1091 processCreateInstance(CreateInstance node) {} |
| 1092 visitCreateClosureClass(CreateClosureClass node) { | 1092 visitCreateInstance(CreateInstance node) { |
| 1093 processCreateClosureClass(node); | 1093 processCreateInstance(node); |
| 1094 node.arguments.forEach(processReference); | 1094 node.arguments.forEach(processReference); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 processSetField(SetField node) {} | 1097 processSetField(SetField node) {} |
| 1098 visitSetField(SetField node) { | 1098 visitSetField(SetField node) { |
| 1099 processSetField(node); | 1099 processSetField(node); |
| 1100 processReference(node.object); | 1100 processReference(node.object); |
| 1101 processReference(node.value); | 1101 processReference(node.value); |
| 1102 visit(node.body); | 1102 visit(node.body); |
| 1103 } | 1103 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 visitReference(node.object); | 1323 visitReference(node.object); |
| 1324 } | 1324 } |
| 1325 | 1325 |
| 1326 void visitGetField(GetField node) { | 1326 void visitGetField(GetField node) { |
| 1327 visitReference(node.object); | 1327 visitReference(node.object); |
| 1328 } | 1328 } |
| 1329 | 1329 |
| 1330 void visitCreateBox(CreateBox node) { | 1330 void visitCreateBox(CreateBox node) { |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 void visitCreateClosureClass(CreateClosureClass node) { | 1333 void visitCreateInstance(CreateInstance node) { |
| 1334 node.arguments.forEach(visitReference); | 1334 node.arguments.forEach(visitReference); |
| 1335 } | 1335 } |
| 1336 | 1336 |
| 1337 void visitIdentical(Identical node) { | 1337 void visitIdentical(Identical node) { |
| 1338 visitReference(node.left); | 1338 visitReference(node.left); |
| 1339 visitReference(node.right); | 1339 visitReference(node.right); |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 void visitInterceptor(Interceptor node) { | 1342 void visitInterceptor(Interceptor node) { |
| 1343 visitReference(node.input); | 1343 visitReference(node.input); |
| 1344 } | 1344 } |
| 1345 } | 1345 } |
| OLD | NEW |