Ignore:
Timestamp:
Mar 8, 2011, 3:17:32 PM (14 years ago)
Author:
[email protected]
Message:

2011-03-07 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Make CodeBlock GC write barrier safe
https://bugs.webkit.org/show_bug.cgi?id=55910

In order to make CodeBlock WriteBarrier safe it was necessary
to make it have a single GC owner, and for that reason I have
made ExecutableBase a GC allocated object. This required
updating their creation routines as well as all sites that hold
a reference to them. GC objects that held Executable's have been
converted to WriteBarriers, and all other sites now use Global<>.

As an added benefit this gets rid of JSGlobalData's list of
GlobalCodeBlocks.

Perf testing shows a 0.5% progression on v8, vs. a 0.3% regression
on SunSpider. Given none of the tests that show regressions
demonstrate a regression on their own, and sampling shows up nothing.
I suspect we're just getting one or two additional gc passes at
the end of the run.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): (JSC::CodeBlock::CodeBlock): (JSC::EvalCodeCache::markAggregate): (JSC::CodeBlock::markAggregate):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::ownerExecutable): (JSC::CodeBlock::addConstant): (JSC::CodeBlock::constantRegister): (JSC::CodeBlock::getConstant): (JSC::CodeBlock::addFunctionDecl): (JSC::CodeBlock::addFunctionExpr): (JSC::GlobalCodeBlock::GlobalCodeBlock): (JSC::ExecState::r):
  • bytecode/EvalCodeCache.h: (JSC::EvalCodeCache::get):
  • bytecode/SamplingTool.h: (JSC::ScriptSampleRecord::ScriptSampleRecord):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::addConstantValue): (JSC::BytecodeGenerator::emitEqualityOp):
  • bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::makeFunction):
  • debugger/Debugger.cpp: (JSC::evaluateInGlobalCallFrame):
  • debugger/DebuggerCallFrame.cpp: (JSC::DebuggerCallFrame::evaluate):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::callEval):
  • jit/JITInlineMethods.h: (JSC::JIT::emitLoadDouble): (JSC::JIT::emitLoadInt32ToDouble):
  • jit/JITStubs.cpp: (JSC::JITThunks::JITThunks): (JSC::JITThunks::hostFunctionStub): (JSC::JITThunks::clearHostFunctionStubs):
  • jit/JITStubs.h:
  • runtime/Completion.cpp: (JSC::checkSyntax): (JSC::evaluate):
  • runtime/Executable.cpp: (JSC::EvalExecutable::EvalExecutable): (JSC::ProgramExecutable::ProgramExecutable): (JSC::FunctionExecutable::FunctionExecutable): (JSC::FunctionExecutable::~FunctionExecutable): (JSC::EvalExecutable::markChildren): (JSC::ProgramExecutable::markChildren): (JSC::FunctionExecutable::markChildren): (JSC::FunctionExecutable::fromGlobalCode):
  • runtime/Executable.h: (JSC::ExecutableBase::ExecutableBase): (JSC::ExecutableBase::createStructure): (JSC::NativeExecutable::create): (JSC::NativeExecutable::NativeExecutable): (JSC::VPtrHackExecutable::VPtrHackExecutable): (JSC::ScriptExecutable::ScriptExecutable): (JSC::EvalExecutable::create): (JSC::EvalExecutable::createStructure): (JSC::ProgramExecutable::create): (JSC::ProgramExecutable::createStructure): (JSC::FunctionExecutable::create): (JSC::FunctionExecutable::createStructure):
  • runtime/FunctionConstructor.cpp: (JSC::constructFunction):
  • runtime/Heap.cpp: (JSC::Heap::destroy): (JSC::Heap::markRoots):
  • runtime/Heap.h:
  • runtime/JSActivation.cpp: (JSC::JSActivation::JSActivation): (JSC::JSActivation::markChildren):
  • runtime/JSActivation.h: (JSC::JSActivation::JSActivationData::JSActivationData):
  • runtime/JSCell.h:
  • runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): (JSC::JSFunction::~JSFunction): (JSC::JSFunction::markChildren):
  • runtime/JSFunction.h:
  • runtime/JSGlobalData.cpp: (JSC::JSGlobalData::storeVPtrs): (JSC::JSGlobalData::JSGlobalData): (JSC::JSGlobalData::getHostFunction):
  • runtime/JSGlobalData.h:
  • runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncEval):
  • runtime/JSObject.cpp:
  • runtime/JSStaticScopeObject.cpp: (JSC::JSStaticScopeObject::markChildren):
  • runtime/JSStaticScopeObject.h: (JSC::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData): (JSC::JSStaticScopeObject::JSStaticScopeObject):
  • runtime/JSZombie.cpp: (JSC::JSZombie::leakedZombieStructure):
  • runtime/JSZombie.h: (JSC::JSZombie::createStructure):
  • runtime/MarkedSpace.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JITStubs.cpp

    r80285 r80598  
    4141#include "ExceptionHelpers.h"
    4242#include "GetterSetter.h"
     43#include "Global.h"
    4344#include "JIT.h"
    4445#include "JSActivation.h"
     
    680681
    681682JITThunks::JITThunks(JSGlobalData* globalData)
     683    : m_hostFunctionStubMap(new HostFunctionStubMap)
    682684{
    683685    if (!globalData->executableAllocator.isValid())
     
    34843486}
    34853487
    3486 PassRefPtr<NativeExecutable> JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function)
    3487 {
    3488     std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap.add(function, 0);
     3488NativeExecutable* JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function)
     3489{
     3490    std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap->add(function, Global<NativeExecutable>(Global<NativeExecutable>::EmptyValue));
    34893491    if (entry.second)
    3490         entry.first->second = NativeExecutable::create(JIT::compileCTINativeCall(globalData, m_executablePool, function), function, ctiNativeConstruct(), callHostFunctionAsConstructor);
    3491     return entry.first->second;
    3492 }
    3493 
    3494 PassRefPtr<NativeExecutable> JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function, ThunkGenerator generator)
    3495 {
    3496     std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap.add(function, 0);
     3492        entry.first->second.set(*globalData, NativeExecutable::create(*globalData, JIT::compileCTINativeCall(globalData, m_executablePool, function), function, ctiNativeConstruct(), callHostFunctionAsConstructor));
     3493    return entry.first->second.get();
     3494}
     3495
     3496NativeExecutable* JITThunks::hostFunctionStub(JSGlobalData* globalData, NativeFunction function, ThunkGenerator generator)
     3497{
     3498    std::pair<HostFunctionStubMap::iterator, bool> entry = m_hostFunctionStubMap->add(function, Global<NativeExecutable>(Global<NativeExecutable>::EmptyValue));
    34973499    if (entry.second) {
    34983500        MacroAssemblerCodePtr code = globalData->canUseJIT() ? generator(globalData, m_executablePool.get()) : MacroAssemblerCodePtr();
    3499         entry.first->second = NativeExecutable::create(code, function, ctiNativeConstruct(), callHostFunctionAsConstructor);
    3500     }
    3501     return entry.first->second;
     3501        entry.first->second.set(*globalData, NativeExecutable::create(*globalData, code, function, ctiNativeConstruct(), callHostFunctionAsConstructor));
     3502    }
     3503    return entry.first->second.get();
     3504}
     3505
     3506void JITThunks::clearHostFunctionStubs()
     3507{
     3508    m_hostFunctionStubMap.clear();
    35023509}
    35033510
Note: See TracChangeset for help on using the changeset viewer.