Changeset 37450 in webkit


Ignore:
Timestamp:
Oct 9, 2008 2:47:31 PM (16 years ago)
Author:
cwzwarich@webkit.org
Message:

2008-10-09 Cameron Zwarich <zwarich@apple.com>

Reviewed by Oliver Hunt.

Bug 21459: REGRESSION (r37324): Safari crashes inside JavaScriptCore while browsing hulu.com
<https://bugs.webkit.org/show_bug.cgi?id=21459>

After r37324, an Arguments object does not mark an associated activation
object. This change was made because Arguments no longer directly used
the activation object in any way. However, if an activation is torn off,
then the backing store of Arguments becomes the register array of the
activation object. Arguments directly marks all of the arguments, but
the activation object is being collected, which causes its register
array to be freed and new memory to be allocated in its place.

Unfortunately, it does not seem possible to reproduce this issue in a
layout test.

  • kjs/Arguments.cpp: (JSC::Arguments::mark):
  • kjs/Arguments.h: (JSC::Arguments::setActivation): (JSC::Arguments::Arguments): (JSC::JSActivation::copyRegisters):
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r37446 r37450  
     12008-10-09  Cameron Zwarich  <zwarich@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Bug 21459: REGRESSION (r37324): Safari crashes inside JavaScriptCore while browsing hulu.com
     6        <https://bugs.webkit.org/show_bug.cgi?id=21459>
     7
     8        After r37324, an Arguments object does not mark an associated activation
     9        object. This change was made because Arguments no longer directly used
     10        the activation object in any way. However, if an activation is torn off,
     11        then the backing store of Arguments becomes the register array of the
     12        activation object. Arguments directly marks all of the arguments, but
     13        the activation object is being collected, which causes its register
     14        array to be freed and new memory to be allocated in its place.
     15
     16        Unfortunately, it does not seem possible to reproduce this issue in a
     17        layout test.
     18
     19        * kjs/Arguments.cpp:
     20        (JSC::Arguments::mark):
     21        * kjs/Arguments.h:
     22        (JSC::Arguments::setActivation):
     23        (JSC::Arguments::Arguments):
     24        (JSC::JSActivation::copyRegisters):
     25
    1262008-10-09  Ariya Hidayat  <ariya.hidayat@trolltech.com>
    227
  • trunk/JavaScriptCore/kjs/Arguments.cpp

    r37324 r37450  
    6565    if (!d->callee->marked())
    6666        d->callee->mark();
     67
     68    if (d->activation && !d->activation->marked())
     69        d->activation->mark();
    6770}
    6871
  • trunk/JavaScriptCore/kjs/Arguments.h

    r37433 r37450  
    3333
    3434    struct ArgumentsData : Noncopyable {
     35        JSActivation* activation;
     36
    3537        unsigned numParameters;
    3638        ptrdiff_t firstParameterIndex;
     
    6365        void copyRegisters();
    6466        bool isTornOff() const { return d->registerArray; }
    65         void setRegisters(Register* registers) { d->registers = registers; }
     67        void setActivation(JSActivation* activation)
     68        {
     69            d->activation = activation;
     70            d->registers = &activation->registerAt(0);
     71        }
    6672
    6773    private:
     
    94100        d->numArguments = numArguments;
    95101
     102        d->activation = 0;
    96103        d->registers = callFrame->registers();
    97104
     
    150157        setRegisters(registerArray + registerOffset, registerArray);
    151158        if (arguments && !arguments->isTornOff())
    152             static_cast<Arguments*>(arguments)->setRegisters(registerArray + registerOffset);
     159            static_cast<Arguments*>(arguments)->setActivation(this);
    153160    }
    154161
Note: See TracChangeset for help on using the changeset viewer.