summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/wtf
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2010-11-10 15:31:59 -0800
committerTeng-Hui Zhu <ztenghui@google.com>2010-11-17 13:35:59 -0800
commit28040489d744e0c5d475a88663056c9040ed5320 (patch)
treec463676791e4a63e452a95f0a12b2a8519730693 /JavaScriptCore/wtf
parenteff9be92c41913c92fb1d3b7983c071f3e718678 (diff)
downloadexternal_webkit-28040489d744e0c5d475a88663056c9040ed5320.zip
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.gz
external_webkit-28040489d744e0c5d475a88663056c9040ed5320.tar.bz2
Merge WebKit at r71558: Initial merge by git.
Change-Id: Ib345578fa29df7e4bc72b4f00e4a6fddcb754c4c
Diffstat (limited to 'JavaScriptCore/wtf')
-rw-r--r--JavaScriptCore/wtf/NullPtr.cpp33
-rw-r--r--JavaScriptCore/wtf/Platform.h3
-rw-r--r--JavaScriptCore/wtf/PlatformRefPtr.h9
-rw-r--r--JavaScriptCore/wtf/RandomNumberSeed.h9
-rw-r--r--JavaScriptCore/wtf/text/AtomicString.cpp8
-rw-r--r--JavaScriptCore/wtf/text/StringImpl.cpp2
-rw-r--r--JavaScriptCore/wtf/text/StringImpl.h4
7 files changed, 47 insertions, 21 deletions
diff --git a/JavaScriptCore/wtf/NullPtr.cpp b/JavaScriptCore/wtf/NullPtr.cpp
new file mode 100644
index 0000000..e7d94b2
--- /dev/null
+++ b/JavaScriptCore/wtf/NullPtr.cpp
@@ -0,0 +1,33 @@
+/*
+
+Copyright (C) 2010 Apple Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are 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.
+
+THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "NullPtr.h"
+
+#if !__has_feature(cxx_nullptr)
+
+std::nullptr_t nullptr;
+
+#endif
diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h
index 1877917..cb732f3 100644
--- a/JavaScriptCore/wtf/Platform.h
+++ b/JavaScriptCore/wtf/Platform.h
@@ -526,6 +526,7 @@
#define WTF_PLATFORM_CI 1
#define WTF_USE_ATSUI 1
#define WTF_USE_CORE_TEXT 1
+#define WTF_USE_ICCJPEG 1
#else
#define WTF_PLATFORM_SKIA 1
#endif
@@ -814,7 +815,7 @@
/* ENABLE macro defaults */
#if PLATFORM(QT)
-// We must not customize the global operator new and delete for the Qt port.
+/* We must not customize the global operator new and delete for the Qt port. */
#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
#endif
diff --git a/JavaScriptCore/wtf/PlatformRefPtr.h b/JavaScriptCore/wtf/PlatformRefPtr.h
index f99ec9b..8ac16cb 100644
--- a/JavaScriptCore/wtf/PlatformRefPtr.h
+++ b/JavaScriptCore/wtf/PlatformRefPtr.h
@@ -62,8 +62,7 @@ public:
~PlatformRefPtr()
{
- T* ptr = m_ptr;
- if (ptr && ptr != hashTableDeletedValue())
+ if (T* ptr = m_ptr)
derefPlatformPtr(ptr);
}
@@ -71,7 +70,7 @@ public:
{
T* ptr = m_ptr;
m_ptr = 0;
- if (ptr && ptr != hashTableDeletedValue())
+ if (ptr)
derefPlatformPtr(ptr);
}
@@ -111,7 +110,7 @@ template <typename T> inline PlatformRefPtr<T>& PlatformRefPtr<T>::operator=(con
refPlatformPtr(optr);
T* ptr = m_ptr;
m_ptr = optr;
- if (ptr && ptr != hashTableDeletedValue())
+ if (ptr)
derefPlatformPtr(ptr);
return *this;
}
@@ -122,7 +121,7 @@ template <typename T> inline PlatformRefPtr<T>& PlatformRefPtr<T>::operator=(T*
if (optr)
refPlatformPtr(optr);
m_ptr = optr;
- if (ptr && ptr != hashTableDeletedValue())
+ if (ptr)
derefPlatformPtr(ptr);
return *this;
}
diff --git a/JavaScriptCore/wtf/RandomNumberSeed.h b/JavaScriptCore/wtf/RandomNumberSeed.h
index 1f1c00e..b53b506 100644
--- a/JavaScriptCore/wtf/RandomNumberSeed.h
+++ b/JavaScriptCore/wtf/RandomNumberSeed.h
@@ -76,15 +76,6 @@ inline void initializeRandomNumberGenerator()
#endif
}
-inline void initializeWeakRandomNumberGenerator()
-{
-#if COMPILER(MSVC) && defined(_CRT_RAND_S)
- // We need to initialise windows rand() explicitly for Math.random
- unsigned seed = 0;
- rand_s(&seed);
- srand(seed);
-#endif
-}
}
#endif
diff --git a/JavaScriptCore/wtf/text/AtomicString.cpp b/JavaScriptCore/wtf/text/AtomicString.cpp
index c8140d6..c49a837 100644
--- a/JavaScriptCore/wtf/text/AtomicString.cpp
+++ b/JavaScriptCore/wtf/text/AtomicString.cpp
@@ -90,7 +90,7 @@ struct CStringTranslator {
static void translate(StringImpl*& location, const char* const& c, unsigned hash)
{
- location = StringImpl::create(c).releaseRef();
+ location = StringImpl::create(c).leakRef();
location->setHash(hash);
location->setIsAtomic(true);
}
@@ -174,7 +174,7 @@ struct UCharBufferTranslator {
static void translate(StringImpl*& location, const UCharBuffer& buf, unsigned hash)
{
- location = StringImpl::create(buf.s, buf.length).releaseRef();
+ location = StringImpl::create(buf.s, buf.length).leakRef();
location->setHash(hash);
location->setIsAtomic(true);
}
@@ -200,7 +200,7 @@ struct HashAndCharactersTranslator {
static void translate(StringImpl*& location, const HashAndCharacters& buffer, unsigned hash)
{
- location = StringImpl::create(buffer.characters, buffer.length).releaseRef();
+ location = StringImpl::create(buffer.characters, buffer.length).leakRef();
location->setHash(hash);
location->setIsAtomic(true);
}
@@ -295,6 +295,8 @@ AtomicString AtomicString::lower() const
{
// Note: This is a hot function in the Dromaeo benchmark.
StringImpl* impl = this->impl();
+ if (UNLIKELY(!impl))
+ return *this;
RefPtr<StringImpl> newImpl = impl->lower();
if (LIKELY(newImpl == impl))
return *this;
diff --git a/JavaScriptCore/wtf/text/StringImpl.cpp b/JavaScriptCore/wtf/text/StringImpl.cpp
index e1e08ee..f4b2f05 100644
--- a/JavaScriptCore/wtf/text/StringImpl.cpp
+++ b/JavaScriptCore/wtf/text/StringImpl.cpp
@@ -144,7 +144,7 @@ SharedUChar* StringImpl::sharedBuffer()
return m_substringBuffer->sharedBuffer();
if (ownership == BufferOwned) {
ASSERT(!m_sharedBuffer);
- m_sharedBuffer = SharedUChar::create(new SharableUChar(m_data)).releaseRef();
+ m_sharedBuffer = SharedUChar::create(new SharableUChar(m_data)).leakRef();
m_refCountAndFlags = (m_refCountAndFlags & ~s_refCountMaskBufferOwnership) | BufferShared;
}
diff --git a/JavaScriptCore/wtf/text/StringImpl.h b/JavaScriptCore/wtf/text/StringImpl.h
index 897751d..8f0af52 100644
--- a/JavaScriptCore/wtf/text/StringImpl.h
+++ b/JavaScriptCore/wtf/text/StringImpl.h
@@ -110,7 +110,7 @@ private:
StringImpl(const UChar* characters, unsigned length, PassRefPtr<StringImpl> base)
: StringImplBase(length, BufferSubstring)
, m_data(characters)
- , m_substringBuffer(base.releaseRef())
+ , m_substringBuffer(base.leakRef())
, m_hash(0)
{
ASSERT(m_data);
@@ -122,7 +122,7 @@ private:
StringImpl(const UChar* characters, unsigned length, PassRefPtr<SharedUChar> sharedBuffer)
: StringImplBase(length, BufferShared)
, m_data(characters)
- , m_sharedBuffer(sharedBuffer.releaseRef())
+ , m_sharedBuffer(sharedBuffer.leakRef())
, m_hash(0)
{
ASSERT(m_data);