| Index: src/x64/code-stubs-x64.cc
|
| ===================================================================
|
| --- src/x64/code-stubs-x64.cc (revision 7254)
|
| +++ src/x64/code-stubs-x64.cc (working copy)
|
| @@ -68,11 +68,15 @@
|
| // Get the function info from the stack.
|
| __ movq(rdx, Operand(rsp, 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.
|
| __ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
|
| __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset));
|
| - __ movq(rcx, Operand(rcx, Context::SlotOffset(Context::FUNCTION_MAP_INDEX)));
|
| + __ movq(rcx, Operand(rcx, Context::SlotOffset(map_index)));
|
| __ movq(FieldOperand(rax, JSObject::kMapOffset), rcx);
|
|
|
| // Initialize the rest of the function. We don't have to update the
|
| @@ -2337,16 +2341,16 @@
|
| __ j(zero, &add_arguments_object);
|
| __ leal(rcx, Operand(rcx, times_pointer_size, FixedArray::kHeaderSize));
|
| __ bind(&add_arguments_object);
|
| - __ addl(rcx, Immediate(Heap::kArgumentsObjectSize));
|
| + __ addl(rcx, Immediate(GetArgumentsObjectSize()));
|
|
|
| // Do the allocation of both objects in one go.
|
| __ AllocateInNewSpace(rcx, rax, rdx, rbx, &runtime, TAG_OBJECT);
|
|
|
| // Get the arguments boilerplate from the current (global) context.
|
| - int offset = Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX);
|
| __ movq(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
|
| __ movq(rdi, FieldOperand(rdi, GlobalObject::kGlobalContextOffset));
|
| - __ movq(rdi, Operand(rdi, offset));
|
| + __ movq(rdi, Operand(rdi,
|
| + Context::SlotOffset(GetArgumentsBoilerplateIndex())));
|
|
|
| // Copy the JS object part.
|
| STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
|
| @@ -2357,15 +2361,21 @@
|
| __ movq(FieldOperand(rax, 1 * kPointerSize), rdx);
|
| __ movq(FieldOperand(rax, 2 * kPointerSize), rbx);
|
|
|
| - // Setup the callee in-object property.
|
| - ASSERT(Heap::arguments_callee_index == 0);
|
| - __ movq(kScratchRegister, Operand(rsp, 3 * kPointerSize));
|
| - __ movq(FieldOperand(rax, JSObject::kHeaderSize), kScratchRegister);
|
| + if (type_ == NEW_NON_STRICT) {
|
| + // Setup the callee in-object property.
|
| + ASSERT(Heap::kArgumentsCalleeIndex == 1);
|
| + __ movq(kScratchRegister, Operand(rsp, 3 * kPointerSize));
|
| + __ movq(FieldOperand(rax, JSObject::kHeaderSize +
|
| + Heap::kArgumentsCalleeIndex * kPointerSize),
|
| + kScratchRegister);
|
| + }
|
|
|
| // Get the length (smi tagged) and set that as an in-object property too.
|
| - ASSERT(Heap::arguments_length_index == 1);
|
| + ASSERT(Heap::kArgumentsLengthIndex == 0);
|
| __ movq(rcx, Operand(rsp, 1 * kPointerSize));
|
| - __ movq(FieldOperand(rax, JSObject::kHeaderSize + kPointerSize), rcx);
|
| + __ movq(FieldOperand(rax, JSObject::kHeaderSize +
|
| + Heap::kArgumentsLengthIndex * kPointerSize),
|
| + rcx);
|
|
|
| // If there are no actual arguments, we're done.
|
| Label done;
|
| @@ -2377,7 +2387,7 @@
|
|
|
| // Setup the elements pointer in the allocated arguments object and
|
| // initialize the header in the elements fixed array.
|
| - __ lea(rdi, Operand(rax, Heap::kArgumentsObjectSize));
|
| + __ lea(rdi, Operand(rax, GetArgumentsObjectSize()));
|
| __ movq(FieldOperand(rax, JSObject::kElementsOffset), rdi);
|
| __ LoadRoot(kScratchRegister, Heap::kFixedArrayMapRootIndex);
|
| __ movq(FieldOperand(rdi, FixedArray::kMapOffset), kScratchRegister);
|
|
|