Ignore:
Timestamp:
Aug 27, 2011, 2:49:46 PM (14 years ago)
Author:
[email protected]
Message:

JSC::Executable is inconsistent about using weak handle finalizers
and destructors for releasing memory
https://bugs.webkit.org/show_bug.cgi?id=67072

Reviewed by Darin Adler.

Moved more of the destruction of Executable state into the finalizer,
which also resulted in an opportunity to mostly combine this with
discardCode(). This also means that the finalizer is now enabled even
when the JIT is turned off. This is performance neutral on SunSpider,
V8, and Kraken.

  • runtime/Executable.cpp:

(JSC::ExecutableBase::clearCode):
(JSC::ExecutableFinalizer::finalize):
(JSC::EvalExecutable::clearCode):
(JSC::ProgramExecutable::clearCode):
(JSC::FunctionExecutable::discardCode):
(JSC::FunctionExecutable::clearCode):

  • runtime/Executable.h:

(JSC::ExecutableBase::finishCreation):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Executable.h

    r93920 r93947  
    6464        {
    6565            Base::finishCreation(globalData);
    66 #if ENABLE(JIT)
    6766            Weak<ExecutableBase> finalizer(globalData, this, executableFinalizer());
    6867            finalizer.leakHandle();
    69 #endif
    7068        }
    7169       
     
    8987       
    9088        static const ClassInfo s_info;
     89
     90        virtual void clearCode();
    9191
    9292    protected:
     
    157157        }
    158158
    159         void clearExecutableCode()
    160         {
    161             m_jitCodeForCall.clear();
    162             m_jitCodeForConstruct.clear();
    163         }
    164 
    165159    protected:
    166160        JITCode m_jitCodeForCall;
     
    168162        MacroAssemblerCodePtr m_jitCodeForCallWithArityCheck;
    169163        MacroAssemblerCodePtr m_jitCodeForConstructWithArityCheck;
     164#endif
    170165       
    171166    private:
    172167        static WeakHandleOwner* executableFinalizer();
    173 #endif
    174168    };
    175169
     
    340334       
    341335        static const ClassInfo s_info;
     336
     337    protected:
     338        virtual void clearCode();
     339
    342340    private:
    343341        static const unsigned StructureFlags = OverridesVisitChildren | ScriptExecutable::StructureFlags;
     
    393391       
    394392        static const ClassInfo s_info;
     393       
     394    protected:
     395        virtual void clearCode();
    395396
    396397    private:
     
    524525       
    525526        static const ClassInfo s_info;
    526 
    527     protected:
     527       
     528    protected:
     529        virtual void clearCode();
     530
    528531        void finishCreation(JSGlobalData& globalData, const Identifier& name, int firstLine, int lastLine)
    529532        {
Note: See TracChangeset for help on using the changeset viewer.