diff options
Diffstat (limited to 'JavaScriptCore/wtf')
18 files changed, 138 insertions, 112 deletions
diff --git a/JavaScriptCore/wtf/FastMalloc.cpp b/JavaScriptCore/wtf/FastMalloc.cpp index 0f240ff..1e537b9 100644 --- a/JavaScriptCore/wtf/FastMalloc.cpp +++ b/JavaScriptCore/wtf/FastMalloc.cpp @@ -384,7 +384,8 @@ size_t fastMallocSize(const void* p) { #if OS(DARWIN) return malloc_size(p); -#elif COMPILER(MSVC) +#elif COMPILER(MSVC) && !PLATFORM(BREWMP) + // Brew MP uses its own memory allocator, so _msize does not work on the Brew MP simulator. return _msize(const_cast<void*>(p)); #else return 1; diff --git a/JavaScriptCore/wtf/OwnPtrCommon.h b/JavaScriptCore/wtf/OwnPtrCommon.h index 37c135d..19256ea 100644 --- a/JavaScriptCore/wtf/OwnPtrCommon.h +++ b/JavaScriptCore/wtf/OwnPtrCommon.h @@ -46,6 +46,8 @@ typedef struct _IFileMgr IFileMgr; typedef struct _IFile IFile; typedef struct IBitmap IBitmap; typedef struct ISSL ISSL; +typedef struct IMemGroup IMemGroup; +typedef struct IMemSpace IMemSpace; #endif namespace WTF { @@ -73,6 +75,8 @@ namespace WTF { void deleteOwnedPtr(IBitmap*); void deleteOwnedPtr(ISSL*); void deleteOwnedPtr(ISocket*); + void deleteOwnedPtr(IMemGroup*); + void deleteOwnedPtr(IMemSpace*); #endif } // namespace WTF diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h index e77fe98..30bc795 100644 --- a/JavaScriptCore/wtf/Platform.h +++ b/JavaScriptCore/wtf/Platform.h @@ -1057,6 +1057,10 @@ #define ENABLE_PAN_SCROLLING 1 #endif +#if !defined(ENABLE_SMOOTH_SCROLLING) +#define ENABLE_SMOOTH_SCROLLING 0 +#endif + /* Use the QXmlStreamReader implementation for XMLDocumentParser */ /* Use the QXmlQuery implementation for XSLTProcessor */ #if PLATFORM(QT) @@ -1123,7 +1127,7 @@ #define ENABLE_JSC_ZOMBIES 0 /* FIXME: Eventually we should enable this for all platforms and get rid of the define. */ -#if PLATFORM(MAC) || PLATFORM(WIN) +#if PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(QT) #define WTF_USE_PLATFORM_STRATEGIES 1 #endif diff --git a/JavaScriptCore/wtf/PlatformRefPtr.h b/JavaScriptCore/wtf/PlatformRefPtr.h index 2d05ac9..8ac16cb 100644 --- a/JavaScriptCore/wtf/PlatformRefPtr.h +++ b/JavaScriptCore/wtf/PlatformRefPtr.h @@ -24,6 +24,7 @@ #define PlatformRefPtr_h #include "AlwaysInline.h" +#include "RefPtr.h" #include <algorithm> namespace WTF { @@ -73,6 +74,10 @@ public: derefPlatformPtr(ptr); } + // Hash table deleted values, which are only constructed and never copied or destroyed. + PlatformRefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { } + bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); } + T* get() const { return m_ptr; } T& operator*() const { return *m_ptr; } ALWAYS_INLINE T* operator->() const { return m_ptr; } diff --git a/JavaScriptCore/wtf/TypeTraits.cpp b/JavaScriptCore/wtf/TypeTraits.cpp index 9e51ad0..a55019b 100644 --- a/JavaScriptCore/wtf/TypeTraits.cpp +++ b/JavaScriptCore/wtf/TypeTraits.cpp @@ -47,6 +47,11 @@ COMPILE_ASSERT(!IsInteger<volatile char*>::value, WTF_IsInteger_volatile_char_po COMPILE_ASSERT(!IsInteger<double>::value, WTF_IsInteger_double_false); COMPILE_ASSERT(!IsInteger<float>::value, WTF_IsInteger_float_false); +COMPILE_ASSERT(IsFloatingPoint<float>::value, WTF_IsFloatingPoint_float_true); +COMPILE_ASSERT(IsFloatingPoint<double>::value, WTF_IsFloatingPoint_double_true); +COMPILE_ASSERT(IsFloatingPoint<long double>::value, WTF_IsFloatingPoint_long_double_true); +COMPILE_ASSERT(!IsFloatingPoint<int>::value, WTF_IsFloatingPoint_int_false); + COMPILE_ASSERT(IsPod<bool>::value, WTF_IsPod_bool_true); COMPILE_ASSERT(IsPod<char>::value, WTF_IsPod_char_true); COMPILE_ASSERT(IsPod<signed char>::value, WTF_IsPod_signed_char_true); diff --git a/JavaScriptCore/wtf/TypeTraits.h b/JavaScriptCore/wtf/TypeTraits.h index 62dbc49..cf9b4af 100644 --- a/JavaScriptCore/wtf/TypeTraits.h +++ b/JavaScriptCore/wtf/TypeTraits.h @@ -62,12 +62,16 @@ namespace WTF { template<> struct IsInteger<wchar_t> { static const bool value = true; }; #endif + template<typename T> struct IsFloatingPoint { static const bool value = false; }; + template<> struct IsFloatingPoint<float> { static const bool value = true; }; + template<> struct IsFloatingPoint<double> { static const bool value = true; }; + template<> struct IsFloatingPoint<long double> { static const bool value = true; }; + + template<typename T> struct IsArithmetic { static const bool value = IsInteger<T>::value || IsFloatingPoint<T>::value; }; + // IsPod is misnamed as it doesn't cover all plain old data (pod) types. // Specifically, it doesn't allow for enums or for structs. - template <typename T> struct IsPod { static const bool value = IsInteger<T>::value; }; - template <> struct IsPod<float> { static const bool value = true; }; - template <> struct IsPod<double> { static const bool value = true; }; - template <> struct IsPod<long double> { static const bool value = true; }; + template <typename T> struct IsPod { static const bool value = IsArithmetic<T>::value; }; template <typename P> struct IsPod<P*> { static const bool value = true; }; template<typename T> class IsConvertibleToInteger { diff --git a/JavaScriptCore/wtf/WTFThreadData.h b/JavaScriptCore/wtf/WTFThreadData.h index 20ffaca..7f91e1a 100644 --- a/JavaScriptCore/wtf/WTFThreadData.h +++ b/JavaScriptCore/wtf/WTFThreadData.h @@ -59,7 +59,14 @@ public: template<typename U, typename V> std::pair<HashSet<StringImpl*>::iterator, bool> add(U value); - void remove(StringImpl* r) { m_table.remove(r); } + bool remove(StringImpl* r) + { + HashSet<StringImpl*>::iterator iter = m_table.find(r); + if (iter == m_table.end()) + return false; + m_table.remove(iter); + return true; + } LiteralIdentifierTable& literalTable() { return m_literalTable; } diff --git a/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp b/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp index 28046bd..ce10fc3 100644 --- a/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp +++ b/JavaScriptCore/wtf/brew/OwnPtrBrew.cpp @@ -28,6 +28,8 @@ #include <AEEBitmap.h> #include <AEEFile.h> +#include <AEEIMemGroup.h> +#include <AEEIMemSpace.h> #include <AEENet.h> #include <AEESSL.h> #include <AEEStdLib.h> @@ -58,6 +60,18 @@ void deleteOwnedPtr(ISSL* ptr) ISSL_Release(ptr); } +void deleteOwnedPtr(IMemGroup* ptr) +{ + if (ptr) + IMemGroup_Release(ptr); +} + +void deleteOwnedPtr(IMemSpace* ptr) +{ + if (ptr) + IMemSpace_Release(ptr); +} + void deleteOwnedPtr(ISocket* ptr) { if (ptr) diff --git a/JavaScriptCore/wtf/gobject/GTypedefs.h b/JavaScriptCore/wtf/gobject/GTypedefs.h index e79ba33..b1600c2 100644 --- a/JavaScriptCore/wtf/gobject/GTypedefs.h +++ b/JavaScriptCore/wtf/gobject/GTypedefs.h @@ -45,6 +45,7 @@ typedef struct _GdkCursor GdkCursor; typedef struct _GdkDragContext GdkDragContext; typedef struct _GdkDrawable GdkDrawable; typedef struct _GdkEventConfigure GdkEventConfigure; +typedef struct _GdkEventExpose GdkEventExpose; typedef struct _GdkPixbuf GdkPixbuf; typedef struct _GError GError; typedef struct _GFile GFile; @@ -79,6 +80,7 @@ typedef struct _GtkStyle GtkStyle; typedef struct _GtkTargetList GtkTargetList; typedef struct _GtkThemeParts GtkThemeParts; typedef struct _GtkWidget GtkWidget; +typedef struct _GtkWindow GtkWindow; #ifdef GTK_API_VERSION_2 typedef struct _GdkRectangle GdkRectangle; diff --git a/JavaScriptCore/wtf/text/StringImpl.cpp b/JavaScriptCore/wtf/text/StringImpl.cpp index a667525..7822c00 100644 --- a/JavaScriptCore/wtf/text/StringImpl.cpp +++ b/JavaScriptCore/wtf/text/StringImpl.cpp @@ -48,8 +48,10 @@ StringImpl::~StringImpl() if (isAtomic()) AtomicString::remove(this); #if USE(JSC) - if (isIdentifier()) - wtfThreadData().currentIdentifierTable()->remove(this); + if (isIdentifier()) { + if (!wtfThreadData().currentIdentifierTable()->remove(this)) + CRASH(); + } #endif BufferOwnership ownership = bufferOwnership(); diff --git a/JavaScriptCore/wtf/text/WTFString.h b/JavaScriptCore/wtf/text/WTFString.h index fafef12..8a4a6c7 100644 --- a/JavaScriptCore/wtf/text/WTFString.h +++ b/JavaScriptCore/wtf/text/WTFString.h @@ -53,6 +53,7 @@ class BString; namespace WTF { class CString; +struct StringHash; // Declarations of string operations @@ -72,6 +73,8 @@ intptr_t charactersToIntPtr(const UChar*, size_t, bool* ok = 0); // ignores trai double charactersToDouble(const UChar*, size_t, bool* ok = 0); float charactersToFloat(const UChar*, size_t, bool* ok = 0); +template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters(const UChar*, size_t); + class String { public: // Construct a null string, distinguishable from an empty string. @@ -220,6 +223,7 @@ public: String simplifyWhiteSpace() const; String removeCharacters(CharacterMatchFunctionPtr) const; + template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters() const; // Return the string with case folded for case insensitive comparison. String foldCase() const; @@ -423,7 +427,19 @@ inline void appendNumber(Vector<UChar>& vector, unsigned char number) } } -struct StringHash; +template<bool isSpecialCharacter(UChar)> inline bool isAllSpecialCharacters(const UChar* characters, size_t length) +{ + for (size_t i = 0; i < length; ++i) { + if (!isSpecialCharacter(characters[i])) + return false; + } + return true; +} + +template<bool isSpecialCharacter(UChar)> inline bool String::isAllSpecialCharacters() const +{ + return WTF::isAllSpecialCharacters<isSpecialCharacter>(characters(), length()); +} // StringHash is the default hash for String template<typename T> struct DefaultHash; @@ -440,17 +456,26 @@ template <> struct VectorTraits<String> : SimpleClassVectorTraits using WTF::CString; using WTF::String; - -using WTF::isSpaceOrNewline; -using WTF::find; -using WTF::reverseFind; using WTF::append; using WTF::appendNumber; -using WTF::equal; -using WTF::equalIgnoringCase; using WTF::charactersAreAllASCII; +using WTF::charactersToIntStrict; +using WTF::charactersToUIntStrict; +using WTF::charactersToInt64Strict; +using WTF::charactersToUInt64Strict; +using WTF::charactersToIntPtrStrict; using WTF::charactersToInt; -using WTF::charactersToFloat; +using WTF::charactersToUInt; +using WTF::charactersToInt64; +using WTF::charactersToUInt64; +using WTF::charactersToIntPtr; using WTF::charactersToDouble; +using WTF::charactersToFloat; +using WTF::equal; +using WTF::equalIgnoringCase; +using WTF::find; +using WTF::isAllSpecialCharacters; +using WTF::isSpaceOrNewline; +using WTF::reverseFind; #endif diff --git a/JavaScriptCore/wtf/unicode/Unicode.h b/JavaScriptCore/wtf/unicode/Unicode.h index d59439d..c755c6c 100644 --- a/JavaScriptCore/wtf/unicode/Unicode.h +++ b/JavaScriptCore/wtf/unicode/Unicode.h @@ -32,7 +32,7 @@ #elif USE(GLIB_UNICODE) #include <wtf/unicode/glib/UnicodeGLib.h> #elif USE(WINCE_UNICODE) -#include <wtf/unicode/wince/UnicodeWince.h> +#include <wtf/unicode/wince/UnicodeWinCE.h> #else #error "Unknown Unicode implementation" #endif diff --git a/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h b/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h index 1963576..f865ef1 100644 --- a/JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h +++ b/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h @@ -36,6 +36,7 @@ #define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) #define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) +#define U16_LENGTH(c) ((uint32_t)(c) <= 0xffff ? 1 : 2) #define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800) #define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) diff --git a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h index badab66..c9e2e1c 100644 --- a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h +++ b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h @@ -23,6 +23,8 @@ #ifndef WTF_UNICODE_QT4_H #define WTF_UNICODE_QT4_H +#include "UnicodeMacrosFromICU.h" + #include <QChar> #include <QString> @@ -63,49 +65,6 @@ typedef uint16_t UChar; #endif typedef uint32_t UChar32; -// some defines from ICU -// FIXME: This should use UnicodeMacrosFromICU.h instead! - -#define U_IS_BMP(c) ((UChar32)(c)<=0xffff) -#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) -#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) -#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000) -#define U16_GET_SUPPLEMENTARY(lead, trail) \ - (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET) - -#define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) -#define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) -#define U16_LENGTH(c) ((uint32_t)(c) <= 0xffff ? 1 : 2) - -#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800) -#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) -#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) -#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) - -#define U16_NEXT(s, i, length, c) { \ - (c)=(s)[(i)++]; \ - if(U16_IS_LEAD(c)) { \ - uint16_t __c2; \ - if((i)<(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \ - ++(i); \ - (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ - } \ - } \ -} - -#define U16_PREV(s, start, i, c) { \ - (c)=(s)[--(i)]; \ - if(U16_IS_TRAIL(c)) { \ - uint16_t __c2; \ - if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ - --(i); \ - (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ - } \ - } \ -} - -#define U_MASK(x) ((uint32_t)1<<(x)) - namespace WTF { namespace Unicode { diff --git a/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp b/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp index 42f0ff8..b52b05c 100644 --- a/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp +++ b/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp @@ -20,7 +20,7 @@ */ #include "config.h" -#include "UnicodeWince.h" +#include "UnicodeWinCE.h" #include <wchar.h> diff --git a/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h b/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h index 3866568..8cc9580 100644 --- a/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h +++ b/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h @@ -21,55 +21,15 @@ * */ -#ifndef UNICODE_WINCE_H -#define UNICODE_WINCE_H +#ifndef WTF_UnicodeWinCE_h +#define WTF_UnicodeWinCE_h + +#include "UnicodeMacrosFromICU.h" #include "ce_unicode.h" #define TO_MASK(x) (1 << (x)) -// some defines from ICU needed one or two places -// FIXME: This should use UnicodeMacrosFromICU.h instead! - -#define U_IS_BMP(c) ((UChar32)(c)<=0xffff) -#define U16_IS_LEAD(c) (((c) & 0xfffffc00) == 0xd800) -#define U16_IS_TRAIL(c) (((c) & 0xfffffc00) == 0xdc00) -#define U16_SURROGATE_OFFSET ((0xd800 << 10UL) + 0xdc00 - 0x10000) -#define U16_GET_SUPPLEMENTARY(lead, trail) \ - (((UChar32)(lead) << 10UL) + (UChar32)(trail) - U16_SURROGATE_OFFSET) - -#define U16_LEAD(supplementary) (UChar)(((supplementary) >> 10) + 0xd7c0) -#define U16_TRAIL(supplementary) (UChar)(((supplementary) & 0x3ff) | 0xdc00) -#define U16_LENGTH(c) ((uint32_t)(c) <= 0xffff ? 1 : 2) - -#define U_IS_SURROGATE(c) (((c) & 0xfffff800) == 0xd800) -#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) -#define U16_IS_SURROGATE_LEAD(c) (((c) & 0x400) == 0) - -#define U16_NEXT(s, i, length, c) { \ - (c)=(s)[(i)++]; \ - if (U16_IS_LEAD(c)) { \ - uint16_t __c2; \ - if ((i) < (length) && U16_IS_TRAIL(__c2 = (s)[(i)])) { \ - ++(i); \ - (c) = U16_GET_SUPPLEMENTARY((c), __c2); \ - } \ - } \ -} - -#define U16_PREV(s, start, i, c) { \ - (c)=(s)[--(i)]; \ - if (U16_IS_TRAIL(c)) { \ - uint16_t __c2; \ - if ((i) > (start) && U16_IS_LEAD(__c2 = (s)[(i) - 1])) { \ - --(i); \ - (c) = U16_GET_SUPPLEMENTARY(__c2, (c)); \ - } \ - } \ -} - -#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) - namespace WTF { namespace Unicode { @@ -216,5 +176,4 @@ namespace WTF { } // namespace WTF -#endif -// vim: ts=2 sw=2 et +#endif // WTF_UnicodeWinCE_h diff --git a/JavaScriptCore/wtf/wince/FastMallocWince.h b/JavaScriptCore/wtf/wince/FastMallocWinCE.h index 37174f0..d91a5f2 100644 --- a/JavaScriptCore/wtf/wince/FastMallocWince.h +++ b/JavaScriptCore/wtf/wince/FastMallocWinCE.h @@ -19,8 +19,8 @@ * */ -#ifndef FastMallocWince_h -#define FastMallocWince_h +#ifndef WTF_FastMallocWinCE_h +#define WTF_FastMallocWinCE_h #include <new.h> @@ -172,5 +172,4 @@ namespace WTF { #endif -#endif // FastMallocWince_h - +#endif // WTF_FastMallocWinCE_h diff --git a/JavaScriptCore/wtf/wtf.pri b/JavaScriptCore/wtf/wtf.pri new file mode 100644 index 0000000..84ac20e --- /dev/null +++ b/JavaScriptCore/wtf/wtf.pri @@ -0,0 +1,35 @@ +# wtf - qmake build info + +SOURCES += \ + wtf/Assertions.cpp \ + wtf/ByteArray.cpp \ + wtf/CurrentTime.cpp \ + wtf/DateMath.cpp \ + wtf/dtoa.cpp \ + wtf/FastMalloc.cpp \ + wtf/HashTable.cpp \ + wtf/MD5.cpp \ + wtf/MainThread.cpp \ + wtf/qt/MainThreadQt.cpp \ + wtf/qt/StringQt.cpp \ + wtf/qt/ThreadingQt.cpp \ + wtf/PageAllocation.cpp \ + wtf/RandomNumber.cpp \ + wtf/RefCountedLeakCounter.cpp \ + wtf/ThreadingNone.cpp \ + wtf/Threading.cpp \ + wtf/TypeTraits.cpp \ + wtf/WTFThreadData.cpp \ + wtf/text/AtomicString.cpp \ + wtf/text/CString.cpp \ + wtf/text/StringImpl.cpp \ + wtf/text/StringStatics.cpp \ + wtf/text/WTFString.cpp \ + wtf/unicode/CollatorDefault.cpp \ + wtf/unicode/icu/CollatorICU.cpp \ + wtf/unicode/UTF8.cpp + +!contains(DEFINES, USE_SYSTEM_MALLOC) { + SOURCES += wtf/TCSystemAlloc.cpp +} + |