[JSC] Add signExt() to FTLB3Output
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2015 20:27:37 +0000 (20:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2015 20:27:37 +0000 (20:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151853

Patch by Benjamin Poulain <bpoulain@apple.com> on 2015-12-04
Reviewed by Geoffrey Garen.

Rename signExt() to signExt32To64(). This is just to separate
it explicitly from the remaining signExt() used inside FTLOutput.

Then use the SExt32 for implementing that in B3.

* ftl/FTLB3Output.h:
(JSC::FTL::Output::signExt32To64):
(JSC::FTL::Output::signExt): Deleted.
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::DFG::LowerDFGToLLVM::compileInt52Rep):
(JSC::FTL::DFG::LowerDFGToLLVM::compileGetDirectPname):
(JSC::FTL::DFG::LowerDFGToLLVM::strictInt52ToInt32):
(JSC::FTL::DFG::LowerDFGToLLVM::strictInt52ToJSValue):
(JSC::FTL::DFG::LowerDFGToLLVM::jsValueToStrictInt52):
* ftl/FTLOutput.h:
(JSC::FTL::Output::signExt32To64):
(JSC::FTL::Output::signExt):

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/ftl/FTLB3Output.h
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
Source/JavaScriptCore/ftl/FTLOutput.h

index 3695a4a..8a2bc7d 100644 (file)
@@ -1,3 +1,28 @@
+2015-12-04  Benjamin Poulain  <bpoulain@apple.com>
+
+        [JSC] Add signExt() to FTLB3Output
+        https://bugs.webkit.org/show_bug.cgi?id=151853
+
+        Reviewed by Geoffrey Garen.
+
+        Rename signExt() to signExt32To64(). This is just to separate
+        it explicitly from the remaining signExt() used inside FTLOutput.
+
+        Then use the SExt32 for implementing that in B3.
+
+        * ftl/FTLB3Output.h:
+        (JSC::FTL::Output::signExt32To64):
+        (JSC::FTL::Output::signExt): Deleted.
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::DFG::LowerDFGToLLVM::compileInt52Rep):
+        (JSC::FTL::DFG::LowerDFGToLLVM::compileGetDirectPname):
+        (JSC::FTL::DFG::LowerDFGToLLVM::strictInt52ToInt32):
+        (JSC::FTL::DFG::LowerDFGToLLVM::strictInt52ToJSValue):
+        (JSC::FTL::DFG::LowerDFGToLLVM::jsValueToStrictInt52):
+        * ftl/FTLOutput.h:
+        (JSC::FTL::Output::signExt32To64):
+        (JSC::FTL::Output::signExt):
+
 2015-12-04  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Unskip many inspector/debugger tests
index b7ec27e..0a1a290 100644 (file)
@@ -171,7 +171,7 @@ public:
     static bool hasSensibleDoubleToInt() { CRASH(); }
     LValue sensibleDoubleToInt(LValue) { CRASH(); }
 
-    LValue signExt(LValue value, LType type) { CRASH(); }
+    LValue signExt32To64(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::SExt32, origin(), value); }
     LValue zeroExt(LValue value, LType type) { return m_block->appendNew<B3::Value>(m_proc, B3::ZExt32, type, origin(), value); }
     LValue zeroExtPtr(LValue value) { return zeroExt(value, B3::Int64); }
     LValue fpToInt(LValue value, LType type) { CRASH(); }
index 6a67523..f7a5db5 100644 (file)
@@ -1274,7 +1274,7 @@ private:
     {
         switch (m_node->child1().useKind()) {
         case Int32Use:
-            setStrictInt52(m_out.signExt(lowInt32(m_node->child1()), m_out.int64));
+            setStrictInt52(m_out.signExt32To64(lowInt32(m_node->child1())));
             return;
             
         case MachineIntUse:
@@ -5807,9 +5807,8 @@ private:
 
         m_out.appendTo(outOfLineLoad, slowCase);
         LValue storage = loadButterflyReadOnly(base);
-        LValue realIndex = m_out.signExt(
-            m_out.neg(m_out.sub(index, m_out.load32(enumerator, m_heaps.JSPropertyNameEnumerator_cachedInlineCapacity))), 
-            m_out.int64);
+        LValue realIndex = m_out.signExt32To64(
+            m_out.neg(m_out.sub(index, m_out.load32(enumerator, m_heaps.JSPropertyNameEnumerator_cachedInlineCapacity))));
         int32_t offsetOfFirstProperty = static_cast<int32_t>(offsetInButterfly(firstOutOfLineOffset)) * sizeof(EncodedJSValue);
         ValueFromBlock outOfLineResult = m_out.anchor(
             m_out.load64(m_out.baseIndex(m_heaps.properties.atAnyNumber(), storage, realIndex, ScaleEight, offsetOfFirstProperty)));
@@ -8342,7 +8341,7 @@ private:
         LValue result = m_out.castToInt32(value);
         FTL_TYPE_CHECK(
             noValue(), edge, SpecInt32,
-            m_out.notEqual(m_out.signExt(result, m_out.int64), value));
+            m_out.notEqual(m_out.signExt32To64(result), value));
         setInt32(edge.node(), result);
         return result;
     }
@@ -8362,7 +8361,7 @@ private:
             
         LValue int32Value = m_out.castToInt32(value);
         m_out.branch(
-            m_out.equal(m_out.signExt(int32Value, m_out.int64), value),
+            m_out.equal(m_out.signExt32To64(int32Value), value),
             unsure(isInt32), unsure(isDouble));
         
         LBasicBlock lastNext = m_out.appendTo(isInt32, isDouble);
@@ -8450,7 +8449,7 @@ private:
         LBasicBlock lastNext = m_out.appendTo(intCase, doubleCase);
             
         ValueFromBlock intToInt52 = m_out.anchor(
-            m_out.signExt(unboxInt32(boxedValue), m_out.int64));
+            m_out.signExt32To64(unboxInt32(boxedValue)));
         m_out.jump(continuation);
             
         m_out.appendTo(doubleCase, continuation);
index ddabc08..9a53f42 100644 (file)
@@ -211,8 +211,8 @@ public:
 
     static bool hasSensibleDoubleToInt() { return isX86(); }
     LValue sensibleDoubleToInt(LValue);
-    
-    LValue signExt(LValue value, LType type) { return buildSExt(m_builder, value, type); }
+
+    LValue signExt32To64(LValue value) { return signExt(value, int64); }
     LValue zeroExt(LValue value, LType type) { return buildZExt(m_builder, value, type); }
     LValue zeroExtPtr(LValue value) { return zeroExt(value, intPtr); }
     LValue fpToInt(LValue value, LType type) { return buildFPToSI(m_builder, value, type); }
@@ -444,6 +444,9 @@ public:
     LBuilder m_builder;
     LBasicBlock m_block;
     LBasicBlock m_nextBlock;
+
+private:
+    LValue signExt(LValue value, LType type) { return buildSExt(m_builder, value, type); }
 };
 
 inline LValue Output::load8SignExt32(TypedPointer pointer)