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

Unified Diff: src/ast.cc

Issue 14367018: Add monomorphic CompareNilICs and Crankshaft support (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 8 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 | « src/ast.h ('k') | src/code-stubs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index d6af89b38c0fd2342a267752bab58ecc9877c0da..d241355fc1b8bf4aa654f790db2cc8bcd2f9efb5 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -70,6 +70,11 @@ bool Expression::IsNullLiteral() {
}
+bool Expression::IsUndefinedLiteral() {
+ return AsLiteral() != NULL && AsLiteral()->handle()->IsUndefined();
+}
+
+
VariableProxy::VariableProxy(Isolate* isolate, Variable* var)
: Expression(isolate),
name_(var->name()),
@@ -352,7 +357,8 @@ static bool IsVoidOfLiteral(Expression* expr) {
}
-// Check for the pattern: void <literal> equals <expression>
+// Check for the pattern: void <literal> equals <expression> or
+// undefined equals <expression>
static bool MatchLiteralCompareUndefined(Expression* left,
Token::Value op,
Expression* right,
@@ -361,6 +367,10 @@ static bool MatchLiteralCompareUndefined(Expression* left,
*expr = right;
return true;
}
+ if (left->IsUndefinedLiteral() && Token::IsEqualityOp(op)) {
+ *expr = right;
+ return true;
+ }
return false;
}
« no previous file with comments | « src/ast.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698