Changeset 154162 in webkit


Ignore:
Timestamp:
Aug 15, 2013 8:28:39 PM (11 years ago)
Author:
mhahnenberg@apple.com
Message:

<https://webkit.org/b/119833> Concurrent compilation thread should not trigger WriteBarriers

Reviewed by Oliver Hunt.

The concurrent compilation thread should interact minimally with the Heap, including not
triggering WriteBarriers. This is a prerequisite for generational GC.

(JSC::CodeBlock::addOrFindConstant):
(JSC::CodeBlock::findConstant):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::addConstantLazily):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::getJSConstantForValue):
(JSC::DFG::ByteCodeParser::constantUndefined):
(JSC::DFG::ByteCodeParser::constantNull):
(JSC::DFG::ByteCodeParser::one):
(JSC::DFG::ByteCodeParser::constantNaN):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGCommonData.cpp:

(JSC::DFG::CommonData::notifyCompilingStructureTransition):

  • dfg/DFGCommonData.h:
  • dfg/DFGDesiredTransitions.cpp: Added.

(JSC::DFG::DesiredTransition::DesiredTransition):
(JSC::DFG::DesiredTransition::reallyAdd):
(JSC::DFG::DesiredTransitions::DesiredTransitions):
(JSC::DFG::DesiredTransitions::~DesiredTransitions):
(JSC::DFG::DesiredTransitions::addLazily):
(JSC::DFG::DesiredTransitions::reallyAdd):

  • dfg/DFGDesiredTransitions.h: Added.
  • dfg/DFGDesiredWeakReferences.cpp: Added.

(JSC::DFG::DesiredWeakReferences::DesiredWeakReferences):
(JSC::DFG::DesiredWeakReferences::~DesiredWeakReferences):
(JSC::DFG::DesiredWeakReferences::addLazily):
(JSC::DFG::DesiredWeakReferences::reallyAdd):

  • dfg/DFGDesiredWeakReferences.h: Added.
  • dfg/DFGDesiredWriteBarriers.cpp: Added.

(JSC::DFG::DesiredWriteBarrier::DesiredWriteBarrier):
(JSC::DFG::DesiredWriteBarrier::trigger):
(JSC::DFG::DesiredWriteBarriers::DesiredWriteBarriers):
(JSC::DFG::DesiredWriteBarriers::~DesiredWriteBarriers):
(JSC::DFG::DesiredWriteBarriers::addImpl):
(JSC::DFG::DesiredWriteBarriers::trigger):

  • dfg/DFGDesiredWriteBarriers.h: Added.

(JSC::DFG::DesiredWriteBarriers::add):
(JSC::DFG::initializeLazyWriteBarrier):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::truncateConstantToInt32):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::convertToConstant):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::addWeakReference):

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::Plan):
(JSC::DFG::Plan::reallyAdd):

  • dfg/DFGPlan.h:
  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • runtime/WriteBarrier.h:

(JSC::WriteBarrierBase::set):
(JSC::WriteBarrier::WriteBarrier):

Location:
trunk/Source/JavaScriptCore
Files:
6 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r154127 r154162  
    101101    dfg/DFGDesiredIdentifiers.cpp
    102102    dfg/DFGDesiredStructureChains.cpp
     103    dfg/DFGDesiredTransitions.cpp
    103104    dfg/DFGDesiredWatchpoints.cpp
     105    dfg/DFGDesiredWeakReferences.cpp
     106    dfg/DFGDesiredWriteBarriers.cpp
    104107    dfg/DFGDisassembler.cpp
    105108    dfg/DFGDominators.cpp
  • trunk/Source/JavaScriptCore/ChangeLog

    r154161 r154162  
     12013-08-15  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        <https://webkit.org/b/119833> Concurrent compilation thread should not trigger WriteBarriers
     4
     5        Reviewed by Oliver Hunt.
     6
     7        The concurrent compilation thread should interact minimally with the Heap, including not
     8        triggering WriteBarriers. This is a prerequisite for generational GC.
     9
     10        * JavaScriptCore.xcodeproj/project.pbxproj:
     11        * bytecode/CodeBlock.cpp:
     12        (JSC::CodeBlock::addOrFindConstant):
     13        (JSC::CodeBlock::findConstant):
     14        * bytecode/CodeBlock.h:
     15        (JSC::CodeBlock::addConstantLazily):
     16        * dfg/DFGByteCodeParser.cpp:
     17        (JSC::DFG::ByteCodeParser::getJSConstantForValue):
     18        (JSC::DFG::ByteCodeParser::constantUndefined):
     19        (JSC::DFG::ByteCodeParser::constantNull):
     20        (JSC::DFG::ByteCodeParser::one):
     21        (JSC::DFG::ByteCodeParser::constantNaN):
     22        (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
     23        * dfg/DFGCommonData.cpp:
     24        (JSC::DFG::CommonData::notifyCompilingStructureTransition):
     25        * dfg/DFGCommonData.h:
     26        * dfg/DFGDesiredTransitions.cpp: Added.
     27        (JSC::DFG::DesiredTransition::DesiredTransition):
     28        (JSC::DFG::DesiredTransition::reallyAdd):
     29        (JSC::DFG::DesiredTransitions::DesiredTransitions):
     30        (JSC::DFG::DesiredTransitions::~DesiredTransitions):
     31        (JSC::DFG::DesiredTransitions::addLazily):
     32        (JSC::DFG::DesiredTransitions::reallyAdd):
     33        * dfg/DFGDesiredTransitions.h: Added.
     34        * dfg/DFGDesiredWeakReferences.cpp: Added.
     35        (JSC::DFG::DesiredWeakReferences::DesiredWeakReferences):
     36        (JSC::DFG::DesiredWeakReferences::~DesiredWeakReferences):
     37        (JSC::DFG::DesiredWeakReferences::addLazily):
     38        (JSC::DFG::DesiredWeakReferences::reallyAdd):
     39        * dfg/DFGDesiredWeakReferences.h: Added.
     40        * dfg/DFGDesiredWriteBarriers.cpp: Added.
     41        (JSC::DFG::DesiredWriteBarrier::DesiredWriteBarrier):
     42        (JSC::DFG::DesiredWriteBarrier::trigger):
     43        (JSC::DFG::DesiredWriteBarriers::DesiredWriteBarriers):
     44        (JSC::DFG::DesiredWriteBarriers::~DesiredWriteBarriers):
     45        (JSC::DFG::DesiredWriteBarriers::addImpl):
     46        (JSC::DFG::DesiredWriteBarriers::trigger):
     47        * dfg/DFGDesiredWriteBarriers.h: Added.
     48        (JSC::DFG::DesiredWriteBarriers::add):
     49        (JSC::DFG::initializeLazyWriteBarrier):
     50        * dfg/DFGFixupPhase.cpp:
     51        (JSC::DFG::FixupPhase::truncateConstantToInt32):
     52        * dfg/DFGGraph.h:
     53        (JSC::DFG::Graph::convertToConstant):
     54        * dfg/DFGJITCompiler.h:
     55        (JSC::DFG::JITCompiler::addWeakReference):
     56        * dfg/DFGPlan.cpp:
     57        (JSC::DFG::Plan::Plan):
     58        (JSC::DFG::Plan::reallyAdd):
     59        * dfg/DFGPlan.h:
     60        * dfg/DFGSpeculativeJIT32_64.cpp:
     61        (JSC::DFG::SpeculativeJIT::compile):
     62        * dfg/DFGSpeculativeJIT64.cpp:
     63        (JSC::DFG::SpeculativeJIT::compile):
     64        * runtime/WriteBarrier.h:
     65        (JSC::WriteBarrierBase::set):
     66        (JSC::WriteBarrier::WriteBarrier):
     67
    1682013-08-15  Benjamin Poulain  <benjamin@webkit.org>
    269
  • trunk/Source/JavaScriptCore/GNUmakefile.list.am

    r154127 r154162  
    234234        Source/JavaScriptCore/dfg/DFGDesiredStructureChains.cpp \
    235235        Source/JavaScriptCore/dfg/DFGDesiredStructureChains.h \
     236        Source/JavaScriptCore/dfg/DFGDesiredTransitions.cpp \
     237        Source/JavaScriptCore/dfg/DFGDesiredTransitions.h \
    236238        Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.cpp \
    237239        Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.h \
     240        Source/JavaScriptCore/dfg/DFGDesiredWeakReferences.cpp \
     241        Source/JavaScriptCore/dfg/DFGDesiredWeakReferences.h \
     242        Source/JavaScriptCore/dfg/DFGDesiredWriteBarriers.cpp \
     243        Source/JavaScriptCore/dfg/DFGDesiredWriteBarriers.h \
    238244        Source/JavaScriptCore/dfg/DFGDisassembler.cpp \
    239245        Source/JavaScriptCore/dfg/DFGDisassembler.h \
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r154127 r154162  
    10621062                C283190016FE4B7D00157BFD /* HandleBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = C28318FF16FE4B7D00157BFD /* HandleBlock.h */; settings = {ATTRIBUTES = (Private, ); }; };
    10631063                C283190216FE533E00157BFD /* HandleBlockInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = C283190116FE533E00157BFD /* HandleBlockInlines.h */; };
     1064                C2981FD817BAEE4B00A3BC98 /* DFGDesiredWeakReferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2981FD617BAEE4B00A3BC98 /* DFGDesiredWeakReferences.cpp */; };
     1065                C2981FD917BAEE4B00A3BC98 /* DFGDesiredWeakReferences.h in Headers */ = {isa = PBXBuildFile; fileRef = C2981FD717BAEE4B00A3BC98 /* DFGDesiredWeakReferences.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1066                C2981FDC17BAFF4400A3BC98 /* DFGDesiredWriteBarriers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2981FDA17BAFF4400A3BC98 /* DFGDesiredWriteBarriers.cpp */; };
     1067                C2981FDD17BAFF4400A3BC98 /* DFGDesiredWriteBarriers.h in Headers */ = {isa = PBXBuildFile; fileRef = C2981FDB17BAFF4400A3BC98 /* DFGDesiredWriteBarriers.h */; settings = {ATTRIBUTES = (Private, ); }; };
    10641068                C2A7F688160432D400F76B98 /* JSDestructibleObject.h in Headers */ = {isa = PBXBuildFile; fileRef = C2A7F687160432D400F76B98 /* JSDestructibleObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
    10651069                C2B916C214DA014E00CBAC86 /* MarkedAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = C2B916C114DA014E00CBAC86 /* MarkedAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
    10661070                C2B916C514DA040C00CBAC86 /* MarkedAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2B916C414DA040C00CBAC86 /* MarkedAllocator.cpp */; };
     1071                C2C0F7CD17BBFC5B00464FE4 /* DFGDesiredTransitions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2C0F7CB17BBFC5B00464FE4 /* DFGDesiredTransitions.cpp */; };
     1072                C2C0F7CE17BBFC5B00464FE4 /* DFGDesiredTransitions.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C0F7CC17BBFC5B00464FE4 /* DFGDesiredTransitions.h */; settings = {ATTRIBUTES = (Private, ); }; };
    10671073                C2C8D02D14A3C6E000578E65 /* CopiedSpaceInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C8D02B14A3C6B200578E65 /* CopiedSpaceInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
    10681074                C2C8D03014A3CEFC00578E65 /* CopiedBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C8D02E14A3CEFC00578E65 /* CopiedBlock.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    21972203                C28318FF16FE4B7D00157BFD /* HandleBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandleBlock.h; sourceTree = "<group>"; };
    21982204                C283190116FE533E00157BFD /* HandleBlockInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandleBlockInlines.h; sourceTree = "<group>"; };
     2205                C2981FD617BAEE4B00A3BC98 /* DFGDesiredWeakReferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGDesiredWeakReferences.cpp; path = dfg/DFGDesiredWeakReferences.cpp; sourceTree = "<group>"; };
     2206                C2981FD717BAEE4B00A3BC98 /* DFGDesiredWeakReferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGDesiredWeakReferences.h; path = dfg/DFGDesiredWeakReferences.h; sourceTree = "<group>"; };
     2207                C2981FDA17BAFF4400A3BC98 /* DFGDesiredWriteBarriers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGDesiredWriteBarriers.cpp; path = dfg/DFGDesiredWriteBarriers.cpp; sourceTree = "<group>"; };
     2208                C2981FDB17BAFF4400A3BC98 /* DFGDesiredWriteBarriers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGDesiredWriteBarriers.h; path = dfg/DFGDesiredWriteBarriers.h; sourceTree = "<group>"; };
    21992209                C2A7F687160432D400F76B98 /* JSDestructibleObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDestructibleObject.h; sourceTree = "<group>"; };
    22002210                C2B916C114DA014E00CBAC86 /* MarkedAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkedAllocator.h; sourceTree = "<group>"; };
    22012211                C2B916C414DA040C00CBAC86 /* MarkedAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkedAllocator.cpp; sourceTree = "<group>"; };
     2212                C2C0F7CB17BBFC5B00464FE4 /* DFGDesiredTransitions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGDesiredTransitions.cpp; path = dfg/DFGDesiredTransitions.cpp; sourceTree = "<group>"; };
     2213                C2C0F7CC17BBFC5B00464FE4 /* DFGDesiredTransitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGDesiredTransitions.h; path = dfg/DFGDesiredTransitions.h; sourceTree = "<group>"; };
    22022214                C2C8D02B14A3C6B200578E65 /* CopiedSpaceInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CopiedSpaceInlines.h; sourceTree = "<group>"; };
    22032215                C2C8D02E14A3CEFC00578E65 /* CopiedBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CopiedBlock.h; sourceTree = "<group>"; };
     
    34703482                                0FDB2CE5174830A2007B3C1B /* DFGWorklist.cpp */,
    34713483                                0FDB2CE6174830A2007B3C1B /* DFGWorklist.h */,
     3484                                C2981FD617BAEE4B00A3BC98 /* DFGDesiredWeakReferences.cpp */,
     3485                                C2981FD717BAEE4B00A3BC98 /* DFGDesiredWeakReferences.h */,
     3486                                C2981FDA17BAFF4400A3BC98 /* DFGDesiredWriteBarriers.cpp */,
     3487                                C2981FDB17BAFF4400A3BC98 /* DFGDesiredWriteBarriers.h */,
     3488                                C2C0F7CB17BBFC5B00464FE4 /* DFGDesiredTransitions.cpp */,
     3489                                C2C0F7CC17BBFC5B00464FE4 /* DFGDesiredTransitions.h */,
    34723490                        );
    34733491                        name = dfg;
     
    36773695                                0FB7F39515ED8E4600F167B2 /* ArrayConventions.h in Headers */,
    36783696                                0F63945515D07057006A597C /* ArrayProfile.h in Headers */,
     3697                                C2981FD917BAEE4B00A3BC98 /* DFGDesiredWeakReferences.h in Headers */,
     3698                                C2981FDD17BAFF4400A3BC98 /* DFGDesiredWriteBarriers.h in Headers */,
     3699                                C2C0F7CE17BBFC5B00464FE4 /* DFGDesiredTransitions.h in Headers */,
    36793700                                BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */,
    36803701                                BC18C5240E16FC8A00B34460 /* ArrayPrototype.lut.h in Headers */,
     
    49114932                                14469DE1107EC7E700650446 /* NativeErrorPrototype.cpp in Sources */,
    49124933                                148F21B7107EC5470042EC2C /* Nodes.cpp in Sources */,
     4934                                C2981FD817BAEE4B00A3BC98 /* DFGDesiredWeakReferences.cpp in Sources */,
    49134935                                655EB29B10CE2581001A990E /* NodesCodegen.cpp in Sources */,
    49144936                                14469DE2107EC7E700650446 /* NumberConstructor.cpp in Sources */,
     
    49524974                                A1712B3B11C7B212007A5315 /* RegExpCache.cpp in Sources */,
    49534975                                8642C510151C06A90046D4EF /* RegExpCachedResult.cpp in Sources */,
     4976                                C2981FDC17BAFF4400A3BC98 /* DFGDesiredWriteBarriers.cpp in Sources */,
    49544977                                14280842107EC0930013E7B2 /* RegExpConstructor.cpp in Sources */,
    49554978                                0F2B66E617B6B5AB00A7AE3F /* JSArrayBufferPrototype.cpp in Sources */,
     
    49925015                                0FF42732158EBD58004CB9FF /* UDis86Disassembler.cpp in Sources */,
    49935016                                A76F279415F13C9600517D67 /* UnlinkedCodeBlock.cpp in Sources */,
     5017                                C2C0F7CD17BBFC5B00464FE4 /* DFGDesiredTransitions.cpp in Sources */,
    49945018                                E18E3A590DF9278C00D90B34 /* VM.cpp in Sources */,
    49955019                                FE4A331F15BD2E07006F54F3 /* VMInspector.cpp in Sources */,
  • trunk/Source/JavaScriptCore/Target.pri

    r154127 r154162  
    138138    dfg/DFGDesiredIdentifiers.cpp \
    139139    dfg/DFGDesiredStructureChains.cpp \
     140    dfg/DFGDesiredTransitions.cpp \
    140141    dfg/DFGDesiredWatchpoints.cpp \
     142    dfg/DFGDesiredWeakReferences.cpp \
     143    dfg/DFGDesiredWriteBarriers.cpp \
    141144    dfg/DFGDisassembler.cpp \
    142145    dfg/DFGDominators.cpp \
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r154120 r154162  
    24902490unsigned CodeBlock::addOrFindConstant(JSValue v)
    24912491{
     2492    unsigned result;
     2493    if (findConstant(v, result))
     2494        return result;
     2495    return addConstant(v);
     2496}
     2497
     2498bool CodeBlock::findConstant(JSValue v, unsigned& index)
     2499{
    24922500    unsigned numberOfConstants = numberOfConstantRegisters();
    24932501    for (unsigned i = 0; i < numberOfConstants; ++i) {
    2494         if (getConstant(FirstConstantRegisterIndex + i) == v)
    2495             return i;
    2496     }
    2497     return addConstant(v);
     2502        if (getConstant(FirstConstantRegisterIndex + i) == v) {
     2503            index = i;
     2504            return true;
     2505        }
     2506    }
     2507    index = numberOfConstants;
     2508    return false;
    24982509}
    24992510
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r154038 r154162  
    687687    }
    688688
    689 
     689    WriteBarrier<Unknown>& addConstantLazily()
     690    {
     691        m_constantRegisters.append(WriteBarrier<Unknown>());
     692        return m_constantRegisters.last();
     693    }
     694
     695    bool findConstant(JSValue, unsigned& result);
    690696    unsigned addOrFindConstant(JSValue);
    691697    WriteBarrier<Unknown>& constantRegister(int index) { return m_constantRegisters[index - FirstConstantRegisterIndex]; }
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r154038 r154162  
    401401        return findArgumentPositionForLocal(operand);
    402402    }
     403
     404    void addConstant(JSValue value)
     405    {
     406        initializeLazyWriteBarrier(
     407            m_codeBlock->addConstantLazily(),
     408            m_graph.m_plan.writeBarriers,
     409            m_codeBlock->ownerExecutable(),
     410            value);
     411    }
    403412   
    404413    void flush(int operand)
     
    497506    Node* getJSConstantForValue(JSValue constantValue)
    498507    {
    499         unsigned constantIndex = m_codeBlock->addOrFindConstant(constantValue);
    500         if (constantIndex >= m_constants.size())
     508        unsigned constantIndex;
     509        if (!m_codeBlock->findConstant(constantValue, constantIndex)) {
     510            addConstant(constantValue);
    501511            m_constants.append(ConstantRecord());
     512        }
    502513       
    503514        ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters());
     
    568579            // Add undefined to the CodeBlock's constants, and add a corresponding slot in m_constants.
    569580            ASSERT(m_constants.size() == numberOfConstants);
    570             m_codeBlock->addConstant(jsUndefined());
     581            addConstant(jsUndefined());
    571582            m_constants.append(ConstantRecord());
    572583            ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters());
     
    593604            // Add null to the CodeBlock's constants, and add a corresponding slot in m_constants.
    594605            ASSERT(m_constants.size() == numberOfConstants);
    595             m_codeBlock->addConstant(jsNull());
     606            addConstant(jsNull());
    596607            m_constants.append(ConstantRecord());
    597608            ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters());
     
    618629            // Add the value 1 to the CodeBlock's constants, and add a corresponding slot in m_constants.
    619630            ASSERT(m_constants.size() == numberOfConstants);
    620             m_codeBlock->addConstant(jsNumber(1));
     631            addConstant(jsNumber(1));
    621632            m_constants.append(ConstantRecord());
    622633            ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters());
     
    646657            // Add the value nan to the CodeBlock's constants, and add a corresponding slot in m_constants.
    647658            ASSERT(m_constants.size() == numberOfConstants);
    648             m_codeBlock->addConstant(nan);
     659            addConstant(nan);
    649660            m_constants.append(ConstantRecord());
    650661            ASSERT(m_constants.size() == m_codeBlock->numberOfConstantRegisters());
     
    32753286       
    32763287        InlineCallFrame inlineCallFrame;
    3277         inlineCallFrame.executable.set(*byteCodeParser->m_vm, byteCodeParser->m_codeBlock->ownerExecutable(), codeBlock->ownerExecutable());
     3288        initializeLazyWriteBarrier(
     3289            inlineCallFrame.executable,
     3290            byteCodeParser->m_graph.m_plan.writeBarriers,
     3291            byteCodeParser->m_codeBlock->ownerExecutable(),
     3292            codeBlock->ownerExecutable());
    32783293        inlineCallFrame.stackOffset = inlineCallFrameStart + JSStack::CallFrameHeaderSize;
    3279         if (callee)
    3280             inlineCallFrame.callee.set(*byteCodeParser->m_vm, byteCodeParser->m_codeBlock->ownerExecutable(), callee);
     3294        if (callee) {
     3295            initializeLazyWriteBarrier(
     3296                inlineCallFrame.callee,
     3297                byteCodeParser->m_graph.m_plan.writeBarriers,
     3298                byteCodeParser->m_codeBlock->ownerExecutable(),
     3299                callee);
     3300        }
    32813301        inlineCallFrame.caller = byteCodeParser->currentCodeOrigin();
    32823302        inlineCallFrame.arguments.resize(argumentCountIncludingThis); // Set the number of arguments including this, but don't configure the value recoveries, yet.
     
    33293349                if (byteCodeParser->m_emptyJSValueIndex == UINT_MAX) {
    33303350                    byteCodeParser->m_emptyJSValueIndex = byteCodeParser->m_codeBlock->numberOfConstantRegisters() + FirstConstantRegisterIndex;
    3331                     byteCodeParser->m_codeBlock->addConstant(JSValue());
     3351                    byteCodeParser->addConstant(JSValue());
    33323352                    byteCodeParser->m_constants.append(ConstantRecord());
    33333353                }
     
    33373357            JSValueMap::AddResult result = byteCodeParser->m_jsValueMap.add(JSValue::encode(value), byteCodeParser->m_codeBlock->numberOfConstantRegisters() + FirstConstantRegisterIndex);
    33383358            if (result.isNewEntry) {
    3339                 byteCodeParser->m_codeBlock->addConstant(value);
     3359                byteCodeParser->addConstant(value);
    33403360                byteCodeParser->m_constants.append(ConstantRecord());
    33413361            }
  • trunk/Source/JavaScriptCore/dfg/DFGCommonData.cpp

    r153116 r154162  
    3131#include "CodeBlock.h"
    3232#include "DFGNode.h"
     33#include "DFGPlan.h"
    3334#include "Operations.h"
    3435#include "VM.h"
     
    3637namespace JSC { namespace DFG {
    3738
    38 void CommonData::notifyCompilingStructureTransition(CodeBlock* codeBlock, Node* node)
     39void CommonData::notifyCompilingStructureTransition(Plan& plan, CodeBlock* codeBlock, Node* node)
    3940{
    40     transitions.append(
    41         WeakReferenceTransition(
    42             *codeBlock->vm(), codeBlock->ownerExecutable(),
    43             node->codeOrigin.codeOriginOwner(),
    44             node->structureTransitionData().previousStructure,
    45             node->structureTransitionData().newStructure));
     41    plan.transitions.addLazily(
     42        codeBlock,
     43        node->codeOrigin.codeOriginOwner(),
     44        node->structureTransitionData().previousStructure,
     45        node->structureTransitionData().newStructure);
    4646}
    4747
  • trunk/Source/JavaScriptCore/dfg/DFGCommonData.h

    r153963 r154162  
    4343
    4444struct Node;
     45struct Plan;
    4546
    4647// CommonData holds the set of data that both DFG and FTL code blocks need to know
     
    7273    }
    7374   
    74     void notifyCompilingStructureTransition(CodeBlock*, Node*);
     75    void notifyCompilingStructureTransition(Plan&, CodeBlock*, Node*);
    7576   
    7677    void shrinkToFit();
  • trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp

    r154157 r154162  
    14131413        value = jsNumber(JSC::toInt32(value.asNumber()));
    14141414        ASSERT(value.isInt32());
     1415        unsigned constantRegister;
     1416        if (!codeBlock()->findConstant(value, constantRegister)) {
     1417            initializeLazyWriteBarrier(
     1418                codeBlock()->addConstantLazily(),
     1419                m_graph.m_plan.writeBarriers,
     1420                codeBlock()->ownerExecutable(),
     1421                value);
     1422        }
    14151423        edge.setNode(m_insertionSet.insertNode(
    14161424            m_indexInBlock, SpecInt32, JSConstant, m_currentNode->codeOrigin,
    1417             OpInfo(codeBlock()->addOrFindConstant(value))));
     1425            OpInfo(constantRegister)));
    14181426    }
    14191427   
  • trunk/Source/JavaScriptCore/dfg/DFGGraph.h

    r154038 r154162  
    154154    void convertToConstant(Node* node, JSValue value)
    155155    {
    156         convertToConstant(node, m_codeBlock->addOrFindConstant(value));
     156        unsigned constantRegister;
     157        if (!m_codeBlock->findConstant(value, constantRegister)) {
     158            initializeLazyWriteBarrier(
     159                m_codeBlock->addConstantLazily(),
     160                m_plan.writeBarriers,
     161                m_codeBlock->ownerExecutable(),
     162                value);
     163        }
     164        convertToConstant(node, constantRegister);
    157165    }
    158166
  • trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.h

    r153267 r154162  
    412412    void addWeakReference(JSCell* target)
    413413    {
    414         m_jitCode->common.weakReferences.append(WriteBarrier<JSCell>(m_graph.m_vm, codeBlock()->ownerExecutable(), target));
     414        m_graph.m_plan.weakReferences.addLazily(target);
    415415    }
    416416   
  • trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp

    r153967 r154162  
    9191    , compilation(codeBlock->vm()->m_perBytecodeProfiler ? adoptRef(new Profiler::Compilation(codeBlock->vm()->m_perBytecodeProfiler->ensureBytecodesFor(codeBlock.get()), Profiler::DFG)) : 0)
    9292    , identifiers(codeBlock.get())
     93    , weakReferences(codeBlock.get())
    9394    , isCompiled(false)
    9495{
     
    276277    watchpoints.reallyAdd();
    277278    identifiers.reallyAdd(vm, commonData);
     279    weakReferences.reallyAdd(vm, commonData);
     280    transitions.reallyAdd(vm, commonData);
     281    writeBarriers.trigger(vm);
    278282}
    279283
  • trunk/Source/JavaScriptCore/dfg/DFGPlan.h

    r153967 r154162  
    3232#include "DFGDesiredIdentifiers.h"
    3333#include "DFGDesiredStructureChains.h"
     34#include "DFGDesiredTransitions.h"
    3435#include "DFGDesiredWatchpoints.h"
     36#include "DFGDesiredWeakReferences.h"
     37#include "DFGDesiredWriteBarriers.h"
    3538#include "DFGFinalizer.h"
    3639#include "Operands.h"
     
    7679    DesiredIdentifiers identifiers;
    7780    DesiredStructureChains chains;
    78    
     81    DesiredWeakReferences weakReferences;
     82    DesiredWriteBarriers writeBarriers;
     83    DesiredTransitions transitions;
     84
    7985    double beforeFTL;
    8086   
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r154129 r154162  
    39763976    case PhantomPutStructure: {
    39773977        ASSERT(isKnownCell(node->child1().node()));
    3978         m_jit.jitCode()->common.notifyCompilingStructureTransition(m_jit.codeBlock(), node);
     3978        m_jit.jitCode()->common.notifyCompilingStructureTransition(m_jit.graph().m_plan, m_jit.codeBlock(), node);
    39793979        noResult(node);
    39803980        break;
     
    39823982
    39833983    case PutStructure: {
    3984         m_jit.jitCode()->common.notifyCompilingStructureTransition(m_jit.codeBlock(), node);
     3984        m_jit.jitCode()->common.notifyCompilingStructureTransition(m_jit.graph().m_plan, m_jit.codeBlock(), node);
    39853985
    39863986        SpeculateCellOperand base(this, node->child1());
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r154127 r154162  
    38973897    case PhantomPutStructure: {
    38983898        ASSERT(isKnownCell(node->child1().node()));
    3899         m_jit.jitCode()->common.notifyCompilingStructureTransition(m_jit.codeBlock(), node);
     3899        m_jit.jitCode()->common.notifyCompilingStructureTransition(m_jit.graph().m_plan, m_jit.codeBlock(), node);
    39003900        noResult(node);
    39013901        break;
     
    39033903       
    39043904    case PutStructure: {
    3905         m_jit.jitCode()->common.notifyCompilingStructureTransition(m_jit.codeBlock(), node);
     3905        m_jit.jitCode()->common.notifyCompilingStructureTransition(m_jit.graph().m_plan, m_jit.codeBlock(), node);
    39063906
    39073907        SpeculateCellOperand base(this, node->child1());
  • trunk/Source/JavaScriptCore/runtime/WriteBarrier.h

    r154038 r154162  
    3535namespace JSC {
    3636
     37namespace DFG {
     38class DesiredWriteBarrier;
     39}
     40
    3741class JSCell;
    3842class VM;
     
    7276    {
    7377        ASSERT(value);
     78        ASSERT(!Options::enableConcurrentJIT() || !isCompilationThread());
    7479        validateCell(value);
    7580        setEarlyValue(vm, owner, value);
     
    150155    void set(VM&, const JSCell* owner, JSValue value)
    151156    {
     157        ASSERT(!Options::enableConcurrentJIT() || !isCompilationThread());
    152158        m_value = JSValue::encode(value);
    153159        Heap::writeBarrier(owner, value);
     
    203209    }
    204210
     211    WriteBarrier(DFG::DesiredWriteBarrier&, T* value)
     212    {
     213        ASSERT(isCompilationThread());
     214        this->setWithoutWriteBarrier(value);
     215    }
     216
    205217    enum MayBeNullTag { MayBeNull };
    206218    WriteBarrier(VM& vm, const JSCell* owner, T* value, MayBeNullTag)
     
    221233        this->set(vm, owner, value);
    222234    }
     235
     236    WriteBarrier(DFG::DesiredWriteBarrier&, JSValue value)
     237    {
     238        ASSERT(isCompilationThread());
     239        this->setWithoutWriteBarrier(value);
     240    }
    223241};
    224242
Note: See TracChangeset for help on using the changeset viewer.