Ignore:
Timestamp:
Nov 1, 2007, 1:50:28 PM (18 years ago)
Author:
ggaren
Message:

JavaScriptCore:

Reviewed by Maciej Stachowiak.

Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
REGRESSION(r27344): Crash on load at finance.yahoo.com


Reverted a small portion of my last check-in. (The speedup and the List
removal are still there, though.)


ActivationImp needs to hold a pointer to its function, and mark that
pointer (rather than accessing its function through its ExecState, and
counting on the active scope to mark its function) because a closure
can cause an ActivationImp to outlive its ExecState along with any
active scope.

  • kjs/ExecState.cpp: (KJS::ExecState::ExecState):
  • kjs/function.cpp: (KJS::FunctionImp::~FunctionImp): (KJS::ActivationImp::ActivationImp):
  • kjs/function.h: (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):

Also made HashTable a little more crash-happy in debug builds, so
problems like this will show up earlier:


  • wtf/HashTable.h: (WTF::HashTable::~HashTable):

LayoutTests:

Reviewed by Maciej Stachowiak.


Layout test for http://bugs.webkit.org/show_bug.cgi?id=15785
REGRESSION(r27344): Crash on load at finance.yahoo.com

  • fast/js/activation-object-function-lifetime-expected.txt: Added.
  • fast/js/activation-object-function-lifetime.html: Added.
File:
1 edited

Legend:

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

    r27344 r27359  
    485485            value->mark();
    486486    }
     487   
     488    ASSERT(d->function);
     489    if (!d->function->marked())
     490        d->function->mark();
    487491
    488492    if (d->argumentsObject && !d->argumentsObject->marked())
     
    492496void ActivationImp::createArgumentsObject(ExecState* exec)
    493497{
    494     d->argumentsObject = new Arguments(exec, d->exec->function(), *d->exec->arguments(), this);
     498    // Since "arguments" is only accessible while a function is being called,
     499    // we can retrieve our argument list from the ExecState for our function
     500    // call instead of storing the list ourselves.
     501    d->argumentsObject = new Arguments(exec, d->function, *d->exec->arguments(), this);
    495502}
    496503
Note: See TracChangeset for help on using the changeset viewer.