Title: [89956] trunk/Source/_javascript_Core
Revision
89956
Author
[email protected]
Date
2011-06-28 13:47:58 -0700 (Tue, 28 Jun 2011)

Log Message

Make constant array optimisation less strict about what constitutes a constant
https://bugs.webkit.org/show_bug.cgi?id=63554

Patch by Oliver Hunt <[email protected]> on 2011-06-28
Reviewed by Gavin Barraclough.

Now allow string constants in array literals to actually be considered constant,
and so avoid codegen in array literals with strings in them.

* bytecode/CodeBlock.h:
(JSC::CodeBlock::addConstantBuffer):
(JSC::CodeBlock::constantBuffer):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::addConstantBuffer):
(JSC::BytecodeGenerator::addStringConstant):
(JSC::BytecodeGenerator::emitNewArray):
* bytecompiler/BytecodeGenerator.h:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::privateExecute):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (89955 => 89956)


--- trunk/Source/_javascript_Core/ChangeLog	2011-06-28 20:34:25 UTC (rev 89955)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-06-28 20:47:58 UTC (rev 89956)
@@ -25,6 +25,26 @@
 
         Reviewed by Oliver Hunt.
 
+        https://bugs.webkit.org/show_bug.cgi?id=63560
+        DFG_JIT allow allocation of specific machine registers
+
+        This allow us to allocate the registers necessary to perform x86
+        idiv instructions for div/mod, and may be useful for shifts, too.
+
+        * dfg/DFGJITCodeGenerator.cpp:
+        (JSC::DFG::GPRTemporary::GPRTemporary):
+        * dfg/DFGJITCodeGenerator.h:
+        (JSC::DFG::JITCodeGenerator::allocate):
+        (JSC::DFG::GPRResult::GPRResult):
+        * dfg/DFGRegisterBank.h:
+        (JSC::DFG::RegisterBank::allocateSpecific):
+        * dfg/DFGSpeculativeJIT.h:
+        (JSC::DFG::SpeculativeJIT::isInteger):
+
+2011-06-28  Gavin Barraclough  <[email protected]>
+
+        Reviewed by Oliver Hunt.
+
         https://bugs.webkit.org/show_bug.cgi?id=55040
         RegExp constructor returns the argument regexp instead of a new object
 

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator.cpp (89955 => 89956)


--- trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator.cpp	2011-06-28 20:34:25 UTC (rev 89955)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator.cpp	2011-06-28 20:47:58 UTC (rev 89956)
@@ -536,6 +536,13 @@
     m_gpr = m_jit->allocate();
 }
 
+GPRTemporary::GPRTemporary(JITCodeGenerator* jit, GPRReg specific)
+    : m_jit(jit)
+    , m_gpr(InvalidGPRReg)
+{
+    m_gpr = m_jit->allocate(specific);
+}
+
 GPRTemporary::GPRTemporary(JITCodeGenerator* jit, SpeculateIntegerOperand& op1)
     : m_jit(jit)
     , m_gpr(InvalidGPRReg)

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator.h (89955 => 89956)


--- trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator.h	2011-06-28 20:34:25 UTC (rev 89955)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator.h	2011-06-28 20:47:58 UTC (rev 89956)
@@ -116,6 +116,13 @@
             spill(spillMe);
         return gpr;
     }
+    GPRReg allocate(GPRReg specific)
+    {
+        VirtualRegister spillMe = m_gprs.allocateSpecific(specific);
+        if (spillMe != InvalidVirtualRegister)
+            spill(spillMe);
+        return specific;
+    }
     FPRReg fprAllocate()
     {
         VirtualRegister spillMe;
@@ -999,6 +1006,7 @@
 class GPRTemporary {
 public:
     GPRTemporary(JITCodeGenerator*);
+    GPRTemporary(JITCodeGenerator*, GPRReg specific);
     GPRTemporary(JITCodeGenerator*, SpeculateIntegerOperand&);
     GPRTemporary(JITCodeGenerator*, SpeculateIntegerOperand&, SpeculateIntegerOperand&);
     GPRTemporary(JITCodeGenerator*, IntegerOperand&);
@@ -1017,13 +1025,6 @@
         return m_gpr;
     }
 
-protected:
-    GPRTemporary(JITCodeGenerator* jit, GPRReg lockedGPR)
-        : m_jit(jit)
-        , m_gpr(lockedGPR)
-    {
-    }
-
 private:
     JITCodeGenerator* m_jit;
     GPRReg m_gpr;
@@ -1066,16 +1067,9 @@
 class GPRResult : public GPRTemporary {
 public:
     GPRResult(JITCodeGenerator* jit)
-        : GPRTemporary(jit, lockedResult(jit))
+        : GPRTemporary(jit, GPRInfo::returnValueGPR)
     {
     }
-
-private:
-    static GPRReg lockedResult(JITCodeGenerator* jit)
-    {
-        jit->lock(GPRInfo::returnValueGPR);
-        return GPRInfo::returnValueGPR;
-    }
 };
 
 class FPRResult : public FPRTemporary {

Modified: trunk/Source/_javascript_Core/dfg/DFGRegisterBank.h (89955 => 89956)


--- trunk/Source/_javascript_Core/dfg/DFGRegisterBank.h	2011-06-28 20:34:25 UTC (rev 89955)
+++ trunk/Source/_javascript_Core/dfg/DFGRegisterBank.h	2011-06-28 20:47:58 UTC (rev 89956)
@@ -139,6 +139,19 @@
         return allocateInternal(currentLowest, spillMe);
     }
 
+    // Allocates the given register, even if this will force a spill.
+    VirtualRegister allocateSpecific(RegID reg)
+    {
+        unsigned index = BankInfo::toIndex(reg);
+
+        ++m_data[index].lockCount;
+        VirtualRegister name = nameAtIndex(index);
+        if (name != InvalidVirtualRegister)
+            releaseAtIndex(index);
+        
+        return name;
+    }
+
     // retain/release - these methods are used to associate/disassociate names
     // with values in registers. retain should only be called on locked registers.
     void retain(RegID reg, VirtualRegister name, SpillHint spillOrder)

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h (89955 => 89956)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2011-06-28 20:34:25 UTC (rev 89955)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2011-06-28 20:47:58 UTC (rev 89956)
@@ -160,6 +160,9 @@
         if (node.hasInt32Result())
             return true;
 
+        if (isInt32Constant(nodeIndex))
+            return true;
+
         VirtualRegister virtualRegister = node.virtualRegister();
         GenerationInfo& info = m_generationInfo[virtualRegister];
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to