Index: src/x64/stub-cache-x64.cc |
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc |
index ef52cb4b37e0d280935c4efab7fc0863ab25ff4d..d51134dc82733c4acc0dbf1ee07505419c7eaef7 100644 |
--- a/src/x64/stub-cache-x64.cc |
+++ b/src/x64/stub-cache-x64.cc |
@@ -447,7 +447,7 @@ static void GenerateFastApiCall(MacroAssembler* masm, |
bool restore_context) { |
// ----------- S t a t e ------------- |
// -- rsp[0] : return address |
- // -- rsp[8] - rsp[58] : FunctionCallbackInfo, incl. |
+ // -- rsp[8] - rsp[56] : FunctionCallbackInfo, incl. |
// : object passing the type check |
// (set by CheckPrototypes) |
// -- rsp[64] : last argument |
@@ -459,37 +459,37 @@ static void GenerateFastApiCall(MacroAssembler* masm, |
StackArgumentsAccessor args(rsp, argc + kFastApiCallArguments); |
// Save calling context. |
- __ movq(args.GetArgumentOperand(argc + 1 - FCA::kContextSaveIndex), rsi); |
+ int offset = argc + kFastApiCallArguments; |
+ __ movq(args.GetArgumentOperand(offset - FCA::kContextSaveIndex), rsi); |
// Get the function and setup the context. |
Handle<JSFunction> function = optimization.constant_function(); |
__ LoadHeapObject(rdi, function); |
__ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
// Construct the FunctionCallbackInfo on the stack. |
- __ movq(args.GetArgumentOperand(argc + 1 - FCA::kCalleeIndex), rdi); |
+ __ movq(args.GetArgumentOperand(offset - FCA::kCalleeIndex), rdi); |
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
Handle<Object> call_data(api_call_info->data(), masm->isolate()); |
if (masm->isolate()->heap()->InNewSpace(*call_data)) { |
__ Move(rcx, api_call_info); |
__ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); |
- __ movq(args.GetArgumentOperand(argc + 1 - FCA::kDataIndex), rbx); |
+ __ movq(args.GetArgumentOperand(offset - FCA::kDataIndex), rbx); |
} else { |
- __ Move(args.GetArgumentOperand(argc + 1 - FCA::kDataIndex), call_data); |
+ __ Move(args.GetArgumentOperand(offset - FCA::kDataIndex), call_data); |
} |
__ movq(kScratchRegister, |
ExternalReference::isolate_address(masm->isolate())); |
- __ movq(args.GetArgumentOperand(argc + 1 - FCA::kIsolateIndex), |
+ __ movq(args.GetArgumentOperand(offset - FCA::kIsolateIndex), |
kScratchRegister); |
__ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
- __ movq( |
- args.GetArgumentOperand(argc + 1 - FCA::kReturnValueDefaultValueIndex), |
- kScratchRegister); |
- __ movq(args.GetArgumentOperand(argc + 1 - FCA::kReturnValueOffset), |
+ __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueDefaultValueIndex), |
+ kScratchRegister); |
+ __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueOffset), |
kScratchRegister); |
// Prepare arguments. |
STATIC_ASSERT(kFastApiCallArguments == 7); |
- __ lea(rbx, Operand(rsp, kFastApiCallArguments * kPointerSize)); |
+ __ lea(rbx, Operand(rsp, 1 * kPointerSize)); |
// Function address is a foreign pointer outside V8's heap. |
Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
@@ -500,11 +500,11 @@ static void GenerateFastApiCall(MacroAssembler* masm, |
__ PrepareCallApiFunction(kApiStackSpace); |
- __ movq(StackSpaceOperand(0), rbx); // v8::Arguments::implicit_args_. |
- __ addq(rbx, Immediate(argc * kPointerSize)); |
- __ movq(StackSpaceOperand(1), rbx); // v8::Arguments::values_. |
- __ Set(StackSpaceOperand(2), argc); // v8::Arguments::length_. |
- // v8::Arguments::is_construct_call_. |
+ __ movq(StackSpaceOperand(0), rbx); // FunctionCallbackInfo::implicit_args_. |
+ __ addq(rbx, Immediate((argc + kFastApiCallArguments - 1) * kPointerSize)); |
+ __ movq(StackSpaceOperand(1), rbx); // FunctionCallbackInfo::values_. |
+ __ Set(StackSpaceOperand(2), argc); // FunctionCallbackInfo::length_. |
+ // FunctionCallbackInfo::is_construct_call_. |
__ Set(StackSpaceOperand(3), 0); |
#if defined(__MINGW64__) || defined(_WIN64) |
@@ -520,11 +520,10 @@ static void GenerateFastApiCall(MacroAssembler* masm, |
Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); |
- Operand context_restore_operand( |
- rbp, (kFastApiCallArguments + 1 + FCA::kContextSaveIndex) * kPointerSize); |
- Operand return_value_operand( |
- rbp, |
- (kFastApiCallArguments + 1 + FCA::kReturnValueOffset) * kPointerSize); |
+ Operand context_restore_operand(rbp, |
+ (2 + FCA::kContextSaveIndex) * kPointerSize); |
+ Operand return_value_operand(rbp, |
+ (2 + FCA::kReturnValueOffset) * kPointerSize); |
__ CallApiFunctionAndReturn( |
function_address, |
thunk_address, |
@@ -546,8 +545,7 @@ static void GenerateFastApiCall(MacroAssembler* masm, |
ASSERT(!receiver.is(scratch)); |
const int stack_space = kFastApiCallArguments + argc + 1; |
- const int kHolderIndex = kFastApiCallArguments + |
- FunctionCallbackArguments::kHolderIndex; |
+ const int kHolderIndex = FunctionCallbackArguments::kHolderIndex + 1; |
// Copy return value. |
__ movq(scratch, Operand(rsp, 0)); |
// Assign stack space for the call arguments. |
@@ -1096,8 +1094,7 @@ Register StubCompiler::CheckPrototypes(Handle<JSObject> object, |
int save_at_depth, |
Label* miss, |
PrototypeCheckType check) { |
- const int kHolderIndex = kFastApiCallArguments + |
- FunctionCallbackArguments::kHolderIndex; |
+ const int kHolderIndex = FunctionCallbackArguments::kHolderIndex + 1; |
// Make sure that the type feedback oracle harvests the receiver map. |
// TODO(svenpanne) Remove this hack when all ICs are reworked. |
__ Move(scratch1, Handle<Map>(object->map())); |
@@ -1333,12 +1330,13 @@ void BaseLoadStubCompiler::GenerateLoadCallback( |
ASSERT(!scratch4().is(reg)); |
__ PopReturnAddressTo(scratch4()); |
- STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 0); |
- STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == -1); |
- STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == -2); |
- STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == -3); |
- STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == -4); |
- STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == -5); |
+ STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
+ STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
+ STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
+ STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
+ STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); |
+ STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
+ STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); |
__ push(receiver()); // receiver |
if (heap()->InNewSpace(callback->data())) { |
ASSERT(!scratch2().is(reg)); |
@@ -1356,7 +1354,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback( |
__ push(reg); // holder |
__ push(name()); // name |
// Save a pointer to where we pushed the arguments pointer. This will be |
- // passed as the const ExecutableAccessorInfo& to the C++ callback. |
+ // passed as the const PropertyAccessorInfo& to the C++ callback. |
Address getter_address = v8::ToCData<Address>(callback->getter()); |
@@ -1381,10 +1379,9 @@ void BaseLoadStubCompiler::GenerateLoadCallback( |
const int kArgStackSpace = 1; |
__ PrepareCallApiFunction(kArgStackSpace); |
- STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); |
- __ lea(rax, Operand(name_arg, 6 * kPointerSize)); |
+ __ lea(rax, Operand(name_arg, 1 * kPointerSize)); |
- // v8::AccessorInfo::args_. |
+ // v8::PropertyAccessorInfo::args_. |
__ movq(StackSpaceOperand(0), rax); |
// The context register (rsi) has been saved in PrepareCallApiFunction and |