Commit 6cf9cb49 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm][arm64] Optimize runtime stub slots

This reduces the size per runtime stub slot by using the same sequence
we plan to use for far jumps.
Note that alignment is not an issue here, since runtime stub slots are
never patched.

R=mstarzinger@chromium.org
CC=joey.gouly@arm.com

Bug: v8:9477
Change-Id: I38666c8fce93a977bc5b9ca5fafc54f6ae739f12
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1784293
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63591}
parent ff0a0575
......@@ -375,7 +375,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
// Instruction set functions ------------------------------------------------
// Branch / Jump instructions.
// For branches offsets are scaled, i.e. they in instrcutions not in bytes.
// For branches offsets are scaled, i.e. in instructions not in bytes.
// Branch to register.
void br(const Register& xn);
......
......@@ -112,8 +112,19 @@ void JumpTableAssembler::EmitLazyCompileJumpSlot(uint32_t func_index,
}
void JumpTableAssembler::EmitRuntimeStubSlot(Address builtin_target) {
JumpToInstructionStream(builtin_target);
ForceConstantPoolEmissionWithoutJump();
// This code uses hard-coded registers and instructions (and avoids
// {UseScratchRegisterScope} or {InstructionAccurateScope}) because this code
// will only be called for the very specific runtime slot table, and we want
// to have maximum control over the generated code.
// Do not reuse this code without validating that the same assumptions hold.
constexpr Register kTmpReg = x16;
DCHECK(TmpList()->IncludesAliasOf(kTmpReg));
// Load from [pc + 2 * kInstrSize] to {kTmpReg}, then branch there.
ldr_pcrel(kTmpReg, 2); // 1 instruction
br(kTmpReg); // 1 instruction
dq(builtin_target); // 8 bytes (== 2 instructions)
STATIC_ASSERT(kInstrSize == kInt32Size);
STATIC_ASSERT(kJumpTableStubSlotSize == 4 * kInstrSize);
}
void JumpTableAssembler::EmitJumpSlot(Address target) {
......
......@@ -173,7 +173,7 @@ class V8_EXPORT_PRIVATE JumpTableAssembler : public MacroAssembler {
static constexpr int kJumpTableLineSize = 1 * kInstrSize;
static constexpr int kJumpTableSlotSize = 1 * kInstrSize;
static constexpr int kLazyCompileTableSlotSize = 3 * kInstrSize;
static constexpr int kJumpTableStubSlotSize = 6 * kInstrSize;
static constexpr int kJumpTableStubSlotSize = 4 * kInstrSize;
#elif V8_TARGET_ARCH_S390X
static constexpr int kJumpTableLineSize = 128;
static constexpr int kJumpTableSlotSize = 14;
......
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