Changeset 86883 in webkit
- Timestamp:
- May 19, 2011 1:18:39 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r86850 r86883 1 2011-05-19 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Geoffrey Garen. 4 5 Make Executables release their JIT code as soon as they become dead 6 https://bugs.webkit.org/show_bug.cgi?id=61134 7 8 Add an ability to clear an Executable's jit code without requiring 9 it to be destroyed, and then call that from a finalizer. 10 11 * heap/Weak.h: 12 (JSC::Weak::Weak): 13 (JSC::Weak::leak): 14 * jit/JITCode.h: 15 (JSC::JITCode::clear): 16 * runtime/Executable.cpp: 17 (JSC::ExecutableFinalizer::finalize): 18 (JSC::ExecutableBase::executableFinalizer): 19 * runtime/Executable.h: 20 (JSC::ExecutableBase::ExecutableBase): 21 (JSC::ExecutableBase::clearExecutableCode): 22 1 23 2011-05-19 Adam Roben <aroben@apple.com> 2 24 -
trunk/Source/JavaScriptCore/heap/Handle.h
r86209 r86883 48 48 49 49 class HandleBase { 50 template <typename T> friend class Weak; 50 51 friend class HandleHeap; 51 52 friend struct JSCallbackObjectData; -
trunk/Source/JavaScriptCore/heap/HandleHeap.h
r84660 r86883 71 71 #if !ASSERT_DISABLED 72 72 bool hasWeakOwner(HandleSlot, WeakHandleOwner*); 73 bool hasFinalizer(HandleSlot); 73 74 #endif 74 75 … … 198 199 return toNode(handle)->weakOwner() == weakOwner; 199 200 } 201 202 inline bool HandleHeap::hasFinalizer(HandleSlot handle) 203 { 204 return toNode(handle)->weakOwner(); 205 } 200 206 #endif 201 207 -
trunk/Source/JavaScriptCore/heap/Weak.h
r84660 r86883 54 54 } 55 55 56 enum AdoptTag { Adopt }; 57 template<typename U> Weak(AdoptTag, Handle<U> handle) 58 : Handle<T>(handle.slot()) 59 { 60 validateCell(get()); 61 } 62 56 63 Weak(const Weak& other) 57 64 : Handle<T>() … … 122 129 return *this; 123 130 } 131 132 HandleSlot leakHandle() 133 { 134 ASSERT(HandleHeap::heapFor(slot())->hasFinalizer(slot())); 135 HandleSlot result = slot(); 136 setSlot(0); 137 return result; 138 } 124 139 125 140 private: -
trunk/Source/JavaScriptCore/jit/JITCode.h
r70703 r86883 102 102 } 103 103 104 void clear() 105 { 106 m_ref.~CodeRef(); 107 new (&m_ref) CodeRef(); 108 } 109 104 110 private: 105 111 JITCode(void* code, PassRefPtr<ExecutablePool> executablePool, size_t size) -
trunk/Source/JavaScriptCore/runtime/Executable.cpp
r86837 r86883 43 43 const ClassInfo ExecutableBase::s_info = { "Executable", 0, 0, 0 }; 44 44 45 #if ENABLE(JIT) 46 class ExecutableFinalizer : public WeakHandleOwner { 47 virtual void finalize(Handle<Unknown> handle, void*) 48 { 49 Weak<ExecutableBase> executable(Weak<ExecutableBase>::Adopt, handle); 50 executable->clearExecutableCode(); 51 } 52 }; 53 54 WeakHandleOwner* ExecutableBase::executableFinalizer() 55 { 56 DEFINE_STATIC_LOCAL(ExecutableFinalizer, finalizer, ()); 57 return &finalizer; 58 } 59 #endif 60 45 61 const ClassInfo NativeExecutable::s_info = { "NativeExecutable", &ExecutableBase::s_info, 0, 0 }; 46 62 -
trunk/Source/JavaScriptCore/runtime/Executable.h
r86499 r86883 58 58 , m_numParametersForConstruct(numParameters) 59 59 { 60 #if ENABLE(JIT) 61 Weak<ExecutableBase> finalizer(globalData, this, executableFinalizer()); 62 finalizer.leakHandle(); 63 #endif 60 64 } 61 65 … … 87 91 ASSERT(m_jitCodeForConstruct); 88 92 return m_jitCodeForConstruct; 93 } 94 95 void clearExecutableCode() 96 { 97 m_jitCodeForCall.clear(); 98 m_jitCodeForConstruct.clear(); 89 99 } 90 100 … … 94 104 MacroAssemblerCodePtr m_jitCodeForCallWithArityCheck; 95 105 MacroAssemblerCodePtr m_jitCodeForConstructWithArityCheck; 106 107 private: 108 static WeakHandleOwner* executableFinalizer(); 96 109 #endif 97 110 };
Note: See TracChangeset
for help on using the changeset viewer.