Changeset 151149 in webkit
- Timestamp:
- Jun 3, 2013 8:20:32 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r151133 r151149 1 2013-06-03 Hojong Han <hojong.han@samsung.com> 2 3 [EFL] Implement GCActivityCallback 4 https://bugs.webkit.org/show_bug.cgi?id=95923 5 6 Reviewed by Geoffrey Garen. 7 8 Implements the activity triggered garbage collector. 9 Additional GCs can be triggered by platfrom timer. 10 It has sort of compaction effect not to make JSC heap grow fast 11 so that memory usage becomes lower than usual. 12 13 * PlatformEfl.cmake: Added. 14 * heap/HeapTimer.cpp: 15 (JSC): 16 (JSC::HeapTimer::HeapTimer): 17 (JSC::HeapTimer::~HeapTimer): 18 (JSC::HeapTimer::add): 19 (JSC::HeapTimer::stop): 20 (JSC::HeapTimer::timerEvent): 21 * heap/HeapTimer.h: 22 (HeapTimer): 23 * jsc.cpp: 24 (main): 25 * runtime/GCActivityCallback.cpp: 26 (JSC): 27 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback): 28 (JSC::DefaultGCActivityCallback::scheduleTimer): 29 (JSC::DefaultGCActivityCallback::cancelTimer): 30 (JSC::DefaultGCActivityCallback::didAllocate): 31 * runtime/GCActivityCallback.h: 32 (GCActivityCallback): 33 (JSC::GCActivityCallback::GCActivityCallback): 34 (DefaultGCActivityCallback): 35 1 36 2013-06-03 Roger Fong <roger_fong@apple.com> 2 37 -
trunk/Source/JavaScriptCore/heap/HeapTimer.cpp
r149255 r151149 39 39 #include <QThread> 40 40 #include <QTimerEvent> 41 #elif PLATFORM(EFL) 42 #include <Ecore.h> 41 43 #endif 42 44 … … 166 168 } 167 169 170 #elif PLATFORM(EFL) 171 172 HeapTimer::HeapTimer(VM* vm) 173 : m_vm(vm) 174 , m_timer(0) 175 { 176 } 177 178 HeapTimer::~HeapTimer() 179 { 180 stop(); 181 } 182 183 Ecore_Timer* HeapTimer::add(double delay, void* agent) 184 { 185 return ecore_timer_add(delay, reinterpret_cast<Ecore_Task_Cb>(timerEvent), agent); 186 } 187 188 void HeapTimer::stop() 189 { 190 if (!m_timer) 191 return; 192 193 ecore_timer_del(m_timer); 194 m_timer = 0; 195 } 196 197 bool HeapTimer::timerEvent(void* info) 198 { 199 HeapTimer* agent = static_cast<HeapTimer*>(info); 200 201 APIEntryShim shim(agent->m_vm); 202 agent->doWork(); 203 agent->m_timer = 0; 204 205 return ECORE_CALLBACK_CANCEL; 206 } 207 168 208 #else 169 209 HeapTimer::HeapTimer(VM* vm) -
trunk/Source/JavaScriptCore/heap/HeapTimer.h
r148704 r151149 39 39 #include <QObject> 40 40 #include <QThread> 41 #elif PLATFORM(EFL) 42 typedef struct _Ecore_Timer Ecore_Timer; 41 43 #endif 42 44 … … 82 84 QThread* m_newThread; 83 85 QMutex m_mutex; 86 #elif PLATFORM(EFL) 87 static bool timerEvent(void*); 88 Ecore_Timer* add(double delay, void* agent); 89 void stop(); 90 Ecore_Timer* m_timer; 84 91 #endif 85 92 -
trunk/Source/JavaScriptCore/jsc.cpp
r149825 r151149 91 91 #endif 92 92 93 #if PLATFORM(EFL) 94 #include <Ecore.h> 95 #endif 96 93 97 using namespace JSC; 94 98 using namespace WTF; … … 538 542 #endif 539 543 544 #if PLATFORM(EFL) 545 ecore_init(); 546 #endif 547 540 548 // Initialize JSC before getting VM. 541 549 #if ENABLE(SAMPLING_REGIONS) … … 552 560 if (Options::logHeapStatisticsAtExit()) 553 561 HeapStatistics::reportSuccess(); 562 563 #if PLATFORM(EFL) 564 ecore_shutdown(); 565 #endif 566 554 567 return res; 555 568 } -
trunk/Source/JavaScriptCore/runtime/GCActivityCallback.cpp
r148696 r151149 39 39 #include <wtf/WTFThreadData.h> 40 40 41 #if PLATFORM(EFL) 42 #include <wtf/MainThread.h> 43 #endif 44 41 45 namespace JSC { 42 46 43 #if USE(CF) || PLATFORM(QT) 47 #if USE(CF) || PLATFORM(QT) || PLATFORM(EFL) 44 48 45 49 const double gcTimeSlicePerMB = 0.01; // Percentage of CPU time we will spend to reclaim 1 MB … … 64 68 DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap) 65 69 : GCActivityCallback(heap->vm()) 70 , m_delay(hour) 71 { 72 } 73 #elif PLATFORM(EFL) 74 DefaultGCActivityCallback::DefaultGCActivityCallback(Heap* heap) 75 : GCActivityCallback(heap->vm(), WTF::isMainThread()) 66 76 , m_delay(hour) 67 77 { … … 117 127 m_timer.stop(); 118 128 } 129 #elif PLATFORM(EFL) 130 void DefaultGCActivityCallback::scheduleTimer(double newDelay) 131 { 132 if (newDelay * timerSlop > m_delay) 133 return; 134 135 stop(); 136 m_delay = newDelay; 137 138 ASSERT(!m_timer); 139 m_timer = add(newDelay, this); 140 } 141 142 void DefaultGCActivityCallback::cancelTimer() 143 { 144 m_delay = hour; 145 stop(); 146 } 119 147 #endif 120 148 121 149 void DefaultGCActivityCallback::didAllocate(size_t bytes) 122 150 { 151 #if PLATFORM(EFL) 152 if (!isEnabled()) 153 return; 154 155 ASSERT(WTF::isMainThread()); 156 #endif 157 123 158 // The first byte allocated in an allocation cycle will report 0 bytes to didAllocate. 124 159 // We pretend it's one byte so that we don't ignore this allocation entirely. -
trunk/Source/JavaScriptCore/runtime/GCActivityCallback.h
r148696 r151149 58 58 { 59 59 } 60 #elif PLATFORM(EFL) 61 GCActivityCallback(VM* vm, bool flag) 62 : HeapTimer(vm) 63 , m_enabled(flag) 64 { 65 } 60 66 #else 61 67 GCActivityCallback(VM* vm) … … 85 91 DefaultGCActivityCallback(Heap*, CFRunLoopRef); 86 92 #endif 87 #if USE(CF) || PLATFORM(QT) 93 #if USE(CF) || PLATFORM(QT) || PLATFORM(EFL) 88 94 protected: 89 95 void cancelTimer();
Note: See TracChangeset
for help on using the changeset viewer.