Ignore:
Timestamp:
Oct 5, 2011, 3:44:36 PM (14 years ago)
Author:
[email protected]
Message:

Added a simpler mechanism for registering one-off finalizers
https://bugs.webkit.org/show_bug.cgi?id=69466

Reviewed by Oliver Hunt.

  • heap/Heap.cpp:

(JSC::Heap::addFinalizer):
(JSC::Heap::FinalizerOwner::finalize):

  • heap/Heap.h: New function for adding an arbitrary finalizer for an

arbitrary cell without declaring any special classes or Handles yourself.

  • runtime/Executable.cpp:

(JSC::ExecutableBase::clearCode):
(JSC::ExecutableBase::clearCodeVirtual):
(JSC::EvalExecutable::clearCodeVirtual):
(JSC::ProgramExecutable::clearCodeVirtual):
(JSC::FunctionExecutable::discardCode):
(JSC::FunctionExecutable::clearCodeVirtual):

  • runtime/Executable.h:

(JSC::ExecutableBase::finishCreation): Use the new mechanism for eager
finalization of executables.

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::clearRareData):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::createRareDataIfNeeded):
(JSC::JSGlobalObject::registerWeakMap): Use the new mechanism for eager
finalization of weak maps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r96346 r96760  
    429429}
    430430
    431 void JSGlobalObject::WeakMapsFinalizer::finalize(Handle<Unknown> handle, void*)
    432 {
    433     JSGlobalObject* globalObject = asGlobalObject(handle.get());
    434     globalObject->m_rareData.clear();
    435 }
    436 
    437 JSGlobalObject::WeakMapsFinalizer* JSGlobalObject::weakMapsFinalizer()
    438 {
    439     static WeakMapsFinalizer* finalizer = new WeakMapsFinalizer();
    440     return finalizer;
     431void JSGlobalObject::clearRareData(JSCell* cell)
     432{
     433    static_cast<JSGlobalObject*>(cell)->m_rareData.clear();
    441434}
    442435
Note: See TracChangeset for help on using the changeset viewer.