Ignore:
Timestamp:
Mar 7, 2007, 7:37:06 AM (18 years ago)
Author:
ggaren
Message:

JavaScriptCore:

Reviewed by Maciej.

http://bugs.webkit.org/show_bug.cgi?id=12997

Wrap pthread-specific assertion in #if USE(MULTIPLE_THREADS).

  • kjs/collector.cpp: (KJS::Collector::markMainThreadOnlyObjects):

WebCore:

Reviewed by Maciej Stachowiak.


Fixed <rdar://problem/4576242> | http://bugs.webkit.org/show_bug.cgi?id=12586
PAC file: malloc deadlock sometimes causes a hang @ www.apple.com/pro/profiles/ (12586)


No test because this is very difficult to repro, and the new ASSERTs in
JavaScriptCore catch the underlying cause while running normal layout tests.


This is a modified version of r14752 on the branch.


The fix is to use a bit inside each node, instead of a hash table, to track
which node subtrees are in the process of being marked. This avoids a call
to malloc inside mark().


  • bindings/js/kjs_binding.cpp: (KJS::domObjects): (KJS::domNodesPerDocument):
  • bindings/js/kjs_dom.cpp: (KJS::DOMNode::mark):
  • dom/Node.cpp: (WebCore::Node::Node):
  • dom/Node.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/FastMalloc.cpp

    r19791 r20019  
    6666#include "FastMalloc.h"
    6767
     68#include "Assertions.h"
     69
    6870#ifndef USE_SYSTEM_MALLOC
    6971#ifndef NDEBUG
     
    7476#endif
    7577
     78#ifndef NDEBUG
     79namespace WTF {
     80
     81static bool isForbidden = false;
     82void fastMallocForbid()
     83{
     84    isForbidden = true;
     85}
     86
     87void fastMallocAllow()
     88{
     89    isForbidden = false;
     90}
     91
     92} // namespace WTF
     93#endif
     94
    7695#if USE_SYSTEM_MALLOC
    7796
     
    85104void *fastMalloc(size_t n)
    86105{
     106    ASSERT(!isForbidden);
    87107    return malloc(n);
    88108}
     
    90110void *fastCalloc(size_t n_elements, size_t element_size)
    91111{
     112    ASSERT(!isForbidden);
    92113    return calloc(n_elements, element_size);
    93114}
     
    95116void fastFree(void* p)
    96117{
     118    ASSERT(!isForbidden);
    97119    free(p);
    98120}
     
    100122void *fastRealloc(void* p, size_t n)
    101123{
     124    ASSERT(!isForbidden);
    102125    return realloc(p, n);
    103126}
     
    18811904#ifdef WTF_CHANGES
    18821905    ASSERT(isMultiThreaded || pthread_main_np());
     1906    ASSERT(!isForbidden);
    18831907#endif
    18841908
Note: See TracChangeset for help on using the changeset viewer.