Title: [184569] branches/safari-601.1.32.2-branch/Source/_javascript_Core

Diff

Modified: branches/safari-601.1.32.2-branch/Source/_javascript_Core/ChangeLog (184568 => 184569)


--- branches/safari-601.1.32.2-branch/Source/_javascript_Core/ChangeLog	2015-05-19 16:46:29 UTC (rev 184568)
+++ branches/safari-601.1.32.2-branch/Source/_javascript_Core/ChangeLog	2015-05-19 16:46:33 UTC (rev 184569)
@@ -1,5 +1,29 @@
 2015-05-18  Matthew Hanson  <[email protected]>
 
+        Merge r184542. rdar://problem/20679710
+
+    2015-05-18  Filip Pizlo  <[email protected]>
+
+            Better optimize 'if' with ternaries conditional tests.
+            https://bugs.webkit.org/show_bug.cgi?id=144136
+
+            Reviewed by Benjamin Poulain.
+
+            This is the last fix I'll do for this for now. BooleanToNumber(Untyped:) where the input
+            is proved to be either BoolInt32 or Boolean should be optimized to just masking the
+            lowest bit.
+
+            This is another 37% speed-up on JSRegress/slow-ternaries.
+
+            * dfg/DFGSpeculativeJIT32_64.cpp:
+            (JSC::DFG::SpeculativeJIT::compile):
+            * dfg/DFGSpeculativeJIT64.cpp:
+            (JSC::DFG::SpeculativeJIT::compile):
+            * ftl/FTLLowerDFGToLLVM.cpp:
+            (JSC::FTL::LowerDFGToLLVM::compileBooleanToNumber):
+
+2015-05-18  Matthew Hanson  <[email protected]>
+
         Merge r184540. rdar://problem/20679710
 
     2015-05-18  Filip Pizlo  <[email protected]>

Modified: branches/safari-601.1.32.2-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp (184568 => 184569)


--- branches/safari-601.1.32.2-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2015-05-19 16:46:29 UTC (rev 184568)
+++ branches/safari-601.1.32.2-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2015-05-19 16:46:33 UTC (rev 184569)
@@ -3029,6 +3029,18 @@
             
         case UntypedUse: {
             JSValueOperand value(this, node->child1());
+            
+            if (!m_interpreter.needsTypeCheck(node->child1(), SpecBoolInt32 | SpecBoolean)) {
+                GPRTemporary result(this);
+                
+                GPRReg valueGPR = value.payloadGPR();
+                GPRReg resultGPR = result.gpr();
+                
+                m_jit.move(valueGPR, resultGPR);
+                int32Result(result.gpr(), node);
+                break;
+            }
+            
             GPRTemporary resultTag(this);
             GPRTemporary resultPayload(this);
             

Modified: branches/safari-601.1.32.2-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (184568 => 184569)


--- branches/safari-601.1.32.2-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2015-05-19 16:46:29 UTC (rev 184568)
+++ branches/safari-601.1.32.2-branch/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2015-05-19 16:46:33 UTC (rev 184569)
@@ -3136,6 +3136,13 @@
             JSValueOperand value(this, node->child1());
             GPRTemporary result(this);
             
+            if (!m_interpreter.needsTypeCheck(node->child1(), SpecBoolInt32 | SpecBoolean)) {
+                m_jit.move(value.gpr(), result.gpr());
+                m_jit.and32(TrustedImm32(1), result.gpr());
+                int32Result(result.gpr(), node);
+                break;
+            }
+            
             m_jit.move(value.gpr(), result.gpr());
             m_jit.xor64(TrustedImm32(static_cast<int32_t>(ValueFalse)), result.gpr());
             JITCompiler::Jump isBoolean = m_jit.branchTest64(

Modified: branches/safari-601.1.32.2-branch/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (184568 => 184569)


--- branches/safari-601.1.32.2-branch/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2015-05-19 16:46:29 UTC (rev 184568)
+++ branches/safari-601.1.32.2-branch/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2015-05-19 16:46:33 UTC (rev 184569)
@@ -1068,6 +1068,11 @@
         case UntypedUse: {
             LValue value = lowJSValue(m_node->child1());
             
+            if (!m_interpreter.needsTypeCheck(m_node->child1(), SpecBoolInt32 | SpecBoolean)) {
+                setInt32(m_out.bitAnd(m_out.castToInt32(value), m_out.int32One));
+                return;
+            }
+            
             LBasicBlock booleanCase = FTL_NEW_BLOCK(m_out, ("BooleanToNumber boolean case"));
             LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("BooleanToNumber continuation"));
             
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to