Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 0637bd2fb928ac1d0f4bea03afab158eedf85d4e..8c5a430014de2658879369f53378c2dd251dac05 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -5177,7 +5177,7 @@ void CallApiFunctionStub::Generate(MacroAssembler* masm) { |
Register context = rsi; |
int argc = ArgumentBits::decode(bit_field_); |
- bool restore_context = RestoreContextBits::decode(bit_field_); |
+ bool is_store = IsStoreBits::decode(bit_field_); |
bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); |
typedef FunctionCallbackArguments FCA; |
@@ -5253,19 +5253,21 @@ void CallApiFunctionStub::Generate(MacroAssembler* masm) { |
Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); |
- StackArgumentsAccessor args_from_rbp(rbp, FCA::kArgsLength, |
+ // Accessor for FunctionCallbackInfo and first js arg. |
+ StackArgumentsAccessor args_from_rbp(rbp, FCA::kArgsLength + 1, |
ARGUMENTS_DONT_CONTAIN_RECEIVER); |
Operand context_restore_operand = args_from_rbp.GetArgumentOperand( |
- FCA::kArgsLength - 1 - FCA::kContextSaveIndex); |
+ FCA::kArgsLength - FCA::kContextSaveIndex); |
+ // Stores return the first js argument |
Operand return_value_operand = args_from_rbp.GetArgumentOperand( |
- FCA::kArgsLength - 1 - FCA::kReturnValueOffset); |
+ is_store ? 0 : FCA::kArgsLength - FCA::kReturnValueOffset); |
__ CallApiFunctionAndReturn( |
api_function_address, |
thunk_address, |
callback_arg, |
argc + FCA::kArgsLength + 1, |
return_value_operand, |
- restore_context ? &context_restore_operand : NULL); |
+ &context_restore_operand); |
} |