Changeset 20019 in webkit for trunk/JavaScriptCore/kjs


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/kjs/collector.cpp

    r20015 r20019  
    565565#endif
    566566   
     567  // MARK: first mark all referenced objects recursively starting out from the set of root objects
     568
     569#ifndef NDEBUG
     570  // Forbid malloc during the mark phase. Marking a thread suspends it, so
     571  // a malloc inside mark() would risk a deadlock with a thread that had been
     572  // suspended while holding the malloc lock.
     573  fastMallocForbid();
     574#endif
     575
    567576  if (Interpreter::s_hook) {
    568577    Interpreter* scr = Interpreter::s_hook;
     
    573582  }
    574583
    575   // MARK: first mark all referenced objects recursively starting out from the set of root objects
    576 
    577584  markStackObjectsConservatively();
    578585  markProtectedObjects();
     
    580587  if (!currentThreadIsMainThread)
    581588    markMainThreadOnlyObjects();
     589
     590#ifndef NDEBUG
     591  fastMallocAllow();
     592#endif
    582593
    583594  // SWEEP: delete everything with a zero refcount (garbage) and unmark everything else
Note: See TracChangeset for help on using the changeset viewer.