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

Unified Diff: src/ast.cc

Issue 13728002: Add an IC for CompareNil operations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix SunSpider regression 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 e8b065c4ea10b3615c43b0e0acf9badfa716822a..091f3f93599d0c2a917ece5ff0ae36e79a167190 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 (op == Token::EQ_STRICT && left->IsUndefinedLiteral()) {
+ *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