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

Unified Diff: src/hydrogen-instructions.cc

Issue 19798002: Faster to number conversion (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix typefeedback on constant replacement Created 7 years, 5 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
« src/hydrogen-instructions.h ('K') | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 16f502ddaf7b11f3d9600ecd40b025dc899e38d1..8cc251c39f69a30d5c33730c7fe2ea57caaeefad 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -2310,7 +2310,7 @@ HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const {
}
-HConstant* HConstant::CopyToTruncatedInt32(Zone* zone) const {
+HConstant* HConstant::CopyToTruncatedInt32(Zone* zone) {
if (has_int32_value_) {
return new(zone) HConstant(int32_value_,
Representation::Integer32(),
@@ -2323,6 +2323,20 @@ HConstant* HConstant::CopyToTruncatedInt32(Zone* zone) const {
is_not_in_new_space_,
handle_);
}
+ HConstant* number = CopyToTruncatedNumber(zone);
+ return (number != NULL) ? number->CopyToTruncatedInt32(zone) : NULL;
+}
+
+
+HConstant* HConstant::CopyToTruncatedNumber(Zone* zone) {
Toon Verwaest 2013/07/22 08:31:44 Shouldn't we also return "this" for values that ar
oliv 2013/07/22 13:56:43 there is no point to copying the constant if we ar
+ if (handle()->IsBoolean()) {
+ return handle()->BooleanValue() ?
+ new(zone) HConstant(1) : new(zone) HConstant(0);
+ } else if (handle()->IsUndefined()) {
+ return new(zone) HConstant(OS::nan_value());
+ } else if (handle()->IsNull()) {
+ return new(zone) HConstant(0);
+ }
return NULL;
}
« src/hydrogen-instructions.h ('K') | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698