[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.0.1-4-2877-g8410c4b
Mike Hommey
glandium at debian.org
Sat Oct 25 11:00:54 UTC 2008
The following commit has been merged in the debian/experimental branch:
commit 932ca42d7b2263327f2881711c493d0023e62f3b
Merge: 278daa3468f31627b1ffb0308ddea35ae8375adb 0120aa024a56265365485c6a17bd4db79609f81b
Author: Mike Hommey <glandium at debian.org>
Date: Sat Oct 25 09:02:56 2008 +0200
Merge branch 'webkit-1.0' into debian/unstable
Conflicts:
GNUmakefile.am
JavaScriptCore/wtf/Platform.h
JavaScriptCore/wtf/Vector.h
WebCore/platform/graphics/cairo/ImageCairo.cpp
WebCore/platform/graphics/cg/ImageCG.cpp
WebCore/platform/graphics/gtk/FontGtk.cpp
symbols.filter
diff --combined JavaScriptCore/wtf/FastMalloc.cpp
index 7f08646,a7c7f7c..956f761
--- a/JavaScriptCore/wtf/FastMalloc.cpp
+++ b/JavaScriptCore/wtf/FastMalloc.cpp
@@@ -1,5 -1,6 +1,6 @@@
// Copyright (c) 2005, 2007, Google Inc.
// All rights reserved.
+ // Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@@ -77,7 -78,7 +78,7 @@@
#include "FastMalloc.h"
#include "Assertions.h"
- #if USE(MULTIPLE_THREADS)
+ #if ENABLE(JSC_MULTIPLE_THREADS)
#include <pthread.h>
#endif
@@@ -93,10 -94,12 +94,12 @@@
#define FORCE_SYSTEM_MALLOC 1
#endif
+ #define TCMALLOC_TRACK_DECOMMITED_SPANS (HAVE(VIRTUALALLOC))
+
#ifndef NDEBUG
namespace WTF {
- #if USE(MULTIPLE_THREADS)
+ #if ENABLE(JSC_MULTIPLE_THREADS)
static pthread_key_t isForbiddenKey;
static pthread_once_t isForbiddenKeyOnce = PTHREAD_ONCE_INIT;
static void initializeIsForbiddenKey()
@@@ -139,7 -142,7 +142,7 @@@ void fastMallocAllow(
{
staticIsForbidden = false;
}
- #endif // USE(MULTIPLE_THREADS)
+ #endif // ENABLE(JSC_MULTIPLE_THREADS)
} // namespace WTF
#endif // NDEBUG
@@@ -147,58 -150,112 +150,112 @@@
#include <string.h>
namespace WTF {
- void *fastZeroedMalloc(size_t n)
+
+ void* fastZeroedMalloc(size_t n)
{
- void *result = fastMalloc(n);
- if (!result)
- return 0;
+ void* result = fastMalloc(n);
memset(result, 0, n);
- #ifndef WTF_CHANGES
- MallocHook::InvokeNewHook(result, n);
- #endif
return result;
}
+ void* tryFastZeroedMalloc(size_t n)
+ {
+ void* result = tryFastMalloc(n);
+ if (!result)
+ return 0;
+ memset(result, 0, n);
+ return result;
}
+ } // namespace WTF
+
#if FORCE_SYSTEM_MALLOC
#include <stdlib.h>
#if !PLATFORM(WIN_OS)
#include <pthread.h>
+ #else
+ #include "windows.h"
#endif
namespace WTF {
-
- void *fastMalloc(size_t n)
+
+ void* tryFastMalloc(size_t n)
{
ASSERT(!isForbidden());
return malloc(n);
}
- void *fastCalloc(size_t n_elements, size_t element_size)
+ void* fastMalloc(size_t n)
+ {
+ ASSERT(!isForbidden());
+ void* result = malloc(n);
+ if (!result)
+ abort();
+ return result;
+ }
+
+ void* tryFastCalloc(size_t n_elements, size_t element_size)
{
ASSERT(!isForbidden());
return calloc(n_elements, element_size);
}
+ void* fastCalloc(size_t n_elements, size_t element_size)
+ {
+ ASSERT(!isForbidden());
+ void* result = calloc(n_elements, element_size);
+ if (!result)
+ abort();
+ return result;
+ }
+
void fastFree(void* p)
{
ASSERT(!isForbidden());
free(p);
}
- void *fastRealloc(void* p, size_t n)
+ void* tryFastRealloc(void* p, size_t n)
{
ASSERT(!isForbidden());
return realloc(p, n);
}
- } // namespace WTF
+ void* fastRealloc(void* p, size_t n)
+ {
+ ASSERT(!isForbidden());
+ void* result = realloc(p, n);
+ if (!result)
+ abort();
+ return result;
+ }
- extern "C" {
void releaseFastMallocFreeMemory() { }
+
+ #if HAVE(VIRTUALALLOC)
+ void* fastMallocExecutable(size_t n)
+ {
+ return VirtualAlloc(0, n, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
+ }
+
+ void fastFreeExecutable(void* p)
+ {
+ VirtualFree(p, 0, MEM_RELEASE);
+ }
+ #else
+ void* fastMallocExecutable(size_t n)
+ {
+ return fastMalloc(n);
+ }
+
+ void fastFreeExecutable(void* p)
+ {
+ fastFree(p);
}
+ #endif
+
+ } // namespace WTF
#if PLATFORM(DARWIN)
// This symbol is present in the JavaScriptCore exports file even when FastMalloc is disabled.
@@@ -206,7 -263,7 +263,7 @@@
extern "C" const int jscore_fastmalloc_introspection = 0;
#endif
- #else
+ #else // FORCE_SYSTEM_MALLOC
#if HAVE(STDINT_H)
#include <stdint.h>
@@@ -295,7 -352,7 +352,7 @@@ public
static void log(malloc_zone_t*, void*) { }
static void forceLock(malloc_zone_t*) { }
static void forceUnlock(malloc_zone_t*) { }
- static void statistics(malloc_zone_t*, malloc_statistics_t*) { }
+ static void statistics(malloc_zone_t*, malloc_statistics_t* stats) { memset(stats, 0, sizeof(malloc_statistics_t)); }
private:
FastMallocZone(TCMalloc_PageHeap*, TCMalloc_ThreadCache**, TCMalloc_Central_FreeListPadded*);
@@@ -864,9 -921,12 +921,12 @@@ struct Span
Span* prev; // Used when in link list
void* objects; // Linked list of free objects
unsigned int free : 1; // Is the span free
+ #ifndef NO_TCMALLOC_SAMPLES
unsigned int sample : 1; // Sampled object?
+ #endif
unsigned int sizeclass : 8; // Size-class for small objects (or 0)
unsigned int refcount : 11; // Number of non-free objects
+ bool decommitted : 1;
#undef SPAN_HISTORY
#ifdef SPAN_HISTORY
@@@ -877,6 -937,12 +937,12 @@@
#endif
};
+ #if TCMALLOC_TRACK_DECOMMITED_SPANS
+ #define ASSERT_SPAN_COMMITTED(span) ASSERT(!span->decommitted)
+ #else
+ #define ASSERT_SPAN_COMMITTED(span)
+ #endif
+
#ifdef SPAN_HISTORY
void Event(Span* span, char op, int v = 0) {
span->history[span->nexthistory] = op;
@@@ -1178,13 -1244,22 +1244,22 @@@ inline Span* TCMalloc_PageHeap::New(Len
Span* result = ll->next;
Carve(result, n, released);
+ #if TCMALLOC_TRACK_DECOMMITED_SPANS
+ if (result->decommitted) {
+ TCMalloc_SystemCommit(reinterpret_cast<void*>(result->start << kPageShift), static_cast<size_t>(n << kPageShift));
+ result->decommitted = false;
+ }
+ #endif
ASSERT(Check());
free_pages_ -= n;
return result;
}
Span* result = AllocLarge(n);
- if (result != NULL) return result;
+ if (result != NULL) {
+ ASSERT_SPAN_COMMITTED(result);
+ return result;
+ }
// Grow the heap and try again
if (!GrowHeap(n)) {
@@@ -1231,6 -1306,12 +1306,12 @@@ Span* TCMalloc_PageHeap::AllocLarge(Len
if (best != NULL) {
Carve(best, n, from_released);
+ #if TCMALLOC_TRACK_DECOMMITED_SPANS
+ if (best->decommitted) {
+ TCMalloc_SystemCommit(reinterpret_cast<void*>(best->start << kPageShift), static_cast<size_t>(n << kPageShift));
+ best->decommitted = false;
+ }
+ #endif
ASSERT(Check());
free_pages_ -= n;
return best;
@@@ -1255,6 -1336,15 +1336,15 @@@ Span* TCMalloc_PageHeap::Split(Span* sp
return leftover;
}
+ #if !TCMALLOC_TRACK_DECOMMITED_SPANS
+ static ALWAYS_INLINE void propagateDecommittedState(Span*, Span*) { }
+ #else
+ static ALWAYS_INLINE void propagateDecommittedState(Span* destination, Span* source)
+ {
+ destination->decommitted = source->decommitted;
+ }
+ #endif
+
inline void TCMalloc_PageHeap::Carve(Span* span, Length n, bool released) {
ASSERT(n > 0);
DLL_Remove(span);
@@@ -1266,6 -1356,7 +1356,7 @@@
if (extra > 0) {
Span* leftover = NewSpan(span->start + n, extra);
leftover->free = 1;
+ propagateDecommittedState(leftover, span);
Event(leftover, 'S', extra);
RecordSpan(leftover);
@@@ -1279,6 -1370,16 +1370,16 @@@
}
}
+ #if !TCMALLOC_TRACK_DECOMMITED_SPANS
+ static ALWAYS_INLINE void mergeDecommittedStates(Span*, Span*) { }
+ #else
+ static ALWAYS_INLINE void mergeDecommittedStates(Span* destination, Span* other)
+ {
+ if (other->decommitted)
+ destination->decommitted = true;
+ }
+ #endif
+
inline void TCMalloc_PageHeap::Delete(Span* span) {
ASSERT(Check());
ASSERT(!span->free);
@@@ -1286,7 -1387,9 +1387,9 @@@
ASSERT(GetDescriptor(span->start) == span);
ASSERT(GetDescriptor(span->start + span->length - 1) == span);
span->sizeclass = 0;
+ #ifndef NO_TCMALLOC_SAMPLES
span->sample = 0;
+ #endif
// Coalesce -- we guarantee that "p" != 0, so no bounds checking
// necessary. We do not bother resetting the stale pagemap
@@@ -1303,6 -1406,7 +1406,7 @@@
// Merge preceding span into this span
ASSERT(prev->start + prev->length == p);
const Length len = prev->length;
+ mergeDecommittedStates(span, prev);
DLL_Remove(prev);
DeleteSpan(prev);
span->start -= len;
@@@ -1315,6 -1419,7 +1419,7 @@@
// Merge next span into this span
ASSERT(next->start == p+n);
const Length len = next->length;
+ mergeDecommittedStates(span, next);
DLL_Remove(next);
DeleteSpan(next);
span->length += len;
@@@ -1355,6 -1460,9 +1460,9 @@@ void TCMalloc_PageHeap::IncrementalScav
DLL_Remove(s);
TCMalloc_SystemRelease(reinterpret_cast<void*>(s->start << kPageShift),
static_cast<size_t>(s->length << kPageShift));
+ #if TCMALLOC_TRACK_DECOMMITED_SPANS
+ s->decommitted = true;
+ #endif
DLL_Prepend(&slist->returned, s);
scavenge_counter_ = std::max<size_t>(64UL, std::min<size_t>(kDefaultReleaseDelay, kDefaultReleaseDelay - (free_pages_ / kDefaultReleaseDelay)));
@@@ -1461,7 -1569,7 +1569,7 @@@ bool TCMalloc_PageHeap::GrowHeap(Lengt
if (n < ask) {
// Try growing just "n" pages
ask = n;
- ptr = TCMalloc_SystemAlloc(ask << kPageShift, &actual_size, kPageSize);;
+ ptr = TCMalloc_SystemAlloc(ask << kPageShift, &actual_size, kPageSize);
}
if (ptr == NULL) return false;
}
@@@ -1722,13 -1830,18 +1830,18 @@@ class TCMalloc_Central_FreeList
#ifdef WTF_CHANGES
template <class Finder, class Reader>
- void enumerateFreeObjects(Finder& finder, const Reader& reader)
+ void enumerateFreeObjects(Finder& finder, const Reader& reader, TCMalloc_Central_FreeList* remoteCentralFreeList)
{
for (Span* span = &empty_; span && span != &empty_; span = (span->next ? reader(span->next) : 0))
ASSERT(!span->objects);
ASSERT(!nonempty_.objects);
- for (Span* span = reader(nonempty_.next); span && span != &nonempty_; span = (span->next ? reader(span->next) : 0)) {
+ static const ptrdiff_t nonemptyOffset = reinterpret_cast<const char*>(&nonempty_) - reinterpret_cast<const char*>(this);
+
+ Span* remoteNonempty = reinterpret_cast<Span*>(reinterpret_cast<char*>(remoteCentralFreeList) + nonemptyOffset);
+ Span* remoteSpan = nonempty_.next;
+
+ for (Span* span = reader(remoteSpan); span && remoteSpan != remoteNonempty; remoteSpan = span->next, span = (span->next ? reader(span->next) : 0)) {
for (void* nextObject = span->objects; nextObject; nextObject = *reader(reinterpret_cast<void**>(nextObject)))
finder.visit(nextObject);
}
@@@ -1824,13 -1937,13 +1937,13 @@@ static TCMalloc_Central_FreeListPadded
// Page-level allocator
static SpinLock pageheap_lock = SPINLOCK_INITIALIZER;
-static void* pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(void*) - 1) / sizeof(void*)];
+static uint64_t pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(uint64_t) - 1) / sizeof(uint64_t)];
static bool phinited = false;
// Avoid extra level of indirection by making "pageheap" be just an alias
// of pageheap_memory.
typedef union {
- void* m_memory;
+ uint64_t* m_memory;
TCMalloc_PageHeap* m_pageHeap;
} PageHeapUnion;
@@@ -2095,6 -2208,7 +2208,7 @@@ void* TCMalloc_Central_FreeList::FetchF
Span* span = nonempty_.next;
ASSERT(span->objects != NULL);
+ ASSERT_SPAN_COMMITTED(span);
span->refcount++;
void* result = span->objects;
span->objects = *(reinterpret_cast<void**>(result));
@@@ -2125,6 -2239,7 +2239,7 @@@ ALWAYS_INLINE void TCMalloc_Central_Fre
lock_.Lock();
return;
}
+ ASSERT_SPAN_COMMITTED(span);
ASSERT(span->length == npages);
// Cache sizeclass info eagerly. Locking is not necessary.
// (Instead of being eager, we could just replace any stale info
@@@ -2901,11 -3016,15 +3016,15 @@@ static inline void* CheckedMallocResult
}
static inline void* SpanToMallocResult(Span *span) {
+ ASSERT_SPAN_COMMITTED(span);
pageheap->CacheSizeClass(span->start, 0);
return
CheckedMallocResult(reinterpret_cast<void*>(span->start << kPageShift));
}
+ #ifdef WTF_CHANGES
+ template <bool abortOnFailure>
+ #endif
static ALWAYS_INLINE void* do_malloc(size_t size) {
void* ret = NULL;
@@@ -2935,7 -3054,14 +3054,14 @@@
// size-appropriate freelist, afer replenishing it if it's empty.
ret = CheckedMallocResult(heap->Allocate(size));
}
- if (ret == NULL) errno = ENOMEM;
+ if (!ret) {
+ #ifdef WTF_CHANGES
+ if (abortOnFailure) // This branch should be optimized out by the compiler.
+ abort();
+ #else
+ errno = ENOMEM;
+ #endif
+ }
return ret;
}
@@@ -2952,7 -3078,9 +3078,9 @@@ static ALWAYS_INLINE void do_free(void
pageheap->CacheSizeClass(p, cl);
}
if (cl != 0) {
+ #ifndef NO_TCMALLOC_SAMPLES
ASSERT(!pageheap->GetDescriptor(p)->sample);
+ #endif
TCMalloc_ThreadCache* heap = TCMalloc_ThreadCache::GetCacheIfPresent();
if (heap != NULL) {
heap->Deallocate(ptr, cl);
@@@ -2965,11 -3093,13 +3093,13 @@@
SpinLockHolder h(&pageheap_lock);
ASSERT(reinterpret_cast<uintptr_t>(ptr) % kPageSize == 0);
ASSERT(span != NULL && span->start == p);
+ #ifndef NO_TCMALLOC_SAMPLES
if (span->sample) {
DLL_Remove(span);
stacktrace_allocator.Delete(reinterpret_cast<StackTrace*>(span->objects));
span->objects = NULL;
}
+ #endif
pageheap->Delete(span);
}
}
@@@ -3095,6 -3225,24 +3225,24 @@@ static inline struct mallinfo do_mallin
#ifndef WTF_CHANGES
extern "C"
+ #else
+ #define do_malloc do_malloc<abortOnFailure>
+
+ template <bool abortOnFailure>
+ void* malloc(size_t);
+
+ void* fastMalloc(size_t size)
+ {
+ return malloc<true>(size);
+ }
+
+ void* tryFastMalloc(size_t size)
+ {
+ return malloc<false>(size);
+ }
+
+ template <bool abortOnFailure>
+ ALWAYS_INLINE
#endif
void* malloc(size_t size) {
void* result = do_malloc(size);
@@@ -3116,6 -3264,22 +3264,22 @@@ void free(void* ptr)
#ifndef WTF_CHANGES
extern "C"
+ #else
+ template <bool abortOnFailure>
+ void* calloc(size_t, size_t);
+
+ void* fastCalloc(size_t n, size_t elem_size)
+ {
+ return calloc<true>(n, elem_size);
+ }
+
+ void* tryFastCalloc(size_t n, size_t elem_size)
+ {
+ return calloc<false>(n, elem_size);
+ }
+
+ template <bool abortOnFailure>
+ ALWAYS_INLINE
#endif
void* calloc(size_t n, size_t elem_size) {
const size_t totalBytes = n * elem_size;
@@@ -3146,6 -3310,22 +3310,22 @@@ void cfree(void* ptr)
#ifndef WTF_CHANGES
extern "C"
+ #else
+ template <bool abortOnFailure>
+ void* realloc(void*, size_t);
+
+ void* fastRealloc(void* old_ptr, size_t new_size)
+ {
+ return realloc<true>(old_ptr, new_size);
+ }
+
+ void* tryFastRealloc(void* old_ptr, size_t new_size)
+ {
+ return realloc<false>(old_ptr, new_size);
+ }
+
+ template <bool abortOnFailure>
+ ALWAYS_INLINE
#endif
void* realloc(void* old_ptr, size_t new_size) {
if (old_ptr == NULL) {
@@@ -3205,7 -3385,19 +3385,19 @@@
}
}
- #ifndef WTF_CHANGES
+ void* fastMallocExecutable(size_t n)
+ {
+ return malloc<false>(n);
+ }
+
+ void fastFreeExecutable(void* p)
+ {
+ free(p);
+ }
+
+ #ifdef WTF_CHANGES
+ #undef do_malloc
+ #else
static SpinLock set_new_handler_lock = SPINLOCK_INITIALIZER;
@@@ -3435,10 -3627,10 +3627,10 @@@ public
threadCache->enumerateFreeObjects(*this, m_reader);
}
- void findFreeObjects(TCMalloc_Central_FreeListPadded* centralFreeList, size_t numSizes)
+ void findFreeObjects(TCMalloc_Central_FreeListPadded* centralFreeList, size_t numSizes, TCMalloc_Central_FreeListPadded* remoteCentralFreeList)
{
for (unsigned i = 0; i < numSizes; i++)
- centralFreeList[i].enumerateFreeObjects(*this, m_reader);
+ centralFreeList[i].enumerateFreeObjects(*this, m_reader, remoteCentralFreeList + i);
}
};
@@@ -3552,7 -3744,7 +3744,7 @@@ kern_return_t FastMallocZone::enumerate
FreeObjectFinder finder(memoryReader);
finder.findFreeObjects(threadHeaps);
- finder.findFreeObjects(centralCaches, kNumClasses);
+ finder.findFreeObjects(centralCaches, kNumClasses, mzone->m_centralCaches);
TCMalloc_PageHeap::PageMap* pageMap = &pageHeap->pagemap_;
PageMapFreeObjectFinder pageMapFinder(memoryReader, finder);
@@@ -3627,18 -3819,16 +3819,16 @@@ void FastMallocZone::init(
static FastMallocZone zone(pageheap, &thread_heaps, static_cast<TCMalloc_Central_FreeListPadded*>(central_cache));
}
- extern "C" {
+ #endif
+
void releaseFastMallocFreeMemory()
{
SpinLockHolder h(&pageheap_lock);
pageheap->ReleaseFreePages();
}
- }
-
- #endif
#if WTF_CHANGES
} // namespace WTF
#endif
- #endif // USE_SYSTEM_MALLOC
+ #endif // FORCE_SYSTEM_MALLOC
diff --combined JavaScriptCore/wtf/ListHashSet.h
index ce09222,2f75c33..3f66606
--- a/JavaScriptCore/wtf/ListHashSet.h
+++ b/JavaScriptCore/wtf/ListHashSet.h
@@@ -1,5 -1,4 +1,4 @@@
/*
- // -*- mode: c++; c-basic-offset: 4 -*-
* Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
@@@ -34,7 -33,7 +33,7 @@@ namespace WTF
// order - iterating it will always give back values in the order
// in which they are added.
- // In theory it would be possible to add prepend, insertAfter, insertBefore,
+ // In theory it would be possible to add prepend, insertAfter
// and an append that moves the element to the end even if already present,
// but unclear yet if these are needed.
@@@ -91,10 -90,13 +90,13 @@@
const_iterator find(const ValueType&) const;
bool contains(const ValueType&) const;
- // the return value is a pair of an interator to the new value's location,
+ // the return value is a pair of an iterator to the new value's location,
// and a bool that is true if an new entry was added
pair<iterator, bool> add(const ValueType&);
+ pair<iterator, bool> insertBefore(const ValueType& beforeValue, const ValueType& newValue);
+ pair<iterator, bool> insertBefore(iterator it, const ValueType&);
+
void remove(const ValueType&);
void remove(iterator);
void clear();
@@@ -102,6 -104,7 +104,7 @@@
private:
void unlinkAndDelete(Node*);
void appendNode(Node*);
+ void insertNodeBefore(Node* beforeNode, Node* newNode);
void deleteAllNodes();
iterator makeIterator(Node*);
const_iterator makeConstIterator(Node*) const;
@@@ -122,7 -125,7 +125,7 @@@
: m_freeList(pool())
, m_isDoneWithInitialFreeList(false)
{
- memset(m_pool.pool, 0, sizeof(m_pool.pool));
+ memset(m_pool, 0, sizeof(m_pool));
}
Node* allocate()
@@@ -166,7 -169,7 +169,7 @@@
}
private:
- Node* pool() { return reinterpret_cast<Node*>(m_pool.pool); }
+ Node* pool() { return reinterpret_cast<Node*>(m_pool); }
Node* pastPool() { return pool() + m_poolSize; }
bool inPool(Node* node)
@@@ -177,7 -180,10 +180,7 @@@
Node* m_freeList;
bool m_isDoneWithInitialFreeList;
static const size_t m_poolSize = 256;
- union {
- char pool[sizeof(Node) * m_poolSize];
- double forAlignment;
- } m_pool;
+ uint32_t m_pool[(sizeof(Node) * m_poolSize + sizeof(uint32_t) - 1) / sizeof(uint32_t)];
};
template<typename ValueArg> struct ListHashSetNode {
@@@ -306,7 -312,10 +309,10 @@@
const_iterator& operator--()
{
ASSERT(m_position != m_set->m_head);
- m_position = m_position->m_prev;
+ if (!m_position)
+ m_position = m_set->m_tail;
+ else
+ m_position = m_position->m_prev;
return *this;
}
@@@ -466,6 -475,23 +472,23 @@@
}
template<typename T, typename U>
+ pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::insertBefore(iterator it, const ValueType& newValue)
+ {
+ typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
+ pair<typename ImplType::iterator, bool> result = m_impl.template add<ValueType, NodeAllocator*, Translator>(newValue, m_allocator.get());
+ if (result.second)
+ insertNodeBefore(it.node(), *result.first);
+ return std::make_pair(makeIterator(*result.first), result.second);
+
+ }
+
+ template<typename T, typename U>
+ pair<typename ListHashSet<T, U>::iterator, bool> ListHashSet<T, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue)
+ {
+ return insertBefore(find(beforeValue), newValue);
+ }
+
+ template<typename T, typename U>
inline void ListHashSet<T, U>::remove(iterator it)
{
if (it == end())
@@@ -529,6 -555,22 +552,22 @@@
}
template<typename T, typename U>
+ void ListHashSet<T, U>::insertNodeBefore(Node* beforeNode, Node* newNode)
+ {
+ if (!beforeNode)
+ return appendNode(newNode);
+
+ newNode->m_next = beforeNode;
+ newNode->m_prev = beforeNode->m_prev;
+ if (beforeNode->m_prev)
+ beforeNode->m_prev->m_next = newNode;
+ beforeNode->m_prev = newNode;
+
+ if (!newNode->m_prev)
+ m_head = newNode;
+ }
+
+ template<typename T, typename U>
void ListHashSet<T, U>::deleteAllNodes()
{
if (!m_head)
diff --combined JavaScriptCore/wtf/Platform.h
index ce44c25,115019b..c70821a
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@@ -1,5 -1,4 +1,4 @@@
/*
- /* -*- mode: c++; c-basic-offset: 4 -*- */
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@@ -21,7 -20,7 +20,7 @@@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WTF_Platform_h
@@@ -50,6 -49,14 +49,14 @@@
#define WTF_PLATFORM_WIN_OS 1
#endif
+ /* PLATFORM(WIN_CE) */
+ /* Operating system level dependencies for Windows CE that should be used */
+ /* regardless of operating environment */
+ /* Note that for this platform PLATFORM(WIN_OS) is also defined. */
+ #if defined(_WIN32_WCE)
+ #define WTF_PLATFORM_WIN_CE 1
+ #endif
+
/* PLATFORM(FREEBSD) */
/* Operating system level dependencies for FreeBSD-like systems that */
/* should be used regardless of operating environment */
@@@ -57,6 -64,13 +64,13 @@@
#define WTF_PLATFORM_FREEBSD 1
#endif
+ /* PLATFORM(OPENBSD) */
+ /* Operating system level dependencies for OpenBSD systems that */
+ /* should be used regardless of operating environment */
+ #ifdef __OpenBSD__
+ #define WTF_PLATFORM_OPENBSD 1
+ #endif
+
/* PLATFORM(SOLARIS) */
/* Operating system level dependencies for Solaris that should be used */
/* regardless of operating environment */
@@@ -79,11 -93,14 +93,14 @@@
/* Operating environments */
+ /* PLATFORM(CHROMIUM) */
/* PLATFORM(QT) */
/* PLATFORM(GTK) */
/* PLATFORM(MAC) */
/* PLATFORM(WIN) */
- #if defined(BUILDING_QT__)
+ #if defined(BUILDING_CHROMIUM__)
+ #define WTF_PLATFORM_CHROMIUM 1
+ #elif defined(BUILDING_QT__)
#define WTF_PLATFORM_QT 1
/* PLATFORM(KDE) */
@@@ -103,12 -120,19 +120,19 @@@
/* Graphics engines */
- /* PLATFORM(CG) */
- /* PLATFORM(CAIRO) */
+ /* PLATFORM(CG) and PLATFORM(CI) */
#if PLATFORM(MAC)
#define WTF_PLATFORM_CG 1
#define WTF_PLATFORM_CI 1
- #elif !PLATFORM(QT) && !PLATFORM(WX)
+ #endif
+
+ /* PLATFORM(SKIA) */
+ #if PLATFORM(CHROMIUM)
+ #define WTF_PLATFORM_SKIA 1
+ #endif
+
+ /* Makes PLATFORM(WIN) default to PLATFORM(CAIRO) */
+ #if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX)
#define WTF_PLATFORM_CAIRO 1
#endif
@@@ -172,23 -196,12 +196,29 @@@
#define WTF_PLATFORM_X86_64 1
#endif
+/* PLATFORM(SPARC) */
+#if defined(__sparc__) \
+ || defined(__sparc)
+#define WTF_PLATFORM_SPARC 1
+#define WTF_PLATFORM_BIG_ENDIAN 1
+#endif
+
+ /* PLATFORM(SPARC64) */
+ #if defined(__sparc64__)
+ #define WTF_PLATFORM_SPARC64 1
+ #define WTF_PLATFORM_BIG_ENDIAN 1
+ #endif
+
+/* For undefined platforms */
+#if !defined(WTF_PLATFORM_BIG_ENDIAN) && !defined(WTF_PLATFORM_MIDDLE_ENDIAN)
+#include <sys/param.h>
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define WTF_PLATFORM_BIG_ENDIAN 1
+#elif __BYTE_ORDER == __PDP_ENDIAN
+#define WTF_PLATFORM_MIDDLE_ENDIAN 1
+#endif
+#endif
+
/* Compiler */
/* COMPILER(MSVC) */
@@@ -204,6 -217,11 +234,11 @@@
#define WTF_COMPILER_GCC 1
#endif
+ /* COMPILER(MINGW) */
+ #if defined(MINGW) || defined(__MINGW32__)
+ #define WTF_COMPILER_MINGW 1
+ #endif
+
/* COMPILER(BORLAND) */
/* not really fully supported - is this relevant any more? */
#if defined(__BORLANDC__)
@@@ -216,9 -234,8 +251,8 @@@
#define WTF_COMPILER_CYGWIN 1
#endif
- /* multiple threads only supported on Mac for now */
- #if PLATFORM(MAC) || PLATFORM(WIN)
- #define WTF_USE_MULTIPLE_THREADS 1
+ #if (PLATFORM(MAC) || PLATFORM(WIN)) && !defined(ENABLE_JSC_MULTIPLE_THREADS)
+ #define ENABLE_JSC_MULTIPLE_THREADS 1
#endif
/* for Unicode, KDE uses Qt */
@@@ -235,11 -252,16 +269,16 @@@
#if PLATFORM(MAC)
#define WTF_PLATFORM_CF 1
#define WTF_USE_PTHREADS 1
+ #if !defined(ENABLE_MAC_JAVA_BRIDGE)
#define ENABLE_MAC_JAVA_BRIDGE 1
#endif
-
- #if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(SYMBIAN) || PLATFORM(WIN) || PLATFORM(WX)
- #define ENABLE_NETSCAPE_PLUGIN_API 1
+ #if !defined(ENABLE_DASHBOARD_SUPPORT)
+ #define ENABLE_DASHBOARD_SUPPORT 1
+ #endif
+ #define HAVE_READLINE 1
+ #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+ #define HAVE_DTRACE 1
+ #endif
#endif
#if PLATFORM(WIN)
@@@ -251,11 -273,13 +290,13 @@@
#define WTF_USE_PTHREADS 1
#endif
- #if PLATFORM(MAC) || PLATFORM(WIN)
- #define ENABLE_DASHBOARD_SUPPORT 1
+ #if PLATFORM(GTK)
+ #if HAVE(PTHREAD_H)
+ #define WTF_USE_PTHREADS 1
+ #endif
#endif
- #if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK)
+ #if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
#define HAVE_ACCESSIBILITY 1
#endif
@@@ -263,6 -287,36 +304,36 @@@
#define HAVE_COMPUTED_GOTO 1
#endif
+ #if PLATFORM(DARWIN)
+
+ #define HAVE_ERRNO_H 1
+ #define HAVE_MMAP 1
+ #define HAVE_MERGESORT 1
+ #define HAVE_SBRK 1
+ #define HAVE_STRINGS_H 1
+ #define HAVE_SYS_PARAM_H 1
+ #define HAVE_SYS_TIME_H 1
+ #define HAVE_SYS_TIMEB_H 1
+
+ #elif PLATFORM(WIN_OS)
+
+ #define HAVE_FLOAT_H 1
+ #define HAVE_SYS_TIMEB_H 1
+ #define HAVE_VIRTUALALLOC 1
+
+ #else
+
+ /* FIXME: is this actually used or do other platforms generate their own config.h? */
+
+ #define HAVE_ERRNO_H 1
+ #define HAVE_MMAP 1
+ #define HAVE_SBRK 1
+ #define HAVE_STRINGS_H 1
+ #define HAVE_SYS_PARAM_H 1
+ #define HAVE_SYS_TIME_H 1
+
+ #endif
+
/* ENABLE macro defaults */
#if !defined(ENABLE_ICONDATABASE)
@@@ -273,20 -327,63 +344,63 @@@
#define ENABLE_DATABASE 1
#endif
+ #if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
+ #define ENABLE_JAVASCRIPT_DEBUGGER 1
+ #endif
+
#if !defined(ENABLE_FTPDIR)
#define ENABLE_FTPDIR 1
#endif
+ #if !defined(ENABLE_DASHBOARD_SUPPORT)
+ #define ENABLE_DASHBOARD_SUPPORT 0
+ #endif
+
#if !defined(ENABLE_MAC_JAVA_BRIDGE)
#define ENABLE_MAC_JAVA_BRIDGE 0
#endif
#if !defined(ENABLE_NETSCAPE_PLUGIN_API)
- #define ENABLE_NETSCAPE_PLUGIN_API 0
+ #define ENABLE_NETSCAPE_PLUGIN_API 1
#endif
- #if !defined(ENABLE_DASHBOARD_SUPPORT)
- #define ENABLE_DASHBOARD_SUPPORT 0
+ #if !defined(ENABLE_SAMPLING_TOOL)
+ #define ENABLE_SAMPLING_TOOL 0
+ #endif
+
+ #if !defined(ENABLE_GEOLOCATION)
+ #define ENABLE_GEOLOCATION 0
+ #endif
+
+ // CTI only supports x86 at the moment, and has only been tested on Mac and Windows.
+ #if !defined(ENABLE_CTI) && PLATFORM(X86) && (PLATFORM(MAC) || PLATFORM(WIN))
+ #define ENABLE_CTI 1
+ #endif
+
+ // WREC only supports x86 at the moment, and has only been tested on Mac and Windows.
+ #if !defined(ENABLE_WREC) && ENABLE(CTI) && PLATFORM(X86) && (PLATFORM(MAC) || PLATFORM(WIN))
+ #define ENABLE_WREC 1
+ #endif
+
+ #if ENABLE(CTI) || ENABLE(WREC)
+ #define ENABLE_MASM 1
+ #endif
+
+ #if !defined(ENABLE_PAN_SCROLLING) && (PLATFORM(WIN) || PLATFORM(CHROMIUM) || (PLATFORM(WX) && PLATFORM(WIN_OS)))
+ #define ENABLE_PAN_SCROLLING 1
+ #endif
+
+ /* Use the QtXmlStreamReader implementation for XMLTokenizer */
+ #if PLATFORM(QT)
+ #if !ENABLE(XSLT)
+ #define WTF_USE_QXMLSTREAM 1
+ #endif
+ #endif
+
+ // Use "fastcall" calling convention on MSVC
+ #if COMPILER(MSVC)
+ #define WTF_USE_FAST_CALL_CTI_ARGUMENT 1
+ #define WTF_USE_CTI_ARGUMENT 1
#endif
#endif /* WTF_Platform_h */
diff --combined WebCore/page/gtk/AXObjectCacheAtk.cpp
index 387be0d,3535cf1..d4de22c
--- a/WebCore/page/gtk/AXObjectCacheAtk.cpp
+++ b/WebCore/page/gtk/AXObjectCacheAtk.cpp
@@@ -22,12 -22,7 +22,9 @@@
#include "AccessibilityObject.h"
#include "AccessibilityObjectWrapperAtk.h"
- #include "RenderObject.h"
-
- #include "CString.h"
+#include <stdio.h>
+
namespace WebCore {
void AXObjectCache::detachWrapper(AccessibilityObject* obj)
@@@ -42,64 -37,16 +39,16 @@@ void AXObjectCache::attachWrapper(Acces
g_object_unref(atkObj);
}
- void AXObjectCache::postNotification(RenderObject* renderer, const String& message)
+ void AXObjectCache::postNotification(RenderObject*, const String&)
{
- printf("postNotification: %s\n", message.utf8().data());
-
- if (!renderer)
- return;
-
- // notifications for text input objects are sent to that object
- // all others are sent to the top WebArea
- RefPtr<AccessibilityObject> obj = get(renderer)->observableObject();
- if (!obj)
- obj = get(renderer->document()->renderer());
-
- if (!obj)
- return;
-
- if (message == "AXValueChanged") {
- #if 0
- printf("emit\n");
- gint start = 0;
- gint length = obj->textLength();
- // TODO: signal detail
- g_signal_emit_by_name(obj->wrapper(), "text_changed::insert", start, length);
- #endif
- } else if (message == "AXSelectedTextChanged") {
- printf("emit\n");
- // FIXME: This is only fired from SelectionControllerMac.mm
- g_signal_emit_by_name(obj->wrapper(), "text_selection_changed");
- }
}
- void AXObjectCache::postNotificationToElement(RenderObject* renderer, const String& message)
+ void AXObjectCache::postNotificationToElement(RenderObject*, const String&)
{
- printf("postNotificationToElement: %s\n", message.utf8().data());
-
- // send the notification to the specified element itself, not one of its ancestors
- if (!renderer)
- return;
-
- RefPtr<AccessibilityObject> obj = get(renderer);
- if (!obj)
- return;
-
- if (message == "AXLoadComplete") {
- printf("emit\n");
- // FIXME: This is only fired from Document.cpp MAC
- g_signal_emit_by_name(obj->wrapper(), "load_complete");
- }
-
- // TODO: Cover the other loader signals supported by AtkDocument.
}
void AXObjectCache::handleFocusedUIElementChanged()
{
- // FIXME: This is fired only in MAC
- printf("handleFocusedUIElementChanged\n");
-
- //g_signal_emit_by_name(obj->wrapper(), "focus_event", TRUE);
}
} // namespace WebCore
diff --combined WebCore/platform/text/AtomicString.cpp
index 1460904,5bc7284..64e3367
--- a/WebCore/platform/text/AtomicString.cpp
+++ b/WebCore/platform/text/AtomicString.cpp
@@@ -20,7 -20,7 +20,7 @@@
#include "config.h"
- #ifdef AVOID_STATIC_CONSTRUCTORS
+ #ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC
#define ATOMICSTRING_HIDE_GLOBALS 1
#endif
@@@ -31,8 -31,10 +31,10 @@@
#include <kjs/identifier.h>
#include <wtf/HashSet.h>
- using KJS::Identifier;
- using KJS::UString;
+ #if USE(JSC)
+ using JSC::Identifier;
+ using JSC::UString;
+ #endif
namespace WebCore {
@@@ -94,7 -96,7 +96,7 @@@ static inline bool equal(StringImpl* st
if (string->length() != length)
return false;
-#if PLATFORM(ARM)
+#if PLATFORM(ARM) || PLATFORM(SPARC)
const UChar* stringCharacters = string->characters();
for (unsigned i = 0; i != length; ++i) {
if (*stringCharacters++ != *characters++)
@@@ -214,7 -216,8 +216,8 @@@ void AtomicString::remove(StringImpl* r
stringTable->remove(r);
}
- PassRefPtr<StringImpl> AtomicString::add(const KJS::Identifier& identifier)
+ #if USE(JSC)
+ PassRefPtr<StringImpl> AtomicString::add(const JSC::Identifier& identifier)
{
if (identifier.isNull())
return 0;
@@@ -231,7 -234,7 +234,7 @@@
return adoptRef(*addResult.first);
}
- PassRefPtr<StringImpl> AtomicString::add(const KJS::UString& ustring)
+ PassRefPtr<StringImpl> AtomicString::add(const JSC::UString& ustring)
{
if (ustring.isNull())
return 0;
@@@ -247,8 -250,9 +250,9 @@@
return *addResult.first;
return adoptRef(*addResult.first);
}
+ #endif
- AtomicStringImpl* AtomicString::find(const KJS::Identifier& identifier)
+ AtomicStringImpl* AtomicString::find(const JSC::Identifier& identifier)
{
if (identifier.isNull())
return 0;
@@@ -265,11 -269,6 +269,6 @@@
return static_cast<AtomicStringImpl*>(*iterator);
}
- AtomicString::operator Identifier() const
- {
- return m_string;
- }
-
AtomicString::operator UString() const
{
return m_string;
diff --combined WebCore/platform/text/StringHash.h
index 8e16b51,c6e08a6..ea7f1dc
--- a/WebCore/platform/text/StringHash.h
+++ b/WebCore/platform/text/StringHash.h
@@@ -46,15 -46,6 +46,15 @@@ namespace WebCore
if (aLength != bLength)
return false;
+#if PLATFORM(ARM) || PLATFORM(SPARC)
+ const UChar* aChars = a->characters();
+ const UChar* bChars = b->characters();
+ for (unsigned i = 0; i != aLength; ++i)
+ if (*aChars++ != *bChars++)
+ return false;
+
+ return true;
+#else
const uint32_t* aChars = reinterpret_cast<const uint32_t*>(a->characters());
const uint32_t* bChars = reinterpret_cast<const uint32_t*>(b->characters());
@@@ -67,7 -58,6 +67,7 @@@
return false;
return true;
+#endif
}
static unsigned hash(const RefPtr<StringImpl>& key) { return key->hash(); }
@@@ -243,7 -233,7 +243,7 @@@ namespace WTF
template<> struct HashTraits<WebCore::String> : GenericHashTraits<WebCore::String> {
static const bool emptyValueIsZero = true;
- static void constructDeletedValue(WebCore::String* slot) { new (slot) WebCore::String(HashTableDeletedValue); }
+ static void constructDeletedValue(WebCore::String& slot) { new (&slot) WebCore::String(HashTableDeletedValue); }
static bool isDeletedValue(const WebCore::String& slot) { return slot.isHashTableDeletedValue(); }
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list