Commit 212c962f authored by Yu Yin's avatar Yu Yin Committed by Commit Bot

[mips][builtins] Make ContinueToBuiltinHelper skip off-heap builtin trampolines

Port 7b48dd55 https://crrev.com/c/1648155

Original Commit Message:

    This changes Generate_ContinueToBuiltinHelper to generate code to load
    the builtin address directly from the builtins table rather than going
    via the executable code in the trampoline's code object.

    The set up for Generate_ContinueToBuiltinHelper is changed so that the
    builtin index is stored on the stack in place of the builtin Code
    object which is no longer needed.

Change-Id: I1c8a5a18ac998b16d84556f08637b32d758f44da
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1659992
Commit-Queue: Dan Elphick <delphick@chromium.org>
Auto-Submit: Yu Yin <xwafish@gmail.com>
Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62199}
parent def9aa5d
......@@ -1467,11 +1467,13 @@ void Generate_ContinueToBuiltinHelper(MacroAssembler* masm,
}
__ lw(fp, MemOperand(
sp, BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp));
// Load builtin index (stored as a Smi) and use it to get the builtin start
// address from the builtins table.
__ Pop(t0);
__ Addu(sp, sp,
Operand(BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp));
__ Pop(ra);
__ Addu(t0, t0, Operand(Code::kHeaderSize - kHeapObjectTag));
__ LoadEntryFromBuiltinIndex(t0);
__ Jump(t0);
}
} // namespace
......
......@@ -1483,11 +1483,13 @@ void Generate_ContinueToBuiltinHelper(MacroAssembler* masm,
}
__ Ld(fp, MemOperand(
sp, BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp));
// Load builtin index (stored as a Smi) and use it to get the builtin start
// address from the builtins table.
__ Pop(t0);
__ Daddu(sp, sp,
Operand(BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp));
__ Pop(ra);
__ Daddu(t0, t0, Operand(Code::kHeaderSize - kHeapObjectTag));
__ LoadEntryFromBuiltinIndex(t0);
__ Jump(t0);
}
} // namespace
......
......@@ -3974,7 +3974,7 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
Call(code.address(), rmode, cond, rs, rt, bd);
}
void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
void TurboAssembler::LoadEntryFromBuiltinIndex(Register builtin_index) {
STATIC_ASSERT(kSystemPointerSize == 4);
STATIC_ASSERT(kSmiShiftSize == 0);
STATIC_ASSERT(kSmiTagSize == 1);
......@@ -3985,6 +3985,10 @@ void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
Lsa(builtin_index, kRootRegister, builtin_index, kSystemPointerSizeLog2);
lw(builtin_index,
MemOperand(builtin_index, IsolateData::builtin_entry_table_offset()));
}
void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
LoadEntryFromBuiltinIndex(builtin_index);
Call(builtin_index);
}
......
......@@ -214,6 +214,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void Call(Label* target);
void LoadAddress(Register dst, Label* target);
// Load the builtin given by the Smi in |builtin_index| into the same
// register.
void LoadEntryFromBuiltinIndex(Register builtin_index);
void CallBuiltinByIndex(Register builtin_index) override;
void LoadCodeObjectEntry(Register destination,
......
......@@ -4274,7 +4274,7 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
Call(code.address(), rmode, cond, rs, rt, bd);
}
void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
void TurboAssembler::LoadEntryFromBuiltinIndex(Register builtin_index) {
STATIC_ASSERT(kSystemPointerSize == 8);
STATIC_ASSERT(kSmiShiftSize == 31);
STATIC_ASSERT(kSmiTagSize == 1);
......@@ -4285,6 +4285,10 @@ void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
Dlsa(builtin_index, kRootRegister, builtin_index, kSystemPointerSizeLog2);
Ld(builtin_index,
MemOperand(builtin_index, IsolateData::builtin_entry_table_offset()));
}
void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
LoadEntryFromBuiltinIndex(builtin_index);
Call(builtin_index);
}
......
......@@ -236,6 +236,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void Call(Label* target);
void LoadAddress(Register dst, Label* target);
// Load the builtin given by the Smi in |builtin_index| into the same
// register.
void LoadEntryFromBuiltinIndex(Register builtin_index);
void CallBuiltinByIndex(Register builtin_index) override;
void LoadCodeObjectEntry(Register destination,
......
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