author | Dan Gohman <sunfish@google.com> |
Thu, 10 Oct 2013 05:31:05 -0700 | |
changeset 150325 | 44c21dcf12745f2f0b8bc8dbc367ac587d14551d |
parent 150324 | 92416820c9fa036f15039fb19c46b254c7e4e9df |
child 150326 | 94bd7574eff132ca85d9a63b873af16765716f7e |
push id | 34823 |
push user | sunfish@google.com |
push date | Thu, 10 Oct 2013 12:34:23 +0000 |
treeherder | mozilla-inbound@44c21dcf1274 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jandem |
bugs | 925088 |
milestone | 27.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
js/src/jit/x64/MacroAssembler-x64.h | file | annotate | diff | comparison | revisions | |
js/src/jit/x86/MacroAssembler-x86.h | file | annotate | diff | comparison | revisions |
--- a/js/src/jit/x64/MacroAssembler-x64.h +++ b/js/src/jit/x64/MacroAssembler-x64.h @@ -1035,22 +1035,24 @@ class MacroAssemblerX64 : public MacroAs void int32ValueToFloat32(const ValueOperand &operand, const FloatRegister &dest) { convertInt32ToFloat32(operand.valueReg(), dest); } void loadConstantDouble(double d, const FloatRegister &dest); void loadConstantFloat32(float f, const FloatRegister &dest); void branchTruncateDouble(const FloatRegister &src, const Register &dest, Label *fail) { - const uint64_t IndefiniteIntegerValue = 0x8000000000000000; - JS_ASSERT(dest != ScratchReg); cvttsd2sq(src, dest); - movq(ImmWord(IndefiniteIntegerValue), ScratchReg); - cmpq(dest, ScratchReg); - j(Assembler::Equal, fail); + + // cvttsd2sq returns 0x8000000000000000 on failure. Test for it by + // subtracting 1 and testing overflow (this avoids the need to + // materialize that value in a register). + cmpq(dest, Imm32(1)); + j(Assembler::Overflow, fail); + movl(dest, dest); // Zero upper 32-bits. } Condition testInt32Truthy(bool truthy, const ValueOperand &operand) { testl(operand.valueReg(), operand.valueReg()); return truthy ? NonZero : Zero; } void branchTestBooleanTruthy(bool truthy, const ValueOperand &operand, Label *label) {
--- a/js/src/jit/x86/MacroAssembler-x86.h +++ b/js/src/jit/x86/MacroAssembler-x86.h @@ -874,26 +874,32 @@ class MacroAssemblerX86 : public MacroAs } void loadConstantDouble(double d, const FloatRegister &dest); void addConstantDouble(double d, const FloatRegister &dest); void loadConstantFloat32(float f, const FloatRegister &dest); void addConstantFloat32(float f, const FloatRegister &dest); void branchTruncateDouble(const FloatRegister &src, const Register &dest, Label *fail) { - const uint32_t IndefiniteIntegerValue = 0x80000000; cvttsd2si(src, dest); - cmpl(dest, Imm32(IndefiniteIntegerValue)); - j(Assembler::Equal, fail); + + // cvttsd2si returns 0x80000000 on failure. Test for it by + // subtracting 1 and testing overflow (this permits the use of a + // smaller immediate field). + cmpl(dest, Imm32(1)); + j(Assembler::Overflow, fail); } void branchTruncateFloat32(const FloatRegister &src, const Register &dest, Label *fail) { - const uint32_t IndefiniteIntegerValue = 0x80000000; cvttss2si(src, dest); - cmpl(dest, Imm32(IndefiniteIntegerValue)); - j(Assembler::Equal, fail); + + // cvttss2si returns 0x80000000 on failure. Test for it by + // subtracting 1 and testing overflow (this permits the use of a + // smaller immediate field). + cmpl(dest, Imm32(1)); + j(Assembler::Overflow, fail); } Condition testInt32Truthy(bool truthy, const ValueOperand &operand) { testl(operand.payloadReg(), operand.payloadReg()); return truthy ? NonZero : Zero; } void branchTestBooleanTruthy(bool truthy, const ValueOperand &operand, Label *label) { testl(operand.payloadReg(), operand.payloadReg());