Ignore:
Timestamp:
Aug 20, 2008, 12:23:06 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Geoff Garen.

Bring back shared JSGlobalData and implicit locking, because too many clients rely on it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/collector.cpp

    r35830 r35853  
    2525#include "ExecState.h"
    2626#include "JSGlobalObject.h"
     27#include "JSLock.h"
    2728#include "JSString.h"
    2829#include "JSValue.h"
     
    135136Heap::~Heap()
    136137{
     138    JSLock lock(false);
     139
    137140    // The global object is not GC protected at this point, so sweeping may delete it (and thus the global data)
    138141    // before other objects that may use the global data.
     
    274277
    275278    CollectorHeap& heap = heapType == PrimaryHeap ? primaryHeap : numberHeap;
     279    ASSERT(JSLock::lockCount() > 0);
     280    ASSERT(JSLock::currentThreadIsHoldingLock());
    276281    ASSERT(s <= HeapConstants<heapType>::cellSize);
    277282    UNUSED_PARAM(s); // s is now only used for the above assert
     
    778783{
    779784    // Most clients do not need to call this, with the notable exception of WebCore.
    780     // Clients that use context from a single context group from multiple threads are supposed
     785    // Clients that use shared heap have JSLock protection, while others are supposed
    781786    // to do explicit locking. WebCore violates this contract in Database code,
    782787    // which calls gcUnprotect from a secondary thread.
     
    788793{
    789794    ASSERT(k);
     795    ASSERT(JSLock::currentThreadIsHoldingLock() || !m_globalData->isSharedInstance);
    790796
    791797    if (JSImmediate::isImmediate(k))
     
    804810{
    805811    ASSERT(k);
     812    ASSERT(JSLock::currentThreadIsHoldingLock() || !m_globalData->isSharedInstance);
    806813
    807814    if (JSImmediate::isImmediate(k))
     
    941948bool Heap::collect()
    942949{
     950#ifndef NDEBUG
     951    if (m_globalData->isSharedInstance) {
     952        ASSERT(JSLock::lockCount() > 0);
     953        ASSERT(JSLock::currentThreadIsHoldingLock());
     954    }
     955#endif
     956
    943957    ASSERT((primaryHeap.operationInProgress == NoOperation) | (numberHeap.operationInProgress == NoOperation));
    944958    if ((primaryHeap.operationInProgress != NoOperation) | (numberHeap.operationInProgress != NoOperation))
Note: See TracChangeset for help on using the changeset viewer.