Changeset 115217 in webkit for trunk/Source/JavaScriptCore/parser


Ignore:
Timestamp:
Apr 25, 2012, 9:11:29 AM (13 years ago)
Author:
[email protected]
Message:

Closure in try {} with catch captures all locals from the enclosing function
https://bugs.webkit.org/show_bug.cgi?id=84804

Reviewed by Oliver Hunt.

Changed the capturing of local variables from capturing when eval is used,
within a "with" or within a "catch" to be just when an eval is used.
Renamed the function returning that we should capture from
getCapturedVariables() to usesEval(), since that what it noew returns.
Needed to fix the "with" code to only range check when the activation
has actually been torn off. Added m_isTornOff to JSActivation to
track this.

  • parser/Parser.h:

(JSC::Scope::usesEval):
(JSC::Scope::getCapturedVariables):

  • runtime/JSActivation.cpp:

(JSC::JSActivation::JSActivation):
(JSC::JSActivation::symbolTableGet):
(JSC::JSActivation::symbolTablePut):

  • runtime/JSActivation.h:

(JSActivation):
(JSC::JSActivation::tearOff):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r114702 r115217  
    163163    ALWAYS_INLINE void setFlags(ScopeFlags scopeFlags) { m_scopeFlags |= scopeFlags; }
    164164
    165     ALWAYS_INLINE bool needsFullActivation() const { return m_scopeFlags & (UsesEvalFlag | UsesWithFlag | UsesCatchFlag); }
     165    ALWAYS_INLINE bool usesEval() const { return m_scopeFlags & UsesEvalFlag; }
    166166    ALWAYS_INLINE bool strictMode() const { return m_scopeFlags & StrictModeFlag; }
    167167    ALWAYS_INLINE bool shadowsArguments() const { return m_scopeFlags & ShadowsArgumentsFlag; }
     
    270270    void getCapturedVariables(IdentifierSet& capturedVariables)
    271271    {
    272         if (needsFullActivation()) {
     272        if (usesEval()) {
    273273            capturedVariables.swap(m_declaredVariables);
    274274            return;
Note: See TracChangeset for help on using the changeset viewer.