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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 735253003: Add CPS IR transformation to make the JavaScript backend specific semantics explicit in the tree. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698