Ignore:
Timestamp:
Jun 19, 2009, 12:10:49 AM (16 years ago)
Author:
[email protected]
Message:

Bug 26532: Native functions do not correctly unlink from optimised callsites when they're collected
<https://bugs.webkit.org/show_bug.cgi?id=26532> <rdar://problem/6625385>

Reviewed by Gavin "Viceroy of Venezuela" Barraclough.

We need to make sure that each native function instance correctly unlinks any references to it
when it is collected. Allowing this to happen required a few changes:

  • Every native function needs a codeblock to track the link information
  • To have this codeblock, every function now also needs its own functionbodynode so we no longer get to have a single shared instance.
  • Identifying a host function is now done by looking for CodeBlock::codeType() == NativeCode
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSFunction.cpp

    r43661 r44844  
    4949    : Base(&exec->globalData(), structure, name)
    5050#if ENABLE(JIT)
    51     , m_body(exec->globalData().nativeFunctionThunk())
     51    , m_body(FunctionBodyNode::createNativeThunk(&exec->globalData()))
    5252#else
    5353    , m_body(0)
     
    7777    // are based on a check for the this pointer value for this JSFunction - which will no longer be valid once
    7878    // this memory is freed and may be reused (potentially for another, different JSFunction).
    79     if (!isHostFunction()) {
    80         if (m_body && m_body->isGenerated())
    81             m_body->generatedBytecode().unlinkCallers();
     79    if (m_body && m_body->isGenerated())
     80        m_body->generatedBytecode().unlinkCallers();
     81    if (!isHostFunction())
    8282        scopeChain().~ScopeChain();
    83     }
    84    
    8583#endif
    8684}
     
    8987{
    9088    Base::mark();
    91     if (!isHostFunction()) {
    92         m_body->mark();
     89    m_body->mark();
     90    if (!isHostFunction())
    9391        scopeChain().mark();
    94     }
    9592}
    9693
Note: See TracChangeset for help on using the changeset viewer.