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..0e75c1c22302ff9dd3dd2bbed3d357f8ae3d26e5 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -5122,7 +5122,6 @@ 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 |
@@ -5131,8 +5130,16 @@ void LCodeGen::DoDeferredAllocate(LAllocate* instr) { |
__ Set(result, 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); |