- Revision
- 141114
- Author
- [email protected]
- Date
- 2013-01-29 08:45:14 -0800 (Tue, 29 Jan 2013)
Log Message
[Qt] Implement GCActivityCallback
https://bugs.webkit.org/show_bug.cgi?id=103998
Reviewed by Simon Hausmann.
Source/_javascript_Core:
Implements the activity triggered garbage collector.
* runtime/GCActivityCallback.cpp:
(JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
(JSC::DefaultGCActivityCallback::scheduleTimer):
(JSC::DefaultGCActivityCallback::cancelTimer):
* runtime/GCActivityCallback.h:
(GCActivityCallback):
(DefaultGCActivityCallback):
Source/WebCore:
Implements the activity triggered garbage collector,
and disables the timer based fallback.
* bindings/js/GCController.cpp:
(WebCore::GCController::GCController):
(WebCore::GCController::garbageCollectSoon):
* bindings/js/GCController.h:
(GCController):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (141113 => 141114)
--- trunk/Source/_javascript_Core/ChangeLog 2013-01-29 16:09:33 UTC (rev 141113)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-01-29 16:45:14 UTC (rev 141114)
@@ -1,3 +1,20 @@
+2013-01-29 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt] Implement GCActivityCallback
+ https://bugs.webkit.org/show_bug.cgi?id=103998
+
+ Reviewed by Simon Hausmann.
+
+ Implements the activity triggered garbage collector.
+
+ * runtime/GCActivityCallback.cpp:
+ (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
+ (JSC::DefaultGCActivityCallback::scheduleTimer):
+ (JSC::DefaultGCActivityCallback::cancelTimer):
+ * runtime/GCActivityCallback.h:
+ (GCActivityCallback):
+ (DefaultGCActivityCallback):
+
2013-01-29 Mikhail Pozdnyakov <[email protected]>
Compilation warning in JSC
Modified: trunk/Source/_javascript_Core/runtime/GCActivityCallback.cpp (141113 => 141114)
--- trunk/Source/_javascript_Core/runtime/GCActivityCallback.cpp 2013-01-29 16:09:33 UTC (rev 141113)
+++ trunk/Source/_javascript_Core/runtime/GCActivityCallback.cpp 2013-01-29 16:45:14 UTC (rev 141114)
@@ -40,14 +40,15 @@
namespace JSC {
-#if USE(CF)
+#if USE(CF) || PLATFORM(QT)
const double gcTimeSlicePerMB = 0.01; // Percentage of CPU time we will spend to reclaim 1 MB
const double maxGCTimeSlice = 0.05; // The maximum amount of CPU time we want to use for opportunistic timer-triggered collections.
const double timerSlop = 2.0; // Fudge factor to avoid performance cost of resetting timer.
const double pagingTimeOut = 0.1; // Time in seconds to allow opportunistic timer to iterate over all blocks to see if the Heap is paged out.
-const CFTimeInterval hour = 60 * 60;
+const double hour = 60 * 60;
+#if USE(CF)
DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap)
: GCActivityCallback(heap->globalData(), CFRunLoopGetCurrent())
, m_delay(s_decade)
@@ -59,6 +60,13 @@
, m_delay(s_decade)
{
}
+#elif PLATFORM(QT)
+DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap)
+ : GCActivityCallback(heap->globalData())
+ , m_delay(hour)
+{
+}
+#endif
void DefaultGCActivityCallback::doWork()
{
@@ -78,6 +86,7 @@
heap->collect(Heap::DoNotSweep);
}
+#if USE(CF)
void DefaultGCActivityCallback::scheduleTimer(double newDelay)
{
if (newDelay * timerSlop > m_delay)
@@ -92,7 +101,23 @@
m_delay = s_decade;
CFRunLoopTimerSetNextFireDate(m_timer.get(), CFAbsoluteTimeGetCurrent() + s_decade);
}
+#elif PLATFORM(QT)
+void DefaultGCActivityCallback::scheduleTimer(double newDelay)
+{
+ if (newDelay * timerSlop > m_delay)
+ return;
+ m_delay = newDelay;
+ m_timer.start(newDelay * 1000, this);
+}
+
+void DefaultGCActivityCallback::cancelTimer()
+{
+ m_delay = hour;
+ m_timer.stop();
+}
+#endif
+
void DefaultGCActivityCallback::didAllocate(size_t bytes)
{
// The first byte allocated in an allocation cycle will report 0 bytes to didAllocate.
Modified: trunk/Source/_javascript_Core/runtime/GCActivityCallback.h (141113 => 141114)
--- trunk/Source/_javascript_Core/runtime/GCActivityCallback.h 2013-01-29 16:09:33 UTC (rev 141113)
+++ trunk/Source/_javascript_Core/runtime/GCActivityCallback.h 2013-01-29 16:45:14 UTC (rev 141114)
@@ -57,7 +57,7 @@
, m_enabled(true)
{
}
-# else
+#else
GCActivityCallback(JSGlobalData* globalData)
: HeapTimer(globalData)
, m_enabled(true)
@@ -83,10 +83,12 @@
#if USE(CF)
protected:
DefaultGCActivityCallback(Heap*, CFRunLoopRef);
-
+#endif
+#if USE(CF) || PLATFORM(QT)
+protected:
void cancelTimer();
void scheduleTimer(double);
-
+
private:
double m_delay;
#endif
Modified: trunk/Source/WebCore/ChangeLog (141113 => 141114)
--- trunk/Source/WebCore/ChangeLog 2013-01-29 16:09:33 UTC (rev 141113)
+++ trunk/Source/WebCore/ChangeLog 2013-01-29 16:45:14 UTC (rev 141114)
@@ -1,3 +1,19 @@
+2013-01-29 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt] Implement GCActivityCallback
+ https://bugs.webkit.org/show_bug.cgi?id=103998
+
+ Reviewed by Simon Hausmann.
+
+ Implements the activity triggered garbage collector,
+ and disables the timer based fallback.
+
+ * bindings/js/GCController.cpp:
+ (WebCore::GCController::GCController):
+ (WebCore::GCController::garbageCollectSoon):
+ * bindings/js/GCController.h:
+ (GCController):
+
2013-01-29 Andrey Lushnikov <[email protected]>
Web Inspector: fix bottom span in token highlight in DTE
Modified: trunk/Source/WebCore/bindings/js/GCController.cpp (141113 => 141114)
--- trunk/Source/WebCore/bindings/js/GCController.cpp 2013-01-29 16:09:33 UTC (rev 141113)
+++ trunk/Source/WebCore/bindings/js/GCController.cpp 2013-01-29 16:45:14 UTC (rev 141114)
@@ -49,7 +49,7 @@
}
GCController::GCController()
-#if !USE(CF) && !PLATFORM(BLACKBERRY)
+#if !USE(CF) && !PLATFORM(BLACKBERRY) && !PLATFORM(QT)
: m_GCTimer(this, &GCController::gcTimerFired)
#endif
{
@@ -62,7 +62,7 @@
// systems with CoreFoundation. If and when the notion of a run loop is pushed
// down into WTF so that more platforms can take advantage of it, we will be
// able to use reportAbandonedObjectGraph on more platforms.
-#if USE(CF) || PLATFORM(BLACKBERRY)
+#if USE(CF) || PLATFORM(BLACKBERRY) || PLATFORM(QT)
JSLockHolder lock(JSDOMWindow::commonJSGlobalData());
JSDOMWindow::commonJSGlobalData()->heap.reportAbandonedObjectGraph();
#else
@@ -71,7 +71,7 @@
#endif
}
-#if !USE(CF) && !PLATFORM(BLACKBERRY)
+#if !USE(CF) && !PLATFORM(BLACKBERRY) && !PLATFORM(QT)
void GCController::gcTimerFired(Timer<GCController>*)
{
collect(0);
Modified: trunk/Source/WebCore/bindings/js/GCController.h (141113 => 141114)
--- trunk/Source/WebCore/bindings/js/GCController.h 2013-01-29 16:09:33 UTC (rev 141113)
+++ trunk/Source/WebCore/bindings/js/GCController.h 2013-01-29 16:45:14 UTC (rev 141114)
@@ -50,7 +50,7 @@
private:
GCController(); // Use gcController() instead
-#if !USE(CF) && !PLATFORM(BLACKBERRY)
+#if !USE(CF) && !PLATFORM(BLACKBERRY) && !PLATFORM(QT)
void gcTimerFired(Timer<GCController>*);
Timer<GCController> m_GCTimer;
#endif