[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.0.2+pre.svn37878-1-3019-gd3ef526

Mike Hommey glandium at debian.org
Thu Mar 5 07:14:17 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d3ef5269a5d2d8925b83e343247099efda6a1b2e
Merge: a7534501d0ae66584dca99cad39215265575ce5b 8cb53892dfe2f9dd993636037b1129b2fbafbe3a
Author: Mike Hommey <glandium at debian.org>
Date:   Thu Mar 5 08:13:29 2009 +0100

    Merge branch 'webkit-1.1' into debian/unstable
    
    Conflicts:
    	GNUmakefile.am
    	GNUmakefile.in
    	JavaScriptCore/wtf/Platform.h
    	configure
    	configure.ac

diff --combined JavaScriptCore/wtf/FastMalloc.cpp
index 956f761,2cd031c..bac5997
--- a/JavaScriptCore/wtf/FastMalloc.cpp
+++ b/JavaScriptCore/wtf/FastMalloc.cpp
@@@ -191,7 -191,7 +191,7 @@@ void* fastMalloc(size_t n
      ASSERT(!isForbidden());
      void* result = malloc(n);
      if (!result)
-         abort();
+         CRASH();
      return result;
  }
  
@@@ -206,7 -206,7 +206,7 @@@ void* fastCalloc(size_t n_elements, siz
      ASSERT(!isForbidden());
      void* result = calloc(n_elements, element_size);
      if (!result)
-         abort();
+         CRASH();
      return result;
  }
  
@@@ -227,34 -227,18 +227,18 @@@ void* fastRealloc(void* p, size_t n
      ASSERT(!isForbidden());
      void* result = realloc(p, n);
      if (!result)
-         abort();
+         CRASH();
      return result;
  }
  
  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)
+     
+ FastMallocStatistics fastMallocStatistics()
  {
-     return fastMalloc(n);
+     FastMallocStatistics statistics = { 0, 0, 0, 0 };
+     return statistics;
  }
  
- void fastFreeExecutable(void* p)
- { 
-     fastFree(p);
- }
- #endif
- 
  } // namespace WTF
  
  #if PLATFORM(DARWIN)
@@@ -686,11 -670,11 +670,11 @@@ static void InitSizeClasses() 
    // Do some sanity checking on add_amount[]/shift_amount[]/class_array[]
    if (ClassIndex(0) < 0) {
      MESSAGE("Invalid class index %d for size 0\n", ClassIndex(0));
-     abort();
+     CRASH();
    }
    if (static_cast<size_t>(ClassIndex(kMaxSize)) >= sizeof(class_array)) {
      MESSAGE("Invalid class index %d for kMaxSize\n", ClassIndex(kMaxSize));
-     abort();
+     CRASH();
    }
  
    // Compute the size classes we want to use
@@@ -742,7 -726,7 +726,7 @@@
    if (sc != kNumClasses) {
      MESSAGE("wrong number of size classes: found %" PRIuS " instead of %d\n",
              sc, int(kNumClasses));
-     abort();
+     CRASH();
    }
  
    // Initialize the mapping arrays
@@@ -760,25 -744,25 +744,25 @@@
      const size_t sc = SizeClass(size);
      if (sc == 0) {
        MESSAGE("Bad size class %" PRIuS " for %" PRIuS "\n", sc, size);
-       abort();
+       CRASH();
      }
      if (sc > 1 && size <= class_to_size[sc-1]) {
        MESSAGE("Allocating unnecessarily large class %" PRIuS " for %" PRIuS
                "\n", sc, size);
-       abort();
+       CRASH();
      }
      if (sc >= kNumClasses) {
        MESSAGE("Bad size class %" PRIuS " for %" PRIuS "\n", sc, size);
-       abort();
+       CRASH();
      }
      const size_t s = class_to_size[sc];
      if (size > s) {
       MESSAGE("Bad size %" PRIuS " for %" PRIuS " (sc = %" PRIuS ")\n", s, size, sc);
-       abort();
+       CRASH();
      }
      if (s == 0) {
        MESSAGE("Bad size %" PRIuS " for %" PRIuS " (sc = %" PRIuS ")\n", s, size, sc);
-       abort();
+       CRASH();
      }
    }
  
@@@ -861,7 -845,7 +845,7 @@@ class PageHeapAllocator 
        if (free_avail_ < kAlignedSize) {
          // Need more room
          free_area_ = reinterpret_cast<char*>(MetaDataAlloc(kAllocIncrement));
-         if (free_area_ == NULL) abort();
+         if (free_area_ == NULL) CRASH();
          free_avail_ = kAllocIncrement;
        }
        result = free_area_;
@@@ -995,7 -979,6 +979,6 @@@ static ALWAYS_INLINE bool DLL_IsEmpty(c
    return list->next == list;
  }
  
- #ifndef WTF_CHANGES
  static int DLL_Length(const Span* list) {
    int result = 0;
    for (Span* s = list->next; s != list; s = s->next) {
@@@ -1003,7 -986,6 +986,6 @@@
    }
    return result;
  }
- #endif
  
  #if 0 /* Not needed at the moment -- causes compiler warnings if not used */
  static void DLL_Print(const char* label, const Span* list) {
@@@ -1055,11 -1037,30 +1037,30 @@@ template <int BITS> class MapSelector 
    typedef PackedCache<BITS, uint64_t> CacheType;
  };
  
+ #if defined(WTF_CHANGES)
+ #if PLATFORM(X86_64)
+ // On all known X86-64 platforms, the upper 16 bits are always unused and therefore 
+ // can be excluded from the PageMap key.
+ // See http://en.wikipedia.org/wiki/X86-64#Virtual_address_space_details
+ 
+ static const size_t kBitsUnusedOn64Bit = 16;
+ #else
+ static const size_t kBitsUnusedOn64Bit = 0;
+ #endif
+ 
+ // A three-level map for 64-bit machines
+ template <> class MapSelector<64> {
+  public:
+   typedef TCMalloc_PageMap3<64 - kPageShift - kBitsUnusedOn64Bit> Type;
+   typedef PackedCache<64, uint64_t> CacheType;
+ };
+ #endif
+ 
  // A two-level map for 32-bit machines
  template <> class MapSelector<32> {
   public:
-   typedef TCMalloc_PageMap2<32-kPageShift> Type;
-   typedef PackedCache<32-kPageShift, uint16_t> CacheType;
+   typedef TCMalloc_PageMap2<32 - kPageShift> Type;
+   typedef PackedCache<32 - kPageShift, uint16_t> CacheType;
  };
  
  // -------------------------------------------------------------------------
@@@ -1109,6 -1110,8 +1110,8 @@@ class TCMalloc_PageHeap 
        pagemap_.Ensure(p, 1);
        return GetDescriptor(p);
    }
+     
+   size_t ReturnedBytes() const;
  #endif
  
    // Dump state to stderr
@@@ -1491,6 -1494,21 +1494,21 @@@ void TCMalloc_PageHeap::RegisterSizeCla
      pagemap_.set(span->start+i, span);
    }
  }
+     
+ #ifdef WTF_CHANGES
+ size_t TCMalloc_PageHeap::ReturnedBytes() const {
+     size_t result = 0;
+     for (unsigned s = 0; s < kMaxPages; s++) {
+         const int r_length = DLL_Length(&free_[s].returned);
+         unsigned r_pages = s * r_length;
+         result += r_pages << kPageShift;
+     }
+     
+     for (Span* s = large_.returned.next; s != &large_.returned; s = s->next)
+         result += s->length << kPageShift;
+     return result;
+ }
+ #endif
  
  #ifndef WTF_CHANGES
  static double PagesToMB(uint64_t pages) {
@@@ -1937,13 -1955,13 +1955,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;
  
@@@ -3023,7 -3041,7 +3041,7 @@@ static inline void* SpanToMallocResult(
  }
  
  #ifdef WTF_CHANGES
- template <bool abortOnFailure>
+ template <bool crashOnFailure>
  #endif
  static ALWAYS_INLINE void* do_malloc(size_t size) {
    void* ret = NULL;
@@@ -3056,8 -3074,8 +3074,8 @@@
    }
    if (!ret) {
  #ifdef WTF_CHANGES
-     if (abortOnFailure) // This branch should be optimized out by the compiler.
-         abort();
+     if (crashOnFailure) // This branch should be optimized out by the compiler.
+         CRASH();
  #else
      errno = ENOMEM;
  #endif
@@@ -3226,9 -3244,9 +3244,9 @@@ static inline struct mallinfo do_mallin
  #ifndef WTF_CHANGES
  extern "C" 
  #else
- #define do_malloc do_malloc<abortOnFailure>
+ #define do_malloc do_malloc<crashOnFailure>
  
- template <bool abortOnFailure>
+ template <bool crashOnFailure>
  void* malloc(size_t);
  
  void* fastMalloc(size_t size)
@@@ -3241,7 -3259,7 +3259,7 @@@ void* tryFastMalloc(size_t size
      return malloc<false>(size);
  }
  
- template <bool abortOnFailure>
+ template <bool crashOnFailure>
  ALWAYS_INLINE
  #endif
  void* malloc(size_t size) {
@@@ -3265,7 -3283,7 +3283,7 @@@ void free(void* ptr) 
  #ifndef WTF_CHANGES
  extern "C" 
  #else
- template <bool abortOnFailure>
+ template <bool crashOnFailure>
  void* calloc(size_t, size_t);
  
  void* fastCalloc(size_t n, size_t elem_size)
@@@ -3278,7 -3296,7 +3296,7 @@@ void* tryFastCalloc(size_t n, size_t el
      return calloc<false>(n, elem_size);
  }
  
- template <bool abortOnFailure>
+ template <bool crashOnFailure>
  ALWAYS_INLINE
  #endif
  void* calloc(size_t n, size_t elem_size) {
@@@ -3298,6 -3316,8 +3316,8 @@@
    return result;
  }
  
+ // Since cfree isn't used anywhere, we don't compile it in.
+ #ifndef WTF_CHANGES
  #ifndef WTF_CHANGES
  extern "C" 
  #endif
@@@ -3307,11 -3327,12 +3327,12 @@@ void cfree(void* ptr) 
  #endif
    do_free(ptr);
  }
+ #endif
  
  #ifndef WTF_CHANGES
  extern "C" 
  #else
- template <bool abortOnFailure>
+ template <bool crashOnFailure>
  void* realloc(void*, size_t);
  
  void* fastRealloc(void* old_ptr, size_t new_size)
@@@ -3324,7 -3345,7 +3345,7 @@@ void* tryFastRealloc(void* old_ptr, siz
      return realloc<false>(old_ptr, new_size);
  }
  
- template <bool abortOnFailure>
+ template <bool crashOnFailure>
  ALWAYS_INLINE
  #endif
  void* realloc(void* old_ptr, size_t new_size) {
@@@ -3385,16 -3406,6 +3406,6 @@@
    }
  }
  
- void* fastMallocExecutable(size_t n)
- {
-     return malloc<false>(n);
- }
- 
- void fastFreeExecutable(void* p)
- { 
-     free(p);
- }
- 
  #ifdef WTF_CHANGES
  #undef do_malloc
  #else
@@@ -3560,7 -3571,7 +3571,7 @@@ extern "C" struct mallinfo mallinfo(voi
  
  #if defined(__GLIBC__)
  extern "C" {
- # if defined(__GNUC__) && !defined(__MACH__) && defined(HAVE___ATTRIBUTE__)
+ #if COMPILER(GCC) && !defined(__MACH__) && defined(HAVE___ATTRIBUTE__)
    // Potentially faster variants that use the gcc alias extension.
    // Mach-O (Darwin) does not support weak aliases, hence the __MACH__ check.
  # define ALIAS(x) __attribute__ ((weak, alias (x)))
@@@ -3792,7 -3803,13 +3803,13 @@@ void* FastMallocZone::zoneRealloc(mallo
  
  extern "C" {
  malloc_introspection_t jscore_fastmalloc_introspection = { &FastMallocZone::enumerate, &FastMallocZone::goodSize, &FastMallocZone::check, &FastMallocZone::print,
-     &FastMallocZone::log, &FastMallocZone::forceLock, &FastMallocZone::forceUnlock, &FastMallocZone::statistics };
+     &FastMallocZone::log, &FastMallocZone::forceLock, &FastMallocZone::forceUnlock, &FastMallocZone::statistics
+ 
+ #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
+     , 0 // zone_locked will not be called on the zone unless it advertises itself as version five or higher.
+ #endif
+ 
+     };
  }
  
  FastMallocZone::FastMallocZone(TCMalloc_PageHeap* pageHeap, TCMalloc_ThreadCache** threadHeaps, TCMalloc_Central_FreeListPadded* centralCaches)
@@@ -3801,6 -3818,7 +3818,7 @@@
      , m_centralCaches(centralCaches)
  {
      memset(&m_zone, 0, sizeof(m_zone));
+     m_zone.version = 4;
      m_zone.zone_name = "JavaScriptCore FastMalloc";
      m_zone.size = &FastMallocZone::size;
      m_zone.malloc = &FastMallocZone::zoneMalloc;
@@@ -3821,13 -3839,41 +3839,41 @@@ void FastMallocZone::init(
  
  #endif
  
+ #if WTF_CHANGES
  void releaseFastMallocFreeMemory()
  {
+     // Flush free pages in the current thread cache back to the page heap.
+     // Low watermark mechanism in Scavenge() prevents full return on the first pass.
+     // The second pass flushes everything.
+     if (TCMalloc_ThreadCache* threadCache = TCMalloc_ThreadCache::GetCacheIfPresent()) {
+         threadCache->Scavenge();
+         threadCache->Scavenge();
+     }
+ 
      SpinLockHolder h(&pageheap_lock);
      pageheap->ReleaseFreePages();
  }
+     
+ FastMallocStatistics fastMallocStatistics()
+ {
+     FastMallocStatistics statistics;
+     {
+         SpinLockHolder lockHolder(&pageheap_lock);
+         statistics.heapSize = static_cast<size_t>(pageheap->SystemBytes());
+         statistics.freeSizeInHeap = static_cast<size_t>(pageheap->FreeBytes());
+         statistics.returnedSize = pageheap->ReturnedBytes();
+         statistics.freeSizeInCaches = 0;
+         for (TCMalloc_ThreadCache* threadCache = thread_heaps; threadCache ; threadCache = threadCache->next_)
+             statistics.freeSizeInCaches += threadCache->Size();
+     }
+     for (unsigned cl = 0; cl < kNumClasses; ++cl) {
+         const int length = central_cache[cl].length();
+         const int tc_length = central_cache[cl].tc_length();
+         statistics.freeSizeInCaches += ByteSizeForClass(cl) * (length + tc_length);
+     }
+     return statistics;
+ }
  
- #if WTF_CHANGES
  } // namespace WTF
  #endif
  
diff --combined JavaScriptCore/wtf/ListHashSet.h
index 3f66606,38cc998..0cc2dd4
--- a/JavaScriptCore/wtf/ListHashSet.h
+++ b/JavaScriptCore/wtf/ListHashSet.h
@@@ -60,6 -60,8 +60,8 @@@ namespace WTF 
          typedef ListHashSetNodeHashFunctions<ValueArg, HashArg> NodeHash;
  
          typedef HashTable<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplType;
+         typedef HashTableIterator<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplTypeIterator;
+         typedef HashTableConstIterator<Node*, Node*, IdentityExtractor<Node*>, NodeHash, NodeTraits, NodeTraits> ImplTypeConstIterator;
  
          typedef HashArg HashFunctions;
  
@@@ -125,7 -127,7 +127,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()
@@@ -169,7 -171,7 +171,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)
@@@ -180,7 -182,10 +182,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 {
@@@ -438,7 -443,7 +440,7 @@@
      inline typename ListHashSet<T, U>::iterator ListHashSet<T, U>::find(const ValueType& value)
      {
          typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
-         typename ImplType::iterator it = m_impl.template find<ValueType, Translator>(value);
+         ImplTypeIterator it = m_impl.template find<ValueType, Translator>(value);
          if (it == m_impl.end())
              return end();
          return makeIterator(*it); 
@@@ -448,7 -453,7 +450,7 @@@
      inline typename ListHashSet<T, U>::const_iterator ListHashSet<T, U>::find(const ValueType& value) const
      {
          typedef ListHashSetTranslator<ValueType, HashFunctions> Translator;
-         typename ImplType::const_iterator it = m_impl.template find<ValueType, Translator>(value);
+         ImplTypeConstIterator it = m_impl.template find<ValueType, Translator>(value);
          if (it == m_impl.end())
              return end();
          return makeConstIterator(*it);
diff --combined JavaScriptCore/wtf/Platform.h
index c70821a,ca767b7..73fc198
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@@ -1,5 -1,5 +1,5 @@@
  /*
-  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+  * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
@@@ -78,15 -78,33 +78,33 @@@
  #define WTF_PLATFORM_SOLARIS 1
  #endif
  
+ #if defined (__S60__) || defined (__SYMBIAN32__)
+ /* we are cross-compiling, it is not really windows */
+ #undef WTF_PLATFORM_WIN_OS
+ #undef WTF_PLATFORM_WIN
+ #undef WTF_PLATFORM_CAIRO
+ #define WTF_PLATFORM_S60 1
+ #define WTF_PLATFORM_SYMBIAN 1
+ #endif
+ 
+ 
+ /* PLATFORM(NETBSD) */
+ /* Operating system level dependencies for NetBSD that should be used */
+ /* regardless of operating environment */
+ #if defined(__NetBSD__)
+ #define WTF_PLATFORM_NETBSD 1
+ #endif
+ 
  /* PLATFORM(UNIX) */
  /* Operating system level dependencies for Unix-like systems that */
  /* should be used regardless of operating environment */
  #if   PLATFORM(DARWIN)     \
     || PLATFORM(FREEBSD)    \
+    || PLATFORM(S60)        \
+    || PLATFORM(NETBSD)     \
     || defined(unix)        \
     || defined(__unix)      \
     || defined(__unix__)    \
-    || defined (__NetBSD__) \
     || defined(_AIX)
  #define WTF_PLATFORM_UNIX 1
  #endif
@@@ -126,25 -144,23 +144,23 @@@
  #define WTF_PLATFORM_CI 1
  #endif
  
- /* PLATFORM(SKIA) */
+ /* PLATFORM(SKIA) for Win/Linux, CG/CI for Mac */
  #if PLATFORM(CHROMIUM)
+ #if PLATFORM(DARWIN)
+ #define WTF_PLATFORM_CG 1
+ #define WTF_PLATFORM_CI 1
+ #define WTF_USE_ATSUI 1
+ #else
  #define WTF_PLATFORM_SKIA 1
  #endif
+ #endif
  
  /* Makes PLATFORM(WIN) default to PLATFORM(CAIRO) */
- #if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX)
+ /* FIXME: This should be changed from a blacklist to a whitelist */
+ #if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM)
  #define WTF_PLATFORM_CAIRO 1
  #endif
  
- #ifdef __S60__
- // we are cross-compiling, it is not really windows
- #undef WTF_PLATFORM_WIN_OS
- #undef WTF_PLATFORM_WIN
- #undef WTF_PLATFORM_CAIRO
- #define WTF_PLATFORM_S60 1
- #define WTF_PLATFORM_SYMBIAN 1
- #endif
- 
  /* CPU */
  
  /* PLATFORM(PPC) */
@@@ -196,29 -212,26 +212,43 @@@
  #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
  
+ /* PLATFORM(WIN_CE) && PLATFORM(QT)
+    We can not determine the endianess at compile time. For
+    Qt for Windows CE the endianess is specified in the
+    device specific makespec
+ */
+ #if PLATFORM(WIN_CE) && PLATFORM(QT)
+ #   include <QtGlobal>
+ #   undef WTF_PLATFORM_BIG_ENDIAN
+ #   undef WTF_PLATFORM_MIDDLE_ENDIAN
+ #   if Q_BYTE_ORDER == Q_BIG_EDIAN
+ #       define WTF_PLATFORM_BIG_ENDIAN 1
+ #   endif
+ #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) */
@@@ -229,8 -242,14 +259,14 @@@
  #endif
  #endif
  
+ /* COMPILER(RVCT) */
+ #if defined(__CC_ARM) || defined(__ARMCC__)
+ #define WTF_COMPILER_RVCT 1
+ #endif
+ 
  /* COMPILER(GCC) */
- #if defined(__GNUC__)
+ /* --gnu option of the RVCT compiler also defines __GNUC__ */
+ #if defined(__GNUC__) && !COMPILER(RVCT)
  #define WTF_COMPILER_GCC 1
  #endif
  
@@@ -251,6 -270,11 +287,11 @@@
  #define WTF_COMPILER_CYGWIN 1
  #endif
  
+ /* COMPILER(WINSCW) */
+ #if defined(__WINSCW__)
+ #define WTF_COMPILER_WINSCW 1
+ #endif
+ 
  #if (PLATFORM(MAC) || PLATFORM(WIN)) && !defined(ENABLE_JSC_MULTIPLE_THREADS)
  #define ENABLE_JSC_MULTIPLE_THREADS 1
  #endif
@@@ -281,6 -305,11 +322,11 @@@
  #endif
  #endif
  
+ #if PLATFORM(CHROMIUM) && PLATFORM(DARWIN)
+ #define WTF_PLATFORM_CF 1
+ #define WTF_USE_PTHREADS 1
+ #endif
+ 
  #if PLATFORM(WIN)
  #define WTF_USE_WININET 1
  #endif
@@@ -296,9 -325,11 +342,11 @@@
  #endif
  #endif
  
+ #if !defined(HAVE_ACCESSIBILITY)
  #if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM)
  #define HAVE_ACCESSIBILITY 1
  #endif
+ #endif /* !defined(HAVE_ACCESSIBILITY) */
  
  #if COMPILER(GCC)
  #define HAVE_COMPUTED_GOTO 1
@@@ -318,9 -349,26 +366,26 @@@
  #elif PLATFORM(WIN_OS)
  
  #define HAVE_FLOAT_H 1
+ #if PLATFORM(WIN_CE)
+ #define HAVE_ERRNO_H 0
+ #else
  #define HAVE_SYS_TIMEB_H 1
+ #endif
  #define HAVE_VIRTUALALLOC 1
  
+ #elif PLATFORM(SYMBIAN)
+ 
+ #define HAVE_ERRNO_H 1
+ #define HAVE_MMAP 0
+ #define HAVE_SBRK 1
+ 
+ #define HAVE_SYS_TIME_H 1
+ #define HAVE_STRINGS_H 1
+ 
+ #if !COMPILER(RVCT)
+ #define HAVE_SYS_PARAM_H 1
+ #endif
+ 
  #else
  
  /* FIXME: is this actually used or do other platforms generate their own config.h? */
@@@ -364,32 -412,86 +429,86 @@@
  #define ENABLE_NETSCAPE_PLUGIN_API 1
  #endif
  
- #if !defined(ENABLE_SAMPLING_TOOL)
- #define ENABLE_SAMPLING_TOOL 0
+ #if !defined(ENABLE_OPCODE_STATS)
+ #define ENABLE_OPCODE_STATS 0
+ #endif
+ 
+ #if !defined(ENABLE_CODEBLOCK_SAMPLING)
+ #define ENABLE_CODEBLOCK_SAMPLING 0
+ #endif
+ 
+ #if ENABLE(CODEBLOCK_SAMPLING) && !defined(ENABLE_OPCODE_SAMPLING)
+ #define ENABLE_OPCODE_SAMPLING 1
+ #endif
+ 
+ #if !defined(ENABLE_OPCODE_SAMPLING)
+ #define ENABLE_OPCODE_SAMPLING 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
+ #if !defined(ENABLE_TEXT_CARET)
+ #define ENABLE_TEXT_CARET 1
+ #endif
+ 
+ #if !defined(ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL)
+ #define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0
+ #endif
+ 
+ #if !defined(WTF_USE_ALTERNATE_JSIMMEDIATE) && PLATFORM(X86_64) && PLATFORM(MAC)
+ #define WTF_USE_ALTERNATE_JSIMMEDIATE 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))
+ #if !defined(ENABLE_JIT)
+ /* The JIT is tested & working on x86_64 Mac */
+ #if PLATFORM(X86_64) && PLATFORM(MAC)
+     #define ENABLE_JIT 1
+     #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
+ /* The JIT is tested & working on x86 Mac */
+ #elif PLATFORM(X86) && PLATFORM(MAC)
+     #define ENABLE_JIT 1
+     #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
+ /* The JIT is tested & working on x86 Windows */
+ #elif PLATFORM(X86) && PLATFORM(WIN)
+     #define ENABLE_JIT 1
+     #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
+ #endif
+     #define ENABLE_JIT_OPTIMIZE_CALL 1
+     #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1
+     #define ENABLE_JIT_OPTIMIZE_ARITHMETIC 1
+ #endif
+ 
+ #if ENABLE(JIT)
+ #if !(USE(JIT_STUB_ARGUMENT_VA_LIST) || USE(JIT_STUB_ARGUMENT_REGISTER) || USE(JIT_STUB_ARGUMENT_STACK))
+ #error Please define one of the JIT_STUB_ARGUMENT settings.
+ #elif (USE(JIT_STUB_ARGUMENT_VA_LIST) && USE(JIT_STUB_ARGUMENT_REGISTER)) \
+    || (USE(JIT_STUB_ARGUMENT_VA_LIST) && USE(JIT_STUB_ARGUMENT_STACK)) \
+    || (USE(JIT_STUB_ARGUMENT_REGISTER) && USE(JIT_STUB_ARGUMENT_STACK))
+ #error Please do not define more than one of the JIT_STUB_ARGUMENT settings.
+ #endif
+ #endif
+ 
+ /* WREC supports x86 & x86-64, and has been tested on Mac and Windows ('cept on 64-bit on Mac). */
+ #if (!defined(ENABLE_WREC) && PLATFORM(X86) && PLATFORM(MAC)) \
+  || (!defined(ENABLE_WREC) && PLATFORM(X86_64) && PLATFORM(MAC)) \
+  || (!defined(ENABLE_WREC) && PLATFORM(X86) && PLATFORM(WIN))
  #define ENABLE_WREC 1
  #endif
  
- #if ENABLE(CTI) || ENABLE(WREC)
- #define ENABLE_MASM 1
+ #if ENABLE(JIT) || ENABLE(WREC)
+ #define ENABLE_ASSEMBLER 1
  #endif
  
- #if !defined(ENABLE_PAN_SCROLLING) && (PLATFORM(WIN) || PLATFORM(CHROMIUM) || (PLATFORM(WX) && PLATFORM(WIN_OS)))
+ #if !defined(ENABLE_PAN_SCROLLING) && PLATFORM(WIN_OS)
  #define ENABLE_PAN_SCROLLING 1
  #endif
  
+ #if !defined(ENABLE_ACTIVEX_TYPE_CONVERSION_WMPLAYER)
+ #define ENABLE_ACTIVEX_TYPE_CONVERSION_WMPLAYER 1
+ #endif
+ 
  /* Use the QtXmlStreamReader implementation for XMLTokenizer */
  #if PLATFORM(QT)
  #if !ENABLE(XSLT)
@@@ -397,10 -499,8 +516,8 @@@
  #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
+ #if !PLATFORM(QT)
+ #define WTF_USE_FONT_FAST_PATH 1
  #endif
  
  #endif /* WTF_Platform_h */
diff --combined WebCore/platform/text/AtomicString.cpp
index 64e3367,5f9abfd..389b897
--- a/WebCore/platform/text/AtomicString.cpp
+++ b/WebCore/platform/text/AtomicString.cpp
@@@ -28,17 -28,22 +28,22 @@@
  
  #include "StaticConstructors.h"
  #include "StringHash.h"
- #include <kjs/identifier.h>
+ #include "ThreadGlobalData.h"
+ #include <wtf/Threading.h>
  #include <wtf/HashSet.h>
  
  #if USE(JSC)
+ #include <runtime/Identifier.h>
  using JSC::Identifier;
  using JSC::UString;
  #endif
  
  namespace WebCore {
  
- static HashSet<StringImpl*>* stringTable;
+ static inline HashSet<StringImpl*>& stringTable()
+ {
+     return threadGlobalData().atomicStringTable();
+ }
  
  struct CStringTranslator {
      static unsigned hash(const char* c)
@@@ -80,7 -85,7 +85,7 @@@ PassRefPtr<StringImpl> AtomicString::ad
          return 0;
      if (!*c)
          return StringImpl::empty();    
-     pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable->add<const char*, CStringTranslator>(c);
+     pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<const char*, CStringTranslator>(c);
      if (!addResult.second)
          return *addResult.first;
      return adoptRef(*addResult.first);
@@@ -96,7 -101,7 +101,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++)
@@@ -172,10 -177,11 +177,11 @@@ PassRefPtr<StringImpl> AtomicString::ad
          return StringImpl::empty();
      
      UCharBuffer buf = { s, length }; 
-     pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable->add<UCharBuffer, UCharBufferTranslator>(buf);
-     if (!addResult.second)
-         return *addResult.first;
-     return adoptRef(*addResult.first);
+     pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<UCharBuffer, UCharBufferTranslator>(buf);
+ 
+     // If the string is newly-translated, then we need to adopt it.
+     // The boolean in the pair tells us if that is so.
+     return addResult.second ? adoptRef(*addResult.first) : *addResult.first;
  }
  
  PassRefPtr<StringImpl> AtomicString::add(const UChar* s)
@@@ -191,10 -197,11 +197,11 @@@
          return StringImpl::empty();
  
      UCharBuffer buf = {s, length}; 
-     pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable->add<UCharBuffer, UCharBufferTranslator>(buf);
-     if (!addResult.second)
-         return *addResult.first;
-     return adoptRef(*addResult.first);
+     pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<UCharBuffer, UCharBufferTranslator>(buf);
+ 
+     // If the string is newly-translated, then we need to adopt it.
+     // The boolean in the pair tells us if that is so.
+     return addResult.second ? adoptRef(*addResult.first) : *addResult.first;
  }
  
  PassRefPtr<StringImpl> AtomicString::add(StringImpl* r)
@@@ -205,7 -212,7 +212,7 @@@
      if (r->length() == 0)
          return StringImpl::empty();
      
-     StringImpl* result = *stringTable->add(r).first;
+     StringImpl* result = *stringTable().add(r).first;
      if (result == r)
          r->m_inTable = true;
      return result;
@@@ -213,7 -220,7 +220,7 @@@
  
  void AtomicString::remove(StringImpl* r)
  {
-     stringTable->remove(r);
+     stringTable().remove(r);
  }
  
  #if USE(JSC)
@@@ -228,7 -235,7 +235,7 @@@ PassRefPtr<StringImpl> AtomicString::ad
          return StringImpl::empty();
  
      HashAndCharacters buffer = { string->computedHash(), string->data(), length }; 
-     pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable->add<HashAndCharacters, HashAndCharactersTranslator>(buffer);
+     pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<HashAndCharacters, HashAndCharactersTranslator>(buffer);
      if (!addResult.second)
          return *addResult.first;
      return adoptRef(*addResult.first);
@@@ -245,12 -252,11 +252,11 @@@ PassRefPtr<StringImpl> AtomicString::ad
          return StringImpl::empty();
  
      HashAndCharacters buffer = { string->hash(), string->data(), length }; 
-     pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable->add<HashAndCharacters, HashAndCharactersTranslator>(buffer);
+     pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable().add<HashAndCharacters, HashAndCharactersTranslator>(buffer);
      if (!addResult.second)
          return *addResult.first;
      return adoptRef(*addResult.first);
  }
- #endif
  
  AtomicStringImpl* AtomicString::find(const JSC::Identifier& identifier)
  {
@@@ -263,8 -269,8 +269,8 @@@
          return static_cast<AtomicStringImpl*>(StringImpl::empty());
  
      HashAndCharacters buffer = { string->computedHash(), string->data(), length }; 
-     HashSet<StringImpl*>::iterator iterator = stringTable->find<HashAndCharacters, HashAndCharactersTranslator>(buffer);
-     if (iterator == stringTable->end())
+     HashSet<StringImpl*>::iterator iterator = stringTable().find<HashAndCharacters, HashAndCharactersTranslator>(buffer);
+     if (iterator == stringTable().end())
          return 0;
      return static_cast<AtomicStringImpl*>(*iterator);
  }
@@@ -273,6 -279,7 +279,7 @@@ AtomicString::operator UString() cons
  {
      return m_string;
  }
+ #endif
  
  DEFINE_GLOBAL(AtomicString, nullAtom)
  DEFINE_GLOBAL(AtomicString, emptyAtom, "")
@@@ -284,7 -291,8 +291,8 @@@ void AtomicString::init(
  {
      static bool initialized;
      if (!initialized) {
-         stringTable = new HashSet<StringImpl*>;
+         // Initialization is not thread safe, so this function must be called from the main thread first.
+         ASSERT(isMainThread());
  
          // Use placement new to initialize the globals.
          new ((void*)&nullAtom) AtomicString;
diff --combined WebCore/platform/text/StringHash.h
index ea7f1dc,336dce3..0f14ef3
--- a/WebCore/platform/text/StringHash.h
+++ b/WebCore/platform/text/StringHash.h
@@@ -21,8 -21,9 +21,9 @@@
  #ifndef StringHash_h
  #define StringHash_h
  
- #include "AtomicStringImpl.h"
+ #include "AtomicString.h"
  #include "PlatformString.h"
+ #include <wtf/HashFunctions.h>
  #include <wtf/HashTraits.h>
  #include <wtf/unicode/Unicode.h>
  
@@@ -46,15 -47,6 +47,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 -59,6 +68,7 @@@
                  return false;
  
              return true;
 +#endif
          }
  
          static unsigned hash(const RefPtr<StringImpl>& key) { return key->hash(); }
@@@ -86,9 -77,6 +87,6 @@@
      };
  
      class CaseFoldingHash {
-     private:
-         // Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
-         static const unsigned PHI = 0x9e3779b9U;
      public:
          // Paul Hsieh's SuperFastHash
          // http://www.azillionmonkeys.com/qed/hash.html
@@@ -96,7 -84,7 +94,7 @@@
          {
              unsigned l = length;
              const UChar* s = data;
-             uint32_t hash = PHI;
+             uint32_t hash = WTF::stringHashingStartValue;
              uint32_t tmp;
              
              int rem = l & 1;
@@@ -146,7 -134,7 +144,7 @@@
  
              unsigned l = length;
              const char* s = str;
-             uint32_t hash = PHI;
+             uint32_t hash = WTF::stringHashingStartValue;
              uint32_t tmp;
              
              int rem = l & 1;
@@@ -209,10 -197,18 +207,18 @@@
          {
              return hash(key.impl());
          }
+         static unsigned hash(const AtomicString& key)
+         {
+             return hash(key.impl());
+         }
          static bool equal(const String& a, const String& b)
          {
              return equal(a.impl(), b.impl());
          }
+         static bool equal(const AtomicString& a, const AtomicString& b)
+         {
+             return (a == b) || equal(a.impl(), b.impl());
+         }
  
          static const bool safeToCompareToEmptyOrDeleted = false;
      };

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list