Changeset 82874 in webkit


Ignore:
Timestamp:
Apr 4, 2011 2:29:56 PM (13 years ago)
Author:
ggaren@apple.com
Message:

2011-04-04 Geoffrey Garen <ggaren@apple.com>

Reviewed by Oliver Hunt.

Standardized handling of handles for immediate values
https://bugs.webkit.org/show_bug.cgi?id=57788

  • collector/handles/HandleHeap.cpp: (JSC::HandleHeap::clearWeakPointers): Don't check for null or non-cell values here, because our write barrier guarantees that such values are not in the weak list.

(JSC::HandleHeap::writeBarrier): Standardized on checking for null before
checking for cell, and on using early return instead of if/else.

  • collector/handles/HandleHeap.h: (JSC::HandleHeap::deallocate): (JSC::HandleHeap::makeWeak): Ditto.
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r82872 r82874  
     12011-04-04  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Standardized handling of handles for immediate values
     6        https://bugs.webkit.org/show_bug.cgi?id=57788
     7
     8        * collector/handles/HandleHeap.cpp:
     9        (JSC::HandleHeap::clearWeakPointers): Don't check for null or non-cell
     10        values here, because our write barrier guarantees that such values are
     11        not in the weak list.
     12
     13        (JSC::HandleHeap::writeBarrier): Standardized on checking for null before
     14        checking for cell, and on using early return instead of if/else.
     15
     16        * collector/handles/HandleHeap.h:
     17        (JSC::HandleHeap::deallocate):
     18        (JSC::HandleHeap::makeWeak): Ditto.
     19
    1202011-04-04  Geoffrey Garen  <ggaren@apple.com>
    221
  • trunk/Source/JavaScriptCore/collector/handles/HandleHeap.cpp

    r82871 r82874  
    6868
    6969        JSValue value = *node->slot();
    70         if (!value || !value.isCell())
    71             continue;
    72        
     70        ASSERT(value);
     71
    7372        JSCell* cell = value.asCell();
    74         ASSERT(!cell || cell->structure());
    75        
     73        ASSERT(cell && cell->structure());
    7674#if ENABLE(JSC_ZOMBIES)
    7775        ASSERT(!cell->isZombie());
    7876#endif
     77
    7978        if (Heap::isMarked(cell))
    8079            continue;
     
    9897    ASSERT(!m_nextToFinalize); // Forbid assignment to handles during the finalization phase, since it would violate many GC invariants.
    9998
    100     if (slot->isCell() == value.isCell() && !value == !*slot)
     99    if (!value == !*slot && slot->isCell() == value.isCell())
    101100        return;
     101
    102102    Node* node = toNode(slot);
    103103    SentinelLinkedList<Node>::remove(node);
    104     if (!value.isCell() || !value) {
     104    if (!value || !value.isCell()) {
    105105        m_immediateList.push(node);
    106106        return;
    107107    }
    108     if (node->isWeak())
     108
     109    if (node->isWeak()) {
    109110        m_weakList.push(node);
    110     else
    111         m_strongList.push(node);
     111        return;
     112    }
     113
     114    m_strongList.push(node);
    112115}
    113116
  • trunk/Source/JavaScriptCore/collector/handles/HandleHeap.h

    r82872 r82874  
    146146{
    147147    Node* node = toNode(handle);
    148     if (m_nextToFinalize == node) {
     148    if (node == m_nextToFinalize) {
    149149        m_nextToFinalize = node->next();
    150150        ASSERT(m_nextToFinalize->next());
    151151    }
     152
    152153    SentinelLinkedList<Node>::remove(node);
    153154    m_freeList.push(node);
     
    157158{
    158159    Node* node = toNode(handle);
     160    node->makeWeak(weakOwner, context);
     161
    159162    SentinelLinkedList<Node>::remove(node);
    160     node->makeWeak(weakOwner, context);
    161     if (handle->isCell() && *handle)
    162         m_weakList.push(node);
    163     else
     163    if (!*handle || !handle->isCell()) {
    164164        m_immediateList.push(node);
     165        return;
     166    }
     167
     168    m_weakList.push(node);
    165169}
    166170
Note: See TracChangeset for help on using the changeset viewer.