Changeset 163691 in webkit


Ignore:
Timestamp:
Feb 7, 2014 9:06:33 PM (10 years ago)
Author:
fpizlo@apple.com
Message:

GC should safepoint the DFG worklist in a smarter way rather than just waiting for everything to complete
https://bugs.webkit.org/show_bug.cgi?id=128297

Reviewed by Oliver Hunt.

This makes DFG worklist threads have a rightToRun lock that gives them the ability to
be safepointed by the GC in much the same way as you'd expect from a fully
multithreaded VM.

The idea is that the worklist threads's roots are the DFG::Plan. They only touch those
roots when holding the rightToRun lock. They currently grab that lock to run the
compiler, but relinquish it when accessing - and waiting on - the worklist.

  • bytecode/CodeBlock.h:

(JSC::CodeBlockSet::mark):

  • dfg/DFGCompilationKey.cpp:

(JSC::DFG::CompilationKey::visitChildren):

  • dfg/DFGCompilationKey.h:
  • dfg/DFGDesiredStructureChains.cpp:

(JSC::DFG::DesiredStructureChains::visitChildren):

  • dfg/DFGDesiredStructureChains.h:
  • dfg/DFGDesiredTransitions.cpp:

(JSC::DFG::DesiredTransition::visitChildren):
(JSC::DFG::DesiredTransitions::visitChildren):

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

(JSC::DFG::DesiredWeakReferences::visitChildren):

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

(JSC::DFG::DesiredWriteBarrier::visitChildren):
(JSC::DFG::DesiredWriteBarriers::visitChildren):

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

(JSC::DFG::Plan::visitChildren):

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

(JSC::DFG::Worklist::~Worklist):
(JSC::DFG::Worklist::finishCreation):
(JSC::DFG::Worklist::suspendAllThreads):
(JSC::DFG::Worklist::resumeAllThreads):
(JSC::DFG::Worklist::visitChildren):
(JSC::DFG::Worklist::runThread):
(JSC::DFG::Worklist::threadFunction):

  • dfg/DFGWorklist.h:

(JSC::DFG::numberOfWorklists):
(JSC::DFG::worklistForIndexOrNull):

  • heap/CodeBlockSet.h:
  • heap/Heap.cpp:

(JSC::Heap::markRoots):
(JSC::Heap::collect):

  • runtime/IntendedStructureChain.cpp:

(JSC::IntendedStructureChain::visitChildren):

  • runtime/IntendedStructureChain.h:
  • runtime/VM.cpp:

(JSC::VM::~VM):
(JSC::VM::prepareToDiscardCode):

Location:
trunk/Source/JavaScriptCore
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r163685 r163691  
     12014-02-07  Filip Pizlo  <fpizlo@apple.com>
     2
     3        GC should safepoint the DFG worklist in a smarter way rather than just waiting for everything to complete
     4        https://bugs.webkit.org/show_bug.cgi?id=128297
     5
     6        Reviewed by Oliver Hunt.
     7       
     8        This makes DFG worklist threads have a rightToRun lock that gives them the ability to
     9        be safepointed by the GC in much the same way as you'd expect from a fully
     10        multithreaded VM.
     11       
     12        The idea is that the worklist threads's roots are the DFG::Plan. They only touch those
     13        roots when holding the rightToRun lock. They currently grab that lock to run the
     14        compiler, but relinquish it when accessing - and waiting on - the worklist.
     15
     16        * bytecode/CodeBlock.h:
     17        (JSC::CodeBlockSet::mark):
     18        * dfg/DFGCompilationKey.cpp:
     19        (JSC::DFG::CompilationKey::visitChildren):
     20        * dfg/DFGCompilationKey.h:
     21        * dfg/DFGDesiredStructureChains.cpp:
     22        (JSC::DFG::DesiredStructureChains::visitChildren):
     23        * dfg/DFGDesiredStructureChains.h:
     24        * dfg/DFGDesiredTransitions.cpp:
     25        (JSC::DFG::DesiredTransition::visitChildren):
     26        (JSC::DFG::DesiredTransitions::visitChildren):
     27        * dfg/DFGDesiredTransitions.h:
     28        * dfg/DFGDesiredWeakReferences.cpp:
     29        (JSC::DFG::DesiredWeakReferences::visitChildren):
     30        * dfg/DFGDesiredWeakReferences.h:
     31        * dfg/DFGDesiredWriteBarriers.cpp:
     32        (JSC::DFG::DesiredWriteBarrier::visitChildren):
     33        (JSC::DFG::DesiredWriteBarriers::visitChildren):
     34        * dfg/DFGDesiredWriteBarriers.h:
     35        * dfg/DFGPlan.cpp:
     36        (JSC::DFG::Plan::visitChildren):
     37        * dfg/DFGPlan.h:
     38        * dfg/DFGWorklist.cpp:
     39        (JSC::DFG::Worklist::~Worklist):
     40        (JSC::DFG::Worklist::finishCreation):
     41        (JSC::DFG::Worklist::suspendAllThreads):
     42        (JSC::DFG::Worklist::resumeAllThreads):
     43        (JSC::DFG::Worklist::visitChildren):
     44        (JSC::DFG::Worklist::runThread):
     45        (JSC::DFG::Worklist::threadFunction):
     46        * dfg/DFGWorklist.h:
     47        (JSC::DFG::numberOfWorklists):
     48        (JSC::DFG::worklistForIndexOrNull):
     49        * heap/CodeBlockSet.h:
     50        * heap/Heap.cpp:
     51        (JSC::Heap::markRoots):
     52        (JSC::Heap::collect):
     53        * runtime/IntendedStructureChain.cpp:
     54        (JSC::IntendedStructureChain::visitChildren):
     55        * runtime/IntendedStructureChain.h:
     56        * runtime/VM.cpp:
     57        (JSC::VM::~VM):
     58        (JSC::VM::prepareToDiscardCode):
     59
    1602014-02-07  Mark Lam  <mark.lam@apple.com>
    261
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r163418 r163691  
    895895
    896896    void clearDebuggerRequests() { m_debuggerRequests = 0; }
    897 
     897   
    898898    // FIXME: Make these remaining members private.
    899899
     
    12741274        return;
    12751275   
    1276     (*iter)->m_mayBeExecuting = true;
     1276    mark(*iter);
     1277}
     1278
     1279inline void CodeBlockSet::mark(CodeBlock* codeBlock)
     1280{
     1281    if (!codeBlock)
     1282        return;
     1283   
     1284    if (codeBlock->m_mayBeExecuting)
     1285        return;
     1286   
     1287    codeBlock->m_mayBeExecuting = true;
    12771288#if ENABLE(GGC)
    1278     m_currentlyExecuting.append(static_cast<CodeBlock*>(candidateCodeBlock));
     1289    m_currentlyExecuting.append(codeBlock);
    12791290#endif
    12801291}
  • trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.cpp

    r159321 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828
    2929#include "CodeBlock.h"
     30#include "CodeBlockSet.h"
    3031
    3132#if ENABLE(DFG_JIT)
     
    4243}
    4344
     45void CompilationKey::visitChildren(CodeBlockSet& codeBlocks)
     46{
     47    codeBlocks.mark(m_profiledBlock);
     48}
     49
    4450} } // namespace JSC::DFG
    4551
  • trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.h

    r154854 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333
    3434class CodeBlock;
     35class CodeBlockSet;
    3536
    3637namespace DFG {
     
    8081    }
    8182   
     83    void visitChildren(CodeBlockSet&);
     84   
    8285    void dump(PrintStream&) const;
    8386
  • trunk/Source/JavaScriptCore/dfg/DFGDesiredStructureChains.cpp

    r153146 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4343}
    4444
     45void DesiredStructureChains::visitChildren(SlotVisitor& visitor)
     46{
     47    for (unsigned i = m_vector.size(); i--;)
     48        m_vector[i]->visitChildren(visitor);
     49}
     50
    4551} } // namespace JSC::DFG
    4652
  • trunk/Source/JavaScriptCore/dfg/DFGDesiredStructureChains.h

    r157653 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4747   
    4848    bool areStillValid() const;
     49   
     50    void visitChildren(SlotVisitor&);
     51   
    4952private:
    5053    Vector<RefPtr<IntendedStructureChain>> m_vector;
  • trunk/Source/JavaScriptCore/dfg/DFGDesiredTransitions.cpp

    r154287 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5252}
    5353
     54void DesiredTransition::visitChildren(SlotVisitor& visitor)
     55{
     56    visitor.appendUnbarrieredPointer(&m_codeOriginOwner);
     57    visitor.appendUnbarrieredPointer(&m_oldStructure);
     58    visitor.appendUnbarrieredPointer(&m_newStructure);
     59}
     60
    5461DesiredTransitions::DesiredTransitions()
    5562{
     
    7178}
    7279
     80void DesiredTransitions::visitChildren(SlotVisitor& visitor)
     81{
     82    for (unsigned i = 0; i < m_transitions.size(); i++)
     83        m_transitions[i].visitChildren(visitor);
     84}
     85
    7386} } // namespace JSC::DFG
    7487
  • trunk/Source/JavaScriptCore/dfg/DFGDesiredTransitions.h

    r154287 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3535class CodeBlock;
    3636class ScriptExecutable;
     37class SlotVisitor;
    3738class Structure;
    3839class VM;
     
    4748
    4849    void reallyAdd(VM&, CommonData*);
     50   
     51    void visitChildren(SlotVisitor&);
    4952
    5053private:
     
    6265    void addLazily(CodeBlock*, ScriptExecutable*, Structure*, Structure*);
    6366    void reallyAdd(VM&, CommonData*);
     67    void visitChildren(SlotVisitor&);
    6468
    6569private:
  • trunk/Source/JavaScriptCore/dfg/DFGDesiredWeakReferences.cpp

    r154287 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3232#include "CodeBlock.h"
    3333#include "DFGCommonData.h"
     34#include "Operations.h"
    3435
    3536namespace JSC { namespace DFG {
     
    5758}
    5859
     60void DesiredWeakReferences::visitChildren(SlotVisitor& visitor)
     61{
     62    for (unsigned i = m_references.size(); i--;)
     63        visitor.appendUnbarrieredPointer(&m_references[i]);
     64}
     65
    5966} } // namespace JSC::DFG
    6067
  • trunk/Source/JavaScriptCore/dfg/DFGDesiredWeakReferences.h

    r154287 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3535class CodeBlock;
    3636class JSCell;
     37class SlotVisitor;
    3738class VM;
    3839
     
    4849    void addLazily(JSCell*);
    4950    void reallyAdd(VM&, CommonData*);
     51   
     52    void visitChildren(SlotVisitor&);
    5053
    5154private:
  • trunk/Source/JavaScriptCore/dfg/DFGDesiredWriteBarriers.cpp

    r156984 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131
    3232#include "CodeBlock.h"
    33 #include "JSCJSValueInlines.h"
     33#include "Operations.h"
    3434
    3535namespace JSC { namespace DFG {
     
    6969}
    7070
     71void DesiredWriteBarrier::visitChildren(SlotVisitor& visitor)
     72{
     73    switch (m_type) {
     74    case ConstantType: {
     75        WriteBarrier<Unknown>& barrier = m_codeBlock->constants()[m_which.index];
     76        visitor.append(&barrier);
     77        return;
     78    }
     79       
     80    case InlineCallFrameExecutableType: {
     81        InlineCallFrame* inlineCallFrame = m_which.inlineCallFrame;
     82        WriteBarrier<ScriptExecutable>& executable = inlineCallFrame->executable;
     83        visitor.append(&executable);
     84        return;
     85    } }
     86    RELEASE_ASSERT_NOT_REACHED();
     87}
     88
    7189DesiredWriteBarriers::DesiredWriteBarriers()
    7290{
     
    83101}
    84102
     103void DesiredWriteBarriers::visitChildren(SlotVisitor& visitor)
     104{
     105    for (unsigned i = 0; i < m_barriers.size(); i++)
     106        m_barriers[i].visitChildren(visitor);
     107}
     108
    85109} } // namespace JSC::DFG
    86110
  • trunk/Source/JavaScriptCore/dfg/DFGDesiredWriteBarriers.h

    r156984 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3636class JSFunction;
    3737class ScriptExecutable;
     38class SlotVisitor;
    3839class VM;
    3940struct InlineCallFrame;
     
    5152
    5253    void trigger(VM&);
     54   
     55    void visitChildren(SlotVisitor&);
    5356
    5457private:
     
    7982
    8083    void trigger(VM&);
     84   
     85    void visitChildren(SlotVisitor&);
    8186
    8287private:
  • trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp

    r163027 r163691  
    405405}
    406406
     407void Plan::visitChildren(SlotVisitor& visitor, CodeBlockSet& codeBlocks)
     408{
     409    for (unsigned i = mustHandleValues.size(); i--;)
     410        visitor.appendUnbarrieredValue(&mustHandleValues[i]);
     411   
     412    codeBlocks.mark(codeBlock.get());
     413    codeBlocks.mark(profiledDFGCodeBlock.get());
     414   
     415    chains.visitChildren(visitor);
     416    weakReferences.visitChildren(visitor);
     417    writeBarriers.visitChildren(visitor);
     418    transitions.visitChildren(visitor);
     419}
     420
    407421} } // namespace JSC::DFG
    408422
  • trunk/Source/JavaScriptCore/dfg/DFGPlan.h

    r163027 r163691  
    4747
    4848class CodeBlock;
     49class CodeBlockSet;
     50class SlotVisitor;
    4951
    5052namespace DFG {
     
    6971   
    7072    CompilationKey key();
     73   
     74    void visitChildren(SlotVisitor&, CodeBlockSet&);
    7175   
    7276    VM& vm;
  • trunk/Source/JavaScriptCore/dfg/DFGWorklist.cpp

    r163027 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5050    }
    5151    for (unsigned i = m_threads.size(); i--;)
    52         waitForThreadCompletion(m_threads[i]);
     52        waitForThreadCompletion(m_threads[i]->m_identifier);
    5353    ASSERT(!m_numberOfActiveThreads);
    5454}
     
    5757{
    5858    RELEASE_ASSERT(numberOfThreads);
    59     for (unsigned i = numberOfThreads; i--;)
    60         m_threads.append(createThread(threadFunction, this, "JSC Compilation Thread"));
     59    for (unsigned i = numberOfThreads; i--;) {
     60        std::unique_ptr<ThreadData> data = std::make_unique<ThreadData>();
     61        data->m_worklist = this;
     62        data->m_identifier = createThread(threadFunction, data.get(), "JSC Compilation Thread");
     63        m_threads.append(std::move(data));
     64    }
    6165}
    6266
     
    189193}
    190194
     195void Worklist::suspendAllThreads()
     196{
     197    for (unsigned i = m_threads.size(); i--;)
     198        m_threads[i]->m_rightToRun.lock();
     199}
     200
     201void Worklist::resumeAllThreads()
     202{
     203    for (unsigned i = m_threads.size(); i--;)
     204        m_threads[i]->m_rightToRun.unlock();
     205}
     206
     207void Worklist::visitChildren(SlotVisitor& visitor, CodeBlockSet& codeBlocks)
     208{
     209    for (PlanMap::iterator iter = m_plans.begin(); iter != m_plans.end(); ++iter) {
     210        iter->key.visitChildren(codeBlocks);
     211        iter->value->visitChildren(visitor, codeBlocks);
     212    }
     213}
     214
    191215size_t Worklist::queueLength()
    192216{
     
    209233}
    210234
    211 void Worklist::runThread()
     235void Worklist::runThread(ThreadData* data)
    212236{
    213237    CompilationScope compilationScope;
     
    224248            while (m_queue.isEmpty())
    225249                m_planEnqueued.wait(m_lock);
     250           
    226251            plan = m_queue.takeFirst();
    227252            if (plan)
     
    235260        }
    236261       
    237         if (Options::verboseCompilationQueue())
    238             dataLog(*this, ": Compiling ", plan->key(), " asynchronously\n");
    239        
    240         plan->compileInThread(longLivedState);
     262        {
     263            MutexLocker locker(data->m_rightToRun);
     264       
     265            if (Options::verboseCompilationQueue())
     266                dataLog(*this, ": Compiling ", plan->key(), " asynchronously\n");
     267       
     268            plan->compileInThread(longLivedState);
     269        }
    241270       
    242271        {
     
    259288void Worklist::threadFunction(void* argument)
    260289{
    261     static_cast<Worklist*>(argument)->runThread();
     290    ThreadData* data = static_cast<ThreadData*>(argument);
     291    data->m_worklist->runThread(data);
    262292}
    263293
  • trunk/Source/JavaScriptCore/dfg/DFGWorklist.h

    r163027 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3838#include <wtf/ThreadingPrimitives.h>
    3939
    40 namespace JSC { namespace DFG {
     40namespace JSC {
     41
     42class CodeBlockSet;
     43class SlotVisitor;
     44
     45namespace DFG {
    4146
    4247class Worklist : public RefCounted<Worklist> {
     
    6267   
    6368    size_t queueLength();
     69   
     70    void suspendAllThreads();
     71    void resumeAllThreads();
     72   
     73    void visitChildren(SlotVisitor&, CodeBlockSet&); // Only called on the main thread after suspending all threads.
     74   
    6475    void dump(PrintStream&) const;
    6576   
    6677private:
     78    struct ThreadData {
     79        Worklist* m_worklist;
     80        ThreadIdentifier m_identifier;
     81        Mutex m_rightToRun;
     82    };
     83   
    6784    Worklist();
    6885    void finishCreation(unsigned numberOfThreads);
    6986   
    70     void runThread();
     87    void runThread(ThreadData*);
    7188    static void threadFunction(void* argument);
    7289   
     
    92109    ThreadCondition m_planEnqueued;
    93110    ThreadCondition m_planCompiled;
    94     Vector<ThreadIdentifier> m_threads;
     111   
     112    Vector<std::unique_ptr<ThreadData>> m_threads;
    95113    unsigned m_numberOfActiveThreads;
    96114};
     
    106124Worklist* ensureGlobalWorklistFor(CompilationMode);
    107125
     126// Simplify doing things for all worklists.
     127inline unsigned numberOfWorklists() { return 2; }
     128inline Worklist* worklistForIndexOrNull(unsigned index)
     129{
     130    switch (index) {
     131    case 0:
     132        return existingGlobalDFGWorklistOrNull();
     133    case 1:
     134        return existingGlobalFTLWorklistOrNull();
     135    default:
     136        RELEASE_ASSERT_NOT_REACHED();
     137        return 0;
     138    }
     139}
     140
    108141} } // namespace JSC::DFG
    109142
  • trunk/Source/JavaScriptCore/heap/CodeBlockSet.h

    r163450 r163691  
    5959    // Mark a pointer that may be a CodeBlock that belongs to the set of DFG
    6060    // blocks. This is defined in CodeBlock.h.
     61    void mark(CodeBlock* candidateCodeBlock);
    6162    void mark(void* candidateCodeBlock);
    6263   
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r163576 r163691  
    525525            visitor.donateAndDrain();
    526526        }
     527        {
     528            GCPHASE(VisitDFGWorklists);
     529            MARK_LOG_ROOT(visitor, "DFG Worklists");
     530            for (unsigned i = DFG::numberOfWorklists(); i--;) {
     531                if (DFG::Worklist* worklist = DFG::worklistForIndexOrNull(i))
     532                    worklist->visitChildren(visitor, m_codeBlocks);
     533            }
     534        }
    527535#endif
    528536        {
     
    802810    RELEASE_ASSERT(m_operationInProgress == NoOperation);
    803811   
    804     {
    805         RecursiveAllocationScope scope(*this);
    806         m_vm->prepareToDiscardCode();
    807     }
     812#if ENABLE(DFG_JIT)
     813    for (unsigned i = DFG::numberOfWorklists(); i--;) {
     814        if (DFG::Worklist* worklist = DFG::worklistForIndexOrNull(i))
     815            worklist->suspendAllThreads();
     816    }
     817#endif
    808818
    809819    bool isFullCollection = m_shouldDoFullCollection;
     
    951961        HeapStatistics::showObjectStatistics(this);
    952962   
     963#if ENABLE(DFG_JIT)
     964    for (unsigned i = DFG::numberOfWorklists(); i--;) {
     965        if (DFG::Worklist* worklist = DFG::worklistForIndexOrNull(i))
     966            worklist->resumeAllThreads();
     967    }
     968#endif
     969
    953970    if (Options::logGC()) {
    954971        double after = currentTimeMS();
  • trunk/Source/JavaScriptCore/runtime/IntendedStructureChain.cpp

    r153146 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    138138}
    139139
     140void IntendedStructureChain::visitChildren(SlotVisitor& visitor)
     141{
     142    visitor.appendUnbarrieredPointer(&m_globalObject);
     143    visitor.appendUnbarrieredPointer(&m_head);
     144    for (unsigned i = m_vector.size(); i--;)
     145        visitor.appendUnbarrieredPointer(&m_vector[i]);
     146}
     147
    140148} // namespace JSC
    141149
  • trunk/Source/JavaScriptCore/runtime/IntendedStructureChain.h

    r153146 r163691  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6060   
    6161    Structure* last() const { return m_vector.last(); }
     62   
     63    void visitChildren(SlotVisitor&);
     64   
    6265private:
    6366    JSGlobalObject* m_globalObject;
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r163664 r163691  
    317317}
    318318
    319 #if ENABLE(DFG_JIT)
    320 static void cleanWorklist(VM& vm, DFG::Worklist* worklist)
    321 {
    322     if (!worklist)
    323         return;
    324     worklist->waitUntilAllPlansForVMAreReady(vm);
    325     worklist->removeAllReadyPlansForVM(vm);
    326 }
    327 #endif // ENABLE(DFG_JIT)
    328 
    329319VM::~VM()
    330320{
     
    335325    // Make sure concurrent compilations are done, but don't install them, since there is
    336326    // no point to doing so.
    337     cleanWorklist(*this, DFG::existingGlobalDFGWorklistOrNull());
    338     cleanWorklist(*this, DFG::existingGlobalFTLWorklistOrNull());
     327    for (unsigned i = DFG::numberOfWorklists(); i--;) {
     328        if (DFG::Worklist* worklist = DFG::worklistForIndexOrNull(i)) {
     329            worklist->waitUntilAllPlansForVMAreReady(*this);
     330            worklist->removeAllReadyPlansForVM(*this);
     331        }
     332    }
    339333#endif // ENABLE(DFG_JIT)
    340334   
     
    509503}
    510504
     505void VM::prepareToDiscardCode()
     506{
    511507#if ENABLE(DFG_JIT)
    512 static void prepareToDiscardCodeFor(VM& vm, DFG::Worklist* worklist)
    513 {
    514     if (!worklist)
    515         return;
    516     worklist->completeAllPlansForVM(vm);
    517 }
    518 #endif // ENABLE(DFG_JIT)
    519 
    520 void VM::prepareToDiscardCode()
    521 {
    522 #if ENABLE(DFG_JIT)
    523     prepareToDiscardCodeFor(*this, DFG::existingGlobalDFGWorklistOrNull());
    524     prepareToDiscardCodeFor(*this, DFG::existingGlobalFTLWorklistOrNull());
     508    for (unsigned i = DFG::numberOfWorklists(); i--;) {
     509        if (DFG::Worklist* worklist = DFG::worklistForIndexOrNull(i))
     510            worklist->completeAllPlansForVM(*this);
     511    }
    525512#endif // ENABLE(DFG_JIT)
    526513}
Note: See TracChangeset for help on using the changeset viewer.