Commit cb4e08c3 authored by Junliang Yan's avatar Junliang Yan Committed by V8 LUCI CQ

s390x: [baseline] port Generate_BaselineOnStackReplacement

Change-Id: Id60f3552af2ba12a8ac8fd88ad43a88a9076774d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3272582Reviewed-by: 's avatarMilad Fa <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/main@{#77826}
parent 98502536
......@@ -240,6 +240,45 @@ void Generate_BaselineOrInterpreterEntry(MacroAssembler* masm,
__ b(&start);
}
void OnStackReplacement(MacroAssembler* masm, bool is_interpreter) {
ASM_CODE_COMMENT(masm);
{
FrameScope scope(masm, StackFrame::INTERNAL);
__ CallRuntime(Runtime::kCompileForOnStackReplacement);
}
// If the code object is null, just return to the caller.
Label skip;
__ CmpSmiLiteral(r2, Smi::zero(), r0);
__ bne(&skip);
__ Ret();
__ bind(&skip);
if (is_interpreter) {
// Drop the handler frame that is be sitting on top of the actual
// JavaScript frame. This is the case then OSR is triggered from bytecode.
__ LeaveFrame(StackFrame::STUB);
}
// Load deoptimization data from the code object.
// <deopt_data> = <code>[#deoptimization_data_offset]
__ LoadTaggedPointerField(
r3,
FieldMemOperand(r2, Code::kDeoptimizationDataOrInterpreterDataOffset));
// Load the OSR entrypoint offset from the deoptimization data.
// <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset]
__ SmiUntagField(
r3, FieldMemOperand(r3, FixedArray::OffsetOfElementAt(
DeoptimizationData::kOsrPcOffsetIndex)));
// Compute the target address = code_obj + header_size + osr_offset
// <entry_addr> = <code_obj> + #header_size + <osr_offset>
__ AddS64(r2, r3);
Generate_OSREntry(masm, r2, Code::kHeaderSize - kHeapObjectTag);
}
} // namespace
void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) {
......@@ -1884,46 +1923,6 @@ void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) {
__ Ret();
}
void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
__ CallRuntime(Runtime::kCompileForOnStackReplacement);
}
// If the code object is null, just return to the caller.
Label skip;
__ CmpSmiLiteral(r2, Smi::zero(), r0);
__ bne(&skip);
__ Ret();
__ bind(&skip);
// Drop the handler frame that is be sitting on top of the actual
// JavaScript frame. This is the case then OSR is triggered from bytecode.
__ LeaveFrame(StackFrame::STUB);
// Load deoptimization data from the code object.
// <deopt_data> = <code>[#deoptimization_data_offset]
__ LoadTaggedPointerField(
r3,
FieldMemOperand(r2, Code::kDeoptimizationDataOrInterpreterDataOffset));
// Load the OSR entrypoint offset from the deoptimization data.
// <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset]
__ SmiUntagField(
r3, FieldMemOperand(r3, FixedArray::OffsetOfElementAt(
DeoptimizationData::kOsrPcOffsetIndex)));
// Compute the target address = code_obj + header_size + osr_offset
// <entry_addr> = <code_obj> + #header_size + <osr_offset>
__ AddS64(r2, r3);
__ AddS64(r0, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
__ mov(r14, r0);
// And "return" to the OSR entry point of the function.
__ Ret();
}
// static
void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
// ----------- S t a t e -------------
......@@ -3657,6 +3656,18 @@ void Builtins::Generate_DeoptimizationEntry_Lazy(MacroAssembler* masm) {
Generate_DeoptimizationEntry(masm, DeoptimizeKind::kLazy);
}
void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
return OnStackReplacement(masm, true);
}
#if ENABLE_SPARKPLUG
void Builtins::Generate_BaselineOnStackReplacement(MacroAssembler* masm) {
__ LoadU64(kContextRegister,
MemOperand(fp, BaselineFrameConstants::kContextOffset));
return OnStackReplacement(masm, false);
}
#endif
void Builtins::Generate_BaselineOrInterpreterEnterAtBytecode(
MacroAssembler* masm) {
Generate_BaselineOrInterpreterEntry(masm, false);
......
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