Commit 4f751240 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC: [api] Expose FunctionCallbackInfo::NewTarget

Port 306c412c

Original commit message:

    This is needed by Blink to implement the Custom Elements spec.

R=adamk@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG=v8:4261
LOG=N

Review-Url: https://codereview.chromium.org/1929703002
Cr-Commit-Position: refs/heads/master@{#35838}
parent ff956f4d
...@@ -605,15 +605,10 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, ...@@ -605,15 +605,10 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// r3: number of arguments // r3: number of arguments
// r4: constructor function // r4: constructor function
// r6: new target // r6: new target
if (is_api_function) {
__ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); ParameterCount actual(r3);
Handle<Code> code = masm->isolate()->builtins()->HandleApiCallConstruct(); __ InvokeFunction(r4, r6, actual, CALL_FUNCTION,
__ Call(code, RelocInfo::CODE_TARGET); CheckDebugStepCallWrapper());
} else {
ParameterCount actual(r3);
__ InvokeFunction(r4, r6, actual, CALL_FUNCTION,
CheckDebugStepCallWrapper());
}
// Store offset of return address for deoptimizer. // Store offset of return address for deoptimizer.
if (create_implicit_receiver && !is_api_function) { if (create_implicit_receiver && !is_api_function) {
......
...@@ -5635,7 +5635,11 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { ...@@ -5635,7 +5635,11 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
STATIC_ASSERT(FCA::kIsolateIndex == 1); STATIC_ASSERT(FCA::kIsolateIndex == 1);
STATIC_ASSERT(FCA::kHolderIndex == 0); STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 7); STATIC_ASSERT(FCA::kNewTargetIndex == 7);
STATIC_ASSERT(FCA::kArgsLength == 8);
// new target
__ PushRoot(Heap::kUndefinedValueRootIndex);
// context save // context save
__ push(context); __ push(context);
...@@ -5671,10 +5675,10 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { ...@@ -5671,10 +5675,10 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// it's not controlled by GC. // it's not controlled by GC.
// PPC LINUX ABI: // PPC LINUX ABI:
// //
// Create 5 extra slots on stack: // Create 4 extra slots on stack:
// [0] space for DirectCEntryStub's LR save // [0] space for DirectCEntryStub's LR save
// [1-4] FunctionCallbackInfo // [1-3] FunctionCallbackInfo
const int kApiStackSpace = 5; const int kApiStackSpace = 4;
const int kFunctionCallbackInfoOffset = const int kFunctionCallbackInfoOffset =
(kStackFrameExtraParamSlot + 1) * kPointerSize; (kStackFrameExtraParamSlot + 1) * kPointerSize;
...@@ -5693,9 +5697,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { ...@@ -5693,9 +5697,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
// FunctionCallbackInfo::length_ = argc // FunctionCallbackInfo::length_ = argc
__ li(ip, Operand(argc())); __ li(ip, Operand(argc()));
__ stw(ip, MemOperand(r3, 2 * kPointerSize)); __ stw(ip, MemOperand(r3, 2 * kPointerSize));
// FunctionCallbackInfo::is_construct_call_ = 0
__ li(ip, Operand::Zero());
__ stw(ip, MemOperand(r3, 2 * kPointerSize + kIntSize));
ExternalReference thunk_ref = ExternalReference thunk_ref =
ExternalReference::invoke_function_callback(masm->isolate()); ExternalReference::invoke_function_callback(masm->isolate());
...@@ -5712,9 +5713,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { ...@@ -5712,9 +5713,9 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
} }
MemOperand return_value_operand(fp, return_value_offset * kPointerSize); MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
int stack_space = 0; int stack_space = 0;
MemOperand is_construct_call_operand = MemOperand length_operand =
MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize + kIntSize); MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize);
MemOperand* stack_space_operand = &is_construct_call_operand; MemOperand* stack_space_operand = &length_operand;
stack_space = argc() + FCA::kArgsLength + 1; stack_space = argc() + FCA::kArgsLength + 1;
stack_space_operand = NULL; stack_space_operand = NULL;
CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
......
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