Unreviewed, rolling out r197994.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Mar 2016 17:51:00 +0000 (17:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Mar 2016 17:51:00 +0000 (17:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=155368

Broke several ARM tests (Requested by msaboff on #webkit).

Reverted changeset:

"[JSC] Add register reuse for ArithAdd of an Int32 and
constant in DFG"
https://bugs.webkit.org/show_bug.cgi?id=155164
http://trac.webkit.org/changeset/197994

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGOSRExit.h
Source/JavaScriptCore/dfg/DFGOSRExitCompiler32_64.cpp
Source/JavaScriptCore/dfg/DFGOSRExitCompiler64.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
Source/JavaScriptCore/tests/stress/arith-add-with-constant-overflow.js [deleted file]

index 89a23b1..77d3c4b 100644 (file)
@@ -1,3 +1,17 @@
+2016-03-11  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r197994.
+        https://bugs.webkit.org/show_bug.cgi?id=155368
+
+        Broke several ARM tests (Requested by msaboff on #webkit).
+
+        Reverted changeset:
+
+        "[JSC] Add register reuse for ArithAdd of an Int32 and
+        constant in DFG"
+        https://bugs.webkit.org/show_bug.cgi?id=155164
+        http://trac.webkit.org/changeset/197994
+
 2016-03-11  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [ES6] Implement Reflect.set without receiver support
index 37dee4b..a14d54f 100644 (file)
@@ -48,9 +48,8 @@ struct Node;
 
 // This enum describes the types of additional recovery that
 // may need be performed should a speculation check fail.
-enum SpeculationRecoveryType : uint8_t {
+enum SpeculationRecoveryType {
     SpeculativeAdd,
-    SpeculativeAddImmediate,
     BooleanSpeculationCheck
 };
 
@@ -61,34 +60,22 @@ enum SpeculationRecoveryType : uint8_t {
 class SpeculationRecovery {
 public:
     SpeculationRecovery(SpeculationRecoveryType type, GPRReg dest, GPRReg src)
-        : m_src(src)
+        : m_type(type)
         , m_dest(dest)
-        , m_type(type)
-    {
-    }
-
-    SpeculationRecovery(SpeculationRecoveryType type, GPRReg dest, int32_t immediate)
-        : m_immediate(immediate)
-        , m_dest(dest)
-        , m_type(type)
+        , m_src(src)
     {
     }
 
     SpeculationRecoveryType type() { return m_type; }
     GPRReg dest() { return m_dest; }
     GPRReg src() { return m_src; }
-    int32_t immediate() { return m_immediate; }
 
 private:
-    // different recovery types may required different additional information here.
-    union {
-        GPRReg m_src;
-        int32_t m_immediate;
-    };
-    GPRReg m_dest;
-
     // Indicates the type of additional recovery to be performed.
     SpeculationRecoveryType m_type;
+    // different recovery types may required different additional information here.
+    GPRReg m_dest;
+    GPRReg m_src;
 };
 
 // === OSRExit ===
index c3746bd..e419941 100644 (file)
@@ -56,10 +56,6 @@ void OSRExitCompiler::compileExit(const OSRExit& exit, const Operands<ValueRecov
         case SpeculativeAdd:
             m_jit.sub32(recovery->src(), recovery->dest());
             break;
-
-        case SpeculativeAddImmediate:
-            m_jit.sub32(AssemblyHelpers::Imm32(recovery->immediate()), recovery->dest());
-            break;
             
         case BooleanSpeculationCheck:
             break;
index f45c833..6999e5c 100644 (file)
@@ -61,11 +61,6 @@ void OSRExitCompiler::compileExit(const OSRExit& exit, const Operands<ValueRecov
             m_jit.sub32(recovery->src(), recovery->dest());
             m_jit.or64(GPRInfo::tagTypeNumberRegister, recovery->dest());
             break;
-
-        case SpeculativeAddImmediate:
-            m_jit.sub32(AssemblyHelpers::Imm32(recovery->immediate()), recovery->dest());
-            m_jit.or64(GPRInfo::tagTypeNumberRegister, recovery->dest());
-            break;
             
         case BooleanSpeculationCheck:
             m_jit.xor64(AssemblyHelpers::TrustedImm32(static_cast<int32_t>(ValueFalse)), recovery->dest());
index c9da093..369ca89 100644 (file)
@@ -3256,26 +3256,19 @@ void SpeculativeJIT::compileArithAdd(Node* node)
 
         if (node->child2()->isInt32Constant()) {
             SpeculateInt32Operand op1(this, node->child1());
-            GPRTemporary result(this, Reuse, op1);
-
-            GPRReg gpr1 = op1.gpr();
             int32_t imm2 = node->child2()->asInt32();
-            GPRReg gprResult = result.gpr();
 
             if (!shouldCheckOverflow(node->arithMode())) {
-                m_jit.add32(Imm32(imm2), gpr1, gprResult);
-                int32Result(gprResult, node);
+                GPRTemporary result(this, Reuse, op1);
+                m_jit.add32(Imm32(imm2), op1.gpr(), result.gpr());
+                int32Result(result.gpr(), node);
                 return;
             }
 
-            MacroAssembler::Jump check = m_jit.branchAdd32(MacroAssembler::Overflow, gpr1, Imm32(imm2), gprResult);
-            if (gpr1 == gprResult) {
-                speculationCheck(Overflow, JSValueRegs(), 0, check,
-                    SpeculationRecovery(SpeculativeAddImmediate, gpr1, imm2));
-            } else
-                speculationCheck(Overflow, JSValueRegs(), 0, check);
+            GPRTemporary result(this);
+            speculationCheck(Overflow, JSValueRegs(), 0, m_jit.branchAdd32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr()));
 
-            int32Result(gprResult, node);
+            int32Result(result.gpr(), node);
             return;
         }
                 
diff --git a/Source/JavaScriptCore/tests/stress/arith-add-with-constant-overflow.js b/Source/JavaScriptCore/tests/stress/arith-add-with-constant-overflow.js
deleted file mode 100644 (file)
index ce5c381..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-function opaqueAdd(a)
-{
-    return a + 42;
-}
-noInline(opaqueAdd);
-
-// Warm up.
-for (let i = 0; i < 1e4; ++i) {
-    let result = opaqueAdd(5);
-    if (result !== 47)
-        throw "Invalid opaqueAdd(5) at i = " + i;
-}
-
-// Overflow.
-for (let i = 0; i < 1e3; ++i) {
-    for (let j = -50; j < 50; ++j) {
-        let result = opaqueAdd(2147483647 + j);
-        if (result !== 2147483689 + j)
-            throw "Invalid opaqueAdd(" + 2147483647 + j + ") at i = " + i + " j = " + j;
-    }
-}