Commit 40a498a7 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

Remove distinction between lazy and non-lazy CallApiCallback, always...

Remove distinction between lazy and non-lazy CallApiCallback, always explicitly set up target context

Bug: 
Change-Id: I0cb751a0415433fdfec21451e2fac3e0726bf26e
Reviewed-on: https://chromium-review.googlesource.com/743019
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49024}
parent 8567093b
......@@ -1467,7 +1467,6 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r0 : callee
// -- r4 : call_data
// -- r2 : holder
// -- r1 : api_function_address
......@@ -1479,11 +1478,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// -- sp[argc * 4] : receiver
// -----------------------------------
Register callee = r0;
Register call_data = r4;
Register holder = r2;
Register api_function_address = r1;
Register context = cp;
typedef FunctionCallbackArguments FCA;
......@@ -1515,12 +1512,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// holder
__ push(holder);
// enter a new context
if (!is_lazy()) {
// load context from callee
__ ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
}
// Prepare arguments.
__ mov(scratch0, sp);
......
......@@ -284,10 +284,10 @@ void ApiCallbackDescriptor::InitializePlatformSpecific(
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
Register registers[] = {
r0, // callee
r4, // call_data
r2, // holder
r1, // api_function_address
JavaScriptFrame::context_register(), // callee context
r4, // call_data
r2, // holder
r1, // api_function_address
};
data->InitializePlatformSpecific(arraysize(registers), registers,
&default_descriptor);
......
......@@ -1690,7 +1690,6 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- x0 : callee
// -- x4 : call_data
// -- x2 : holder
// -- x1 : api_function_address
......@@ -1702,11 +1701,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// -- sp[argc * 8] : receiver
// -----------------------------------
Register callee = x0;
Register call_data = x4;
Register holder = x2;
Register api_function_address = x1;
Register context = cp;
typedef FunctionCallbackArguments FCA;
......@@ -1731,12 +1728,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// return value, return value default, isolate, holder.
__ Push(undef, undef, isolate_reg, holder);
// Enter a new context.
if (!is_lazy()) {
// Load context from callee.
__ Ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
}
// Prepare arguments.
Register args = x6;
__ Mov(args, masm->StackPointer());
......
......@@ -295,10 +295,10 @@ void ApiCallbackDescriptor::InitializePlatformSpecific(
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
Register registers[] = {
x0, // callee
x4, // call_data
x2, // holder
x1, // api_function_address
JavaScriptFrame::context_register(), // callee context
x4, // call_data
x2, // holder
x1, // api_function_address
};
data->InitializePlatformSpecific(arraysize(registers), registers,
&default_descriptor);
......
......@@ -632,29 +632,25 @@ class CallApiCallbackStub : public PlatformCodeStub {
static const int kArgMax = (1 << kArgBits) - 1;
// CallApiCallbackStub for regular setters and getters.
CallApiCallbackStub(Isolate* isolate, bool is_store, bool is_lazy)
: CallApiCallbackStub(isolate, is_store ? 1 : 0, is_store, is_lazy) {}
CallApiCallbackStub(Isolate* isolate, bool is_store)
: CallApiCallbackStub(isolate, is_store ? 1 : 0, is_store) {}
// CallApiCallbackStub for callback functions.
CallApiCallbackStub(Isolate* isolate, int argc, bool is_lazy)
: CallApiCallbackStub(isolate, argc, false, is_lazy) {}
CallApiCallbackStub(Isolate* isolate, int argc)
: CallApiCallbackStub(isolate, argc, false) {}
private:
CallApiCallbackStub(Isolate* isolate, int argc, bool is_store, bool is_lazy)
CallApiCallbackStub(Isolate* isolate, int argc, bool is_store)
: PlatformCodeStub(isolate) {
CHECK(0 <= argc && argc <= kArgMax);
minor_key_ = IsStoreBits::encode(is_store) |
ArgumentBits::encode(argc) |
IsLazyAccessorBits::encode(is_lazy);
minor_key_ = IsStoreBits::encode(is_store) | ArgumentBits::encode(argc);
}
bool is_store() const { return IsStoreBits::decode(minor_key_); }
bool is_lazy() const { return IsLazyAccessorBits::decode(minor_key_); }
int argc() const { return ArgumentBits::decode(minor_key_); }
class IsStoreBits: public BitField<bool, 0, 1> {};
class IsLazyAccessorBits : public BitField<bool, 1, 1> {};
class ArgumentBits : public BitField<int, 2, kArgBits> {};
class ArgumentBits : public BitField<int, 1, kArgBits> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiCallback);
DEFINE_PLATFORM_CODE_STUB(CallApiCallback, PlatformCodeStub);
......
......@@ -1562,8 +1562,8 @@ Node* JSCallReducer::SafeLoadElement(ElementsKind kind, Node* receiver,
return element;
}
Reduction JSCallReducer::ReduceCallApiFunction(
Node* node, Handle<FunctionTemplateInfo> function_template_info) {
Reduction JSCallReducer::ReduceCallApiFunction(Node* node,
Handle<JSFunction> function) {
DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
CallParameters const& p = CallParametersOf(node->op());
int const argc = static_cast<int>(p.arity()) - 2;
......@@ -1572,6 +1572,10 @@ Reduction JSCallReducer::ReduceCallApiFunction(
: NodeProperties::GetValueInput(node, 1);
Node* effect = NodeProperties::GetEffectInput(node);
Handle<FunctionTemplateInfo> function_template_info(
FunctionTemplateInfo::cast(function->shared()->function_data()));
Handle<Context> context(function->context());
// CallApiCallbackStub expects the target in a register, so we count it out,
// and counts the receiver as an implicit argument, so we count the receiver
// out too.
......@@ -1627,13 +1631,13 @@ Reduction JSCallReducer::ReduceCallApiFunction(
Handle<CallHandlerInfo> call_handler_info(
CallHandlerInfo::cast(function_template_info->call_code()), isolate());
Handle<Object> data(call_handler_info->data(), isolate());
CallApiCallbackStub stub(isolate(), argc, false);
CallApiCallbackStub stub(isolate(), argc);
CallInterfaceDescriptor cid = stub.GetCallInterfaceDescriptor();
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), graph()->zone(), cid,
cid.GetStackParameterCount() + argc + 1 /* implicit receiver */,
CallDescriptor::kNeedsFrameState, Operator::kNoProperties,
MachineType::AnyTagged(), 1);
MachineType::AnyTagged(), 1, Linkage::kNoContext);
ApiFunction api_function(v8::ToCData<Address>(call_handler_info->callback()));
Node* holder = lookup == CallOptimization::kHolderFound
? jsgraph()->HeapConstant(api_holder)
......@@ -1642,11 +1646,14 @@ Reduction JSCallReducer::ReduceCallApiFunction(
&api_function, ExternalReference::DIRECT_API_CALL, isolate());
node->InsertInput(graph()->zone(), 0,
jsgraph()->HeapConstant(stub.GetCode()));
node->ReplaceInput(1, jsgraph()->Constant(context));
node->InsertInput(graph()->zone(), 2, jsgraph()->Constant(data));
node->InsertInput(graph()->zone(), 3, holder);
node->InsertInput(graph()->zone(), 4,
jsgraph()->ExternalConstant(function_reference));
node->ReplaceInput(5, receiver);
// Remove context input.
node->RemoveInput(6 + argc);
NodeProperties::ChangeOp(node, common()->Call(call_descriptor));
return Changed(node);
}
......@@ -1989,9 +1996,7 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) {
}
if (!FLAG_runtime_stats && shared->IsApiFunction()) {
Handle<FunctionTemplateInfo> function_template_info(
FunctionTemplateInfo::cast(shared->function_data()), isolate());
return ReduceCallApiFunction(node, function_template_info);
return ReduceCallApiFunction(node, function);
}
} else if (m.Value()->IsJSBoundFunction()) {
Handle<JSBoundFunction> function =
......
......@@ -54,8 +54,7 @@ class JSCallReducer final : public AdvancedReducer {
private:
Reduction ReduceArrayConstructor(Node* node);
Reduction ReduceBooleanConstructor(Node* node);
Reduction ReduceCallApiFunction(
Node* node, Handle<FunctionTemplateInfo> function_template_info);
Reduction ReduceCallApiFunction(Node* node, Handle<JSFunction> function);
Reduction ReduceNumberConstructor(Node* node);
Reduction ReduceFunctionPrototypeApply(Node* node);
Reduction ReduceFunctionPrototypeBind(Node* node);
......
......@@ -1612,9 +1612,8 @@ Node* JSNativeContextSpecialization::InlinePropertyGetterCall(
access_info.holder().is_null()
? receiver
: jsgraph()->Constant(access_info.holder().ToHandleChecked());
value =
InlineApiCall(receiver, holder, context, target, frame_state0, nullptr,
effect, control, shared_info, function_template_info);
value = InlineApiCall(receiver, holder, frame_state0, nullptr, effect,
control, shared_info, function_template_info);
}
// Remember to rewire the IfException edge if this is inside a try-block.
if (if_exceptions != nullptr) {
......@@ -1664,9 +1663,8 @@ Node* JSNativeContextSpecialization::InlinePropertySetterCall(
access_info.holder().is_null()
? receiver
: jsgraph()->Constant(access_info.holder().ToHandleChecked());
value =
InlineApiCall(receiver, holder, context, target, frame_state0, value,
effect, control, shared_info, function_template_info);
value = InlineApiCall(receiver, holder, frame_state0, value, effect,
control, shared_info, function_template_info);
}
// Remember to rewire the IfException edge if this is inside a try-block.
if (if_exceptions != nullptr) {
......@@ -1681,9 +1679,8 @@ Node* JSNativeContextSpecialization::InlinePropertySetterCall(
}
Node* JSNativeContextSpecialization::InlineApiCall(
Node* receiver, Node* holder, Node* context, Node* target,
Node* frame_state, Node* value, Node** effect, Node** control,
Handle<SharedFunctionInfo> shared_info,
Node* receiver, Node* holder, Node* frame_state, Node* value, Node** effect,
Node** control, Handle<SharedFunctionInfo> shared_info,
Handle<FunctionTemplateInfo> function_template_info) {
Handle<CallHandlerInfo> call_handler_info = handle(
CallHandlerInfo::cast(function_template_info->call_code()), isolate());
......@@ -1692,9 +1689,7 @@ Node* JSNativeContextSpecialization::InlineApiCall(
// Only setters have a value.
int const argc = value == nullptr ? 0 : 1;
// The stub always expects the receiver as the first param on the stack.
CallApiCallbackStub stub(
isolate(), argc,
true /* FunctionTemplateInfo doesn't have an associated context. */);
CallApiCallbackStub stub(isolate(), argc);
CallInterfaceDescriptor call_interface_descriptor =
stub.GetCallInterfaceDescriptor();
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
......@@ -1702,7 +1697,7 @@ Node* JSNativeContextSpecialization::InlineApiCall(
call_interface_descriptor.GetStackParameterCount() + argc +
1 /* implicit receiver */,
CallDescriptor::kNeedsFrameState, Operator::kNoProperties,
MachineType::AnyTagged(), 1);
MachineType::AnyTagged(), 1, Linkage::kNoContext);
Node* data = jsgraph()->Constant(call_data_object);
ApiFunction function(v8::ToCData<Address>(call_handler_info->callback()));
......@@ -1712,9 +1707,10 @@ Node* JSNativeContextSpecialization::InlineApiCall(
Node* code = jsgraph()->HeapConstant(stub.GetCode());
// Add CallApiCallbackStub's register argument as well.
Node* inputs[11] = {code, target, data, holder, function_reference, receiver};
Node* context = jsgraph()->Constant(native_context());
Node* inputs[10] = {code, context, data, holder, function_reference,
receiver};
int index = 6 + argc;
inputs[index++] = context;
inputs[index++] = frame_state;
inputs[index++] = *effect;
inputs[index++] = *control;
......
......@@ -145,9 +145,9 @@ class JSNativeContextSpecialization final : public AdvancedReducer {
Node** control,
ZoneVector<Node*>* if_exceptions,
PropertyAccessInfo const& access_info);
Node* InlineApiCall(Node* receiver, Node* holder, Node* context, Node* target,
Node* frame_state, Node* value, Node** effect,
Node** control, Handle<SharedFunctionInfo> shared_info,
Node* InlineApiCall(Node* receiver, Node* holder, Node* frame_state,
Node* value, Node** effect, Node** control,
Handle<SharedFunctionInfo> shared_info,
Handle<FunctionTemplateInfo> function_template_info);
// Construct the appropriate subgraph for element access.
......
......@@ -1420,7 +1420,6 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- edi : callee
// -- ebx : call_data
// -- ecx : holder
// -- edx : api_function_address
......@@ -1433,11 +1432,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// -- esp[(argc + 1) * 4] : receiver
// -----------------------------------
Register callee = edi;
Register call_data = ebx;
Register holder = ecx;
Register api_function_address = edx;
Register context = esi;
Register return_address = eax;
typedef FunctionCallbackArguments FCA;
......@@ -1467,12 +1464,7 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// holder
__ push(holder);
// enter a new context
Register scratch = call_data;
if (!is_lazy()) {
// load context from callee
__ mov(context, FieldOperand(callee, JSFunction::kContextOffset));
}
__ mov(scratch, esp);
......
......@@ -281,10 +281,10 @@ void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
void ApiCallbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
edi, // callee
ebx, // call_data
ecx, // holder
edx, // api_function_address
JavaScriptFrame::context_register(), // callee context
ebx, // call_data
ecx, // holder
edx, // api_function_address
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -241,7 +241,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
__ mov(api_function_address, Operand(ref));
// Jump to stub.
CallApiCallbackStub stub(isolate, is_store, !optimization.is_constant_call());
CallApiCallbackStub stub(isolate, is_store);
__ TailCallStub(&stub);
}
......
......@@ -175,7 +175,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
__ Mov(api_function_address, ref);
// Jump to stub.
CallApiCallbackStub stub(isolate, is_store, !optimization.is_constant_call());
CallApiCallbackStub stub(isolate, is_store);
__ TailCallStub(&stub);
}
......
......@@ -174,7 +174,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
__ mov(api_function_address, Immediate(function_address));
// Jump to stub.
CallApiCallbackStub stub(isolate, is_store, !optimization.is_constant_call());
CallApiCallbackStub stub(isolate, is_store);
__ TailCallStub(&stub);
}
......
......@@ -231,7 +231,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
__ li(api_function_address, Operand(ref));
// Jump to stub.
CallApiCallbackStub stub(isolate, is_store, !optimization.is_constant_call());
CallApiCallbackStub stub(isolate, is_store);
__ TailCallStub(&stub);
}
......
......@@ -231,7 +231,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
__ li(api_function_address, Operand(ref));
// Jump to stub.
CallApiCallbackStub stub(isolate, is_store, !optimization.is_constant_call());
CallApiCallbackStub stub(isolate, is_store);
__ TailCallStub(&stub);
}
......
......@@ -237,7 +237,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
__ mov(api_function_address, Operand(ref));
// Jump to stub.
CallApiCallbackStub stub(isolate, is_store, !optimization.is_constant_call());
CallApiCallbackStub stub(isolate, is_store);
__ TailCallStub(&stub);
}
......
......@@ -230,7 +230,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
__ mov(api_function_address, Operand(ref));
// Jump to stub.
CallApiCallbackStub stub(isolate, is_store, !optimization.is_constant_call());
CallApiCallbackStub stub(isolate, is_store);
__ TailCallStub(&stub);
}
......
......@@ -157,7 +157,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
RelocInfo::EXTERNAL_REFERENCE);
// Jump to stub.
CallApiCallbackStub stub(isolate, is_store, !optimization.is_constant_call());
CallApiCallbackStub stub(isolate, is_store);
__ TailCallStub(&stub);
}
......
......@@ -1573,7 +1573,6 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- a0 : callee
// -- t0 : call_data
// -- a2 : holder
// -- a1 : api_function_address
......@@ -1585,11 +1584,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// -- sp[argc * 4] : receiver
// -----------------------------------
Register callee = a0;
Register call_data = t0;
Register holder = a2;
Register api_function_address = a1;
Register context = cp;
typedef FunctionCallbackArguments FCA;
......@@ -1615,12 +1612,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// Push isolate and holder.
__ Push(scratch, holder);
// Enter a new context
if (!is_lazy()) {
// Load context from callee.
__ lw(context, FieldMemOperand(callee, JSFunction::kContextOffset));
}
// Prepare arguments.
__ mov(scratch, sp);
......
......@@ -276,10 +276,10 @@ void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
void ApiCallbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
a0, // callee
t0, // call_data
a2, // holder
a1, // api_function_address
JavaScriptFrame::context_register(), // callee context
t0, // call_data
a2, // holder
a1, // api_function_address
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -1575,7 +1575,6 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- a0 : callee
// -- a4 : call_data
// -- a2 : holder
// -- a1 : api_function_address
......@@ -1587,11 +1586,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// -- sp[argc * 8] : receiver
// -----------------------------------
Register callee = a0;
Register call_data = a4;
Register holder = a2;
Register api_function_address = a1;
Register context = cp;
typedef FunctionCallbackArguments FCA;
......@@ -1617,12 +1614,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// Push isolate and holder.
__ Push(scratch, holder);
// Enter a new context
if (!is_lazy()) {
// Load context from callee.
__ Ld(context, FieldMemOperand(callee, JSFunction::kContextOffset));
}
// Prepare arguments.
__ mov(scratch, sp);
......
......@@ -276,10 +276,10 @@ void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
void ApiCallbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
a0, // callee
a4, // call_data
a2, // holder
a1, // api_function_address
JavaScriptFrame::context_register(), // callee context
a4, // call_data
a2, // holder
a1, // api_function_address
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -1576,7 +1576,6 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r3 : callee
// -- r7 : call_data
// -- r5 : holder
// -- r4 : api_function_address
......@@ -1588,11 +1587,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// -- sp[argc * 4] : receiver
// -----------------------------------
Register callee = r3;
Register call_data = r7;
Register holder = r5;
Register api_function_address = r4;
Register context = cp;
typedef FunctionCallbackArguments FCA;
......@@ -1622,12 +1619,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// holder
__ push(holder);
// Enter a new context
if (!is_lazy()) {
// Load context from callee
__ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset));
}
// Prepare arguments.
__ mr(scratch, sp);
......
......@@ -276,10 +276,10 @@ void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
void ApiCallbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r3, // callee
r7, // call_data
r5, // holder
r4, // api_function_address
JavaScriptFrame::context_register(), // callee context
r7, // call_data
r5, // holder
r4, // api_function_address
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -1577,7 +1577,6 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r2 : callee
// -- r6 : call_data
// -- r4 : holder
// -- r3 : api_function_address
......@@ -1589,11 +1588,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// -- sp[argc * 4] : receiver
// -----------------------------------
Register callee = r2;
Register call_data = r6;
Register holder = r4;
Register api_function_address = r3;
Register context = cp;
typedef FunctionCallbackArguments FCA;
......@@ -1623,12 +1620,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// holder
__ push(holder);
// Enter a new context
if (!is_lazy()) {
// Load context from callee
__ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset));
}
// Prepare arguments.
__ LoadRR(scratch, sp);
......
......@@ -269,10 +269,10 @@ void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
void ApiCallbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r2, // callee
r6, // call_data
r4, // holder
r3, // api_function_address
JavaScriptFrame::context_register(), // callee context
r6, // call_data
r4, // holder
r3, // api_function_address
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -1467,7 +1467,6 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- rdi : callee
// -- rbx : call_data
// -- rcx : holder
// -- rdx : api_function_address
......@@ -1480,11 +1479,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// -- rsp[(argc + 1) * 8] : receiver
// -----------------------------------
Register callee = rdi;
Register call_data = rbx;
Register holder = rcx;
Register api_function_address = rdx;
Register context = rsi;
Register return_address = r8;
typedef FunctionCallbackArguments FCA;
......@@ -1516,12 +1513,7 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// holder
__ Push(holder);
// enter a new context
int argc = this->argc();
if (!this->is_lazy()) {
// load context from callee
__ movp(context, FieldOperand(callee, JSFunction::kContextOffset));
}
__ movp(scratch, rsp);
// Push return address back on stack.
......
......@@ -281,10 +281,10 @@ void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
void ApiCallbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
rdi, // callee
rbx, // call_data
rcx, // holder
rdx, // api_function_address
JavaScriptFrame::context_register(), // callee context
rbx, // call_data
rcx, // holder
rdx, // api_function_address
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment