#include "config.h"
#include "HeapTimer.h"
-#include "APIShims.h"
+#include "IncrementalSweeper.h"
#include "JSObject.h"
#include "JSString.h"
-
+#include "JSCInlines.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
}
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)
{
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;
}
-
#else
HeapTimer::HeapTimer(VM* vm)
: m_vm(vm)