Commit e2f27917 authored by ggaren@apple.com's avatar ggaren@apple.com

Removed ENABLE_JSC_MULTIPLE_THREADS and related #ifdefs.

https://bugs.webkit.org/show_bug.cgi?id=68422
        
As discussed on webkit-dev. All ports build with threads enabled in JSC now.
        
This may break WinCE and other ports that have not built and tested with
this configuration. I've filed bugs for port maintainers. It's time for
WebKit to move forward.

Reviewed by Sam Weinig.

* API/APIShims.h:
(JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
* API/JSContextRef.cpp:
* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::MachineThreads):
(JSC::MachineThreads::~MachineThreads):
(JSC::MachineThreads::gatherConservativeRoots):
* heap/MachineStackMarker.h:
* runtime/InitializeThreading.cpp:
(JSC::initializeThreadingOnce):
(JSC::initializeThreading):
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::sharedInstance):
* runtime/JSGlobalData.h:
(JSC::JSGlobalData::makeUsableFromMultipleThreads):
* runtime/JSLock.cpp:
* runtime/Structure.cpp:
* wtf/Platform.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95510 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b03eb35f
......@@ -40,10 +40,8 @@ protected:
, m_entryIdentifierTable(wtfThreadData().setCurrentIdentifierTable(globalData->identifierTable))
{
UNUSED_PARAM(registerThread);
#if ENABLE(JSC_MULTIPLE_THREADS)
if (registerThread)
globalData->heap.machineThreads().addCurrentThread();
#endif
m_globalData->heap.activityCallback()->synchronize();
m_globalData->timeoutChecker.start();
}
......
......@@ -92,9 +92,7 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass
APIEntryShim entryShim(globalData.get(), false);
#if ENABLE(JSC_MULTIPLE_THREADS)
globalData->makeUsableFromMultipleThreads();
#endif
if (!globalObjectClass) {
JSGlobalObject* globalObject = JSGlobalObject::create(*globalData, JSGlobalObject::createStructure(*globalData, jsNull()));
......
2011-09-19 Geoffrey Garen <ggaren@apple.com>
Removed ENABLE_JSC_MULTIPLE_THREADS and related #ifdefs.
https://bugs.webkit.org/show_bug.cgi?id=68422
As discussed on webkit-dev. All ports build with threads enabled in JSC now.
This may break WinCE and other ports that have not built and tested with
this configuration. I've filed bugs for port maintainers. It's time for
WebKit to move forward.
Reviewed by Sam Weinig.
* API/APIShims.h:
(JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
* API/JSContextRef.cpp:
* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::MachineThreads):
(JSC::MachineThreads::~MachineThreads):
(JSC::MachineThreads::gatherConservativeRoots):
* heap/MachineStackMarker.h:
* runtime/InitializeThreading.cpp:
(JSC::initializeThreadingOnce):
(JSC::initializeThreading):
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::sharedInstance):
* runtime/JSGlobalData.h:
(JSC::JSGlobalData::makeUsableFromMultipleThreads):
* runtime/JSLock.cpp:
* runtime/Structure.cpp:
* wtf/Platform.h:
2011-09-19 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r95493 and r95496.
......@@ -76,7 +76,7 @@
#include <errno.h>
#endif
#if ENABLE(JSC_MULTIPLE_THREADS) && USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN)
#if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN)
#include <signal.h>
#endif
......@@ -98,8 +98,6 @@ UNUSED_PARAM(end);
#endif
}
#if ENABLE(JSC_MULTIPLE_THREADS)
#if OS(DARWIN)
typedef mach_port_t PlatformThread;
#elif OS(WINDOWS)
......@@ -145,20 +143,15 @@ public:
void* stackBase;
};
#endif
MachineThreads::MachineThreads(Heap* heap)
: m_heap(heap)
#if ENABLE(JSC_MULTIPLE_THREADS)
, m_registeredThreads(0)
, m_threadSpecific(0)
#endif
{
}
MachineThreads::~MachineThreads()
{
#if ENABLE(JSC_MULTIPLE_THREADS)
if (m_threadSpecific) {
int error = pthread_key_delete(m_threadSpecific);
ASSERT_UNUSED(error, !error);
......@@ -170,11 +163,8 @@ MachineThreads::~MachineThreads()
delete t;
t = next;
}
#endif
}
#if ENABLE(JSC_MULTIPLE_THREADS)
static inline PlatformThread getCurrentPlatformThread()
{
#if OS(DARWIN)
......@@ -243,8 +233,6 @@ void MachineThreads::removeCurrentThread()
}
}
#endif
#if COMPILER(GCC)
#define REGISTER_BUFFER_ALIGNMENT __attribute__ ((aligned (sizeof(void*))))
#else
......@@ -275,8 +263,6 @@ void MachineThreads::gatherFromCurrentThread(ConservativeRoots& conservativeRoot
conservativeRoots.add(stackBegin, stackEnd);
}
#if ENABLE(JSC_MULTIPLE_THREADS)
static inline void suspendThread(const PlatformThread& platformThread)
{
#if OS(DARWIN)
......@@ -482,14 +468,10 @@ void MachineThreads::gatherFromOtherThread(ConservativeRoots& conservativeRoots,
freePlatformThreadRegisters(regs);
}
#endif
void MachineThreads::gatherConservativeRoots(ConservativeRoots& conservativeRoots, void* stackCurrent)
{
gatherFromCurrentThread(conservativeRoots, stackCurrent);
#if ENABLE(JSC_MULTIPLE_THREADS)
if (m_threadSpecific) {
MutexLocker lock(m_registeredThreadsMutex);
......@@ -510,7 +492,6 @@ void MachineThreads::gatherConservativeRoots(ConservativeRoots& conservativeRoot
fastMallocAllow();
#endif
}
#endif
}
} // namespace JSC
......@@ -22,13 +22,10 @@
#ifndef MachineThreads_h
#define MachineThreads_h
#include <pthread.h>
#include <wtf/Noncopyable.h>
#include <wtf/ThreadingPrimitives.h>
#if ENABLE(JSC_MULTIPLE_THREADS)
#include <pthread.h>
#endif
namespace JSC {
class Heap;
......@@ -42,30 +39,23 @@ namespace JSC {
void gatherConservativeRoots(ConservativeRoots&, void* stackCurrent);
#if ENABLE(JSC_MULTIPLE_THREADS)
void makeUsableFromMultipleThreads();
void addCurrentThread(); // Only needs to be called by clients that can use the same heap from multiple threads.
#endif
private:
void gatherFromCurrentThread(ConservativeRoots&, void* stackCurrent);
#if ENABLE(JSC_MULTIPLE_THREADS)
class Thread;
static void removeThread(void*);
void removeCurrentThread();
void gatherFromOtherThread(ConservativeRoots&, Thread*);
#endif
Heap* m_heap;
#if ENABLE(JSC_MULTIPLE_THREADS)
Mutex m_registeredThreadsMutex;
Thread* m_registeredThreads;
pthread_key_t m_threadSpecific;
#endif
};
} // namespace JSC
......
......@@ -44,7 +44,7 @@ using namespace WTF;
namespace JSC {
#if OS(DARWIN) && ENABLE(JSC_MULTIPLE_THREADS)
#if OS(DARWIN)
static pthread_once_t initializeThreadingKeyOnce = PTHREAD_ONCE_INIT;
#endif
......@@ -59,14 +59,12 @@ static void initializeThreadingOnce()
#if ENABLE(JIT) && ENABLE(ASSEMBLER)
ExecutableAllocator::initializeAllocator();
#endif
#if ENABLE(JSC_MULTIPLE_THREADS)
RegisterFile::initializeThreading();
#endif
}
void initializeThreading()
{
#if OS(DARWIN) && ENABLE(JSC_MULTIPLE_THREADS)
#if OS(DARWIN)
pthread_once(&initializeThreadingKeyOnce, initializeThreadingOnce);
#else
static bool initializedThreading = false;
......
......@@ -50,19 +50,14 @@
#include "Lookup.h"
#include "Nodes.h"
#include "Parser.h"
#include "RegExpCache.h"
#include "RegExpObject.h"
#include "StrictEvalActivation.h"
#include <wtf/WTFThreadData.h>
#if ENABLE(REGEXP_TRACING)
#include "RegExp.h"
#endif
#if ENABLE(JSC_MULTIPLE_THREADS)
#include "RegExpCache.h"
#include "RegExpObject.h"
#include "StrictEvalActivation.h"
#include <wtf/Threading.h>
#endif
#include <wtf/WTFThreadData.h>
#if PLATFORM(MAC)
#include <CoreFoundation/CoreFoundation.h>
#endif
......@@ -387,9 +382,7 @@ JSGlobalData& JSGlobalData::sharedInstance()
JSGlobalData*& instance = sharedInstanceInternal();
if (!instance) {
instance = adoptRef(new JSGlobalData(APIShared, ThreadStackTypeSmall, SmallHeap)).leakRef();
#if ENABLE(JSC_MULTIPLE_THREADS)
instance->makeUsableFromMultipleThreads();
#endif
}
return *instance;
}
......
......@@ -129,10 +129,7 @@ namespace JSC {
static PassRefPtr<JSGlobalData> createContextGroup(ThreadStackType, HeapSize = SmallHeap);
~JSGlobalData();
#if ENABLE(JSC_MULTIPLE_THREADS)
// Will start tracking threads that use the heap, which is resource-heavy.
void makeUsableFromMultipleThreads() { heap.machineThreads().makeUsableFromMultipleThreads(); }
#endif
GlobalDataType globalDataType;
ClientData* clientData;
......
......@@ -35,7 +35,7 @@ namespace JSC {
// JSLock is only needed to support an obsolete execution model where JavaScriptCore
// automatically protected against concurrent access from multiple threads.
// So it's safe to disable it on non-mac platforms where we don't have native pthreads.
#if ENABLE(JSC_MULTIPLE_THREADS) && (OS(DARWIN) || USE(PTHREADS))
#if (OS(DARWIN) || USE(PTHREADS))
// Acquire this mutex before accessing lock-related data.
static pthread_mutex_t JSMutex = PTHREAD_MUTEX_INITIALIZER;
......@@ -213,7 +213,7 @@ JSLock::DropAllLocks::~DropAllLocks()
--lockDropDepth;
}
#else // ENABLE(JSC_MULTIPLE_THREADS) && (OS(DARWIN) || USE(PTHREADS))
#else // (OS(DARWIN) || USE(PTHREADS))
JSLock::JSLock(ExecState*)
: m_lockBehavior(SilenceAssertionsOnly)
......@@ -260,6 +260,6 @@ JSLock::DropAllLocks::~DropAllLocks()
{
}
#endif // ENABLE(JSC_MULTIPLE_THREADS) && (OS(DARWIN) || USE(PTHREADS))
#endif // (OS(DARWIN) || USE(PTHREADS))
} // namespace JSC
......@@ -34,10 +34,7 @@
#include "StructureChain.h"
#include <wtf/RefCountedLeakCounter.h>
#include <wtf/RefPtr.h>
#if ENABLE(JSC_MULTIPLE_THREADS)
#include <wtf/Threading.h>
#endif
#define DUMP_STRUCTURE_ID_STATISTICS 0
......
......@@ -508,10 +508,6 @@
#define WTF_USE_PTHREAD_BASED_QT 1
#endif
#if !defined(ENABLE_JSC_MULTIPLE_THREADS)
#define ENABLE_JSC_MULTIPLE_THREADS 1
#endif
#if !defined(ENABLE_WTF_MULTIPLE_THREADS)
#define ENABLE_WTF_MULTIPLE_THREADS 1
#endif
......@@ -1044,10 +1040,8 @@
#endif
#if !defined(ENABLE_LAZY_BLOCK_FREEING)
#if ENABLE(JSC_MULTIPLE_THREADS)
#define ENABLE_LAZY_BLOCK_FREEING 1
#endif
#endif
#ifndef ENABLE_LARGE_HEAP
#if CPU(X86) || CPU(X86_64)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment