[wasm][turbofan] Load 32-bit values more efficiently
When loading a 32-bit value from the stack, just load 32 bit and zero-extend them into the target register, instead of loading the full 64 bits. As there are things to fix (see https://crbug.com/1356461), we only enable this optimization for Wasm for now. R=jkummerow@chromium.org Bug: chromium:1395604, chromium:1356461, v8:13581 Change-Id: Ibdd2d80704973362906aec9b38faa762d3b43f3f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4097424 Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Maya Lekova <mslekova@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#84796}
This commit is contained in:
parent
50961e7032
commit
a38209949f
@ -5335,7 +5335,22 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
|
||||
case MoveType::kStackToRegister: {
|
||||
Operand src = g.ToOperand(source);
|
||||
if (source->IsStackSlot()) {
|
||||
__ movq(g.ToRegister(destination), src);
|
||||
MachineRepresentation mr =
|
||||
LocationOperand::cast(source)->representation();
|
||||
const bool is_32_bit = mr == MachineRepresentation::kWord32 ||
|
||||
mr == MachineRepresentation::kCompressed ||
|
||||
mr == MachineRepresentation::kCompressedPointer;
|
||||
// TODO(13581): Fix this for other code kinds (see
|
||||
// https://crbug.com/1356461).
|
||||
if (code_kind() == CodeKind::WASM_FUNCTION && is_32_bit) {
|
||||
// When we need only 32 bits, move only 32 bits. Benefits:
|
||||
// - Save a byte here and there (depending on the destination
|
||||
// register; "movl eax, ..." is smaller than "movq rax, ...").
|
||||
// - Safeguard against accidental decompression of compressed slots.
|
||||
__ movl(g.ToRegister(destination), src);
|
||||
} else {
|
||||
__ movq(g.ToRegister(destination), src);
|
||||
}
|
||||
} else {
|
||||
DCHECK(source->IsFPStackSlot());
|
||||
XMMRegister dst = g.ToDoubleRegister(destination);
|
||||
|
Loading…
Reference in New Issue
Block a user