Bug 1129088 - IonMonkey: Revert bug 1100685 and add a comment. r=jandem, a=sledru
authorDan Gohman <sunfish@mozilla.com>
Fri, 06 Feb 2015 15:30:25 -0800
changeset 243745 3ef577b545b8
parent 243744 33a2305f846a
child 243746 a00e758a0460
push id4460
push userryanvm@gmail.com
push date2015-02-10 14:41 +0000
treeherdermozilla-beta@a00e758a0460 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, sledru
bugs1129088, 1100685
milestone36.0
Bug 1129088 - IonMonkey: Revert bug 1100685 and add a comment. r=jandem, a=sledru
js/src/jit/LIR-Common.h
js/src/jit/Lowering.cpp
--- a/js/src/jit/LIR-Common.h
+++ b/js/src/jit/LIR-Common.h
@@ -5133,23 +5133,24 @@ class LClampIToUint8 : public LInstructi
   public:
     LIR_HEADER(ClampIToUint8)
 
     explicit LClampIToUint8(const LAllocation &in) {
         setOperand(0, in);
     }
 };
 
-class LClampDToUint8 : public LInstructionHelper<1, 1, 0>
+class LClampDToUint8 : public LInstructionHelper<1, 1, 1>
 {
   public:
     LIR_HEADER(ClampDToUint8)
 
-    explicit LClampDToUint8(const LAllocation &in) {
+    LClampDToUint8(const LAllocation &in, const LDefinition &temp) {
         setOperand(0, in);
+        setTemp(0, temp);
     }
 };
 
 class LClampVToUint8 : public LInstructionHelper<1, BOX_PIECES, 1>
 {
   public:
     LIR_HEADER(ClampVToUint8)
 
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -2979,17 +2979,19 @@ LIRGenerator::visitClampToUint8(MClampTo
     switch (in->type()) {
       case MIRType_Boolean:
         return redefine(ins, in);
 
       case MIRType_Int32:
         return defineReuseInput(new(alloc()) LClampIToUint8(useRegisterAtStart(in)), ins, 0);
 
       case MIRType_Double:
-        return define(new(alloc()) LClampDToUint8(useRegisterAtStart(in)), ins);
+        // LClampDToUint8 clobbers its input register. Making it available as
+        // a temp copy describes this behavior to the register allocator.
+        return define(new(alloc()) LClampDToUint8(useRegisterAtStart(in), tempCopy(in, 0)), ins);
 
       case MIRType_Value:
       {
         LClampVToUint8 *lir = new(alloc()) LClampVToUint8(tempDouble());
         if (!useBox(lir, LClampVToUint8::Input, in))
             return false;
         return assignSnapshot(lir, Bailout_NonPrimitiveInput)
                && define(lir, ins)