Changeset 16797 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Oct 4, 2006, 6:07:49 PM (19 years ago)
Author:
ggaren
Message:

Patch by Darin and me, reviewed by Maciej.

Fixed <rdar://problem/4518397> REGRESSION(?): Oft-seen but unrepro crash

in JavaScript garbage collection (KJS::Collector::collect())

<rdar://problem/4752492> Crash in KJS::collect


The issue here was allocating one garbage-collected object in the midst
of allocating a second garbage-collected object. In such a case, the
zeroIfFree word lies.

  • kjs/collector.cpp: (KJS::Collector::allocate): (KJS::Collector::collect):
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r16795 r16797  
     12006-10-04  Geoffrey Garen  <[email protected]>
     2
     3        Patch by Darin and me, reviewed by Maciej.
     4
     5        Fixed <rdar://problem/4518397> REGRESSION(?): Oft-seen but unrepro crash
     6              in JavaScript garbage collection (KJS::Collector::collect())
     7               <rdar://problem/4752492> Crash in KJS::collect
     8             
     9        The issue here was allocating one garbage-collected object in the midst
     10        of allocating a second garbage-collected object. In such a case, the
     11        zeroIfFree word lies.
     12
     13        * kjs/collector.cpp:
     14        (KJS::Collector::allocate):
     15        (KJS::Collector::collect):
     16
    1172006-10-04  Kevin McCullough  <[email protected]>
    218
  • trunk/JavaScriptCore/kjs/collector.cpp

    r16614 r16797  
    119119  size_t numLiveObjectsAtLastCollect = heap.numLiveObjectsAtLastCollect;
    120120  size_t numNewObjects = numLiveObjects - numLiveObjectsAtLastCollect;
     121
    121122  if (numNewObjects >= ALLOCATIONS_PER_COLLECTION && numNewObjects >= numLiveObjectsAtLastCollect) {
    122123    collect();
     
    493494          imp->m_marked = false;
    494495        } else if (currentThreadIsMainThread || imp->m_destructorIsThreadSafe) {
     496          // special case for allocated but uninitialized object
     497          // (We don't need this check earlier because nothing prior this point assumes the object has a valid vptr.)
     498          if (cell->u.freeCell.zeroIfFree == 0)
     499            continue;
     500
    495501          imp->~JSCell();
    496502          --usedCells;
     
    505511    } else {
    506512      size_t minimumCellsToProcess = usedCells;
    507       for (size_t i = 0; i < minimumCellsToProcess; i++) {
     513      for (size_t i = 0; (i < minimumCellsToProcess) & (i < CELLS_PER_BLOCK); i++) {
    508514        CollectorCell *cell = curBlock->cells + i;
    509515        if (cell->u.freeCell.zeroIfFree == 0) {
Note: See TracChangeset for help on using the changeset viewer.