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