Unreviewed, rolling out r189136.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Aug 2015 06:52:10 +0000 (06:52 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Aug 2015 06:52:10 +0000 (06:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148608

Made JSC tests flaky (Requested by ap on #webkit).

Reverted changeset:

"[JSC][x86] Improve the compare functions when comparing with
zero"
https://bugs.webkit.org/show_bug.cgi?id=148536
http://trac.webkit.org/changeset/189136

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189148 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/assembler/MacroAssembler.h
Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

index c7ff084..a179d46 100644 (file)
@@ -1,3 +1,17 @@
+2015-08-28  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r189136.
+        https://bugs.webkit.org/show_bug.cgi?id=148608
+
+        Made JSC tests flaky (Requested by ap on #webkit).
+
+        Reverted changeset:
+
+        "[JSC][x86] Improve the compare functions when comparing with
+        zero"
+        https://bugs.webkit.org/show_bug.cgi?id=148536
+        http://trac.webkit.org/changeset/189136
+
 2015-08-28  Benjamin Poulain  <bpoulain@apple.com>
 
         [JSC] Get rid of DFG's MergeMode
index 5a47d70..8cc7fba 100644 (file)
@@ -112,7 +112,6 @@ public:
     using MacroAssemblerBase::pop;
     using MacroAssemblerBase::jump;
     using MacroAssemblerBase::branch32;
-    using MacroAssemblerBase::compare32;
     using MacroAssemblerBase::move;
     using MacroAssemblerBase::add32;
     using MacroAssemblerBase::and32;
@@ -330,11 +329,6 @@ public:
         return branch32(commute(cond), right, left);
     }
 
-    void compare32(RelationalCondition cond, Imm32 left, RegisterID right, RegisterID dest)
-    {
-        compare32(commute(cond), right, left, dest);
-    }
-
     void branchTestPtr(ResultCondition cond, RegisterID reg, Label target)
     {
         branchTestPtr(cond, reg).linkTo(target, this);
@@ -1515,24 +1509,6 @@ public:
         return branch32(cond, left, right.asTrustedImm32());
     }
 
-    void compare32(RelationalCondition cond, RegisterID left, Imm32 right, RegisterID dest)
-    {
-        if (shouldBlind(right)) {
-            if (haveScratchRegisterForBlinding()) {
-                loadXorBlindedConstant(xorBlindConstant(right), scratchRegisterForBlinding());
-                compare32(cond, left, scratchRegisterForBlinding(), dest);
-            }
-            // If we don't have a scratch register available for use, we'll just
-            // place a random number of nops.
-            uint32_t nopCount = random() & 3;
-            while (nopCount--)
-                nop();
-            compare32(cond, left, right.asTrustedImm32(), dest);
-        }
-
-        compare32(cond, left, right.asTrustedImm32(), dest);
-    }
-
     Jump branchAdd32(ResultCondition cond, RegisterID src, Imm32 imm, RegisterID dest)
     {
         if (src == dest)
index 2cbd894..cb5efde 100644 (file)
@@ -1305,7 +1305,7 @@ public:
 private:
 
     // Should we be using TEQ for equal/not-equal?
-    void compare32AndSetFlags(RegisterID left, TrustedImm32 right)
+    void compare32(RegisterID left, TrustedImm32 right)
     {
         int32_t imm = right.m_value;
         ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm);
@@ -1363,7 +1363,7 @@ public:
 
     Jump branch32(RelationalCondition cond, RegisterID left, TrustedImm32 right)
     {
-        compare32AndSetFlags(left, right);
+        compare32(left, right);
         return Jump(makeBranch(cond));
     }
 
@@ -1421,7 +1421,7 @@ public:
 
     Jump branch8(RelationalCondition cond, RegisterID left, TrustedImm32 right)
     {
-        compare32AndSetFlags(left, right);
+        compare32(left, right);
         return Jump(makeBranch(cond));
     }
 
@@ -1721,7 +1721,7 @@ public:
 
     void compare32(RelationalCondition cond, RegisterID left, TrustedImm32 right, RegisterID dest)
     {
-        compare32AndSetFlags(left, right);
+        compare32(left, right);
         m_assembler.it(armV7Condition(cond), false);
         m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(1));
         m_assembler.mov(dest, ARMThumbImmediate::makeUInt16(0));
index 6e63ce9..84a4f52 100644 (file)
@@ -1124,28 +1124,10 @@ public:
 
     Jump branch32(RelationalCondition cond, RegisterID left, TrustedImm32 right)
     {
-        if (!right.m_value && (cond == Equal || cond == NotEqual || cond == LessThan || cond == GreaterThanOrEqual)) {
-            ResultCondition resultCondition;
-            switch (cond) {
-            case Equal:
-                resultCondition = Zero;
-                break;
-            case NotEqual:
-                resultCondition = NonZero;
-                break;
-            case LessThan:
-                resultCondition = Signed;
-                break;
-            case GreaterThanOrEqual:
-                resultCondition = PositiveOrZero;
-                break;
-            default:
-                RELEASE_ASSERT_NOT_REACHED();
-            }
+        if (((cond == Equal) || (cond == NotEqual)) && !right.m_value)
             m_assembler.testl_rr(left, left);
-            return Jump(m_assembler.jCC(x86Condition(resultCondition)));
-        }
-        m_assembler.cmpl_ir(right.m_value, left);
+        else
+            m_assembler.cmpl_ir(right.m_value, left);
         return Jump(m_assembler.jCC(x86Condition(cond)));
     }
     
@@ -1455,29 +1437,10 @@ public:
 
     void compare32(RelationalCondition cond, RegisterID left, TrustedImm32 right, RegisterID dest)
     {
-        if (!right.m_value && (cond == Equal || cond == NotEqual || cond == LessThan || cond == GreaterThanOrEqual)) {
-            ResultCondition resultCondition;
-            switch (cond) {
-            case Equal:
-                resultCondition = Zero;
-                break;
-            case NotEqual:
-                resultCondition = NonZero;
-                break;
-            case LessThan:
-                resultCondition = Signed;
-                break;
-            case GreaterThanOrEqual:
-                resultCondition = PositiveOrZero;
-                break;
-            default:
-                RELEASE_ASSERT_NOT_REACHED();
-            }
+        if (((cond == Equal) || (cond == NotEqual)) && !right.m_value)
             m_assembler.testl_rr(left, left);
-            set32(x86Condition(resultCondition), dest);
-            return;
-        }
-        m_assembler.cmpl_ir(right.m_value, left);
+        else
+            m_assembler.cmpl_ir(right.m_value, left);
         set32(x86Condition(cond), dest);
     }
 
index 2a647a9..29ede52 100644 (file)
@@ -1278,14 +1278,14 @@ void SpeculativeJIT::compilePeepHoleBooleanBranch(Node* node, Node* branchNode,
         notTaken = tmp;
     }
 
-    if (node->child1()->isInt32Constant()) {
-        int32_t imm = node->child1()->asInt32();
+    if (node->child1()->isBooleanConstant()) {
+        bool imm = node->child1()->asBoolean();
         SpeculateBooleanOperand op2(this, node->child2());
-        branch32(condition, JITCompiler::Imm32(imm), op2.gpr(), taken);
-    } else if (node->child2()->isInt32Constant()) {
+        branch32(condition, JITCompiler::Imm32(static_cast<int32_t>(JSValue::encode(jsBoolean(imm)))), op2.gpr(), taken);
+    } else if (node->child2()->isBooleanConstant()) {
         SpeculateBooleanOperand op1(this, node->child1());
-        int32_t imm = node->child2()->asInt32();
-        branch32(condition, op1.gpr(), JITCompiler::Imm32(imm), taken);
+        bool imm = node->child2()->asBoolean();
+        branch32(condition, op1.gpr(), JITCompiler::Imm32(static_cast<int32_t>(JSValue::encode(jsBoolean(imm)))), taken);
     } else {
         SpeculateBooleanOperand op1(this, node->child1());
         SpeculateBooleanOperand op2(this, node->child2());
index cc49bb2..379d9c3 100644 (file)
@@ -1470,34 +1470,15 @@ void SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality(Edge leftChild
 
 void SpeculativeJIT::compileInt32Compare(Node* node, MacroAssembler::RelationalCondition condition)
 {
-    if (node->child1()->isInt32Constant()) {
-        SpeculateInt32Operand op2(this, node->child2());
-        GPRTemporary result(this, Reuse, op2);
-        int32_t imm = node->child1()->asInt32();
-        m_jit.compare32(condition, JITCompiler::Imm32(imm), op2.gpr(), result.gpr());
-
-        // If we add a DataFormatBool, we should use it here.
-        m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
-        jsValueResult(result.gpr(), m_currentNode, DataFormatJSBoolean);
-    } else if (node->child2()->isInt32Constant()) {
-        SpeculateInt32Operand op1(this, node->child1());
-        GPRTemporary result(this, Reuse, op1);
-        int32_t imm = node->child2()->asInt32();
-        m_jit.compare32(condition, op1.gpr(), JITCompiler::Imm32(imm), result.gpr());
-
-        // If we add a DataFormatBool, we should use it here.
-        m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
-        jsValueResult(result.gpr(), m_currentNode, DataFormatJSBoolean);
-    } else {
-        SpeculateInt32Operand op1(this, node->child1());
-        SpeculateInt32Operand op2(this, node->child2());
-        GPRTemporary result(this, Reuse, op1, op2);
-        m_jit.compare32(condition, op1.gpr(), op2.gpr(), result.gpr());
-
-        // If we add a DataFormatBool, we should use it here.
-        m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
-        jsValueResult(result.gpr(), m_currentNode, DataFormatJSBoolean);
-    }
+    SpeculateInt32Operand op1(this, node->child1());
+    SpeculateInt32Operand op2(this, node->child2());
+    GPRTemporary result(this, Reuse, op1, op2);
+    
+    m_jit.compare32(condition, op1.gpr(), op2.gpr(), result.gpr());
+    
+    // If we add a DataFormatBool, we should use it here.
+    m_jit.or32(TrustedImm32(ValueFalse), result.gpr());
+    jsValueResult(result.gpr(), m_currentNode, DataFormatJSBoolean);
 }
 
 void SpeculativeJIT::compileInt52Compare(Node* node, MacroAssembler::RelationalCondition condition)