示例#1
0
VM& JSDOMWindowBase::commonVM()
{
    ASSERT(isMainThread());

    static VM* vm = nullptr;
    if (!vm) {
        ScriptController::initializeThreading();
        vm = &VM::createLeaked(LargeHeap).leakRef();
#if !PLATFORM(IOS)
        vm->setExclusiveThread(std::this_thread::get_id());
#else
        vm->heap.setFullActivityCallback(WebSafeFullGCActivityCallback::create(&vm->heap));
        vm->heap.setEdenActivityCallback(WebSafeEdenGCActivityCallback::create(&vm->heap));

        vm->heap.setIncrementalSweeper(std::make_unique<WebSafeIncrementalSweeper>(&vm->heap));
        vm->heap.machineThreads().addCurrentThread();
#endif

#if PLATFORM(MAC)
        if (applicationIsITunes() || applicationIsIBooks() || Settings::shouldRewriteConstAsVar())
            vm->setShouldRewriteConstAsVar(true);
#endif

        initNormalWorldClientData(vm);
    }

    return *vm;
}
示例#2
0
WorkerScriptController::WorkerScriptController(WorkerContext* workerContext)
    : m_globalData(JSGlobalData::create(ThreadStackTypeSmall))
    , m_workerContext(workerContext)
    , m_executionForbidden(false)
{
    initNormalWorldClientData(m_globalData.get());
}
示例#3
0
VM& JSDOMWindowBase::commonVM()
{
    ASSERT(isMainThread());

    static VM* vm = nullptr;
    if (!vm) {
        ScriptController::initializeThreading();
        vm = &VM::createLeaked(LargeHeap).leakRef();
#if !PLATFORM(IOS)
        vm->setExclusiveThread(std::this_thread::get_id());
#else
        vm->heap.setFullActivityCallback(WebSafeFullGCActivityCallback::create(&vm->heap));
#if ENABLE(GGC)
        vm->heap.setEdenActivityCallback(WebSafeEdenGCActivityCallback::create(&vm->heap));
#else
        vm->heap.setEdenActivityCallback(vm->heap.fullActivityCallback());
#endif
        vm->heap.setIncrementalSweeper(std::make_unique<WebSafeIncrementalSweeper>(&vm->heap));
        vm->heap.machineThreads().addCurrentThread();
#endif
        initNormalWorldClientData(vm);
    }

    return *vm;
}
示例#4
0
WorkerScriptController::WorkerScriptController(WorkerGlobalScope* workerGlobalScope)
    : m_vm(VM::create())
    , m_workerGlobalScope(workerGlobalScope)
    , m_workerGlobalScopeWrapper(*m_vm)
    , m_executionForbidden(false)
{
    initNormalWorldClientData(m_vm.get());
}
示例#5
0
WorkerScriptController::WorkerScriptController(WorkerContext* workerContext)
    : m_vm(VM::create())
    , m_workerContext(workerContext)
    , m_workerContextWrapper(*m_vm)
    , m_executionForbidden(false)
{
    initNormalWorldClientData(m_vm.get());
}
示例#6
0
VM* JSDOMWindowBase::commonVM()
{
    ASSERT(isMainThread());

    static VM* vm = 0;
    if (!vm) {
        ScriptController::initializeThreading();
        vm = VM::createLeaked(LargeHeap).leakRef();
        vm->exclusiveThread = currentThread();
        initNormalWorldClientData(vm);
    }

    return vm;
}
示例#7
0
JSGlobalData* JSDOMWindowBase::commonJSGlobalData()
{
    ASSERT(isMainThread());

    static JSGlobalData* globalData = 0;
    if (!globalData) {
        globalData = JSGlobalData::createLeaked(ThreadStackTypeLarge, LargeHeap).leakRef();
        globalData->timeoutChecker.setTimeoutInterval(10000); // 10 seconds
#ifndef NDEBUG
        globalData->exclusiveThread = currentThread();
#endif
        initNormalWorldClientData(globalData);
    }

    return globalData;
}
示例#8
0
VM& JSDOMWindowBase::commonVM()
{
    ASSERT(isMainThread());

    static VM* vm = nullptr;
    if (!vm) {
        ScriptController::initializeThreading();
        vm = VM::createLeaked(LargeHeap).leakRef();
#if !PLATFORM(IOS)
        vm->setExclusiveThread(std::this_thread::get_id());
#else
        vm->heap.setActivityCallback(WebSafeGCActivityCallback::create(&vm->heap));
        vm->heap.setIncrementalSweeper(WebSafeIncrementalSweeper::create(&vm->heap));
        vm->makeUsableFromMultipleThreads();
        vm->heap.machineThreads().addCurrentThread();
#endif
        initNormalWorldClientData(vm);
    }

    return *vm;
}
示例#9
0
VM& commonVMSlow()
{
    ASSERT(isMainThread());
    ASSERT(!g_commonVMOrNull);
    
    ScriptController::initializeThreading();
    g_commonVMOrNull = &VM::createLeaked(LargeHeap).leakRef();
    g_commonVMOrNull->heap.acquireAccess(); // At any time, we may do things that affect the GC.
#if !PLATFORM(IOS)
    g_commonVMOrNull->setExclusiveThread(std::this_thread::get_id());
#else
    g_commonVMOrNull->heap.setRunLoop(WebThreadRunLoop());
    g_commonVMOrNull->heap.machineThreads().addCurrentThread();
#endif
    
    g_commonVMOrNull->setGlobalConstRedeclarationShouldThrow(Settings::globalConstRedeclarationShouldThrow());
    g_commonVMOrNull->heap.addMutatorShouldBeFencedCache(g_opaqueRootWriteBarrierEnabled);
    
    initNormalWorldClientData(g_commonVMOrNull);
    
    return *g_commonVMOrNull;
}