Bug 957504: Fix mis-refactoring, and add some asserts to let debug users know that float32 can be broken (r=sunfish)

This commit is contained in:
Marty Rosenberg 2014-02-12 08:41:59 -05:00
parent d28da97897
commit a3c0d5dc25
3 changed files with 21 additions and 2 deletions

View File

@ -1926,7 +1926,6 @@ ICCompare_Fallback::Compiler::generateStubCode(MacroAssembler &masm)
masm.pushValue(R0);
masm.push(BaselineStubReg);
masm.pushBaselineFramePtr(BaselineFrameReg, R0.scratchReg());
return tailCallVM(DoCompareFallbackInfo, masm);
}

View File

@ -3493,6 +3493,7 @@ MacroAssemblerARMCompat::setupABICall(uint32_t args)
#ifdef JS_CODEGEN_ARM_HARDFP
usedIntSlots_ = 0;
usedFloatSlots_ = 0;
usedFloat32_ = false;
padding_ = 0;
#else
usedSlots_ = 0;
@ -3535,17 +3536,33 @@ MacroAssemblerARMCompat::passABIArg(const MoveOperand &from, MoveOp::Type type)
switch (type) {
case MoveOp::FLOAT32:
case MoveOp::DOUBLE: {
// N.B. this isn't a limitation of the ABI, it is a limitation of the compiler right now.
// There isn't a good way to handle odd numbered single registers, so everything goes to hell
// when we try. Current fix is to never use more than one float in a function call.
// Fix coming along with complete float32 support in bug 957504.
JS_ASSERT(!usedFloat32_);
if (type == MoveOp::FLOAT32)
usedFloat32_ = true;
FloatRegister fr;
if (GetFloatArgReg(usedIntSlots_, usedFloatSlots_, &fr)) {
if (from.isFloatReg() && from.floatReg() == fr) {
// Nothing to do; the value is in the right register already
usedFloatSlots_++;
if (type == MoveOp::FLOAT32)
passedArgTypes_ = (passedArgTypes_ << ArgType_Shift) | ArgType_Float32;
else
passedArgTypes_ = (passedArgTypes_ << ArgType_Shift) | ArgType_Double;
return;
}
to = MoveOperand(fr);
} else {
// If (and only if) the integer registers have started spilling, do we
// need to take the register's alignment into account
uint32_t disp = GetFloatArgStackDisp(usedIntSlots_, usedFloatSlots_, &padding_);
uint32_t disp = INT_MAX;
if (type == MoveOp::FLOAT32)
disp = GetFloat32ArgStackDisp(usedIntSlots_, usedFloatSlots_, &padding_);
else
disp = GetDoubleArgStackDisp(usedIntSlots_, usedFloatSlots_, &padding_);
to = MoveOperand(sp, disp);
}
usedFloatSlots_++;
@ -3560,6 +3577,8 @@ MacroAssemblerARMCompat::passABIArg(const MoveOperand &from, MoveOp::Type type)
if (GetIntArgReg(usedIntSlots_, usedFloatSlots_, &r)) {
if (from.isGeneralReg() && from.reg() == r) {
// Nothing to do; the value is in the right register already
usedIntSlots_++;
passedArgTypes_ = (passedArgTypes_ << ArgType_Shift) | ArgType_General;
return;
}
to = MoveOperand(r);

View File

@ -448,6 +448,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
#ifdef JS_CODEGEN_ARM_HARDFP
uint32_t usedIntSlots_;
uint32_t usedFloatSlots_;
bool usedFloat32_;
uint32_t padding_;
#else
// ARM treats arguments as a vector in registers/memory, that looks like: