Chromium Code Reviews| Index: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
| index 8f6ff29b7484d1ea50dd3121a135e763211056f8..eed3eb5fb9fced9f99481baa4220f59eb4e4e328 100644 |
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart |
| @@ -112,9 +112,9 @@ class Reference<T extends Definition<T>> { |
| /// represent one-level context 'let val x = V in []'. |
| class LetPrim extends Expression implements InteriorNode { |
| final Primitive primitive; |
| - Expression body = null; |
| + Expression body; |
| - LetPrim(this.primitive); |
| + LetPrim(this.primitive, [this.body = null]); |
| Expression plug(Expression expr) { |
| assert(body == null); |
| @@ -451,6 +451,15 @@ class Branch extends Expression { |
| accept(Visitor visitor) => visitor.visitBranch(this); |
| } |
| +class Identical extends Primitive { |
| + final Reference<Primitive> left; |
| + final Reference<Primitive> right; |
| + Identical(Primitive a, Primitive b) |
|
Kevin Millikin (Google)
2014/11/25 14:27:23
I do prefer a ==> left and b ==> right in paramete
karlklose
2014/11/25 14:38:46
Done.
|
| + : left = new Reference<Primitive>(a), |
| + right = new Reference<Primitive>(b); |
| + accept(Visitor visitor) => visitor.visitIdentical(this); |
| +} |
| + |
| class Constant extends Primitive { |
| final ConstantExpression expression; |
| @@ -620,6 +629,9 @@ abstract class Visitor<T> { |
| // Conditions. |
| T visitIsTrue(IsTrue node) => visitCondition(node); |
| + |
| + // JavaScript specific nodes. |
| + T visitIdentical(Identical node) => visitPrimitive(node); |
| } |
| /// Recursively visits the entire CPS term, and calls abstract `process*` |
| @@ -786,6 +798,14 @@ abstract class RecursiveVisitor extends Visitor { |
| processIsTrue(node); |
| processReference(node.value); |
| } |
| + |
| + // JavaScript specific nodes. |
| + processIdentical(Identical node) {} |
| + visitIdentical(Identical node) { |
| + processIdentical(node); |
| + processReference(node.left); |
| + processReference(node.right); |
| + } |
| } |
| /// Keeps track of currently unused register indices. |
| @@ -954,5 +974,11 @@ class RegisterAllocator extends Visitor { |
| visitReference(node.value); |
| } |
| + // JavaScript specific nodes. |
| + |
| + void visitIdentical(Identical node) { |
| + visitReference(node.left); |
| + visitReference(node.right); |
| + } |
| } |