Changeset 167467 in webkit


Ignore:
Timestamp:
Apr 17, 2014, 4:33:32 PM (11 years ago)
Author:
fpizlo@apple.com
Message:

InlineCallFrameSet should be refcounted
https://bugs.webkit.org/show_bug.cgi?id=131829

Reviewed by Geoffrey Garen.

And DFG::Plan should hold a ref to it. Previously it was owned by Graph until it
became owned by JITCode. Except that if we're "failing" to compile, JITCode may die.
Even as it dies, the GC may still want to scan the DFG::Plan, which leads to scanning
the DesiredWriteBarriers, which leads to scanning the InlineCallFrameSet.

So, just make the darn thing refcounted.

  • bytecode/InlineCallFrameSet.h:
  • dfg/DFGArgumentsSimplificationPhase.cpp:

(JSC::DFG::ArgumentsSimplificationPhase::run):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGCommonData.h:
  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::Graph):
(JSC::DFG::Graph::requiredRegisterCountForExit):

  • dfg/DFGGraph.h:
  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):

  • dfg/DFGPlan.cpp:

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

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

(JSC::DFG::StackLayoutPhase::run):

  • ftl/FTLFail.cpp:

(JSC::FTL::fail):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

Location:
trunk/Source/JavaScriptCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r167456 r167467  
     12014-04-17  Filip Pizlo  <fpizlo@apple.com>
     2
     3        InlineCallFrameSet should be refcounted
     4        https://bugs.webkit.org/show_bug.cgi?id=131829
     5
     6        Reviewed by Geoffrey Garen.
     7       
     8        And DFG::Plan should hold a ref to it. Previously it was owned by Graph until it
     9        became owned by JITCode. Except that if we're "failing" to compile, JITCode may die.
     10        Even as it dies, the GC may still want to scan the DFG::Plan, which leads to scanning
     11        the DesiredWriteBarriers, which leads to scanning the InlineCallFrameSet.
     12       
     13        So, just make the darn thing refcounted.
     14
     15        * bytecode/InlineCallFrameSet.h:
     16        * dfg/DFGArgumentsSimplificationPhase.cpp:
     17        (JSC::DFG::ArgumentsSimplificationPhase::run):
     18        * dfg/DFGByteCodeParser.cpp:
     19        (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
     20        * dfg/DFGCommonData.h:
     21        * dfg/DFGGraph.cpp:
     22        (JSC::DFG::Graph::Graph):
     23        (JSC::DFG::Graph::requiredRegisterCountForExit):
     24        * dfg/DFGGraph.h:
     25        * dfg/DFGJITCompiler.cpp:
     26        (JSC::DFG::JITCompiler::link):
     27        * dfg/DFGPlan.cpp:
     28        (JSC::DFG::Plan::Plan):
     29        * dfg/DFGPlan.h:
     30        * dfg/DFGStackLayoutPhase.cpp:
     31        (JSC::DFG::StackLayoutPhase::run):
     32        * ftl/FTLFail.cpp:
     33        (JSC::FTL::fail):
     34        * ftl/FTLLink.cpp:
     35        (JSC::FTL::link):
     36
    1372014-04-17  Filip Pizlo  <fpizlo@apple.com>
    238
  • trunk/Source/JavaScriptCore/bytecode/InlineCallFrameSet.h

    r157576 r167467  
    2929#include "CodeOrigin.h"
    3030#include <wtf/Bag.h>
    31 #include <wtf/Noncopyable.h>
     31#include <wtf/RefCounted.h>
    3232
    3333namespace JSC {
    3434
    35 class InlineCallFrameSet {
    36     WTF_MAKE_NONCOPYABLE(InlineCallFrameSet);
     35class InlineCallFrameSet : public RefCounted<InlineCallFrameSet> {
    3736public:
    3837    InlineCallFrameSet();
  • trunk/Source/JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp

    r166281 r167467  
    123123       
    124124        // Record which arguments are known to escape no matter what.
    125         for (InlineCallFrameSet::iterator iter = m_graph.m_inlineCallFrames->begin(); !!iter; ++iter)
     125        for (InlineCallFrameSet::iterator iter = m_graph.m_plan.inlineCallFrames->begin(); !!iter; ++iter)
    126126            pruneObviousArgumentCreations(*iter);
    127127        pruneObviousArgumentCreations(0); // the machine call frame.
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r167394 r167467  
    34013401        ASSERT(callsiteBlockHead);
    34023402       
    3403         m_inlineCallFrame = byteCodeParser->m_graph.m_inlineCallFrames->add();
     3403        m_inlineCallFrame = byteCodeParser->m_graph.m_plan.inlineCallFrames->add();
    34043404        initializeLazyWriteBarrierForInlineCallFrameExecutable(
    34053405            byteCodeParser->m_graph.m_plan.writeBarriers,
  • trunk/Source/JavaScriptCore/dfg/DFGCommonData.h

    r166440 r167467  
    9090    }
    9191
    92     OwnPtr<InlineCallFrameSet> inlineCallFrames;
     92    RefPtr<InlineCallFrameSet> inlineCallFrames;
    9393    Vector<CodeOrigin, 0, UnsafeVectorOverflow> codeOrigins;
    9494   
  • trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp

    r167325 r167467  
    6262    , m_allocator(longLivedState.m_allocator)
    6363    , m_mustHandleAbstractValues(OperandsLike, plan.mustHandleValues)
    64     , m_inlineCallFrames(adoptPtr(new InlineCallFrameSet()))
    6564    , m_hasArguments(false)
    6665    , m_nextMachineLocal(0)
     
    762761{
    763762    unsigned count = JIT::frameRegisterCountFor(m_profiledBlock);
    764     for (InlineCallFrameSet::iterator iter = m_inlineCallFrames->begin(); !!iter; ++iter) {
     763    for (InlineCallFrameSet::iterator iter = m_plan.inlineCallFrames->begin(); !!iter; ++iter) {
    765764        InlineCallFrame* inlineCallFrame = *iter;
    766765        CodeBlock* codeBlock = baselineCodeBlockForInlineCallFrame(inlineCallFrame);
  • trunk/Source/JavaScriptCore/dfg/DFGGraph.h

    r167325 r167467  
    4040#include "DFGPlan.h"
    4141#include "DFGScannable.h"
    42 #include "InlineCallFrameSet.h"
    4342#include "JSStack.h"
    4443#include "MethodOfGettingAValueProfile.h"
     
    832831    Bag<MultiPutByOffsetData> m_multiPutByOffsetData;
    833832    Vector<InlineVariableData, 4> m_inlineVariableData;
    834     OwnPtr<InlineCallFrameSet> m_inlineCallFrames;
    835833    HashMap<CodeBlock*, std::unique_ptr<FullBytecodeLiveness>> m_bytecodeLiveness;
    836834    bool m_hasArguments;
  • trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp

    r166440 r167467  
    154154    m_jitCode->common.requiredRegisterCountForExit = m_graph.requiredRegisterCountForExit();
    155155
    156     if (!m_graph.m_inlineCallFrames->isEmpty())
    157         m_jitCode->common.inlineCallFrames = m_graph.m_inlineCallFrames.release();
     156    if (!m_graph.m_plan.inlineCallFrames->isEmpty())
     157        m_jitCode->common.inlineCallFrames = m_graph.m_plan.inlineCallFrames;
    158158   
    159159    m_jitCode->common.machineCaptureStart = m_graph.m_machineCaptureStart;
  • trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp

    r166948 r167467  
    121121    , mustHandleValues(mustHandleValues)
    122122    , compilation(codeBlock->vm()->m_perBytecodeProfiler ? adoptRef(new Profiler::Compilation(codeBlock->vm()->m_perBytecodeProfiler->ensureBytecodesFor(codeBlock.get()), profilerCompilationKindForMode(mode))) : 0)
     123    , inlineCallFrames(adoptRef(new InlineCallFrameSet()))
    123124    , identifiers(codeBlock.get())
    124125    , weakReferences(codeBlock.get())
  • trunk/Source/JavaScriptCore/dfg/DFGPlan.h

    r164424 r167467  
    8686    OwnPtr<Finalizer> finalizer;
    8787   
     88    RefPtr<InlineCallFrameSet> inlineCallFrames;
    8889    DesiredWatchpoints watchpoints;
    8990    DesiredIdentifiers identifiers;
  • trunk/Source/JavaScriptCore/dfg/DFGStackLayoutPhase.cpp

    r166064 r167467  
    104104        if (codeBlock()->uncheckedActivationRegister().isValid())
    105105            usedLocals.set(codeBlock()->activationRegister().toLocal());
    106         for (InlineCallFrameSet::iterator iter = m_graph.m_inlineCallFrames->begin(); !!iter; ++iter) {
     106        for (InlineCallFrameSet::iterator iter = m_graph.m_plan.inlineCallFrames->begin(); !!iter; ++iter) {
    107107            InlineCallFrame* inlineCallFrame = *iter;
    108108            if (!inlineCallFrame->executable->usesArguments())
  • trunk/Source/JavaScriptCore/ftl/FTLFail.cpp

    r167456 r167467  
    4141    state.graph.m_plan.finalizer = adoptPtr(new FailedFinalizer(state.graph.m_plan));
    4242   
    43     if (!state.graph.m_inlineCallFrames->isEmpty())
    44         state.jitCode->common.inlineCallFrames = std::move(state.graph.m_inlineCallFrames);
    45 
    4643    if (state.module)
    4744        llvm->DisposeModule(state.module);
  • trunk/Source/JavaScriptCore/ftl/FTLLink.cpp

    r165205 r167467  
    6161    state.jitCode->common.requiredRegisterCountForExit = graph.requiredRegisterCountForExit();
    6262   
    63     if (!graph.m_inlineCallFrames->isEmpty())
    64         state.jitCode->common.inlineCallFrames = std::move(graph.m_inlineCallFrames);
     63    if (!graph.m_plan.inlineCallFrames->isEmpty())
     64        state.jitCode->common.inlineCallFrames = graph.m_plan.inlineCallFrames;
    6565   
    6666    // Create the entrypoint. Note that we use this entrypoint totally differently
Note: See TracChangeset for help on using the changeset viewer.