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

Unified Diff: lib/compiler/implementation/ssa/codegen_helpers.dart

Issue 10697031: Generate JS operators using helper functions with thunks for operands. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 6 months 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
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/codegen_helpers.dart
diff --git a/lib/compiler/implementation/ssa/codegen_helpers.dart b/lib/compiler/implementation/ssa/codegen_helpers.dart
index 4344721da0b14d7f8ad8f767a296dbf9ed10fc3e..e965cfa2a31eac42faf7df333ee8db24e93fffa5 100644
--- a/lib/compiler/implementation/ssa/codegen_helpers.dart
+++ b/lib/compiler/implementation/ssa/codegen_helpers.dart
@@ -341,6 +341,10 @@ class JSPrecedence {
SHIFT_PRECEDENCE),
">=" : const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE,
SHIFT_PRECEDENCE),
+ "in": const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE,
+ SHIFT_PRECEDENCE),
+ "instanceof": const JSBinaryOperatorPrecedence(RELATIONAL_PRECEDENCE,
+ SHIFT_PRECEDENCE),
"<<" : const JSBinaryOperatorPrecedence(SHIFT_PRECEDENCE,
ADDITIVE_PRECEDENCE),
">>" : const JSBinaryOperatorPrecedence(SHIFT_PRECEDENCE,
@@ -357,6 +361,21 @@ class JSPrecedence {
PREFIX_PRECEDENCE),
"%" : const JSBinaryOperatorPrecedence(MULTIPLICATIVE_PRECEDENCE,
PREFIX_PRECEDENCE),
+ // TODO(lrn): Consider changing rhs to EXPRESSION_PRECEDENCE.
+ ",": const JSBinaryOperatorPrecedence(EXPRESSION_PRECEDENCE,
+ ASSIGNMENT_PRECEDENCE),
+ "=" : const JSAssignmentOperatorPrecedence(),
+ "+=" : const JSAssignmentOperatorPrecedence(),
+ "-=" : const JSAssignmentOperatorPrecedence(),
+ "*=" : const JSAssignmentOperatorPrecedence(),
+ "/=" : const JSAssignmentOperatorPrecedence(),
+ "%=" : const JSAssignmentOperatorPrecedence(),
+ "&=" : const JSAssignmentOperatorPrecedence(),
+ "|=" : const JSAssignmentOperatorPrecedence(),
+ "^=" : const JSAssignmentOperatorPrecedence(),
+ "<<=" : const JSAssignmentOperatorPrecedence(),
+ ">>=" : const JSAssignmentOperatorPrecedence(),
+ ">>>=" : const JSAssignmentOperatorPrecedence(),
};
}
@@ -364,6 +383,16 @@ class JSBinaryOperatorPrecedence {
final int left;
final int right;
const JSBinaryOperatorPrecedence(this.left, this.right);
- // All binary operators (excluding assignment) are left associative.
+ // All non-assignment binary operators are left associative.
int get precedence() => left;
}
+
+class JSAssignmentOperatorPrecedence implements JSBinaryOperatorPrecedence {
+ const JSAssignmentOperatorPrecedence();
+ // The actual left-hand-side of an assignment in JavaScript is the production
+ // 'LeftHandSideExpression ::= callExpression | newExpression'. We don't
+ // represent 'newExpression' at all.
+ int get left() => JSPrecedence.CALL_PRECEDENCE;
+ int get right() => JSPrecedence.ASSIGNMENT_PRECEDENCE;
+ int get precedence() => JSPrecedence.ASSIGNMENT_PRECEDENCE;
+}
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698