]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - heap/HeapTimer.cpp
JavaScriptCore-7600.1.4.17.5.tar.gz
[apple/javascriptcore.git] / heap / HeapTimer.cpp
index 5773a9eed5861858844a030cc6fdaa15c3c5dc7d..9660d662165268476d5737bca2ad7f6523d1f92a 100644 (file)
 #include "config.h"
 #include "HeapTimer.h"
 
 #include "config.h"
 #include "HeapTimer.h"
 
-#include "APIShims.h"
+#include "IncrementalSweeper.h"
 #include "JSObject.h"
 #include "JSString.h"
 #include "JSObject.h"
 #include "JSString.h"
-
+#include "JSCInlines.h"
 #include <wtf/MainThread.h>
 #include <wtf/Threading.h>
 
 #include <wtf/MainThread.h>
 #include <wtf/Threading.h>
 
-#if PLATFORM(QT)
-#include <QCoreApplication>
-#include <QMutexLocker>
-#include <QThread>
-#include <QTimerEvent>
-#elif PLATFORM(EFL)
+#if PLATFORM(EFL)
 #include <Ecore.h>
 #endif
 
 #include <Ecore.h>
 #endif
 
@@ -90,88 +85,23 @@ void HeapTimer::timerDidFire(CFRunLoopTimerRef timer, void* context)
     }
 
     HeapTimer* heapTimer = 0;
     }
 
     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();
 
     {
     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();
 }
 
         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)
 #elif PLATFORM(EFL)
 
 HeapTimer::HeapTimer(VM* vm)
@@ -203,13 +133,12 @@ bool HeapTimer::timerEvent(void* info)
 {
     HeapTimer* agent = static_cast<HeapTimer*>(info);
     
 {
     HeapTimer* agent = static_cast<HeapTimer*>(info);
     
-    APIEntryShim shim(agent->m_vm);
+    JSLockHolder locker(agent->m_vm);
     agent->doWork();
     agent->m_timer = 0;
     
     return ECORE_CALLBACK_CANCEL;
 }
     agent->doWork();
     agent->m_timer = 0;
     
     return ECORE_CALLBACK_CANCEL;
 }
-
 #else
 HeapTimer::HeapTimer(VM* vm)
     : m_vm(vm)
 #else
 HeapTimer::HeapTimer(VM* vm)
     : m_vm(vm)