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

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

Reviewed by Geoffrey Garen.

Make BuiltinExecutables a WeakHandleOwner so it can clear out its respective Weak members
if and when their pointees get garbage collected.

This fixes an issue I've seen locally where a WeakBlock is pinned down by a single one of
these Weak<BuiltinExecutables>.

  • builtins/BuiltinExecutables.h: Make BuiltinExecutables inherit from WeakHandleOwner.
  • builtins/BuiltinExecutables.cpp:

(JSC::BuiltinExecutables::finalize): Clear out the relevant member pointer when it's been
garbage collected. We use the WeakImpl's "context" field to pass the address of the member.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.h

    r177222 r181248  
    3030#include "SourceCode.h"
    3131#include "Weak.h"
     32#include "WeakHandleOwner.h"
    3233
    3334namespace JSC {
     
    3738class VM;
    3839
    39 class BuiltinExecutables {
     40class BuiltinExecutables final: private WeakHandleOwner {
    4041    WTF_MAKE_FAST_ALLOCATED;
    4142public:
     
    5051   
    5152private:
     53    void finalize(Handle<Unknown>, void* context) override;
     54
    5255    VM& m_vm;
    5356    UnlinkedFunctionExecutable* createBuiltinExecutable(const SourceCode&, const Identifier&);
Note: See TracChangeset for help on using the changeset viewer.