Ignore:
Timestamp:
Jan 21, 2008, 10:18:10 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

Reviewed by Maciej Stachowiak.


Fixed http://bugs.webkit.org/show_bug.cgi?id=16909
REGRESSION: Amazon.com crash (ActivationImp)


(and a bunch of other crashes)


Plus, a .7% SunSpider speedup to boot.


Replaced the buggy currentExec and savedExec mechanisms with an
explicit ExecState stack.

  • kjs/collector.cpp: (KJS::Collector::collect): Explicitly mark the ExecState stack.

(KJS::Collector::reportOutOfMemoryToAllExecStates): Slight change in
behavior: We no longer throw an exception in any global ExecStates,
since global ExecStates are more like pseudo-ExecStates, and aren't
used for script execution. (It's unclear what would happen if you left
an exception waiting around in a global ExecState, but it probably
wouldn't be good.)

WebCore:

Reviewed by Maciej Stachowiak.

Adapted WebCore to the fix for http://bugs.webkit.org/show_bug.cgi?id=16909
REGRESSION: Amazon.com crash (ActivationImp)

  • bindings/js/kjs_proxy.cpp: (WebCore::KJSProxy::~KJSProxy): No convenient way to make this assertion anymore. (It wasn't firing for anyone, anyway, so it's no big loss.)
  • bindings/objc/WebScriptObject.mm: (+[WebScriptObject throwException:]): Use the ExecState stack, instead of currentExec. (-[WebScriptObject setException:]): ditto. Also, a slight change in behavior: If no ExecStates are active, we no longer throw an exception in the global ExecState. The JavaScriptCore ChangeLog explains why. This also matches the behavior of +throwException.

LayoutTests:

Layout test for http://bugs.webkit.org/show_bug.cgi?id=16909
REGRESSION: Amazon.com crash (ActivationImp)

  • fast/js/exec-state-marking-expected.txt: Added.
  • fast/js/exec-state-marking.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/ExecState.h

    r29425 r29710  
    5252    struct LocalStorageEntry;
    5353   
     54    typedef Vector<ExecState*, 16> ExecStateStack;
     55
    5456    /**
    5557     * Represents the current state of script execution. This is
     
    8688       
    8789        ExecState* callingExecState() { return m_callingExec; }
    88         ExecState* savedExec() { return m_savedExec; }
    8990       
    9091        ActivationImp* activationObject() { return m_activation; }
     
    107108        bool inSwitch() const { return (m_switchDepth > 0); }
    108109
    109         void mark();
    110        
    111110        // These pointers are used to avoid accessing global variables for these,
    112111        // to avoid taking PIC branches in Mach-O binaries.
     
    179178        }
    180179
     180        ExecState(JSGlobalObject*);
    181181        ExecState(JSGlobalObject*, JSObject* thisObject, ProgramNode*);
    182182        ExecState(JSGlobalObject*, EvalNode*, ExecState* callingExecState);
     
    185185        ~ExecState();
    186186
     187        static void markActiveExecStates();
     188        static ExecStateStack& activeExecStates();
     189
    187190    private:
    188191        // ExecStates are always stack-allocated, and the garbage collector
     
    195198
    196199        ExecState* m_callingExec;
    197         ExecState* m_savedExec;
     200
    198201        ScopeNode* m_scopeNode;
    199202       
Note: See TracChangeset for help on using the changeset viewer.