Chromium Code Reviews| 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); |
| } |