Ignore:
Timestamp:
Mar 8, 2015, 4:58:40 PM (10 years ago)
Author:
[email protected]
Message:

JITThunks keeps finalized Weaks around, pinning WeakBlocks.
<https://webkit.org/b/142454>

Reviewed by Darin Adler.

Make JITThunks a WeakHandleOwner so it can keep its host function map free of stale entries.
This fixes an issue I was seeing where a bunch of WeakBlocks stuck around with nothing but
finalized Weak<NativeExecutable> entries.

  • jit/JITThunks.h:
  • jit/JITThunks.cpp:

(JSC::JITThunks::finalize): Make JITThunks inherit from WeakHandleOwner so it can receive
a callback when the NativeExecutables get garbage collected.

(JSC::JITThunks::hostFunctionStub): Pass 'this' as the handle owner when creating Weaks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JITThunks.h

    r177130 r181250  
    3535#include "ThunkGenerator.h"
    3636#include "Weak.h"
     37#include "WeakHandleOwner.h"
    3738#include "WeakInlines.h"
    3839#include <wtf/HashMap.h>
     
    4546class NativeExecutable;
    4647
    47 class JITThunks {
     48class JITThunks final : private WeakHandleOwner {
    4849public:
    4950    JITThunks();
    50     ~JITThunks();
     51    virtual ~JITThunks();
    5152
    5253    MacroAssemblerCodePtr ctiNativeCall(VM*);
     
    6566    typedef Mutex Lock;
    6667    typedef MutexLocker Locker;
     68
     69    void finalize(Handle<Unknown>, void* context) override;
    6770   
    6871    typedef HashMap<ThunkGenerator, MacroAssemblerCodeRef> CTIStubMap;
Note: See TracChangeset for help on using the changeset viewer.