Title: [106185] trunk/Source/_javascript_Core
Revision
106185
Author
[email protected]
Date
2012-01-28 02:18:32 -0800 (Sat, 28 Jan 2012)

Log 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):
():

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (106184 => 106185)


--- trunk/Source/_javascript_Core/ChangeLog	2012-01-28 07:17:28 UTC (rev 106184)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-01-28 10:18:32 UTC (rev 106185)
@@ -1,3 +1,28 @@
+2012-01-28  Filip Pizlo  <[email protected]>
+
+        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):
+        ():
+
 2012-01-27  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r106167.

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (106184 => 106185)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2012-01-28 07:17:28 UTC (rev 106184)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2012-01-28 10:18:32 UTC (rev 106185)
@@ -548,7 +548,7 @@
         stubCall.skipArgument(); // ident
         stubCall.skipArgument(); // value
         stubCall.addArgument(TrustedImm32(oldStructure->propertyStorageCapacity()));
-        stubCall.addArgument(TrustedImm32(newStructure->propertyStorageCapacity()));
+        stubCall.addArgument(TrustedImmPtr(newStructure));
         stubCall.call(regT0);
         emitGetJITStubArg(2, regT1);
 

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp (106184 => 106185)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2012-01-28 07:17:28 UTC (rev 106184)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2012-01-28 10:18:32 UTC (rev 106185)
@@ -517,7 +517,7 @@
         stubCall.skipArgument(); // ident
         stubCall.skipArgument(); // value
         stubCall.addArgument(TrustedImm32(oldStructure->propertyStorageCapacity()));
-        stubCall.addArgument(TrustedImm32(newStructure->propertyStorageCapacity()));
+        stubCall.addArgument(TrustedImmPtr(newStructure));
         stubCall.call(regT0);
 
         restoreReturnAddressBeforeReturn(regT3);

Modified: trunk/Source/_javascript_Core/jit/JITStubs.cpp (106184 => 106185)


--- trunk/Source/_javascript_Core/jit/JITStubs.cpp	2012-01-28 07:17:28 UTC (rev 106184)
+++ trunk/Source/_javascript_Core/jit/JITStubs.cpp	2012-01-28 10:18:32 UTC (rev 106185)
@@ -1490,7 +1490,8 @@
 
     JSValue baseValue = stackFrame.args[0].jsValue();
     int32_t oldSize = stackFrame.args[3].int32();
-    int32_t newSize = stackFrame.args[4].int32();
+    Structure* newStructure = stackFrame.args[4].structure();
+    int32_t newSize = newStructure->propertyStorageCapacity();
 
     ASSERT(baseValue.isObject());
     JSObject* base = asObject(baseValue);

Modified: trunk/Source/_javascript_Core/jit/JITStubs.h (106184 => 106185)


--- trunk/Source/_javascript_Core/jit/JITStubs.h	2012-01-28 07:17:28 UTC (rev 106184)
+++ trunk/Source/_javascript_Core/jit/JITStubs.h	2012-01-28 10:18:32 UTC (rev 106185)
@@ -59,6 +59,7 @@
     class PutPropertySlot;
     class RegisterFile;
     class RegExp;
+    class Structure;
 
     template <typename T> class Weak;
 
@@ -78,6 +79,7 @@
         JSPropertyNameIterator* propertyNameIterator() { return static_cast<JSPropertyNameIterator*>(asPointer); }
         JSGlobalObject* globalObject() { return static_cast<JSGlobalObject*>(asPointer); }
         JSString* jsString() { return static_cast<JSString*>(asPointer); }
+        Structure* structure() { return static_cast<Structure*>(asPointer); }
         ReturnAddressPtr returnAddress() { return ReturnAddressPtr(asPointer); }
     };
     
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to