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/jsc.cpp

    r127191 r127202  
    358358    StopWatch stopWatch;
    359359    stopWatch.start();
    360     evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), jscSource(script.data(), fileName), JSValue(), &exception);
     360    evaluate(globalObject->globalExec(), jscSource(script.data(), fileName), JSValue(), &exception);
    361361    stopWatch.stop();
    362362
     
    379379   
    380380    JSValue evaluationException;
    381     JSValue result = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), jscSource(script.data(), fileName), JSValue(), &evaluationException);
     381    JSValue result = evaluate(globalObject->globalExec(), jscSource(script.data(), fileName), JSValue(), &evaluationException);
    382382    if (evaluationException)
    383383        throwError(exec, evaluationException);
     
    551551
    552552        JSValue evaluationException;
    553         JSValue returnValue = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), jscSource(script, fileName), JSValue(), &evaluationException);
     553        JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(script, fileName), JSValue(), &evaluationException);
    554554        success = success && !evaluationException;
    555555        if (dump && !evaluationException)
     
    597597            add_history(line);
    598598        JSValue evaluationException;
    599         JSValue returnValue = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), jscSource(line, interpreterName), JSValue(), &evaluationException);
     599        JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(line, interpreterName), JSValue(), &evaluationException);
    600600        free(line);
    601601#else
     
    614614
    615615        JSValue evaluationException;
    616         JSValue returnValue = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), jscSource(line.data(), interpreterName), JSValue(), &evaluationException);
     616        JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(line.data(), interpreterName), JSValue(), &evaluationException);
    617617#endif
    618618        if (evaluationException)
Note: See TracChangeset for help on using the changeset viewer.