Changeset 122624 in webkit
- Timestamp:
- Jul 13, 2012 1:12:36 PM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r122595 r122624 1 2012-07-13 Yong Li <yoli@rim.com> 2 3 [BlackBerry] Implement GCActivityCallback with platform timer 4 https://bugs.webkit.org/show_bug.cgi?id=90175 5 6 Reviewed by Rob Buis. 7 8 Implement GCActivityCallback and HeapTimer for BlackBerry port. 9 10 * heap/HeapTimer.cpp: 11 (JSC): 12 (JSC::HeapTimer::HeapTimer): 13 (JSC::HeapTimer::~HeapTimer): 14 (JSC::HeapTimer::timerDidFire): 15 (JSC::HeapTimer::synchronize): 16 (JSC::HeapTimer::invalidate): 17 (JSC::HeapTimer::didStartVMShutdown): 18 * heap/HeapTimer.h: 19 (HeapTimer): 20 * runtime/GCActivityCallbackBlackBerry.cpp: 21 (JSC): 22 (JSC::DefaultGCActivityCallback::doWork): 23 (JSC::DefaultGCActivityCallback::didAllocate): 24 (JSC::DefaultGCActivityCallback::willCollect): 25 (JSC::DefaultGCActivityCallback::cancel): 26 1 27 2012-07-13 Patrick Gansterer <paroga@webkit.org> 2 28 -
trunk/Source/JavaScriptCore/heap/HeapTimer.cpp
r121381 r122624 99 99 } 100 100 101 #elif PLATFORM(BLACKBERRY) 102 103 HeapTimer::HeapTimer(JSGlobalData* globalData) 104 : m_globalData(globalData) 105 , m_timer(this, &HeapTimer::timerDidFire) 106 { 107 } 108 109 HeapTimer::~HeapTimer() 110 { 111 } 112 113 void HeapTimer::timerDidFire() 114 { 115 doWork(); 116 } 117 118 void HeapTimer::synchronize() 119 { 120 } 121 122 void HeapTimer::invalidate() 123 { 124 } 125 126 void HeapTimer::didStartVMShutdown() 127 { 128 delete this; 129 } 130 101 131 #else 102 132 103 133 HeapTimer::HeapTimer(JSGlobalData* globalData) 104 134 : m_globalData(globalData) -
trunk/Source/JavaScriptCore/heap/HeapTimer.h
r121381 r122624 32 32 #if USE(CF) 33 33 #include <CoreFoundation/CoreFoundation.h> 34 #elif PLATFORM(BLACKBERRY) 35 #include <BlackBerryPlatformTimer.h> 34 36 #endif 35 37 … … 64 66 65 67 Mutex m_shutdownMutex; 68 #elif PLATFORM(BLACKBERRY) 69 void timerDidFire(); 70 71 BlackBerry::Platform::Timer<HeapTimer> m_timer; 66 72 #endif 67 73 -
trunk/Source/JavaScriptCore/runtime/GCActivityCallbackBlackBerry.cpp
r120742 r122624 21 21 22 22 #include "Heap.h" 23 #include "JSGlobalData.h" 23 24 #include <BlackBerryPlatformMemory.h> 24 25 25 26 namespace JSC { 27 28 static const size_t bytesWorthGC = 4 * 1024 * 1024; 26 29 27 30 DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap) … … 30 33 } 31 34 32 DefaultGCActivityCallback::doWork()35 void DefaultGCActivityCallback::doWork() 33 36 { 37 m_globalData->heap.collect(Heap::DoNotSweep); 34 38 } 35 39 36 40 void DefaultGCActivityCallback::didAllocate(size_t bytesAllocated) 37 41 { 38 if ( !BlackBerry::Platform::isMemoryLow())42 if (bytesAllocated < bytesWorthGC || m_timer.started()) 39 43 return; 40 44 41 if (bytesAllocated < 1 * 1024 * 1024) 42 return; 43 44 if (m_globalData->heap.isBusy() || !m_globalData->heap.isSafeToCollect()) 45 return; 46 47 m_globalData->heap.collect(Heap::DoNotSweep); 45 // Try using ~5% CPU time. 46 m_timer.start(m_globalData->heap.lastGCLength() * 20); 48 47 } 49 48 50 49 void DefaultGCActivityCallback::willCollect() 51 50 { 51 cancel(); 52 52 } 53 53 54 54 void DefaultGCActivityCallback::cancel() 55 55 { 56 m_timer.stop(); 56 57 } 57 58
Note: See TracChangeset
for help on using the changeset viewer.