Changeset 106185 in webkit


Ignore:
Timestamp:
Jan 28, 2012 2:18:32 AM (12 years ago)
Author:
fpizlo@apple.com
Message:

GC invoked while doing an old JIT property storage reallocation may lead
to an object that refers to a dead structure
https://bugs.webkit.org/show_bug.cgi?id=77273
<rdar://problem/10770565>

Reviewed by Gavin Barraclough.

The put_by_id transition was already saving the old structure by virtue of
having the object on the stack, so that wasn't going to get deleted. But the
new structure was unprotected in the transition. I've now changed the
transition code to save the new structure, ensuring that the GC will know it
to be marked if invoked from within put_by_id_transition_realloc.

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::privateCompilePutByIdTransition):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::privateCompilePutByIdTransition):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • jit/JITStubs.h:

(JSC):
():

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r106170 r106185  
     12012-01-28  Filip Pizlo  <fpizlo@apple.com>
     2
     3        GC invoked while doing an old JIT property storage reallocation may lead
     4        to an object that refers to a dead structure
     5        https://bugs.webkit.org/show_bug.cgi?id=77273
     6        <rdar://problem/10770565>
     7
     8        Reviewed by Gavin Barraclough.
     9       
     10        The put_by_id transition was already saving the old structure by virtue of
     11        having the object on the stack, so that wasn't going to get deleted. But the
     12        new structure was unprotected in the transition. I've now changed the
     13        transition code to save the new structure, ensuring that the GC will know it
     14        to be marked if invoked from within put_by_id_transition_realloc.
     15
     16        * jit/JITPropertyAccess.cpp:
     17        (JSC::JIT::privateCompilePutByIdTransition):
     18        * jit/JITPropertyAccess32_64.cpp:
     19        (JSC::JIT::privateCompilePutByIdTransition):
     20        * jit/JITStubs.cpp:
     21        (JSC::DEFINE_STUB_FUNCTION):
     22        * jit/JITStubs.h:
     23        (JSC):
     24        ():
     25
    1262012-01-27  Sheriff Bot  <webkit.review.bot@gmail.com>
    227
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp

    r105636 r106185  
    549549        stubCall.skipArgument(); // value
    550550        stubCall.addArgument(TrustedImm32(oldStructure->propertyStorageCapacity()));
    551         stubCall.addArgument(TrustedImm32(newStructure->propertyStorageCapacity()));
     551        stubCall.addArgument(TrustedImmPtr(newStructure));
    552552        stubCall.call(regT0);
    553553        emitGetJITStubArg(2, regT1);
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp

    r105636 r106185  
    518518        stubCall.skipArgument(); // value
    519519        stubCall.addArgument(TrustedImm32(oldStructure->propertyStorageCapacity()));
    520         stubCall.addArgument(TrustedImm32(newStructure->propertyStorageCapacity()));
     520        stubCall.addArgument(TrustedImmPtr(newStructure));
    521521        stubCall.call(regT0);
    522522
  • trunk/Source/JavaScriptCore/jit/JITStubs.cpp

    r106067 r106185  
    14911491    JSValue baseValue = stackFrame.args[0].jsValue();
    14921492    int32_t oldSize = stackFrame.args[3].int32();
    1493     int32_t newSize = stackFrame.args[4].int32();
     1493    Structure* newStructure = stackFrame.args[4].structure();
     1494    int32_t newSize = newStructure->propertyStorageCapacity();
    14941495
    14951496    ASSERT(baseValue.isObject());
  • trunk/Source/JavaScriptCore/jit/JITStubs.h

    r106067 r106185  
    6060    class RegisterFile;
    6161    class RegExp;
     62    class Structure;
    6263
    6364    template <typename T> class Weak;
     
    7980        JSGlobalObject* globalObject() { return static_cast<JSGlobalObject*>(asPointer); }
    8081        JSString* jsString() { return static_cast<JSString*>(asPointer); }
     82        Structure* structure() { return static_cast<Structure*>(asPointer); }
    8183        ReturnAddressPtr returnAddress() { return ReturnAddressPtr(asPointer); }
    8284    };
Note: See TracChangeset for help on using the changeset viewer.