Commit beed8f6a authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[liftoff] Use cached instance for bulk memory operations

Instead of always loading the instance from the frame, try to use the
cached instance register instead.
This is totally not performance critical since we do a C call afterwards
anyway, but it's just as easy to use the cached instance than loading it
fresh from the stack.

R=thibaudm@chromium.org

Change-Id: Ia815e9e6f8ab2efc665b2e3aefcdc7b4aa95739f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3427461Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78929}
parent 4365a70d
......@@ -4852,13 +4852,16 @@ class LiftoffCompiler {
LiftoffRegister src = pinned.set(__ PopToRegister(pinned));
LiftoffRegister dst = pinned.set(PopMemTypeToRegister(pinned));
Register instance = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp();
__ LoadInstanceFromFrame(instance);
LiftoffRegister segment_index =
pinned.set(__ GetUnusedRegister(kGpReg, pinned));
__ LoadConstant(segment_index, WasmValue(imm.data_segment.index));
Register instance = __ cache_state()->cached_instance;
if (instance == no_reg) {
instance = __ GetUnusedRegister(kGpReg, pinned).gp();
__ LoadInstanceFromFrame(instance);
}
ExternalReference ext_ref = ExternalReference::wasm_memory_init();
auto sig = MakeSig::Returns(kI32).Params(kPointerKind, kPointerKind, kI32,
kI32, kI32);
......@@ -4901,8 +4904,13 @@ class LiftoffCompiler {
LiftoffRegister size = pinned.set(PopMemTypeToRegister(pinned));
LiftoffRegister src = pinned.set(PopMemTypeToRegister(pinned));
LiftoffRegister dst = pinned.set(PopMemTypeToRegister(pinned));
Register instance = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp();
__ LoadInstanceFromFrame(instance);
Register instance = __ cache_state()->cached_instance;
if (instance == no_reg) {
instance = __ GetUnusedRegister(kGpReg, pinned).gp();
__ LoadInstanceFromFrame(instance);
}
ExternalReference ext_ref = ExternalReference::wasm_memory_copy();
auto sig = MakeSig::Returns(kI32).Params(kPointerKind, kPointerKind,
kPointerKind, kPointerKind);
......@@ -4924,8 +4932,12 @@ class LiftoffCompiler {
LiftoffRegister value = pinned.set(__ PopToRegister(pinned));
LiftoffRegister dst = pinned.set(PopMemTypeToRegister(pinned));
Register instance = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp();
__ LoadInstanceFromFrame(instance);
Register instance = __ cache_state()->cached_instance;
if (instance == no_reg) {
instance = __ GetUnusedRegister(kGpReg, pinned).gp();
__ LoadInstanceFromFrame(instance);
}
ExternalReference ext_ref = ExternalReference::wasm_memory_fill();
auto sig = MakeSig::Returns(kI32).Params(kPointerKind, kPointerKind, kI32,
kPointerKind);
......
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