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

Unified Diff: src/parser.cc

Issue 7044100: Constant-fold !<number> (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
===================================================================
--- src/parser.cc (revision 8225)
+++ src/parser.cc (working copy)
@@ -2555,6 +2555,12 @@
return NewNumberLiteral(-value);
case Token::BIT_NOT:
return NewNumberLiteral(~DoubleToInt32(value));
+ case Token::NOT:
+ if (value == 0) {
Kasper Lund 2011/06/10 09:20:08 Could this be something ala: Handle<Object> bo
Kevin Millikin (Chromium) 2011/06/10 10:05:14 We already have this constant folding in void Full
+ return new(zone()) Literal(isolate()->factory()->true_value());
+ } else {
+ return new(zone()) Literal(isolate()->factory()->false_value());
+ }
default: break;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698