Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index fbb7c289797d43ab3fee6320a201ff93cf72b160..1ff2bd6ebc4e6985ee4bae946769a0c8e691cfbd 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -5122,17 +5122,24 @@ void LCodeGen::DoAllocate(LAllocate* instr) { |
void LCodeGen::DoDeferredAllocate(LAllocate* instr) { |
- Register size = ToRegister(instr->size()); |
Register result = ToRegister(instr->result()); |
// TODO(3095996): Get rid of this. For now, we need to make the |
// result register contain a valid pointer because it is already |
// contained in the register pointer map. |
- __ Set(result, 0); |
+ __ Move(result, Smi::FromInt(0)); |
PushSafepointRegistersScope scope(this); |
- __ Integer32ToSmi(size, size); |
- __ push(size); |
+ if (instr->size()->IsRegister()) { |
+ Register size = ToRegister(instr->size()); |
+ ASSERT(!size.is(result)); |
+ __ Integer32ToSmi(size, size); |
+ __ push(size); |
+ } else { |
+ int32_t size = ToInteger32(LConstantOperand::cast(instr->size())); |
+ __ Push(Smi::FromInt(size)); |
+ } |
+ |
if (instr->hydrogen()->CanAllocateInOldPointerSpace()) { |
CallRuntimeFromDeferred( |
Runtime::kAllocateInOldPointerSpace, 1, instr); |