Skip to content

Commit 1542e46

Browse files
lizhengxingCommit bot
authored andcommitted
X87: [api] Expose FunctionCallbackInfo::NewTarget.
port 306c412 (r35833) original commit message: This is needed by Blink to implement the Custom Elements spec. BUG= Review-Url: https://codereview.chromium.org/1928213002 Cr-Commit-Position: refs/heads/master@{#35889}
1 parent ad32fae commit 1542e46

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

src/x87/builtins-x87.cc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,9 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
186186
__ j(greater_equal, &loop);
187187

188188
// Call the function.
189-
if (is_api_function) {
190-
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
191-
Handle<Code> code =
192-
masm->isolate()->builtins()->HandleApiCallConstruct();
193-
__ call(code, RelocInfo::CODE_TARGET);
194-
} else {
195-
ParameterCount actual(eax);
196-
__ InvokeFunction(edi, edx, actual, CALL_FUNCTION,
197-
CheckDebugStepCallWrapper());
198-
}
189+
ParameterCount actual(eax);
190+
__ InvokeFunction(edi, edx, actual, CALL_FUNCTION,
191+
CheckDebugStepCallWrapper());
199192

200193
// Store offset of return address for deoptimizer.
201194
if (create_implicit_receiver && !is_api_function) {

src/x87/code-stubs-x87.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5361,9 +5361,14 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
53615361
STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
53625362
STATIC_ASSERT(FCA::kIsolateIndex == 1);
53635363
STATIC_ASSERT(FCA::kHolderIndex == 0);
5364-
STATIC_ASSERT(FCA::kArgsLength == 7);
5364+
STATIC_ASSERT(FCA::kNewTargetIndex == 7);
5365+
STATIC_ASSERT(FCA::kArgsLength == 8);
53655366

53665367
__ pop(return_address);
5368+
5369+
// new target
5370+
__ PushRoot(Heap::kUndefinedValueRootIndex);
5371+
53675372
// context save.
53685373
__ push(context);
53695374

@@ -5408,7 +5413,7 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
54085413

54095414
// Allocate the v8::Arguments structure in the arguments' space since
54105415
// it's not controlled by GC.
5411-
const int kApiStackSpace = 4;
5416+
const int kApiStackSpace = 3;
54125417

54135418
PrepareCallApiFunction(masm, kApiArgc + kApiStackSpace);
54145419

@@ -5419,8 +5424,6 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
54195424
__ mov(ApiParameterOperand(3), scratch);
54205425
// FunctionCallbackInfo::length_.
54215426
__ Move(ApiParameterOperand(4), Immediate(argc()));
5422-
// FunctionCallbackInfo::is_construct_call_.
5423-
__ Move(ApiParameterOperand(5), Immediate(0));
54245427

54255428
// v8::InvocationCallback's argument.
54265429
__ lea(scratch, ApiParameterOperand(2));
@@ -5440,8 +5443,8 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
54405443
}
54415444
Operand return_value_operand(ebp, return_value_offset * kPointerSize);
54425445
int stack_space = 0;
5443-
Operand is_construct_call_operand = ApiParameterOperand(5);
5444-
Operand* stack_space_operand = &is_construct_call_operand;
5446+
Operand length_operand = ApiParameterOperand(4);
5447+
Operand* stack_space_operand = &length_operand;
54455448
stack_space = argc() + FCA::kArgsLength + 1;
54465449
stack_space_operand = nullptr;
54475450
CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,

0 commit comments

Comments
 (0)