source: webkit/trunk/JavaScriptCore/wtf/FastMalloc.h@ 21064

Last change on this file since 21064 was 20019, checked in by ggaren, 18 years ago

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:
  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1// -*- mode: c++; c-basic-offset: 4 -*-
2/*
3 * This file is part of the KDE libraries
4 * Copyright (C) 2005 Apple Computer, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef WTF_FastMalloc_h
24#define WTF_FastMalloc_h
25
26#include "Platform.h"
27#include <stdlib.h>
28#include <new>
29
30namespace WTF {
31
32 void *fastMalloc(size_t n);
33 void *fastCalloc(size_t n_elements, size_t element_size);
34 void fastFree(void* p);
35 void *fastRealloc(void* p, size_t n);
36
37#ifndef NDEBUG
38 void fastMallocForbid();
39 void fastMallocAllow();
40#endif
41
42} // namespace WTF
43
44using WTF::fastMalloc;
45using WTF::fastCalloc;
46using WTF::fastRealloc;
47using WTF::fastFree;
48
49#ifndef NDEBUG
50using WTF::fastMallocForbid;
51using WTF::fastMallocAllow;
52#endif
53
54#if PLATFORM(GCC) && PLATFORM(DARWIN)
55#define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline))
56#elif PLATFORM(GCC)
57#define WTF_PRIVATE_INLINE inline __attribute__((always_inline))
58#else
59#define WTF_PRIVATE_INLINE inline
60#endif
61
62#ifndef _CRTDBG_MAP_ALLOC
63
64WTF_PRIVATE_INLINE void* operator new(size_t s) { return fastMalloc(s); }
65WTF_PRIVATE_INLINE void operator delete(void* p) { fastFree(p); }
66WTF_PRIVATE_INLINE void* operator new[](size_t s) { return fastMalloc(s); }
67WTF_PRIVATE_INLINE void operator delete[](void* p) { fastFree(p); }
68
69#endif // _CRTDBG_MAP_ALLOC
70
71#endif /* WTF_FastMalloc_h */
Note: See TracBrowser for help on using the repository browser.