Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index 273a3104f8a558b6746993a1f8c42fe6283c22a2..f0fd09a72f4eee795890ac718941920ed57b9aaa 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -112,9 +112,10 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) { |
void FastNewContextStub::Generate(MacroAssembler* masm) { |
// Try to allocate the context in new space. |
Label gc; |
+ int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
// Attempt to allocate the context in new space. |
- __ AllocateInNewSpace(FixedArray::SizeFor(slots_), |
+ __ AllocateInNewSpace(FixedArray::SizeFor(length), |
r0, |
r1, |
r2, |
@@ -127,7 +128,7 @@ void FastNewContextStub::Generate(MacroAssembler* masm) { |
// Setup the object header. |
__ LoadRoot(r2, Heap::kContextMapRootIndex); |
__ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); |
- __ mov(r2, Operand(Smi::FromInt(slots_))); |
+ __ mov(r2, Operand(Smi::FromInt(length))); |
__ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
// Setup the fixed slots. |
@@ -143,7 +144,7 @@ void FastNewContextStub::Generate(MacroAssembler* masm) { |
// Initialize the rest of the slots to undefined. |
__ LoadRoot(r1, Heap::kUndefinedValueRootIndex); |
- for (int i = Context::MIN_CONTEXT_SLOTS; i < slots_; i++) { |
+ for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { |
__ str(r1, MemOperand(r0, Context::SlotOffset(i))); |
} |