Backed out changeset 8bb615862099 (bug 875656) for introducing a subtle regalloc miscompile.

This commit is contained in:
Dan Gohman 2013-09-27 11:51:28 -07:00
parent 4b0b8bdd91
commit 2ad4bcece0
6 changed files with 38 additions and 25 deletions

View File

@ -4305,7 +4305,8 @@ CodeGenerator::visitConcat(LConcat *lir)
JS_ASSERT(ToRegister(lir->temp1()) == CallTempReg2);
JS_ASSERT(ToRegister(lir->temp2()) == CallTempReg3);
JS_ASSERT(ToRegister(lir->temp3()) == CallTempReg4);
JS_ASSERT(output == CallTempReg5);
JS_ASSERT(ToRegister(lir->temp4()) == CallTempReg5);
JS_ASSERT(output == CallTempReg6);
return emitConcat(lir, lhs, rhs, output);
}
@ -4320,10 +4321,11 @@ CodeGenerator::visitConcatPar(LConcatPar *lir)
JS_ASSERT(lhs == CallTempReg0);
JS_ASSERT(rhs == CallTempReg1);
JS_ASSERT((Register)slice == CallTempReg4);
JS_ASSERT((Register)slice == CallTempReg5);
JS_ASSERT(ToRegister(lir->temp1()) == CallTempReg2);
JS_ASSERT(ToRegister(lir->temp2()) == CallTempReg3);
JS_ASSERT(output == CallTempReg5);
JS_ASSERT(ToRegister(lir->temp3()) == CallTempReg4);
JS_ASSERT(output == CallTempReg6);
return emitConcat(lir, lhs, rhs, output);
}
@ -4363,12 +4365,13 @@ IonCompartment::generateStringConcatStub(JSContext *cx, ExecutionMode mode)
Register temp1 = CallTempReg2;
Register temp2 = CallTempReg3;
Register temp3 = CallTempReg4;
Register output = CallTempReg5;
Register temp4 = CallTempReg5;
Register output = CallTempReg6;
// In parallel execution, we pass in the ForkJoinSlice in CallTempReg4, as
// by the time we need to use the temp3 we no longer have need of the
// In parallel execution, we pass in the ForkJoinSlice in CallTempReg5, as
// by the time we need to use the temp4 we no longer have need of the
// slice.
Register forkJoinSlice = CallTempReg4;
Register forkJoinSlice = CallTempReg5;
Label failure, failurePopTemps;
@ -4463,15 +4466,14 @@ IonCompartment::generateStringConcatStub(JSContext *cx, ExecutionMode mode)
masm.storePtr(temp2, Address(output, JSShortString::offsetOfChars()));
// Copy lhs chars. Temp1 still holds the lhs length. Note that this
// advances temp2 to point to the next char. Note that this also repurposes
// the lhs register.
masm.loadPtr(Address(lhs, JSString::offsetOfChars()), lhs);
CopyStringChars(masm, temp2, lhs, temp1, temp3);
// advances temp2 to point to the next char.
masm.loadPtr(Address(lhs, JSString::offsetOfChars()), temp3);
CopyStringChars(masm, temp2, temp3, temp1, temp4);
// Copy rhs chars. This repurposes the rhs register.
// Copy rhs chars.
masm.loadPtr(Address(rhs, JSString::offsetOfChars()), temp3);
masm.loadStringLength(rhs, temp1);
masm.loadPtr(Address(rhs, JSString::offsetOfChars()), rhs);
CopyStringChars(masm, temp2, rhs, temp1, temp3);
CopyStringChars(masm, temp2, temp3, temp1, temp4);
// Null-terminate.
masm.store16(Imm32(0), Address(temp2, 0));

View File

@ -2436,18 +2436,19 @@ class LBinaryV : public LCallInstructionHelper<BOX_PIECES, 2 * BOX_PIECES, 0>
};
// Adds two string, returning a string.
class LConcat : public LInstructionHelper<1, 2, 3>
class LConcat : public LInstructionHelper<1, 2, 4>
{
public:
LIR_HEADER(Concat)
LConcat(const LAllocation &lhs, const LAllocation &rhs, const LDefinition &temp1,
const LDefinition &temp2, const LDefinition &temp3) {
const LDefinition &temp2, const LDefinition &temp3, const LDefinition &temp4) {
setOperand(0, lhs);
setOperand(1, rhs);
setTemp(0, temp1);
setTemp(1, temp2);
setTemp(2, temp3);
setTemp(3, temp4);
}
const LAllocation *lhs() {
@ -2465,21 +2466,25 @@ class LConcat : public LInstructionHelper<1, 2, 3>
const LDefinition *temp3() {
return this->getTemp(2);
}
const LDefinition *temp4() {
return this->getTemp(3);
}
};
class LConcatPar : public LInstructionHelper<1, 3, 2>
class LConcatPar : public LInstructionHelper<1, 3, 3>
{
public:
LIR_HEADER(ConcatPar)
LConcatPar(const LAllocation &slice, const LAllocation &lhs, const LAllocation &rhs,
const LDefinition &temp1, const LDefinition &temp2)
const LDefinition &temp1, const LDefinition &temp2, const LDefinition &temp3)
{
setOperand(0, slice);
setOperand(1, lhs);
setOperand(2, rhs);
setTemp(0, temp1);
setTemp(1, temp2);
setTemp(2, temp3);
}
const LAllocation *forkJoinSlice() {
@ -2497,6 +2502,9 @@ class LConcatPar : public LInstructionHelper<1, 3, 2>
const LDefinition *temp2() {
return this->getTemp(1);
}
const LDefinition *temp3() {
return this->getTemp(2);
}
};
// Get uint16 character code from a string.

View File

@ -1448,8 +1448,9 @@ LIRGenerator::visitConcat(MConcat *ins)
useFixed(rhs, CallTempReg1),
tempFixed(CallTempReg2),
tempFixed(CallTempReg3),
tempFixed(CallTempReg4));
if (!defineFixed(lir, ins, LAllocation(AnyRegister(CallTempReg5))))
tempFixed(CallTempReg4),
tempFixed(CallTempReg5));
if (!defineFixed(lir, ins, LAllocation(AnyRegister(CallTempReg6))))
return false;
return assignSafepoint(lir, ins);
}
@ -1465,12 +1466,13 @@ LIRGenerator::visitConcatPar(MConcatPar *ins)
JS_ASSERT(rhs->type() == MIRType_String);
JS_ASSERT(ins->type() == MIRType_String);
LConcatPar *lir = new LConcatPar(useFixed(slice, CallTempReg4),
LConcatPar *lir = new LConcatPar(useFixed(slice, CallTempReg5),
useFixed(lhs, CallTempReg0),
useFixed(rhs, CallTempReg1),
tempFixed(CallTempReg2),
tempFixed(CallTempReg3));
if (!defineFixed(lir, ins, LAllocation(AnyRegister(CallTempReg5))))
tempFixed(CallTempReg3),
tempFixed(CallTempReg4));
if (!defineFixed(lir, ins, LAllocation(AnyRegister(CallTempReg6))))
return false;
return assignSafepoint(lir, ins);
}

View File

@ -56,6 +56,7 @@ static MOZ_CONSTEXPR_VAR Register CallTempReg2 = r7;
static MOZ_CONSTEXPR_VAR Register CallTempReg3 = r8;
static MOZ_CONSTEXPR_VAR Register CallTempReg4 = r0;
static MOZ_CONSTEXPR_VAR Register CallTempReg5 = r1;
static MOZ_CONSTEXPR_VAR Register CallTempReg6 = r2;
static MOZ_CONSTEXPR_VAR Register IntArgReg0 = r0;
static MOZ_CONSTEXPR_VAR Register IntArgReg1 = r1;

View File

@ -75,7 +75,6 @@ static MOZ_CONSTEXPR_VAR Register HeapReg = r15;
static MOZ_CONSTEXPR_VAR FloatRegister ReturnFloatReg = xmm0;
static MOZ_CONSTEXPR_VAR FloatRegister ScratchFloatReg = xmm15;
// Avoid rbp, which is the FramePointer, which is unavailable in some modes.
static MOZ_CONSTEXPR_VAR Register ArgumentsRectifierReg = r8;
static MOZ_CONSTEXPR_VAR Register CallTempReg0 = rax;
static MOZ_CONSTEXPR_VAR Register CallTempReg1 = rdi;
@ -83,6 +82,7 @@ static MOZ_CONSTEXPR_VAR Register CallTempReg2 = rbx;
static MOZ_CONSTEXPR_VAR Register CallTempReg3 = rcx;
static MOZ_CONSTEXPR_VAR Register CallTempReg4 = rsi;
static MOZ_CONSTEXPR_VAR Register CallTempReg5 = rdx;
static MOZ_CONSTEXPR_VAR Register CallTempReg6 = rbp;
// Different argument registers for WIN64
#if defined(_WIN64)

View File

@ -46,7 +46,6 @@ static MOZ_CONSTEXPR_VAR Register ReturnReg = eax;
static MOZ_CONSTEXPR_VAR FloatRegister ReturnFloatReg = xmm0;
static MOZ_CONSTEXPR_VAR FloatRegister ScratchFloatReg = xmm7;
// Avoid ebp, which is the FramePointer, which is unavailable in some modes.
static MOZ_CONSTEXPR_VAR Register ArgumentsRectifierReg = esi;
static MOZ_CONSTEXPR_VAR Register CallTempReg0 = edi;
static MOZ_CONSTEXPR_VAR Register CallTempReg1 = eax;
@ -54,6 +53,7 @@ static MOZ_CONSTEXPR_VAR Register CallTempReg2 = ebx;
static MOZ_CONSTEXPR_VAR Register CallTempReg3 = ecx;
static MOZ_CONSTEXPR_VAR Register CallTempReg4 = esi;
static MOZ_CONSTEXPR_VAR Register CallTempReg5 = edx;
static MOZ_CONSTEXPR_VAR Register CallTempReg6 = ebp;
// We have no arg regs, so our NonArgRegs are just our CallTempReg*
static MOZ_CONSTEXPR_VAR Register CallTempNonArgRegs[] = { edi, eax, ebx, ecx, esi, edx };