Ignore:
Timestamp:
Aug 17, 2009, 6:05:37 PM (16 years ago)
Author:
[email protected]
Message:

Fix 300,000+ leaks seen during the regression tests.

Reviewed by Darin Adler.

EvalCodeCache::get was heap-allocating an EvalExecutable instance without adopting the initial reference.
While fixing this we noticed that EvalExecutable was a RefCounted type that was sometimes stack allocated.
To make this cleaner and to prevent clients from attempting to ref a stack-allocated instance, we move the
refcounting down to a new CacheableEvalExecutable class that derives from EvalExecutable. EvalCodeCache::get
now uses CacheableEvalExecutable::create and avoids the leak.

  • bytecode/EvalCodeCache.h:

(JSC::EvalCodeCache::get):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::callEval):

  • runtime/Executable.h:

(JSC::CacheableEvalExecutable::create):
(JSC::CacheableEvalExecutable::CacheableEvalExecutable):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r47304 r47405  
    351351    if (JSValue parsedObject = preparser.tryLiteralParse())
    352352        return parsedObject;
    353    
    354    
     353
    355354    ScopeChainNode* scopeChain = callFrame->scopeChain();
    356355    CodeBlock* codeBlock = callFrame->codeBlock();
    357     RefPtr<EvalExecutable> eval = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue);
     356    RefPtr<CacheableEvalExecutable> eval = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue);
    358357
    359358    JSValue result = jsUndefined();
Note: See TracChangeset for help on using the changeset viewer.