Changeset 95877 in webkit


Ignore:
Timestamp:
Sep 23, 2011 3:59:18 PM (13 years ago)
Author:
barraclough@apple.com
Message:

Source/JavaScriptCore: Strict mode does not work in non-trivial nested functions.
https://bugs.webkit.org/show_bug.cgi?id=68740

Reviewed by Oliver Hunt.

Function-info caching does not preserve all state that it should.

  • parser/JSParser.cpp:

(JSC::JSParser::Scope::saveFunctionInfo):
(JSC::JSParser::Scope::restoreFunctionInfo):
(JSC::JSParser::parseFunctionInfo):

  • parser/SourceProviderCacheItem.h:

LayoutTests: gh@apple.com>

Strict mode does not work in non-trivial nested functions.
https://bugs.webkit.org/show_bug.cgi?id=68740

Reviewed by Oliver Hunt.

Function-info caching does not preserve all state that it should.

  • fast/js/nested-functions-expected.txt: Added.
  • fast/js/nested-functions.html: Added.
  • fast/js/script-tests/nested-functions.js: Added.

(runTests.test1):
(runTests.test2):
(runTests.test3):
(runTests):

Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95874 r95877  
     1gh@apple.com>
     2
     3        Strict mode does not work in non-trivial nested functions.
     4        https://bugs.webkit.org/show_bug.cgi?id=68740
     5
     6        Reviewed by Oliver Hunt.
     7
     8        Function-info caching does not preserve all state that it should.
     9
     10        * fast/js/nested-functions-expected.txt: Added.
     11        * fast/js/nested-functions.html: Added.
     12        * fast/js/script-tests/nested-functions.js: Added.
     13        (runTests.test1):
     14        (runTests.test2):
     15        (runTests.test3):
     16        (runTests):
     17
    1182011-09-23  Dan Bernstein  <mitz@apple.com>
    219
  • trunk/Source/JavaScriptCore/ChangeLog

    r95876 r95877  
     12011-09-23  Gavin Barraclough  <barraclough@apple.com>
     2
     3        Strict mode does not work in non-trivial nested functions.
     4        https://bugs.webkit.org/show_bug.cgi?id=68740
     5
     6        Reviewed by Oliver Hunt.
     7
     8        Function-info caching does not preserve all state that it should.
     9
     10        * parser/JSParser.cpp:
     11        (JSC::JSParser::Scope::saveFunctionInfo):
     12        (JSC::JSParser::Scope::restoreFunctionInfo):
     13        (JSC::JSParser::parseFunctionInfo):
     14        * parser/SourceProviderCacheItem.h:
     15
    1162011-09-23  Filip Pizlo  <fpizlo@apple.com>
    217
  • trunk/Source/JavaScriptCore/parser/JSParser.cpp

    r90535 r95877  
    753753            ASSERT(m_isFunction);
    754754            info->usesEval = m_usesEval;
     755            info->strictMode = m_strictMode;
     756            info->needsFullActivation = m_needsFullActivation;
    755757            copyCapturedVariablesToVector(m_writtenVariables, info->writtenVariables);
    756758            copyCapturedVariablesToVector(m_usedVariables, info->usedVariables);
     
    761763            ASSERT(m_isFunction);
    762764            m_usesEval = info->usesEval;
     765            m_strictMode = info->strictMode;
     766            m_needsFullActivation = info->needsFullActivation;
    763767            unsigned size = info->usedVariables.size();
    764768            for (unsigned i = 0; i < size; ++i)
     
    16091613    bodyStartLine = tokenLine();
    16101614
     1615    // If we know about this function already, we can use the cached info and skip the parser to the end of the function.
    16111616    if (const SourceProviderCacheItem* cachedInfo = TreeBuilder::CanUseFunctionCache ? findCachedFunctionInfo(openBracePos) : 0) {
    1612         // If we know about this function already, we can use the cached info and skip the parser to the end of the function.
    1613         body = context.createFunctionBody(strictMode());
     1617        // If we're in a strict context, the cached function info must say it was strict too.
     1618        ASSERT(!strictMode() || cachedInfo->strictMode);
     1619        body = context.createFunctionBody(cachedInfo->strictMode);
    16141620
    16151621        functionScope->restoreFunctionInfo(cachedInfo);
  • trunk/Source/JavaScriptCore/parser/SourceProviderCacheItem.h

    r76611 r95877  
    6060    int closeBracePos;
    6161    bool usesEval;
     62    bool strictMode;
     63    bool needsFullActivation;
    6264    Vector<RefPtr<StringImpl> > usedVariables;
    6365    Vector<RefPtr<StringImpl> > writtenVariables;
Note: See TracChangeset for help on using the changeset viewer.