Changeset 31205 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Mar 20, 2008, 10:00:16 PM (17 years ago)
Author:
[email protected]
Message:

Fix for leak introduced by inline ScopeChainNode use

Reviewed by Maciej

To avoid any extra branches when managing an inline ScopeChainNode
in the ScopeChain the inline node gets inserted with a refcount of

  1. This meant than when the ScopeChain was destroyed the ScopeChainNodes

above the inline node would be leaked.

We resolve this by manually popping the inline node in the
FunctionExecState destructor.

Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r31195 r31205  
     12008-03-20  Oliver Hunt  <[email protected]>
     2
     3        Reviewed by Maciej.
     4
     5        Fix for leak introduced by inline ScopeChainNode use
     6
     7        To avoid any extra branches when managing an inline ScopeChainNode
     8        in the ScopeChain the inline node gets inserted with a refcount of
     9        2.  This meant than when the ScopeChain was destroyed the ScopeChainNodes
     10        above the inline node would be leaked.
     11
     12        We resolve this by manually popping the inline node in the
     13        FunctionExecState destructor.
     14
     15        * JavaScriptCore.xcodeproj/project.pbxproj:
     16        * kjs/ExecStateInlines.h:
     17        (KJS::FunctionExecState::~FunctionExecState):
     18        * kjs/scope_chain.h:
     19        (KJS::ScopeChain::popInlineScopeNode):
     20
    1212008-03-20  Mark Rowe  <[email protected]>
    222
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r31174 r31205  
    483483                93F1981A08245AAE001E9ABC /* keywords.table */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = text; path = keywords.table; sourceTree = "<group>"; tabWidth = 8; };
    484484                95C18D3E0C90E7EF00E72F73 /* JSRetainPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRetainPtr.h; sourceTree = "<group>"; };
     485                A785E3030D9341AB00953772 /* ExecStateInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecStateInlines.h; sourceTree = "<group>"; };
    485486                A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObjectFunctions.h; sourceTree = "<group>"; };
    486487                A8E894330CD0603F00367179 /* JSGlobalObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObject.h; sourceTree = "<group>"; };
     
    827828                                14BD53F40A3E12D800BAF59C /* ExecState.cpp */,
    828829                                14BD53F30A3E12D800BAF59C /* ExecState.h */,
     830                                A785E3030D9341AB00953772 /* ExecStateInlines.h */,
    829831                                F692A85E0255597D01FF60F7 /* function.cpp */,
    830832                                F692A85F0255597D01FF60F7 /* function.h */,
  • trunk/JavaScriptCore/kjs/ExecStateInlines.h

    r31173 r31205  
    8484        if (m_activation->needsPop())
    8585            m_globalObject->popActivation();
     86       
     87        if (m_inlineScopeChainNode.next) {
     88            m_scopeChain.popInlineScopeNode();
     89            m_inlineScopeChainNode.next = 0;
     90        }
    8691    }
    8792
  • trunk/JavaScriptCore/kjs/scope_chain.h

    r31172 r31205  
    9494        void replaceTop(JSObject*);
    9595        void pop();
    96        
     96        void popInlineScopeNode();
     97
    9798        void mark();
    9899
     
    172173}
    173174
     175inline void ScopeChain::popInlineScopeNode()
     176{
     177    _node = _node->next;
     178}
     179
    174180} // namespace KJS
    175181
Note: See TracChangeset for help on using the changeset viewer.