Ignore:
Timestamp:
Oct 16, 2007, 2:35:50 PM (18 years ago)
Author:
ggaren
Message:

JavaScriptCore:

Reviewed by Maciej Stachowiak.


Re-structured variable and function declaration code.


Command-line JS iBench shows no regression.


Here are the changes:

  1. Function declarations are now processed at the same time as var declarations -- namely, immediately upon entry to an execution context. This does not match Firefox, which waits to process a function declaration until the declaration's containing block executes, but it does match IE and the ECMA spec. (10.1.3 states that var and function declarations should be processed at the same time -- namely, "On entering an execution context." 12.2 states that "A Block does not define a new execution scope.")
  1. Declaration processing proceeds iteratively now, rather than recursively, storing the nodes is finds in stacks. This will later facilitate an optimization to hold on to the gathered declaration nodes, rather than re-fetching them in every function call. [ http://bugs.webkit.org/show_bug.cgi?id=14868 ]

Modified these tests because they expected the incorrect Mozilla
behavior described above:

  • tests/mozilla/ecma_3/Function/scope-001.js:
  • tests/mozilla/js1_5/Scope/regress-184107.js:

LayoutTests:

Reviewed by Maciej Stachowiak.


Layout tests for http://bugs.webkit.org/show_bug.cgi?id=15478
Declare vars and functions iteratively upon entering an execution context

  • fast/js/function-declarations-expected.txt: Added.
  • fast/js/function-declarations.html: Added.
  • fast/js/var-declarations-expected.txt: Added.
  • fast/js/var-declarations.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/function.cpp

    r26676 r26682  
    325325void DeclaredFunctionImp::processVarDecls(ExecState* exec)
    326326{
    327   body->processVarDecls(exec);
     327    body->processDeclarations(exec);
    328328}
    329329
     
    839839       
    840840        // execute the code
    841         progNode->processVarDecls(&newExec);
     841        progNode->processDeclarations(&newExec);
    842842        Completion c = progNode->execute(&newExec);
    843843         
Note: See TracChangeset for help on using the changeset viewer.