Ignore:
Timestamp:
Aug 30, 2012, 3:50:00 PM (13 years ago)
Author:
[email protected]
Message:

Use one object instead of two for closures, eliminating ScopeChainNode
https://bugs.webkit.org/show_bug.cgi?id=95501

Reviewed by Filip Pizlo.

../JavaScriptCore:

This patch removes ScopeChainNode, and moves all the data and related
functions that used to be in ScopeChainNode into JSScope.

Most of this patch is mechanical changes to use a JSScope* where we used
to use a ScopeChainNode*. I've only specifically commented about items
that were non-mechanical.

  • runtime/Completion.cpp:

(JSC::evaluate):

  • runtime/Completion.h: Don't require an explicit scope chain argument

when evaluating code. Clients never wanted anything other than the
global scope, and other arbitrary scopes probably wouldn't work
correctly, anyway.

  • runtime/JSScope.cpp:
  • runtime/JSScope.h:

(JSC::JSScope::JSScope): JSScope now requires the data we used to pass to
ScopeChainNode, so it can link itself into the scope chain correctly.

  • runtime/JSWithScope.h:

(JSC::JSWithScope::create):
(JSC::JSWithScope::JSWithScope): JSWithScope gets an extra constructor
for specifically supplying your own scope chain. The DOM needs this
interface for setting up the scope chain for certain event handlers.
Other clients always just push the JSWithScope to the head of the current
scope chain.

../WebCore:

Mechanical changes to update for JSC interface changes.

../WebKit/mac:

Mechanical change to update for JSC interface change.

../WebKit/qt:

Mechanical change to update for JSC interface change.

  • Api/qwebelement.cpp:

(QWebElement::evaluateJavaScript):

../WebKit2:

Mechanical changes to update for JSC interface change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.h

    r127199 r127202  
    3434    class JSActivation;
    3535    class Interpreter;
    36     class ScopeChainNode;
     36    class JSScope;
    3737
    3838    // Represents the current state of script execution.
     
    4343        JSObject* callee() const { return this[RegisterFile::Callee].function(); }
    4444        CodeBlock* codeBlock() const { return this[RegisterFile::CodeBlock].Register::codeBlock(); }
    45         ScopeChainNode* scopeChain() const
    46         {
    47             ASSERT(this[RegisterFile::ScopeChain].Register::scopeChain());
    48             return this[RegisterFile::ScopeChain].Register::scopeChain();
     45        JSScope* scope() const
     46        {
     47            ASSERT(this[RegisterFile::ScopeChain].Register::scope());
     48            return this[RegisterFile::ScopeChain].Register::scope();
    4949        }
    5050
     
    167167
    168168        void setCallerFrame(CallFrame* callerFrame) { static_cast<Register*>(this)[RegisterFile::CallerFrame] = callerFrame; }
    169         void setScopeChain(ScopeChainNode* scopeChain) { static_cast<Register*>(this)[RegisterFile::ScopeChain] = scopeChain; }
    170 
    171         ALWAYS_INLINE void init(CodeBlock* codeBlock, Instruction* vPC, ScopeChainNode* scopeChain,
     169        void setScope(JSScope* scope) { static_cast<Register*>(this)[RegisterFile::ScopeChain] = scope; }
     170
     171        ALWAYS_INLINE void init(CodeBlock* codeBlock, Instruction* vPC, JSScope* scope,
    172172            CallFrame* callerFrame, int argc, JSObject* callee)
    173173        {
     
    176176
    177177            setCodeBlock(codeBlock);
    178             setScopeChain(scopeChain);
     178            setScope(scope);
    179179            setCallerFrame(callerFrame);
    180180            setReturnPC(vPC); // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
Note: See TracChangeset for help on using the changeset viewer.