Commit 481cabfe authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[liftoff] Switch traps to use runtime stubs.

This switches Liftoff code to use WebAssembly runtime stubs instead of
builtin calls for handling traps, similar to what we use in TurboFan
generated code as well.

R=clemensh@chromium.org
BUG=v8:7424

Change-Id: If2554067b3e294220306c67861bb1fb14db7b492
Reviewed-on: https://chromium-review.googlesource.com/1087275
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53644}
parent cbd4932e
......@@ -340,6 +340,10 @@ void LiftoffAssembler::CallIndirect(wasm::FunctionSig* sig,
BAILOUT("CallIndirect");
}
void LiftoffAssembler::CallRuntimeStub(WasmCode::RuntimeStubId sid) {
BAILOUT("CallRuntimeStub");
}
void LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) {
BAILOUT("AllocateStackSlot");
}
......
......@@ -924,6 +924,12 @@ void LiftoffAssembler::CallIndirect(wasm::FunctionSig* sig,
Call(target);
}
void LiftoffAssembler::CallRuntimeStub(WasmCode::RuntimeStubId sid) {
// A direct call to a wasm runtime stub defined in this module.
// Just encode the stub index. This will be patched at relocation.
Call(static_cast<Address>(sid), RelocInfo::WASM_STUB_CALL);
}
void LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) {
// The stack pointer is required to be quadword aligned.
size = RoundUp(size, kQuadWordSizeInBytes);
......
......@@ -1582,6 +1582,12 @@ void LiftoffAssembler::CallIndirect(wasm::FunctionSig* sig,
}
}
void LiftoffAssembler::CallRuntimeStub(WasmCode::RuntimeStubId sid) {
// A direct call to a wasm runtime stub defined in this module.
// Just encode the stub index. This will be patched at relocation.
wasm_call(static_cast<Address>(sid), RelocInfo::WASM_STUB_CALL);
}
void LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) {
sub(esp, Immediate(size));
mov(addr, esp);
......
......@@ -14,6 +14,7 @@
#include "src/wasm/baseline/liftoff-assembler-defs.h"
#include "src/wasm/baseline/liftoff-register.h"
#include "src/wasm/function-body-decoder.h"
#include "src/wasm/wasm-code-manager.h"
#include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-opcodes.h"
#include "src/wasm/wasm-value.h"
......@@ -544,6 +545,7 @@ class LiftoffAssembler : public TurboAssembler {
inline void CallIndirect(wasm::FunctionSig* sig,
compiler::CallDescriptor* call_descriptor,
Register target);
inline void CallRuntimeStub(WasmCode::RuntimeStubId sid);
// Reserve space in the current frame, store address to space in {addr}.
inline void AllocateStackSlot(Register addr, uint32_t size);
......
This diff is collapsed.
......@@ -1344,6 +1344,12 @@ void LiftoffAssembler::CallIndirect(wasm::FunctionSig* sig,
}
}
void LiftoffAssembler::CallRuntimeStub(WasmCode::RuntimeStubId sid) {
// A direct call to a wasm runtime stub defined in this module.
// Just encode the stub index. This will be patched at relocation.
Call(static_cast<Address>(sid), RelocInfo::WASM_STUB_CALL);
}
void LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) {
addiu(sp, sp, -size);
TurboAssembler::Move(addr, sp);
......
......@@ -1208,6 +1208,12 @@ void LiftoffAssembler::CallIndirect(wasm::FunctionSig* sig,
}
}
void LiftoffAssembler::CallRuntimeStub(WasmCode::RuntimeStubId sid) {
// A direct call to a wasm runtime stub defined in this module.
// Just encode the stub index. This will be patched at relocation.
Call(static_cast<Address>(sid), RelocInfo::WASM_STUB_CALL);
}
void LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) {
daddiu(sp, sp, -size);
TurboAssembler::Move(addr, sp);
......
......@@ -349,6 +349,10 @@ void LiftoffAssembler::CallIndirect(wasm::FunctionSig* sig,
BAILOUT("CallIndirect");
}
void LiftoffAssembler::CallRuntimeStub(WasmCode::RuntimeStubId sid) {
BAILOUT("CallRuntimeStub");
}
void LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) {
BAILOUT("AllocateStackSlot");
}
......
......@@ -349,6 +349,10 @@ void LiftoffAssembler::CallIndirect(wasm::FunctionSig* sig,
BAILOUT("CallIndirect");
}
void LiftoffAssembler::CallRuntimeStub(WasmCode::RuntimeStubId sid) {
BAILOUT("CallRuntimeStub");
}
void LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) {
BAILOUT("AllocateStackSlot");
}
......
......@@ -1433,6 +1433,12 @@ void LiftoffAssembler::CallIndirect(wasm::FunctionSig* sig,
}
}
void LiftoffAssembler::CallRuntimeStub(WasmCode::RuntimeStubId sid) {
// A direct call to a wasm runtime stub defined in this module.
// Just encode the stub index. This will be patched at relocation.
near_call(static_cast<Address>(sid), RelocInfo::WASM_STUB_CALL);
}
void LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) {
subp(rsp, Immediate(size));
movp(addr, rsp);
......
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