⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 89956 in webkit


Ignore:
Timestamp:
Jun 28, 2011, 1:47:58 PM (15 years ago)
Author:
barraclough@apple.com
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 <oliver@apple.com> 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):

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r89954 r89956  
    2121        * jit/JITStubs.cpp:
    2222        (JSC::DEFINE_STUB_FUNCTION):
     23
     242011-06-28  Gavin Barraclough  <barraclough@apple.com>
     25
     26        Reviewed by Oliver Hunt.
     27
     28        https://bugs.webkit.org/show_bug.cgi?id=63560
     29        DFG_JIT allow allocation of specific machine registers
     30
     31        This allow us to allocate the registers necessary to perform x86
     32        idiv instructions for div/mod, and may be useful for shifts, too.
     33
     34        * dfg/DFGJITCodeGenerator.cpp:
     35        (JSC::DFG::GPRTemporary::GPRTemporary):
     36        * dfg/DFGJITCodeGenerator.h:
     37        (JSC::DFG::JITCodeGenerator::allocate):
     38        (JSC::DFG::GPRResult::GPRResult):
     39        * dfg/DFGRegisterBank.h:
     40        (JSC::DFG::RegisterBank::allocateSpecific):
     41        * dfg/DFGSpeculativeJIT.h:
     42        (JSC::DFG::SpeculativeJIT::isInteger):
    2343
    24442011-06-28  Gavin Barraclough  <barraclough@apple.com>
  • trunk/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.cpp

    r89861 r89956  
    537537}
    538538
     539GPRTemporary::GPRTemporary(JITCodeGenerator* jit, GPRReg specific)
     540    : m_jit(jit)
     541    , m_gpr(InvalidGPRReg)
     542{
     543    m_gpr = m_jit->allocate(specific);
     544}
     545
    539546GPRTemporary::GPRTemporary(JITCodeGenerator* jit, SpeculateIntegerOperand& op1)
    540547    : m_jit(jit)
  • trunk/Source/JavaScriptCore/dfg/DFGJITCodeGenerator.h

    r89861 r89956  
    117117        return gpr;
    118118    }
     119    GPRReg allocate(GPRReg specific)
     120    {
     121        VirtualRegister spillMe = m_gprs.allocateSpecific(specific);
     122        if (spillMe != InvalidVirtualRegister)
     123            spill(spillMe);
     124        return specific;
     125    }
    119126    FPRReg fprAllocate()
    120127    {
     
    10001007public:
    10011008    GPRTemporary(JITCodeGenerator*);
     1009    GPRTemporary(JITCodeGenerator*, GPRReg specific);
    10021010    GPRTemporary(JITCodeGenerator*, SpeculateIntegerOperand&);
    10031011    GPRTemporary(JITCodeGenerator*, SpeculateIntegerOperand&, SpeculateIntegerOperand&);
     
    10181026    }
    10191027
    1020 protected:
    1021     GPRTemporary(JITCodeGenerator* jit, GPRReg lockedGPR)
    1022         : m_jit(jit)
    1023         , m_gpr(lockedGPR)
    1024     {
    1025     }
    1026 
    10271028private:
    10281029    JITCodeGenerator* m_jit;
     
    10671068public:
    10681069    GPRResult(JITCodeGenerator* jit)
    1069         : GPRTemporary(jit, lockedResult(jit))
    1070     {
    1071     }
    1072 
    1073 private:
    1074     static GPRReg lockedResult(JITCodeGenerator* jit)
    1075     {
    1076         jit->lock(GPRInfo::returnValueGPR);
    1077         return GPRInfo::returnValueGPR;
     1070        : GPRTemporary(jit, GPRInfo::returnValueGPR)
     1071    {
    10781072    }
    10791073};
  • trunk/Source/JavaScriptCore/dfg/DFGRegisterBank.h

    r85271 r89956  
    140140    }
    141141
     142    // Allocates the given register, even if this will force a spill.
     143    VirtualRegister allocateSpecific(RegID reg)
     144    {
     145        unsigned index = BankInfo::toIndex(reg);
     146
     147        ++m_data[index].lockCount;
     148        VirtualRegister name = nameAtIndex(index);
     149        if (name != InvalidVirtualRegister)
     150            releaseAtIndex(index);
     151       
     152        return name;
     153    }
     154
    142155    // retain/release - these methods are used to associate/disassociate names
    143156    // with values in registers. retain should only be called on locked registers.
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r89084 r89956  
    161161            return true;
    162162
     163        if (isInt32Constant(nodeIndex))
     164            return true;
     165
    163166        VirtualRegister virtualRegister = node.virtualRegister();
    164167        GenerationInfo& info = m_generationInfo[virtualRegister];
Note: See TracChangeset for help on using the changeset viewer.