Changeset 181250 in webkit
- Timestamp:
- Mar 8, 2015 4:58:40 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r181248 r181250 1 2015-03-08 Andreas Kling <akling@apple.com> 2 3 JITThunks keeps finalized Weaks around, pinning WeakBlocks. 4 <https://webkit.org/b/142454> 5 6 Reviewed by Darin Adler. 7 8 Make JITThunks a WeakHandleOwner so it can keep its host function map free of stale entries. 9 This fixes an issue I was seeing where a bunch of WeakBlocks stuck around with nothing but 10 finalized Weak<NativeExecutable> entries. 11 12 * jit/JITThunks.h: 13 * jit/JITThunks.cpp: 14 (JSC::JITThunks::finalize): Make JITThunks inherit from WeakHandleOwner so it can receive 15 a callback when the NativeExecutables get garbage collected. 16 17 (JSC::JITThunks::hostFunctionStub): Pass 'this' as the handle owner when creating Weaks. 18 1 19 2015-03-08 Andreas Kling <akling@apple.com> 2 20 -
trunk/Source/JavaScriptCore/jit/JITThunks.cpp
r177130 r181250 77 77 } 78 78 79 void JITThunks::finalize(Handle<Unknown> handle, void*) 80 { 81 auto* nativeExecutable = jsCast<NativeExecutable*>(handle.get().asCell()); 82 weakRemove(*m_hostFunctionStubMap, std::make_pair(nativeExecutable->function(), nativeExecutable->constructor()), nativeExecutable); 83 } 84 79 85 NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, NativeFunction constructor) 80 86 { … … 90 96 adoptRef(new NativeJITCode(MacroAssemblerCodeRef::createSelfManagedCodeRef(ctiNativeConstruct(vm)), JITCode::HostCallThunk)), 91 97 constructor, NoIntrinsic); 92 weakAdd(*m_hostFunctionStubMap, std::make_pair(function, constructor), Weak<NativeExecutable>(nativeExecutable ));98 weakAdd(*m_hostFunctionStubMap, std::make_pair(function, constructor), Weak<NativeExecutable>(nativeExecutable, this)); 93 99 return nativeExecutable; 94 100 } … … 112 118 113 119 NativeExecutable* nativeExecutable = NativeExecutable::create(*vm, forCall, function, forConstruct, callHostFunctionAsConstructor, intrinsic); 114 weakAdd(*m_hostFunctionStubMap, std::make_pair(function, &callHostFunctionAsConstructor), Weak<NativeExecutable>(nativeExecutable ));120 weakAdd(*m_hostFunctionStubMap, std::make_pair(function, &callHostFunctionAsConstructor), Weak<NativeExecutable>(nativeExecutable, this)); 115 121 return nativeExecutable; 116 122 } -
trunk/Source/JavaScriptCore/jit/JITThunks.h
r177130 r181250 35 35 #include "ThunkGenerator.h" 36 36 #include "Weak.h" 37 #include "WeakHandleOwner.h" 37 38 #include "WeakInlines.h" 38 39 #include <wtf/HashMap.h> … … 45 46 class NativeExecutable; 46 47 47 class JITThunks {48 class JITThunks final : private WeakHandleOwner { 48 49 public: 49 50 JITThunks(); 50 ~JITThunks();51 virtual ~JITThunks(); 51 52 52 53 MacroAssemblerCodePtr ctiNativeCall(VM*); … … 65 66 typedef Mutex Lock; 66 67 typedef MutexLocker Locker; 68 69 void finalize(Handle<Unknown>, void* context) override; 67 70 68 71 typedef HashMap<ThunkGenerator, MacroAssemblerCodeRef> CTIStubMap;
Note: See TracChangeset
for help on using the changeset viewer.