summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/JavaScriptCore/wtf
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/wtf')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp22
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp20
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h11
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp25
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Locker.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h11
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/OwnArrayPtr.h6
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/OwnFastMallocPtr.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtr.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h104
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp10
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h16
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h19
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h8
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp20
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Collator.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp10
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h177
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.cpp171
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.h80
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/wince/mt19937ar.c170
30 files changed, 836 insertions, 76 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp
index 098186e64..819ed9a15 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -45,6 +46,10 @@
#include <crtdbg.h>
#endif
+#if PLATFORM(WINCE)
+#include <winbase.h>
+#endif
+
extern "C" {
WTF_ATTRIBUTE_PRINTF(1, 0)
@@ -66,7 +71,7 @@ static void vprintf_stderr_common(const char* format, va_list args)
CFRelease(str);
CFRelease(cfFormat);
} else
-#elif COMPILER(MSVC) && !PLATFORM(WINCE)
+#elif COMPILER(MSVC) && !defined(WINCEBASIC)
if (IsDebuggerPresent()) {
size_t size = 1024;
@@ -77,7 +82,20 @@ static void vprintf_stderr_common(const char* format, va_list args)
break;
if (_vsnprintf(buffer, size, format, args) != -1) {
+#if PLATFORM(WINCE)
+ // WinCE only supports wide chars
+ wchar_t* wideBuffer = (wchar_t*)malloc(size * sizeof(wchar_t));
+ if (wideBuffer == NULL)
+ break;
+ for (unsigned int i = 0; i < size; ++i) {
+ if (!(wideBuffer[i] = buffer[i]))
+ break;
+ }
+ OutputDebugStringW(wideBuffer);
+ free(wideBuffer);
+#else
OutputDebugStringA(buffer);
+#endif
free(buffer);
break;
}
@@ -101,7 +119,7 @@ static void printf_stderr_common(const char* format, ...)
static void printCallSite(const char* file, int line, const char* function)
{
-#if PLATFORM(WIN) && defined _DEBUG
+#if PLATFORM(WIN) && !PLATFORM(WINCE) && defined _DEBUG
_CrtDbgReport(_CRT_WARN, file, line, NULL, "%s\n", function);
#else
printf_stderr_common("(%s:%d %s)\n", file, line, function);
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h
index ad66d067e..59efd8421 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h
@@ -136,8 +136,8 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann
#undef ERROR
#endif
-#if PLATFORM(WIN_OS)
-/* FIXME: Change to use something other than ASSERT to avoid this conflict with win32. */
+#if PLATFORM(WIN_OS) || PLATFORM(SYMBIAN)
+/* FIXME: Change to use something other than ASSERT to avoid this conflict with the underlying platform */
#undef ASSERT
#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h
index 33f0877f0..96e9cc20f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h
@@ -26,8 +26,8 @@
#ifndef ByteArray_h
#define ByteArray_h
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
namespace WTF {
class ByteArray : public RefCountedBase {
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h b/src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h
index 281dfa606..6a0521121 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h
@@ -51,7 +51,7 @@ namespace WTF {
// with respect to the original and any other copies. The underlying m_data is jointly
// owned by the original instance and all copies.
template<class T>
- class CrossThreadRefCounted : Noncopyable {
+ class CrossThreadRefCounted : public Noncopyable {
public:
static PassRefPtr<CrossThreadRefCounted<T> > create(T* data)
{
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp
index 47c9d4415..0b766496b 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp
@@ -2,6 +2,7 @@
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
@@ -375,14 +376,19 @@ static int32_t calculateUTCOffset()
localt.tm_wday = 0;
localt.tm_yday = 0;
localt.tm_isdst = 0;
-#if PLATFORM(WIN_OS) || PLATFORM(SOLARIS) || COMPILER(RVCT)
+#if HAVE(TM_GMTOFF)
+ localt.tm_gmtoff = 0;
+#endif
+#if HAVE(TM_ZONE)
+ localt.tm_zone = 0;
+#endif
+
+#if HAVE(TIMEGM)
+ time_t utcOffset = timegm(&localt) - mktime(&localt);
+#else
// Using a canned date of 01/01/2009 on platforms with weaker date-handling foo.
localt.tm_year = 109;
time_t utcOffset = 1230768000 - mktime(&localt);
-#else
- localt.tm_zone = 0;
- localt.tm_gmtoff = 0;
- time_t utcOffset = timegm(&localt) - mktime(&localt);
#endif
return static_cast<int32_t>(utcOffset * 1000);
@@ -512,7 +518,7 @@ void msToGregorianDateTime(double ms, bool outputIsUTC, GregorianDateTime& tm)
tm.year = year - 1900;
tm.isDST = dstOff != 0.0;
- tm.utcOffset = static_cast<long>((dstOff + utcOff) / msPerSecond);
+ tm.utcOffset = outputIsUTC ? 0 : static_cast<long>((dstOff + utcOff) / msPerSecond);
tm.timeZone = NULL;
}
@@ -835,7 +841,7 @@ double parseDateFromNullTerminatedCharacters(const char* dateString)
return NaN;
int sgn = (o < 0) ? -1 : 1;
- o = abs(o);
+ o = labs(o);
if (*dateString != ':') {
offset = ((o / 100) * 60 + (o % 100)) * sgn;
} else { // GMT+05:00
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h
index 8690a4981..6110f766a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.h
@@ -109,14 +109,17 @@ struct GregorianDateTime : Noncopyable {
, year(inTm.tm_year)
, isDST(inTm.tm_isdst)
{
-#if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !COMPILER(RVCT)
+#if HAVE(TM_GMTOFF)
utcOffset = static_cast<int>(inTm.tm_gmtoff);
+#else
+ utcOffset = static_cast<int>(getUTCOffset() / msPerSecond + (isDST ? secondsPerHour : 0));
+#endif
+#if HAVE(TM_ZONE)
int inZoneSize = strlen(inTm.tm_zone) + 1;
timeZone = new char[inZoneSize];
strncpy(timeZone, inTm.tm_zone, inZoneSize);
#else
- utcOffset = static_cast<int>(getUTCOffset() / msPerSecond + (isDST ? secondsPerHour : 0));
timeZone = 0;
#endif
}
@@ -136,8 +139,10 @@ struct GregorianDateTime : Noncopyable {
ret.tm_year = year;
ret.tm_isdst = isDST;
-#if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !COMPILER(RVCT)
+#if HAVE(TM_GMTOFF)
ret.tm_gmtoff = static_cast<long>(utcOffset);
+#endif
+#if HAVE(TM_ZONE)
ret.tm_zone = timeZone;
#endif
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h b/src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h
index 1c8185677..9fcbbc1c4 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h
@@ -79,9 +79,9 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include "Assertions.h"
#include "FastMalloc.h"
#include "TypeTraits.h"
-#include <wtf/Assertions.h>
namespace WTF {
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp
index d6850e6fc..c855a41a4 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp
@@ -95,8 +95,6 @@
#define FORCE_SYSTEM_MALLOC 1
#endif
-#define TCMALLOC_TRACK_DECOMMITED_SPANS (HAVE(VIRTUALALLOC) || HAVE(MADV_FREE_REUSE))
-
#ifndef NDEBUG
namespace WTF {
@@ -1043,11 +1041,7 @@ struct Span {
#endif
};
-#if TCMALLOC_TRACK_DECOMMITED_SPANS
#define ASSERT_SPAN_COMMITTED(span) ASSERT(!span->decommitted)
-#else
-#define ASSERT_SPAN_COMMITTED(span)
-#endif
#ifdef SPAN_HISTORY
void Event(Span* span, char op, int v = 0) {
@@ -1369,12 +1363,10 @@ inline Span* TCMalloc_PageHeap::New(Length n) {
Span* result = ll->next;
Carve(result, n, released);
-#if TCMALLOC_TRACK_DECOMMITED_SPANS
if (result->decommitted) {
TCMalloc_SystemCommit(reinterpret_cast<void*>(result->start << kPageShift), static_cast<size_t>(n << kPageShift));
result->decommitted = false;
}
-#endif
ASSERT(Check());
free_pages_ -= n;
return result;
@@ -1431,12 +1423,10 @@ Span* TCMalloc_PageHeap::AllocLarge(Length n) {
if (best != NULL) {
Carve(best, n, from_released);
-#if TCMALLOC_TRACK_DECOMMITED_SPANS
if (best->decommitted) {
TCMalloc_SystemCommit(reinterpret_cast<void*>(best->start << kPageShift), static_cast<size_t>(n << kPageShift));
best->decommitted = false;
}
-#endif
ASSERT(Check());
free_pages_ -= n;
return best;
@@ -1461,14 +1451,10 @@ Span* TCMalloc_PageHeap::Split(Span* span, Length n) {
return leftover;
}
-#if !TCMALLOC_TRACK_DECOMMITED_SPANS
-static ALWAYS_INLINE void propagateDecommittedState(Span*, Span*) { }
-#else
static ALWAYS_INLINE void propagateDecommittedState(Span* destination, Span* source)
{
destination->decommitted = source->decommitted;
}
-#endif
inline void TCMalloc_PageHeap::Carve(Span* span, Length n, bool released) {
ASSERT(n > 0);
@@ -1495,9 +1481,6 @@ inline void TCMalloc_PageHeap::Carve(Span* span, Length n, bool released) {
}
}
-#if !TCMALLOC_TRACK_DECOMMITED_SPANS
-static ALWAYS_INLINE void mergeDecommittedStates(Span*, Span*) { }
-#else
static ALWAYS_INLINE void mergeDecommittedStates(Span* destination, Span* other)
{
if (destination->decommitted && !other->decommitted) {
@@ -1509,7 +1492,6 @@ static ALWAYS_INLINE void mergeDecommittedStates(Span* destination, Span* other)
destination->decommitted = true;
}
}
-#endif
inline void TCMalloc_PageHeap::Delete(Span* span) {
ASSERT(Check());
@@ -1556,15 +1538,12 @@ inline void TCMalloc_PageHeap::Delete(Span* span) {
Event(span, 'D', span->length);
span->free = 1;
-#if TCMALLOC_TRACK_DECOMMITED_SPANS
if (span->decommitted) {
if (span->length < kMaxPages)
DLL_Prepend(&free_[span->length].returned, span);
else
DLL_Prepend(&large_.returned, span);
- } else
-#endif
- {
+ } else {
if (span->length < kMaxPages)
DLL_Prepend(&free_[span->length].normal, span);
else
@@ -1596,9 +1575,7 @@ void TCMalloc_PageHeap::IncrementalScavenge(Length n) {
DLL_Remove(s);
TCMalloc_SystemRelease(reinterpret_cast<void*>(s->start << kPageShift),
static_cast<size_t>(s->length << kPageShift));
-#if TCMALLOC_TRACK_DECOMMITED_SPANS
s->decommitted = true;
-#endif
DLL_Prepend(&slist->returned, s);
scavenge_counter_ = std::max<size_t>(64UL, std::min<size_t>(kDefaultReleaseDelay, kDefaultReleaseDelay - (free_pages_ / kDefaultReleaseDelay)));
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h
index 8d03ff224..499334852 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/GOwnPtr.h
@@ -37,7 +37,7 @@ namespace WTF {
template<> void freeOwnedGPtr<GDir>(GDir*);
template<> void freeOwnedGPtr<GHashTable>(GHashTable*);
- template <typename T> class GOwnPtr : Noncopyable {
+ template <typename T> class GOwnPtr : public Noncopyable {
public:
explicit GOwnPtr(T* ptr = 0) : m_ptr(ptr) { }
~GOwnPtr() { freeOwnedGPtr(m_ptr); }
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Locker.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Locker.h
index 9feec1f3f..41813d3f9 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Locker.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Locker.h
@@ -32,7 +32,7 @@
namespace WTF {
-template <typename T> class Locker : Noncopyable {
+template <typename T> class Locker : public Noncopyable {
public:
Locker(T& lockable) : m_lockable(lockable) { m_lockable.lock(); }
~Locker() { m_lockable.unlock(); }
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h
index 7721dba51..12291cc31 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h
@@ -45,7 +45,7 @@ namespace WTF {
};
template<typename DataType>
- class MessageQueue : Noncopyable {
+ class MessageQueue : public Noncopyable {
public:
MessageQueue() : m_killed(false) { }
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h
index f241c7c98..c50c9d8d5 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h
@@ -24,6 +24,8 @@
// We don't want argument-dependent lookup to pull in everything from the WTF
// namespace when you use Noncopyable, so put it in its own namespace.
+#include "FastAllocBase.h"
+
namespace WTFNoncopyable {
class Noncopyable {
@@ -34,8 +36,17 @@ namespace WTFNoncopyable {
~Noncopyable() { }
};
+ class NoncopyableCustomAllocated {
+ NoncopyableCustomAllocated(const NoncopyableCustomAllocated&);
+ NoncopyableCustomAllocated& operator=(const NoncopyableCustomAllocated&);
+ protected:
+ NoncopyableCustomAllocated() { }
+ ~NoncopyableCustomAllocated() { }
+ };
+
} // namespace WTFNoncopyable
using WTFNoncopyable::Noncopyable;
+using WTFNoncopyable::NoncopyableCustomAllocated;
#endif // WTF_Noncopyable_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnArrayPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnArrayPtr.h
index 344f813f2..61375c769 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnArrayPtr.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnArrayPtr.h
@@ -27,7 +27,7 @@
namespace WTF {
- template <typename T> class OwnArrayPtr : Noncopyable {
+ template <typename T> class OwnArrayPtr : public Noncopyable {
public:
explicit OwnArrayPtr(T* ptr = 0) : m_ptr(ptr) { }
~OwnArrayPtr() { safeDelete(); }
@@ -46,8 +46,12 @@ namespace WTF {
bool operator!() const { return !m_ptr; }
// This conversion operator allows implicit conversion to bool but not to other integer types.
+#if COMPILER(WINSCW)
+ operator bool() const { return m_ptr; }
+#else
typedef T* OwnArrayPtr::*UnspecifiedBoolType;
operator UnspecifiedBoolType() const { return m_ptr ? &OwnArrayPtr::m_ptr : 0; }
+#endif
void swap(OwnArrayPtr& o) { std::swap(m_ptr, o.m_ptr); }
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnFastMallocPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnFastMallocPtr.h
index 5c0d0647b..c88235a8a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnFastMallocPtr.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnFastMallocPtr.h
@@ -27,7 +27,7 @@
namespace WTF {
- template<class T> class OwnFastMallocPtr : Noncopyable {
+ template<class T> class OwnFastMallocPtr : public Noncopyable {
public:
explicit OwnFastMallocPtr(T* ptr) : m_ptr(ptr)
{
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtr.h
index 9e4bd32ae..b7e62b1ea 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtr.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/OwnPtr.h
@@ -34,7 +34,7 @@ namespace WTF {
template <typename T> class PassOwnPtr;
- template <typename T> class OwnPtr : Noncopyable {
+ template <typename T> class OwnPtr : public Noncopyable {
public:
typedef typename RemovePointer<T>::Type ValueType;
typedef ValueType* PtrType;
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
index 5e37e09b6..c7a5be902 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -93,12 +94,10 @@
#define WTF_PLATFORM_SOLARIS 1
#endif
-#if defined (__S60__) || defined (__SYMBIAN32__)
+#if 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
@@ -110,17 +109,25 @@
#define WTF_PLATFORM_NETBSD 1
#endif
+/* PLATFORM(QNX) */
+/* Operating system level dependencies for QNX that should be used */
+/* regardless of operating environment */
+#if defined(__QNXNTO__)
+#define WTF_PLATFORM_QNX 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(SYMBIAN) \
|| PLATFORM(NETBSD) \
|| defined(unix) \
|| defined(__unix) \
|| defined(__unix__) \
- || defined(_AIX)
+ || defined(_AIX) \
+ || defined(__QNXNTO__)
#define WTF_PLATFORM_UNIX 1
#endif
@@ -191,7 +198,7 @@
/* Makes PLATFORM(WIN) default to PLATFORM(CAIRO) */
/* FIXME: This should be changed from a blacklist to a whitelist */
-#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM)
+#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !PLATFORM(WINCE)
#define WTF_PLATFORM_CAIRO 1
#endif
@@ -311,6 +318,7 @@
/* --gnu option of the RVCT compiler also defines __GNUC__ */
#if defined(__GNUC__) && !COMPILER(RVCT)
#define WTF_COMPILER_GCC 1
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
/* COMPILER(MINGW) */
@@ -339,11 +347,36 @@
#define ENABLE_JSC_MULTIPLE_THREADS 1
#endif
+#if PLATFORM(WINCE) && !PLATFORM(QT)
+#undef ENABLE_JSC_MULTIPLE_THREADS
+#define ENABLE_JSC_MULTIPLE_THREADS 0
+#define USE_SYSTEM_MALLOC 0
+#define ENABLE_ICONDATABASE 0
+#define ENABLE_JAVASCRIPT_DEBUGGER 0
+#define ENABLE_FTPDIR 0
+#define ENABLE_PAN_SCROLLING 0
+#define ENABLE_WML 1
+#define HAVE_ACCESSIBILITY 0
+
+#define NOMINMAX // Windows min and max conflict with standard macros
+#define NOSHLWAPI // shlwapi.h not available on WinCe
+
+// MSDN documentation says these functions are provided with uspce.lib. But we cannot find this file.
+#define __usp10__ // disable "usp10.h"
+
+#define _INC_ASSERT // disable "assert.h"
+#define assert(x)
+
+// _countof is only included in CE6; for CE5 we need to define it ourself
+#ifndef _countof
+#define _countof(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
+#endif /* PLATFORM(WINCE) && !PLATFORM(QT) */
+
/* for Unicode, KDE uses Qt */
#if PLATFORM(KDE) || PLATFORM(QT)
#define WTF_USE_QT4_UNICODE 1
-#elif PLATFORM(SYMBIAN)
-#define WTF_USE_SYMBIAN_UNICODE 1
#elif PLATFORM(GTK)
/* The GTK+ Unicode backend is configurable */
#else
@@ -406,6 +439,13 @@
#define HAVE_SIGNAL_H 1
#endif
+#if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(QNX) \
+ && !PLATFORM(SYMBIAN) && !COMPILER(RVCT)
+#define HAVE_TM_GMTOFF 1
+#define HAVE_TM_ZONE 1
+#define HAVE_TIMEGM 1
+#endif
+
#if PLATFORM(DARWIN)
#define HAVE_ERRNO_H 1
@@ -450,6 +490,15 @@
#define HAVE_SYS_PARAM_H 1
#endif
+#elif PLATFORM(QNX)
+
+#define HAVE_ERRNO_H 1
+#define HAVE_MMAP 1
+#define HAVE_SBRK 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_TIME_H 1
+
#else
/* FIXME: is this actually used or do other platforms generate their own config.h? */
@@ -536,6 +585,7 @@
#endif
#if !defined(ENABLE_JIT)
+
/* The JIT is tested & working on x86_64 Mac */
#if PLATFORM(X86_64) && PLATFORM(MAC)
#define ENABLE_JIT 1
@@ -551,7 +601,21 @@
#elif PLATFORM(X86) && PLATFORM(WIN)
#define ENABLE_JIT 1
#endif
+
+#if PLATFORM(X86) && PLATFORM(QT)
+#if PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100
+ #define ENABLE_JIT 1
+ #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
+#elif PLATFORM(WIN_OS) && COMPILER(MSVC)
+ #define ENABLE_JIT 1
+ #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
+#elif PLATFORM(LINUX) && GCC_VERSION >= 40100
+ #define ENABLE_JIT 1
+ #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
#endif
+#endif /* PLATFORM(QT) && PLATFORM(X86) */
+
+#endif /* !defined(ENABLE_JIT) */
#if ENABLE(JIT)
#ifndef ENABLE_JIT_OPTIMIZE_CALL
@@ -590,15 +654,29 @@
#endif
/* Yet Another Regex Runtime. */
+#if !defined(ENABLE_YARR_JIT)
+
/* YARR supports x86 & x86-64, and has been tested on Mac and Windows. */
-#if (!defined(ENABLE_YARR_JIT) && PLATFORM(X86) && PLATFORM(MAC)) \
- || (!defined(ENABLE_YARR_JIT) && PLATFORM(X86_64) && PLATFORM(MAC)) \
+#if (PLATFORM(X86) && PLATFORM(MAC)) \
+ || (PLATFORM(X86_64) && PLATFORM(MAC)) \
/* Under development, temporarily disabled until 16Mb link range limit in assembler is fixed. */ \
- || (!defined(ENABLE_YARR_JIT) && PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE) && 0) \
- || (!defined(ENABLE_YARR_JIT) && PLATFORM(X86) && PLATFORM(WIN))
+ || (PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE) && 0) \
+ || (PLATFORM(X86) && PLATFORM(WIN))
#define ENABLE_YARR 1
#define ENABLE_YARR_JIT 1
#endif
+
+#if PLATFORM(X86) && PLATFORM(QT)
+#if (PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \
+ || (PLATFORM(WIN_OS) && COMPILER(MSVC)) \
+ || (PLATFORM(LINUX) && GCC_VERSION >= 40100)
+#define ENABLE_YARR 1
+#define ENABLE_YARR_JIT 1
+#endif
+#endif
+
+#endif /* !defined(ENABLE_YARR_JIT) */
+
/* Sanity Check */
#if ENABLE(YARR_JIT) && !ENABLE(YARR)
#error "YARR_JIT requires YARR"
@@ -609,7 +687,7 @@
#endif
/* Setting this flag prevents the assembler from using RWX memory; this may improve
security but currectly comes at a significant performance cost. */
-#if PLATFORM_ARM_ARCH(7) && PLATFORM(IPHONE)
+#if PLATFORM(ARM)
#define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1
#else
#define ENABLE_ASSEMBLER_WX_EXCLUSIVE 0
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp
index c94d5a4b9..0e6e20830 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumber.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
- * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -34,6 +34,12 @@
#include <stdint.h>
#include <stdlib.h>
+#if PLATFORM(WINCE)
+extern "C" {
+#include "wince/mt19937ar.c"
+}
+#endif
+
namespace WTF {
double weakRandomNumber()
@@ -74,6 +80,8 @@ double randomNumber()
// Mask off the low 53bits
fullRandom &= (1LL << 53) - 1;
return static_cast<double>(fullRandom)/static_cast<double>(1LL << 53);
+#elif PLATFORM(WINCE)
+ return genrand_res53();
#else
uint32_t part1 = rand() & (RAND_MAX - 1);
uint32_t part2 = rand() & (RAND_MAX - 1);
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h
index 32291ddfb..1c2d364ed 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RandomNumberSeed.h
@@ -39,6 +39,9 @@
#endif
#if PLATFORM(WINCE)
+extern "C" {
+void init_by_array(unsigned long init_key[],int key_length);
+}
#include <ce_time.h>
#endif
@@ -49,8 +52,19 @@ inline void initializeRandomNumberGenerator()
{
#if PLATFORM(DARWIN)
// On Darwin we use arc4random which initialises itself.
+#elif PLATFORM(WINCE)
+ // initialize rand()
+ srand(static_cast<unsigned>(time(0)));
+
+ // use rand() to initialize the real RNG
+ unsigned long initializationBuffer[4];
+ initializationBuffer[0] = (rand() << 16) | rand();
+ initializationBuffer[1] = (rand() << 16) | rand();
+ initializationBuffer[2] = (rand() << 16) | rand();
+ initializationBuffer[3] = (rand() << 16) | rand();
+ init_by_array(initializationBuffer, 4);
#elif COMPILER(MSVC) && defined(_CRT_RAND_S)
- // On Windows we use rand_s which intialises itself
+ // On Windows we use rand_s which initialises itself
#elif PLATFORM(UNIX)
// srandomdev is not guaranteed to exist on linux so we use this poor seed, this should be improved
timeval time;
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h
index c174145dc..761a8566f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RefCounted.h
@@ -29,7 +29,7 @@ namespace WTF {
// This base class holds the non-template methods and attributes.
// The RefCounted class inherits from it reducing the template bloat
// generated by the compiler (technique called template hoisting).
-class RefCountedBase : Noncopyable {
+class RefCountedBase {
public:
void ref()
{
@@ -101,7 +101,7 @@ private:
};
-template<class T> class RefCounted : public RefCountedBase {
+template<class T> class RefCounted : public RefCountedBase, public Noncopyable {
public:
void deref()
{
@@ -115,8 +115,23 @@ protected:
}
};
+template<class T> class RefCountedCustomAllocated : public RefCountedBase, public NoncopyableCustomAllocated {
+public:
+ void deref()
+ {
+ if (derefBase())
+ delete static_cast<T*>(this);
+ }
+
+protected:
+ ~RefCountedCustomAllocated()
+ {
+ }
+};
+
} // namespace WTF
using WTF::RefCounted;
+using WTF::RefCountedCustomAllocated;
#endif // RefCounted_h
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h
index b07a9a21e..4d5d2f751 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h
@@ -59,7 +59,7 @@ namespace WTF {
void ThreadSpecificThreadExit();
#endif
-template<typename T> class ThreadSpecific : Noncopyable {
+template<typename T> class ThreadSpecific : public Noncopyable {
public:
ThreadSpecific();
T* operator->();
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp
index bd25ee749..56bf43814 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.cpp
@@ -30,7 +30,7 @@
namespace WTF {
-struct NewThreadContext {
+struct NewThreadContext : FastAllocBase {
NewThreadContext(ThreadFunction entryPoint, void* data, const char* name)
: entryPoint(entryPoint)
, data(data)
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h
index b12f41fa7..65781516f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h
@@ -159,7 +159,7 @@ typedef void* PlatformReadWriteLock;
typedef void* PlatformCondition;
#endif
-class Mutex : Noncopyable {
+class Mutex : public Noncopyable {
public:
Mutex();
~Mutex();
@@ -176,7 +176,7 @@ private:
typedef Locker<Mutex> MutexLocker;
-class ReadWriteLock : Noncopyable {
+class ReadWriteLock : public Noncopyable {
public:
ReadWriteLock();
~ReadWriteLock();
@@ -193,7 +193,7 @@ private:
PlatformReadWriteLock m_readWriteLock;
};
-class ThreadCondition : Noncopyable {
+class ThreadCondition : public Noncopyable {
public:
ThreadCondition();
~ThreadCondition();
@@ -234,7 +234,7 @@ inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_
#endif
-class ThreadSafeSharedBase : Noncopyable {
+class ThreadSafeSharedBase : public Noncopyable {
public:
ThreadSafeSharedBase(int initialRefCount = 1)
: m_refCount(initialRefCount)
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp
index ea186564b..cccbda14e 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingWin.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -89,7 +90,14 @@
#if !USE(PTHREADS) && PLATFORM(WIN_OS)
#include "ThreadSpecific.h"
#endif
+#if !PLATFORM(WINCE)
#include <process.h>
+#endif
+#if HAVE(ERRNO_H)
+#include <errno.h>
+#else
+#define NO_ERRNO
+#endif
#include <windows.h>
#include <wtf/CurrentTime.h>
#include <wtf/HashMap.h>
@@ -210,9 +218,21 @@ ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, con
unsigned threadIdentifier = 0;
ThreadIdentifier threadID = 0;
ThreadFunctionInvocation* invocation = new ThreadFunctionInvocation(entryPoint, data);
+#if PLATFORM(WINCE)
+ // This is safe on WINCE, since CRT is in the core and innately multithreaded.
+ // On desktop Windows, need to use _beginthreadex (not available on WinCE) if using any CRT functions
+ HANDLE threadHandle = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)wtfThreadEntryPoint, invocation, 0, (LPDWORD)&threadIdentifier);
+#else
HANDLE threadHandle = reinterpret_cast<HANDLE>(_beginthreadex(0, 0, wtfThreadEntryPoint, invocation, 0, &threadIdentifier));
+#endif
if (!threadHandle) {
+#if PLATFORM(WINCE)
+ LOG_ERROR("Failed to create thread at entry point %p with data %p: %ld", entryPoint, data, ::GetLastError());
+#elif defined(NO_ERRNO)
+ LOG_ERROR("Failed to create thread at entry point %p with data %p.", entryPoint, data);
+#else
LOG_ERROR("Failed to create thread at entry point %p with data %p: %ld", entryPoint, data, errno);
+#endif
return 0;
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
index c378fd058..7cba4e48a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
@@ -268,7 +268,7 @@ namespace WTF {
};
template<typename T>
- class VectorBufferBase : Noncopyable {
+ class VectorBufferBase : public Noncopyable {
public:
void allocateBuffer(size_t newCapacity)
{
@@ -934,7 +934,7 @@ namespace WTF {
inline void Vector<T, inlineCapacity>::remove(size_t position, size_t length)
{
ASSERT(position < size());
- ASSERT(position + length < size());
+ ASSERT(position + length <= size());
T* beginSpot = begin() + position;
T* endSpot = beginSpot + length;
TypeOperations::destruct(beginSpot, endSpot);
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Collator.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Collator.h
index f04779dd7..51e8a063f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Collator.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Collator.h
@@ -39,7 +39,7 @@ struct UCollator;
namespace WTF {
- class Collator : Noncopyable {
+ class Collator : public Noncopyable {
public:
enum Result { Equal = 0, Greater = 1, Less = -1 };
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp
index 79dec79d2..6376bb31f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp
@@ -37,6 +37,7 @@
#include <string.h>
#if PLATFORM(DARWIN)
+#include "RetainPtr.h"
#include <CoreFoundation/CoreFoundation.h>
#endif
@@ -60,11 +61,16 @@ std::auto_ptr<Collator> Collator::userDefault()
{
#if PLATFORM(DARWIN) && PLATFORM(CF)
// Mac OS X doesn't set UNIX locale to match user-selected one, so ICU default doesn't work.
- CFStringRef collationOrder = (CFStringRef)CFPreferencesCopyValue(CFSTR("AppleCollationOrder"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE)
+ RetainPtr<CFLocaleRef> currentLocale(AdoptCF, CFLocaleCopyCurrent());
+ CFStringRef collationOrder = (CFStringRef)CFLocaleGetValue(currentLocale.get(), kCFLocaleCollatorIdentifier);
+#else
+ RetainPtr<CFStringRef> collationOrderRetainer(AdoptCF, (CFStringRef)CFPreferencesCopyValue(CFSTR("AppleCollationOrder"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost));
+ CFStringRef collationOrder = collationOrderRetainer.get();
+#endif
char buf[256];
if (collationOrder) {
CFStringGetCString(collationOrder, buf, sizeof(buf), kCFStringEncodingASCII);
- CFRelease(collationOrder);
return std::auto_ptr<Collator>(new Collator(buf));
} else
return std::auto_ptr<Collator>(new Collator(""));
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h
new file mode 100644
index 000000000..93d9f7595
--- /dev/null
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/FastMallocWince.h
@@ -0,0 +1,177 @@
+/*
+ * This file is part of the KDE libraries
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, 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 FastMallocWince_h
+#define FastMallocWince_h
+
+#include <new.h>
+
+#ifdef __cplusplus
+#include <new>
+#include "MemoryManager.h"
+extern "C" {
+#endif
+
+void* fastMalloc(size_t n);
+void* fastCalloc(size_t n_elements, size_t element_size);
+void fastFree(void* p);
+void* fastRealloc(void* p, size_t n);
+void* fastZeroedMalloc(size_t n);
+// These functions return 0 if an allocation fails.
+void* tryFastMalloc(size_t n);
+void* tryFastZeroedMalloc(size_t n);
+void* tryFastCalloc(size_t n_elements, size_t element_size);
+void* tryFastRealloc(void* p, size_t n);
+char* fastStrDup(const char*);
+
+#ifndef NDEBUG
+void fastMallocForbid();
+void fastMallocAllow();
+#endif
+
+#if !defined(USE_SYSTEM_MALLOC) || !USE_SYSTEM_MALLOC
+
+#define malloc(n) fastMalloc(n)
+#define calloc(n_elements, element_size) fastCalloc(n_elements, element_size)
+#define realloc(p, n) fastRealloc(p, n)
+#define free(p) fastFree(p)
+#define strdup(p) fastStrDup(p)
+
+#else
+
+#define strdup(p) _strdup(p)
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+#if !defined(USE_SYSTEM_MALLOC) || !USE_SYSTEM_MALLOC
+static inline void* __cdecl operator new(size_t s) { return fastMalloc(s); }
+static inline void __cdecl operator delete(void* p) { fastFree(p); }
+static inline void* __cdecl operator new[](size_t s) { return fastMalloc(s); }
+static inline void __cdecl operator delete[](void* p) { fastFree(p); }
+static inline void* operator new(size_t s, const std::nothrow_t&) throw() { return fastMalloc(s); }
+static inline void operator delete(void* p, const std::nothrow_t&) throw() { fastFree(p); }
+static inline void* operator new[](size_t s, const std::nothrow_t&) throw() { return fastMalloc(s); }
+static inline void operator delete[](void* p, const std::nothrow_t&) throw() { fastFree(p); }
+#endif
+
+namespace WTF {
+ // This defines a type which holds an unsigned integer and is the same
+ // size as the minimally aligned memory allocation.
+ typedef unsigned long long AllocAlignmentInteger;
+
+ namespace Internal {
+ enum AllocType { // Start with an unusual number instead of zero, because zero is common.
+ AllocTypeMalloc = 0x375d6750, // Encompasses fastMalloc, fastZeroedMalloc, fastCalloc, fastRealloc.
+ AllocTypeClassNew, // Encompasses class operator new from FastAllocBase.
+ AllocTypeClassNewArray, // Encompasses class operator new[] from FastAllocBase.
+ AllocTypeFastNew, // Encompasses fastNew.
+ AllocTypeFastNewArray, // Encompasses fastNewArray.
+ AllocTypeNew, // Encompasses global operator new.
+ AllocTypeNewArray // Encompasses global operator new[].
+ };
+ }
+
+
+#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
+
+ // Malloc validation is a scheme whereby a tag is attached to an
+ // allocation which identifies how it was originally allocated.
+ // This allows us to verify that the freeing operation matches the
+ // allocation operation. If memory is allocated with operator new[]
+ // but freed with free or delete, this system would detect that.
+ // In the implementation here, the tag is an integer prepended to
+ // the allocation memory which is assigned one of the AllocType
+ // enumeration values. An alternative implementation of this
+ // scheme could store the tag somewhere else or ignore it.
+ // Users of FastMalloc don't need to know or care how this tagging
+ // is implemented.
+
+ namespace Internal {
+
+ // Return the AllocType tag associated with the allocated block p.
+ inline AllocType fastMallocMatchValidationType(const void* p)
+ {
+ const AllocAlignmentInteger* type = static_cast<const AllocAlignmentInteger*>(p) - 1;
+ return static_cast<AllocType>(*type);
+ }
+
+ // Return the address of the AllocType tag associated with the allocated block p.
+ inline AllocAlignmentInteger* fastMallocMatchValidationValue(void* p)
+ {
+ return reinterpret_cast<AllocAlignmentInteger*>(static_cast<char*>(p) - sizeof(AllocAlignmentInteger));
+ }
+
+ // Set the AllocType tag to be associaged with the allocated block p.
+ inline void setFastMallocMatchValidationType(void* p, AllocType allocType)
+ {
+ AllocAlignmentInteger* type = static_cast<AllocAlignmentInteger*>(p) - 1;
+ *type = static_cast<AllocAlignmentInteger>(allocType);
+ }
+
+ // Handle a detected alloc/free mismatch. By default this calls CRASH().
+ void fastMallocMatchFailed(void* p);
+
+ } // namespace Internal
+
+ // This is a higher level function which is used by FastMalloc-using code.
+ inline void fastMallocMatchValidateMalloc(void* p, Internal::AllocType allocType)
+ {
+ if (!p)
+ return;
+
+ Internal::setFastMallocMatchValidationType(p, allocType);
+ }
+
+ // This is a higher level function which is used by FastMalloc-using code.
+ inline void fastMallocMatchValidateFree(void* p, Internal::AllocType allocType)
+ {
+ if (!p)
+ return;
+
+ if (Internal::fastMallocMatchValidationType(p) != allocType)
+ Internal::fastMallocMatchFailed(p);
+ Internal::setFastMallocMatchValidationType(p, Internal::AllocTypeMalloc); // Set it to this so that fastFree thinks it's OK.
+ }
+
+#else
+
+ inline void fastMallocMatchValidateMalloc(void*, Internal::AllocType)
+ {
+ }
+
+ inline void fastMallocMatchValidateFree(void*, Internal::AllocType)
+ {
+ }
+
+#endif
+
+} // namespace WTF
+
+#endif
+
+#endif // FastMallocWince_h
+
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.cpp
new file mode 100644
index 000000000..b65b36823
--- /dev/null
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.cpp
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2008-2009 Torch Mobile Inc.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "MemoryManager.h"
+
+#undef malloc
+#undef calloc
+#undef realloc
+#undef free
+#undef strdup
+#undef _strdup
+#undef VirtualAlloc
+#undef VirtualFree
+
+#include <malloc.h>
+#include <windows.h>
+
+namespace WTF {
+
+MemoryManager* memoryManager()
+{
+ static MemoryManager mm;
+ return &mm;
+}
+
+MemoryManager::MemoryManager()
+: m_allocationCanFail(false)
+{
+}
+
+MemoryManager::~MemoryManager()
+{
+}
+
+HBITMAP MemoryManager::createCompatibleBitmap(HDC hdc, int width, int height)
+{
+ return ::CreateCompatibleBitmap(hdc, width, height);
+}
+
+HBITMAP MemoryManager::createDIBSection(const BITMAPINFO* pbmi, void** ppvBits)
+{
+ return ::CreateDIBSection(0, pbmi, DIB_RGB_COLORS, ppvBits, 0, 0);
+}
+
+void* MemoryManager::m_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+void* MemoryManager::m_calloc(size_t num, size_t size)
+{
+ return calloc(num, size);
+}
+
+void* MemoryManager::m_realloc(void* p, size_t size)
+{
+ return realloc(p, size);
+}
+
+void MemoryManager::m_free(void* p)
+{
+ return free(p);
+}
+
+bool MemoryManager::resizeMemory(void*, size_t)
+{
+ return false;
+}
+
+void* MemoryManager::allocate64kBlock()
+{
+ return VirtualAlloc(0, 65536, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
+}
+
+void MemoryManager::free64kBlock(void* p)
+{
+ VirtualFree(p, 65536, MEM_RELEASE);
+}
+
+bool MemoryManager::onIdle(DWORD& timeLimitMs)
+{
+ return false;
+}
+
+LPVOID MemoryManager::virtualAlloc(LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect)
+{
+ return ::VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
+}
+
+BOOL MemoryManager::virtualFree(LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType)
+{
+ return ::VirtualFree(lpAddress, dwSize, dwFreeType);
+}
+
+
+#if defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC
+
+void *fastMalloc(size_t n) { return malloc(n); }
+void *fastCalloc(size_t n_elements, size_t element_size) { return calloc(n_elements, element_size); }
+void fastFree(void* p) { return free(p); }
+void *fastRealloc(void* p, size_t n) { return realloc(p, n); }
+
+#else
+
+void *fastMalloc(size_t n) { return MemoryManager::m_malloc(n); }
+void *fastCalloc(size_t n_elements, size_t element_size) { return MemoryManager::m_calloc(n_elements, element_size); }
+void fastFree(void* p) { return MemoryManager::m_free(p); }
+void *fastRealloc(void* p, size_t n) { return MemoryManager::m_realloc(p, n); }
+
+#endif
+
+#ifndef NDEBUG
+void fastMallocForbid() {}
+void fastMallocAllow() {}
+#endif
+
+void* fastZeroedMalloc(size_t n)
+{
+ void* p = fastMalloc(n);
+ if (p)
+ memset(p, 0, n);
+ return p;
+}
+
+void* tryFastMalloc(size_t n)
+{
+ MemoryAllocationCanFail canFail;
+ return fastMalloc(n);
+}
+
+void* tryFastZeroedMalloc(size_t n)
+{
+ MemoryAllocationCanFail canFail;
+ return fastZeroedMalloc(n);
+}
+
+void* tryFastCalloc(size_t n_elements, size_t element_size)
+{
+ MemoryAllocationCanFail canFail;
+ return fastCalloc(n_elements, element_size);
+}
+
+void* tryFastRealloc(void* p, size_t n)
+{
+ MemoryAllocationCanFail canFail;
+ return fastRealloc(p, n);
+}
+
+char* fastStrDup(const char* str)
+{
+ return _strdup(str);
+}
+
+} \ No newline at end of file
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.h b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.h
new file mode 100644
index 000000000..f405612df
--- /dev/null
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/MemoryManager.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2008-2009 Torch Mobile Inc.
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include <winbase.h>
+
+typedef struct HBITMAP__* HBITMAP;
+typedef struct HDC__* HDC;
+typedef void *HANDLE;
+typedef struct tagBITMAPINFO BITMAPINFO;
+
+namespace WTF {
+
+ class MemoryManager {
+ public:
+ MemoryManager();
+ ~MemoryManager();
+
+ bool allocationCanFail() const { return m_allocationCanFail; }
+ void setAllocationCanFail(bool c) { m_allocationCanFail = c; }
+
+ static HBITMAP createCompatibleBitmap(HDC hdc, int width, int height);
+ static HBITMAP createDIBSection(const BITMAPINFO* pbmi, void** ppvBits);
+ static void* m_malloc(size_t size);
+ static void* m_calloc(size_t num, size_t size);
+ static void* m_realloc(void* p, size_t size);
+ static void m_free(void*);
+ static bool resizeMemory(void* p, size_t newSize);
+ static void* allocate64kBlock();
+ static void free64kBlock(void*);
+ static bool onIdle(DWORD& timeLimitMs);
+ static LPVOID virtualAlloc(LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect);
+ static BOOL virtualFree(LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType);
+
+ private:
+ friend MemoryManager* memoryManager();
+
+ bool m_allocationCanFail;
+ };
+
+ MemoryManager* memoryManager();
+
+ class MemoryAllocationCanFail {
+ public:
+ MemoryAllocationCanFail() : m_old(memoryManager()->allocationCanFail()) { memoryManager()->setAllocationCanFail(true); }
+ ~MemoryAllocationCanFail() { memoryManager()->setAllocationCanFail(m_old); }
+ private:
+ bool m_old;
+ };
+
+ class MemoryAllocationCannotFail {
+ public:
+ MemoryAllocationCannotFail() : m_old(memoryManager()->allocationCanFail()) { memoryManager()->setAllocationCanFail(false); }
+ ~MemoryAllocationCannotFail() { memoryManager()->setAllocationCanFail(m_old); }
+ private:
+ bool m_old;
+ };
+}
+
+using WTF::MemoryManager;
+using WTF::memoryManager;
+using WTF::MemoryAllocationCanFail;
+using WTF::MemoryAllocationCannotFail;
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/wince/mt19937ar.c b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/mt19937ar.c
new file mode 100644
index 000000000..4715958d1
--- /dev/null
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/wince/mt19937ar.c
@@ -0,0 +1,170 @@
+/*
+ A C-program for MT19937, with initialization improved 2002/1/26.
+ Coded by Takuji Nishimura and Makoto Matsumoto.
+
+ Before using, initialize the state by using init_genrand(seed)
+ or init_by_array(init_key, key_length).
+
+ Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The names of its contributors may not 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.
+
+
+ Any feedback is very welcome.
+ http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
+ email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
+*/
+
+#include <stdio.h>
+
+/* Period parameters */
+#define N 624
+#define M 397
+#define MATRIX_A 0x9908b0dfUL /* constant vector a */
+#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
+#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
+
+static unsigned long mt[N]; /* the array for the state vector */
+static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */
+
+/* initializes mt[N] with a seed */
+void init_genrand(unsigned long s)
+{
+ mt[0]= s & 0xffffffffUL;
+ for (mti=1; mti<N; mti++) {
+ mt[mti] = (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
+ /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
+ /* In the previous versions, MSBs of the seed affect */
+ /* only MSBs of the array mt[]. */
+ /* 2002/01/09 modified by Makoto Matsumoto */
+ mt[mti] &= 0xffffffffUL;
+ /* for >32 bit machines */
+ }
+}
+
+/* initialize by an array with array-length */
+/* init_key is the array for initializing keys */
+/* key_length is its length */
+/* slight change for C++, 2004/2/26 */
+void init_by_array(unsigned long init_key[],int key_length)
+{
+ int i, j, k;
+ init_genrand(19650218UL);
+ i=1; j=0;
+ k = (N>key_length ? N : key_length);
+ for (; k; k--) {
+ mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL))
+ + init_key[j] + j; /* non linear */
+ mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
+ i++; j++;
+ if (i>=N) { mt[0] = mt[N-1]; i=1; }
+ if (j>=key_length) j=0;
+ }
+ for (k=N-1; k; k--) {
+ mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL))
+ - i; /* non linear */
+ mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
+ i++;
+ if (i>=N) { mt[0] = mt[N-1]; i=1; }
+ }
+
+ mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
+}
+
+/* generates a random number on [0,0xffffffff]-interval */
+unsigned long genrand_int32(void)
+{
+ unsigned long y;
+ static unsigned long mag01[2]={0x0UL, MATRIX_A};
+ /* mag01[x] = x * MATRIX_A for x=0,1 */
+
+ if (mti >= N) { /* generate N words at one time */
+ int kk;
+
+ if (mti == N+1) /* if init_genrand() has not been called, */
+ init_genrand(5489UL); /* a default initial seed is used */
+
+ for (kk=0;kk<N-M;kk++) {
+ y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
+ mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1UL];
+ }
+ for (;kk<N-1;kk++) {
+ y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
+ mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
+ }
+ y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
+ mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
+
+ mti = 0;
+ }
+
+ y = mt[mti++];
+
+ /* Tempering */
+ y ^= (y >> 11);
+ y ^= (y << 7) & 0x9d2c5680UL;
+ y ^= (y << 15) & 0xefc60000UL;
+ y ^= (y >> 18);
+
+ return y;
+}
+
+/* generates a random number on [0,0x7fffffff]-interval */
+long genrand_int31(void)
+{
+ return (long)(genrand_int32()>>1);
+}
+
+/* generates a random number on [0,1]-real-interval */
+double genrand_real1(void)
+{
+ return genrand_int32()*(1.0/4294967295.0);
+ /* divided by 2^32-1 */
+}
+
+/* generates a random number on [0,1)-real-interval */
+double genrand_real2(void)
+{
+ return genrand_int32()*(1.0/4294967296.0);
+ /* divided by 2^32 */
+}
+
+/* generates a random number on (0,1)-real-interval */
+double genrand_real3(void)
+{
+ return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0);
+ /* divided by 2^32 */
+}
+
+/* generates a random number on [0,1) with 53-bit resolution*/
+double genrand_res53(void)
+{
+ unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
+ return(a*67108864.0+b)*(1.0/9007199254740992.0);
+}