Title: [150661] branches/dfgFourthTier/Source/_javascript_Core
Revision
150661
Author
[email protected]
Date
2013-05-24 15:27:57 -0700 (Fri, 24 May 2013)

Log Message

fourthTier: FTL boolify should support ObjectOrOtherUse
https://bugs.webkit.org/show_bug.cgi?id=116741

Reviewed by Geoffrey Garen.
        
Just reusing what was already there in equalNullOrUndefined(). Note that we will
sometimes generate some redundant IR - like having some spurious bitNot's in
places - but it's safe to assume that LLVM will simplify those, and that it won't
be the longest pole in the tent for compile times.

* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant):
(JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant):
(JSC::FTL::LowerDFGToLLVM::boolify):
(JSC::FTL::LowerDFGToLLVM::equalNullOrUndefined):

Modified Paths

Diff

Modified: branches/dfgFourthTier/Source/_javascript_Core/ChangeLog (150660 => 150661)


--- branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-05-24 22:05:57 UTC (rev 150660)
+++ branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-05-24 22:27:57 UTC (rev 150661)
@@ -1,5 +1,25 @@
 2013-05-24  Filip Pizlo  <[email protected]>
 
+        fourthTier: FTL boolify should support ObjectOrOtherUse
+        https://bugs.webkit.org/show_bug.cgi?id=116741
+
+        Reviewed by Geoffrey Garen.
+        
+        Just reusing what was already there in equalNullOrUndefined(). Note that we will
+        sometimes generate some redundant IR - like having some spurious bitNot's in
+        places - but it's safe to assume that LLVM will simplify those, and that it won't
+        be the longest pole in the tent for compile times.
+
+        * ftl/FTLCapabilities.cpp:
+        (JSC::FTL::canCompile):
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::LowerDFGToLLVM::compileCompareEqConstant):
+        (JSC::FTL::LowerDFGToLLVM::compileCompareStrictEqConstant):
+        (JSC::FTL::LowerDFGToLLVM::boolify):
+        (JSC::FTL::LowerDFGToLLVM::equalNullOrUndefined):
+
+2013-05-24  Filip Pizlo  <[email protected]>
+
         fourthTier: FTL should support LogicalNot and Branch on Int32 and Number
         https://bugs.webkit.org/show_bug.cgi?id=116739
 

Modified: branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLCapabilities.cpp (150660 => 150661)


--- branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLCapabilities.cpp	2013-05-24 22:05:57 UTC (rev 150660)
+++ branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLCapabilities.cpp	2013-05-24 22:27:57 UTC (rev 150661)
@@ -128,6 +128,7 @@
         case BooleanUse:
         case Int32Use:
         case NumberUse:
+        case ObjectOrOtherUse:
             break;
         default:
             return false;
@@ -165,6 +166,7 @@
                 case CellUse:
                 case KnownCellUse:
                 case ObjectUse:
+                case ObjectOrOtherUse:
                     // These are OK.
                     break;
                 default:

Modified: branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (150660 => 150661)


--- branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2013-05-24 22:05:57 UTC (rev 150660)
+++ branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2013-05-24 22:27:57 UTC (rev 150661)
@@ -990,7 +990,9 @@
     {
         ASSERT(m_graph.valueOfJSConstant(m_node->child2().node()).isNull());
         masqueradesAsUndefinedWatchpointIfIsStillValid();
-        equalNullOrUndefined(m_node->child1(), EqualNullOrUndefined);
+        m_booleanValues.add(
+            m_node, equalNullOrUndefined(
+                m_node->child1(), AllCellsAreFalse, EqualNullOrUndefined));
     }
     
     void compileCompareStrictEq()
@@ -1028,12 +1030,14 @@
         if (constant.isUndefinedOrNull()
             && !masqueradesAsUndefinedWatchpointIfIsStillValid()) {
             if (constant.isNull()) {
-                equalNullOrUndefined(m_node->child1(), EqualNull);
+                m_booleanValues.add(
+                    m_node, equalNullOrUndefined(m_node->child1(), AllCellsAreFalse, EqualNull));
                 return;
             }
         
             ASSERT(constant.isUndefined());
-            equalNullOrUndefined(m_node->child1(), EqualUndefined);
+            m_booleanValues.add(
+                m_node, equalNullOrUndefined(m_node->child1(), AllCellsAreFalse, EqualUndefined));
             return;
         }
         
@@ -1163,22 +1167,38 @@
             return m_out.notZero32(lowInt32(m_node->child1()));
         case NumberUse:
             return m_out.doubleNotEqual(lowDouble(edge), m_out.doubleZero);
+        case ObjectOrOtherUse:
+            return m_out.bitNot(
+                equalNullOrUndefined(
+                    edge, CellCaseSpeculatesObject, SpeculateNullOrUndefined,
+                    ManualOperandSpeculation));
         default:
             RELEASE_ASSERT_NOT_REACHED();
             return 0;
         }
     }
     
-    enum EqualNullOrUndefinedMode { EqualNull, EqualUndefined, EqualNullOrUndefined };
-    void equalNullOrUndefined(Edge edge, EqualNullOrUndefinedMode mode)
+    enum StringOrObjectMode {
+        AllCellsAreFalse,
+        CellCaseSpeculatesObject
+    };
+    enum EqualNullOrUndefinedMode {
+        EqualNull,
+        EqualUndefined,
+        EqualNullOrUndefined,
+        SpeculateNullOrUndefined
+    };
+    LValue equalNullOrUndefined(
+        Edge edge, StringOrObjectMode cellMode, EqualNullOrUndefinedMode primitiveMode,
+        OperandSpeculationMode operandMode = AutomaticOperandSpeculation)
     {
         bool validWatchpoint = masqueradesAsUndefinedWatchpointIsStillValid();
         
-        LValue value = lowJSValue(edge);
+        LValue value = lowJSValue(edge, operandMode);
         
-        LBasicBlock cellCase = FTL_NEW_BLOCK(m_out, ("CompareEqConstant cell case"));
-        LBasicBlock primitiveCase = FTL_NEW_BLOCK(m_out, ("CompareEqConstant primitive case"));
-        LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("CompareEqConstant continuation"));
+        LBasicBlock cellCase = FTL_NEW_BLOCK(m_out, ("EqualNullOrUndefined cell case"));
+        LBasicBlock primitiveCase = FTL_NEW_BLOCK(m_out, ("EqualNullOrUndefined primitive case"));
+        LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("EqualNullOrUndefined continuation"));
         
         m_out.branch(isNotCell(value), primitiveCase, cellCase);
         
@@ -1186,12 +1206,24 @@
         
         Vector<ValueFromBlock, 3> results;
         
+        switch (cellMode) {
+        case AllCellsAreFalse:
+            break;
+        case CellCaseSpeculatesObject:
+            FTL_TYPE_CHECK(
+                jsValueValue(value), edge, (~SpecCell) | SpecObject,
+                m_out.equal(
+                    m_out.loadPtr(value, m_heaps.JSCell_structure),
+                    m_out.constIntPtr(vm().stringStructure.get())));
+            break;
+        }
+        
         if (validWatchpoint) {
             results.append(m_out.anchor(m_out.booleanFalse));
             m_out.jump(continuation);
         } else {
             LBasicBlock masqueradesCase =
-                FTL_NEW_BLOCK(m_out, ("CompareEqConstant masquerades case"));
+                FTL_NEW_BLOCK(m_out, ("EqualNullOrUndefined masquerades case"));
                 
             LValue structure = m_out.loadPtr(value, m_heaps.JSCell_structure);
             
@@ -1215,7 +1247,7 @@
         m_out.appendTo(primitiveCase, continuation);
         
         LValue primitiveResult;
-        switch (mode) {
+        switch (primitiveMode) {
         case EqualNull:
             primitiveResult = m_out.equal(value, m_out.constInt64(ValueNull));
             break;
@@ -1227,13 +1259,21 @@
                 m_out.bitAnd(value, m_out.constInt64(~TagBitUndefined)),
                 m_out.constInt64(ValueNull));
             break;
+        case SpeculateNullOrUndefined:
+            FTL_TYPE_CHECK(
+                jsValueValue(value), edge, SpecCell | SpecOther,
+                m_out.notEqual(
+                    m_out.bitAnd(value, m_out.constInt64(~TagBitUndefined)),
+                    m_out.constInt64(ValueNull)));
+            primitiveResult = m_out.booleanTrue;
+            break;
         }
         results.append(m_out.anchor(primitiveResult));
         m_out.jump(continuation);
         
         m_out.appendTo(continuation, lastNext);
         
-        m_booleanValues.add(m_node, m_out.phi(m_out.boolean, results));
+        return m_out.phi(m_out.boolean, results);
     }
     
     void speculateBackward(
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to