[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: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62199}
This commit is contained in:
Yu Yin 2019-06-15 14:39:50 +08:00 committed by Commit Bot
parent def9aa5d0a
commit 212c962fee
6 changed files with 22 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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,

View File

@ -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);
}

View File

@ -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,