[baseline] Add kJavaScriptCallNewTarget in BaselineOutOfLinePrologue descriptor

Change-Id: Iefbc2fe993ca7bed385624ecc6818c94b87f3915
Bug: v8:11429
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2715189
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72963}
This commit is contained in:
Victor Gomes 2021-02-23 16:56:02 +01:00 committed by Commit Bot
parent 29b863829e
commit ef1ae61976
6 changed files with 21 additions and 14 deletions

View File

@ -20,7 +20,8 @@ void BaselineCompiler::Prologue() {
__ masm()->EnterFrame(StackFrame::BASELINE);
CallBuiltin(Builtins::kBaselineOutOfLinePrologue, kContextRegister,
kJSFunctionRegister, kJavaScriptCallArgCountRegister,
kInterpreterBytecodeArrayRegister);
kInterpreterBytecodeArrayRegister,
kJavaScriptCallNewTargetRegister);
__ masm()->AssertSpAligned();
PrologueFillFrame();

View File

@ -20,7 +20,8 @@ void BaselineCompiler::Prologue() {
DCHECK_EQ(kJSFunctionRegister, kJavaScriptCallTargetRegister);
CallBuiltin(Builtins::kBaselineOutOfLinePrologue, kContextRegister,
kJSFunctionRegister, kJavaScriptCallArgCountRegister,
kInterpreterBytecodeArrayRegister);
kInterpreterBytecodeArrayRegister,
kJavaScriptCallNewTargetRegister);
PrologueFillFrame();
}

View File

@ -1321,12 +1321,15 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
__ bind(&call_stack_guard);
{
Register new_target = descriptor.GetRegisterParameter(
BaselineOutOfLinePrologueDescriptor::kJavaScriptCallNewTarget);
FrameScope frame_scope(masm, StackFrame::INTERNAL);
__ RecordComment("[ Stack/interrupt call");
// Save incoming new target or generator
__ Push(padreg, kJavaScriptCallNewTargetRegister);
__ Push(padreg, new_target);
__ CallRuntime(Runtime::kStackGuard);
__ Pop(kJavaScriptCallNewTargetRegister, padreg);
__ Pop(new_target, padreg);
__ RecordComment("]");
}
__ Ret();

View File

@ -1686,6 +1686,9 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
__ RecordComment("]");
Register new_target = descriptor.GetRegisterParameter(
BaselineOutOfLinePrologueDescriptor::kJavaScriptCallNewTarget);
__ RecordComment("[ Stack/interrupt check");
Label call_stack_guard;
{
@ -1701,7 +1704,7 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
__ movzxwl(frame_size,
FieldOperand(bytecode_array, BytecodeArray::kFrameSizeOffset));
__ Move(kScratchRegister, rsp);
DCHECK_NE(frame_size, kJavaScriptCallNewTargetRegister);
DCHECK_NE(frame_size, new_target);
__ subq(kScratchRegister, frame_size);
__ cmpq(kScratchRegister,
__ StackLimitAsOperand(StackLimitKind::kInterruptStackLimit));
@ -1737,9 +1740,9 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
__ PushReturnAddressFrom(return_address);
FrameScope frame_scope(masm, StackFrame::INTERNAL);
// Save incoming new target or generator
__ Push(kJavaScriptCallNewTargetRegister);
__ Push(new_target);
__ CallRuntime(Runtime::kStackGuard, 0);
__ Pop(kJavaScriptCallNewTargetRegister);
__ Pop(new_target);
}
// Return to caller pushed pc, without any frame teardown.

View File

@ -333,11 +333,8 @@ void BaselineOutOfLinePrologueDescriptor::InitializePlatformSpecific(
// TODO(v8:11421): Implement on other platforms.
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64
Register registers[] = {
kContextRegister,
kJSFunctionRegister,
kJavaScriptCallArgCountRegister,
kInterpreterBytecodeArrayRegister,
};
kContextRegister, kJSFunctionRegister, kJavaScriptCallArgCountRegister,
kInterpreterBytecodeArrayRegister, kJavaScriptCallNewTargetRegister};
data->InitializePlatformSpecific(kParameterCount, registers);
#else
InitializePlatformUnimplemented(data, kParameterCount);

View File

@ -1467,11 +1467,13 @@ class BaselineOutOfLinePrologueDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS_NO_CONTEXT(kCalleeContext, kClosure,
kJavaScriptCallArgCount,
kInterpreterBytecodeArray)
kInterpreterBytecodeArray,
kJavaScriptCallNewTarget)
DEFINE_PARAMETER_TYPES(MachineType::AnyTagged(), // kCalleeContext
MachineType::AnyTagged(), // kClosure
MachineType::Int32(), // kJavaScriptCallArgCount
MachineType::AnyTagged()) // kInterpreterBytecodeArray
MachineType::AnyTagged(), // kInterpreterBytecodeArray
MachineType::AnyTagged()) // kJavaScriptCallNewTarget
DECLARE_DESCRIPTOR(BaselineOutOfLinePrologueDescriptor,
CallInterfaceDescriptor)
};