Commit 36807f06 authored by epertoso's avatar epertoso Committed by Commit bot

[crankshaft] Fix DoDeferredMathAbsTaggedHeapNumber overwriting the context...

[crankshaft] Fix DoDeferredMathAbsTaggedHeapNumber overwriting the context with some temporary value.

BUG=v8:5067

Review-Url: https://codereview.chromium.org/2033413002
Cr-Commit-Position: refs/heads/master@{#36738}
parent f3694aca
...@@ -3072,8 +3072,19 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { ...@@ -3072,8 +3072,19 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber);
Label slow, allocated, done; Label slow, allocated, done;
Register tmp = input_reg.is(eax) ? ecx : eax; uint32_t available_regs = eax.bit() | ecx.bit() | edx.bit() | ebx.bit();
Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; available_regs &= ~input_reg.bit();
if (instr->context()->IsRegister()) {
// Make sure that the context isn't overwritten in the AllocateHeapNumber
// macro below.
available_regs &= ~ToRegister(instr->context()).bit();
}
Register tmp =
Register::from_code(base::bits::CountTrailingZeros32(available_regs));
available_regs &= ~tmp.bit();
Register tmp2 =
Register::from_code(base::bits::CountTrailingZeros32(available_regs));
// Preserve the value of all registers. // Preserve the value of all registers.
PushSafepointRegistersScope scope(this); PushSafepointRegistersScope scope(this);
......
...@@ -3267,8 +3267,19 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { ...@@ -3267,8 +3267,19 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber);
Label slow, allocated, done; Label slow, allocated, done;
Register tmp = input_reg.is(rax) ? rcx : rax; uint32_t available_regs = rax.bit() | rcx.bit() | rdx.bit() | rbx.bit();
Register tmp2 = tmp.is(rcx) ? rdx : input_reg.is(rcx) ? rdx : rcx; available_regs &= ~input_reg.bit();
if (instr->context()->IsRegister()) {
// Make sure that the context isn't overwritten in the AllocateHeapNumber
// macro below.
available_regs &= ~ToRegister(instr->context()).bit();
}
Register tmp =
Register::from_code(base::bits::CountTrailingZeros32(available_regs));
available_regs &= ~tmp.bit();
Register tmp2 =
Register::from_code(base::bits::CountTrailingZeros32(available_regs));
// Preserve the value of all registers. // Preserve the value of all registers.
PushSafepointRegistersScope scope(this); PushSafepointRegistersScope scope(this);
......
...@@ -3348,8 +3348,19 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { ...@@ -3348,8 +3348,19 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber);
Label slow, allocated, done; Label slow, allocated, done;
Register tmp = input_reg.is(eax) ? ecx : eax; uint32_t available_regs = eax.bit() | ecx.bit() | edx.bit() | ebx.bit();
Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; available_regs &= ~input_reg.bit();
if (instr->context()->IsRegister()) {
// Make sure that the context isn't overwritten in the AllocateHeapNumber
// macro below.
available_regs &= ~ToRegister(instr->context()).bit();
}
Register tmp =
Register::from_code(base::bits::CountTrailingZeros32(available_regs));
available_regs &= ~tmp.bit();
Register tmp2 =
Register::from_code(base::bits::CountTrailingZeros32(available_regs));
// Preserve the value of all registers. // Preserve the value of all registers.
PushSafepointRegistersScope scope(this); PushSafepointRegistersScope scope(this);
......
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