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

Unified Diff: src/ast.cc

Issue 7887037: Nuke CompareToNull AST node. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 3 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/full-codegen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.cc
===================================================================
--- src/ast.cc (revision 9281)
+++ src/ast.cc (working copy)
@@ -380,6 +380,27 @@
}
+bool CompareOperation::IsLiteralCompareNull(Expression** expr) {
+ if (op_ != Token::EQ && op_ != Token::EQ_STRICT) return false;
+
+ // Check for the pattern: <expression> equals null.
+ Literal* right_literal = right_->AsLiteral();
+ if (right_literal != NULL && right_literal->handle()->IsNull()) {
+ *expr = left_;
+ return true;
+ }
+
+ // Check for the pattern: null equals <expression>.
+ Literal* left_literal = left_->AsLiteral();
+ if (left_literal != NULL && left_literal->handle()->IsNull()) {
+ *expr = right_;
+ return true;
+ }
+
+ return false;
+}
+
+
// ----------------------------------------------------------------------------
// Inlining support
@@ -598,11 +619,6 @@
}
-bool CompareToNull::IsInlineable() const {
- return expression()->IsInlineable();
-}
-
-
bool CountOperation::IsInlineable() const {
return expression()->IsInlineable();
}
« no previous file with comments | « src/ast.h ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698