Changeset 136773 in webkit
- Timestamp:
- Dec 5, 2012, 3:43:06 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r136720 r136773 1 2012-12-05 Oliver Hunt <oliver@apple.com> 2 3 Empty parse cache when receiving a low memory warning 4 https://bugs.webkit.org/show_bug.cgi?id=104161 5 6 Reviewed by Filip Pizlo. 7 8 This adds a function to the globaldata to empty all code related data 9 structures (code in the heap and the code cache). 10 It also adds a function to allow the CodeCache to actually be cleared 11 at all. 12 13 * runtime/CodeCache.h: 14 (CacheMap): 15 (JSC::CacheMap::clear): 16 (JSC::CodeCache::clear): 17 (CodeCache): 18 * runtime/JSGlobalData.cpp: 19 (JSC::JSGlobalData::discardAllCode): 20 (JSC): 21 * runtime/JSGlobalData.h: 22 (JSGlobalData): 23 1 24 2012-12-05 Filip Pizlo <fpizlo@apple.com> 2 25 -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r136608 r136773 188 188 ?detachThread@WTF@@YAXI@Z 189 189 ?didTimeOut@TimeoutChecker@JSC@@QAE_NPAVExecState@2@@Z 190 ?discardAllCode@JSGlobalData@JSC@@QAEXXZ 190 191 ?displayName@JSFunction@JSC@@QAE?AVString@WTF@@PAVExecState@2@@Z 191 192 ?dtoa@WTF@@YAXQADNAA_NAAHAAI@Z -
trunk/Source/JavaScriptCore/runtime/CodeCache.h
r136261 r136773 83 83 ASSERT(m_map.size() <= CacheSize); 84 84 } 85 86 void clear() 87 { 88 m_map.clear(); 89 for (size_t i = 0; i < CacheSize; i++) { 90 m_data[i].first = KeyType(); 91 m_data[i].second = EntryType(); 92 } 93 } 94 95 85 96 private: 86 97 HashMap<KeyType, unsigned> m_map; … … 99 110 void usedFunctionCode(JSGlobalData&, UnlinkedFunctionCodeBlock*); 100 111 ~CodeCache(); 112 113 void clear() 114 { 115 m_cachedCodeBlocks.clear(); 116 m_cachedFunctionExecutables.clear(); 117 m_cachedGlobalFunctions.clear(); 118 m_recentlyUsedFunctionCode.clear(); 119 } 101 120 102 121 enum CodeType { EvalType, ProgramType, FunctionCallType, FunctionConstructType }; -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp
r136601 r136773 432 432 } 433 433 434 void JSGlobalData::discardAllCode() 435 { 436 m_codeCache->clear(); 437 heap.deleteAllCompiledCode(); 438 } 439 434 440 void JSGlobalData::dumpSampleData(ExecState* exec) 435 441 { -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.h
r136601 r136773 451 451 CodeCache* codeCache() { return m_codeCache.get(); } 452 452 453 JS_EXPORT_PRIVATE void discardAllCode(); 454 453 455 private: 454 456 friend class LLIntOffsetsExtractor; -
trunk/Source/WebCore/ChangeLog
r136765 r136773 1 2012-12-05 Oliver Hunt <oliver@apple.com> 2 3 Empty parse cache when receiving a low memory warning 4 https://bugs.webkit.org/show_bug.cgi?id=104161 5 6 Reviewed by Filip Pizlo. 7 8 Use new discardAllCode() function on the global data, rather than 9 directly interacting with the heap. 10 11 * bindings/js/GCController.cpp: 12 (WebCore::GCController::discardAllCompiledCode): 13 1 14 2012-12-05 Dan Bernstein <mitz@apple.com> 2 15 -
trunk/Source/WebCore/bindings/js/GCController.cpp
r127278 r136773 106 106 { 107 107 JSLockHolder lock(JSDOMWindow::commonJSGlobalData()); 108 JSDOMWindow::commonJSGlobalData()-> heap.deleteAllCompiledCode();108 JSDOMWindow::commonJSGlobalData()->discardAllCode(); 109 109 } 110 110
Note:
See TracChangeset
for help on using the changeset viewer.