summaryrefslogtreecommitdiffstats
path: root/Source/JavaScriptCore/wtf
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-06-02 12:07:03 +0100
committerBen Murdoch <benm@google.com>2011-06-10 10:47:21 +0100
commit2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch)
treee4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/JavaScriptCore/wtf
parent87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff)
downloadexternal_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/JavaScriptCore/wtf')
-rw-r--r--Source/JavaScriptCore/wtf/Alignment.h36
-rw-r--r--Source/JavaScriptCore/wtf/Assertions.cpp2
-rw-r--r--Source/JavaScriptCore/wtf/Assertions.h13
-rw-r--r--Source/JavaScriptCore/wtf/CMakeLists.txt3
-rw-r--r--Source/JavaScriptCore/wtf/DynamicAnnotations.cpp35
-rw-r--r--Source/JavaScriptCore/wtf/DynamicAnnotations.h96
-rw-r--r--Source/JavaScriptCore/wtf/FastMalloc.cpp17
-rw-r--r--Source/JavaScriptCore/wtf/HashTable.h14
-rw-r--r--Source/JavaScriptCore/wtf/HashTraits.h8
-rw-r--r--Source/JavaScriptCore/wtf/MathExtras.h2
-rw-r--r--Source/JavaScriptCore/wtf/PageAllocatorSymbian.h2
-rw-r--r--Source/JavaScriptCore/wtf/Platform.h36
-rw-r--r--Source/JavaScriptCore/wtf/RetainPtr.h6
-rw-r--r--Source/JavaScriptCore/wtf/StdLibExtras.h1
-rw-r--r--Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h6
-rw-r--r--Source/JavaScriptCore/wtf/Vector.h16
-rw-r--r--Source/JavaScriptCore/wtf/VectorTraits.h6
-rw-r--r--Source/JavaScriptCore/wtf/gobject/GTypedefs.h2
-rw-r--r--Source/JavaScriptCore/wtf/text/AtomicString.cpp35
-rw-r--r--Source/JavaScriptCore/wtf/text/AtomicString.h43
-rw-r--r--Source/JavaScriptCore/wtf/text/StringConcatenate.h118
-rw-r--r--Source/JavaScriptCore/wtf/text/StringHash.h6
-rw-r--r--Source/JavaScriptCore/wtf/text/StringStatics.cpp2
-rw-r--r--Source/JavaScriptCore/wtf/text/WTFString.h5
-rw-r--r--Source/JavaScriptCore/wtf/unicode/CharacterNames.h2
-rw-r--r--Source/JavaScriptCore/wtf/unicode/UTF8.cpp13
-rw-r--r--Source/JavaScriptCore/wtf/unicode/UTF8.h3
27 files changed, 384 insertions, 144 deletions
diff --git a/Source/JavaScriptCore/wtf/Alignment.h b/Source/JavaScriptCore/wtf/Alignment.h
new file mode 100644
index 0000000..2541e01
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Alignment.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WTF_Alignment_h
+#define WTF_Alignment_h
+
+#include <wtf/Platform.h>
+
+#if COMPILER(GCC) || COMPILER(MINGW) || COMPILER(RVCT) || COMPILER(WINSCW)
+ #define WTF_ALIGN_OF(type) __alignof__(type)
+ #define WTF_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((__aligned__(n)))
+#elif COMPILER(MSVC)
+ #define WTF_ALIGN_OF(type) __alignof(type)
+ #define WTF_ALIGNED(variable_type, variable, n) __declspec(align(n)) variable_type variable
+#else
+ #error WTF_ALIGN macros need alignment control.
+#endif
+
+#endif // WTF_Alignment_h
diff --git a/Source/JavaScriptCore/wtf/Assertions.cpp b/Source/JavaScriptCore/wtf/Assertions.cpp
index 77e30c1..930368c 100644
--- a/Source/JavaScriptCore/wtf/Assertions.cpp
+++ b/Source/JavaScriptCore/wtf/Assertions.cpp
@@ -215,7 +215,7 @@ void WTFReportArgumentAssertionFailure(const char* file, int line, const char* f
void WTFReportBacktrace()
{
-#if PLATFORM(MAC) && !defined(NDEBUG)
+#if PLATFORM(MAC)
static const int maxFrames = 32;
void* samples[maxFrames];
int frames = backtrace(samples, maxFrames);
diff --git a/Source/JavaScriptCore/wtf/Assertions.h b/Source/JavaScriptCore/wtf/Assertions.h
index 1d108e4..72f8d36 100644
--- a/Source/JavaScriptCore/wtf/Assertions.h
+++ b/Source/JavaScriptCore/wtf/Assertions.h
@@ -73,6 +73,10 @@
#define HAVE_VARIADIC_MACRO 1
#endif
+#ifndef BACKTRACE_DISABLED
+#define BACKTRACE_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#endif
+
#ifndef ASSERT_DISABLED
#define ASSERT_DISABLED ASSERTIONS_DISABLED_DEFAULT
#endif
@@ -188,10 +192,17 @@ WTF_EXPORT_PRIVATE void WTFLogVerbose(const char* file, int line, const char* fu
Print a backtrace to the same location as ASSERT messages.
*/
-#ifndef BACKTRACE
+
+#if BACKTRACE_DISABLED
+
+#define BACKTRACE() ((void)0)
+
+#else
+
#define BACKTRACE() do { \
WTFReportBacktrace(); \
} while(false)
+
#endif
/* ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED
diff --git a/Source/JavaScriptCore/wtf/CMakeLists.txt b/Source/JavaScriptCore/wtf/CMakeLists.txt
index 304be73..97aad2d 100644
--- a/Source/JavaScriptCore/wtf/CMakeLists.txt
+++ b/Source/JavaScriptCore/wtf/CMakeLists.txt
@@ -1,6 +1,7 @@
SET(WTF_HEADERS
ASCIICType.h
AVLTree.h
+ Alignment.h
AlwaysInline.h
Assertions.h
Atomics.h
@@ -17,6 +18,7 @@ SET(WTF_HEADERS
Deque.h
DisallowCType.h
DoublyLinkedList.h
+ DynamicAnnotations.h
Encoder.h
FastAllocBase.h
FastMalloc.h
@@ -111,6 +113,7 @@ SET(WTF_SOURCES
CryptographicallyRandomNumber.cpp
CurrentTime.cpp
DecimalNumber.cpp
+ DynamicAnnotations.cpp
FastMalloc.cpp
HashTable.cpp
MainThread.cpp
diff --git a/Source/JavaScriptCore/wtf/DynamicAnnotations.cpp b/Source/JavaScriptCore/wtf/DynamicAnnotations.cpp
new file mode 100644
index 0000000..b7d4b41
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/DynamicAnnotations.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR 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.
+ */
+
+#include "config.h"
+
+#include "DynamicAnnotations.h"
+
+#if USE(DYNAMIC_ANNOTATIONS)
+void WTFAnnotateBenignRaceSized(const char*, int, const volatile void*, long, const char*) { }
+void WTFAnnotateHappensBefore(const char*, int, const volatile void*) { }
+void WTFAnnotateHappensAfter(const char*, int, const volatile void*) { }
+#endif // USE(DYNAMIC_ANNOTATIONS)
diff --git a/Source/JavaScriptCore/wtf/DynamicAnnotations.h b/Source/JavaScriptCore/wtf/DynamicAnnotations.h
new file mode 100644
index 0000000..38acce3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/DynamicAnnotations.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR 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.
+ */
+
+#ifndef WTF_DynamicAnnotations_h
+#define WTF_DynamicAnnotations_h
+
+/* This file defines dynamic annotations for use with dynamic analysis
+ * tool such as ThreadSanitizer, Valgrind, etc.
+ *
+ * Dynamic annotation is a source code annotation that affects
+ * the generated code (that is, the annotation is not a comment).
+ * Each such annotation is attached to a particular
+ * instruction and/or to a particular object (address) in the program.
+ *
+ * By using dynamic annotations a developer can give more details to the dynamic
+ * analysis tool to improve its precision.
+ *
+ * In C/C++ program the annotations are represented as C macros.
+ * With the default build flags, these macros are empty, hence don't affect
+ * performance of a compiled binary.
+ * If dynamic annotations are enabled, they just call no-op functions.
+ * The dynamic analysis tools can intercept these functions and replace them
+ * with their own implementations.
+ *
+ * See http://code.google.com/p/data-race-test/wiki/DynamicAnnotations for more information.
+ */
+
+#if USE(DYNAMIC_ANNOTATIONS)
+/* Tell data race detector that we're not interested in reports on the given address range. */
+#define WTF_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) WTFAnnotateBenignRaceSized(__FILE__, __LINE__, address, size, description)
+#define WTF_ANNOTATE_BENIGN_RACE(pointer, description) WTFAnnotateBenignRaceSized(__FILE__, __LINE__, pointer, sizeof(*(pointer)), description)
+
+/* Annotations for user-defined synchronization mechanisms.
+ * These annotations can be used to define happens-before arcs in user-defined
+ * synchronization mechanisms: the race detector will infer an arc from
+ * the former to the latter when they share the same argument pointer.
+ *
+ * The most common case requiring annotations is atomic reference counting:
+ * bool deref() {
+ * ANNOTATE_HAPPENS_BEFORE(&m_refCount);
+ * if (!atomicDecrement(&m_refCount)) {
+ * // m_refCount is now 0
+ * ANNOTATE_HAPPENS_AFTER(&m_refCount);
+ * // "return true; happens-after each atomicDecrement of m_refCount"
+ * return true;
+ * }
+ * return false;
+ * }
+ */
+#define WTF_ANNOTATE_HAPPENS_BEFORE(address) WTFAnnotateHappensBefore(__FILE__, __LINE__, address)
+#define WTF_ANNOTATE_HAPPENS_AFTER(address) WTFAnnotateHappensAfter(__FILE__, __LINE__, address)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* Don't use these directly, use the above macros instead. */
+void WTFAnnotateBenignRaceSized(const char* file, int line, const volatile void* memory, long size, const char* description);
+void WTFAnnotateHappensBefore(const char* file, int line, const volatile void* address);
+void WTFAnnotateHappensAfter(const char* file, int line, const volatile void* address);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#else // USE(DYNAMIC_ANNOTATIONS)
+/* These macros are empty when dynamic annotations are not enabled so you can
+ * use them without affecting the performance of release binaries. */
+#define WTF_ANNOTATE_BENIGN_RACE_SIZED(address, size, description)
+#define WTF_ANNOTATE_BENIGN_RACE(pointer, description)
+#define WTF_ANNOTATE_HAPPENS_BEFORE(address)
+#define WTF_ANNOTATE_HAPPENS_AFTER(address)
+#endif // USE(DYNAMIC_ANNOTATIONS)
+
+#endif // WTF_DynamicAnnotations_h
diff --git a/Source/JavaScriptCore/wtf/FastMalloc.cpp b/Source/JavaScriptCore/wtf/FastMalloc.cpp
index 29e9a1a..95a9aff 100644
--- a/Source/JavaScriptCore/wtf/FastMalloc.cpp
+++ b/Source/JavaScriptCore/wtf/FastMalloc.cpp
@@ -245,7 +245,8 @@ void* fastMalloc(size_t n)
#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
TryMallocReturnValue returnValue = tryFastMalloc(n);
void* result;
- returnValue.getValue(result);
+ if (!returnValue.getValue(result))
+ CRASH();
#else
void* result = malloc(n);
#endif
@@ -293,7 +294,8 @@ void* fastCalloc(size_t n_elements, size_t element_size)
#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
TryMallocReturnValue returnValue = tryFastCalloc(n_elements, element_size);
void* result;
- returnValue.getValue(result);
+ if (!returnValue.getValue(result))
+ CRASH();
#else
void* result = calloc(n_elements, element_size);
#endif
@@ -362,7 +364,8 @@ void* fastRealloc(void* p, size_t n)
#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
TryMallocReturnValue returnValue = tryFastRealloc(p, n);
void* result;
- returnValue.getValue(result);
+ if (!returnValue.getValue(result))
+ CRASH();
#else
void* result = realloc(p, n);
#endif
@@ -1615,10 +1618,10 @@ void TCMalloc_PageHeap::initializeScavenger()
void* TCMalloc_PageHeap::runScavengerThread(void* context)
{
- static_cast<TCMalloc_PageHeap*>(context)->scavengerThread();
-#if COMPILER(MSVC)
- // Without this, Visual Studio will complain that this method does not return a value.
- return 0;
+ static_cast<TCMalloc_PageHeap*>(context)->scavengerThread();
+#if (COMPILER(MSVC) || COMPILER(SUNCC))
+ // Without this, Visual Studio and Sun Studio will complain that this method does not return a value.
+ return 0;
#endif
}
diff --git a/Source/JavaScriptCore/wtf/HashTable.h b/Source/JavaScriptCore/wtf/HashTable.h
index 1c4ae6d..c2bc49b 100644
--- a/Source/JavaScriptCore/wtf/HashTable.h
+++ b/Source/JavaScriptCore/wtf/HashTable.h
@@ -259,19 +259,21 @@ namespace WTF {
using std::swap;
-#if !COMPILER(MSVC)
- // Visual C++ has a swap for pairs defined.
+ // Work around MSVC's standard library, whose swap for pairs does not swap by component.
+ template<typename T> inline void hashTableSwap(T& a, T& b)
+ {
+ swap(a, b);
+ }
- // swap pairs by component, in case of pair members that specialize swap
- template<typename T, typename U> inline void swap(pair<T, U>& a, pair<T, U>& b)
+ // Swap pairs by component, in case of pair members that specialize swap.
+ template<typename T, typename U> inline void hashTableSwap(pair<T, U>& a, pair<T, U>& b)
{
swap(a.first, b.first);
swap(a.second, b.second);
}
-#endif
template<typename T, bool useSwap> struct Mover;
- template<typename T> struct Mover<T, true> { static void move(T& from, T& to) { swap(from, to); } };
+ template<typename T> struct Mover<T, true> { static void move(T& from, T& to) { hashTableSwap(from, to); } };
template<typename T> struct Mover<T, false> { static void move(T& from, T& to) { to = from; } };
template<typename Key, typename Value, typename HashFunctions> class IdentityHashTranslator {
diff --git a/Source/JavaScriptCore/wtf/HashTraits.h b/Source/JavaScriptCore/wtf/HashTraits.h
index c8d40f7..fba5afe 100644
--- a/Source/JavaScriptCore/wtf/HashTraits.h
+++ b/Source/JavaScriptCore/wtf/HashTraits.h
@@ -81,12 +81,14 @@ namespace WTF {
static bool isDeletedValue(P* value) { return value == reinterpret_cast<P*>(-1); }
};
- template<typename P> struct HashTraits<RefPtr<P> > : GenericHashTraits<RefPtr<P> > {
+ template<typename T> struct SimpleClassHashTraits : GenericHashTraits<T> {
static const bool emptyValueIsZero = true;
- static void constructDeletedValue(RefPtr<P>& slot) { new (&slot) RefPtr<P>(HashTableDeletedValue); }
- static bool isDeletedValue(const RefPtr<P>& value) { return value.isHashTableDeletedValue(); }
+ static void constructDeletedValue(T& slot) { new (&slot) T(HashTableDeletedValue); }
+ static bool isDeletedValue(const T& value) { return value.isHashTableDeletedValue(); }
};
+ template<typename P> struct HashTraits<RefPtr<P> > : SimpleClassHashTraits<RefPtr<P> > { };
+
// special traits for pairs, helpful for their use in HashMap implementation
template<typename FirstTraitsArg, typename SecondTraitsArg>
diff --git a/Source/JavaScriptCore/wtf/MathExtras.h b/Source/JavaScriptCore/wtf/MathExtras.h
index 66e557f..fac187c 100644
--- a/Source/JavaScriptCore/wtf/MathExtras.h
+++ b/Source/JavaScriptCore/wtf/MathExtras.h
@@ -238,7 +238,7 @@ inline int clampToInteger(unsigned value)
return static_cast<int>(std::min(value, static_cast<unsigned>(std::numeric_limits<int>::max())));
}
-#if !COMPILER(MSVC) && !COMPILER(WINSCW) && !(COMPILER(RVCT) && (OS(SYMBIAN) || PLATFORM(BREWMP))) && !OS(SOLARIS)
+#if !COMPILER(MSVC) && !(COMPILER(RVCT) && PLATFORM(BREWMP)) && !OS(SOLARIS) && !OS(SYMBIAN)
using std::isfinite;
using std::isinf;
using std::isnan;
diff --git a/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h b/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h
index 48a8464..eba5b03 100644
--- a/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h
+++ b/Source/JavaScriptCore/wtf/PageAllocatorSymbian.h
@@ -30,7 +30,7 @@
#define PageAllocatorSymbian_h
#include <e32std.h>
-#include <wtf/BitMap.h>
+#include <wtf/Bitmap.h>
namespace WTF {
diff --git a/Source/JavaScriptCore/wtf/Platform.h b/Source/JavaScriptCore/wtf/Platform.h
index aee03e6..3e93b60 100644
--- a/Source/JavaScriptCore/wtf/Platform.h
+++ b/Source/JavaScriptCore/wtf/Platform.h
@@ -352,6 +352,10 @@
# error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms"
#endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */
+#if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON)
+#define WTF_CPU_ARM_NEON 1
+#endif
+
#endif /* ARM */
#if CPU(ARM) || CPU(MIPS)
@@ -535,18 +539,18 @@
/* Graphics engines */
-/* PLATFORM(CG) and PLATFORM(CI) */
+/* USE(CG) and PLATFORM(CI) */
#if PLATFORM(MAC) || PLATFORM(IOS)
-#define WTF_PLATFORM_CG 1
+#define WTF_USE_CG 1
#endif
-#if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && PLATFORM(CG))
-#define WTF_PLATFORM_CA 1
+#if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG))
+#define WTF_USE_CA 1
#endif
/* USE(SKIA) for Win/Linux, CG for Mac */
#if PLATFORM(CHROMIUM)
#if OS(DARWIN)
-#define WTF_PLATFORM_CG 1
+#define WTF_USE_CG 1
#define WTF_USE_ATSUI 1
#define WTF_USE_CORE_TEXT 1
#define WTF_USE_ICCJPEG 1
@@ -561,7 +565,7 @@
#endif
#if PLATFORM(GTK)
-#define WTF_PLATFORM_CAIRO 1
+#define WTF_USE_CAIRO 1
#endif
@@ -632,6 +636,7 @@
#define ENABLE_WEB_ARCHIVE 1
#endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
+<<<<<<< HEAD
#if PLATFORM(ANDROID)
#define ENABLE_FULLSCREEN_API 1
#endif
@@ -640,11 +645,12 @@
#define WTF_USE_CARBON_SECURE_INPUT_MODE 1
#endif
+=======
+>>>>>>> WebKit.org at r84325
#if PLATFORM(CHROMIUM) && OS(DARWIN)
#define WTF_USE_CF 1
#define WTF_USE_PTHREADS 1
#define HAVE_PTHREAD_RWLOCK 1
-#define WTF_USE_CARBON_SECURE_INPUT_MODE 1
#endif
#if PLATFORM(BREWMP)
@@ -680,7 +686,10 @@
#if PLATFORM(ANDROID)
#define WTF_USE_PTHREADS 1
+<<<<<<< HEAD
#define WTF_USE_SKIA 1
+=======
+>>>>>>> WebKit.org at r84325
#define USE_SYSTEM_MALLOC 1
#define ENABLE_JAVA_BRIDGE 1
#define LOG_DISABLED 1
@@ -786,6 +795,7 @@
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIMEB_H 1
+#define WTF_USE_ACCELERATE 1
#if !defined(TARGETING_TIGER) && !defined(TARGETING_LEOPARD)
@@ -1046,6 +1056,14 @@
#error You have to have at least one execution model enabled to build JSC
#endif
+#if CPU(SH4) && PLATFORM(QT)
+#define ENABLE_JIT 1
+#define ENABLE_YARR 1
+#define ENABLE_YARR_JIT 1
+#define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
+#define ENABLE_ASSEMBLER 1
+#endif
+
/* Configure the JIT */
#if ENABLE(JIT)
#if CPU(ARM)
@@ -1210,4 +1228,8 @@
breakages one port at a time. */
#define WTF_USE_EXPORT_MACROS 0
+#if PLATFORM(QT) || PLATFORM(GTK)
+#define WTF_USE_UNIX_DOMAIN_SOCKETS 1
+#endif
+
#endif /* WTF_Platform_h */
diff --git a/Source/JavaScriptCore/wtf/RetainPtr.h b/Source/JavaScriptCore/wtf/RetainPtr.h
index 3a11589..a716390 100644
--- a/Source/JavaScriptCore/wtf/RetainPtr.h
+++ b/Source/JavaScriptCore/wtf/RetainPtr.h
@@ -234,11 +234,7 @@ namespace WTF {
return a != b.get();
}
- template<typename P> struct HashTraits<RetainPtr<P> > : GenericHashTraits<RetainPtr<P> > {
- static const bool emptyValueIsZero = true;
- static void constructDeletedValue(RetainPtr<P>& slot) { new (&slot) RetainPtr<P>(HashTableDeletedValue); }
- static bool isDeletedValue(const RetainPtr<P>& value) { return value == reinterpret_cast<P*>(-1); }
- };
+ template<typename P> struct HashTraits<RetainPtr<P> > : SimpleClassHashTraits<RetainPtr<P> > { };
template<typename P> struct PtrHash<RetainPtr<P> > : PtrHash<P*> {
using PtrHash<P*>::hash;
diff --git a/Source/JavaScriptCore/wtf/StdLibExtras.h b/Source/JavaScriptCore/wtf/StdLibExtras.h
index 0dacb91..a8582e9 100644
--- a/Source/JavaScriptCore/wtf/StdLibExtras.h
+++ b/Source/JavaScriptCore/wtf/StdLibExtras.h
@@ -162,5 +162,6 @@ inline ArrayType* binarySearch(ArrayType* array, size_t size, KeyType key)
} // namespace WTF
using WTF::binarySearch;
+using WTF::bitwise_cast;
#endif // WTF_StdLibExtras_h
diff --git a/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h b/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h
index c9beec4..ca11db3 100644
--- a/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h
+++ b/Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h
@@ -62,6 +62,7 @@
#include "Platform.h"
#include <wtf/Atomics.h>
+#include <wtf/DynamicAnnotations.h>
#include <wtf/ThreadingPrimitives.h>
namespace WTF {
@@ -103,8 +104,11 @@ protected:
bool derefBase()
{
#if USE(LOCKFREE_THREADSAFEREFCOUNTED)
- if (atomicDecrement(&m_refCount) <= 0)
+ WTF_ANNOTATE_HAPPENS_BEFORE(&m_refCount);
+ if (atomicDecrement(&m_refCount) <= 0) {
+ WTF_ANNOTATE_HAPPENS_AFTER(&m_refCount);
return true;
+ }
#else
int refCount;
{
diff --git a/Source/JavaScriptCore/wtf/Vector.h b/Source/JavaScriptCore/wtf/Vector.h
index b26857c..03c03d5 100644
--- a/Source/JavaScriptCore/wtf/Vector.h
+++ b/Source/JavaScriptCore/wtf/Vector.h
@@ -29,6 +29,7 @@
#include "VectorTraits.h"
#include <limits>
#include <utility>
+#include <wtf/Alignment.h>
#if PLATFORM(QT)
#include <QDataStream>
@@ -39,17 +40,6 @@ namespace WTF {
using std::min;
using std::max;
- // WTF_ALIGN_OF / WTF_ALIGNED
- #if COMPILER(GCC) || COMPILER(MINGW) || COMPILER(RVCT) || COMPILER(WINSCW) || COMPILER(SUNCC)
- #define WTF_ALIGN_OF(type) __alignof__(type)
- #define WTF_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((__aligned__(n)))
- #elif COMPILER(MSVC)
- #define WTF_ALIGN_OF(type) __alignof(type)
- #define WTF_ALIGNED(variable_type, variable, n) __declspec(align(n)) variable_type variable
- #else
- #error WTF_ALIGN macros need alignment control.
- #endif
-
#if COMPILER(GCC) && !COMPILER(INTEL) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303)
typedef char __attribute__((__may_alias__)) AlignedBufferChar;
#else
@@ -129,7 +119,11 @@ namespace WTF {
{
while (src != srcEnd) {
new (dst) T(*src);
+#if COMPILER(SUNCC) && __SUNPRO_CC <= 0x590
+ const_cast<T*>(src)->~T(); // Work around obscure SunCC 12 compiler bug.
+#else
src->~T();
+#endif
++dst;
++src;
}
diff --git a/Source/JavaScriptCore/wtf/VectorTraits.h b/Source/JavaScriptCore/wtf/VectorTraits.h
index 3f33b29..6777c9e 100644
--- a/Source/JavaScriptCore/wtf/VectorTraits.h
+++ b/Source/JavaScriptCore/wtf/VectorTraits.h
@@ -61,14 +61,10 @@ namespace WTF {
template<typename T>
struct VectorTraits : VectorTraitsBase<IsPod<T>::value, T> { };
- struct SimpleClassVectorTraits
+ struct SimpleClassVectorTraits : VectorTraitsBase<false, void>
{
- static const bool needsDestruction = true;
- static const bool needsInitialization = true;
static const bool canInitializeWithMemset = true;
static const bool canMoveWithMemcpy = true;
- static const bool canCopyWithMemcpy = false;
- static const bool canFillWithMemset = false;
static const bool canCompareWithMemcmp = true;
};
diff --git a/Source/JavaScriptCore/wtf/gobject/GTypedefs.h b/Source/JavaScriptCore/wtf/gobject/GTypedefs.h
index 8061e8a..c7f7ac4 100644
--- a/Source/JavaScriptCore/wtf/gobject/GTypedefs.h
+++ b/Source/JavaScriptCore/wtf/gobject/GTypedefs.h
@@ -61,7 +61,7 @@ typedef struct _GSource GSource;
typedef struct _GVariant GVariant;
typedef union _GdkEvent GdkEvent;
-#if PLATFORM(CAIRO)
+#if USE(CAIRO)
typedef struct _cairo_surface cairo_surface_t;
#endif
diff --git a/Source/JavaScriptCore/wtf/text/AtomicString.cpp b/Source/JavaScriptCore/wtf/text/AtomicString.cpp
index eb0dbbb..9dd655e 100644
--- a/Source/JavaScriptCore/wtf/text/AtomicString.cpp
+++ b/Source/JavaScriptCore/wtf/text/AtomicString.cpp
@@ -351,41 +351,14 @@ AtomicString AtomicString::lower() const
return AtomicString(newImpl);
}
-AtomicString AtomicString::fromUTF8(const char* characters, size_t length)
+AtomicString AtomicString::fromUTF8Internal(const char* charactersStart, const char* charactersEnd)
{
- if (!characters)
- return AtomicString();
-
- if (!length)
- return emptyAtom;
-
- HashAndUTF8Characters buffer;
- buffer.characters = characters;
- buffer.length = length;
- buffer.hash = calculateStringHashFromUTF8(characters, characters + length, buffer.utf16Length);
-
- if (!buffer.hash)
- return AtomicString();
-
- AtomicString atomicString;
- atomicString.m_string = addToStringTable<HashAndUTF8Characters, HashAndUTF8CharactersTranslator>(buffer);
- return atomicString;
-}
-
-AtomicString AtomicString::fromUTF8(const char* characters)
-{
- if (!characters)
- return AtomicString();
-
- if (!*characters)
- return emptyAtom;
-
HashAndUTF8Characters buffer;
- buffer.characters = characters;
- buffer.hash = calculateStringHashAndLengthFromUTF8(characters, buffer.length, buffer.utf16Length);
+ buffer.characters = charactersStart;
+ buffer.hash = calculateStringHashAndLengthFromUTF8(charactersStart, charactersEnd, buffer.length, buffer.utf16Length);
if (!buffer.hash)
- return AtomicString();
+ return nullAtom;
AtomicString atomicString;
atomicString.m_string = addToStringTable<HashAndUTF8Characters, HashAndUTF8CharactersTranslator>(buffer);
diff --git a/Source/JavaScriptCore/wtf/text/AtomicString.h b/Source/JavaScriptCore/wtf/text/AtomicString.h
index 45a71e7..440700c 100644
--- a/Source/JavaScriptCore/wtf/text/AtomicString.h
+++ b/Source/JavaScriptCore/wtf/text/AtomicString.h
@@ -127,6 +127,7 @@ private:
return addSlowCase(r);
}
static PassRefPtr<StringImpl> addSlowCase(StringImpl*);
+ static AtomicString fromUTF8Internal(const char*, const char*);
};
inline bool operator==(const AtomicString& a, const AtomicString& b) { return a.impl() == b.impl(); }
@@ -154,20 +155,38 @@ inline bool equalIgnoringCase(const String& a, const AtomicString& b) { return e
// Define external global variables for the commonly used atomic strings.
// These are only usable from the main thread.
#ifndef ATOMICSTRING_HIDE_GLOBALS
- extern const JS_EXPORTDATA AtomicString nullAtom;
- extern const JS_EXPORTDATA AtomicString emptyAtom;
- extern const JS_EXPORTDATA AtomicString textAtom;
- extern const JS_EXPORTDATA AtomicString commentAtom;
- extern const JS_EXPORTDATA AtomicString starAtom;
- extern const JS_EXPORTDATA AtomicString xmlAtom;
- extern const JS_EXPORTDATA AtomicString xmlnsAtom;
+extern const JS_EXPORTDATA AtomicString nullAtom;
+extern const JS_EXPORTDATA AtomicString emptyAtom;
+extern const JS_EXPORTDATA AtomicString textAtom;
+extern const JS_EXPORTDATA AtomicString commentAtom;
+extern const JS_EXPORTDATA AtomicString starAtom;
+extern const JS_EXPORTDATA AtomicString xmlAtom;
+extern const JS_EXPORTDATA AtomicString xmlnsAtom;
+
+inline AtomicString AtomicString::fromUTF8(const char* characters, size_t length)
+{
+ if (!characters)
+ return nullAtom;
+ if (!length)
+ return emptyAtom;
+ return fromUTF8Internal(characters, characters + length);
+}
+
+inline AtomicString AtomicString::fromUTF8(const char* characters)
+{
+ if (!characters)
+ return nullAtom;
+ if (!*characters)
+ return emptyAtom;
+ return fromUTF8Internal(characters, 0);
+}
#endif
- // AtomicStringHash is the default hash for AtomicString
- template<typename T> struct DefaultHash;
- template<> struct DefaultHash<AtomicString> {
- typedef AtomicStringHash Hash;
- };
+// AtomicStringHash is the default hash for AtomicString
+template<typename T> struct DefaultHash;
+template<> struct DefaultHash<AtomicString> {
+ typedef AtomicStringHash Hash;
+};
} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/text/StringConcatenate.h b/Source/JavaScriptCore/wtf/text/StringConcatenate.h
index 7fa7d2c..8500200 100644
--- a/Source/JavaScriptCore/wtf/text/StringConcatenate.h
+++ b/Source/JavaScriptCore/wtf/text/StringConcatenate.h
@@ -204,7 +204,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2)
sumWithOverflow(length, adapter2.length(), overflow);
if (overflow)
return 0;
- PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
return 0;
@@ -213,7 +213,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2)
result += adapter1.length();
adapter2.writeTo(result);
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3>
@@ -230,7 +230,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
sumWithOverflow(length, adapter3.length(), overflow);
if (overflow)
return 0;
- PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
return 0;
@@ -241,7 +241,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
result += adapter2.length();
adapter3.writeTo(result);
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
@@ -260,7 +260,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
sumWithOverflow(length, adapter4.length(), overflow);
if (overflow)
return 0;
- PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
return 0;
@@ -273,7 +273,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
result += adapter3.length();
adapter4.writeTo(result);
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
@@ -294,7 +294,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
sumWithOverflow(length, adapter5.length(), overflow);
if (overflow)
return 0;
- PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
return 0;
@@ -309,7 +309,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
result += adapter4.length();
adapter5.writeTo(result);
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6>
@@ -332,7 +332,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
sumWithOverflow(length, adapter6.length(), overflow);
if (overflow)
return 0;
- PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
return 0;
@@ -349,7 +349,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
result += adapter5.length();
adapter6.writeTo(result);
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7>
@@ -374,7 +374,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
sumWithOverflow(length, adapter7.length(), overflow);
if (overflow)
return 0;
- PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
return 0;
@@ -393,7 +393,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
result += adapter6.length();
adapter7.writeTo(result);
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8>
@@ -420,7 +420,7 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
sumWithOverflow(length, adapter8.length(), overflow);
if (overflow)
return 0;
- PassRefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
if (!resultImpl)
return 0;
@@ -441,9 +441,62 @@ PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, S
result += adapter7.length();
adapter8.writeTo(result);
- return resultImpl;
+ return resultImpl.release();
}
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8, typename StringType9>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8, StringType9 string9)
+{
+ StringTypeAdapter<StringType1> adapter1(string1);
+ StringTypeAdapter<StringType2> adapter2(string2);
+ StringTypeAdapter<StringType3> adapter3(string3);
+ StringTypeAdapter<StringType4> adapter4(string4);
+ StringTypeAdapter<StringType5> adapter5(string5);
+ StringTypeAdapter<StringType6> adapter6(string6);
+ StringTypeAdapter<StringType7> adapter7(string7);
+ StringTypeAdapter<StringType8> adapter8(string8);
+ StringTypeAdapter<StringType9> adapter9(string9);
+
+ UChar* buffer;
+ bool overflow = false;
+ unsigned length = adapter1.length();
+ sumWithOverflow(length, adapter2.length(), overflow);
+ sumWithOverflow(length, adapter3.length(), overflow);
+ sumWithOverflow(length, adapter4.length(), overflow);
+ sumWithOverflow(length, adapter5.length(), overflow);
+ sumWithOverflow(length, adapter6.length(), overflow);
+ sumWithOverflow(length, adapter7.length(), overflow);
+ sumWithOverflow(length, adapter8.length(), overflow);
+ sumWithOverflow(length, adapter9.length(), overflow);
+ if (overflow)
+ return 0;
+ RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+ if (!resultImpl)
+ return 0;
+
+ UChar* result = buffer;
+ adapter1.writeTo(result);
+ result += adapter1.length();
+ adapter2.writeTo(result);
+ result += adapter2.length();
+ adapter3.writeTo(result);
+ result += adapter3.length();
+ adapter4.writeTo(result);
+ result += adapter4.length();
+ adapter5.writeTo(result);
+ result += adapter5.length();
+ adapter6.writeTo(result);
+ result += adapter6.length();
+ adapter7.writeTo(result);
+ result += adapter7.length();
+ adapter8.writeTo(result);
+ result += adapter8.length();
+ adapter9.writeTo(result);
+
+ return resultImpl.release();
+}
+
+
// Convenience only.
template<typename StringType1>
String makeString(StringType1 string1)
@@ -454,64 +507,73 @@ String makeString(StringType1 string1)
template<typename StringType1, typename StringType2>
String makeString(StringType1 string1, StringType2 string2)
{
- PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2);
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2);
if (!resultImpl)
CRASH();
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3>
String makeString(StringType1 string1, StringType2 string2, StringType3 string3)
{
- PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3);
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3);
if (!resultImpl)
CRASH();
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
{
- PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4);
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4);
if (!resultImpl)
CRASH();
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
{
- PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5);
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5);
if (!resultImpl)
CRASH();
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6>
String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6)
{
- PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6);
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6);
if (!resultImpl)
CRASH();
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7>
String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7)
{
- PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7);
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7);
if (!resultImpl)
CRASH();
- return resultImpl;
+ return resultImpl.release();
}
template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8>
String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8)
{
- PassRefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8);
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8);
+ if (!resultImpl)
+ CRASH();
+ return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8, typename StringType9>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8, StringType9 string9)
+{
+ RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7, string8, string9);
if (!resultImpl)
CRASH();
- return resultImpl;
+ return resultImpl.release();
}
} // namespace WTF
diff --git a/Source/JavaScriptCore/wtf/text/StringHash.h b/Source/JavaScriptCore/wtf/text/StringHash.h
index 80193a6..c47c1d8 100644
--- a/Source/JavaScriptCore/wtf/text/StringHash.h
+++ b/Source/JavaScriptCore/wtf/text/StringHash.h
@@ -179,11 +179,7 @@ namespace WTF {
}
};
- template<> struct HashTraits<String> : GenericHashTraits<String> {
- static const bool emptyValueIsZero = true;
- static void constructDeletedValue(String& slot) { new (&slot) String(HashTableDeletedValue); }
- static bool isDeletedValue(const String& slot) { return slot.isHashTableDeletedValue(); }
- };
+ template<> struct HashTraits<String> : SimpleClassHashTraits<String> { };
}
diff --git a/Source/JavaScriptCore/wtf/text/StringStatics.cpp b/Source/JavaScriptCore/wtf/text/StringStatics.cpp
index 5654044..ce08728 100644
--- a/Source/JavaScriptCore/wtf/text/StringStatics.cpp
+++ b/Source/JavaScriptCore/wtf/text/StringStatics.cpp
@@ -30,6 +30,7 @@
#endif
#include "AtomicString.h"
+#include "DynamicAnnotations.h"
#include "StaticConstructors.h"
#include "StringImpl.h"
@@ -46,6 +47,7 @@ StringImpl* StringImpl::empty()
// PCRE goes away.
static UChar emptyUCharData = 0;
DEFINE_STATIC_LOCAL(StringImpl, emptyString, (&emptyUCharData, 0, ConstructStaticString));
+ WTF_ANNOTATE_BENIGN_RACE(&emptyString, "Benign race on StringImpl::emptyString reference counter");
return &emptyString;
}
diff --git a/Source/JavaScriptCore/wtf/text/WTFString.h b/Source/JavaScriptCore/wtf/text/WTFString.h
index 713a6c3..b593d20 100644
--- a/Source/JavaScriptCore/wtf/text/WTFString.h
+++ b/Source/JavaScriptCore/wtf/text/WTFString.h
@@ -499,10 +499,7 @@ template<> struct DefaultHash<String> {
typedef StringHash Hash;
};
-template <> struct VectorTraits<String> : SimpleClassVectorTraits
-{
- static const bool canInitializeWithMemset = true;
-};
+template <> struct VectorTraits<String> : SimpleClassVectorTraits { };
}
diff --git a/Source/JavaScriptCore/wtf/unicode/CharacterNames.h b/Source/JavaScriptCore/wtf/unicode/CharacterNames.h
index 3d093a6..10fdbf0 100644
--- a/Source/JavaScriptCore/wtf/unicode/CharacterNames.h
+++ b/Source/JavaScriptCore/wtf/unicode/CharacterNames.h
@@ -85,6 +85,7 @@ const UChar yenSign = 0x00A5;
const UChar zeroWidthJoiner = 0x200D;
const UChar zeroWidthNonJoiner = 0x200C;
const UChar zeroWidthSpace = 0x200B;
+const UChar zeroWidthNoBreakSpace = 0xFEFF;
} // namespace Unicode
} // namespace WTF
@@ -138,5 +139,6 @@ using WTF::Unicode::yenSign;
using WTF::Unicode::zeroWidthJoiner;
using WTF::Unicode::zeroWidthNonJoiner;
using WTF::Unicode::zeroWidthSpace;
+using WTF::Unicode::zeroWidthNoBreakSpace;
#endif // CharacterNames_h
diff --git a/Source/JavaScriptCore/wtf/unicode/UTF8.cpp b/Source/JavaScriptCore/wtf/unicode/UTF8.cpp
index 6981fe4..3a88906 100644
--- a/Source/JavaScriptCore/wtf/unicode/UTF8.cpp
+++ b/Source/JavaScriptCore/wtf/unicode/UTF8.cpp
@@ -314,7 +314,7 @@ ConversionResult convertUTF8ToUTF16(
return result;
}
-static inline unsigned calculateStringHashAndLengthFromUTF8Internal(const char* data, const char* dataEnd, unsigned& dataLength, unsigned& utf16Length)
+unsigned calculateStringHashAndLengthFromUTF8(const char* data, const char* dataEnd, unsigned& dataLength, unsigned& utf16Length)
{
if (!data)
return 0;
@@ -365,17 +365,6 @@ static inline unsigned calculateStringHashAndLengthFromUTF8Internal(const char*
return stringHasher.hash();
}
-unsigned calculateStringHashFromUTF8(const char* data, const char* dataEnd, unsigned& utf16Length)
-{
- unsigned dataLength;
- return calculateStringHashAndLengthFromUTF8Internal(data, dataEnd, dataLength, utf16Length);
-}
-
-unsigned calculateStringHashAndLengthFromUTF8(const char* data, unsigned& dataLength, unsigned& utf16Length)
-{
- return calculateStringHashAndLengthFromUTF8Internal(data, 0, dataLength, utf16Length);
-}
-
bool equalUTF16WithUTF8(const UChar* a, const UChar* aEnd, const char* b, const char* bEnd)
{
while (b < bEnd) {
diff --git a/Source/JavaScriptCore/wtf/unicode/UTF8.h b/Source/JavaScriptCore/wtf/unicode/UTF8.h
index bbfaa84..7b7b75d 100644
--- a/Source/JavaScriptCore/wtf/unicode/UTF8.h
+++ b/Source/JavaScriptCore/wtf/unicode/UTF8.h
@@ -70,8 +70,7 @@ namespace Unicode {
const UChar** sourceStart, const UChar* sourceEnd,
char** targetStart, char* targetEnd, bool strict = true);
- unsigned calculateStringHashFromUTF8(const char* data, const char* dataEnd, unsigned& utf16Length);
- unsigned calculateStringHashAndLengthFromUTF8(const char* data, unsigned& dataLength, unsigned& utf16Length);
+ unsigned calculateStringHashAndLengthFromUTF8(const char* data, const char* dataEnd, unsigned& dataLength, unsigned& utf16Length);
bool equalUTF16WithUTF8(const UChar* a, const UChar* aEnd, const char* b, const char* bEnd);