Commit 844f3d64 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[maglev] Use higher level Smi macro assembler operations

Bug: v8:7700
Change-Id: Ia601631de4cbc8099a87be0bda4a68ddffa8de74
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3610428Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80248}
parent b8f88be0
......@@ -765,9 +765,9 @@ void CheckedSmiUntag::GenerateCode(MaglevCodeGenState* code_gen_state,
// TODO(leszeks): Consider optimizing away this test and using the carry bit
// of the `sarl` for cases where the deopt uses the value from a different
// register.
__ testb(value, Immediate(1));
EmitEagerDeoptIf(not_zero, code_gen_state, this);
__ sarl(value, Immediate(1));
Condition is_smi = __ CheckSmi(value);
EmitEagerDeoptIf(NegateCondition(is_smi), code_gen_state, this);
__ SmiToInt32(value);
}
void CheckedSmiTag::AllocateVreg(MaglevVregAllocationState* vreg_state,
......@@ -833,17 +833,16 @@ void CheckedFloat64Unbox::GenerateCode(MaglevCodeGenState* code_gen_state,
Register value = ToRegister(input());
Label is_not_smi, done;
// Check if Smi.
__ testb(value, Immediate(1));
__ j(not_zero, &is_not_smi);
__ JumpIfNotSmi(value, &is_not_smi);
// If Smi, convert to Float64.
__ sarl(value, Immediate(1));
__ SmiToInt32(value);
__ Cvtlsi2sd(ToDoubleRegister(result()), value);
// TODO(v8:7700): Add a constraint to the register allocator to indicate that
// the value in the input register is "trashed" by this node. Currently we
// have the invariant that the input register should not be mutated when it is
// not the same as the output register or the function does not call a
// builtin. So, we recover the Smi value here.
__ addl(value, value);
__ SmiTag(value);
__ jmp(&done);
__ bind(&is_not_smi);
// Check if HeapNumber, deopt otherwise.
......
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