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

Unified Diff: src/hydrogen-instructions.cc

Issue 23654041: Ensure constant truncation is only done when it is safe. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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/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 3c4482547a2af701f56c740e047a4d8e287d7105..e93e21d99fde5c183208c9a0b7144a0aecdf2de3 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -2575,25 +2575,23 @@ Maybe<HConstant*> HConstant::CopyToTruncatedInt32(Zone* zone) {
Representation::Integer32(),
is_not_in_new_space_,
handle_);
- } else {
- ASSERT(!HasNumberValue());
- Maybe<HConstant*> number = CopyToTruncatedNumber(zone);
- if (number.has_value) return number.value->CopyToTruncatedInt32(zone);
}
return Maybe<HConstant*>(res != NULL, res);
}
-Maybe<HConstant*> HConstant::CopyToTruncatedNumber(Zone* zone) {
+Maybe<HConstant*> HConstant::CopyToTruncatedNumberAndAdd(
+ Zone* zone, HGraphBuilder* builder) {
Michael Starzinger 2013/09/17 12:10:13 I don't like passing around the HGraphBuilder into
HConstant* res = NULL;
Handle<Object> handle = this->handle(zone->isolate());
if (handle->IsBoolean()) {
- res = handle->BooleanValue() ?
- new(zone) HConstant(1) : new(zone) HConstant(0);
+ res = handle->BooleanValue()
+ ? builder->graph()->GetConstant1()
+ : builder->graph()->GetConstant0();
} else if (handle->IsUndefined()) {
- res = new(zone) HConstant(OS::nan_value());
+ res = builder->Add<HConstant>(OS::nan_value());
} else if (handle->IsNull()) {
- res = new(zone) HConstant(0);
+ res = builder->graph()->GetConstant0();
}
return Maybe<HConstant*>(res != NULL, res);
}
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698