Ignore:
Timestamp:
Jul 24, 2013, 8:59:09 PM (12 years ago)
Author:
[email protected]
Message:

fourthTier: ASSERT that commonly used not-thread-safe methods in the runtime are not being called during compilation
https://bugs.webkit.org/show_bug.cgi?id=115297

Source/JavaScriptCore:

Reviewed by Geoffrey Garen.

Put in assertions that we're not doing bad things in compilation threads. Also
factored compilation into compile+link so that even though we don't yet have
concurrent compilation, we can be explicit about which parts of DFG work are
meant to be concurrent, and which aren't.

Also fix a handful of bugs found by these assertions.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bytecode/ResolveGlobalStatus.cpp:

(JSC::computeForStructure):

  • bytecode/Watchpoint.cpp:

(JSC::WatchpointSet::add):
(JSC::InlineWatchpointSet::inflateSlow):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::~JITCompiler):
(DFG):
(JSC::DFG::JITCompiler::compileBody):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compileFunction):
(JSC::DFG::JITCompiler::linkFunction):

  • dfg/DFGJITCompiler.h:

(JITCompiler):

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile):

  • ftl/FTLCompile.h:

(FTL):

  • ftl/FTLLink.cpp: Added.

(FTL):
(JSC::FTL::compileEntry):
(JSC::FTL::link):

  • ftl/FTLLink.h: Added.

(FTL):

  • ftl/FTLState.cpp:

(JSC::FTL::State::State):

  • ftl/FTLState.h:

(FTL):
(State):

  • runtime/Structure.cpp:

(JSC::Structure::get):
(JSC::Structure::prototypeChainMayInterceptStoreTo):

  • runtime/Structure.h:

(JSC::Structure::materializePropertyMapIfNecessary):

  • runtime/StructureInlines.h:

(JSC::Structure::get):

Source/WTF:

Reviewed by Geoffrey Garen.

Taught WTF the notion of compilation threads. This allows all parts of our stack
to assert that we're not being called from a JSC compilation thread. This is in
WTF because it will probably end up being used in StringImpl and WTFString.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/CompilationThread.cpp: Added.

(WTF):
(WTF::initializeCompilationThreadsOnce):
(WTF::initializeCompilationThreads):
(WTF::isCompilationThread):
(WTF::exchangeIsCompilationThread):

  • wtf/CompilationThread.h: Added.

(WTF):
(CompilationScope):
(WTF::CompilationScope::CompilationScope):
(WTF::CompilationScope::~CompilationScope):
(WTF::CompilationScope::leaveEarly):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp

    r153124 r153134  
    5252#include "FTLCapabilities.h"
    5353#include "FTLCompile.h"
     54#include "FTLLink.h"
    5455#include "FTLLowerDFGToLLVM.h"
    5556#include "FTLState.h"
    5657#include "Operations.h"
    5758#include "Options.h"
     59#include <wtf/CompilationThread.h>
    5860
    5961namespace JSC { namespace DFG {
     
    8284{
    8385    SamplingRegion samplingRegion("DFG Compilation (Driver)");
     86    CompilationScope compilationScope;
    8487   
    8588    numCompilations++;
     
    175178        FTL::State state(dfg);
    176179        FTL::lowerDFGToLLVM(state);
    177         return FTL::compile(state, jitCode, *jitCodeWithArityCheck);
     180        FTL::compile(state);
     181        compilationScope.leaveEarly();
     182        return FTL::link(state, jitCode, *jitCodeWithArityCheck);
    178183    }
    179184#endif // ENABLE(FTL_JIT)
     
    187192        ASSERT(jitCodeWithArityCheck);
    188193       
    189         result = dataFlowJIT.compileFunction(jitCode, *jitCodeWithArityCheck);
     194        if (!dataFlowJIT.compileFunction())
     195            return false;
     196        compilationScope.leaveEarly();
     197        result = dataFlowJIT.linkFunction(jitCode, *jitCodeWithArityCheck);
    190198    } else {
    191199        ASSERT(compileMode == CompileOther);
    192200        ASSERT(!jitCodeWithArityCheck);
    193201       
    194         result = dataFlowJIT.compile(jitCode);
     202        if (!dataFlowJIT.compile())
     203            return false;
     204        compilationScope.leaveEarly();
     205        result = dataFlowJIT.link(jitCode);
    195206    }
    196207   
Note: See TracChangeset for help on using the changeset viewer.