Ignore:
Timestamp:
Sep 6, 2012, 6:42:53 PM (13 years ago)
Author:
[email protected]
Message:

Source/JavaScriptCore: Rolled back in <http://trac.webkit.org/changeset/127698> with a fix for
fast/dom/HTMLScriptElement/script-reexecution-pretty-diff.html, which
is to make sure that function declarations don't put their names in scope.

Reviewed by Gavin Barraclough.

Named functions should not allocate scope objects for their names
https://bugs.webkit.org/show_bug.cgi?id=95659

Reviewed by Oliver Hunt.

LayoutTests: Rolled back in <http://trac.webkit.org/changeset/127698> with a fix for
fast/dom/HTMLScriptElement/script-reexecution-pretty-diff.html.

Added a more explicit test for the feature I broke in
fast/dom/HTMLScriptElement/script-reexecution-pretty-diff.html.

Reviewed by Gavin Barraclough.

Named functions should not allocate scope objects for their names
https://bugs.webkit.org/show_bug.cgi?id=95659

Reviewed by Oliver Hunt.

  • fast/dom/HTMLScriptElement/script-reexecution.html:
  • fast/js/function-name-is-in-scope-expected.txt: Added.
  • fast/js/function-name-is-in-scope.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r127774 r127810  
    13481348            FunctionExecutable* function = codeBlock->functionDecl(i);
    13491349            PutPropertySlot slot;
    1350             variableObject->methodTable()->put(variableObject, callFrame, function->name(), function->make(callFrame, scope), slot);
     1350            variableObject->methodTable()->put(variableObject, callFrame, function->name(), JSFunction::create(callFrame, function, scope), slot);
    13511351        }
    13521352    }
     
    42804280        JSFunction* func = JSFunction::create(callFrame, function, callFrame->scope());
    42814281
    4282         /*
    4283             The Identifier in a FunctionExpression can be referenced from inside
    4284             the FunctionExpression's FunctionBody to allow the function to call
    4285             itself recursively. However, unlike in a FunctionDeclaration, the
    4286             Identifier in a FunctionExpression cannot be referenced from and
    4287             does not affect the scope enclosing the FunctionExpression.
    4288          */
    4289         if (!function->name().isNull()) {
    4290             JSNameScope* functionScopeObject = JSNameScope::create(callFrame, function->name(), func, ReadOnly | DontDelete);
    4291             func->setScope(*globalData, functionScopeObject);
    4292         }
    4293 
    42944282        callFrame->uncheckedR(dst) = JSValue(func);
    42954283
Note: See TracChangeset for help on using the changeset viewer.