X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/93a3786624b2768d89bfa27e46598dc64e2fb70a..2d39b0e377c0896910ee49ae70082ba665faf986:/heap/HeapTimer.cpp diff --git a/heap/HeapTimer.cpp b/heap/HeapTimer.cpp index 5773a9e..9660d66 100644 --- a/heap/HeapTimer.cpp +++ b/heap/HeapTimer.cpp @@ -26,19 +26,14 @@ #include "config.h" #include "HeapTimer.h" -#include "APIShims.h" +#include "IncrementalSweeper.h" #include "JSObject.h" #include "JSString.h" - +#include "JSCInlines.h" #include #include -#if PLATFORM(QT) -#include -#include -#include -#include -#elif PLATFORM(EFL) +#if PLATFORM(EFL) #include #endif @@ -90,88 +85,23 @@ void HeapTimer::timerDidFire(CFRunLoopTimerRef timer, void* context) } HeapTimer* heapTimer = 0; -#if PLATFORM(IOS) - if (vm->heap.activityCallback() && vm->heap.activityCallback()->m_timer.get() == timer) - heapTimer = vm->heap.activityCallback(); -#else - if (vm->heap.activityCallback()->m_timer.get() == timer) - heapTimer = vm->heap.activityCallback(); -#endif // PLATFORM(IOS) + if (vm->heap.fullActivityCallback() && vm->heap.fullActivityCallback()->m_timer.get() == timer) + heapTimer = vm->heap.fullActivityCallback(); + else if (vm->heap.edenActivityCallback() && vm->heap.edenActivityCallback()->m_timer.get() == timer) + heapTimer = vm->heap.edenActivityCallback(); else if (vm->heap.sweeper()->m_timer.get() == timer) heapTimer = vm->heap.sweeper(); else RELEASE_ASSERT_NOT_REACHED(); { - APIEntryShim shim(vm); + JSLockHolder locker(vm); heapTimer->doWork(); } apiLock->unlock(); } -#elif PLATFORM(BLACKBERRY) - -HeapTimer::HeapTimer(VM* vm) - : m_vm(vm) - , m_timer(this, &HeapTimer::timerDidFire) -{ - // FIXME: Implement HeapTimer for other threads. - if (WTF::isMainThread() && !m_timer.tryCreateClient()) - CRASH(); -} - -HeapTimer::~HeapTimer() -{ -} - -void HeapTimer::timerDidFire() -{ - doWork(); -} - -void HeapTimer::invalidate() -{ -} - -#elif PLATFORM(QT) - -HeapTimer::HeapTimer(VM* vm) - : m_vm(vm) - , m_newThread(0) - , m_mutex(QMutex::NonRecursive) -{ - // The HeapTimer might be created before the runLoop is started, - // but we need to ensure the thread has an eventDispatcher already. - QEventLoop fakeLoop(this); -} - -HeapTimer::~HeapTimer() -{ - QMutexLocker lock(&m_mutex); - m_timer.stop(); -} - -void HeapTimer::timerEvent(QTimerEvent*) -{ - QMutexLocker lock(&m_mutex); - if (m_newThread) { - // We need to wait with processing until we are on the right thread. - return; - } - - APIEntryShim shim(m_vm); - doWork(); -} - -void HeapTimer::customEvent(QEvent*) -{ - ASSERT(m_newThread); - QMutexLocker lock(&m_mutex); - moveToThread(m_newThread); - m_newThread = 0; -} - #elif PLATFORM(EFL) HeapTimer::HeapTimer(VM* vm) @@ -203,13 +133,12 @@ bool HeapTimer::timerEvent(void* info) { HeapTimer* agent = static_cast(info); - APIEntryShim shim(agent->m_vm); + JSLockHolder locker(agent->m_vm); agent->doWork(); agent->m_timer = 0; return ECORE_CALLBACK_CANCEL; } - #else HeapTimer::HeapTimer(VM* vm) : m_vm(vm)