Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index c539ff564626c4f7b4499487c96a8e6d37593521..99387b8a5fef9dd49eb6377d7555d4f8ef099f5c 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -3628,16 +3628,16 @@ void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) { |
__ j(zero, &add_arguments_object); |
__ lea(ecx, Operand(ecx, times_2, FixedArray::kHeaderSize)); |
__ bind(&add_arguments_object); |
- __ add(Operand(ecx), Immediate(Heap::kArgumentsObjectSize)); |
+ __ add(Operand(ecx), Immediate(GetArgumentsObjectSize())); |
// Do the allocation of both objects in one go. |
__ AllocateInNewSpace(ecx, eax, edx, ebx, &runtime, TAG_OBJECT); |
// Get the arguments boilerplate from the current (global) context. |
- int offset = Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX); |
__ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
__ mov(edi, FieldOperand(edi, GlobalObject::kGlobalContextOffset)); |
- __ mov(edi, Operand(edi, offset)); |
+ __ mov(edi, Operand(edi, |
+ Context::SlotOffset(GetArgumentsBoilerplateIndex()))); |
// Copy the JS object part. |
for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { |
@@ -3645,15 +3645,21 @@ void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) { |
__ mov(FieldOperand(eax, i), ebx); |
} |
- // Setup the callee in-object property. |
- STATIC_ASSERT(Heap::arguments_callee_index == 0); |
- __ mov(ebx, Operand(esp, 3 * kPointerSize)); |
- __ mov(FieldOperand(eax, JSObject::kHeaderSize), ebx); |
+ if (type_ == NEW_NON_STRICT) { |
+ // Setup the callee in-object property. |
+ STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); |
+ __ mov(ebx, Operand(esp, 3 * kPointerSize)); |
+ __ mov(FieldOperand(eax, JSObject::kHeaderSize + |
+ Heap::kArgumentsCalleeIndex * kPointerSize), |
+ ebx); |
+ } |
// Get the length (smi tagged) and set that as an in-object property too. |
- STATIC_ASSERT(Heap::arguments_length_index == 1); |
+ STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
__ mov(ecx, Operand(esp, 1 * kPointerSize)); |
- __ mov(FieldOperand(eax, JSObject::kHeaderSize + kPointerSize), ecx); |
+ __ mov(FieldOperand(eax, JSObject::kHeaderSize + |
+ Heap::kArgumentsLengthIndex * kPointerSize), |
+ ecx); |
// If there are no actual arguments, we're done. |
Label done; |
@@ -3665,10 +3671,11 @@ void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) { |
// Setup the elements pointer in the allocated arguments object and |
// initialize the header in the elements fixed array. |
- __ lea(edi, Operand(eax, Heap::kArgumentsObjectSize)); |
+ __ lea(edi, Operand(eax, GetArgumentsObjectSize())); |
__ mov(FieldOperand(eax, JSObject::kElementsOffset), edi); |
__ mov(FieldOperand(edi, FixedArray::kMapOffset), |
Immediate(Factory::fixed_array_map())); |
+ |
__ mov(FieldOperand(edi, FixedArray::kLengthOffset), ecx); |
// Untag the length for the loop below. |
__ SmiUntag(ecx); |