| Index: src/ia32/code-stubs-ia32.cc
|
| ===================================================================
|
| --- src/ia32/code-stubs-ia32.cc (revision 7254)
|
| +++ src/ia32/code-stubs-ia32.cc (working copy)
|
| @@ -70,11 +70,15 @@
|
| // Get the function info from the stack.
|
| __ mov(edx, Operand(esp, 1 * kPointerSize));
|
|
|
| + int map_index = strict_mode_ == kStrictMode
|
| + ? Context::STRICT_MODE_FUNCTION_MAP_INDEX
|
| + : Context::FUNCTION_MAP_INDEX;
|
| +
|
| // Compute the function map in the current global context and set that
|
| // as the map of the allocated object.
|
| __ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
|
| __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalContextOffset));
|
| - __ mov(ecx, Operand(ecx, Context::SlotOffset(Context::FUNCTION_MAP_INDEX)));
|
| + __ mov(ecx, Operand(ecx, Context::SlotOffset(map_index)));
|
| __ mov(FieldOperand(eax, JSObject::kMapOffset), ecx);
|
|
|
| // Initialize the rest of the function. We don't have to update the
|
| @@ -3634,16 +3638,16 @@
|
| __ 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) {
|
| @@ -3651,15 +3655,21 @@
|
| __ 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;
|
| @@ -3671,10 +3681,11 @@
|
|
|
| // 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);
|
|
|