Merge from Chromium at DEPS revision r167172

This commit was generated by merge_to_master.py.

Change-Id: Iead6b4948cd90f0aac77a0e5e2b6c1749577569b
diff --git a/Source/WTF/CMakeLists.txt b/Source/WTF/CMakeLists.txt
new file mode 100644
index 0000000..c383a2b
--- /dev/null
+++ b/Source/WTF/CMakeLists.txt
@@ -0,0 +1 @@
+ADD_SUBDIRECTORY(wtf)
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
new file mode 100644
index 0000000..e11fdc3
--- /dev/null
+++ b/Source/WTF/ChangeLog
@@ -0,0 +1,11747 @@
+2012-11-11  Kenichi Ishibashi  <bashi@chromium.org>
+
+        WTFString::utf8() should have a mode of conversion to use replacement character
+        https://bugs.webkit.org/show_bug.cgi?id=101678
+
+        Reviewed by Alexander Pavlov.
+
+        Introduce conversion mode to String::utf8().
+        There are three conversion modes; lenient mode, strict mode, and
+        "replacing unpaired surrogates with the replacement character" (replacement) mode.
+        Lenient mode converts unpaired surrogates. Strict mode fails when there is an unpaired
+        surrogates and returns CString(). Replacement mode replaces unpaired surrogates with
+        the replacement character(U+FFFD). Replacement mode implements the algorithm defined at
+        http://dev.w3.org/2006/webapi/WebIDL/#dfn-obtain-unicode. WebSocket::send() requires
+        this algorithm to encode a string to utf-8.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::utf8): Changed to take ConversionMode as the argument.
+        * wtf/text/WTFString.h:
+        (String):
+
+2012-11-09  Alexei Filippov  <alph@chromium.org>
+
+        Web Inspector: Fix heap snapshots counted several times by NMI
+        https://bugs.webkit.org/show_bug.cgi?id=101085
+
+        The fix moves snapshots size counting to V8PerIsolateData class. As long
+        as it has one instance per isolate its reportMemoryUsage should be
+        called once per isolate.
+
+        Reviewed by Yury Semikhatsky.
+
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryClassInfo::addPrivateBuffer):
+
+2012-11-08  Michael Saboff  <msaboff@apple.com>
+
+        HashAndUTF8CharactersTranslator should create an 8 bit string if possible
+        https://bugs.webkit.org/show_bug.cgi?id=101515
+
+        Reviewed by Darin Adler.
+
+        Added isAllASCII flag that's passed to convertUTF8ToUTF16().  If on return it is true, create an
+        8 bit string, otherwise use the 16 bit string.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::HashAndUTF8CharactersTranslator::translate):
+
+2012-11-08  Simon Hausmann  <simon.hausmann@digia.com>
+
+        [Qt] Fix build with MSVC 2012 and Angle
+        https://bugs.webkit.org/show_bug.cgi?id=101588
+
+        Reviewed by Tor Arne Vestbø.
+
+        Angle includes STL's <memory> header file, which with MSVC 2012 includes stdint.h. MSVC 2012
+        does ship stdint.h, but it's lacking other headers such as inttypes.h.
+
+        So for the rest of WebKit we have to continue to use our own versions of these files from
+        JavaScriptCore/os-win32. But for Angle we are just including a shipped STL header file (memory)
+        and so it's up to the compiler to make that work, i.e. using the stdint.h it ships.
+
+        This patch moves the addition of JavaScriptCore/os-win32 out of default_post.prf, so that it
+        doesn't apply to each and every target anymore. In particular it won't apply to Angle anymore,
+        because its presence causes a build issue where due to the addition of os-win32/ we end up
+        including our own stdint.h but are lacking WTF/ to be in the include search path (which our own
+        stdint.h requires). So out of default_post.prf and into WTF.pri, our own wrappers are now only
+        used where WTF is also needed, and since os-win32/stdint.h depends on wtf/Platform.h, it seems
+        like a logical location.
+
+        * WTF.pri:
+
+2012-11-07  Hans Wennborg  <hans@chromium.org>
+
+        Fix asm operand type for weakCompareAndSwap on ARM_THUMB2
+        https://bugs.webkit.org/show_bug.cgi?id=101238
+
+        Reviewed by Benjamin Poulain.
+
+        'result' was a bool, but the asm was expecting a 32-bit register. A
+        recent version of Clang warned about this:
+
+          WebKit/Source/WTF/wtf/Atomics.h:163:34: error: the size being stored
+          is truncated, use a modifier to specify the size [-Werror,-Wasm-operand-widths]
+
+        This patch fixes it by making 'result' an unsigned. It does not change
+        the functionality in practice ('result' would be in a 32-bit register
+        anyway), but it makes the code more correct and makes the warning go
+        away.
+
+        Also make 'result' for the X86 version an 'unsigned char' to make it
+        more clear that it is a byte.
+
+        * wtf/Atomics.h:
+        (WTF::weakCompareAndSwap):
+
+2012-11-07  Remy Demarest  <rdemarest@apple.com>
+
+        Function adoptNS and adoptCF should not generate memory leak diagnostic with Clang Static Analyzer.
+        https://bugs.webkit.org/show_bug.cgi?id=101420
+
+        Reviewed by Benjamin Poulain.
+
+        Add attributes to the adoptNS and adoptCF function arguments to remove Clang Static Analyzer diagnotics.
+        Define CF_RELEASES_ARGUMENT and NS_RELEASES_ARGUMENT if not available, use them in function declarations.
+
+        * wtf/RetainPtr.h:
+        (WTF::adoptCF): Adds CF_RELEASES_ARGUMENT attribute to the argument.
+        (WTF::adoptNS): Adds NS_RELEASES_ARGUMENT attribute to the argument.
+
+2012-11-07  Christophe Dumez  <christophe.dumez@intel.com>
+
+        Add replaceWithLiteral() method to WTF::String
+        https://bugs.webkit.org/show_bug.cgi?id=101257
+
+        Reviewed by Benjamin Poulain.
+
+        Add replaceWithLiteral() method to WTF::String that takes
+        replacement string as a literal to avoid uselessly constructing
+        a String object.
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::replace):
+        (WTF):
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::replace):
+        (StringImpl):
+        * wtf/text/WTFString.h:
+        (String):
+        (WTF::String::replaceWithLiteral):
+
+2012-11-06  Michael Saboff  <msaboff@apple.com>
+
+        StringBuilder::append(UChar) with an 8 bit quantity shouldn't change the contents to 16 bits
+        https://bugs.webkit.org/show_bug.cgi?id=101421
+
+        Reviewed by Anders Carlsson.
+
+        If the string builder contains only 8 bit data, check if the character being appended contains
+        8 bit data.  If so, append it to the 8 bit buffer instead of converting the buffer to 16 bits.
+
+        * wtf/text/StringBuilder.cpp:
+        (WTF::StringBuilder::append):
+        * wtf/text/StringBuilder.h:
+        (WTF::StringBuilder::append):
+
+2012-11-06  Benjamin Poulain  <benjamin@webkit.org>
+
+        Speed up TransformationMatrix::multiply() on modern ARM
+        https://bugs.webkit.org/show_bug.cgi?id=101084
+
+        Reviewed by Gavin Barraclough.
+
+        * wtf/Platform.h:
+        Add CPU(ARM_VFP) for detecting VFP availability.
+        Add CPU(APPLE_ARMV7S) for the Apple ARMv7S architecture.
+
+2012-11-06  Laszlo Gombos  <l.gombos@samsung.com>
+
+        Refactor setting TEXTURE_MAPPER_GL
+        https://bugs.webkit.org/show_bug.cgi?id=99758
+
+        Reviewed by Noam Rosenthal.
+
+        Make the rule that sets the default for USE(3D_GRAPHICS) port independent.
+
+        If not set, set USE(TEXTURE_MAPPER_GL) when USE(TEXTURE_MAPPER) and 
+        USE(3D_GRAPHICS) is enabled.
+
+        * wtf/Platform.h:
+
+2012-11-05  Philip Rogers  <pdr@google.com>
+
+        Unblock SVG external references
+        https://bugs.webkit.org/show_bug.cgi?id=100635
+
+        Reviewed by Adam Barth.
+
+        This patch reverts r132849 and r132869 because the potential XSS issue
+        turned out to not be an issue after all.
+
+        Covered by existing tests, many of which are re-whitelisted with this patch.
+
+        * wtf/Platform.h:
+
+2012-11-05  Dima Gorbik  <dgorbik@apple.com>
+
+        Back out controversial changes from Bug 98665.
+        https://bugs.webkit.org/show_bug.cgi?id=101244
+
+        Reviewed by David Kilzer.
+
+        Backing out changes from Bug 98665 until further discussions take place on rules for including Platform.h in Assertions.h.
+
+        * wtf/Assertions.h:
+
+2012-11-03  Alexey Proskuryakov  <ap@apple.com>
+
+        Get rid of USE(CFURLSTORAGESESSIONS)
+        https://bugs.webkit.org/show_bug.cgi?id=101131
+
+        Reviewed by Sam Weinig.
+
+        * wtf/Platform.h:
+
+2012-11-02  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI instrument NodeRareData::Map. It uses ~250k on nytimes.com
+        https://bugs.webkit.org/show_bug.cgi?id=101052
+
+        Reviewed by Yury Semikhatsky.
+
+        I noticed that in many cases cache structures are plain static HashMap, HashSet etc.
+        MemoryAgent can visit it but instrumentation for these containers report no objectType.
+        It means that addRootObject method needs to accept objectType property as an argument.
+        Otherwise I would have had to create a proxy class with proper objectType.
+
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryInstrumentation::addRootObject):
+
+2012-11-01  Kent Tamura  <tkent@chromium.org>
+
+        Introduce ENABLE_DATE_AND_TIME_INPUT_TYPES, and clarify usage of other related flags
+        https://bugs.webkit.org/show_bug.cgi?id=101007
+
+        Reviewed by Kentaro Hara.
+
+        * wtf/Platform.h:
+        Add ENABLE_DATE_AND_TIME_INPUT_TYPES.  It's a union of
+        ENABLE_INPUT_TYPE_{DATE,DATETIME,DATETIMELOCAL,MONTH,TIME,WEEK}.
+
+2012-11-01  Yury Semikhatsky  <yurys@chromium.org>
+
+        Memory instrumentation: do not call checkCountedObject with wrong pointers
+        https://bugs.webkit.org/show_bug.cgi?id=100958
+
+        Reviewed by Alexander Pavlov.
+
+        Removed calls to checkCountedObject from places where the pointer may contain
+        an address of a base class which may differ from the actual object pointer. Instead
+        checkCountedObject is only called right after processing deferred pointer where
+        we know real address.
+
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryInstrumentation::addObjectImpl):
+        (WTF::::process):
+
+2012-11-01  Alexey Proskuryakov  <ap@apple.com>
+
+        Rename HAVE(NETWORK_CFDATA_ARRAY_CALLBACK) to USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+
+        Rubber-stamped by Joe Pecoraro.
+
+        All CFNetwork based platforms have this now, but not all use it at the moment.
+
+2012-11-01  Alexey Proskuryakov  <ap@apple.com>
+
+        Fix HAVE(NETWORK_CFDATA_ARRAY_CALLBACK) build
+        https://bugs.webkit.org/show_bug.cgi?id=100979
+
+        Reviewed by Joseph Pecoraro.
+
+        * wtf/Platform.h: Added a FIXME about HAVE(NETWORK_CFDATA_ARRAY_CALLBACK).
+
+2012-11-01  Yury Semikhatsky  <yurys@chromium.org>
+
+        Memory instrumentation: report memory occupied by ResourceRequest instead of its base ResourceRequestBase
+        https://bugs.webkit.org/show_bug.cgi?id=100497
+
+        Reviewed by Alexander Pavlov.
+
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryClassInfo::addPrivateBuffer): do not report memory usage for empty buffer.
+
+2012-10-31  Anders Carlsson  <andersca@apple.com>
+
+        Fix build.
+        <rdar://problem/12612207>.
+
+        Reviewed by Sam Weinig.
+
+        * wtf/CheckedArithmetic.h:
+
+2012-10-31  Benjamin Poulain  <bpoulain@apple.com>
+
+        Add an optimized version of copyLCharsFromUCharSource for ARM
+        https://bugs.webkit.org/show_bug.cgi?id=94886
+
+        Reviewed by Gavin Barraclough.
+
+        Michael Saboff added a SIMD version of copyLCharsFromUCharSource() in r125846.
+
+        This patch a similar optimization for ARMv7 by using the interleaved load/store available
+        in the NEON extension.
+
+        The performance gains:
+        -10000 characters: ~3.5 times faster.
+        -20 characters (2 vectors): ~55% faster.
+        -15 characters (1 vector): ~21% faster.
+        -3 characters (no vector, pure overhead): ~10% slower.
+
+        * wtf/text/ASCIIFastPath.h:
+        (WTF::copyLCharsFromUCharSource):
+
+2012-10-31  Christophe Dumez  <christophe.dumez@intel.com>
+
+        [EFL][WK2][AC] Use smart pointers for Evas_GL types
+        https://bugs.webkit.org/show_bug.cgi?id=100745
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Make OwnPtr usable with Evas_GL type to avoid handling
+        raw pointers in EFL port.
+
+        * wtf/OwnPtrCommon.h:
+        (WTF):
+        * wtf/efl/OwnPtrEfl.cpp:
+        (WTF):
+        (WTF::deleteOwnedPtr):
+
+2012-10-29  Anders Carlsson  <andersca@apple.com>
+
+        Build WebKit as C++11 on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=100720
+
+        Reviewed by Daniel Bates.
+
+        * Configurations/Base.xcconfig:
+        Add CLANG_CXX_LANGUAGE_STANDARD=gnu++0x.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::AtomicString::add):
+        Change the type of length to be unsigned to prevent implicit type conversions in non-constant initializer lists.
+
+        * wtf/unicode/UTF8.cpp:
+        (Unicode):
+        Add static_casts to prevent implicit type conversions in non-constant initializer lists.
+
+2012-10-29  Anders Carlsson  <andersca@apple.com>
+
+        String::createCFString should return a RetainPtr
+        https://bugs.webkit.org/show_bug.cgi?id=100419
+
+        Reviewed by Andreas Kling.
+
+        Make String::createCFString and StringImpl::createCFString return RetainPtrs.
+
+        * wtf/text/AtomicString.h:
+        * wtf/text/StringImpl.h:
+        * wtf/text/WTFString.h:
+
+2012-10-30  Mark Rowe  <mrowe@apple.com>
+
+        Fix WTF to not install a few header files in bogus locations.
+
+        * WTF.xcodeproj/project.pbxproj:
+
+2012-10-28  Mark Rowe  <mrowe@apple.com>
+
+        Simplify Xcode configuration settings that used to vary between OS versions.
+
+        Reviewed by Dan Bernstein.
+
+        * Configurations/Base.xcconfig:
+        * Configurations/DebugRelease.xcconfig:
+
+2012-10-28  Mark Rowe  <mrowe@apple.com>
+
+        Remove references to unsupported OS and Xcode versions.
+
+        Reviewed by Anders Carlsson.
+
+        * Configurations/Base.xcconfig:
+        * Configurations/CompilerVersion.xcconfig: Removed.
+        * Configurations/DebugRelease.xcconfig:
+        * WTF.xcodeproj/project.pbxproj:
+
+2012-10-29  Anders Carlsson  <andersca@apple.com>
+
+        AtomicString(CFStringRef) shouldn't unconditionally create a StringImpl
+        https://bugs.webkit.org/show_bug.cgi?id=100701
+
+        Reviewed by Dan Bernstein.
+
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::AtomicString):
+        Change the constructors that take a CFStringRef and an NSString * to call AtomicString::add(CFStringRef)
+        and remove AtomicString::createCFString.
+
+        (WTF::AtomicString::add):
+        Add new member function declaration. The definition is in a new file in WebCore, AtomicStringCF.cpp.
+        Also, fix the overload of add that takes a const char* to call the right other overload instead of itself.
+
+2012-10-29  Adam Barth  <abarth@webkit.org>
+
+        Unreviewed. Correct my previous patch to disable external SVG
+        references only on PLATFORM(CHROMIUM).
+
+        * wtf/Platform.h:
+
+2012-10-29  Adam Barth  <abarth@webkit.org>
+
+        Block SVG external references pending a security review
+        https://bugs.webkit.org/show_bug.cgi?id=100635
+
+        Reviewed by Eric Seidel.
+
+        We need to do a security review of loading external SVG references
+        before we're sure that it is safe.
+
+        * wtf/Platform.h:
+
+2012-10-29  Michael Saboff  <msaboff@apple.com>
+
+        String::split(UChar, Vector<String>&) shouldn't create a temporary String
+        https://bugs.webkit.org/show_bug.cgi?id=100578
+
+        Reviewed by Anders Carlsson.
+
+        Changed split(UChar, Vector<String>&) to call split(UChar, bool, Vector<String>&) instead of creating a
+        string and calling the split(String,...) version and moved it to WTFString.h.  Also moved
+        split(const String& separator, Vector<String>& result) to WTFString.h.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::split):
+        * wtf/text/WTFString.h:
+        (WTF::String::split):
+
+2012-10-29  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r132736.
+        http://trac.webkit.org/changeset/132736
+        https://bugs.webkit.org/show_bug.cgi?id=100652
+
+        It broke all plugin related tests on GTK and on Qt (Requested
+        by Ossy on #webkit).
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::fromUTF8):
+
+2012-10-27  Michael Saboff  <msaboff@apple.com>
+
+        Try to create AtomicString as 8 bit where possible
+        https://bugs.webkit.org/show_bug.cgi?id=100575
+
+        Reviewed by Oliver Hunt.
+
+        Added StringImpl::create8BitIfPossible() that first tries to create an 8 bit string.  If it finds a 16 bit character
+        during processing, it calls the standard create() method.  The assumption is that this will be used on mostly 8 bit
+        strings and ones that are shorter (in the tens of characters).  Changed AtomicString to use the new creation method
+        for UChar based construction.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::UCharBufferTranslator::translate):
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::create8BitIfPossible):
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::create8BitIfPossible):
+
+2012-10-27  Michael Saboff  <msaboff@apple.com>
+
+        String::fromUTF8() should take advantage of the ASCII check in convertUTF8ToUTF16()
+        https://bugs.webkit.org/show_bug.cgi?id=100577
+
+        Reviewed by Oliver Hunt.
+
+        Passed is ASCII flag to convertUTF8ToUTF16() and if try, create an 8 bit string from the original arguments.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::fromUTF8):
+
+2012-10-27  Dan Bernstein  <mitz@apple.com>
+
+        REAL_PLATFORM_NAME build setting is no longer needed
+        https://bugs.webkit.org/show_bug.cgi?id=100587
+
+        Reviewed by Mark Rowe.
+
+        Removed the definition of REAL_PLATFORM_NAME and replaced references to it with references
+        to PLATFORM_NAME.
+
+        * Configurations/Base.xcconfig:
+        * Configurations/CompilerVersion.xcconfig:
+        * Configurations/DebugRelease.xcconfig:
+
+2012-10-26  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r132689.
+        http://trac.webkit.org/changeset/132689
+        https://bugs.webkit.org/show_bug.cgi?id=100574
+
+        Broke HashMaps containing RetainPtrs (Requested by andersca on
+        #webkit).
+
+        * wtf/RetainPtr.h:
+
+2012-10-26  Anders Carlsson  <andersca@apple.com>
+
+        Add an operator& to RetainPtr
+        https://bugs.webkit.org/show_bug.cgi?id=100549
+
+        Reviewed by Dan Bernstein.
+
+        This is useful for APIs that return references using out parameters.
+
+        * wtf/RetainPtr.h:
+        (WTF::RetainPtr::operator&):
+
+2012-10-26  Gabor Ballabas  <gaborb@inf.u-szeged.hu>
+
+        [Qt] Enable JSC's disassembler on x86, x86_64 Linux
+        https://bugs.webkit.org/show_bug.cgi?id=100386
+
+        Reviewed by Simon Hausmann.
+
+        It works fine on Linux x86, x86_64 just needs to be enabled in the
+        QtWebKit build system.
+
+        * wtf/Platform.h:
+
+2012-10-25  Michael Saboff  <msaboff@apple.com>
+
+        REGRESSION (r131836): failures in list styles tests on EFL, GTK
+        https://bugs.webkit.org/show_bug.cgi?id=99824
+
+        Reviewed by Oliver Hunt.
+
+        Fixed ASCII check.
+        Added placeholder argument for new argument added to convertUTF8ToUTF16() in http://trac.webkit.org/changeset/131836.
+
+        * wtf/unicode/UTF8.cpp:
+        (WTF::Unicode::convertUTF8ToUTF16):
+        * wtf/unicode/glib/UnicodeGLib.cpp:
+        (WTF::Unicode::convertCase):
+
+2012-10-25  Christophe Dumez  <christophe.dumez@intel.com>
+
+        [EFL][WK2] Remove some C'ism from EwkView
+        https://bugs.webkit.org/show_bug.cgi?id=100370
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Make OwnPtr useable for Ecore_IMF_Context to avoid
+        using raw pointers in EFL port.
+
+        * wtf/OwnPtrCommon.h:
+        (WTF):
+        * wtf/PlatformEfl.cmake:
+        * wtf/efl/OwnPtrEfl.cpp:
+        (WTF::deleteOwnedPtr):
+        (WTF):
+
+2012-09-27  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: provide memory instrumentation for ListHashSet
+        https://bugs.webkit.org/show_bug.cgi?id=97786
+
+        Reviewed by Vsevolod Vlasov.
+
+        Added memory instrumentation for ListHashSet.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/HashSet.h:
+        (WTF):
+        * wtf/ListHashSet.h:
+        (ListHashSet):
+        (ListHashSetNodeAllocator): changed visibility of inPool method to public
+        (WTF::ListHashSetNodeAllocator::pool):
+        (WTF::ListHashSetNodeAllocator::pastPool):
+        (WTF::::sizeInBytes): added a method that returns size of the set in bytes including
+        all its internals but not the content elements.
+        (WTF):
+        * wtf/MemoryInstrumentation.h: removed onsolete method. All clients were updated to
+        use generic addMember instead.
+        (MemoryInstrumentation):
+        (WTF::MemoryClassInfo::addPrivateBuffer):
+        * wtf/MemoryInstrumentationHashSet.h:
+        * wtf/MemoryInstrumentationListHashSet.h: Copied from Source/WTF/wtf/MemoryInstrumentationHashSet.h.
+        (WTF):
+        (WTF::reportMemoryUsage):
+
+2012-10-23  Benjamin Poulain  <benjamin@webkit.org>
+
+        WTFURL: Implement KURL::setPort()
+        https://bugs.webkit.org/show_bug.cgi?id=99898
+
+        Reviewed by Adam Barth.
+
+        Add an efficient implementation for remplacing the port component
+        in an URL. This will be the base for replacing other components
+        efficiently.
+
+        The testing is covered by fast/dom/HTMLAnchorElement/set-href-attribute-port.html
+
+        * wtf/url/api/ParsedURL.cpp:
+        (WTF::generateNewSpecWithPort):
+        (WTF::replacePortWithString):
+        (WTF::ParsedURL::replacePort):
+        * wtf/url/api/ParsedURL.h:
+        (ParsedURL):
+
+2012-10-22  Michael Saboff  <msaboff@apple.com>
+
+        Regression(r131655): Crash in StringImpl::findIgnoringCase
+        https://bugs.webkit.org/show_bug.cgi?id=99753
+
+        Reviewed by Geoffrey Garen.
+
+        Fixed to use the searchLength to take into account the start index.
+
+        Added LayoutTests/fast/js/find-ignoring-case-regress-99753.html
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::findIgnoringCase):
+
+2012-10-22  Simon Hausmann  <simon.hausmann@digia.com>
+
+        Unreviewed: Re-enable LLINT on Qt/Linux after r131932.
+
+        * wtf/Platform.h:
+
+2012-10-22  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: do not double count memory of objects with multiple ancestors
+        https://bugs.webkit.org/show_bug.cgi?id=99958
+
+        Reviewed by Alexander Pavlov.
+
+        Make sure memory occupied by objects of classes with multiple inheritance is
+        not double counted.
+
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryObjectInfo::MemoryObjectInfo):
+        (WTF::MemoryObjectInfo::reportedPointer):
+        (WTF::MemoryObjectInfo::reportObjectInfo): 1) Store actual pointer to the instrumented
+        object as it may differ from the original pointer by which it was reported. 2) Make
+        the method non-template and calculate object size on the caller side.
+        (MemoryObjectInfo):
+        (WTF::MemoryInstrumentation::reportObjectMemoryUsage):
+        (WTF::MemoryClassInfo::MemoryClassInfo):
+        (WTF::MemoryInstrumentation::InstrumentedPointer::process): use adjusted pointer
+        returned by reportMemoryUsage to check if the object has already been visited when
+        the pointer differs from the orinal one(it may happen if the object was reported
+        by a pointer to one of its base classes).
+
+2012-10-20  Martin Robinson  <mrobinson@igalia.com>
+
+        Fix 'make dist' for the GTK+ port
+
+        * GNUmakefile.list.am: Add missing files to the source list.
+
+2012-10-19  Mark Lam  <mark.lam@apple.com>
+
+        Added WTF::StackStats mechanism.
+        https://bugs.webkit.org/show_bug.cgi?id=99805.
+
+        Reviewed by Geoffrey Garen.
+
+        Disabled by default. Should have no performance and memory cost when
+        disabled. To enable, #define ENABLE_STACK_STATS 1 in StackStats.h.
+        The output is currently hardcoded to be dumped in /tmp/stack-stats.log,
+        and is in the form of stack sample events. By default, it only logs
+        a sample event when a new high watermark value is encountered.
+
+        Also renamed StackBounds::recursiveCheck() to isSafeToRecurse().
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/StackBounds.h:
+        (StackBounds):
+        (WTF::StackBounds::size):
+        (WTF::StackBounds::isSafeToRecurse):
+        * wtf/StackStats.cpp: Added.
+        (WTF):
+        (WTF::StackStats::initialize):
+        (WTF::StackStats::PerThreadStats::PerThreadStats):
+        (WTF::StackStats::CheckPoint::CheckPoint):
+        (WTF::StackStats::CheckPoint::~CheckPoint):
+        (WTF::StackStats::probe):
+        (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
+        (WTF::StackStats::LayoutCheckPoint::~LayoutCheckPoint):
+        * wtf/StackStats.h: Added.
+        (WTF):
+        (StackStats):
+        (CheckPoint):
+        (WTF::StackStats::CheckPoint::CheckPoint):
+        (PerThreadStats):
+        (WTF::StackStats::PerThreadStats::PerThreadStats):
+        (LayoutCheckPoint):
+        (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
+        (WTF::StackStats::initialize):
+        (WTF::StackStats::probe):
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::initializeThreading):
+        * wtf/WTFThreadData.cpp:
+        (WTF::WTFThreadData::WTFThreadData):
+        * wtf/WTFThreadData.h:
+        (WTFThreadData):
+        (WTF::WTFThreadData::stackStats):
+
+2012-10-19  Anders Carlsson  <andersca@apple.com>
+
+        Deque can use std::reverse_iterator for its reverse iterators
+        https://bugs.webkit.org/show_bug.cgi?id=99789
+
+        Reviewed by Andreas Kling.
+
+        Remove DequeReverseIterator and DequeConstReverseIterator and just use std::reverse_iterator directly.
+        Also, remove the DequeIteratorBase<T, inlineCapacity> to Base typedef - We can already use DequeIteratorBase since it's
+        equivalent to the full class template type.
+
+        * wtf/Deque.h:
+        (WTF::Deque::rbegin):
+        (WTF::Deque::rend):
+        (DequeIteratorBase):
+        (WTF::DequeIteratorBase::assign):
+        (DequeIterator):
+        (DequeConstIterator):
+        (WTF::::checkValidity):
+        (WTF::::DequeIteratorBase):
+        (WTF::=):
+        (WTF::::isEqual):
+
+2012-10-19  Csaba Osztrogonác  <ossy@webkit.org>
+
+        Unreviewed buildfix, use C-style comment instead of C++
+
+        * wtf/Platform.h:
+
+2012-10-19  Csaba Osztrogonác  <ossy@webkit.org>
+
+        REGRESSION(r131822): It made 500+ tests crash on 32 bit platforms
+        https://bugs.webkit.org/show_bug.cgi?id=99814
+
+        Reviewed by Simon Hausmann.
+
+        * wtf/Platform.h: Disable LLINT on (PLATFORM(QT) && CPU(X86)) temporarily until proper fix.
+
+2012-10-17  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI provide data for mixing with tcmalloc heap dumps.
+        https://bugs.webkit.org/show_bug.cgi?id=99457
+
+        Reviewed by Yury Semikhatsky.
+
+        countObjectSize now accepts ptr as the first argument and saves it into HashMap if the binary was ran with HEAPPROFILE env variable.
+        getProcessMemoryDistribution does snapshot and calls the downstream code with the map of counted objects.
+
+        * wtf/MemoryInstrumentation.h:
+        (MemoryInstrumentationClient):
+        (WTF::MemoryInstrumentation::countObjectSize):
+        (WTF::MemoryInstrumentation::addRawBuffer):
+        (WTF::MemoryClassInfo::addPrivateBuffer):
+        (WTF::MemoryInstrumentation::addObjectImpl):
+        (WTF::MemoryInstrumentation::addListHashSet):
+        (WTF::::process):
+
+2012-10-18  Michael Saboff  <msaboff@apple.com>
+
+        convertUTF8ToUTF16() Should Check for ASCII Input
+        ihttps://bugs.webkit.org/show_bug.cgi?id=99739
+
+        Reviewed by Geoffrey Garen.
+
+        Added code to accumulate the "or" of all characters seen during the UTF8 to UTF16 conversion.  This is
+        used to check to see if all characters are ASCII and is returned via a bool*.
+
+        * wtf/unicode/UTF8.cpp:
+        (WTF::Unicode::convertUTF8ToUTF16):
+        * wtf/unicode/UTF8.h:
+
+2012-10-18  Michael Saboff  <msaboff@apple.com>
+
+        Mac WTF build checks dependencies before copying header files
+        https://bugs.webkit.org/show_bug.cgi?id=99770
+
+        Reviewed by Mark Rowe.
+
+        Fixed up build rules per Mark Rowe. Made new target an Aggregate and removed "WTF copy".
+
+        * Configurations/CopyWTFHeaders.xcconfig: Added.
+        * Configurations/WTF.xcconfig:
+        * WTF.xcodeproj/project.pbxproj:
+
+2012-10-18  Michael Saboff  <msaboff@apple.com>
+
+        Mac WTF build checks dependencies before copying header files
+        https://bugs.webkit.org/show_bug.cgi?id=99770
+
+        Reviewed by Geoffrey Garen.
+
+        Added a new build target "Copy WTF HEaders" to copy the header files and made that new target a dependency
+        for the main WTF build target.  Moved the "Copy WTF Headers" phase from WTF target to the new target.
+
+        * WTF.xcodeproj/project.pbxproj:
+
+2012-10-17  Anders Carlsson  <andersca@apple.com>
+
+        Clean up Vector.h
+        https://bugs.webkit.org/show_bug.cgi?id=99622
+
+        Reviewed by Benjamin Poulain.
+
+        Remove unused member functions from Vector and get rid of the std::max and std::min using declarations
+        (as per the WebKit coding style guidelines).
+
+        * WTF.xcodeproj/project.pbxproj:
+        Turns out StreamBuffer.h was never added to the Xcode project; add it. Also go ahead and sort the project file.
+
+        * wtf/Deque.h:
+        (WTF::::expandCapacity):
+        * wtf/StreamBuffer.h:
+        (WTF::StreamBuffer::append):
+        Add std:: prefixes to max and min.
+
+        * wtf/Vector.h:
+        Remove VectorBase::bufferSlot(), VectorReverseProxy and add std:: prefixes where needed.
+
+2012-10-17  Michael Saboff  <msaboff@apple.com>
+
+        Creating a String from an NSString should check for all 8 bit strings
+        https://bugs.webkit.org/show_bug.cgi?id=99392
+
+        Reviewed by Geoffrey Garen.
+
+        Exported the LChar* version of create().
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::create):
+
+2012-10-17  Michael Saboff  <msaboff@apple.com>
+
+        StringImpl::findIgnoringCase() and reverseFindIgnoringCase() don't optimally handle a mix of 8 and 16 bit strings
+        https://bugs.webkit.org/show_bug.cgi?id=99224
+
+        Reviewed by Geoffrey Garen.
+
+        Added helper templated functions and all four combinations similar to find() and reverseFind().
+
+        (WTF::findIgnoringCaseInner):
+        (WTF::StringImpl::findIgnoringCase):
+        (WTF::reverseFindIgnoringCaseInner):
+        (WTF::StringImpl::reverseFindIgnoringCase):
+
+2012-10-17  Michael Saboff  <msaboff@apple.com>
+
+        AtomicString::HashAndUTF8CharactersTranslator::equal() doesn't optimally handle 8 bit strings
+        https://bugs.webkit.org/show_bug.cgi?id=99223
+
+        Reviewed by Geoffrey Garen.
+
+        Added an 8 bit path.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::HashAndUTF8CharactersTranslator::equal):
+
+2012-10-17  Anders Carlsson  <andersca@apple.com>
+
+        Always use fastRealloc when growing or shrinking the Vector buffer
+        https://bugs.webkit.org/show_bug.cgi?id=99616
+
+        Reviewed by Andreas Kling.
+
+        Remove the pointless #if PLATFORM(BLACKBERRY) and always try to use fastRealloc to grow or shrink the
+        vector buffer when possible; realloc should always be at least as fast as free+malloc.
+
+        * wtf/Vector.h:
+        (WTF::VectorBufferBase::shouldReallocateBuffer):
+
+2012-10-16  Michael Saboff  <msaboff@apple.com>
+
+        Change WTF_USE_8BIT_TEXTRUN to ENABLE_8BIT_TEXTRUN
+        https://bugs.webkit.org/show_bug.cgi?id=99484
+
+        Reviewed by Eric Seidel.
+
+        Changed macro name to align with it's purpose.
+
+        * wtf/Platform.h:
+
+2012-10-16  Michael Saboff  <msaboff@apple.com>
+
+        StringImpl::reverseFind() with a single match character isn't optimal for mixed 8/16 bit cases
+        https://bugs.webkit.org/show_bug.cgi?id=99363
+
+        Reviewed by Benjamin Poulain.
+
+        Factored out the 8/16 bitness check of the match character from the subject character bitness
+        check.  Did this for both find() and reverseFind().  Added all UChar/LChar combinations to the
+        inline reverseFind().
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::find):
+        (WTF::StringImpl::reverseFind):
+        * wtf/text/StringImpl.h:
+        (WTF::reverseFind):
+
+2012-10-16  Dima Gorbik  <dgorbik@apple.com>
+
+        Remove Platform.h include from the header files.
+        https://bugs.webkit.org/show_bug.cgi?id=98665
+
+        Reviewed by Eric Seidel.
+
+        We don't want other clients that include WebKit headers to know about Platform.h.
+
+        * wtf/Assertions.h:
+        * wtf/MainThread.h:
+
+2012-10-16  Adrienne Walker  <enne@google.com>
+
+        Remove unused WTF_NEW_HASHMAP_ITERATORS_INTERFACE #define
+        https://bugs.webkit.org/show_bug.cgi?id=99367
+
+        Reviewed by James Robinson.
+
+        Does what it says on the tin.
+
+        * wtf/HashTraits.h:
+
+2012-10-15  Andreas Kling  <kling@webkit.org>
+
+        Remove WTF::fastDeleteAllValues().
+        <http://webkit.org/b/99345>
+
+        Reviewed by Eric Seidel.
+
+        It was only used to fastDelete() a class that was already overriding operator delete
+        by way of WTF_MAKE_FAST_ALLOCATED anyway.
+
+        * wtf/HashSet.h:
+        (WTF):
+        (HashSet):
+
+2012-10-15  Mark Hahnenberg  <mhahnenberg@apple.com>
+
+        Parallel GC should not be disabled for all platforms
+
+        * wtf/Platform.h: D'oh!
+
+2012-10-15  George Staikos  <staikos@webkit.org>
+
+        [BlackBerry] Adapt to Platform API changes in string handling
+        https://bugs.webkit.org/show_bug.cgi?id=99248
+
+        Reviewed by Yong Li.
+
+        Convert usage of WebString, char* and std::string to BlackBerry::Platform::String.
+
+        * wtf/Assertions.cpp: Use proper log function.
+        * wtf/text/AtomicString.h: Add BlackBerry support
+        (AtomicString):
+        (WTF::AtomicString::AtomicString): Add BlackBerry Support
+        (WTF::AtomicString::operator BlackBerry::Platform::String):
+        * wtf/text/StringImpl.h: Conversion support.
+        * wtf/text/WTFString.h: Conversion support.
+        (Platform):
+        (String):
+
+2012-10-15  Michael Saboff  <msaboff@apple.com>
+
+        Update RenderText to use String instead of UChar* for text
+        https://bugs.webkit.org/show_bug.cgi?id=96979
+
+        Reviewed by Dan Bernstein.
+
+        Added WTF_USE_8BIT_TEXTRUN to encase code that creates 8 bit TextRun's.  Enabled WTF_USE_8BIT_TEXTRUN
+        for PLATFORM(MAC).  Other platform can update this setting in Platform.h when their platform specific use of
+        TextRun handle 8 bit data.  Added a new Vector::appendVector to allow appending the contents of a vector
+        containing one type to the end of vector containing another.  This is used to append a Vector<LChar> to
+        the end of a Vector<UChar>.
+
+        * wtf/Platform.h:
+        * wtf/Vector.h:
+        (Vector):
+        (WTF::Vector::appendVector):
+
+2012-10-15  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: convert manual size calculation of different WebKit things into MemoryInstrumentation.
+        https://bugs.webkit.org/show_bug.cgi?id=99309
+
+        Reviewed by Yury Semikhatsky.
+
+        JSHeap, DOMStorage and HeapProfiler data were counted manually.
+        Now we count the sizes more generic way.
+
+        * wtf/MemoryInstrumentation.h: calculateContainerSize were removed.
+        * wtf/MemoryInstrumentationSequence.h: empty instrumentations were added for 'const char*' and 'const void*' sequences.
+
+2012-10-12  Anders Carlsson  <andersca@apple.com>
+
+        Move QDataStream functions into HistoryItemQt.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=99203
+
+        Reviewed by Andreas Kling.
+
+        It seems like the QDataStream stream operators are only used from HistoryItemQt.cpp
+        inside WebCore, so move them there. If in the future they are required elsewhere, they should
+        be moved into a separate header instead of polluting headers unnecessarily.
+
+        * wtf/Vector.h:
+        * wtf/qt/StringQt.cpp:
+        * wtf/text/WTFString.h:
+
+2012-10-12  Michael Saboff  <msaboff@apple.com>
+
+        StringBuilder::append(StringBuilder&) doesn't take into account the bit size of the argument string
+        https://bugs.webkit.org/show_bug.cgi?id=99225
+
+        Reviewed by Benjamin Poulain.
+
+        Added 8 bit path.
+
+        * wtf/text/StringBuilder.h:
+        (WTF::StringBuilder::append):
+
+2012-10-12  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r131224.
+        http://trac.webkit.org/changeset/131224
+        https://bugs.webkit.org/show_bug.cgi?id=99210
+
+        It broke the build (Requested by andersca on #webkit).
+
+        * wtf/Vector.h:
+        (WTF):
+        (WTF::operator<<):
+        (WTF::operator>>):
+        * wtf/qt/StringQt.cpp:
+        (WTF::operator<<):
+        (WTF):
+        (WTF::operator>>):
+        * wtf/text/WTFString.h:
+        (WTF):
+
+2012-10-12  Anders Carlsson  <andersca@apple.com>
+
+        Move QDataStream functions into HistoryItemQt.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=99203
+
+        Reviewed by Andreas Kling.
+
+        It seems like the QDataStream stream operators are only used from HistoryItemQt.cpp
+        inside WebCore, so move them there. If in the future they are required elsewhere, they should
+        be moved into a separate header instead of polluting headers unnecessarily.
+
+        * wtf/Vector.h:
+        * wtf/qt/StringQt.cpp:
+        * wtf/text/WTFString.h:
+
+2012-10-11  Mark Toller  <mark.toller@samsung.com>
+
+        Removed incorrect pthread_mutex_trylock code in an ASSERT in TCMalloc_PageHeap::signalScavenger. This 
+        branch is used by the Webkit GTK code.
+
+        https://bugs.webkit.org/show_bug.cgi?id=97539
+
+        Reviewed by Geoffrey Garen.
+
+        The code was never compiled in, and was functionally broken. There is no need for locking around the 
+        m_scavengeThreadActive flag, however, we should lock pageheap_lock before calling 'shouldScavenge()', as we
+        only want to scavenge when really required, so it's better to wait for any current memory operation to 
+        complete before checking. 
+
+        * wtf/FastMalloc.cpp:
+        (WTF::TCMalloc_PageHeap::signalScavenger):
+
+2012-10-10  Yong Li  <yoli@rim.com>
+
+        [BlackBerry] Define WTF_USE_EXTRA_MACROS in cmake rather than Platform.h
+        https://bugs.webkit.org/show_bug.cgi?id=98819
+
+        Reviewed by Rob Buis.
+
+        And make it depend on SHARED_CORE
+        RIM PR# 221339.
+
+        * wtf/Platform.h:
+
+2012-10-09  Filip Pizlo  <fpizlo@apple.com>
+
+        JSC should infer when indexed storage is contiguous, and optimize for it
+        https://bugs.webkit.org/show_bug.cgi?id=97288
+
+        Reviewed by Mark Hahnenberg.
+
+        Moved out this helpful math utility to MathExtras, since we now use it in
+        multiple places.
+
+        * wtf/MathExtras.h:
+        (timesThreePlusOneDividedByTwo):
+
+2012-10-08  Benjamin Poulain  <benjamin@webkit.org>
+
+        Generalize moving URLComponent's begin position
+        https://bugs.webkit.org/show_bug.cgi?id=98626
+
+        Reviewed by Adam Barth.
+
+        The patch r130609 introduced moving URLComponents's position.
+        It turns out this concept is really useful in the parser so
+        this patch generalize the idea.
+
+        * wtf/url/api/ParsedURL.cpp:
+        (WTF::ParsedURL::removePort):
+        * wtf/url/src/URLCanonEtc.cpp:
+        * wtf/url/src/URLComponent.h:
+        (WTF::URLComponent::moveBy):
+        Rename URLComponent::move() to URLComponent::moveBy() for consistency
+        with some of WebCore types.
+
+        * wtf/url/src/URLParse.cpp:
+        * wtf/url/src/URLParseFile.cpp:
+
+        * wtf/url/src/URLSegments.cpp:
+        (WTF::URLSegments::moveFromComponentBy):
+        Change the semantic to everything from a certain component. This is
+        useful to move everything, including the scheme.
+
+        * wtf/url/src/URLSegments.h:
+        (URLSegments):
+
+2012-10-08  Andreas Kling  <kling@webkit.org>
+
+        Lower minimum table size of WTF::HashTable to reduce memory usage.
+        <http://webkit.org/b/98406>
+        <rdar://problem/12432140>
+
+        Reviewed by Anders Carlsson.
+
+        Lower the default minimumTableSize for WTF hash tables from 64 to 8 entries.
+        This reduces WebProcess memory consumption by ~16MB on Membuster3 (a 6% progression!)
+
+        No significant movement on PLT or JSC benchmarks on my machine. If there's a perf regression somewhere
+        from this, we can tweak individual tables to have a larger minimumTableSize.
+
+        * wtf/HashTraits.h:
+
+2012-10-08  Andreas Kling  <kling@webkit.org>
+
+        Using float/double as WTF hash table key is unreliable.
+        <http://webkit.org/b/98627>
+
+        Reviewed by Geoffrey Garen.
+
+        Change FloatHash::equal() to do a bitwise compare instead of a logical compare.
+        This fixes a problem where the keys with different binary representation but the
+        same logical value (e.g 0 and -0) could block each other from being found if they
+        ended up in the same hash bucket.
+
+        * wtf/HashFunctions.h:
+        (FloatHash):
+        (WTF::FloatHash::hash):
+        (WTF::FloatHash::equal):
+
+2012-10-08  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r130619.
+        http://trac.webkit.org/changeset/130619
+        https://bugs.webkit.org/show_bug.cgi?id=98634
+
+        Causes many crashes on the EFL bots. (Requested by rakuco on
+        #webkit).
+
+        * wtf/efl/MainThreadEfl.cpp:
+        (WTF::pipeObject):
+        (WTF):
+        (WTF::monitorDispatchFunctions):
+        (WTF::initializeMainThreadPlatform):
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+
+2012-10-08  Byungwoo Lee  <bw80.lee@samsung.com>
+
+        [EFL] Use ecore_main_loop_thread_safe_call_async() to wakeup main loop.
+        https://bugs.webkit.org/show_bug.cgi?id=98505
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Instead of ecore_pipe_write(),
+        use ecore_main_loop_thread_safe_call_async() to wakeup ecore main loop.
+
+        According to the EFL API document, this function is designed to dispatch
+        a function on ecore main loop by avoiding dead lock or race condition. 
+        With this function, webkit doesn't need to maintain ecore pipe also.
+
+        * wtf/efl/MainThreadEfl.cpp:
+        (WTF::monitorDispatchFunctions):
+        (WTF::initializeMainThreadPlatform):
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+
+2012-10-07  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        Rename first/second to key/value in HashMap iterators
+        https://bugs.webkit.org/show_bug.cgi?id=82784
+
+        Reviewed by Eric Seidel.
+
+        Currently HashMap iterators follow the same interface in std::map: given an
+        iterator it, we use it->first to access the key and it->second to access the
+        value. This patch changes these accesses to it->key and it->value, improving the
+        readability at call sites.
+
+        One potential downside of this change would be the confusion between std::map and
+        HashMap interfaces. However, they are already different in other aspects and the
+        usage of std::map is more an exception than a rule in WebKit code, so we consider
+        the confusion will be less likely to happen.
+
+        * wtf/HashCountedSet.h:
+        (WTF::::add):
+        (WTF::::remove):
+        (WTF::copyToVector):
+        * wtf/HashIterators.h:
+        (WTF::HashTableConstKeysIterator::get):
+        (WTF::HashTableConstValuesIterator::get):
+        (WTF::HashTableKeysIterator::get):
+        (WTF::HashTableValuesIterator::get):
+        * wtf/HashMap.h:
+        (WTF::KeyValuePairKeyExtractor::extract):
+        (WTF::HashMapValueTraits::isEmptyValue):
+        (WTF::HashMapTranslator::translate):
+        (WTF::HashMapTranslatorAdapter::translate):
+        (WTF::::set):
+        (WTF::::get):
+        (WTF::::take):
+        (WTF::operator==):
+        (WTF::deleteAllValues):
+        (WTF::deleteAllKeys):
+        Removed deleteAllPairFirsts() and deleteAllPairSeconds() since they are now unused.
+
+        * wtf/HashTable.h:
+        (WTF::hashTableSwap):
+        (WTF::::checkTableConsistencyExceptSize):
+        * wtf/HashTraits.h:
+        (WTF):
+        (WTF::KeyValuePair::KeyValuePair):
+        (KeyValuePair):
+        (WTF::KeyValuePairHashTraits::constructDeletedValue):
+        (WTF::KeyValuePairHashTraits::isDeletedValue):
+        * wtf/MetaAllocator.cpp:
+        (WTF::MetaAllocator::addFreeSpace):
+        (WTF::MetaAllocator::incrementPageOccupancy):
+        (WTF::MetaAllocator::decrementPageOccupancy):
+        * wtf/RefCountedLeakCounter.cpp:
+        (WTF::RefCountedLeakCounter::~RefCountedLeakCounter):
+        * wtf/RefPtrHashMap.h:
+        (WTF::::set):
+        (WTF::::get):
+        (WTF::::inlineGet):
+        (WTF::::take):
+        * wtf/Spectrum.h:
+        (WTF::Spectrum::add):
+        (WTF::Spectrum::get):
+        (WTF::Spectrum::buildList):
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::identifierByPthreadHandle):
+
+2012-10-07  Benjamin Poulain  <benjamin@webkit.org>
+
+        WTFURL: implement URL port removal for HTMLAnchorElement
+        https://bugs.webkit.org/show_bug.cgi?id=98604
+
+        Reviewed by Adam Barth.
+
+        Add hasStandardScheme() (similar to isStandard from Google URL),
+        hasPort() and removePort() to implement the port removal of KURL.
+
+        * wtf/url/api/ParsedURL.cpp:
+        (WTF::ParsedURL::hasStandardScheme):
+        (WTF::ParsedURL::hasPort):
+        (WTF::ParsedURL::removePort):
+        * wtf/url/api/ParsedURL.h:
+        (ParsedURL):
+        * wtf/url/src/URLComponent.h:
+        (WTF::URLComponent::move):
+        * wtf/url/src/URLSegments.cpp:
+        (WTF::URLSegments::moveComponentsAfter):
+        * wtf/url/src/URLSegments.h:
+        (URLSegments):
+        * wtf/url/src/URLUtil.cpp:
+        (URLUtilities):
+        (WTF::URLUtilities::isStandard):
+        * wtf/url/src/URLUtil.h:
+        (URLUtilities):
+        Remove LowerCaseEqualsASCII() from the interface, make it an internal template.
+
+        (WTF::URLUtilities::isStandard):
+        Since in WebKit, LChar is a superset of char, expose LChar and cast char* to LChar*.
+
+2012-10-06  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI fix String instrumentation the way it was discussed in WK97964
+        https://bugs.webkit.org/show_bug.cgi?id=98500
+
+        Reviewed by Benjamin Poulain.
+
+        Current instrumentation incorrectly covers the case when StringImpl object has been created via StringImpl::createWithTerminatingNullCharacter().
+        Looks like the only way to detect the strings that has been created from literals is to compare the addresses of buffer and stringImpl + 1.
+
+        * wtf/MemoryInstrumentationString.h:
+        (WTF::reportMemoryUsage):
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::hasInternalBuffer):
+
+2012-10-06  Benjamin Poulain  <benjamin@webkit.org>
+
+        Fix build of WTFURL after r130187
+        https://bugs.webkit.org/show_bug.cgi?id=98588
+
+        Reviewed by Kentaro Hara.
+
+        * wtf/MemoryInstrumentationParsedURL.h:
+        (WTF::reportMemoryUsage):
+        * wtf/url/api/ParsedURL.h:
+        (WTF::ParsedURL::spec):
+
+2012-10-05  Simon Pena  <spena@igalia.com>
+
+        [GTK] Add support for GBytes in GRefPtr
+        https://bugs.webkit.org/show_bug.cgi?id=98489
+
+        Reviewed by Carlos Garcia Campos.
+
+        Adding support for GBytes in GRefPtr makes it easier
+        for them to be used when adding GResources support,
+        and is more consistent with the rest of the port.
+
+        This calls g_bytes_ref and g_bytes_unref in the implementation
+        of the refPtr and derefPtr template functions, in case the GLib
+        version is met. Otherwise, it does nothing.
+
+        * wtf/gobject/GRefPtr.cpp: Implement templates for ref and deref.
+        (WTF::refGPtr):
+        (WTF):
+        (WTF::derefGPtr):
+        * wtf/gobject/GRefPtr.h:
+        (WTF):
+        * wtf/gobject/GTypedefs.h: Define the GBytes datatype.
+
+2012-10-05  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r130478.
+        http://trac.webkit.org/changeset/130478
+        https://bugs.webkit.org/show_bug.cgi?id=98494
+
+        It broke the Qt build (Requested by Ossy on #webkit).
+
+        * wtf/gobject/GRefPtr.cpp:
+        * wtf/gobject/GRefPtr.h:
+        (WTF):
+        * wtf/gobject/GTypedefs.h:
+
+2012-10-05  Simon Pena  <spena@igalia.com>
+
+        [GTK] Add support for GBytes in GRefPtr
+        https://bugs.webkit.org/show_bug.cgi?id=98489
+
+        Reviewed by Carlos Garcia Campos.
+
+        Adding support for GBytes in GRefPtr makes it easier
+        for them to be used when adding GResources support,
+        and is more consistent with the rest of the port.
+
+        This calls g_bytes_ref and g_bytes_unref in the implementation
+        of the refPtr and derefPtr template functions.
+
+        * wtf/gobject/GRefPtr.cpp: Implement templates for ref and deref.
+        (WTF::refGPtr):
+        (WTF):
+        (WTF::derefGPtr):
+        * wtf/gobject/GRefPtr.h:
+        (WTF):
+        * wtf/gobject/GTypedefs.h: Define the GBytes datatype.
+
+2012-10-04  Dirk Pranke  <dpranke@chromium.org>
+
+        Unreviewed, rolling out r130419.
+        http://trac.webkit.org/changeset/130419
+        https://bugs.webkit.org/show_bug.cgi?id=98406
+
+        broke editing/pasteboard/data-transfer-items.html on chromium
+
+        * wtf/HashTraits.h:
+
+2012-10-04  Andreas Kling  <kling@webkit.org>
+
+        Lower minimum table size of WTF::HashTable to reduce memory usage.
+        <http://webkit.org/b/98406>
+        <rdar://problem/12432140>
+
+        Reviewed by Anders Carlsson.
+
+        Lower the default minimumTableSize for WTF hash tables from 64 to 8 entries.
+        This reduces WebProcess memory consumption by ~16MB on Membuster3 (a 6% progression!)
+
+        No significant movement on PLT or JSC benchmarks on my machine. If there's a perf regression somewhere
+        from this, we can tweak individual tables to have a larger minimumTableSize.
+
+        * wtf/HashTraits.h:
+
+2012-10-04  Michael Saboff  <msaboff@apple.com>
+
+        String::remove will convert an 8 bit string to a 16 bit string
+        https://bugs.webkit.org/show_bug.cgi?id=98299
+
+        Reviewed by Benjamin Poulain.
+
+        Added an 8 bit path to remove().  Added a private templated helper removeInternal.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::removeInternal):
+        (WTF::String::remove):
+        * wtf/text/WTFString.h:
+        (String):
+
+2012-10-03  Kangil Han  <kangil.han@samsung.com>
+
+        [Refactoring] Tidy NDEBUG optioning in RefCountedBase.
+        https://bugs.webkit.org/show_bug.cgi?id=98252
+
+        Reviewed by Benjamin Poulain.
+
+        Fixed incomplete implementation for NDEBUG option.
+        Additionally, adopted CHECK_REF_COUNTED_LIFECYCLE definition to suppress abusing NDEBUG option.
+
+        * wtf/RefCounted.h:
+        (WTF):
+        (WTF::RefCountedBase::ref):
+        (WTF::RefCountedBase::hasOneRef):
+        (WTF::RefCountedBase::refCount):
+        (WTF::RefCountedBase::turnOffVerifier):
+        (WTF::RefCountedBase::relaxAdoptionRequirement):
+        (WTF::RefCountedBase::RefCountedBase):
+        (WTF::RefCountedBase::~RefCountedBase):
+        (WTF::RefCountedBase::derefBase):
+        (RefCountedBase):
+        (WTF::adopted):
+        (WTF::RefCountedBase::setMutexForVerifier):
+        (WTF::RefCountedBase::setDispatchQueueForVerifier):
+
+2012-10-03  Yury Semikhatsky  <yurys@chromium.org>
+
+        Remove MemoryInstrumentation::addCollectionElements
+        https://bugs.webkit.org/show_bug.cgi?id=98245
+
+        Reviewed by Vsevolod Vlasov.
+
+        Removed MemoryInstrumentation::addCollectionElements and switched all call sites
+        to reportSequenceMemoryUsage.
+
+        Drive-by fix: removed some unused methods on MemoryInstrumentation.
+
+        * wtf/MemoryInstrumentation.h:
+        * wtf/MemoryInstrumentationHashSet.h:
+        (WTF::reportMemoryUsage):
+        * wtf/MemoryInstrumentationSequence.h:
+        (WTF::SequenceMemoryInstrumentationTraits::reportMemoryUsage):
+        * wtf/MemoryInstrumentationVector.h:
+        (WTF::reportMemoryUsage):
+
+2012-10-02  Yury Semikhatsky  <yurys@chromium.org>
+
+        Provide memory instrumentation for HashCountedSet
+        https://bugs.webkit.org/show_bug.cgi?id=98138
+
+        Reviewed by Pavel Feldman.
+
+        Added memory instrumentation for HashCountedSet.
+
+        Extracted common routines for collecting memory info for an iterable sequence.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/MemoryInstrumentation.h:
+        (WTF):
+        * wtf/MemoryInstrumentationHashCountedSet.h: Copied from Source/WTF/wtf/MemoryInstrumentationHashSet.h.
+        (WTF):
+        (WTF::reportMemoryUsage):
+        * wtf/MemoryInstrumentationHashMap.h:
+        (WTF::reportMemoryUsage):
+        * wtf/MemoryInstrumentationHashSet.h:
+        * wtf/MemoryInstrumentationSequence.h: Copied from Source/WTF/wtf/MemoryInstrumentationHashMap.h.
+        (WTF):
+        (WTF::SequenceMemoryInstrumentationTraits::reportMemoryUsage):
+        (WTF::reportSequenceMemoryUsage):
+
+2012-10-02  Joshua Bell  <jsbell@chromium.org>
+
+        Add htons/htonl definitions and implementations
+        https://bugs.webkit.org/show_bug.cgi?id=98054
+
+        Reviewed by Darin Adler.
+
+        For parsing or serializing binary data, byte order matters. The canonical htons/htonl/
+        ntohs/ntohl functions are not present everywhere, so implementations are proliferating in
+        parsers. Expose a new WTF header (wtf/ByteOrder.h) that includes the standard
+        implementations on UNIX-like OSs and provides basic inlined implementations on Windows.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/ByteOrder.h: Added.
+        (WTF::wswap32): Inline functions so arguments are only evaluated once.
+        (WTF::bswap32):
+        (WTF::bswap16):
+        (ntohs): Inline functions on OS(WINDOWS) to match macros on OS(UNIX)
+        (htons):
+        (ntohl):
+        (htonl):
+        * wtf/CMakeLists.txt:
+
+2012-10-02  Michael Saboff  <msaboff@apple.com>
+
+        HTMLConstructionSite::insertTextNode isn't optimized for 8 bit strings
+        https://bugs.webkit.org/show_bug.cgi?id=97740
+
+        Reviewed by Darin Adler.
+
+        Added an append method that takes an LChar source.  Made both the UChar and LChar versions optimally handle
+        the appendee and appendend string bitness.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::append):
+        * wtf/text/WTFString.h:
+        (String):
+
+2012-10-02  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI: switch to non intrusive instrumentation of ParsedURL.
+        https://bugs.webkit.org/show_bug.cgi?id=98150
+
+        Reviewed by Yury Semikhatsky.
+
+        Memory instrumentation for ParsedURL was extracted into separate header MemoryInstrumentationParsedURL.h
+
+        Drive by fix: unnecessary include was removed from String*.cpp files.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/MemoryInstrumentation.h:
+        (WTF):
+        * wtf/MemoryInstrumentationParsedURL.h: Added.
+        (WTF):
+        (WTF::reportMemoryUsage):
+        * wtf/text/AtomicString.cpp:
+        * wtf/text/StringImpl.cpp:
+        * wtf/text/WTFString.cpp:
+        * wtf/url/api/ParsedURL.cpp:
+        * wtf/url/api/ParsedURL.h:
+        * wtf/url/api/URLString.cpp:
+        * wtf/url/api/URLString.h:
+
+2012-09-29  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI make String* instrumentation non intrusive
+        https://bugs.webkit.org/show_bug.cgi?id=97964
+
+        Reviewed by Yury Semikhatsky.
+
+        MemoryInstrumentationString.h was added.
+        Intrusive instrumentation was removed.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/MemoryInstrumentation.h:
+        (WTF):
+        * wtf/MemoryInstrumentationString.h: Added.
+        (WTF):
+        (WTF::reportMemoryUsage):
+        * wtf/text/AtomicString.cpp:
+        (WTF):
+        * wtf/text/AtomicString.h:
+        (AtomicString):
+        * wtf/text/CString.h:
+        (WTF::CStringBuffer::length):
+        * wtf/text/StringImpl.cpp:
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::usesInternalBuffer):
+        (WTF::StringImpl::baseString):
+        (StringImpl):
+
+2012-10-02  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r130129.
+        http://trac.webkit.org/changeset/130129
+        https://bugs.webkit.org/show_bug.cgi?id=98125
+
+        broke 4 webkit_unit_tests
+        (MemoryInstrumentationTest.hashMapWith*) (Requested by caseq
+        on #webkit).
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/MemoryInstrumentation.h:
+        (WTF):
+        * wtf/MemoryInstrumentationString.h: Removed.
+        * wtf/text/AtomicString.cpp:
+        (WTF::AtomicString::reportMemoryUsage):
+        (WTF):
+        * wtf/text/AtomicString.h:
+        (AtomicString):
+        * wtf/text/CString.h:
+        (WTF::CStringBuffer::length):
+        (CStringBuffer):
+        (WTF::CStringBuffer::reportMemoryUsage):
+        (CString):
+        (WTF::CString::reportMemoryUsage):
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::reportMemoryUsage):
+        (WTF):
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+        * wtf/text/WTFString.cpp:
+        (WTF::String::reportMemoryUsage):
+        (WTF):
+        * wtf/text/WTFString.h:
+        (String):
+
+2012-09-29  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI make String* instrumentation non intrusive
+        https://bugs.webkit.org/show_bug.cgi?id=97964
+
+        Reviewed by Yury Semikhatsky.
+
+        MemoryInstrumentationString.h was added.
+        Intrusive instrumentation was removed.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/MemoryInstrumentation.h:
+        (WTF):
+        * wtf/MemoryInstrumentationString.h: Added.
+        (WTF):
+        (WTF::reportMemoryUsage):
+        * wtf/text/AtomicString.cpp:
+        (WTF):
+        * wtf/text/AtomicString.h:
+        (AtomicString):
+        * wtf/text/CString.h:
+        (WTF::CStringBuffer::length):
+        * wtf/text/StringImpl.cpp:
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::usesInternalBuffer):
+        (WTF::StringImpl::baseString):
+        (StringImpl):
+
+2012-10-01  Daniel Drake  <dsd@laptop.org>
+
+        Another SIGILL in JavaScriptCore on a Geode processor
+        https://bugs.webkit.org/show_bug.cgi?id=96286
+
+        Reviewed by Filip Pizlo.
+
+        Disable LLint for the GTK build where the build target does not
+        support SSE2 instructions. Restores support for non-SSE2 processors
+        such as the AMD Geode.
+
+        * wtf/Platform.h:
+
+2012-10-01  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: provide memory instrumentation for HashMap
+        https://bugs.webkit.org/show_bug.cgi?id=98005
+
+        Reviewed by Pavel Feldman.
+
+        Extracted HashMap memory instrumentation into its own file. The map's content
+        elements will be automatically traversed if their types are supported
+        by the memory instrumentation. No need to call special method for hash map
+        fields any more.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * wtf/MemoryInstrumentation.h:
+        (MemoryInstrumentation):
+        (WTF):
+        * wtf/MemoryInstrumentationHashMap.h: Added.
+        (WTF):
+        (WTF::SequenceMemoryInstrumentationTraits::reportMemoryUsage):
+        (WTF::reportMemoryUsage):
+
+2012-10-01  Alberto Garcia  <agarcia@igalia.com>
+
+        Check that __cplusplus is defined before comparing its value
+        https://bugs.webkit.org/show_bug.cgi?id=98015
+
+        Reviewed by Xan Lopez.
+
+        If __cplusplus is not defined is interpreted as having the value
+        0, but it produces a compilation warning with -Wundef.
+
+        This is the case with some API tests that are written in C
+        (JSNode.c, JSNodeList.c, minidom.c).
+
+        * wtf/Compiler.h:
+
+2012-10-01  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        Unreviewed. Fix make distcheck.
+
+        * GNUmakefile.list.am: Add missing header files to compilation.
+
+2012-09-30  Mark Hahnenberg  <mhahnenberg@apple.com>
+
+        Clean up HasTrivialConstructor/Destructor
+        https://bugs.webkit.org/show_bug.cgi?id=97754
+
+        Reviewed by Sam Weinig.
+
+        Mixed up the HasTrivialDestructor/Constructor case for VS2010 and later in the previous patch.
+
+        * wtf/TypeTraits.h:
+
+2012-09-29  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r129982.
+        http://trac.webkit.org/changeset/129982
+        https://bugs.webkit.org/show_bug.cgi?id=97971
+
+        hit assert in fast/overflow/overflow-height-float-not-removed-
+        crash3.html (Requested by eae on #webkit).
+
+        * wtf/Platform.h:
+
+2012-09-29  Emil A Eklund  <eae@chromium.org>
+
+        Enable SATURATED_LAYOUT_ARITHMETIC for chromium
+        https://bugs.webkit.org/show_bug.cgi?id=95053
+
+        Reviewed by Abhishek Arya.
+
+        Enable the SATURATED_LAYOUT_ARITHMETIC flag for the chromium port.
+        This changes the behavior of FractionalLayoutUnit to clamp to the
+        max or min value instead of overflowing.
+
+        This may very well impact performance so the current plan is to enable
+        it for a couple of hours to a day to collect performance data and then
+        disable it again until we've had a chance to review the perf data.
+
+        * wtf/Platform.h:
+
+2012-09-28  Anders Carlsson  <andersca@apple.com>
+
+        Remove Java bridge
+        https://bugs.webkit.org/show_bug.cgi?id=97954
+
+        Reviewed by Sam Weinig.
+
+        The Java bridge is not used by any port; Mac now has a NPAPI Java plug-in.
+
+        * wtf/Platform.h:
+
+2012-09-28  Kai Koehne  <kai.koehne@digia.com>
+
+        Disable YARR_JIT for Windows 64 bit
+        https://bugs.webkit.org/show_bug.cgi?id=97772
+
+        Reviewed by Simon Hausmann.
+
+        Using YARR_JIT requires ASSEMBLER, which in turn enables the
+        executable fixed allocator, which is mmap based (not available on
+        Windows).
+
+        * wtf/Platform.h:
+
+2012-09-28  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: make HashSet memory instrumentation non-intrusive
+        https://bugs.webkit.org/show_bug.cgi?id=97879
+
+        Reviewed by Vsevolod Vlasov.
+
+        Removed reportMemoryUsage declarations as a friend of HashSet and HashTable. Also
+        removed MemoryInstrumentationHashTable which is not needed if we don't have
+        access to HashSet's guts.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/HashSet.h:
+        (WTF):
+        (HashSet):
+        * wtf/HashTable.h:
+        (HashTable):
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryClassInfo::addPrivateBuffer):
+        * wtf/MemoryInstrumentationHashSet.h:
+        (WTF::reportMemoryUsage):
+        * wtf/MemoryInstrumentationHashTable.h: Removed.
+
+2012-09-27  Anders Carlsson  <andersca@apple.com>
+
+        Remove the clang pragmas to disable warnings in Noncopyable.h
+        https://bugs.webkit.org/show_bug.cgi?id=97826
+
+        Reviewed by Beth Dakin.
+
+        Warnings about C++11 extensions are already disabled project-wide now so there's no need
+        to keep these pragmas.
+
+        * wtf/Noncopyable.h:
+
+2012-09-26  Mark Hahnenberg  <mhahnenberg@apple.com>
+
+        Clean up HasTrivialConstructor/Destructor
+        https://bugs.webkit.org/show_bug.cgi?id=97754
+
+        Reviewed by Darin Adler.
+
+        Cleaned up HasTrivialConstructor and HasTrivialDestructor by defining them in terms of 
+        other type traits we have. Also moved some ifdefs and comments to make things more clear.
+
+        * wtf/TypeTraits.h:
+
+2012-09-27  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI: move visited and countObjectSize methods implementation into separate class.
+        https://bugs.webkit.org/show_bug.cgi?id=97461
+
+        Reviewed by Yury Semikhatsky.
+
+        These methods and the data collected by them need to be used in the instrumentation code for other components.
+        As example when we are visiting bitmaps we need to visit platform specific objects.
+        These objects will be instrumented with help of component's own instrumentation code
+        but we have to keep the single set of visited objects and the map of counters.
+
+        * wtf/MemoryInstrumentation.h:
+        (MemoryInstrumentationClient):
+        (WTF::MemoryInstrumentationClient::~MemoryInstrumentationClient):
+        (WTF):
+        (WTF::MemoryInstrumentation::MemoryInstrumentation):
+        (MemoryInstrumentation):
+        (WTF::MemoryInstrumentation::countObjectSize):
+        (WTF::MemoryInstrumentation::visited):
+
+2012-09-27  Csaba Osztrogonác  <ossy@webkit.org>, Tor Arne Vestbø  <vestbo@webkit.org>
+
+        [Qt] Enable the LLInt on Linux
+        https://bugs.webkit.org/show_bug.cgi?id=95749
+
+        Reviewed by Simon Hausmann.
+
+        * wtf/Platform.h:
+
+2012-09-26  Cosmin Truta  <ctruta@rim.com>
+
+        [BlackBerry] Allow denormal floats in ARM VFP
+        https://bugs.webkit.org/show_bug.cgi?id=97008
+
+        Reviewed by Filip Pizlo.
+        Reviewed internally by Yong Li.
+
+        Cleared the Flush-to-Zero flag in the ARM FPSCR register on QNX.
+
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::enableIEEE754Denormal): Added.
+        (WTF::initializeThreading):
+        (WTF::initializeCurrentThreadInternal):
+
+2012-09-26  Michael Saboff  <msaboff@apple.com>
+
+        Update ComplexTextController for 8 bit TextRun changes
+        https://bugs.webkit.org/show_bug.cgi?id=97378
+
+        Reviewed by Geoffrey Garen.
+
+        Add a new create method to make a 16 bit string from 8 bit source data.  This is used in 
+        ComplexTextController when we have LChar* + length text data, but we really want 16 bit
+        data for the complex text rendering code.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::make16BitFrom8BitSource):
+        (WTF):
+        * wtf/text/WTFString.h:
+        (String):
+
+2012-09-26  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI: replace manual JS external resources counting with MemoryInstrumentation
+        https://bugs.webkit.org/show_bug.cgi?id=97662
+
+        Reviewed by Yury Semikhatsky.
+
+        Old schema uses sizeInBytes method on StringImpl. This method works incorrect for substrings.
+        Also we'd like to know exact pointers to strings and buffers for verification purposes.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/MemoryInstrumentationArrayBufferView.h:
+        (WTF):
+        (WTF::reportMemoryUsage):
+
+2012-09-25  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: extract HashSet instrumentation from core NMI code and put it into MemoryInstrumentationHashSet.h
+        https://bugs.webkit.org/show_bug.cgi?id=97198
+
+        Reviewed by Yury Semikhatsky.
+
+        Current implementation has overloads for HashSet.
+        This prevents us from instrumenting complex cases like Vector<HashSet<...> >.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/HashSet.h:
+        (WTF):
+        (HashSet):
+        * wtf/HashTable.h:
+        (WTF):
+        (HashTable):
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryClassInfo::addCollectionElements):
+        (WTF::MemoryClassInfo::addHashCountedSet):
+        * wtf/MemoryInstrumentationHashSet.h: Added.
+        (WTF):
+        (WTF::reportMemoryUsage):
+        * wtf/MemoryInstrumentationHashTable.h: Added.
+        (WTF):
+        (WTF::reportMemoryUsage):
+
+2012-09-26  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: compare objects counted by the memory instrumentation with those allocated in the heap
+        https://bugs.webkit.org/show_bug.cgi?id=97641
+
+        Reviewed by Pavel Feldman.
+
+        Added a method for checking if reported object was actually allocated in the heap.
+
+        * wtf/MemoryInstrumentation.h:
+        (MemoryInstrumentation):
+        (WTF::MemoryInstrumentation::addObjectImpl):
+
+2012-09-26  Gavin Barraclough  <barraclough@apple.com>
+
+        String.localeCompare should normalize input
+        https://bugs.webkit.org/show_bug.cgi?id=97639
+
+        Reviewed by Filip Pizlo.
+
+        From the spec: "It is strongly recommended that this function treat Strings that are
+        canonically equivalent according to the Unicode standard as identical (in other words,
+        compare the Strings as if they had both been converted to Normalised Form C or D first).
+        It is also recommended that this function not honour Unicode compatibility equivalences
+        or decompositions."
+
+        * wtf/unicode/icu/CollatorICU.cpp:
+        (WTF::Collator::createCollator):
+            - Enable normalization.
+
+2012-09-25  Cosmin Truta  <ctruta@rim.com>
+
+        [BlackBerry] Enable LLInt
+        https://bugs.webkit.org/show_bug.cgi?id=97604
+
+        Reviewed by Yong Li.
+
+        Set the prefix of LOCAL_LABEL_STRING to ".L" on QNX.
+
+        * wtf/InlineASM.h:
+
+2012-09-25  Patrick Gansterer  <paroga@webkit.org>
+
+        Do not enable DFG JIT for COMPILER(MSVC).
+
+        The current code does not support MSVC inline assembler, so disable it for now.
+
+        * wtf/Platform.h:
+
+2012-09-25  Pratik Solanki  <psolanki@apple.com>
+
+        Remove HAVE_SBRK since we never set use_sbrk to true
+        https://bugs.webkit.org/show_bug.cgi?id=97525
+        <rdar://problem/12363601>
+
+        Reviewed by Geoffrey Garen.
+
+        The code under HAVE(SBRK) has not been used since 2005. We use mmap not sbrk for FastMalloc
+        not sbrk. We can just remove the define and move all of this code inside #ifndef
+        WTF_CHANGES.
+
+        * wtf/Platform.h:
+        * wtf/TCSystemAlloc.cpp:
+        (TCMalloc_SystemAlloc):
+
+2012-09-25  Mark Lam  <mark.lam@apple.com>
+
+        #undef some symbols before redefining them.
+        https://bugs.webkit.org/show_bug.cgi?id=97568.
+
+        Reviewed by Michael Saboff.
+
+        * wtf/Platform.h:
+
+2012-09-21  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: extract Vector instrumentation from core NMI code into MemoryInstrumentationVector.h header.
+        https://bugs.webkit.org/show_bug.cgi?id=96650
+
+        Reviewed by Vsevolod Vlasov.
+
+        Added reportMemoryUsage free template function with default body to core NMI code
+        and add custom version of reportMemoryUsage function for Vectors.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/MemoryInstrumentation.h:
+        (WTF):
+        (MemoryInstrumentation):
+        (WTF::MemoryInstrumentation::addObjectImpl):
+        * wtf/MemoryInstrumentationVector.h: Added.
+        (WTF):
+        (WTF::instrumentVectorValues):
+        (WTF::reportMemoryUsage):
+
+2012-09-24  Mark Lam  <mark.lam@apple.com>
+
+        Deleting the classic interpreter and cleaning up some build options.
+        https://bugs.webkit.org/show_bug.cgi?id=96969.
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/OSAllocatorPosix.cpp:
+        (WTF::OSAllocator::reserveAndCommit):
+        * wtf/Platform.h:
+
+2012-09-24  Patrick Gansterer  <paroga@webkit.org>
+
+        Remove String::operator+=()
+        https://bugs.webkit.org/show_bug.cgi?id=96172
+
+        Reviewed by Benjamin Poulain.
+
+        * wtf/Platform.h:
+        * wtf/text/WTFString.h:
+
+2012-09-24  Benjamin Poulain  <benjamin@webkit.org>
+
+        Add support for query encoding to WTFURL
+        https://bugs.webkit.org/show_bug.cgi?id=97422
+
+        Reviewed by Adam Barth.
+
+        Expose character conversion through the new abstract class URLQueryCharsetConverter.
+        URLQueryCharsetConverter is implemented by WebCore to expose the TextEncoding classes.
+
+        Unfortunatelly that forces us to bring over URLBuffer in the public API. We may be able
+        to mitigate that later when moving WTFURL to more templates.
+
+        The change fixes 2 of the URL layout tests.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/url/api/ParsedURL.cpp:
+        (WTF::ParsedURL::ParsedURL):
+        * wtf/url/api/ParsedURL.h:
+        (ParsedURL):
+        ParsedURL was using the same constructor for ParsedURLString, and URL without a base.
+        That was a mistake on my part, I did not intend that, fixed it now :)
+
+        * wtf/url/api/URLBuffer.h: Renamed from Source/WTF/wtf/url/src/URLBuffer.h.
+        (URLBuffer):
+        (WTF::URLBuffer::URLBuffer):
+        (WTF::URLBuffer::~URLBuffer):
+        (WTF::URLBuffer::at):
+        (WTF::URLBuffer::set):
+        (WTF::URLBuffer::capacity):
+        (WTF::URLBuffer::length):
+        (WTF::URLBuffer::data):
+        (WTF::URLBuffer::setLength):
+        (WTF::URLBuffer::append):
+        (WTF::URLBuffer::grow):
+        * wtf/url/api/URLQueryCharsetConverter.h: Added.
+        (URLQueryCharsetConverter):
+        (WTF::URLQueryCharsetConverter::URLQueryCharsetConverter):
+        (WTF::URLQueryCharsetConverter::~URLQueryCharsetConverter):
+        * wtf/url/src/URLCanon.h:
+        (URLCanonicalizer):
+        * wtf/url/src/URLCanonFilesystemurl.cpp:
+        (WTF::URLCanonicalizer::canonicalizeFileSystemURL):
+        (WTF::URLCanonicalizer::ReplaceFileSystemURL):
+        * wtf/url/src/URLCanonFileurl.cpp:
+        (WTF::URLCanonicalizer::CanonicalizeFileURL):
+        (WTF::URLCanonicalizer::ReplaceFileURL):
+        * wtf/url/src/URLCanonInternal.h:
+        (URLCanonicalizer):
+        * wtf/url/src/URLCanonQuery.cpp:
+        (WTF::URLCanonicalizer::CanonicalizeQuery):
+        (WTF::URLCanonicalizer::ConvertUTF16ToQueryEncoding):
+        * wtf/url/src/URLCanonRelative.cpp:
+        (WTF::URLCanonicalizer::resolveRelativeURL):
+        * wtf/url/src/URLCanonStdURL.cpp:
+        (WTF::URLCanonicalizer::CanonicalizeStandardURL):
+        (WTF::URLCanonicalizer::ReplaceStandardURL):
+        * wtf/url/src/URLUtil.cpp:
+        (URLUtilities):
+        (WTF::URLUtilities::canonicalize):
+        (WTF::URLUtilities::resolveRelative):
+        (WTF::URLUtilities::ReplaceComponents):
+        * wtf/url/src/URLUtil.h:
+        (URLUtilities):
+
+2012-09-24  Benjamin Poulain  <benjamin@webkit.org>
+
+        Integrate most of GoogleURL in WTFURL
+        https://bugs.webkit.org/show_bug.cgi?id=97405
+
+        Reviewed by Adam Barth.
+
+        This patch brings almost all of the implementatation of Google-URL in WTFURL
+        with only minor changes.
+
+        The changes from the original code are mostly:
+        -Code cleaning.
+        -Replace url_parse::Parsed by URLSegments.
+        -Replace url_parse::Component by URLComponent
+        -More code cleaning.
+        -Adopt URLBuffer and RawURLBuffer instead of the CanonOutputT and RawCanonOutputT.
+        -Use URLCharacterTypes instead of the litany of characters functions.
+        -Some more code cleaning.
+        -Fix the style to match WebKit as much as possible.
+        -Rename the files to match WebKit style.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/url/api/ParsedURL.cpp:
+        (WTF::ParsedURL::ParsedURL):
+        (WTF::ParsedURL::segment):
+        * wtf/url/api/ParsedURL.h:
+        (WTF::ParsedURL::isValid):
+        * wtf/url/src/RawURLBuffer.h:
+        * wtf/url/src/URLCanon.h: Added.
+        (URLCanonicalizer):
+        (CharsetConverter):
+        (WTF::URLCanonicalizer::CharsetConverter::CharsetConverter):
+        (WTF::URLCanonicalizer::CharsetConverter::~CharsetConverter):
+        (CanonHostInfo):
+        (WTF::URLCanonicalizer::CanonHostInfo::CanonHostInfo):
+        (WTF::URLCanonicalizer::CanonHostInfo::IsIPAddress):
+        (WTF::URLCanonicalizer::CanonHostInfo::AddressLength):
+        (URLComponentSource):
+        (WTF::URLCanonicalizer::URLComponentSource::URLComponentSource):
+        (Replacements):
+        (WTF::URLCanonicalizer::Replacements::Replacements):
+        (WTF::URLCanonicalizer::Replacements::SetScheme):
+        (WTF::URLCanonicalizer::Replacements::IsSchemeOverridden):
+        (WTF::URLCanonicalizer::Replacements::SetUsername):
+        (WTF::URLCanonicalizer::Replacements::ClearUsername):
+        (WTF::URLCanonicalizer::Replacements::IsUsernameOverridden):
+        (WTF::URLCanonicalizer::Replacements::SetPassword):
+        (WTF::URLCanonicalizer::Replacements::ClearPassword):
+        (WTF::URLCanonicalizer::Replacements::IsPasswordOverridden):
+        (WTF::URLCanonicalizer::Replacements::SetHost):
+        (WTF::URLCanonicalizer::Replacements::ClearHost):
+        (WTF::URLCanonicalizer::Replacements::IsHostOverridden):
+        (WTF::URLCanonicalizer::Replacements::SetPort):
+        (WTF::URLCanonicalizer::Replacements::ClearPort):
+        (WTF::URLCanonicalizer::Replacements::IsPortOverridden):
+        (WTF::URLCanonicalizer::Replacements::SetPath):
+        (WTF::URLCanonicalizer::Replacements::ClearPath):
+        (WTF::URLCanonicalizer::Replacements::IsPathOverridden):
+        (WTF::URLCanonicalizer::Replacements::SetQuery):
+        (WTF::URLCanonicalizer::Replacements::ClearQuery):
+        (WTF::URLCanonicalizer::Replacements::IsQueryOverridden):
+        (WTF::URLCanonicalizer::Replacements::SetRef):
+        (WTF::URLCanonicalizer::Replacements::ClearRef):
+        (WTF::URLCanonicalizer::Replacements::IsRefOverridden):
+        (WTF::URLCanonicalizer::Replacements::sources):
+        (WTF::URLCanonicalizer::Replacements::components):
+        (WTF::URLCanonicalizer::Replacements::Placeholder):
+        * wtf/url/src/URLCanonEtc.cpp: Added.
+        (WTF::URLCanonicalizer::removeURLWhitespace):
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::canonicalSchemeChar):
+        (WTF::URLCanonicalizer::CanonicalizeScheme):
+        (WTF::URLCanonicalizer::CanonicalizeUserInfo):
+        (WTF::URLCanonicalizer::CanonicalizePort):
+        (WTF::URLCanonicalizer::CanonicalizeRef):
+        * wtf/url/src/URLCanonFilesystemurl.cpp: Added.
+        (WTF::URLCanonicalizer::CanonicalizeFileSystemURL):
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::ReplaceFileSystemURL):
+        * wtf/url/src/URLCanonFileurl.cpp: Added.
+        (WTF::URLCanonicalizer::CanonicalizeFileURL):
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::FileCanonicalizePath):
+        (WTF::URLCanonicalizer::ReplaceFileURL):
+        * wtf/url/src/URLCanonHost.cpp: Added.
+        (WTF::URLCanonicalizer::CanonicalizeHost):
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::CanonicalizeHostVerbose):
+        * wtf/url/src/URLCanonICU.cpp: Added.
+        (WTF::URLCanonicalizer::IDNToASCII):
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::readUTFChar):
+        * wtf/url/src/URLCanonIP.cpp: Added.
+        (WTF::URLCanonicalizer::CanonicalizeIPAddress):
+        (URLCanonicalizer):
+        * wtf/url/src/URLCanonInternal.cpp: Added.
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::AppendInvalidNarrowString):
+        (WTF::URLCanonicalizer::ConvertUTF16ToUTF8):
+        (WTF::URLCanonicalizer::ConvertUTF8ToUTF16):
+        (WTF::URLCanonicalizer::SetupOverrideComponents):
+        (WTF::URLCanonicalizer::SetupUTF16OverrideComponents):
+        (WTF::URLCanonicalizer::_itoa_s):
+        (WTF::URLCanonicalizer::_itow_s):
+        * wtf/url/src/URLCanonInternal.h: Added.
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::hexCharToValue):
+        (WTF::URLCanonicalizer::isDot):
+        (WTF::URLCanonicalizer::appendURLEscapedCharacter):
+        (WTF::URLCanonicalizer::doAppendUTF8):
+        (WTF::URLCanonicalizer::AppendCharToOutput):
+        (WTF::URLCanonicalizer::AppendUTF8Value):
+        (WTF::URLCanonicalizer::AppendUTF8EscapedValue):
+        (WTF::URLCanonicalizer::AppendUTF16Value):
+        (WTF::URLCanonicalizer::AppendUTF8EscapedChar):
+        (WTF::URLCanonicalizer::Is8BitChar):
+        (WTF::URLCanonicalizer::DecodeEscaped):
+        (WTF::URLCanonicalizer::_itoa_s):
+        (WTF::URLCanonicalizer::_itow_s):
+        (WTF::URLCanonicalizer::_strtoui64):
+        * wtf/url/src/URLCanonMailto.cpp: Added.
+        (WTF::URLCanonicalizer::CanonicalizeMailtoURL):
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::ReplaceMailtoURL):
+        * wtf/url/src/URLCanonPath.cpp: Added.
+        (WTF::URLCanonicalizer::CanonicalizePath):
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::CanonicalizePartialPath):
+        * wtf/url/src/URLCanonPathurl.cpp: Added.
+        (WTF::URLCanonicalizer::canonicalizePathURL):
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::ReplacePathURL):
+        * wtf/url/src/URLCanonQuery.cpp: Added.
+        (WTF::URLCanonicalizer::CanonicalizeQuery):
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::ConvertUTF16ToQueryEncoding):
+        * wtf/url/src/URLCanonRelative.cpp: Added.
+        (WTF::URLCanonicalizer::isRelativeURL):
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::resolveRelativeURL):
+        * wtf/url/src/URLCanonStdURL.cpp: Added.
+        (WTF::URLCanonicalizer::DefaultPortForScheme):
+        (URLCanonicalizer):
+        (WTF::URLCanonicalizer::CanonicalizeStandardURL):
+        (WTF::URLCanonicalizer::ReplaceStandardURL):
+        * wtf/url/src/URLCharacterTypes.cpp:
+        * wtf/url/src/URLCharacterTypes.h:
+        (WTF::URLCharacterTypes::isComponentChar):
+        (WTF::URLCharacterTypes::isHexChar):
+        (WTF::URLCharacterTypes::isIPv4Char):
+        (WTF::URLCharacterTypes::isQueryChar):
+        (WTF::URLCharacterTypes::isCharacterOfType):
+        (URLCharacterTypes):
+        * wtf/url/src/URLEscape.cpp: Removed.
+        * wtf/url/src/URLFile.h: Added.
+        (URLParser):
+        (WTF::URLParser::isWindowsDriveSeparator):
+        (WTF::URLParser::isWindowsDriveLetter):
+        (WTF::URLParser::findNextSlash):
+        (WTF::URLParser::doesBeginWindowsDriveSpec):
+        (WTF::URLParser::doesBeginUNCPath):
+        * wtf/url/src/URLParse.cpp: Added.
+        (WTF::URLParser::ExtractScheme):
+        (URLParser):
+        (WTF::URLParser::IsAuthorityTerminator):
+        (WTF::URLParser::ExtractFileName):
+        (WTF::URLParser::ExtractQueryKeyValue):
+        (WTF::URLParser::ParseAuthority):
+        (WTF::URLParser::ParsePort):
+        (WTF::URLParser::ParseStandardURL):
+        (WTF::URLParser::ParsePathURL):
+        (WTF::URLParser::ParseFileSystemURL):
+        (WTF::URLParser::ParseMailtoURL):
+        (WTF::URLParser::parsePathInternal):
+        (WTF::URLParser::ParseAfterScheme):
+        * wtf/url/src/URLParse.h: Added.
+        (URLParser):
+        * wtf/url/src/URLParseFile.cpp: Added.
+        (WTF):
+        (WTF::URLParser::ParseFileURL):
+        (URLParser):
+        * wtf/url/src/URLParseInternal.h: Added.
+        (URLParser):
+        (WTF::URLParser::isURLSlash):
+        (WTF::URLParser::shouldTrimFromURL):
+        (WTF::URLParser::trimURL):
+        (WTF::URLParser::countConsecutiveSlashes):
+        * wtf/url/src/URLParser.h: Removed.
+        * wtf/url/src/URLQueryCanonicalizer.h: Removed.
+        * wtf/url/src/URLSegments.cpp:
+        * wtf/url/src/URLSegments.h:
+        (WTF::URLSegments::URLSegments):
+        (URLSegments):
+        (WTF::URLSegments::operator=):
+        (WTF::URLSegments::innerURLSegments):
+        (WTF::URLSegments::setInnerURLSegments):
+        (WTF::URLSegments::clearInnerURLSegments):
+        * wtf/url/src/URLUtil.cpp: Added.
+        (URLUtilities):
+        (WTF::URLUtilities::IsStandard):
+        (WTF::URLUtilities::FindAndCompareScheme):
+        (WTF::URLUtilities::Canonicalize):
+        (WTF::URLUtilities::resolveRelative):
+        (WTF::URLUtilities::ReplaceComponents):
+        (WTF::URLUtilities::LowerCaseEqualsASCII):
+        (WTF::URLUtilities::DecodeURLEscapeSequences):
+        (WTF::URLUtilities::EncodeURIComponent):
+        (WTF::URLUtilities::CompareSchemeComponent):
+        * wtf/url/src/URLUtil.h: Added.
+        (URLUtilities):
+        * wtf/url/src/URLUtilInternal.h: Renamed from Source/WTF/wtf/url/src/URLEscape.h.
+        (URLUtilities):
+
+2012-09-24  Joone Hur  <joone.hur@intel.com>
+
+        [GTK] Implement GraphicsLayer using Clutter
+        https://bugs.webkit.org/show_bug.cgi?id=73767
+
+        Reviewed by Martin Robinson.
+
+        Add ClutterActor and GraphicsLayerActor to GTypedefs.h.
+
+        * wtf/gobject/GTypedefs.h:
+
+2012-09-23  Byungwoo Lee  <bw80.lee@gmail.com>
+
+        Fix build warnings : -Wunused-parameter, -Wparentheses, -Wuninitialized.
+        https://bugs.webkit.org/show_bug.cgi?id=97306
+
+        Reviewed by Benjamin Poulain.
+
+        Fix build warning about -Wunused-parameter on FastMalloc.cpp,
+        OSAllocatorPosix.cpp by using UNUSED_PARAM() macro.
+        Fix header including order of FastMalloc.cpp.
+
+        * wtf/FastMalloc.cpp:
+        (WTF::fastMallocSize):
+        * wtf/OSAllocatorPosix.cpp:
+        (WTF::OSAllocator::reserveAndCommit):
+
+2012-09-22  Sam Weinig  <sam@webkit.org>
+
+        Add explicit conversion operator to RetainPtr for easier use in C++11 environments
+        https://bugs.webkit.org/show_bug.cgi?id=97403
+
+        Reviewed by Dan Bernstein.
+
+        * wtf/Compiler.h:
+        Add support for COMPILER_SUPPORTS(CXX_EXPLICIT_CONVERSIONS)
+
+        * wtf/RetainPtr.h:
+        (RetainPtr):
+        (WTF::RetainPtr::get):
+        (WTF::RetainPtr::operator PtrType):
+        Add the explicit conversion operator and group all the underlying
+        pointer accessors together.
+
+2012-09-21  Simon Hausmann  <simon.hausmann@digia.com>
+
+        [Qt] Error out early if we don't have ICU available
+
+        Reviewed by Tor Arne Vestbø.
+
+        * WTF.pri:
+
+2012-09-20  Patrick Gansterer  <paroga@webkit.org>
+
+        Add String::numberToStringFixedWidth()
+        https://bugs.webkit.org/show_bug.cgi?id=96330
+
+        Reviewed by Benjamin Poulain.
+
+        Add this new function as replacement for the ShouldRoundDecimalPlaces flag of String::number()
+        and remove the now unnecessary branch in String::number() for the old flags.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::number):
+        (WTF::String::numberToStringFixedWidth):
+        * wtf/text/WTFString.h:
+
+2012-09-19  Geoffrey Garen  <ggaren@apple.com>
+
+        OSR exit sometimes neglects to create the arguments object
+        https://bugs.webkit.org/show_bug.cgi?id=97162
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/HashTraits.h:
+        (NullableHashTraits):
+        (WTF::NullableHashTraits::emptyValue):
+        (WTF):
+
+2012-09-18  Glenn Adams  <glenn@skynav.com>
+
+        WTFString::show doesn't dump non-ASCII characters in a readable manner
+        https://bugs.webkit.org/show_bug.cgi?id=96749
+
+        Reviewed by Benjamin Poulain.
+
+        Dump non-ASCII characters in a useful form for debugging.
+
+        * wtf/text/WTFString.cpp:
+        (asciiDebug):
+        Dump non-ASCII characters (i.e., UTF-16 code elements) as well as non-printable ASCII characters
+        using \uXXXX format. Also escape \ as \\ in order to remove ambiguity.
+
+2012-09-18  Mark Hahnenberg  <mhahnenberg@apple.com>
+
+        Use WTF::HasTrivialDestructor instead of compiler-specific versions in JSC::NeedsDestructor
+        https://bugs.webkit.org/show_bug.cgi?id=96980
+
+        Reviewed by Benjamin Poulain.
+
+        * wtf/TypeTraits.h:
+        (WTF):
+
+2012-09-17  Glenn Adams  <glenn@skynav.com>
+
+        Including HexNumber.h fails build if hexDigitsForMode is not referenced
+        https://bugs.webkit.org/show_bug.cgi?id=96873
+
+        Reviewed by Benjamin Poulain.
+
+        Ensure release build is possible when hexDigitsForMode is not referenced by
+        template expansion.
+
+        * wtf/HexNumber.h:
+        (WTF::Internal::hexDigitsForMode):
+        Change hexDigitsForMode to inline (rather than static). Make string literals
+        {lower,upper}HexDigits non-local and non-static, but const, to which the linker
+        should merge references in the RO data segment.
+
+2012-09-17  Filip Pizlo  <fpizlo@apple.com>
+
+        The ThreadRescrictionVerifier should be more forcibly disabled on systems that use threads
+        https://bugs.webkit.org/show_bug.cgi?id=96957
+
+        Reviewed by Oliver Hunt.
+
+        * wtf/ThreadRestrictionVerifier.h:
+        (WTF):
+        (WTF::ThreadRestrictionVerifier::ThreadRestrictionVerifier):
+        (ThreadRestrictionVerifier):
+        (WTF::ThreadRestrictionVerifier::setMutexMode):
+        (WTF::ThreadRestrictionVerifier::setDispatchQueueMode):
+        (WTF::ThreadRestrictionVerifier::turnOffVerification):
+        (WTF::ThreadRestrictionVerifier::setShared):
+        (WTF::ThreadRestrictionVerifier::isSafeToUse):
+
+2012-09-17  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r128796.
+        http://trac.webkit.org/changeset/128796
+        https://bugs.webkit.org/show_bug.cgi?id=96966
+
+        It broke everything (Requested by Ossy_NIGHT on #webkit).
+
+        * wtf/OSAllocatorPosix.cpp:
+        (WTF::OSAllocator::reserveUncommitted):
+        (WTF::OSAllocator::reserveAndCommit):
+        (WTF::OSAllocator::commit):
+        (WTF::OSAllocator::decommit):
+
+2012-09-17  Uli Schlachter  <psychon@znc.in>
+
+        Implement uncommitted memory for Linux.
+        https://bugs.webkit.org/show_bug.cgi?id=65766
+
+        Reviewed by Gavin Barraclough.
+
+        The old approach used MAP_NORESERVE to allocate address space without
+        committing it. However, that flag gets ignored if
+        /proc/sys/vm/overcommit_memory is set to 2. The new approach uses a
+        mapping with PROT_NONE. This works because mappings which aren't even
+        readable don't get accounted as committed on Linux.
+
+        * wtf/OSAllocatorPosix.cpp:
+        (WTF::OSAllocator::reserveUncommitted):
+        (WTF::OSAllocator::reserveAndCommit):
+        (WTF::OSAllocator::commit):
+        (WTF::OSAllocator::decommit):
+
+2012-09-17  Filip Pizlo  <fpizlo@apple.com>
+
+        Array profiling has convergence issues
+        https://bugs.webkit.org/show_bug.cgi?id=96891
+
+        Reviewed by Gavin Barraclough.
+
+        Added functions for testing if something is a power of 2.
+
+        * wtf/MathExtras.h:
+        (hasZeroOrOneBitsSet):
+        (hasTwoOrMoreBitsSet):
+
+2012-09-17  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI: now when we can detect instrumented classes we can
+        remove addInstrumentedMember and use addMember for everything.
+        https://bugs.webkit.org/show_bug.cgi?id=96913
+
+        Reviewed by Yury Semikhatsky.
+
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryInstrumentation::addRootObject):
+        (WTF::MemoryInstrumentation::addObject):
+        (WTF::MemoryInstrumentation::addObjectImpl):
+        (WTF):
+        (WTF::MemoryInstrumentation::addInstrumentedCollection):
+        (WTF::MemoryInstrumentation::addInstrumentedMapEntries):
+        (WTF::MemoryInstrumentation::addInstrumentedMapValues):
+        * wtf/text/AtomicString.cpp:
+        (WTF::AtomicString::reportMemoryUsage):
+        * wtf/text/CString.h:
+        (WTF::CString::reportMemoryUsage):
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::reportMemoryUsage):
+        * wtf/text/WTFString.cpp:
+        (WTF::String::reportMemoryUsage):
+        * wtf/url/api/ParsedURL.cpp:
+        (WTF::ParsedURL::reportMemoryUsage):
+        * wtf/url/api/URLString.cpp:
+        (WTF::URLString::reportMemoryUsage):
+
+2012-09-17  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Unreviewed compilation fix.
+
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryInstrumentation::reportObjectMemoryUsage):
+
+2012-09-15  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: automatically detect if class has reportMemoryUsage method
+        https://bugs.webkit.org/show_bug.cgi?id=96756
+
+        Reviewed by Alexander Pavlov.
+
+        Implemeted automatic selector of the memory reporting method. If
+        an object has reportMemoryUsage method then call it. Otherwise
+        count only object's self size. As the next step we will delete
+        addInstrumentedMember and addInstrumentedObjectImpl and will
+        have only addMember and addObjectImpl that would automatically
+        call reportMemoryUsage if it is present.
+
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryInstrumentation::selectInstrumentationMethod):
+        (MemoryInstrumentation):
+        (WTF::MemoryInstrumentation::reportObjectMemoryUsage):
+        (WTF::MemoryInstrumentation::addInstrumentedObjectImpl):
+        (WTF::MemoryInstrumentation::addObjectImpl):
+        (WTF::::process):
+
+2012-09-14  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: OwnPtr and RefPtr reported by pointer can be double counted by the memory instrumentation
+        https://bugs.webkit.org/show_bug.cgi?id=96791
+
+        Reviewed by Alexander Pavlov.
+
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryInstrumentation::addObjectImpl): check if the smart pointer has already
+        been visited before counting its size.
+
+2012-09-15  Benjamin Poulain  <benjamin@webkit.org>
+
+        Fix the build with WTF URL
+        https://bugs.webkit.org/show_bug.cgi?id=96875
+
+        Reviewed by Adam Barth.
+
+        Add support for MemoryInstrumentation to WTF's URL classes.
+
+        * wtf/url/api/ParsedURL.cpp:
+        (WTF::ParsedURL::reportMemoryUsage):
+        * wtf/url/api/ParsedURL.h:
+        (ParsedURL):
+        * wtf/url/api/URLString.cpp:
+        (WTF::URLString::reportMemoryUsage):
+        * wtf/url/api/URLString.h:
+        (URLString):
+
+2012-09-15  Raphael Kubo da Costa  <rakuco@FreeBSD.org>
+
+        llint: Implement LOCAL_LABEL_STRING for the BSD platforms.
+        https://bugs.webkit.org/show_bug.cgi?id=96870
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/InlineASM.h: Extend the definition of LOCAL_LABEL_STRING
+        currently used for OS(LINUX) to the BSDs, since they also normally
+        use GNU as, and clang/llvm seems to parse that syntax just fine as
+        well.
+
+2012-09-14  Alexey Proskuryakov  <ap@apple.com>
+
+        Minimize collisions when hashing pairs
+        https://bugs.webkit.org/show_bug.cgi?id=96022
+
+        Build fix (with newer clang?)
+
+        * wtf/HashFunctions.h: (WTF::pairIntHash): Be explicit about casting from
+        64 bit to 32 bit.
+
+2012-09-14  Dana Jansens  <danakj@chromium.org>
+
+        Minimize collisions when hashing pairs
+        https://bugs.webkit.org/show_bug.cgi?id=96022
+
+        Reviewed by Adrienne Walker.
+
+        The current hash function for pairs has poor performance as it does a
+        nice hash function on 64 bits, but then just drops the top 32 bits. The
+        hash method for pairs tries to use Thomas Wang's 64 bit Mix Function,
+        but this requires not dropping any bits in order to retain the
+        characteristics mentioned by Thomas.
+
+        A better method of hashing sets of 32-bit integers is to use
+        multiplication in 64 bits with random integers. This method is a
+        provably almost-universal hash function. Testing shows that this
+        method decreases the time required, when compared with the current
+        method, by more than 20% due to better hashing characteristics.
+
+        * wtf/HashFunctions.h:
+        (WTF):
+        (WTF::pairIntHash):
+        Implments the hashing method for a pair of unsigned integers.
+
+        (WTF::PairHash::hash):
+        Use pairIntHash() on the hash results of each object in the pair.
+
+        (WTF::IntPairHash::hash):
+        Implement an integer-specific PairHash class that does not need to
+        hash each object in the pair. It uses pairIntHash on the two
+        integers in the pair directly.
+
+        (WTF::IntPairHash::equal):
+        (IntPairHash):
+
+2012-09-14  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Make force_static_libs_as_shared work on Mac OS
+
+        We had to move a few LIBS += around that were in the wrong place,
+        and not caught when everything was just linked into the final
+        QtWebKit library.
+
+        Reviewed by Simon Hausmann.
+
+        * WTF.pri:
+
+2012-09-14  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI: convert template versions of String*::reportMemoryUsage functions to normal functions.
+        https://bugs.webkit.org/show_bug.cgi?id=96759
+
+        Reviewed by Yury Semikhatsky.
+
+        Now when MemoryInstrumentation.h is a part of WTF we can move reportMemoryUsage functions to cpp file.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::AtomicString::reportMemoryUsage):
+        (WTF):
+        * wtf/text/AtomicString.h:
+        (WTF):
+        (AtomicString):
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::reportMemoryUsage):
+        (WTF):
+        * wtf/text/StringImpl.h:
+        (WTF):
+        (StringImpl):
+        * wtf/text/WTFString.cpp:
+        (WTF::String::reportMemoryUsage):
+        (WTF):
+        * wtf/text/WTFString.h:
+        (WTF):
+        (String):
+
+2012-09-14  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI: remove current traits helper class because it is customizing the instrumentation at a wrong place and is not necessary at the moment.
+        https://bugs.webkit.org/show_bug.cgi?id=96737
+
+        Reviewed by Yury Semikhatsky.
+
+        * wtf/MemoryInstrumentation.h:
+        (MemoryInstrumentation):
+        WTF::MemoryInstrumentationTraits): removed
+        (WTF::MemoryInstrumentation::OwningTraits::addInstrumentedObject): direct call inserted
+        (WTF::MemoryInstrumentation::OwningTraits::addObject):direct call inserted
+
+2012-09-13  Kenneth Rohde Christiansen  <kenneth@webkit.org>
+
+        Evas_Object* is a ref'ed structure, so tread it as such
+        https://bugs.webkit.org/show_bug.cgi?id=96659
+
+        Reviewed by Gyuyoung Kim.
+
+        Remove OwnPtr support for Evas_Object* and add support for it
+        with RefPtr instead (the latter moved from WebCore).
+
+        * wtf/PlatformEfl.cmake:
+        * wtf/efl/OwnPtrEfl.cpp:
+        * wtf/efl/RefPtrEfl.cpp: Renamed from Source/WebCore/platform/efl/RefPtrEfl.cpp.
+        (WTF):
+        (WTF::refIfNotNull):
+        (WTF::derefIfNotNull):
+        * wtf/efl/RefPtrEfl.h: Renamed from Source/WebCore/platform/efl/RefPtrEfl.h.
+        (WTF):
+
+2012-09-14  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Unreviewed, rolling out r128507.
+        http://trac.webkit.org/changeset/128507
+        https://bugs.webkit.org/show_bug.cgi?id=96659
+
+        Revert. r128507 makes too many crash in EFL layout test bots.
+
+        * wtf/PlatformEfl.cmake:
+        * wtf/efl/OwnPtrEfl.cpp:
+        (WTF::deleteOwnedPtr):
+        (WTF):
+
+2012-09-13  Kevin Funk  <kevin.funk@kdab.com>
+
+        Make compile with both OS(WINCE) and PLATFORM(QT) support
+        https://bugs.webkit.org/show_bug.cgi?id=95536
+
+        Reviewed by Simon Hausmann.
+
+        Fixes for Windows CE.
+
+        * WTF.pri:
+        Also include path for mt19937ar.c
+        * wtf/unicode/icu/CollatorICU.cpp:
+        Fix undeclared strdup() on CE7
+        * wtf/Platform.h:
+
+2012-09-13  Byungseon Shin  <xingri@gmail.com>
+
+        Fix for WTF fails to compile in thumb mode when llint is enabled.
+        https://bugs.webkit.org/show_bug.cgi?id=96400
+
+        Reviewed by Filip Pizlo.
+
+        When using "+m" with Armv7 cross compiler assume offset range between +/- 4095
+        (the largest possible offset range).
+        However, ldrex/strex can only use offset range of 0~1020, so "+m" needed to be changed to "+Q".
+        Ref. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54480
+
+        * wtf/Atomics.h:
+        (WTF::weakCompareAndSwap):
+
+2012-09-13  Kenneth Rohde Christiansen  <kenneth@webkit.org>
+
+        Evas_Object* is a ref'ed structure, so tread it as such
+        https://bugs.webkit.org/show_bug.cgi?id=96659
+
+        Reviewed by Adam Barth.
+
+        Remove OwnPtr support for Evas_Object* and add support for it
+        with RefPtr instead (the latter moved from WebCore).
+
+        * wtf/PlatformEfl.cmake:
+        * wtf/efl/OwnPtrEfl.cpp:
+        * wtf/efl/RefPtrEfl.cpp: Renamed from Source/WebCore/platform/efl/RefPtrEfl.cpp.
+        (WTF):
+        (WTF::refIfNotNull):
+        (WTF::derefIfNotNull):
+        * wtf/efl/RefPtrEfl.h: Renamed from Source/WebCore/platform/efl/RefPtrEfl.h.
+        (WTF):
+
+2012-09-13  Michael Saboff  <msaboff@apple.com>
+
+        Added 8 bit path to WidthIterator::advance()
+        https://bugs.webkit.org/show_bug.cgi?id=96590
+
+        Reviewed by Geoffrey Garen.
+
+        Added new character constant for Hiragana Letter Small A.
+
+        * wtf/unicode/CharacterNames.h:
+        (Unicode):
+
+2012-09-13  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI: instrument KURL directly.
+        https://bugs.webkit.org/show_bug.cgi?id=96624
+
+        Reviewed by Yury Semikhatsky.
+
+        I replaced traits based instrumentation of KURL with reportMemoryUsage functions.
+        CString* were also instrumented.
+
+        Drive by fix: Instrumentation code in QualifiedName was moved to cpp.
+
+        * wtf/text/CString.h:
+        (CStringBuffer):
+        (WTF::CStringBuffer::reportMemoryUsage):
+        (CString):
+        (WTF::CString::reportMemoryUsage):
+
+2012-09-12  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI: migrate core instrumentation code to WTF namespace
+        https://bugs.webkit.org/show_bug.cgi?id=96511
+
+        Reviewed by Yury Semikhatsky.
+
+        After moving core NMI code to WTF namespace I removed forward declarations
+        of MemoryObjectInfo and MemoryInstrumentation from WebCore headers and add
+        forward declaration into wtf/Forward.h
+
+        * wtf/Forward.h:
+        (WTF):
+        * wtf/MemoryInstrumentation.h:
+
+2012-09-12  Dan Bernstein  <mitz@apple.com>
+
+        Removed a reference to a file that doesn’t participate in any target.
+
+        * WTF.xcodeproj/project.pbxproj: Removed the reference to
+        CONTRIBUTORS.pthreads-win32.
+
+2012-09-11  Michael Saboff  <msaboff@apple.com>
+
+        Element::classAttributeChanged should use characters8/16 to find first non-whitespace
+        https://bugs.webkit.org/show_bug.cgi?id=96446
+
+        Reviewed by Benjamin Poulain.
+
+        Added bit size related string accessors to AtomicString to support change.
+
+        * wtf/text/AtomicString.h:
+        (AtomicString):
+        (WTF::AtomicString::is8Bit):
+        (WTF::AtomicString::characters8):
+        (WTF::AtomicString::characters16):
+
+2012-09-12  Michael Saboff  <msaboff@apple.com>
+
+        Build fixed for http://trac.webkit.org/changeset/128243
+
+        Unreviewed build fix.
+
+        Removed temporarily added function signature.
+
+        * icu/unicode/unistr.h:
+        (UnicodeString::extract):
+
+2012-09-12  Michael Saboff  <msaboff@apple.com>
+
+        Build fixed for http://trac.webkit.org/changeset/128243
+
+        Unreviewed build fix.
+
+        Change UnicodeString::extract for gcc based on ICU fix described in
+        http://bugs.icu-project.org/trac/ticket/8197.
+
+        * icu/unicode/unistr.h:
+        (UnicodeString::extract):
+
+2012-09-12  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI move String* instrumentation to wtf.
+        https://bugs.webkit.org/show_bug.cgi?id=96405
+
+        Reviewed by Yury Semikhatsky.
+
+        This instrumentation is solving the problem with substrings and removes traits based code which is hard to upstream.
+
+        Tested by webkit_unit_tests.
+
+        * wtf/text/AtomicString.h:
+        (AtomicString):
+        (WTF::AtomicString::reportMemoryUsage):
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+        (WTF::StringImpl::reportMemoryUsage):
+        * wtf/text/WTFString.h:
+        (String):
+        (WTF::String::reportMemoryUsage):
+
+2012-09-12  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r128279.
+        http://trac.webkit.org/changeset/128279
+        https://bugs.webkit.org/show_bug.cgi?id=96487
+
+        "Snow Leopard compilation broken" (Requested by yurys on
+        #webkit).
+
+        * wtf/MemoryInstrumentation.h:
+        (GenericMemoryTypes):
+        (WebCore):
+        (WebCore::MemoryInstrumentation::addRootObject):
+        (WebCore::MemoryObjectInfo::reportObjectInfo):
+        (WebCore::MemoryClassInfo::MemoryClassInfo):
+        * wtf/text/AtomicString.h:
+        (AtomicString):
+        * wtf/text/StringImpl.h:
+        * wtf/text/WTFString.h:
+
+2012-09-12  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: Persistent handle referenced from ScriptWrappable is double counted
+        https://bugs.webkit.org/show_bug.cgi?id=96483
+
+        Reviewed by Alexander Pavlov.
+
+        * wtf/MemoryInstrumentation.h:
+        (WebCore::MemoryClassInfo::addWeakPointer): this method is expected to be
+        used on fields that are pointers to objects which are parts of bigger memory
+        blocks (field of another object, element in an array, object allocated in a
+        memory arena etc.). We don't want to count such objects' memory separately
+        from their owners but in order to be able to validates the memory instrumentation
+        with clang plugin we need to make sure all fields in instrumented objects
+        are reported.
+        (MemoryClassInfo):
+
+2012-09-12  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI move String* instrumentation to wtf.
+        https://bugs.webkit.org/show_bug.cgi?id=96405
+
+        Reviewed by Yury Semikhatsky.
+
+        This instrumentation is solving the problem with substrings and removes traits based code which is hard to upstream.
+
+        Tested by webkit_unit_tests.
+
+        * wtf/MemoryInstrumentation.h:
+        (WebCore):
+        (WebCore::MemoryInstrumentation::addRootObject):
+        (WebCore::MemoryObjectInfo::reportObjectInfo):
+        (WebCore::MemoryClassInfo::MemoryClassInfo):
+        * wtf/text/AtomicString.h:
+        (AtomicString):
+        (WTF::AtomicString::reportMemoryUsage):
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+        (WTF::StringImpl::reportMemoryUsage):
+        * wtf/text/WTFString.h:
+        (String):
+        (WTF::String::reportMemoryUsage):
+
+2012-09-11  Michael Saboff  <msaboff@apple.com>
+
+        Build fixed for http://trac.webkit.org/changeset/128243
+
+        Unreviewed build fix.
+
+        Added missing include file needed by 96422 for C++ ICU APIs.
+
+        * icu/unicode/bytestream.h: Added.
+        * icu/unicode/rep.h: Added.
+        * icu/unicode/std_string.h: Added.
+        * icu/unicode/strenum.h: Added.
+        * icu/unicode/stringpiece.h: Added.
+        * icu/unicode/unistr.h: Added.
+        * icu/unicode/uobject.h: Added.
+
+2012-09-11  Michael Saboff  <msaboff@apple.com>
+
+        Build fixed for http://trac.webkit.org/changeset/128243
+
+        Rubber stamped by Stephanie Lewis.
+
+        Added missing include file needed by 96422.
+
+        * icu/unicode/unorm2.h: Added.
+
+2012-09-11  Michael Saboff  <msaboff@apple.com>
+
+        Build fixed for http://trac.webkit.org/changeset/128243
+
+        Rubber stamped by Stephanie Lewis.
+
+        Added missing include file needed by 96422.
+
+        * icu/unicode/ptypes.h: Added.
+
+2012-09-11  Michael Saboff  <msaboff@apple.com>
+
+        Update ICU header files to more recent version
+        https://bugs.webkit.org/show_bug.cgi?id=96422
+
+        Reviewed by Geoff Garen.
+
+        Updated ICU header files to 4.6.1.  Modifications made as part of the merge are:
+        platform.h - Changed ifndef / define / endif for U_HAVE_UINT8_T, U_HAVE_UINT16_T, U_HAVE_UINT32_T,
+            U_HAVE_UINT64_T, U_IS_BIG_ENDIAN and U_ENABLE_TRACING to match the existing platform.h
+        putil.h (line 132) - Changes defined(U_WINDOWS) to defined(WIN32) || defined(OS2) to match existing putil.h
+        ustring.h (line 945) - Wrapped macro argument cs with { (const UChar *)cs } to match existing ustring.h
+        utypes.h (line 545) - Changed defined(U_WINDOWS) to defined(WIN32) to match existing utypes.h
+
+        * icu/unicode/localpointer.h: Added.
+        * icu/unicode/parseerr.h:
+        * icu/unicode/platform.h:
+        * icu/unicode/putil.h:
+        * icu/unicode/uchar.h:
+        * icu/unicode/ucnv.h:
+        * icu/unicode/ucnv_err.h:
+        * icu/unicode/ucol.h:
+        * icu/unicode/uconfig.h:
+        * icu/unicode/uenum.h:
+        * icu/unicode/uiter.h:
+        * icu/unicode/uloc.h:
+        * icu/unicode/umachine.h:
+        * icu/unicode/unorm.h:
+        * icu/unicode/urename.h:
+        * icu/unicode/uscript.h:
+        * icu/unicode/uset.h:
+        * icu/unicode/ustring.h:
+        * icu/unicode/utf.h:
+        * icu/unicode/utf16.h:
+        * icu/unicode/utf8.h:
+        * icu/unicode/utypes.h:
+        * icu/unicode/uvernum.h: Added.
+        * icu/unicode/uversion.h:
+
+2012-09-11  Pratik Solanki  <psolanki@apple.com>
+
+        Add ObjcRuntimeExtras.h to the Xcode project file
+        https://bugs.webkit.org/show_bug.cgi?id=96419
+
+        Reviewed by Alexey Proskuryakov.
+
+        * WTF.xcodeproj/project.pbxproj:
+
+2012-09-11  Adrienne Walker  <enne@google.com>
+
+        Clang doesn't optimize away undefined OwnPtr copy constructor
+        https://bugs.webkit.org/show_bug.cgi?id=74625
+
+        Reviewed by Anders Carlsson.
+
+        Original patch by Anders Carlsson, with a minor edit.
+
+        The publicly declared-but-not-defined copy constructor is a compiler
+        optimization-dependent landmine. Clang often fails to optimize the use
+        of this function out, leading to internal linkage errors for the missing
+        definition. gcc doesn't have this problem and optimizes that function
+        out, leading to code that inconsistently fails to link across platforms.
+
+        As a partial fix for this problem, on any compiler that supports C++11
+        move semantics, replace the bogus copy constructor with the move
+        constructors.  In the future, if all compilers support this, then the
+        copy constructor can be removed.
+
+        This still leaves other compilers that don't support move semantics
+        like Visual Studio vulnerable to linking inconsistencies.
+
+        * wtf/OwnPtr.h:
+        (OwnPtr):
+        (WTF):
+        (WTF::::OwnPtr):
+        (WTF::=):
+
+2012-09-11  Raphael Kubo da Costa  <rakuco@webkit.org>
+
+        [EFL] Rewrite the EFL-related Find modules
+        https://bugs.webkit.org/show_bug.cgi?id=95237
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * CMakeLists.txt: Stop setting the LINK_FLAGS property.
+        * PlatformEfl.cmake: Add libraries and include directories for
+        each Enlightenment Foundation Library used by the port.
+
+2012-09-11  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Add a configure step to the Qt build system
+
+        This allows building the Qt port using just 'qmake WebKit.pro'. Using
+        the build-webkit script is still supported, and will add slightly more
+        logic to the build, such as detecting the need for clean or incremental
+        builds.
+
+        Internally, the build system now uses a new variable, WEBKIT_CONFIG, for
+        all things related to configuring the build, such as use/have/enable flags,
+        and these are translated to defines in default_post. Project files should
+        no longer check contains(DEFINES,...) to detect features, but use the new
+        enable?(), use?(), and have?() functions. The no_webkit1 and no_webkit2
+        options have been translated into WEBKIT_CONFIG options as well, and can
+        be checked using build?().
+
+        Reviewed by Simon Hausmann.
+
+        * WTF.pri:
+        * wtf/Platform.h:
+
+2012-09-10  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: NMI: move MemoryInstrumentation.h to wtf
+        https://bugs.webkit.org/show_bug.cgi?id=96356
+
+        Reviewed by Yury Semikhatsky.
+
+        It is necessary step because it helps us to remove dependency between platform and WebCore.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/MemoryInstrumentation.h: Renamed from Source/WebCore/dom/MemoryInstrumentation.h.
+        (WebCore):
+        (GenericMemoryTypes):
+        (MemoryInstrumentationTraits):
+        (MemoryInstrumentation):
+        (WebCore::MemoryInstrumentation::~MemoryInstrumentation):
+        (WebCore::MemoryInstrumentation::addRootObject):
+        (InstrumentedPointerBase):
+        (WebCore::MemoryInstrumentation::InstrumentedPointerBase::~InstrumentedPointerBase):
+        (InstrumentedPointer):
+        (WebCore::MemoryInstrumentation::InstrumentedPointer::InstrumentedPointer):
+        (WebCore::MemoryInstrumentation::addObject):
+        (WebCore::MemoryInstrumentation::addInstrumentedObject):
+        (WebCore::MemoryInstrumentation::addRawBuffer):
+        (WebCore::MemoryInstrumentation::OwningTraits::addInstrumentedObject):
+        (WebCore::MemoryInstrumentation::OwningTraits::addObject):
+        (WebCore::MemoryInstrumentationTraits::addInstrumentedObject):
+        (WebCore::MemoryInstrumentationTraits::addObject):
+        (MemoryObjectInfo):
+        (WebCore::MemoryObjectInfo::MemoryObjectInfo):
+        (WebCore::MemoryObjectInfo::objectType):
+        (WebCore::MemoryObjectInfo::objectSize):
+        (WebCore::MemoryObjectInfo::memoryInstrumentation):
+        (WebCore::MemoryObjectInfo::reportObjectInfo):
+        (MemoryClassInfo):
+        (WebCore::MemoryClassInfo::MemoryClassInfo):
+        (WebCore::MemoryClassInfo::addInstrumentedMember):
+        (WebCore::MemoryClassInfo::addMember):
+        (WebCore::MemoryClassInfo::addHashMap):
+        (WebCore::MemoryClassInfo::addHashSet):
+        (WebCore::MemoryClassInfo::addHashCountedSet):
+        (WebCore::MemoryClassInfo::addInstrumentedHashSet):
+        (WebCore::MemoryClassInfo::addInstrumentedVector):
+        (WebCore::MemoryClassInfo::addInstrumentedVectorPtr):
+        (WebCore::MemoryClassInfo::addInstrumentedMapEntries):
+        (WebCore::MemoryClassInfo::addInstrumentedMapValues):
+        (WebCore::MemoryClassInfo::addListHashSet):
+        (WebCore::MemoryClassInfo::addVector):
+        (WebCore::MemoryClassInfo::addVectorPtr):
+        (WebCore::MemoryClassInfo::addRawBuffer):
+        (WebCore::MemoryInstrumentation::addInstrumentedObjectImpl):
+        (WebCore::MemoryInstrumentation::addObjectImpl):
+        (WebCore::MemoryInstrumentation::addHashMap):
+        (WebCore::MemoryInstrumentation::addHashSet):
+        (WebCore::MemoryInstrumentation::addInstrumentedCollection):
+        (WebCore::MemoryInstrumentation::addInstrumentedMapEntries):
+        (WebCore::MemoryInstrumentation::addInstrumentedMapValues):
+        (WebCore::MemoryInstrumentation::addListHashSet):
+        (WebCore::MemoryInstrumentation::addVector):
+        (WebCore::MemoryInstrumentation::calculateContainerSize):
+        (WebCore::::process):
+
+2012-09-09  Mark Lam  <mark.lam@apple.com>
+
+        Fixed ASSERT() and ASSERT_AT() macros so that they can be used in
+        comma expressions. Also, added UNUSED_LABEL().
+        https://bugs.webkit.org/show_bug.cgi?id=96127.
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/Assertions.h:
+        * wtf/UnusedParam.h: Added UNUSED_LABEL(). Removed an obsolete comment.
+
+2012-09-09  Patrick Gansterer  <paroga@webkit.org>
+
+        Add StringBuilder::appendNumber() and use it
+        https://bugs.webkit.org/show_bug.cgi?id=96030
+
+        Reviewed by Eric Seidel.
+
+        Also fix a bunch of append() vs. appendLiteral() issues in the surrounding code.
+
+        * wtf/DateMath.cpp:
+        (WTF::makeRFC2822DateString):
+        * wtf/text/StringBuilder.cpp:
+        (WTF::StringBuilder::appendNumber):
+        * wtf/text/StringBuilder.h:
+        (StringBuilder):
+
+2012-09-09  Patrick Gansterer  <paroga@webkit.org>
+
+        Make the String initialization on the function side of String::number()
+        https://bugs.webkit.org/show_bug.cgi?id=95940
+
+        Reviewed by Benjamin Poulain.
+
+        Un-Inline String::number() to make the String initialization done on the function side
+        instead of being on the caller side.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/text/IntegerToStringConversion.cpp: Removed.
+        * wtf/text/IntegerToStringConversion.h:
+        (WTF::numberToStringImpl):
+        (WTF::numberToStringSigned):
+        (WTF::numberToStringUnsigned):
+        * wtf/text/WTFString.cpp:
+        (WTF::String::number):
+        * wtf/text/WTFString.h:
+
+2012-09-08  Andreas Kling  <kling@webkit.org>
+
+        Give AtomicString SimpleClassVectorTraits.
+        <http://webkit.org/b/96186>
+
+        Reviewed by Karl Anders Carlsson.
+
+        AtomicString can be initialized/moved/compared with memset/memcpy/memcmp,
+        so add a VectorTraits<AtomicString> to make Vector<AtomicString> a little
+        more efficient.
+
+        * wtf/VectorTraits.h:
+
+2012-09-07  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r127938.
+        http://trac.webkit.org/changeset/127938
+        https://bugs.webkit.org/show_bug.cgi?id=96166
+
+        It broke the build (Requested by smfr on #webkit).
+
+        * wtf/Assertions.h:
+
+2012-09-07  Mark Lam  <mark.lam@apple.com>
+
+        Fixed ASSERT() and ASSERT_AT() macros so that they can be used in
+        comma expressions.
+        https://bugs.webkit.org/show_bug.cgi?id=96127.
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/Assertions.h:
+        (wtfAssert):
+
+2012-09-07  Michael Saboff  <msaboff@apple.com>
+
+        StringImpl::find(StringImpl*) doesn't handle cases where search and match strings are different bitness
+        https://bugs.webkit.org/show_bug.cgi?id=96125
+
+        Reviewed by Benjamin Poulain.
+
+        Changed findInner and reverseFindInner to be templated on both search and match character types.
+        Changed both find's and reverseFind to use all four bitness combinations of findInner and
+        reverseFindInner.
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::findInner):
+        (WTF::StringImpl::find):
+        (WTF::reverseFindInner):
+        (WTF::StringImpl::reverseFind):
+
+2012-09-07  Michael Saboff  <msaboff@apple.com>
+
+        equalIgnoringCase of two StringImpls doesn't handle 8 bit strings
+        https://bugs.webkit.org/show_bug.cgi?id=96028
+
+        Reviewed by Benjamin Poulain.
+
+        Added 8 bit checks and paths to CaseFoldingHash::equal.  Also cleaned up StringHash::equal(), removing
+        obvious and in one case wrong comments.  Moved equalIgnoringCase(UChar*, UChar*) from StringImpl.cpp
+        to StringImpl.h.
+
+        * wtf/text/StringHash.h:
+        (WTF::StringHash::equal):
+        (WTF::CaseFoldingHash::equal):
+        * wtf/text/StringImpl.cpp:
+        * wtf/text/StringImpl.h:
+        (WTF::equalIgnoringCase):
+
+2012-09-07  Patrick Gansterer  <paroga@webkit.org>
+
+        [WIN] Deprecate String += operator
+        https://bugs.webkit.org/show_bug.cgi?id=96083
+
+        Reviewed by Adam Barth.
+
+        * wtf/Platform.h:
+
+2012-09-06  Michael Saboff  <msaboff@apple.com>
+
+        StringBuilder::toAtomicString() can create an 16 bit string with 8 bit contents
+        https://bugs.webkit.org/show_bug.cgi?id=96029
+
+        Reviewed by Benjamin Poulain.
+
+        Added 8 bit path when creating an AtomicString from a partial 8 bit buffer.
+
+        * wtf/text/StringBuilder.h:
+        (WTF::StringBuilder::toAtomicString):
+
+2012-09-06  Michael Saboff  <msaboff@apple.com>
+
+        16 bit JSRopeString up converts an 8 bit fibers to 16 bits during resolution
+        https://bugs.webkit.org/show_bug.cgi?id=95810
+
+        Reviewed by Benjamin Poulain.
+
+        New copy routine that takes an 8 bit source and a 16 bit destination.  Used when copying
+        the contents of an 8 bit fiber to the 16 bit buffer when resolving a 16 bit rope.
+
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::copyChars):
+        (StringImpl):
+
+2012-09-06  Michael Saboff  <msaboff@apple.com>
+
+        Unreviewed fix to r127799.
+        https://bugs.webkit.org/show_bug.cgi?id=95807
+
+        Unreviewed fix.
+
+        Removed extraneous "static".  This code is hidden behind STRING_STATS define and 
+        therefore is not enabled by default.
+
+        * wtf/text/StringImpl.cpp:
+
+2012-09-06  Lauro Neto  <lauro.neto@openbossa.org>
+
+        [Qt] Deprecate String += operator
+        https://bugs.webkit.org/show_bug.cgi?id=95895
+
+        Reviewed by Benjamin Poulain.
+
+        Remove Qt from WTF_DEPRECATED_STRING_OPERATORS guard.
+
+        * wtf/Platform.h:
+
+2012-09-06  Michael Saboff  <msaboff@apple.com>
+
+        ENH: Add Logging to StringImpl to track String Types
+        https://bugs.webkit.org/show_bug.cgi?id=95807
+
+        Reviewed by Benjamin Poulain.
+
+        Added StringsStats class that keeps track of the number of strings, number of 8 and 16 bit
+        strings as well as the number of 8 bit strings up converted to 16 bits. The number of characrters
+        for each type is also accumulated. These statistics are output via DataLog every 5000
+        calls to StringImpl destructor. The 5000 can be adjusted via s_printStringStatsFrequency.
+        This StringStats code is disabled by default and enabled by defining STRING_STATS in
+        wtf/text/StringImpl.h.
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringStats::removeString):
+        (WTF::StringStats::printStats):
+        (WTF::StringImpl::~StringImpl):
+        (WTF::StringImpl::getData16SlowCase):
+        * wtf/text/StringImpl.h:
+        (WTF::StringStats::add8BitString):
+        (StringStats):
+        (WTF::StringStats::add16BitString):
+        (WTF::StringStats::addUpconvertedString):
+        (WTF::StringImpl::StringImpl):
+        (StringImpl):
+        (WTF::StringImpl::isSubString):
+        (WTF::StringImpl::stringStats):
+
+2012-09-06  Patrick Gansterer  <paroga@webkit.org>
+
+        Fix export macros in IntegerToStringConversion.h
+        https://bugs.webkit.org/show_bug.cgi?id=95900
+
+        Reviewed by Benjamin Poulain.
+
+        The WTF_EXPORT_STRING_API must be used only for symbols which are compiled
+        on windows in "non-WTF" binaries too. Since this isn't valid for the
+        IntegerToStringConversion function replace it with WTF_EXPORT_PRIVATE.
+
+        * wtf/text/IntegerToStringConversion.h:
+
+2012-09-06  Simon Hausmann  <simon.hausmann@nokia.com>
+
+        [Qt] Various small Windows / MSVC build fixes
+        https://bugs.webkit.org/show_bug.cgi?id=95934
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        For the Qt build on Windows, do not enable WTF_USE_UNIX_DOMAIN_SOCKETS for
+        WebKit2 IPC.
+
+        * wtf/Platform.h:
+
+2012-09-06  Adam Barth  <abarth@chromium.org>
+
+        Remove WTF::String::operator+=
+        https://bugs.webkit.org/show_bug.cgi?id=95797
+
+        Reviewed by Sam Weinig.
+
+        This patch encloses WTF::String::operator+= in an ifdef so that we can
+        gradually remove it from the various port-specific files. The ifdef
+        lets us whitelist use of operator+= in individual files during the
+        transition.
+
+        * wtf/Platform.h
+        * wtf/text/WTFString.h:
+
+2012-09-05  Gabor Rapcsanyi  <rgabor@webkit.org>
+
+        DFG JIT doesn't work properly on ARM hardfp
+        https://bugs.webkit.org/show_bug.cgi?id=95684
+
+        Reviewed by Filip Pizlo.
+
+        Add hardfp support to DFG JIT. The patch is created with the
+        help of Zoltan Herczeg.
+
+        * wtf/Platform.h:
+
+2012-09-04  Zoltan Horvath  <zoltan@webkit.org>
+
+        Extend the coverage of the Custom Allocation Framework in WTF and in JavaScriptCore
+        https://bugs.webkit.org/show_bug.cgi?id=95737
+
+        Reviewed by Eric Seidel.
+
+        Add WTF_MAKE_FAST_ALLOCATED macro to the following class declarations because these are instantiated by operator new.
+
+        * wtf/CryptographicallyRandomNumber.cpp: CryptographicallyRandomNumber is instantiated at wtf/CryptographicallyRandomNumber.cpp:162.
+        * wtf/MediaTime.h: MediaTime is instantiated at wtf/MediaTime.cpp:288.
+        * wtf/MetaAllocator.h:
+        (MetaAllocatorTracker): MetaAllocatorTracker is instantiated at JavaScriptCore/tools/CodeProfiling.cpp:120.
+        * wtf/ThreadingPthreads.cpp:
+        (PthreadState): PthreadState is instantiated at wtf/ThreadingPthreads.cpp:165.
+        * wtf/text/AtomicString.cpp:
+        (AtomicStringTable): AtomicStringTable is instantiated at wtf/text/AtomicString.cpp:43.
+
+2012-09-01  Mark Lam  <mark.lam@apple.com>
+
+        LLInt C loop backend.
+        https://bugs.webkit.org/show_bug.cgi?id=91052.
+
+        Reviewed by Filip Pizlo.
+
+        Added configs for the llint C loop backend.
+
+        * wtf/Platform.h:
+
+2012-08-31  Pratik Solanki  <psolanki@apple.com>
+
+        objc_msgSend and IMP should be cast appropriately before using
+        https://bugs.webkit.org/show_bug.cgi?id=95242
+
+        Reviewed by Benjamin Poulain.
+
+        Fix for older compilers. Pass id as the return type to the template
+        instead of relying on default type.
+
+        * wtf/Functional.h:
+        (WTF::R):
+        * wtf/ObjcRuntimeExtras.h:
+
+2012-08-31  Michael Saboff  <msaboff@apple.com>
+
+        CSS Parser should directly parse 8 bit source strings
+        https://bugs.webkit.org/show_bug.cgi?id=95207
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/text/StringImpl.h:
+        (WTF::equalIgnoringCase): Added (const char*, const LChar*, unsigned) flavor to support
+        8 bit CSS parser work.
+
+2012-08-30  Benjamin Poulain  <bpoulain@apple.com>
+
+        AtomicString(ASCIILiteral) should not compile
+        https://bugs.webkit.org/show_bug.cgi?id=95413
+
+        Reviewed by Adam Barth.
+
+        * wtf/text/AtomicString.h:
+        (AtomicString): Declare the constructor from ASCIILiteral private to ensure it is
+        not used by accident.
+
+2012-08-30  Benjamin Poulain  <bpoulain@apple.com>
+
+        Ambiguous operator[]  after r127191 on some compiler
+        https://bugs.webkit.org/show_bug.cgi?id=95509
+
+        Reviewed by Simon Fraser.
+
+        * wtf/text/WTFString.h:
+        (WTF::String::characterAt): At this as a synonym to operator[] to attempt a build fix.
+
+2012-08-30  Mark Lam  <mark.lam@apple.com>
+
+        Render unto #ifdef's that which belong to them.
+        https://bugs.webkit.org/show_bug.cgi?id=95482.
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/Platform.h: Added ENABLE(COMPUTED_GOTO_OPCODES).
+
+2012-08-30  Pratik Solanki  <psolanki@apple.com>
+
+        objc_msgSend and IMP should be cast appropriately before using
+        https://bugs.webkit.org/show_bug.cgi?id=95242
+
+        Reviewed by Benjamin Poulain.
+
+        Add new templates wtfObjcMsgSend and wtfCallIMP that do the appropriate
+        casts to correctly typed function pointers before calling objc_msgSend
+        and IMP methods directly.
+
+        * wtf/Functional.h:
+        (WTF::R): Use wtfObjcMsgSend.
+        * wtf/ObjcRuntimeExtras.h: Added.
+        (wtfObjcMsgSend):
+        (wtfCallIMP):
+
+2012-08-30  Benjamin Poulain  <bpoulain@apple.com>
+
+        Replace JSC::UString by WTF::String
+        https://bugs.webkit.org/show_bug.cgi?id=95271
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/Platform.h: Useless edit to force a full build. This is needed for some bots for some reason.
+        * wtf/text/WTFString.h: Export a symbol that was exported on UString and needed in WebCore.
+
+        Add String::getCharactersWithUpconvert<>(), which is similar to String::getCharacters<>() but with the same
+        behaviors as UString::getCharacters<>().
+
+        String::getCharactersWithUpconvert<>() is useful when manipulating multiple strings, it allow writting code
+        using 16bits characters if any of the input String is not 8bit.
+
+2012-08-30  Yong Li  <yoli@rim.com>
+
+        Vector::shrinkToFit should use realloc when suitable.
+        https://bugs.webkit.org/show_bug.cgi?id=94810
+
+        Reviewed by Benjamin Poulain.
+
+        Only tested on BlackBerry. So it is wrapped with PLATFORM(BLACKBERRY) in the mean time.
+        Use realloc to shrink buffer when inline buffer isn't involved and and canMoveWithMemcpy is true.
+
+        When running the test code attached to the bug, it gives 30-45% performance boost for the large blocks
+        (Every test cycle includes an extra pair of malloc/free, so the boost on shrinkToFit() is even bigger)
+        Performance impact on small blocks is not noticeable. (Tested on BlackBerry)
+
+        * wtf/Vector.h:
+        (WTF::VectorBufferBase::shouldReallocateBuffer):
+        (VectorBufferBase):
+        (WTF::VectorBufferBase::reallocateBuffer):
+        (VectorBuffer):
+        (WTF::VectorBuffer::shouldReallocateBuffer):
+        (WTF::VectorBuffer::reallocateBuffer):
+        (WTF::VectorBuffer::inlineBuffer):
+        (WTF::::shrinkCapacity):
+
+2012-08-30  Patrick Gansterer  <paroga@webkit.org>
+
+        Build fix for COMPILER(MSVC) && !CPU(X86) after r127001.
+
+        * wtf/MathExtras.h:
+        (lrint): Added additional parentheses to silence compiler warning.
+
+2012-08-29  Benjamin Poulain  <bpoulain@apple.com>
+
+        REGRESSION(r126780): Crash using StringImpl::is8Bit before checking if there is an impl
+        https://bugs.webkit.org/show_bug.cgi?id=95380
+
+        Reviewed by Michael Saboff.
+
+        Blindly copying code from UString in r126780 was stupid. I just brought over a bug.
+        This patch adds the zero length branch back so that null strings are handled correctly.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::ascii): Return a empty CString if the String is null or empty.
+
+2012-08-29  Dominik Röttsches  <dominik.rottsches@intel.com>
+
+        The 2d.imageData.object.round canvas test is failing
+        https://bugs.webkit.org/show_bug.cgi?id=40272
+
+        Reviewed by Benjamin Poulain.
+
+        Updating previous patch to address Benjamin's comments.
+        #ifdef in Uint8ClampedArray removed, fallback implementation for MSVC on non-X86 added.
+
+        * wtf/MathExtras.h:
+        (lrint): Fallback implementation for non-X86 & MSVC case.
+        * wtf/Uint8ClampedArray.h: Removed #ifdef.
+
+2012-08-28  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r126914.
+        http://trac.webkit.org/changeset/126914
+        https://bugs.webkit.org/show_bug.cgi?id=95239
+
+        it breaks everything and fixes nothing (Requested by pizlo on
+        #webkit).
+
+        * wtf/HashCountedSet.h:
+        (WTF::::add):
+        (WTF::::remove):
+        (WTF::copyToVector):
+        * wtf/HashIterators.h:
+        (WTF::HashTableConstKeysIterator::get):
+        (WTF::HashTableConstValuesIterator::get):
+        (WTF::HashTableKeysIterator::get):
+        (WTF::HashTableValuesIterator::get):
+        * wtf/HashMap.h:
+        (WTF::KeyValuePairKeyExtractor::extract):
+        (WTF::HashMapValueTraits::isEmptyValue):
+        (WTF::HashMapTranslator::translate):
+        (WTF::HashMapTranslatorAdapter::translate):
+        (WTF::::set):
+        (WTF::::get):
+        (WTF::::take):
+        (WTF::operator==):
+        (WTF):
+        (WTF::deleteAllPairSeconds):
+        (WTF::deleteAllValues):
+        (WTF::deleteAllPairFirsts):
+        (WTF::deleteAllKeys):
+        * wtf/HashTable.h:
+        (WTF::hashTableSwap):
+        (WTF::::checkTableConsistencyExceptSize):
+        * wtf/HashTraits.h:
+        (WTF::KeyValuePair::KeyValuePair):
+        (KeyValuePair):
+        (WTF::KeyValuePairHashTraits::constructDeletedValue):
+        (WTF::KeyValuePairHashTraits::isDeletedValue):
+        * wtf/MetaAllocator.cpp:
+        (WTF::MetaAllocator::addFreeSpace):
+        (WTF::MetaAllocator::incrementPageOccupancy):
+        (WTF::MetaAllocator::decrementPageOccupancy):
+        * wtf/RefCountedLeakCounter.cpp:
+        (WTF::RefCountedLeakCounter::~RefCountedLeakCounter):
+        * wtf/RefPtrHashMap.h:
+        (WTF::::set):
+        (WTF::::get):
+        (WTF::::inlineGet):
+        (WTF::::take):
+        * wtf/Spectrum.h:
+        (WTF::Spectrum::add):
+        (WTF::Spectrum::get):
+        (WTF::Spectrum::buildList):
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::identifierByPthreadHandle):
+
+2012-08-28  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        Rename first/second to key/value in HashMap iterators
+        https://bugs.webkit.org/show_bug.cgi?id=82784
+
+        Reviewed by Eric Seidel.
+
+        * wtf/HashCountedSet.h:
+        (WTF::::add):
+        (WTF::::remove):
+        (WTF::copyToVector):
+        * wtf/HashIterators.h:
+        (WTF::HashTableConstKeysIterator::get):
+        (WTF::HashTableConstValuesIterator::get):
+        (WTF::HashTableKeysIterator::get):
+        (WTF::HashTableValuesIterator::get):
+        * wtf/HashMap.h:
+        (WTF::KeyValuePairKeyExtractor::extract):
+        (WTF::HashMapValueTraits::isEmptyValue):
+        (WTF::HashMapTranslator::translate):
+        (WTF::HashMapTranslatorAdapter::translate):
+        (WTF::::set):
+        (WTF::::get):
+        (WTF::::take):
+        (WTF::operator==):
+        (WTF::deleteAllValues):
+        (WTF::deleteAllKeys):
+        Remove deleteAllPairFirsts/Seconds.
+
+        * wtf/HashTable.h:
+        (WTF::hashTableSwap):
+        (WTF::::checkTableConsistencyExceptSize):
+        * wtf/HashTraits.h:
+        (WTF::KeyValuePair::KeyValuePair):
+        (KeyValuePair):
+        (WTF::KeyValuePairHashTraits::constructDeletedValue):
+        (WTF::KeyValuePairHashTraits::isDeletedValue):
+        * wtf/MetaAllocator.cpp:
+        (WTF::MetaAllocator::addFreeSpace):
+        (WTF::MetaAllocator::incrementPageOccupancy):
+        (WTF::MetaAllocator::decrementPageOccupancy):
+        * wtf/RefCountedLeakCounter.cpp:
+        (WTF::RefCountedLeakCounter::~RefCountedLeakCounter):
+        * wtf/RefPtrHashMap.h:
+        (WTF::::set):
+        (WTF::::get):
+        (WTF::::inlineGet):
+        (WTF::::take):
+        * wtf/Spectrum.h:
+        (WTF::Spectrum::add):
+        (WTF::Spectrum::get):
+        (WTF::Spectrum::buildList):
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::identifierByPthreadHandle):
+
+2012-08-27  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r126836.
+        http://trac.webkit.org/changeset/126836
+        https://bugs.webkit.org/show_bug.cgi?id=95163
+
+        Broke all Apple ports, EFL, and Qt. (Requested by tkent on
+        #webkit).
+
+        * wtf/HashCountedSet.h:
+        (WTF::::add):
+        (WTF::::remove):
+        (WTF::copyToVector):
+        * wtf/HashIterators.h:
+        (WTF::HashTableConstKeysIterator::get):
+        (WTF::HashTableConstValuesIterator::get):
+        (WTF::HashTableValuesIterator::get):
+        * wtf/HashMap.h:
+        (WTF::KeyValuePairKeyExtractor::extract):
+        (WTF::HashMapValueTraits::isEmptyValue):
+        (WTF::HashMapTranslator::translate):
+        (WTF::HashMapTranslatorAdapter::translate):
+        (WTF::::set):
+        (WTF::::get):
+        (WTF::::take):
+        (WTF::operator==):
+        (WTF):
+        (WTF::deleteAllPairSeconds):
+        (WTF::deleteAllValues):
+        (WTF::deleteAllPairFirsts):
+        (WTF::deleteAllKeys):
+        * wtf/HashTable.h:
+        (WTF::hashTableSwap):
+        (WTF::::checkTableConsistencyExceptSize):
+        * wtf/HashTraits.h:
+        (WTF::KeyValuePair::KeyValuePair):
+        (KeyValuePair):
+        (WTF::KeyValuePairHashTraits::constructDeletedValue):
+        (WTF::KeyValuePairHashTraits::isDeletedValue):
+        * wtf/MetaAllocator.cpp:
+        (WTF::MetaAllocator::addFreeSpace):
+        (WTF::MetaAllocator::incrementPageOccupancy):
+        (WTF::MetaAllocator::decrementPageOccupancy):
+        * wtf/RefCountedLeakCounter.cpp:
+        (WTF::RefCountedLeakCounter::~RefCountedLeakCounter):
+        * wtf/RefPtrHashMap.h:
+        (WTF::::set):
+        (WTF::::get):
+        (WTF::::inlineGet):
+        (WTF::::take):
+        * wtf/Spectrum.h:
+        (WTF::Spectrum::add):
+        (WTF::Spectrum::get):
+        (WTF::Spectrum::buildList):
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::identifierByPthreadHandle):
+
+2012-08-27  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        Rename first/second to key/value in HashMap iterators
+        https://bugs.webkit.org/show_bug.cgi?id=82784
+
+        Reviewed by Eric Seidel.
+
+        * wtf/HashCountedSet.h:
+        (WTF::::add):
+        (WTF::::remove):
+        (WTF::copyToVector):
+        * wtf/HashIterators.h:
+        (WTF::HashTableConstKeysIterator::get):
+        (WTF::HashTableConstValuesIterator::get):
+        (WTF::HashTableValuesIterator::get):
+        * wtf/HashMap.h:
+        (WTF::KeyValuePairKeyExtractor::extract):
+        (WTF::HashMapValueTraits::isEmptyValue):
+        (WTF::HashMapTranslator::translate):
+        (WTF::HashMapTranslatorAdapter::translate):
+        (WTF::::set):
+        (WTF::::get):
+        (WTF::::take):
+        (WTF::operator==):
+        (WTF::deleteAllValues):
+        (WTF::deleteAllKeys):
+        Remove deleteAllPairFirsts/Seconds.
+
+        * wtf/HashTable.h:
+        (WTF::hashTableSwap):
+        (WTF::::checkTableConsistencyExceptSize):
+        * wtf/HashTraits.h:
+        (WTF::KeyValuePair::KeyValuePair):
+        (KeyValuePair):
+        (WTF::KeyValuePairHashTraits::constructDeletedValue):
+        (WTF::KeyValuePairHashTraits::isDeletedValue):
+        * wtf/MetaAllocator.cpp:
+        (WTF::MetaAllocator::addFreeSpace):
+        (WTF::MetaAllocator::incrementPageOccupancy):
+        (WTF::MetaAllocator::decrementPageOccupancy):
+        * wtf/RefCountedLeakCounter.cpp:
+        (WTF::RefCountedLeakCounter::~RefCountedLeakCounter):
+        * wtf/RefPtrHashMap.h:
+        (WTF::::set):
+        (WTF::::get):
+        (WTF::::inlineGet):
+        (WTF::::take):
+        * wtf/Spectrum.h:
+        (WTF::Spectrum::add):
+        (WTF::Spectrum::get):
+        (WTF::Spectrum::buildList):
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::identifierByPthreadHandle):
+
+2012-08-27  Benjamin Poulain  <benjamin@webkit.org>
+
+        Add ECMAScript Number to String conversion to WTF::String
+        https://bugs.webkit.org/show_bug.cgi?id=95016
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::numberToStringECMAScript):
+        * wtf/text/WTFString.h:
+        Add the implementation of numberToStringECMAScript(double) from UString to String.
+        This will make it easier to replace UString in the future.
+
+2012-08-27  Benjamin Poulain  <benjamin@webkit.org>
+
+        Even up WTF::String to CString functions
+        https://bugs.webkit.org/show_bug.cgi?id=95008
+
+        Reviewed by Sam Weinig.
+
+        Apply advantages from UString to WTF::String.
+
+        * wtf/text/WTFString.cpp:
+        (WTF::String::ascii): There is no need to special case the null length, both
+        following branches use CString::newUninitialized(), which create empty string
+        for null length.
+        (WTF::String::latin1): Use characters16() instead of characters() to avoid
+        testing is8Bit() a second time.
+
+2012-08-24  Benjamin Poulain  <benjamin@webkit.org>
+
+        Touch Platform.h to solve a build dependency issue
+
+        Unreviewed.
+
+        * wtf/Platform.h:
+
+2012-08-24  Benjamin Poulain  <bpoulain@apple.com>
+
+        Unify Number to StringImpl conversion
+        https://bugs.webkit.org/show_bug.cgi?id=94879
+
+        Reviewed by Geoffrey Garen.
+
+        Previously, UString::number() and String::number() used different implementations.
+
+        WTF::String::number() was simply forwarding to String::format().
+        UString::number() had an optimized version of the conversion.
+
+        This patch replace both implementation by a new version, faster than the two previous versions.
+
+        The new functions numberToStringImpl improvements are:
+        -about 3 times faster than String::number().
+        -14% faster than UString::number() on signed numbers.
+        -9% faster than UString::number() on unsigned numbers.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/text/IntegerToStringConversion.cpp: Added.
+        (WTF::numberToStringImplSigned):
+        (WTF::numberToStringImpl):
+        (WTF::numberToStringImplUnsigned):
+        * wtf/text/IntegerToStringConversion.h: Added.
+        * wtf/text/WTFString.cpp:
+        (WTF::String::format):
+        * wtf/text/WTFString.h:
+        (WTF::String::number):
+
+2012-08-24  Andras Becsi  <andras.becsi@nokia.com>
+
+        [Qt] Be more explicit about the ICU dependency in the error message
+
+        Rubber-stamped by Simon Hausmann.
+
+        When building QtWebKit with a Qt5 which was not configured with libICU support
+        the error message is somewhat ambiguous about the indirect dependency.
+
+        * WTF.pri:
+
+2012-08-23  Julien Chaffraix  <jchaffraix@webkit.org>
+
+        [Chromium] Enable AtomicString && CString && WTFString && StringImpl unit tests
+        https://bugs.webkit.org/show_bug.cgi?id=94871
+
+        Reviewed by Benjamin Poulain.
+
+        * wtf/PassRefPtr.h:
+        We need to include Assertions.h due to the COMPILE_ASSERT added in r89283.
+        This matches other files in WTF though I am not sure why Chromium is the only
+        platform complaining about that.
+
+2012-08-23  Mark Rowe  <mrowe@apple.com>
+
+        Build fix for old, old versions of Clang.
+
+        * wtf/FastMalloc.cpp:
+        (WTF): Rejigger things so that they parse correctly if __has_warning isn't defined.
+
+2012-08-23  Emil A Eklund  <eae@chromium.org>
+
+        Add saturation arithmetic support to FractionalLayoutUnit
+        https://bugs.webkit.org/show_bug.cgi?id=94364
+
+        Reviewed by Benjamin Poulain.
+
+        Add support functions for saturated addition and subtraction.
+
+        Test: TestWebKitAPI/Tests/WTF/SaturatedArithmeticOperations.cpp
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * WTF/wtf/CMakeLists.txt:
+        Add SaturatedArithmetic.h to build files.
+
+        * wtf/SaturatedArithmetic.h: Added.
+        (saturatedAddition):
+        (saturatedSubtraction):
+        Support functions for saturated addition/subtraction. Compares the signed
+        bit of the values instead of using range checks to reduce branching.
+
+        * wtf/Platform.h:
+        Add ENABLE_SATURATED_LAYOUT_ARITHMETIC flag.
+
+2012-08-23  Mark Rowe  <mrowe@apple.com>
+
+        Roll back in the part of r126475 that I had rolled out.
+
+        * wtf/FastMalloc.cpp:
+        (WTF): Disable the -Wunused-private-field warning around the declaration of
+        TCMalloc_Central_FreeListPadded since the padding is intentionally unused.
+        Only disable the warning if we detect it is enabled, since the warning may not
+        be supported by the version of Clang that is being used.
+
+2012-08-23  Mark Rowe  <mrowe@apple.com>
+
+        Roll out part of r126475 that breaks the build with older versions of Clang.
+
+        * wtf/FastMalloc.cpp:
+
+2012-08-23  Mark Rowe  <mrowe@apple.com>
+
+        Make WTF build with the latest version of clang.
+
+        Reviewed by Dan Bernstein.
+
+        * wtf/FastMalloc.cpp:
+        (WTF): Disable the -Wunused-private-field warning around the declaration of
+        TCMalloc_Central_FreeListPadded since the padding is intentionally unused.
+        (WTF::AdminRegionRecorder): Remove the unused m_reader member.
+        (WTF::FastMallocZone::enumerate): Don't pass in the RemoteMemoryReader since
+        it is no longer needed.
+
+2012-08-22  Geoffrey Garen  <ggaren@apple.com>
+
+        Fixed a fastMallocForbid/Allow compile error for some compilers
+        https://bugs.webkit.org/show_bug.cgi?id=94775
+
+        Reviewed by Gavin Barraclough.
+
+        * wtf/FastMalloc.h:
+        (WTF::fastMallocForbid()):
+        (WTF::fastMallocAllow()): Export, since these are called by JavaScriptCore.
+
+2012-08-22  Geoffrey Garen  <ggaren@apple.com>
+
+        ThreadRestrictionVerifier should be opt-in, not opt-out
+        https://bugs.webkit.org/show_bug.cgi?id=94761
+
+        Reviewed by Mark Hahnenberg.
+
+        WebKit's JavaScript engine supports use on multiple threads, so default-on
+        is not appropriate for most of our objects, and it causes lots of suprious
+        assertions.
+
+        * wtf/MetaAllocator.cpp:
+        (WTF::MetaAllocatorHandle::MetaAllocatorHandle): No need to turn off
+        explicitly, since it's off by default now.
+
+        * wtf/ThreadRestrictionVerifier.h:
+        (WTF::ThreadRestrictionVerifier::ThreadRestrictionVerifier): Turn off by default.
+
+        (WTF::ThreadRestrictionVerifier::setMutexMode):
+        (WTF::ThreadRestrictionVerifier::setDispatchQueueMode):
+        (WTF::ThreadRestrictionVerifier::turnOffVerification): These assertions
+        about state transitions were inconsistent with each other, and impossible
+        to maintain with default off, so I removed them.
+
+2012-08-22  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
+
+        [Qt] Optionally support smooth-scrolling on all platforms
+        https://bugs.webkit.org/show_bug.cgi?id=74926
+
+        Reviewed by Simon Hausmann.
+
+        Initialize GESTURE_ANIMATION feature flag.
+
+        * wtf/Platform.h:
+
+2012-08-21  Mark Hahnenberg  <mhahnenberg@apple.com>
+
+        WTF Threading leaks kernel objects on platforms that use pthreads
+        https://bugs.webkit.org/show_bug.cgi?id=94636
+
+        Reviewed by Geoffrey Garen.
+
+        Creating lots of Web workers on Mac platforms leaks lots of Mach ports. Eventually, the 
+        process can exhaust its allocation of Mach ports from the kernel, which can then cause 
+        all sorts of badness, including the inability to allocate new virtual memory from the 
+        kernel. ThreadingPthreads.cpp and ThreadIdentifierDataPthreads.cpp need to be refactored 
+        so that we do not leak these kernel resources. I would assume that we also leak kernel 
+        resources on other pthreads platforms as well.
+
+        * wtf/ThreadIdentifierDataPthreads.cpp:
+        (WTF):
+        (WTF::ThreadIdentifierData::~ThreadIdentifierData): Now calls the event threadDidExit, which 
+        handles all relevant tear-down of the thread metadata in the thread map.
+        * wtf/ThreadingPthreads.cpp: Added a new class called PthreadState that encapsulates the 
+        state of a thread and the possible transitions between those states.
+        (PthreadState):
+        (WTF::PthreadState::PthreadState):
+        (WTF::PthreadState::joinableState): Returns the current state of the pthread.
+        (WTF::PthreadState::pthreadHandle): Returns the pthread_t for this particular thread. This needs to 
+        remain valid even after the thread has exited because somebody could come along at any time in the 
+        future and call join on the thread.
+        (WTF::PthreadState::didBecomeDetached): Signals that the thread was detached.
+        (WTF::PthreadState::didExit): Signals that the thread's exit destructor (~ThreadIdentifierData) has run.
+        (WTF::PthreadState::didJoin): Signals that the thread has been joined on successfully.
+        (WTF::PthreadState::hasExited): Returns whether or not the thread's exit destructor has run.
+        (WTF):
+        (WTF::identifierByPthreadHandle): Changed to also check hasExited() on the threads it finds in the map. We 
+        should only have one valid pthread_t in the map, but there are other pthread_t's that need to remain in the 
+        thread map for when somebody joins on that thread id later.
+        (WTF::establishIdentifierForPthreadHandle): Changed to put the allocate the new PthreadState data structure and 
+        put it in the map.
+        (WTF::pthreadHandleForIdentifierWithLockAlreadyHeld):
+        (WTF::wtfThreadEntryPoint):
+        (WTF::waitForThreadCompletion): We now do the relevant cleanup after the specified thread has been 
+        successfully joined on depending on if the joined thread has already exited.
+        (WTF::detachThread): Performs relevant cleanup if the thread has already exited. Otherwise signals to the 
+        PthreadState that the thread has been detached.
+        (WTF::threadDidExit): Function called by ~ThreadIdentifierData to indicate that the thread has exited. 
+        Only cleans up after itself if the thread isn't Joinable (i.e. Joined or Detached).
+
+2012-08-21  Ulan Degenbaev  <ulan@chromium.org>
+
+        Call AdjustAmountOfExternalAllocatedMemory when V8ArrayBuffer constructed and destructed
+        https://bugs.webkit.org/show_bug.cgi?id=92993
+
+        Reviewed by Kenneth Russell.
+
+        Call AdjustAmountOfExternalAllocatedMemory when V8ArrayBuffer
+        is constructed and destructed so that V8's garbage collection
+        heuristics can account for the memory held by these objects.
+
+        * wtf/ArrayBuffer.h:
+        (WTF):
+        (ArrayBufferDeallocationObserver):
+        (WTF::ArrayBufferContents::ArrayBufferContents):
+        (WTF::ArrayBufferContents::transfer):
+        (ArrayBufferContents):
+        (ArrayBuffer):
+        (WTF::ArrayBuffer::setDeallocationObserver):
+        (WTF::ArrayBufferContents::~ArrayBufferContents):
+
+2012-08-21  Benjamin Poulain  <bpoulain@apple.com>
+
+        Store CString data in the CStringBuffer to avoid the double indirection
+        https://bugs.webkit.org/show_bug.cgi?id=94562
+
+        Reviewed by Darin Adler.
+
+        Previously, any non-trivial CString would require two allocations:
+        1) CStringBuffer (ref-counted container for CString's data).
+        2) VectorBuffer's m_buffer (the actual char data).
+
+        This patches changes CStringBuffer to hold the data previously owned by
+        WTF::Vector and WTF::VectorBuffer. This makes CString more efficient
+        both in CPU time and memory use.
+
+        * wtf/text/CString.cpp:
+        (WTF::CStringBuffer::createUninitialized): This new method allocate the memory
+        for CStringBuffer and its data. We simply allocate more memory after CStringBuffer
+        to hold the data.
+
+        The extra memory needed to store the terminating zero is now handled by design.
+        (WTF::CString::CString): Move the test for "str" one level up the stack from CString::init().
+        This avoid double checking the pointer when using the other constructor.
+        (WTF::CString::init):
+        (WTF::CString::newUninitialized):
+        (WTF::CString::copyBufferIfNeeded):
+        * wtf/text/CString.h:
+        (WTF::CStringBuffer::data):
+        (WTF::CStringBuffer::length):
+        (CStringBuffer):
+        (WTF::CStringBuffer::CStringBuffer):
+        (WTF::CStringBuffer::mutableData):
+        (WTF::CString::length):
+
+2012-08-21  Patrick Gansterer  <paroga@webkit.org>
+
+        Build fix for COMPILER(MSVC) && !CPU(X86) after r126023.
+
+        * wtf/MathExtras.h:
+        (lrint):
+
+2012-08-20  Dominik Röttsches  <dominik.rottsches@intel.com>
+
+        The 2d.imageData.object.round canvas test is failing
+        https://bugs.webkit.org/show_bug.cgi?id=40272
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        According to the Uint8ClampedArray spec (http://www.khronos.org/registry/typedarray/specs/latest/#7.1)
+        which references WebIDL's clamping rules, with implications defined in http://www.w3.org/TR/WebIDL/#es-octet
+        we need to round to nearest integer, and to the even one if exactly halfway in between.
+        As a solution: applying C99's lrint which, in default rounding mode, does that.
+
+        The updated version of test 2d.imageData.object.round.html test passes now.
+
+        * wtf/MathExtras.h:
+        (lrint): Assembly based implementation for MSVC under X86, otherwise falling back to casting.
+        * wtf/Uint8ClampedArray.h:
+        (WTF::Uint8ClampedArray::set): lrint instead of simple rounding.
+
+2012-08-17  Michael Saboff  <msaboff@apple.com>
+
+        Add ability to create AtomicString using LChar* buffer and length
+        https://bugs.webkit.org/show_bug.cgi?id=94381
+
+        Reviewed by Geoffrey Garen.
+
+        Allows the use of 8 bit string data directly without converting to 16 bits first.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::LCharBufferTranslator::hash):
+        (LCharBufferTranslator):
+        (WTF::LCharBufferTranslator::equal):
+        (WTF::LCharBufferTranslator::translate):
+        (WTF::AtomicString::add):
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::AtomicString):
+        (AtomicString):
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+
+2012-08-17  Benjamin Poulain  <bpoulain@apple.com>
+
+        Make it easier to append a literal to StringBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=94273
+
+        Reviewed by Kentaro Hara.
+
+        * wtf/text/StringBuilder.h:
+        (WTF::StringBuilder::appendLiteral): Add the method StringBuilder::appendLiteral() for efficiently
+        adding a string literal to the StringBuilder.
+
+2012-08-17  Yong Li  <yoli@rim.com>
+
+        [BlackBerry] Turn on a few macros for jpeg decoding and image interpolation
+        https://bugs.webkit.org/show_bug.cgi?id=94244
+
+        Reviewed by Antonio Gomes.
+
+        Turn on these macros to get better performance.
+
+        * wtf/Platform.h:
+
+2012-08-17  Milian Wolff  <milian.wolff@kdab.com>
+
+        [Qt] QNX build fails due to ctype usage in system headers
+        https://bugs.webkit.org/show_bug.cgi?id=93849
+
+        Reviewed by Simon Hausmann.
+
+        Move the check for whether DisallowCType should be active or not
+        to the DisallowCType.h header. This way, we can update the list
+        of platforms or OSes which do not work with this header in a
+        central place. All users can now safely include the header
+        and do not need to place custom guards around it.
+
+        * config.h:
+        * wtf/DisallowCType.h:
+
+2012-08-17  Milian Wolff  <milian.wolff@kdab.com>
+
+        [Qt] QNX build fails due to missing timegm declaration
+        https://bugs.webkit.org/show_bug.cgi?id=93842
+
+        Reviewed by Simon Hausmann.
+
+        On QNX, timegm is declared in nbutils.h and one must link against
+        nbutils to use it.
+
+        * WTF.pri:
+        * wtf/DateMath.cpp:
+
+2012-08-16  Kent Tamura  <tkent@chromium.org>
+
+        Build fix for Chromium-mac.
+
+        * wtf/text/WTFString.cpp: Remove unnecessary includes.
+
+2012-08-16  Michael Saboff  <msaboff@apple.com>
+
+        HTML Parser should produce 8bit substrings for inline style and script elements
+        https://bugs.webkit.org/show_bug.cgi?id=93742
+
+        Reviewed by Benjamin Poulain.
+
+        Added 8 bit path to String::isAllSpecialCharacters(). Added new String creator
+        that takes a pointer to a UChar array that is known to contain only 8 bit
+        characters (LChar's). Added new helper method to copy contents of a
+        UChar buffer to a LChar buffer. The helper method includes X86-64 intrinsics
+        of SSE family instructions for performance.
+
+        * wtf/Alignment.h:
+        (WTF::isAlignedTo):
+        * wtf/text/ASCIIFastPath.h:
+        (WTF::copyLCharsFromUCharSource):
+        * wtf/text/WTFString.cpp:
+        (WTF::String::make8BitFrom16BitSource):
+        * wtf/text/WTFString.h:
+        (String):
+        (WTF::isAllSpecialCharacters):
+        (WTF::String::isAllSpecialCharacters):
+
+2012-08-16  Benjamin Poulain  <bpoulain@apple.com>
+
+        Use initialization from literals for StringStatics
+        https://bugs.webkit.org/show_bug.cgi?id=94185
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/text/StringStatics.cpp:
+        Remove the arguments for DEFINE_GLOBAL. They are no longer used by the macro.
+        (WTF::AtomicString::init):
+        Use ConstructFromLiteral to initialize the strings faster and to save memory.
+
+2012-08-14  Milian Wolff  <milian.wolff@kdab.com>
+
+        [Qt] QNX build fails due to reference to MADV_FREE_REUSE and MADV_FREE_REUSABLE
+        https://bugs.webkit.org/show_bug.cgi?id=93843
+
+        Reviewed by Simon Hausmann.
+
+        QNX does not implement MADV_FREE_REUSE nor MADV_FREE_REUSABLE.
+        The Blackberry port already sets the define to use the system
+        malloc, which is now also done for QNX in general.
+
+        * wtf/Platform.h:
+
+2012-08-13  Raphael Kubo da Costa  <rakuco@webkit.org>
+
+        [CMake] Remove glib-related Find modules and write single new one instead.
+        https://bugs.webkit.org/show_bug.cgi?id=93786
+
+        Reviewed by Rob Buis.
+
+        * wtf/PlatformEfl.cmake: Use GLIB_* instead of Glib_*, and link directly to GIO, as wtf/gobject uses functions from it.
+
+2012-08-11  Sam Weinig  <sam@webkit.org>
+
+        Enable XPC Service based WebProcess with runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=93773
+
+        Reviewed by Dan Bernstein.
+
+        * wtf/Platform.h:
+        Define HAVE_XPC on 10.7 and later.
+
+2012-08-11  Benjamin Poulain  <bpoulain@apple.com>
+
+        Do the DecimalNumber to String conversion on 8 bits
+        https://bugs.webkit.org/show_bug.cgi?id=93683
+
+        Reviewed by Andreas Kling.
+
+        Modify DecimalNumber to do the conversion to string on LChar instead of UChar.
+
+        * wtf/DecimalNumber.cpp:
+        (WTF::DecimalNumber::toStringDecimal):
+        (WTF::DecimalNumber::toStringExponential):
+        * wtf/DecimalNumber.h:
+        (DecimalNumber):
+        * wtf/dtoa.h:
+        * wtf/text/StringBuffer.h:
+        (WTF::StringBuffer::operator[]): StringBuffer::operator[] was incorrectly typed to UChar, making
+        the method impossible to instanciate with LChar.
+        * wtf/text/WTFString.h:
+        (String):
+        (WTF::String::adopt): String::adopt() is modified to work with both LChar and UChar. StringImpl
+        already support that.
+        (WTF::appendNumber): Add support for any type that can instanciate the template.
+
+2012-08-11  Benjamin Poulain  <benjamin@webkit.org>
+
+        WebCore::findAtomicString(PropertyName) always convert the name to 16bits
+        https://bugs.webkit.org/show_bug.cgi?id=93685
+
+        Reviewed by Geoffrey Garen.
+
+        Previously, WebCore::findAtomicString() was causing a conversion for the 8bit property name
+        to a 16bits due to the call to StringImpl::character16().
+
+        This patch fixes the issue by adding support for both 8bits and 16bits string in AtomicString::find().
+
+        * wtf/text/AtomicString.cpp:
+        (HashAndCharacters):
+        (WTF::HashAndCharactersTranslator::hash):
+        (WTF::HashAndCharactersTranslator::equal):
+        (WTF::HashAndCharactersTranslator::translate):
+        Use a template to make the struct and the translator independant of the CharacterType.
+
+        (WTF::AtomicString::add):
+        (WTF::findString):
+        (WTF::AtomicString::find): Change the API to take a StringImpl*. AtomicString can use
+        it efficiently to find the right string.
+        * wtf/text/AtomicString.h:
+        (AtomicString):
+        * wtf/text/StringImpl.h:
+        (StringImpl): Adapt the friends translator to support the template.
+
+2012-08-10  Benjamin Poulain  <bpoulain@apple.com>
+
+        Add support for String initialization from literal to WTFString
+        https://bugs.webkit.org/show_bug.cgi?id=93426
+
+        Reviewed by Anders Carlsson.
+
+        This patch adds two constructor to WTF::String in order to support fast initialization from literal:
+        -String(ASCIILiteral): Constructor similar to String(const char*) while being faster. This constructor
+         does not incur any overhead over String(const char*).
+        -String(char[], ConstructFromLiteralTag): Template constructor that encode explicitely the size of the
+         string.
+
+        String(ASCIILiteral) is expected to be used in most cases to avoid regressions. This constructor was
+        added because of what we have learned from r124922: inlining the string length in the code causes a code bloat
+        that is not always welcome.
+
+        Regarding performance of string initialization, the constructors performance are (6 characters string):
+        -String(ASCIILiteral): 16% faster.
+        -String(char[], ConstructFromLiteralTag): 33% faster (the delta increases with the string length).
+
+        In addition, no memory is allocated for the characters.
+
+        * wtf/text/StringImpl.cpp:
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::createFromLiteral): Extend StringImpl::createFromLiteral to have a version
+        with strlen() which avoids loading one extra argument.
+        * wtf/text/WTFString.cpp:
+        (WTF::String::String):
+        * wtf/text/WTFString.h:
+        (WTF::String::String):
+        (ASCIILiteral): This class is aimed at making the construction of WTFString from a literal very easy.
+        By using the explicit constructor ASCIILiteral(char *), one can expect the implicit conversion to String
+        when needed.
+        (WTF::ASCIILiteral::ASCIILiteral):
+        (WTF::ASCIILiteral::operator const char*):
+
+2012-08-08  Benjamin Poulain  <bpoulain@apple.com>
+
+        Use char* instead of LChar* for the public interface of String construction from literals
+        https://bugs.webkit.org/show_bug.cgi?id=93402
+
+        Reviewed by Michael Saboff.
+
+        When the initialization from literal was added, some constructor/initialization function were
+        using LChar for convenience.
+
+        Since those function should only take ASCII characters, using LChar* could cause confusion. This
+        patch intents to clarify this by using char* for all those APIs.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::CharBufferFromLiteralDataTranslator::hash):
+        (WTF::CharBufferFromLiteralDataTranslator::equal):
+        (WTF::CharBufferFromLiteralDataTranslator::translate):
+        (WTF::AtomicString::addFromLiteralData):
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::AtomicString):
+        (AtomicString):
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::createFromLiteral):
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+        (WTF::StringImpl::StringImpl):
+        (WTF::StringImpl::createFromLiteral):
+
+2012-08-08  Patrick Gansterer  <paroga@webkit.org>
+
+        Remove ce_time.(cpp|h) from list of source files
+        https://bugs.webkit.org/show_bug.cgi?id=93446
+
+        Reviewed by Simon Hausmann.
+
+        r125004 removed the last dependency on functions defined in ce_time.cpp.
+
+        * wtf/PlatformWinCE.cmake:
+
+2012-08-08  Alvaro Lopez Ortega  <alvaro@alobbs.com>
+
+        Atomics.h has incorrect GCC test for ext/atomicity.h when using LSB compilers
+        https://bugs.webkit.org/show_bug.cgi?id=51974
+
+        Reviewed by Simon Hausmann.
+
+        * wtf/Atomics.h: Inhibits the inclusion of the atomicity.h GNU C++
+        extension when compiling with a LSB compliant compiler. Thanks to
+        Craig Scott for the new precompiler check code.
+
+2012-08-07  Yoshifumi Inoue  <yosin@chromium.org>
+
+        [WTF] Add using WTF::msPerHour into DateMath.h
+        https://bugs.webkit.org/show_bug.cgi?id=93428
+
+        Reviewed by Kent Tamura.
+
+        This patch adds "using WTF::msPerHour" into DateMath.h for some codes
+        which will use it, e.g. bug 92960. Note: DateMath.h already has had
+        using statements for msPerDay, msPerMinute and msPerSecond.
+
+        * wtf/DateMath.h: Added "using WTF::msPerHour".
+
+2012-08-07  Benjamin Poulain  <benjamin@webkit.org>
+
+        Use the initialization from literal for JSC's Identifiers
+        https://bugs.webkit.org/show_bug.cgi?id=93193
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/text/StringImpl.h: Update the names for the HashTranslator used by Identifier.
+
+2012-07-19  Simon Hausmann  <simon.hausmann@nokia.com>
+
+        [Qt] Remove Qt 4 specific code paths
+        https://bugs.webkit.org/show_bug.cgi?id=88161
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * WTF.pri:
+        * WTF.pro:
+        * wtf/qt/StringQt.cpp:
+        (WTF::String::String):
+        (WTF::String::operator QString):
+        * wtf/qt/UtilsQt.h: Removed.
+        * wtf/qt/compat/QGuiApplication: Removed.
+        * wtf/qt/compat/qguiapplication.h: Removed.
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::~StringImpl):
+        (WTF):
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+
+2012-08-06  Patrick Gansterer  <paroga@webkit.org>
+
+        [WIN] Remove dependency on pthread from MachineStackMarker
+        https://bugs.webkit.org/show_bug.cgi?id=68429
+
+        Reviewed by Geoffrey Garen.
+
+        Windows has no support for calling a destructor for thread specific data.
+        Since we need more control over creating and deleting thread specific keys
+        we can not simply extend WTF::ThreadSpecific with this functionality.
+
+        All thread specific keys created via the new API get stored in a list.
+        After a thread function finished we iterate over this list and call
+        the registered destructor for every item if needed.
+
+        * wtf/ThreadSpecific.h:
+        (WTF):
+        (WTF::threadSpecificKeyCreate): Added wrapper around pthread_key_create.
+        (WTF::threadSpecificKeyDelete): Added wrapper around pthread_key_delete.
+        (WTF::threadSpecificSet): Added wrapper around pthread_setspecific.
+        (WTF::threadSpecificGet): Added wrapper around pthread_getspecific.
+        * wtf/ThreadSpecificWin.cpp:
+
+2012-08-04  No'am Rosenthal  <noam.rosenthal@nokia.com>
+
+        [Qt] UI_SIDE_COMPOSITING code has confusing names
+        https://bugs.webkit.org/show_bug.cgi?id=93164
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Renamed UI_SIDE_COMPOSITING to COORDINATED_GRAPHICS.
+
+        * wtf/Platform.h:
+
+2012-08-03  Michael Saboff  <msaboff@apple.com>
+
+        Convert HTML parser to handle 8-bit resources without converting to UChar*
+        https://bugs.webkit.org/show_bug.cgi?id=90321
+
+        Reviewed by Adam Barth.
+
+        * wtf/text/WTFString.h:
+        (WTF::String::dataSize): New method to return the number of bytes 
+        the string requires.  This replaces a harcoded calculation based on
+        length and sizeof(UChar).
+
+2012-08-03  Benjamin Poulain  <benjamin@webkit.org>
+
+        StringImpl created from literal should be BufferInternal
+        https://bugs.webkit.org/show_bug.cgi?id=92940
+
+        Reviewed by Anders Carlsson.
+
+        The ownership of string created from literal should be BufferInternal so that
+        StringImpl never tries to delete the characters.
+
+        The ownership was accidentaly set to BufferOwned in r123689.
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::createFromLiteral): Update to use the new constructor.
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::StringImpl):
+        Add a new constructor making the construction from literal explicit.
+        Add the flag s_hashFlagHasTerminatingNullCharacter since the data has the terminating
+        null character.
+
+2012-08-02  Patrick Gansterer  <paroga@webkit.org>
+
+        Move getLocalTime() as static inline function to DateMath
+        https://bugs.webkit.org/show_bug.cgi?id=92955
+
+        Reviewed by Ryosuke Niwa.
+
+        getCurrentLocalTime() and getLocalTime() has been superseded with the
+        GregorianDateTime class. So we can move it into DateMath.cpp as an static inline
+        function. This allows us to remove the dependecy on time() and localtime()
+        for Windows CE, where this functions require the ce_time library to work.
+
+        * wtf/CurrentTime.cpp:
+        (WTF):
+        * wtf/CurrentTime.h:
+        * wtf/DateMath.cpp:
+        (WTF):
+        (WTF::getLocalTime):
+
+2012-08-02  Patrick Gansterer  <paroga@webkit.org>
+
+        [WINCE] Return 0 at calculateDSTOffset(double, double)
+        https://bugs.webkit.org/show_bug.cgi?id=92953
+
+        Reviewed by Ryosuke Niwa.
+
+        localtime() is implemented as a call to gmtime() in ce_time.c.
+        Since this will never return correct values, returning 0 instead
+        does not remove any existing functionality, but decreases the
+        dependency on the (external) ce_time implementation.
+
+        * wtf/DateMath.cpp:
+        (WTF::calculateDSTOffsetSimple):
+
+2012-08-02  Arnaud Renevier  <a.renevier@sisa.samsung.com>
+
+        TypedArray set method is slow when called with another typed array
+        https://bugs.webkit.org/show_bug.cgi?id=92556
+
+        Reviewed by Kenneth Russell.
+
+        Add an checkInboundData function to TypedArrayBase to check if a
+        position will be not be out of bound or overflow from the typed array.
+
+        * wtf/TypedArrayBase.h:
+        (WTF::TypedArrayBase::checkInboundData):
+        (TypedArrayBase):
+
+2012-08-01  Patrick Gansterer  <paroga@webkit.org>
+
+        Replace WTF::getCurrentLocalTime() with GregorianDateTime::setToCurrentLocalTime()
+        https://bugs.webkit.org/show_bug.cgi?id=92286
+
+        Reviewed by Geoffrey Garen.
+
+        Add a method to GregorianDateTime to set its values to the current locale time.
+        Replacing all occurrences of getCurrentLocalTime with the new function allows
+        us to remove getCurrentLocalTime in a next step.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/DateMath.cpp:
+        (WTF::dayInYear):
+        * wtf/DateMath.h:
+        (WTF):
+        * wtf/GregorianDateTime.cpp: Added.
+        (WTF):
+        (WTF::GregorianDateTime::setToCurrentLocalTime):
+        * wtf/GregorianDateTime.h:
+        (GregorianDateTime):
+
+2012-08-01  Patrick Gansterer  <paroga@webkit.org>
+
+        Fix FastMalloc build with assertions enabled.
+
+        * wtf/FastMalloc.cpp:
+        (WTF::TCMalloc_PageHeap::isScavengerSuspended):
+        (WTF::TCMalloc_PageHeap::scheduleScavenger):
+        (WTF::TCMalloc_PageHeap::suspendScavenger):
+
+2012-08-01  Patrick Gansterer  <paroga@webkit.org>
+
+        Export StringImpl::sizeInBytes() with WTF_EXPORT_STRING_API
+        https://bugs.webkit.org/show_bug.cgi?id=92851
+
+        Reviewed by Hajime Morita.
+
+        r124069 missed to change one export macro, which is needed
+        to make the windows port with USE(EXPORT_MACROS).
+
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+
+2012-08-01  Patrick Gansterer  <paroga@webkit.org>
+
+        [WIN] Add missing WTF export macros to functions
+        https://bugs.webkit.org/show_bug.cgi?id=92842
+
+        Reviewed by Hajime Morita.
+
+        When we switch the windows port to USE(EXPORT_MACROS) we
+        need to export all functions referenced by WebKit.dll.
+
+        * wtf/ThreadingPrimitives.h:
+        (WTF):
+        * wtf/dtoa.h:
+        (WTF):
+        * wtf/dtoa/double-conversion.h:
+        (StringToDoubleConverter):
+        * wtf/unicode/UTF8.h:
+
+2012-07-31  Sam Weinig  <sam@webkit.org>
+
+        Stop masking 8 bits off of the visited link hash. We need all the bits!
+        https://bugs.webkit.org/show_bug.cgi?id=92799
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/StringHasher.h:
+        (WTF::StringHasher::hashWithTop8BitsMasked):
+        (WTF::StringHasher::hash):
+        (StringHasher):
+        (WTF::StringHasher::computeHashAndMaskTop8Bits):
+        (WTF::StringHasher::hashMemory):
+        (WTF::StringHasher::avalancheBits):
+        Rename existing computeHash and hash functions to computeHashAndMaskTop8Bits
+        and hashWithTop8BitsMasked respectively. Add new computeHash and hash functions
+        that do the StringHash without the masking.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::CStringTranslator::hash):
+        (WTF::UCharBufferTranslator::hash):
+        (WTF::HashAndCharactersTranslator::hash):
+        (WTF::SubstringTranslator::hash):
+        (WTF::LCharBufferFromLiteralDataTranslator::hash):
+        (WTF::AtomicString::fromUTF8Internal):
+        * wtf/text/StringHash.h:
+        (WTF::CaseFoldingHash::hash):
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::setHash):
+        * wtf/text/StringStatics.cpp:
+        (WTF::StringImpl::hashSlowCase):
+        * wtf/unicode/UTF8.cpp:
+        (WTF::Unicode::calculateStringHashAndLengthFromUTF8MaskingTop8Bits):
+        * wtf/unicode/UTF8.h:
+        Update for new function names.
+
+2012-07-31  Thiago Marcos P. Santos  <thiago.santos@intel.com>
+
+        Add a mechanism to dump the stack trace in case of a crash
+        https://bugs.webkit.org/show_bug.cgi?id=92666
+
+        Reviewed by Csaba Osztrogonác.
+
+        Unix based ports can make use of signal handlers to dump the stack
+        trace in case of a crash. This is specially handy when a test crashes on
+        the bot without hitting an assertion, we might have a chance to see
+        some insightful information at the reports.
+
+        * wtf/Assertions.cpp:
+        * wtf/Assertions.h:
+
+2012-07-31  Stephen Chenney  <schenney@chromium.org>
+
+        xmlserializer strips xlink from xlink:html svg image tag
+        https://bugs.webkit.org/show_bug.cgi?id=79586
+
+        Reviewed by Nikolas Zimmermann.
+
+        Add WTF::xlinkAtom as a global AtomicString constant.
+
+        * wtf/text/AtomicString.h:
+        (WTF): Add xlinkAtom.
+        * wtf/text/StringStatics.cpp:
+        (WTF): Add xlinkAtom.
+        (WTF::AtomicString::init): Add xlinkAtom.
+
+2012-07-30  Patrick Gansterer  <paroga@webkit.org>
+
+        Add WTF_EXPORT_PRIVATE to deleteOwnedPtr()
+        https://bugs.webkit.org/show_bug.cgi?id=92668
+
+        Reviewed by Hajime Morita.
+
+        When using export macros all non-inlined deleteOwnedPtr()
+        functions need to be declared with WTF_EXPORT_PRIVATE.
+
+        * wtf/OwnPtrCommon.h:
+        (WTF):
+
+2012-07-30  Wei James  <james.wei@intel.com>
+
+        atomicDecrement() never reach 0 on Android so no deref() will be called
+        https://bugs.webkit.org/show_bug.cgi?id=92635
+
+        Reviewed by Adam Barth.
+
+        With Android NDK 7b and later, __atomic_dec()  is implemented by
+        __sync_fetch_and_sub(), which will result in that atomicDecrement()
+        returns the old value instead of new one.
+
+        * wtf/Atomics.h:
+        (WTF):
+        (WTF::atomicIncrement):
+        (WTF::atomicDecrement):
+
+2012-07-30  Patrick Gansterer  <paroga@webkit.org>
+
+        Add function to calculate the day in year from a date
+        https://bugs.webkit.org/show_bug.cgi?id=92671
+
+        Reviewed by Ryosuke Niwa.
+
+        Replace monthToDayInYear() with dayInYear() which takes a whole
+        date for calculation and will be used for bug 92286 later.
+
+        * wtf/DateMath.cpp:
+        (WTF::dayInYear):
+        (WTF::dateToDaysFrom1970):
+
+2012-07-30  Patrick Gansterer  <paroga@webkit.org>
+
+        Add special export macro for string related functions
+        https://bugs.webkit.org/show_bug.cgi?id=92624
+
+        Reviewed by Hajime Morita.
+
+        The windows port compiles string related code into every binary for performance reasons (see r59187).
+        Add the WTF_EXPORT_STRING_API define to allow this behaviour with export macros too.
+
+        * wtf/ExportMacros.h:
+        * wtf/text/AtomicString.h:
+        (AtomicString):
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+        (WTF):
+        * wtf/text/WTFString.h:
+        (WTF):
+        (String):
+
+2012-07-30  Patrick Gansterer  <paroga@webkit.org>
+
+        Replace UnicodeWinCE with UnicodeWchar
+        https://bugs.webkit.org/show_bug.cgi?id=92539
+
+        Reviewed by Ryosuke Niwa.
+
+        UnicodeWinCE never contained WinCE specific code. UnicodeWchar
+        is a replacement for it, which is mainly based on the functions
+        from <wchar.h>. It is ment as a minimal Unicode backend, which
+        can be used very easy and has no external dependencies.
+
+        * WTF.gyp/WTF.gyp:
+        * WTF.gypi:
+        * wtf/Platform.h:
+        * wtf/PlatformWinCE.cmake:
+        * wtf/unicode/Unicode.h:
+        * wtf/unicode/wchar/UnicodeWchar.cpp: Added.
+        (Unicode):
+        (WTF::Unicode::category):
+        (WTF::Unicode::combiningClass):
+        (WTF::Unicode::direction):
+        (WTF::Unicode::decompositionType):
+        (WTF::Unicode::hasLineBreakingPropertyComplexContext):
+        (WTF::Unicode::mirroredChar):
+        (WTF::Unicode::convertWithFunction):
+        (WTF::Unicode::foldCase):
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        * wtf/unicode/wchar/UnicodeWchar.h: Added.
+        (Unicode):
+        (WTF::Unicode::isAlphanumeric):
+        (WTF::Unicode::isDigit):
+        (WTF::Unicode::isLetter):
+        (WTF::Unicode::isLower):
+        (WTF::Unicode::isPrintableChar):
+        (WTF::Unicode::isPunct):
+        (WTF::Unicode::isSpace):
+        (WTF::Unicode::isUpper):
+        (WTF::Unicode::isArabicChar):
+        (WTF::Unicode::isSeparatorSpace):
+        (WTF::Unicode::foldCase):
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        (WTF::Unicode::toTitleCase):
+        (WTF::Unicode::umemcasecmp):
+        * wtf/unicode/wince/UnicodeWinCE.cpp: Removed.
+        * wtf/unicode/wince/UnicodeWinCE.h: Removed.
+
+2012-07-26  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: move StringImpl size calculation to StringImpl
+        https://bugs.webkit.org/show_bug.cgi?id=92359
+
+        Reviewed by Pavel Feldman.
+
+        Moved stringSize(StringImpl*) implementation from InspectorMemoryAgent to
+        StringImpl::sizeInBytes();
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::sizeInBytes):
+        (WTF):
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+
+2012-07-28  Patrick Gansterer  <paroga@webkit.org>
+
+        [WIN] Add missing export macro to friend decleration.
+
+        Since the __declspec is part of the function signature
+        on windows, we need it at all friend declerations too.
+
+        * wtf/MediaTime.h:
+
+2012-07-28  Patrick Gansterer  <paroga@webkit.org>
+
+        [CMake] Add missing MediaTime files after r123878.
+
+        * wtf/CMakeLists.txt:
+
+2012-07-28  Patrick Gansterer  <paroga@webkit.org>
+
+        Remove obsolete functions from WTF::Unicode
+        https://bugs.webkit.org/show_bug.cgi?id=92571
+
+        Reviewed by Kentaro Hara.
+
+        Remove hasLineBreakingPropertyComplexContextOrIdeographic() and digitValue(),
+        since they are never used and defined for a few Unicode backends only.
+
+        * wtf/unicode/glib/UnicodeGLib.h:
+        * wtf/unicode/icu/UnicodeIcu.h:
+
+2012-07-27  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r123679.
+        http://trac.webkit.org/changeset/123679
+        https://bugs.webkit.org/show_bug.cgi?id=92565
+
+        Slowed down HTML parsing by 3.6% (Requested by abarth on
+        #webkit).
+
+        * wtf/text/WTFString.h:
+
+2012-07-27  Arnaud Renevier  <a.renevier@sisa.samsung.com>
+
+        use createUninitialized when creating TypedArray from another array
+        https://bugs.webkit.org/show_bug.cgi?id=92518
+
+        Reviewed by Kenneth Russell.
+
+        Expose a createUninitialized static method on TypedArray classes.
+
+        * wtf/Float32Array.h:
+        (Float32Array):
+        (WTF::Float32Array::createUninitialized):
+        (WTF):
+        * wtf/Float64Array.h:
+        (Float64Array):
+        (WTF::Float64Array::createUninitialized):
+        (WTF):
+        * wtf/Int16Array.h:
+        (Int16Array):
+        (WTF::Int16Array::createUninitialized):
+        (WTF):
+        * wtf/Int32Array.h:
+        (Int32Array):
+        (WTF::Int32Array::createUninitialized):
+        (WTF):
+        * wtf/Int8Array.h:
+        (Int8Array):
+        (WTF::Int8Array::createUninitialized):
+        (WTF):
+        * wtf/Uint16Array.h:
+        (Uint16Array):
+        (WTF::Uint16Array::createUninitialized):
+        (WTF):
+        * wtf/Uint32Array.h:
+        (Uint32Array):
+        (WTF::Uint32Array::createUninitialized):
+        (WTF):
+        * wtf/Uint8Array.h:
+        (Uint8Array):
+        (WTF::Uint8Array::createUninitialized):
+        (WTF):
+        * wtf/Uint8ClampedArray.h:
+        (Uint8ClampedArray):
+
+2012-07-27  Patrick Gansterer  <paroga@webkit.org>
+
+        [WINCE] Use macros from ICU instead of defining the same functionality again
+        https://bugs.webkit.org/show_bug.cgi?id=92530
+
+        Reviewed by Ryosuke Niwa.
+
+        Replace isHighSurrogate() with U16_IS_LEAD(), isLowSurrogate() with
+        U16_IS_TRAIL() and surrogateToUcs4() with U16_GET_SUPPLEMENTARY().
+
+        * wtf/unicode/wince/UnicodeWinCE.h:
+
+2012-07-27  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        [Qt] Fix build after r123917
+        https://bugs.webkit.org/show_bug.cgi?id=92555
+
+        Unreviewed.
+
+        * wtf/GregorianDateTime.h: Needs string.h for memset().
+
+2012-07-27  Paweł Forysiuk  <tuxator@o2.pl>
+
+        MinGW build fails because of missing header in GregorianDateTime.h
+        https://bugs.webkit.org/show_bug.cgi?id=92531
+
+        * wtf/GregorianDateTime.h: Include time.h
+
+2012-07-27  Jer Noble  <jer.noble@apple.com>
+
+        Unreviewed build fix.
+
+        Use MathExtras.h and the non std:: versions of isnan and signbit.
+
+        * wtf/MediaTime.cpp:
+        (WTF::MediaTime::createWithFloat):
+        (WTF::MediaTime::createWithDouble):
+
+2012-07-27  Jer Noble  <jer.noble@apple.com>
+
+        Support a rational time class for use by media elements.
+        https://bugs.webkit.org/show_bug.cgi?id=88787
+
+        Reviewed by Eric Carlson.
+
+        Add a new MediaTime class which implements rational math operations.
+
+        Add common constructors and assignment operators:
+        * wtf/MediaTime.cpp: Added.
+        (WTF::MediaTime::MediaTime):
+        (WTF::MediaTime::~MediaTime):
+        (WTF::MediaTime::operator=):
+
+        Add common math operators:
+        * wtf/MediaTime.cpp:
+        (WTF::MediaTime::operator+):
+        (WTF::MediaTime::operator-):
+        (WTF::MediaTime::operator<):
+        (WTF::MediaTime::operator>):
+        (WTF::MediaTime::operator==):
+        (WTF::MediaTime::operator>=):
+        (WTF::MediaTime::operator<=):
+
+        Add functions to check the MeiaTime time type flags:
+        * wtf/MediaTime.h:
+        (WTF::MediaTime::isValid):
+        (WTF::MediaTime::isInvalid):
+        (WTF::MediaTime::hasBeenRounde):
+        (WTF::MediaTime::isPositiveInfinite):
+        (WTF::MediaTime::isNegativeInfinite):
+        (WTF::MediaTime::isIndefinite):
+
+        Add constants for commonly used MediaTime values:
+        (WTF::MediaTime::zeroTime):
+        (WTF::MediaTime::invalidTime):
+        (WTF::MediaTime::positiveInfiniteTime):
+        (WTF::MediaTime::negativeInfiniteTime):
+        (WTF::MediaTime::indefiniteTime):
+
+        Add explicit conversion functions to convert to and from floating point values.
+        * wtf/MediaTime.cpp:
+        (WTF::MediaTime::createWithFloat):
+        (WTF::MediaTime::createWithDouble):
+        (WTF::MediaTime::toFloat):
+        (WTF::MediaTime::toDouble):
+
+        Add some useful exported functions:
+        * wtf/MediaTime.cpp:
+        (WTF::MediaTime::compare): Master function for the comparison operators above.
+        (WTF::MediaTime::setTimeScale): Rescale the time value to a new time scale.
+        (WTF::abs): Return an absolute value for the current MediaTime.
+
+        Static utility functions to implement the above:
+        * wtf/MediaTime.cpp:
+        (WTF::greatestCommonDivisor):
+        (WTF::leastCommonMultiple):
+        (WTF::signum):
+
+        Windows-only implementations of isinf and signbit:
+        * wtf/MediaTime.cpp:
+        (std::isinf):
+        (std::signbit):
+
+        Add the new class to platform build files:
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+
+2012-07-27  Wei James  <james.wei@intel.com>
+
+        set WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED for chromium android
+        https://bugs.webkit.org/show_bug.cgi?id=91746
+
+        Reviewed by Adam Barth.
+
+        This patch is part of efforts to enable web audio for chromium android.
+        Web audio component needs to use atomicIncrement and atomicDecrement,
+        which are enabled by this MACRO.
+
+        As mentioned in https://bugs.webkit.org/show_bug.cgi?id=89428#c19, make
+        this patch standalone.
+
+        * wtf/Atomics.h:
+        (WTF):
+
+2012-07-27  Wei James  <james.wei@intel.com>
+
+        set WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED for chromium android
+        https://bugs.webkit.org/show_bug.cgi?id=91746
+
+        Reviewed by Adam Barth.
+
+        This patch is part of efforts to enable web audio for chromium android.
+        Web audio component needs to use atomicIncrement and atomicDecrement,
+        which are enabled by this MACRO.
+
+        As mentioned in https://bugs.webkit.org/show_bug.cgi?id=89428#c19, make
+        this patch standalone.
+
+        * wtf/Atomics.h:
+        (WTF):
+
+2012-07-26  Arnaud Renevier  <a.renevier@sisa.samsung.com>
+
+        constructing TypedArray from another TypedArray is slow
+        https://bugs.webkit.org/show_bug.cgi?id=90838
+
+        Reviewed by Kenneth Russell.
+
+        Introduce virtual method getType on ArrayBufferView. It returns the actual
+        type of the view. This method replaces previous is<Type>Array() methods.
+
+        * wtf/ArrayBufferView.h:
+        * wtf/Float32Array.h:
+        (WTF::Float32Array::getType):
+        (Float32Array):
+        * wtf/Float64Array.h:
+        (WTF::Float64Array::getType):
+        (Float64Array):
+        * wtf/Int16Array.h:
+        (WTF::Int16Array::getType):
+        (Int16Array):
+        * wtf/Int32Array.h:
+        (WTF::Int32Array::getType):
+        (Int32Array):
+        * wtf/Int8Array.h:
+        (WTF::Int8Array::getType):
+        (Int8Array):
+        * wtf/IntegralTypedArrayBase.h:
+        * wtf/TypedArrayBase.h:
+        (TypedArrayBase):
+        (WTF::TypedArrayBase::item):
+        * wtf/Uint16Array.h:
+        (WTF::Uint16Array::getType):
+        (Uint16Array):
+        * wtf/Uint32Array.h:
+        (WTF::Uint32Array::getType):
+        (Uint32Array):
+        * wtf/Uint8Array.h:
+        (WTF::Uint8Array::getType):
+        (Uint8Array):
+        * wtf/Uint8ClampedArray.h:
+        (WTF::Uint8ClampedArray::getType):
+        (Uint8ClampedArray):
+
+2012-07-26  Zeno Albisser  <zeno@webkit.org>
+
+        [Qt] requestAnimationFrame should only trigger when a new frame can be displayed.
+        https://bugs.webkit.org/show_bug.cgi?id=88638
+
+        Disable REQUEST_ANIMATION_FRAME_TIMER for the Qt port and tie
+        the servicing of scripted animations to layer syncing for WK2.
+        For WK1 we rely on the RefreshAnimation that is based on QAbstractAnimation.
+
+        Reviewed by Jocelyn Turcotte.
+
+        * wtf/Platform.h:
+
+2012-07-26  Yury Semikhatsky  <yurys@chromium.org>
+
+        Unreviewed. Revert r123740 as it breaks AppleMac compilation.
+
+        * wtf/text/StringImpl.cpp:
+        * wtf/text/StringImpl.h:
+
+2012-07-26  Yury Semikhatsky  <yurys@chromium.org>
+
+        Web Inspector: move StringImpl size calculation to StringImpl
+        https://bugs.webkit.org/show_bug.cgi?id=92359
+
+        Reviewed by Pavel Feldman.
+
+        Moved stringSize(StringImpl*) implementation from InspectorMemoryAgent to
+        StringImpl::sizeInBytes();
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::sizeInBytes):
+        (WTF):
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+
+2012-07-25  Benjamin Poulain  <bpoulain@apple.com>
+
+        Initialize QualifiedName's strings from the read only data segment
+        https://bugs.webkit.org/show_bug.cgi?id=92226
+
+        Reviewed by Anders Carlsson.
+
+        Add constructors for StringImpl and AtomicString to be able to create
+        the strings from the literal in read only memory.
+
+        * wtf/text/AtomicString.cpp:
+        (HashTranslatorCharBuffer):
+        (WTF::LCharBufferFromLiteralDataTranslator::hash):
+        (LCharBufferFromLiteralDataTranslator):
+        (WTF::LCharBufferFromLiteralDataTranslator::equal):
+        (WTF::LCharBufferFromLiteralDataTranslator::translate):
+        (WTF::AtomicString::addFromLiteralData):
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::AtomicString):
+        (AtomicString):
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::createFromLiteral):
+        * wtf/text/StringImpl.h:
+        (WTF):
+        (StringImpl):
+        (WTF::StringImpl::createFromLiteral):
+
+2012-07-25  Michael Saboff  <msaboff@apple.com>
+
+        Convert HTML parser to handle 8-bit resources without converting to UChar*
+        https://bugs.webkit.org/show_bug.cgi?id=90321
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/text/WTFString.h:
+        (WTF::String::dataSize): New method to return the number of bytes 
+        the string requires.  This replaces a harcoded calculation based on
+        length and sizeof(UChar).
+
+2012-07-25  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        Create a specialized pair for use in HashMap iterators
+        https://bugs.webkit.org/show_bug.cgi?id=92137
+
+        Reviewed by Ryosuke Niwa.
+
+        The type used for internal storage in HashMap is exposed in its interface as iterator
+        "contents". Currently HashMap uses std::pair<>, which this patch replaces with
+        KeyValuePair.
+
+        Having this specialized structure will allow us to customize the members to be called
+        key/value, improving readability in code using HashMap iterators. They are still called
+        first/second to separate this change from the mechanical change of updating callsites.
+
+        * wtf/HashIterators.h:
+        (HashTableConstKeysIterator):
+        (HashTableConstValuesIterator):
+        (HashTableKeysIterator):
+        (HashTableValuesIterator):
+        Use KeyValuePair instead of std::pair when defining the iterators.
+
+        * wtf/HashMap.h:
+        (WTF):
+        (WTF::KeyValuePairKeyExtractor::extract):
+        (HashMap):
+        Remove PairFirstExtractor. Add and use the KeyValuePair corresponding extractor.
+
+        (WTF::HashMapValueTraits::isEmptyValue): Use KeyValuePairHashTraits for HashMaps.
+        (WTF::HashMapTranslator::translate):
+        (WTF::HashMapTranslatorAdapter::translate):
+        The traits of the mapped value is now called ValueTraits instead of SecondTraits.
+
+        * wtf/HashTable.h:
+        (WTF::hashTableSwap): Add specialization for swapping KeyValuePairs.
+        (WTF): Remove now unneeded specialization for std::pairs.
+
+        * wtf/HashTraits.h:
+        (KeyValuePair):
+        (WTF::KeyValuePair::KeyValuePair):
+        (WTF):
+        Specialized pair. In the future difference from pair should be the member names.
+
+        (KeyValuePairHashTraits):
+        (WTF::KeyValuePairHashTraits::emptyValue):
+        (WTF::KeyValuePairHashTraits::constructDeletedValue):
+        (WTF::KeyValuePairHashTraits::isDeletedValue):
+        These traits are analogous to PairHashTraits but for KeyValuePair.
+
+        * wtf/RefPtrHashMap.h: Use KeyValuePairHashTraits.
+
+2012-07-25  Andrew Wilson  <atwilson@chromium.org>
+
+        Unreviewed, rolling out r123560.
+        http://trac.webkit.org/changeset/123560
+        https://bugs.webkit.org/show_bug.cgi?id=90321
+
+        Breaks chromium valgrind tests.
+
+        * wtf/text/WTFString.h:
+
+2012-07-25  Csaba Osztrogonác  <ossy@webkit.org>
+
+        [Qt] There are parallel GC related crashes regularly
+        https://bugs.webkit.org/show_bug.cgi?id=90957
+
+        Rubber-stamped by Zoltan Herczeg.
+
+        * wtf/Platform.h: Disable parallel GC temporarily on Qt until proper fix.
+
+2012-07-24  Benjamin Poulain  <bpoulain@apple.com> && Joseph Pecoraro  <pecoraro@apple.com>
+
+        QualifiedName's HashSet should be big enough to hold at least all the static names
+        https://bugs.webkit.org/show_bug.cgi?id=91891
+
+        Reviewed by Darin Adler.
+
+        Add a static struct to compute the HashTable capacity for any given size at compile time.
+        This allow us to create HashTraits giving the minimumSize without hardcoding the values.
+
+        * wtf/HashTable.h:
+        (OneifyLowBits):
+        (UpperPowerOfTwoBound):
+        (HashTableCapacityForSize): Compute the HashTable capacity at compile time.
+
+2012-07-24  Michael Saboff  <msaboff@apple.com>
+
+        Convert HTML parser to handle 8-bit resources without converting to UChar*
+        https://bugs.webkit.org/show_bug.cgi?id=90321
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/text/WTFString.h:
+        (WTF::String::dataSize): New method to return the number of bytes 
+        the string requires.  This replaces a harcoded calculation based on
+        length and sizeof(UChar).
+
+2012-07-24  Sam Weinig  <sam@webkit.org>
+
+        Add per-HashTable stats
+        https://bugs.webkit.org/show_bug.cgi?id=92185
+
+        Reviewed by Anders Carlsson.
+
+        Add per-HashTable stats, so we can look at the effectiveness of an individual HashTable.
+
+        * wtf/HashTable.h:
+        (WTF::HashTable::Stats::Stats):
+        Add a HashTable::Stats to hold the stats.
+
+        (WTF::HashTable::Stats::recordCollisionAtCount):
+        (WTF::HashTable::Stats::dumpStats):
+        Add versions of recordCollisionAtCount and dumpStats for per-HashTable version.
+
+        (WTF::HashTable):
+        Keep the stats, if enabled, in an OwnPtr, to not blow JSCell max size restrictions.
+
+        (WTF::lookup):
+        (WTF::lookupForWriting):
+        (WTF::fullLookupForWriting):
+        (WTF::add):
+        (WTF::reinsert):
+        (WTF::remove):
+        (WTF::rehash):
+        Keep track of the stats as the table is used.
+
+2012-07-24  Patrick Gansterer  <paroga@webkit.org>
+
+        Store the full year in GregorianDateTime
+        https://bugs.webkit.org/show_bug.cgi?id=92067
+
+        Reviewed by Geoffrey Garen.
+
+        Use the full year instead of the offset from year 1900 
+        for the year member variable of GregorianDateTime.
+
+        * wtf/GregorianDateTime.h:
+        (WTF::GregorianDateTime::operator tm):
+
+2012-07-23  Patrick Gansterer  <paroga@webkit.org>
+
+        Move GregorianDateTime from JSC to WTF namespace
+        https://bugs.webkit.org/show_bug.cgi?id=91948
+
+        Reviewed by Geoffrey Garen.
+
+        Moving GregorianDateTime into the WTF namespace allows us to us to
+        use it in WebCore too. The new class has the same behaviour as the
+        old struct. Only the unused timeZone member has been removed.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/GregorianDateTime.h: Added.
+        (GregorianDateTime):
+
+2012-07-23  Rob Buis  <rbuis@rim.com>
+
+        [BlackBerry] Merge createThreadInternal implementations
+        https://bugs.webkit.org/show_bug.cgi?id=91899
+
+        Reviewed by Yong Li.
+
+        PR 111675
+
+        Remove our implementation since the default thread stack size on QNX is fine.
+
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::createThreadInternal):
+        (WTF::initializeCurrentThreadInternal): make sure we set the thread name.
+
+2012-07-23  Patrick Gansterer  <paroga@webkit.org>
+
+        [WINCE] Define NOMINMAX in the build system instead of Platform.h
+        https://bugs.webkit.org/show_bug.cgi?id=91938
+
+        Reviewed by Ryosuke Niwa.
+
+        * wtf/Platform.h:
+
+2012-07-23  Patrick Gansterer  <paroga@webkit.org>
+
+        Build fix for Windows after r123317.
+
+        * wtf/DateMath.cpp: Added missing header include.
+
+2012-07-23  Patrick Gansterer  <paroga@webkit.org>
+
+        [WIN] Use GetTimeZoneInformation() for calculateUTCOffset()
+        https://bugs.webkit.org/show_bug.cgi?id=91935
+
+        Reviewed by Ryosuke Niwa.
+
+        GetTimeZoneInformation() returns the offset directly. Using it
+        avoids unnecessary calculations and remove dependencies on
+        other time related function, which do not exist on WinCE.
+
+        * wtf/DateMath.cpp:
+        (WTF::calculateUTCOffset):
+
+2012-07-20  Han Shen  <shenhan@google.com>
+
+        [Chromium] Compilation fails under gcc 4.7
+        https://bugs.webkit.org/show_bug.cgi?id=90227
+
+        Reviewed by Tony Chang.
+
+        Disable warnings about c++0x compatibility in gcc newer than 4.6.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-07-19  Dan Bernstein  <mitz@apple.com>
+
+        The ATSUI-based complex text code is unused
+        https://bugs.webkit.org/show_bug.cgi?id=91816
+
+        Reviewed by Sam Weinig.
+
+        Removed definitions of WTF_USE_ATSUI and WTF_USE_CORE_TEXT.
+
+        * wtf/Platform.h:
+
+2012-07-19  Wei James  <james.wei@intel.com>
+
+        enable Web Audio for chromium android port
+        https://bugs.webkit.org/show_bug.cgi?id=89428
+
+        Reviewed by Kenneth Russell.
+
+        * wtf/MathExtras.h:
+        (log2):
+        (log2f):
+
+2012-07-19  Scott Graham  <scottmg@chromium.org>
+
+        [Chromium] disable warning on Windows from gcc-only pragma in Assertions.cpp"
+        https://bugs.webkit.org/show_bug.cgi?id=91776
+
+        Reviewed by Ryosuke Niwa.
+
+        Avoids:
+            ...\source\wtf\wtf\assertions.cpp(31) : warning C4068: unknown pragma
+
+        * WTF.gyp/WTF.gyp:
+
+2012-07-19  Robert Sesek  <rsesek@chromium.org>
+
+        [chromium][Mac] Switch the MACOSX_DEPLOYMENT_TARGET to 10.6
+        https://bugs.webkit.org/show_bug.cgi?id=91752
+
+        Reviewed by Eric Seidel.
+
+        When building CHROMIUM && DARWIN, do not enable ATSUI support.
+
+        * wtf/Platform.h:
+
+2012-07-18  Yong Li  <yoli@rim.com>
+
+        [BlackBerry] Implement currentTime() and monotonicallyIncreasingTime() for OS(QNX)
+        https://bugs.webkit.org/show_bug.cgi?id=91659
+
+        Reviewed by Rob Buis.
+
+        Implement currentTime() and monotonicallyIncreasingTime() for OS(QNX) with clock_gettime().
+
+        * wtf/CurrentTime.cpp:
+        (WTF):
+        (WTF::currentTime):
+        (WTF::monotonicallyIncreasingTime):
+
+2012-07-18  Tom Sepez  <tsepez@chromium.org>
+
+        OOB read of stack buffer below DoubleToStringConverter::CreateExponentialRepresentation() in debug builds
+        https://bugs.webkit.org/show_bug.cgi?id=91642
+
+        Reviewed by Abhishek Arya.
+
+        * wtf/dtoa/double-conversion.cc:
+        (DoubleToStringConverter::CreateExponentialRepresentation): NUL-terminate string buffer before passing it to StringBuilder::AddSubstring()
+        
+2012-07-18  Michael Saboff  <msaboff@apple.com>
+
+        Make TextCodecLatin1 handle 8 bit data without converting to UChar's
+        https://bugs.webkit.org/show_bug.cgi?id=90319
+
+        Reviewed by Oliver Hunt.
+
+        * wtf/text/StringImpl.h:
+        (StringImpl): Exported LChar variant of adopt().
+        * wtf/text/WTFString.h:
+        (WTF::String::createUninitialized): Exported LChar variant.
+
+2012-07-18  Rob Buis  <rbuis@rim.com>
+
+        Alignment crash in MIMESniffer
+        https://bugs.webkit.org/show_bug.cgi?id=89787
+
+        Reviewed by Yong Li.
+
+        PR 169064
+
+        Change isPointerTypeAlignmentOkay so calling it does not require ifdefs.
+
+        * wtf/StdLibExtras.h:
+        (isPointerTypeAlignmentOkay):
+
+2012-07-17  Gabor Ballabas  <gaborb@inf.u-szeged.hu>
+
+        [Qt][V8] Remove the V8 related codepaths and configuration
+        https://bugs.webkit.org/show_bug.cgi?id=90863
+
+        Reviewed by Simon Hausmann.
+
+        * WTF.pri:
+
+2012-07-17  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r122834.
+        http://trac.webkit.org/changeset/122834
+        https://bugs.webkit.org/show_bug.cgi?id=91492
+
+        it broke the chromium (Requested by kkristof on #webkit).
+
+        * WTF.pri:
+
+2012-07-17  Gabor Ballabas  <gaborb@inf.u-szeged.hu>
+
+        [Qt][V8] Remove the V8 related codepaths and configuration
+        https://bugs.webkit.org/show_bug.cgi?id=90863
+
+        Reviewed by Simon Hausmann.
+
+        * WTF.pri:
+
+2012-07-16  Hajime Morrita  <morrita@chromium.org>
+
+        WebCore needs WEBCORE_TESTING macro to mark methods being exported for testing.
+        https://bugs.webkit.org/show_bug.cgi?id=90764
+
+        Reviewed by Adam Barth.
+
+        Added USE(EXPORT_MACROS_FOR_TESTING) and enabled it on GTK and Windows.
+
+        * wtf/ExportMacros.h:
+        * wtf/Platform.h:
+
+2012-07-16  Filip Pizlo  <fpizlo@apple.com>
+
+        Unreviewed build fix.
+
+        * wtf/FastMalloc.cpp:
+        (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+
+2012-07-16  Adam Treat  <atreat@rim.com>
+
+        [BlackBerry] Use newer version of platform API to implement callOnMainThread
+        https://bugs.webkit.org/show_bug.cgi?id=91404
+
+        Reviewed by Yong Li.
+
+        Right now we're using an outdated API that involves a virtual function call for no reason.
+        Use the new API that is much more direct and to the point.
+
+        * wtf/blackberry/MainThreadBlackBerry.cpp:
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+
+2012-07-14  Filip Pizlo  <fpizlo@apple.com>
+
+        Unreviewed, build fix.
+
+        * wtf/Assertions.cpp:
+        * wtf/Platform.h:
+        * wtf/unicode/icu/CollatorICU.cpp:
+        (WTF::Collator::userDefault):
+
+2012-07-13  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        Move WebCore/platform/text/Base64 to WTF/wtf/text
+        https://bugs.webkit.org/show_bug.cgi?id=91162
+
+        Reviewed by Adam Barth.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/text/Base64.cpp: Renamed from Source/WebCore/platform/text/Base64.cpp.
+        (WTF):
+        (WTF::base64Encode):
+        (WTF::base64Decode):
+        (WTF::base64DecodeInternal):
+        * wtf/text/Base64.h: Renamed from Source/WebCore/platform/text/Base64.h.
+        (WTF):
+        (WTF::base64Encode):
+
+2012-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Add API to get HTTPS status to WebKit2 GTK+
+        https://bugs.webkit.org/show_bug.cgi?id=91100
+
+        Reviewed by Martin Robinson.
+
+        Add support for GByteArray.
+
+        * wtf/gobject/GRefPtr.cpp:
+        (WTF::refGPtr):
+        (WTF):
+        (WTF::derefGPtr):
+        * wtf/gobject/GRefPtr.h:
+        (WTF):
+        * wtf/gobject/GTypedefs.h:
+
+2012-07-12  Maciej Stachowiak  <mjs@apple.com>
+
+        Document ListHashSet iteration guarantees
+        https://bugs.webkit.org/show_bug.cgi?id=91106
+
+        Reviewed by Eric Seidel.
+
+        * wtf/ListHashSet.h:
+        (WTF): Expand class comment to document this.
+
+2012-07-11  Mark Rowe  <mrowe@apple.com>
+
+        <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions.
+
+        Reviewed by Dan Bernstein.
+
+        The deployment target is already set to the version that we're targeting, and it's that setting
+        which determines which functionality from the SDK is available to us.
+
+        * Configurations/Base.xcconfig:
+
+2012-07-11  Mark Rowe  <mrowe@apple.com>
+
+        Replace definitions of BUILDING_ON / TARGETING macros with macros that will error when used.
+
+        Part of <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros.
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/Platform.h:
+
+2012-07-11  Mark Rowe  <mrowe@apple.com>
+
+        Switch a few cases that care about the SDK over to checking __MAC_OS_X_VERSION_MAX_ALLOWED so that things build.
+
+        Part of <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/FastMalloc.cpp:
+        (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): The SDK we're building against determines how many elements
+        the structure is declared as having.
+
+2012-07-11  Mark Rowe  <mrowe@apple.com>
+
+        <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros
+
+        This removal was handled by a script that translates the relevant macros in to the equivalent checks
+        using the system availability macros.
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/Assertions.cpp:
+        * wtf/FastMalloc.cpp:
+        * wtf/Platform.h:
+        * wtf/ThreadingPthreads.cpp:
+        * wtf/unicode/icu/CollatorICU.cpp:
+
+2012-07-11  Anders Carlsson  <andersca@apple.com>
+
+        Add -Wtautological-compare and -Wsign-compare warning flags
+        https://bugs.webkit.org/show_bug.cgi?id=90994
+
+        Reviewed by Mark Rowe.
+
+        * Configurations/Base.xcconfig:
+
+2012-07-10  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
+
+        Re-enable __declspec(dl{import,export}) for MinGW when using EXPORT_MACROS
+        https://bugs.webkit.org/show_bug.cgi?id=90612
+
+        Reviewed by Csaba Osztrogonác.
+
+        MinGW was switched to use auto import/export of symbols on r44184.
+        From my understanding of the documentation, MinGW will not auto-export symbols
+        unless there are no explicit __declspec(dlexport) in the DLL already.
+
+        The issues that originally made us rely on the auto-import feature of MinGW
+        should now be resolved with the EXPORT_MACROS work. This patch re-enables them.
+
+        It also removes the GCC check for internal symbols hiding as the visibility should
+        already be hidden by default for both MSVC and GCC on Windows anyway.
+
+        * wtf/ExportMacros.h:
+
+2012-07-09  No'am Rosenthal  <noam.rosenthal@nokia.com>
+
+        Shared code that is guarded with ENABLE(WEBGL) should be guarded with USE()
+        https://bugs.webkit.org/show_bug.cgi?id=90506
+
+        Reviewed by Martin Robinson.
+
+        Made USE(3D_GRAPHICS) default to true when ENABLE(WEBGL) is true.
+        Also updated the Qt default to always use TEXTURE_MAPPER, and to use TEXTURE_MAPPER_GL when
+        3D_GRAPHICS is used.
+
+        * wtf/Platform.h:
+
+2012-07-08  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
+
+        Introduce a build flag for low quality JPEG images
+        https://bugs.webkit.org/show_bug.cgi?id=90748
+
+        Reviewed by Adam Barth.
+
+        Turn on the newly introduced flags for android.
+
+        * wtf/Platform.h:
+
+2012-07-05  Filip Pizlo  <fpizlo@apple.com>
+
+        INLINE_ARM_FUNCTION(thingy) should make thingy be thumb2 if we're using thumb2
+        https://bugs.webkit.org/show_bug.cgi?id=90644
+
+        Reviewed by Mark Hahnenberg.
+        
+        Fix breakage introduced in http://trac.webkit.org/changeset/121885
+
+        * wtf/InlineASM.h:
+
+2012-07-05  Zoltan Herczeg  <zherczeg@webkit.org>
+
+        Port DFG JIT to traditional ARM
+        https://bugs.webkit.org/show_bug.cgi?id=90198
+
+        Reviewed by Filip Pizlo.
+
+        Enabling DFG JIT on ARM systems with 32 bit instruction set.
+
+        * wtf/InlineASM.h:
+        * wtf/Platform.h:
+
+2012-07-04  Andy Wingo  <wingo@igalia.com>
+
+        [GTK] Enable parallel GC
+        https://bugs.webkit.org/show_bug.cgi?id=90568
+
+        Reviewed by Martin Robinson.
+
+        * wtf/Platform.h: Add GTK to the ENABLE_PARALLEL_GC party.
+
+2012-07-04  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Get rid of un-needed QT += declarative for Qt 5
+
+        The declarative module has been renamed to quick1 in Qt 5, and the
+        engine-only module for Qt 5 is named 'qml'. For many of the instances
+        we could just remove 'declarative', since the project file was only
+        used for Qt5/WebKit2 builds. In the other cases the module was wrapped
+        in a haveQt(4) scope.
+
+        Reviewed by Csaba Osztrogonác.
+
+        * WTF.pri:
+
+2012-07-03  Yong Li  <yoli@rim.com>
+
+        [BlackBerry] Turn on DFGJIT in Platform.h
+        https://bugs.webkit.org/show_bug.cgi?id=90482
+
+        Set ENABLE_DFG_JIT for PLATFORM(BLACKBERRY).
+
+        Reviewed by Rob Buis.
+
+        * wtf/Platform.h:
+
+2012-07-03  Tony Chang  <tony@chromium.org>
+
+        [chromium] Unreviewed, update .gitignore to handle VS2010 files.
+
+        * WTF.gyp/.gitignore:
+
+2012-07-03  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Make use of .qmake.cache for caching features
+
+        Instead of loading() features from the files that need them (and re-running
+        a bunch of checks), we now run feature detection as part of configure.pro,
+        and have build-webkit write the computed feature-defines and CONFIG to
+        .qmake.cache, which is then loaded by qmake _before_ even defaults_pre
+        when building WebKit.pro.
+
+        At some point we'll be able to selectivly prevent running of config tests
+        in configure.pro, which means we don't need a separate code-path for
+        the build-webkit --help case.
+
+        We should also move the code in build-webkit that now uses .webkit.config
+        to detect clean builds, to use .qmake.cache, since we now store the same
+        thing there.
+
+        Original patch by Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
+
+        Reviewed by Tor Arne Vestbø.
+
+        * WTF.pri:
+
+2012-07-03  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r121766.
+        http://trac.webkit.org/changeset/121766
+        https://bugs.webkit.org/show_bug.cgi?id=90465
+
+        It caused flakey build errors on the bots (Requested by Ossy
+        on #webkit).
+
+        * WTF.pri:
+
+2012-07-03  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Make use of .qmake.cache for caching features
+
+        Instead of loading() features from the files that need them (and re-running
+        a bunch of checks), we now run feature detection as part of configure.pro,
+        and have build-webkit write the computed feature-defines and CONFIG to
+        .qmake.cache, which is then loaded by qmake _before_ even defaults_pre
+        when building WebKit.pro.
+
+        At some point we'll be able to selectivly prevent running of config tests
+        in configure.pro, which means we don't need a separate code-path for
+        the build-webkit --help case.
+
+        We should also move the code in build-webkit that now uses .webkit.config
+        to detect clean builds, to use .qmake.cache, since we now store the same
+        thing there.
+
+        Original patch by Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
+
+        Reviewed by Tor Arne Vestbø.
+
+        * WTF.pri:
+
+2012-07-03  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>  Joel Dillon <joel.dillon@codethink.co.uk>
+
+        [Qt][Win] Fix broken QtWebKit5.lib linking
+        https://bugs.webkit.org/show_bug.cgi?id=88321
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Instead of letting a module's headers know which other modules depend on them,
+        have depending modules define explicitely that they want its symbols exported too.
+
+        JavaScriptCore should then be compiled with both BUILDING_JavaScriptCore and
+        STATICALLY_LINKED_WITH_WTF.
+
+        * wtf/ExportMacros.h:
+
+2012-06-29  Tony Chang  <tony@chromium.org>
+
+        Unreviewed, rolling out r121572.
+        http://trac.webkit.org/changeset/121572
+        https://bugs.webkit.org/show_bug.cgi?id=90249
+
+        Breaks Mac build since it depends on r121547, which was rolled
+        out
+
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::initializeCurrentThreadInternal):
+
+2012-06-29  Eric Seidel  <eric@webkit.org>
+
+        Remove BUILDING_ON_LEOPARD now that no ports build on Leopard
+        https://bugs.webkit.org/show_bug.cgi?id=90249
+
+        Reviewed by Ryosuke Niwa.
+
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::initializeCurrentThreadInternal):
+
+2012-06-29  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r121529.
+        http://trac.webkit.org/changeset/121529
+        https://bugs.webkit.org/show_bug.cgi?id=90260
+
+        Failed to compile on Chromium WebKitMacBuilder (Requested by
+        keishi on #webkit).
+
+        * wtf/FastMalloc.cpp:
+        (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+        * wtf/unicode/icu/CollatorICU.cpp:
+        (WTF::Collator::userDefault):
+
+2012-06-29  Eric Seidel  <eric@webkit.org>
+
+        Remove more BUILDING_ON_LEOPARD branches now that no port builds on Leopard
+        https://bugs.webkit.org/show_bug.cgi?id=90252
+
+        Reviewed by Ryosuke Niwa.
+
+        * wtf/FastMalloc.cpp:
+        (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+        * wtf/unicode/icu/CollatorICU.cpp:
+        (WTF::Collator::userDefault):
+
+2012-06-29  Eric Seidel  <eric@webkit.org>
+
+        Remove more BUILDING_ON_LEOPARD usage in PLATFORM(MAC) code
+        https://bugs.webkit.org/show_bug.cgi?id=85846
+
+        Reviewed by Adam Barth.
+
+        PLATFORM(MAC) has not supported Leopard for several months now.
+        This change removes about 1/3 of the remaining BUILDING_ON_LEOPARD
+        uses in the PLATFORM(MAC) codepaths.  PLATFORM(CHROMIUM) still
+        supports BUILDING_ON_LEOPARD for now.
+
+        * wtf/Platform.h:
+
+2012-06-28  Kalev Lember  <kalevlember@gmail.com>
+
+        ThreadingWin: Silence GCC compiler warnings
+        https://bugs.webkit.org/show_bug.cgi?id=89491
+
+        Reviewed by Adam Roben.
+
+        * wtf/ThreadingWin.cpp:
+        (WTF::createThreadInternal):
+        (WTF::PlatformCondition::timedWait):
+        (WTF::PlatformCondition::signal): Fix unused-but-set-variable
+        warnings.
+
+2012-06-26  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Add missing heades to HEADERS
+
+        For JavaScriptCore there aren't any Qt specific files, so we include all
+        headers for easy editing in Qt Creator.
+
+        Reviewed by Simon Hausmann.
+
+        * WTF.pro:
+
+2012-06-25  Kent Tamura  <tkent@chromium.org>
+
+        Unreviewed, rolling out r121145.
+        http://trac.webkit.org/changeset/121145
+        https://bugs.webkit.org/show_bug.cgi?id=89847
+
+        Had an objection for the change.
+
+        * wtf/text/StringBuilder.h:
+
+2012-06-25  Yong Li  <yoli@rim.com>
+
+        [BlackBerry] Add JSC statistics into about:memory
+        https://bugs.webkit.org/show_bug.cgi?id=89779
+
+        Reviewed by Rob Buis.
+
+        Turn on WTF_USE_EXPORT_MACROS for BlackBerry port.
+        This will make macros like JS_EXPORT_PRIVATE work without
+        extra porting.
+
+        * wtf/Platform.h:
+
+2012-06-25  Adam Barth  <abarth@webkit.org>
+
+        Use InterpolationLow on chromium-android
+        https://bugs.webkit.org/show_bug.cgi?id=89849
+
+        Reviewed by Daniel Bates.
+
+        Introduce a USE macro to control image interpolation quality.
+
+        * wtf/Platform.h:
+
+2012-06-25  Kent Tamura  <tkent@chromium.org>
+
+        Change the serialization format of form control state to make the code simple
+        https://bugs.webkit.org/show_bug.cgi?id=89847
+
+        Reviewed by Hajime Morita.
+
+        * wtf/text/StringBuilder.h:
+        (WTF::StringBuilder::appendEscaped): Added. This function adds the
+        escaped form of the input string. e.g. if stiring="foo,bar" escape='\'
+        special=',', the appended string is foo\,bar.
+
+2012-06-24  Adam Barth  <abarth@webkit.org>
+
+        Remove USE(CHROMIUM_NET) because it is unused
+        https://bugs.webkit.org/show_bug.cgi?id=89850
+
+        Reviewed by Eric Seidel.
+
+        I didn't see any mentions of CHROMIUM_NET when I grepped the Source
+        directory. Also, this USE macro isn't defined on OS(DARWIN) or
+        OS(ANDROID), which seems a bit odd given that Chromium uses the same
+        network stack on all platforms.
+
+        * wtf/Platform.h:
+
+2012-06-22  Peter Beverloo  <peter@chromium.org>
+
+        [Chromium] Disable c++0x compatibility warnings in JavaScriptCore.gyp when building for Android
+        https://bugs.webkit.org/show_bug.cgi?id=88853
+
+        Reviewed by Steve Block.
+
+        The Android exclusions were necessary to fix a gyp generation error, as
+        the gcc_version variable wasn't being defined for Android. Remove these
+        exceptions when Chromium is able to define the gcc_version variable.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-06-18  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
+
+        Causes crashes in LLVMPipe
+        https://bugs.webkit.org/show_bug.cgi?id=89358
+
+        Reviewed by Martin Robinson.
+
+        Change suggested by Dave Airlie and Xan Lopez.
+
+        * wtf/Platform.h: disable global fastMalloc for GTK+
+
+2012-06-22  Mario Sanchez Prada  <msanchez@igalia.com>
+
+        Memory corruption on HashTable.h
+        https://bugs.webkit.org/show_bug.cgi?id=88419
+
+        Reviewed by Martin Robinson.
+
+        Simplify definition of WTF_USE_PTHREADS and HAVE_PTHREAD_RWLOCK
+        for the GTK platform using OS(LINUX) instead of HAVE(PTHREAD_H).
+
+        * wtf/Platform.h:
+
+2012-06-21  Parth Patel  <parpatel@rim.com>
+
+        [Blackberry] BlackBerry::Platform::Settings::get() rename to BlackBerry::Platform::Settings::instance() to make it consistent with our other singletons
+        https://bugs.webkit.org/show_bug.cgi?id=89684
+
+        Reviewed by Yong Li.
+        
+        Update setting instance access to use instance() instead of get().
+
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::createThreadInternal):
+
+2012-06-21  Kalev Lember  <kalevlember@gmail.com>
+
+        [GTK] Fix NPAPI plugins on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=54531
+
+        Reviewed by Martin Robinson.
+
+        Define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH for the GTK+ port, and
+        include OwnPtrWin.cpp in the list of files built on Windows.
+
+        * GNUmakefile.am:
+        * GNUmakefile.list.am:
+        * wtf/Platform.h:
+
+2012-06-21  Balazs Kelemen  <kbalazs@webkit.org>
+
+        Compile error: 'bool std::isinf(float)' is not 'constexpr' with GCC 4.6 in C++11 mode
+        https://bugs.webkit.org/show_bug.cgi?id=88721
+
+        Reviewed by Csaba Osztrogonác.
+
+        Don't define these as consexpr because with gcc 4.6
+        they call non constexpr functions.
+        * wtf/MathExtras.h:
+        (std::wtf_isinf):
+        (std::wtf_isnan):
+
+2012-06-17  Filip Pizlo  <fpizlo@apple.com>
+
+        It should be possible to look at disassembly
+        https://bugs.webkit.org/show_bug.cgi?id=89319
+
+        Reviewed by Sam Weinig.
+        
+        Made changes to Assertions.h to make it friendly to C code again.
+        
+        Added ENABLE(DISASSEMBLER) and USE(UDIS86) logic to Platform.h.
+
+        * wtf/Assertions.h:
+        * wtf/Platform.h:
+
+2012-06-19  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        REGRESSION(r120552): Many tests timing out on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=89433
+
+        Reviewed by Andy Estes.
+
+        * wtf/CurrentTime.cpp:
+        (WTF::lowResUTCTime):
+        It looks like there were two bugs:
+        1) the function was converting from 100ths of nanoseconds to seconds
+           rather than 100s of nanoseconds to seconds by dividing by
+           (nsPerSecond * 100) rather than (nsPerSecond / 100)
+        2) the function should've been returning milliseconds, not seconds
+
+2012-06-18  Tony Payne  <tpayne@chromium.org>
+
+        [chromium] Add iccjpeg and qcms to chromium port.
+        https://bugs.webkit.org/show_bug.cgi?id=81974
+
+        * wtf/Platform.h: Add Chromium USE defines for ICCJPEG and QCMSLIB
+        to each Chromium platform, excluding Android.
+
+        Reviewed by Adam Barth.
+
+2012-06-18  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r120485 and r120582.
+        http://trac.webkit.org/changeset/120485
+        http://trac.webkit.org/changeset/120582
+        https://bugs.webkit.org/show_bug.cgi?id=89345
+
+        chromeos tree breakage (Requested by morrita on #webkit).
+
+        * wtf/Platform.h:
+
+2012-06-17  Patrick Gansterer  <paroga@webkit.org>
+
+        [WIN] Simplify implementation of currentTime()
+        https://bugs.webkit.org/show_bug.cgi?id=83156
+
+        Reviewed by Brent Fulgham.
+
+        Use GetSystemTimeAsFileTime() instead of ftime().
+        This avoids an unneeded call to the MS CRT and
+        brings the Win/WinCE code closer together.
+
+        * wtf/CurrentTime.cpp:
+        (WTF::lowResUTCTime):
+        (WTF::currentTime):
+
+2012-06-15  Tony Payne  <tpayne@chromium.org>
+
+        [chromium] Add iccjpeg and qcms to chromium port.
+        https://bugs.webkit.org/show_bug.cgi?id=81974
+
+        * wtf/Platform.h: Add Chromium USE defines for ICCJPEG and QCMSLIB
+        to each Chromium platform, excluding Android.
+
+        Reviewed by Adam Barth.
+
+2012-06-14  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r120393.
+        http://trac.webkit.org/changeset/120393
+        https://bugs.webkit.org/show_bug.cgi?id=89163
+
+        breaks cr-mac build (Requested by morrita on #webkit).
+
+        * wtf/Platform.h:
+
+2012-06-14  Tony Payne  <tpayne@chromium.org>
+
+        [chromium] Add iccjpeg and qcms to chromium port.
+        https://bugs.webkit.org/show_bug.cgi?id=81974
+
+        * wtf/Platform.h: Add Chromium USE defines for ICCJPEG and QCMSLIB
+        to each Chromium platform, excluding Android.
+
+        Reviewed by Adam Barth.
+
+2012-06-14  Yong Li  <yoli@rim.com>
+
+        [BlackBerry] Implement computeRAMSize for QNX
+        https://bugs.webkit.org/show_bug.cgi?id=89110
+
+        Reviewed by Rob Buis.
+
+        * wtf/RAMSize.cpp:
+        (WTF::computeRAMSize):
+
+2012-06-14  Geoffrey Garen  <ggaren@apple.com>
+
+        ARMv7 should support spinlocks
+        https://bugs.webkit.org/show_bug.cgi?id=88957
+
+        Reviewed by Darin Adler.
+
+        More info @ http://infocenter.arm.com/help/topic/
+        com.arm.doc.genc007826/Barrier_Litmus_Tests_and_Cookbook_A08.pdf
+
+        * wtf/Atomics.h:
+        (WTF::memoryBarrierAfterLock):
+        (WTF::memoryBarrierBeforeUnlock): Added memory barrier primitives since
+        ARMv7 has a weakly ordered memory model.
+
+        * wtf/Platform.h: Enabled compare-and-swap on Windows so our spinlock
+        implementation would continue working on Windows.
+
+        * wtf/TCSpinLock.h:
+        (TCMalloc_SpinLock::Lock):
+        (TCMalloc_SpinLock::Unlock):
+        (TCMalloc_SpinLock): Use our compare-and-swap helper function to avoid
+        rewriting it in assembly here.
+
+        Added memory barriers since ARMv7 needs them.
+
+        Removed PPC support because our helper function doesn't support PPC.
+
+2012-06-13  Arnaud Renevier  <arno@renevier.net>
+
+        make sure headers are included only once per file
+        https://bugs.webkit.org/show_bug.cgi?id=88929
+
+        Reviewed by Kentaro Hara.
+
+        * wtf/FastMalloc.cpp:
+        * wtf/MathExtras.h:
+        * wtf/OSAllocator.h:
+
+2012-06-13  Benjamin Poulain  <benjamin@webkit.org>
+
+        Implement the simple constructors WTFURL's KURL
+        https://bugs.webkit.org/show_bug.cgi?id=85724
+
+        Reviewed by Adam Barth.
+
+        This patch extends WTFURL with:
+        -support basic debugging using print() methods
+        -parsing in the incomming string character set (8bits or 16bits)
+        -add a function for parsing of relative URL (but no implementation yet)
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/text/WTFString.h:
+        (String):
+        * wtf/url/api/ParsedURL.cpp:
+        (WTF::ParsedURL::ParsedURL):
+        (WTF):
+        (WTF::ParsedURL::hasFragment): Add this method to query the framgent availability without
+        allocating a new String.
+        (WTF::ParsedURL::withoutFragment): This method is added to implement KURL::removeFragmentIdentifier() and
+        the parsing of empty relative URL (where we return the base without fragment).
+        (WTF::ParsedURL::print):
+        * wtf/url/api/ParsedURL.h:
+        (ParsedURL):
+        (WTF::ParsedURL::spec):
+        * wtf/url/api/URLString.h:
+        (URLString):
+        * wtf/url/src/URLParser.h:
+        (WTF):
+        (URLParser):
+        (WTF::URLParser::parseURLWithBase):
+        * wtf/url/src/URLSegments.cpp:
+        (WTF::URLSegments::length):
+        (WTF::URLSegments::charactersBefore):
+        * wtf/url/src/URLSegments.h:
+        (URLSegments):
+        Change the boolean argument includeDelimiter in favor of an enum to improve readability.
+
+2012-06-13  Filip Pizlo  <fpizlo@apple.com>
+
+        DFG should be able to set watchpoints on global variables
+        https://bugs.webkit.org/show_bug.cgi?id=88692
+
+        Reviewed by Geoffrey Garen.
+        
+        Added ability to set the inline capacity of segmented vectors.
+        
+        Also added the ability ot ASSERT_NOT_REACHED() without having to
+        propagate NO_RETURN macros, which would be a show-stopper for code
+        that is conditionally unreachable.
+
+        * wtf/Assertions.h:
+        (UNREACHABLE_FOR_PLATFORM):
+        * wtf/SegmentedVector.h:
+        (WTF):
+        (SegmentedVectorIterator):
+        (WTF::SegmentedVectorIterator::operator=):
+        (WTF::SegmentedVectorIterator::SegmentedVectorIterator):
+        (SegmentedVector):
+
+2012-06-13  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r120172.
+        http://trac.webkit.org/changeset/120172
+        https://bugs.webkit.org/show_bug.cgi?id=88976
+
+        The patch causes compilation failures on Gtk, Qt and Apple Win
+        bots (Requested by zdobersek on #webkit).
+
+        * wtf/SegmentedVector.h:
+        (WTF):
+        (SegmentedVectorIterator):
+        (WTF::SegmentedVectorIterator::operator=):
+        (WTF::SegmentedVectorIterator::SegmentedVectorIterator):
+        (SegmentedVector):
+
+2012-06-10  Filip Pizlo  <fpizlo@apple.com>
+
+        DFG should be able to set watchpoints on global variables
+        https://bugs.webkit.org/show_bug.cgi?id=88692
+
+        Reviewed by Geoffrey Garen.
+        
+        Added ability to set the inline capacity of segmented vectors.
+
+        * wtf/SegmentedVector.h:
+        (WTF):
+        (SegmentedVectorIterator):
+        (WTF::SegmentedVectorIterator::operator=):
+        (WTF::SegmentedVectorIterator::SegmentedVectorIterator):
+        (SegmentedVector):
+
+2012-06-12  Geoffrey Garen  <ggaren@apple.com>
+
+        Try to fix the build.
+
+        Maybe don't export inlined functions.
+
+        * wtf/ThreadingPrimitives.h:
+        (WTF::MutexTryLocker::MutexTryLocker):
+        (WTF::MutexTryLocker::~MutexTryLocker):
+        (WTF::MutexTryLocker::locked):
+
+2012-06-11  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
+
+        Using extrernal ICU library on case unsensitive drives will not work
+        https://bugs.webkit.org/show_bug.cgi?id=70913
+
+        Reviewed by Csaba Osztrogonác.
+
+        Properly set the include path for the WTF module and for modules using it.
+        The path should include Source/WTF/wtf only when building WTF itself. Other
+        modules are expected to include the headers as #include <wtf/Header.h>, so
+        only add Source/WTF to their include path.
+
+        "unicode/utf8.h" should now then always reference to ICU in the include path
+        and "wtf/unicode/UTF8.h" reference to the WTF version.
+        This will work as long as WTF object files don't depend on ICU themselves.
+
+        Removed gobject, qt and unicode from the include path as those directories
+        don't exist anymore.
+
+        * WTF.pri:
+        * WTF.pro:
+
+2012-06-11  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        Unreviewed. Fix make distcheck issues.
+
+        * GNUmakefile.list.am: Add missing header file.
+
+2012-06-09  Dominic Cooney  <dominicc@chromium.org>
+
+        [Chromium] Remove JavaScriptCore dependencies from gyp
+        https://bugs.webkit.org/show_bug.cgi?id=88510
+
+        Reviewed by Adam Barth.
+
+        Chromium doesn't support JSC any more and there doesn't seem to be
+        a strong interest in using GYP as the common build system in other
+        ports.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-06-08  Andy Wingo  <wingo@igalia.com>
+
+        Explictly mark stubs called by JIT as being internal
+        https://bugs.webkit.org/show_bug.cgi?id=88552
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/ExportMacros.h (WTF_INTERNAL, HAVE_INTERNAL_VISIBILITY): New
+        defines.  Regardless of what the port does about visibility in
+        general, for code referenced only from assembly it is useful to
+        give it internal visibility.
+        * wtf/InlineASM.h: Split SYMBOL_STRING_RELOCATION into
+        LOCAL_REFERENCE and GLOBAL_REFERENCE; the former will try to avoid
+        indirection if HAVE(INTERNAL_VISIBILITY).
+
+2012-06-07  Csaba Osztrogonác  <ossy@webkit.org>
+
+        [Qt][Win] Fix linking WTF with ICU
+        https://bugs.webkit.org/show_bug.cgi?id=88302
+
+        Reviewed by Simon Hausmann.
+
+        * WTF.pri: Use proper library names on win32 platforms.
+
+2012-06-06  Michael Saboff  <msaboff@apple.com>
+
+        ENH: Add Logging to GC Marking Phase
+        https://bugs.webkit.org/show_bug.cgi?id=88364
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/DataLog.cpp:
+        (WTF::dataLogString): Additional method to support GC Mark logging.
+        * wtf/DataLog.h:
+        * wtf/Platform.h: New ENABLE_OBJECT_MARK_LOGGING flag macro.
+
+2012-06-06  Andy Wingo  <wingo@igalia.com>
+
+        [GTK] Enable the LLInt
+        https://bugs.webkit.org/show_bug.cgi?id=88315
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/InlineASM.h: Add an implementation of LOCAL_LABEL_STRING for
+        OS(LINUX).
+        * wtf/Platform.h: Add OS(LINUX) to the set of operating systems
+        for ENABLE_LLINT.  Add a specific check for PLATFORM(MAC) or
+        PLATFORM(IOS), and add to that a check for PLATFORM(GTK).
+
+2012-06-05  Roland Takacs  <takacs.roland@stud.u-szeged.hu>
+
+        [Qt] Use GraphicsContext3DOpenGLES.cpp when using OpenGL ES
+        https://bugs.webkit.org/show_bug.cgi?id=78720
+
+        Reviewed by Noam Rosenthal.
+
+        Defined a global Opengl ES macro to check OpenGL ES on every platforms.
+
+        * wtf/Platform.h:
+
+2012-06-04  Takashi Toyoshima  <toyoshim@chromium.org>
+
+        [WebSocket] Send requires super linear time against data size
+        https://bugs.webkit.org/show_bug.cgi?id=87383
+
+        Reviewed by Kent Tamura.
+
+        * wtf/StreamBuffer.h: Added.
+        (WTF):
+        (StreamBuffer):
+        (WTF::StreamBuffer::StreamBuffer):
+        (WTF::StreamBuffer::~StreamBuffer):
+        (WTF::StreamBuffer::isEmpty):
+        (WTF::StreamBuffer::append):
+        (WTF::StreamBuffer::consume):
+        (WTF::StreamBuffer::size):
+        (WTF::StreamBuffer::firstBlockData):
+        (WTF::StreamBuffer::firstBlockSize):
+
+2012-06-04  Patrick Gansterer  <paroga@webkit.org>
+
+        Port RAMSize to WinCE
+        https://bugs.webkit.org/show_bug.cgi?id=87854
+
+        Reviewed by Geoffrey Garen.
+
+        WinCE has no GlobalMemoryStatusEx() function. Use GlobalMemoryStatus() instead.
+
+        * wtf/RAMSize.cpp:
+        (WTF::computeRAMSize):
+
+2012-06-01  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        Remove dependency from ImageDiff to WTF
+        https://bugs.webkit.org/show_bug.cgi?id=88147
+
+        Reviewed by Adam Barth.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-06-01  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Save one copy when going from 8-bit WTF::String to QString
+
+        Asking for characters() of an 8-bit string will make a 16-bit copy internally
+        in WTF::String. Since we're going to copy the data to QStringData anyways, which
+        is 16-bit, we can do the conversion ourselves and save one copy.
+
+        Reviewed by Simon Hausmann.
+
+        * wtf/qt/StringQt.cpp:
+        (WTF::String::operator QString):
+
+2012-05-30  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Make conversion from QString to WTF::String (and back again) ~free
+
+        https://bugs.webkit.org/show_bug.cgi?id=87847
+
+        Instead of copying the QString data when converting to a WTF::String we
+        make the WTF::String adopt the QString data by introducing a new buffer
+        ownership type, and pointing the internal WTF::StringImpl 16-bit data
+        member to the string data managed by QStringData.
+
+        We make sure to reference the QStringData when adopting, so that the
+        data will stay alive, and then dereference it when the WTF::StringImpl
+        is deleted, which will free the QStringData (either straight away, if
+        we're the only one holding a reference still, or later, when the ref
+        count goes to 0).
+
+        In the case of going back from a WTF::String to a QString we can cheat
+        a bit (avoid a copy), if we know that the WTF::String was adopted from
+        a QString, since it's then just a matter of having the QString adopt
+        the existing QStringData (just like a regular QString copy).
+
+        If the WTF::String buffer is not owned by QStringData, eg a regular
+        8-bit or 16-bit string/substring, we have to fall back to copying,
+        as before (though there are potential optimization tricks we can
+        apply here later on).
+
+        Reviewed by Gavin Barraclough.
+
+        * wtf/qt/StringQt.cpp:
+        * wtf/text/StringImpl.cpp:
+        * wtf/text/StringImpl.h:
+
+2012-06-01  Sudarsana Nagineni  <sudarsana.nagineni@linux.intel.com>
+
+        [EFL] Implement PlatformStrategies
+        https://bugs.webkit.org/show_bug.cgi?id=86946
+
+        Reviewed by Carlos Garcia Campos.
+
+        * wtf/Platform.h: Enable PLATFORM_STRATEGIES for EFL platform.
+
+2012-05-31  Anders Carlsson  <andersca@apple.com>
+
+        Enable support for rvalue references when building with a version of clang that supports them
+        https://bugs.webkit.org/show_bug.cgi?id=88018
+
+        Re-enable support for rvalue references when building with a version of Xcode newer than 4.2.
+
+        * wtf/Compiler.h:
+
+2012-05-31  Filip Pizlo  <fpizlo@apple.com>
+
+        DataLog should be usable outside of JSC
+        https://bugs.webkit.org/show_bug.cgi?id=88015
+
+        Reviewed by Oliver Hunt.
+
+        * wtf/DataLog.h:
+        (WTF):
+
+2012-05-31  Anders Carlsson  <andersca@apple.com>
+
+        Disable support for rvalue references until I figure out why this is breaking the Xcode 4.2 build.
+
+        * wtf/Compiler.h:
+
+2012-05-31  Anders Carlsson  <andersca@apple.com>
+
+        Vector should have a move constructor and move assignment operator
+        https://bugs.webkit.org/show_bug.cgi?id=87997
+
+        Reviewed by Andreas Kling.
+
+        * wtf/Compiler.h:
+        Use __has_extension so we can use move semantics and other C++11 features even when building as C++98.
+
+        * wtf/Vector.h:
+        Add a move constructor and a move assignment operator to Vector.
+
+2012-05-31  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Simplify QT_VERSION_CHECKS for Qt5 by introducing HAVE(QT5)
+        https://bugs.webkit.org/show_bug.cgi?id=87955
+
+        Reviewed by Simon Hausmann.
+
+        * wtf/qt/UtilsQt.h:
+
+2012-05-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        HashTable.h has using directives for std::pair and std::make_pair
+        https://bugs.webkit.org/show_bug.cgi?id=29919
+
+        Reviewed by Darin Adler.
+
+        * wtf/HashTraits.h:
+        (WTF): Remove the directives.
+
+2012-05-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        HashTable.h has using directives for std::pair and std::make_pair
+        https://bugs.webkit.org/show_bug.cgi?id=29919
+
+        Reviewed by Darin Adler.
+
+        Change code to use std::pair and std::make_pair. Later patch will remove the
+        'using' directives.
+
+        * wtf/HashTable.h:
+        (WTF::hashTableSwap):
+        (HashTable):
+        * wtf/HashTraits.h:
+        (PairHashTraits):
+        (WTF::PairHashTraits::emptyValue):
+
+2012-05-30  Patrick Gansterer  <paroga@webkit.org>
+
+        Build fix for WinCE after r118603.
+
+        * wtf/Atomics.h:
+        (WTF::weakCompareAndSwap):
+
+2012-05-29  Anders Carlsson  <andersca@apple.com>
+
+        String should be move enabled/optimized
+        https://bugs.webkit.org/show_bug.cgi?id=87596
+
+        Reviewed by Andreas Kling.
+
+        Add move constructors and move assignment operators to String and AtomicString when building with
+        compilers that support rvalue references. This gets rid of ref-churn when the source of the 
+        constructor or assignment is a temporary object.
+
+        * wtf/text/AtomicString.h:
+        (AtomicString):
+        (WTF::AtomicString::AtomicString):
+        (WTF::AtomicString::operator=):
+        * wtf/text/WTFString.h:
+        (String):
+        (WTF::String::String):
+        (WTF::String::operator=):
+
+2012-05-29  Alexandre Elias  <aelias@google.com>
+
+        Support WebKit log messages on Android
+        https://bugs.webkit.org/show_bug.cgi?id=87773
+
+        Reviewed by Darin Adler.
+
+        This sends WebKit log messages to the Android "logcat" facility, as
+        Android sends stderr to /dev/null.
+
+        * wtf/Assertions.cpp:
+
+2012-05-29  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Remove duplication of logic for disabling selected warnings related to C++11
+
+        This is already handled in unix/default_post.prf
+
+        Reviewed by Simon Hausmann.
+
+        * WTF.pro:
+
+2012-05-27  Darin Adler  <darin@apple.com>
+
+        Fix an incorrect assertion in Vector::remove
+        https://bugs.webkit.org/show_bug.cgi?id=87612
+
+        Reviewed by Dan Bernstein.
+
+        * wtf/Vector.h: There's no good reason to disallow calling remove
+        with a size of 0, even when the position is at the end of the vector,
+        so changed the two-argument Vector::remove assertion to assert that
+        the position is <= size rather than < size.
+
+2012-05-27  Yoshifumi Inoue  <yosin@chromium.org>
+
+        [WTF] Introduce UINT64_C to MathExtras.h
+        https://bugs.webkit.org/show_bug.cgi?id=87485
+
+        Reviewed by Kent Tamura.
+
+        * wtf/MathExtras.h:
+
+2012-05-25  Filip Pizlo  <fpizlo@apple.com>
+
+        weakCompareAndSwap should work on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=87549
+
+        Reviewed by Jessie Berlin.
+
+        * wtf/Atomics.h:
+        (WTF):
+        (WTF::weakCompareAndSwap):
+
+2012-05-24  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
+
+        cti_vm_throw gets kicked out by gcc 4.6 -flto
+        https://bugs.webkit.org/show_bug.cgi?id=56088
+
+        Reviewed by Darin Adler.
+
+        Define REFERENCED_FROM_ASM to __attribute__((used)) on GCC.
+
+        * wtf/Compiler.h:
+
+2012-05-23  Darin Adler  <darin@apple.com>
+
+        Optimize iteration of empty hash tables
+        https://bugs.webkit.org/show_bug.cgi?id=87215
+
+        Reviewed by Geoffrey Garen.
+
+        Iteration of empty hash tables was showing up on simple page loading
+        profiles due to the use of hash tables in the
+        NodeListsNodeData::invalidateCaches and
+        NodeListsNodeData::invalidateCachesThatDependOnAttributes functions.
+        It's worth optimizing the case of an empty table.
+
+        * wtf/HashTable.h:
+        (WTF::HashTable::begin): Return the known-good end iterator when the
+        table is empty. This makes iterating an empty table faster because we
+        avoid skipping empty and deleted buckets.
+
+2012-05-22  Geoffrey Garen  <ggaren@apple.com>
+
+        Build fix.
+
+        * wtf/RAMSize.cpp:
+        (WTF::computeRAMSize): sysctl expects a uint64_t, so use that and then
+        cast back to size_t. Since it's coneivable that a 32bit process would
+        run on a system with more than 4GB RAM, I added a paranoid check for
+        that condition.
+
+2012-05-22  Jessie Berlin  <jberlin@apple.com>
+
+        Build fix.
+
+        * wtf/RAMSize.cpp:
+        (WTF::computeRAMSize):
+        If you say you are going to return a size_t, actually return a size_t.
+
+2012-05-21  Geoffrey Garen  <ggaren@apple.com>
+
+        GC allocation trigger should be tuned to system RAM
+        https://bugs.webkit.org/show_bug.cgi?id=87039
+
+        Reviewed by Darin Adler.
+
+        Added a helper function for measuring system RAM.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/AmountOfRAM.cpp: Added.
+        (WTF):
+        (WTF::computeAmountOfRAM):
+        (WTF::amountOfRAM):
+        * wtf/AmountOfRAM.h: Added.
+        (WTF):
+        * wtf/CMakeLists.txt:
+        * wtf/StdLibExtras.h:
+        (WTF):
+
+2012-05-22  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
+
+        GCC 4.7 and C++11 support.
+        https://bugs.webkit.org/show_bug.cgi?id=86465
+
+        Reviewed by Darin Adler.
+
+        Detect C++11 mode in GCC 4.7 and set appropiate compiler feature flags.
+        Turn C++11 override control into a compiler feature flag.
+        Fix non-clang support of compiler feature CXX_DELETED_FUNCTIONS.
+
+        * wtf/Compiler.h:
+        * wtf/Noncopyable.h:
+
+2012-05-22  Filip Pizlo  <fpizlo@apple.com>
+
+        REGRESSION(r117861): It made almost all tests crash on Qt
+        https://bugs.webkit.org/show_bug.cgi?id=87082
+
+        Reviewed by Csaba Osztrogonác.
+        
+        Using OwnArrayPtr is a bad idea if you allocate array with fastCalloc.
+
+        * wtf/FastBitVector.h:
+        (WTF::FastBitVector::FastBitVector):
+        (WTF::FastBitVector::~FastBitVector):
+        (FastBitVector):
+        (WTF::FastBitVector::operator=):
+        (WTF::FastBitVector::resize):
+        (WTF::FastBitVector::setAll):
+        (WTF::FastBitVector::clearAll):
+        (WTF::FastBitVector::set):
+
+2012-05-21  Filip Pizlo  <fpizlo@apple.com>
+
+        DFG should be able to compute dominators
+        https://bugs.webkit.org/show_bug.cgi?id=85269
+
+        Reviewed by Oliver Hunt.
+        
+        Merged r115754 from dfgopt.
+        
+        Added a bitvector class suitable for cheap static analysis. This class
+        differs from BitVector in that instead of optimizing for space, it
+        optimizes for execution time. Its API is also somewhat less friendly,
+        which is intentional; it's meant to be used in places where you know
+        up front how bit your bitvectors are going to be.
+
+        * GNUmakefile.list.am:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/FastBitVector.h: Added.
+        (WTF):
+        (FastBitVector):
+        (WTF::FastBitVector::FastBitVector):
+        (WTF::FastBitVector::operator=):
+        (WTF::FastBitVector::numBits):
+        (WTF::FastBitVector::resize):
+        (WTF::FastBitVector::setAll):
+        (WTF::FastBitVector::clearAll):
+        (WTF::FastBitVector::set):
+        (WTF::FastBitVector::setAndCheck):
+        (WTF::FastBitVector::equals):
+        (WTF::FastBitVector::merge):
+        (WTF::FastBitVector::filter):
+        (WTF::FastBitVector::exclude):
+        (WTF::FastBitVector::clear):
+        (WTF::FastBitVector::get):
+        (WTF::FastBitVector::arrayLength):
+
+2012-05-15  Gavin Barraclough  <barraclough@apple.com>
+
+        Add support for private names
+        https://bugs.webkit.org/show_bug.cgi?id=86509
+
+        Reviewed by Oliver Hunt.
+
+        The spec isn't final, but we can start adding support to allow property maps
+        to contain keys that aren't identifiers.
+
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::StringImpl):
+        (StringImpl):
+        (WTF::StringImpl::createEmptyUnique):
+        (WTF::StringImpl::isEmptyUnique):
+            - Allow empty string impls to be allocated, which can be used as unique keys.
+
+2012-05-21  Emil A Eklund <eae@chromium.org> and Levi Weintraub  <leviw@chromium.org>
+
+        Enable SUBPIXEL_LAYOUT feature flag on Chromium
+        https://bugs.webkit.org/show_bug.cgi?id=85555
+
+        Reviewed by Eric Seidel.
+
+        Enabling sub-pixel layout on Chromium port.
+
+        * wtf/Platform.h:
+
+2012-05-21  Andreas Kling  <kling@webkit.org>
+
+        CSS: Move duplicate property elimination to parser.
+        <http://webkit.org/b/86948>
+
+        Reviewed by Antti Koivisto.
+
+        Add WTF::BitArray, a simple, malloc free, fixed-size bit array class.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/BitArray.h: Added.
+        (WTF):
+        (BitArray):
+        (WTF::BitArray::BitArray):
+        (WTF::BitArray::set):
+        (WTF::BitArray::get):
+        * wtf/CMakeLists.txt:
+
+2012-05-21  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
+
+        Colliding isinf/isnan between C99 and C++11 with GCC >=4.6
+        https://bugs.webkit.org/show_bug.cgi?id=59249
+
+        Reviewed by Darin Adler.
+
+        Workaround the isinf and isnan conflict in GCC C++11.
+
+        * wtf/Compiler.h:
+        * wtf/MathExtras.h:
+        (std::wtf_isinf):
+        (std::wtf_isnan):
+
+2012-05-21  Andreas Kling  <kling@webkit.org>
+
+        REGRESSION(r117501): IconDatabase asserts on startup in synchronousIconForPageURL().
+        <http://webkit.org/b/86935>
+        <rdar://problem/11480012>
+
+        Reviewed by Anders Carlsson.
+
+        Added a swap() to HashCountedSet.
+
+        * wtf/HashCountedSet.h:
+        (HashCountedSet::swap):
+
+2012-05-16  Geoffrey Garen  <ggaren@apple.com>
+
+        This is not a joke: 3.7X speedup from removing a call to sleep
+        https://bugs.webkit.org/show_bug.cgi?id=86702
+
+        Reviewed by Eric Seidel.
+
+        The speedup was on a GC benchmark, with a custom VM caching layer
+        not in TOT yet.
+
+        Instruments showed most GC threads spending the majority of their
+        time sleeping instead of doing useful work. Removing the call to
+        sleep sped up the benchmark.
+
+        * wtf/TCSpinLock.h:
+        (TCMalloc_SlowLock): Since a spin lock is only ever held for a short
+        amount of time, don't sleep for a long amount of time waiting for it
+        to unlock -- yielding to the scheduler is sufficient.
+
+        If we find a case where someone is sitting on a spin lock for over 2ms,
+        we should fix the spin lock holder, not the spin lock.
+
+2012-05-16  Simon Fraser  <simon.fraser@apple.com>
+
+        Make things build with DUMP_HASHTABLE_STATS=1
+        https://bugs.webkit.org/show_bug.cgi?id=86571
+
+        Reviewed by Geoffrey Garen.
+        
+        DUMP_HASHTABLE_STATS bitrotted after the WTF separation. This patch
+        makes it build.
+        
+        Added WTF_EXPORTDATA to the global data, and WTF_EXPORT_PRIVATE to
+        the static HashTableStats methods. Added a dumpStats() method
+        that is not yet called anywhere; we can no longer rely on destroying
+        a global object to dump the stats because global destructors are
+        disallowed.
+
+        * wtf/HashTable.cpp:
+        (WTF):
+        (WTF::HashTableStats::recordCollisionAtCount):
+        (WTF::HashTableStats::dumpStats):
+        * wtf/HashTable.h:
+        (HashTableStats):
+
+2012-05-15  Filip Pizlo  <fpizlo@apple.com>
+
+        shrinkToFit() is often not called for Vectors in CodeBlock
+        https://bugs.webkit.org/show_bug.cgi?id=86436
+
+        Reviewed by Oliver Hunt.
+        
+        Gave SegmentedVector a shrinkToFit() method. This only shrinks the segment
+        lookup table, which is likely to not be hugely profitable, but it is better
+        than nothing.
+
+        * wtf/SegmentedVector.h:
+        (SegmentedVector):
+        (WTF::SegmentedVector::shrinkToFit):
+
+2012-05-15  Andy Estes  <aestes@apple.com>
+
+        Add WTF_USE_SECURITY_FRAMEWORK and use it in place of the less specific PLATFORM(MAC)
+        https://bugs.webkit.org/show_bug.cgi?id=86508
+
+        Reviewed by Sam Weinig.
+
+        * wtf/Platform.h:
+
+2012-05-15  Zoltan Herczeg  <zherczeg@webkit.org>
+
+        NEONizing forceValidPreMultipliedPixels
+        https://bugs.webkit.org/show_bug.cgi?id=86468
+
+        Reviewed by Nikolas Zimmermann.
+
+        Allow to disable all intrinsics with a single macro.
+
+        * wtf/Platform.h:
+
+2012-05-14  Andy Estes  <aestes@apple.com>
+
+        Add WTF_USE_APPKIT to differentiate platforms that use AppKit.framework from other Darwin platforms
+        https://bugs.webkit.org/show_bug.cgi?id=86432
+
+        Reviewed by Maciej Stachowiak.
+
+        * wtf/Platform.h:
+
+2012-05-14  Mark Rowe  <mrowe@apple.com>
+
+        <http://webkit.org/b/86320> WTF.xcodeproj builds with -O3 in debug builds
+
+        Reviewed by Simon Fraser.
+
+        * WTF.xcodeproj/project.pbxproj: Ensure that the debug configuration uses the
+        same settings as the debug variant would.
+
+2012-05-14  Wei James  <james.wei@intel.com>
+
+        [Chromium] ImageDiff should be build for host on Android
+        https://bugs.webkit.org/show_bug.cgi?id=82039
+
+        Reviewed by Adam Barth.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-05-14  Yong Li  <yoli@rim.com>
+
+        DFG JIT is not ARM EABI compatible
+        https://bugs.webkit.org/show_bug.cgi?id=84449
+
+        Reviewed by Filip Pizlo.
+
+        Add COMPILER_SUPPORTS(EABI) when __ARM_EABI__
+        or __EABI__ is defined.
+
+        * wtf/Compiler.h:
+
+2012-05-10  Michał Pakuła vel Rutka  <m.pakula@samsung.com>
+
+        [EFL] Add OwnPtr specialization for Eina_Hash.
+        https://bugs.webkit.org/show_bug.cgi?id=85046
+
+        Reviewed by Andreas Kling.
+
+        Add an override for Eina_Hash for EFL port.
+
+        * wtf/OwnPtrCommon.h:
+        (WTF):
+        * wtf/efl/OwnPtrEfl.cpp:
+        (WTF::deleteOwnedPtr):
+        (WTF):
+
+2012-05-09  Filip Pizlo  <fpizlo@apple.com>
+
+        It should be possible to get useful debug logging from the JIT memory allocator
+        https://bugs.webkit.org/show_bug.cgi?id=86042
+
+        Reviewed by Geoff Garen.
+
+        * wtf/MetaAllocator.cpp:
+        (WTF::MetaAllocator::findAndRemoveFreeSpace):
+        (WTF::MetaAllocator::addFreeSpace):
+        (WTF::MetaAllocator::dumpProfile):
+
+2012-05-08  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r116440.
+        http://trac.webkit.org/changeset/116440
+        https://bugs.webkit.org/show_bug.cgi?id=85904
+
+        Broke the Chromium Android bot (Requested by beverloo on
+        #webkit).
+
+        * WTF.gyp/WTF.gyp:
+
+2012-05-08  Adam Barth  <abarth@webkit.org>
+
+        [Chromium] OS(ANDROID) ImageDiff requires us to build WTF for both host and target
+        https://bugs.webkit.org/show_bug.cgi?id=85897
+
+        Reviewed by Tony Chang.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-05-08  Adam Barth  <abarth@webkit.org>
+
+        [Chromium] Assertions.cpp should work on OS(ANDROID)
+        https://bugs.webkit.org/show_bug.cgi?id=85867
+
+        Reviewed by Eric Seidel.
+
+        Some minor ifdefs for OS(ANDROID) on PLATFORM(CHROMIUM).
+
+        * wtf/Assertions.cpp:
+
+2012-05-07  Adam Barth  <abarth@webkit.org>
+
+        [Chromium] Android wishes to use an empty implementation if AXObjectCache
+        https://bugs.webkit.org/show_bug.cgi?id=85842
+
+        Reviewed by Eric Seidel.
+
+        Disable accessibility on OS(ANDROID) for PLATFORM(CHROMIUM).
+
+        * wtf/Platform.h:
+
+2012-05-04  Jeff Rogers  <jrogers@rim.com>
+
+        [BlackBerry] Implement numberOfProcessorCores() for QNX
+        https://bugs.webkit.org/show_bug.cgi?id=85638
+
+        Reviewed by Antonio Gomes.
+
+        * wtf/NumberOfCores.cpp:
+        (WTF::numberOfProcessorCores):
+
+2012-05-03  Yong Li  <yoli@rim.com>
+
+        Mutex failure when HashTable is memory moved in debug build
+        https://bugs.webkit.org/show_bug.cgi?id=84970
+
+        Reviewed by Rob Buis.
+
+        1. Replace m_mutex with OwnPtr<m_mutex> so HashTable is still
+           memory movable in debug build.
+        2. Assert successes of pthread_mutex_init() and pthread_mutex_destroy().
+
+        * wtf/HashTable.h:
+        (HashTable):
+        (WTF::::HashTable):
+        (WTF::::invalidateIterators):
+        (WTF::addIterator):
+        (WTF::removeIterator):
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::Mutex::Mutex):
+        (WTF::Mutex::~Mutex):
+
+2012-05-02  Antti Koivisto  <antti@apple.com>
+
+        Add temporary feature define for parsed stylesheet caching
+        https://bugs.webkit.org/show_bug.cgi?id=85413
+
+        Rubber-stamped by Nikolas Zimmermann.
+
+        While not an externally visible feature this is still a significant internal change.
+        It is good to have define in case someone has an urgent need to turn it off.
+        
+        Caching is enabled by default on all platforms. The define should be removed after some bake time.
+
+        * wtf/Platform.h:
+
+2012-05-02  Lauro Neto  <lauro.neto@openbossa.org>
+
+        [Qt]r57240 broke Qt build (gcc bug)
+        https://bugs.webkit.org/show_bug.cgi?id=37253
+
+        Reviewed by Csaba Osztrogonác.
+
+        Add back the inline hack just for ARM due to old version of
+        gcc still being used on Harmattan SDK. Thanks to Ossy for the
+        suggestion.
+        * wtf/PassRefPtr.h:
+        (WTF):
+
+2012-05-02  Nico Weber  <thakis@chromium.org>
+
+        Let WebKit parse with clang on windows with -std=c++11
+        https://bugs.webkit.org/show_bug.cgi?id=85398
+
+        Reviewed by Ryosuke Niwa.
+
+        See http://trac.webkit.org/changeset/85945 for background on the line
+        I'm changing. With clang, __GXX_EXPERIMENTLAL_CXX0X__ is set in c++11
+        mode, but MSVC's c++ library doesn't have a tr1/memory header. So also
+        check for __GLIBCXX__, like it's done in the rest of this file.
+
+        * wtf/TypeTraits.h:
+
+2012-05-02  Adenilson Cavalcanti  <cavalcantii@gmail.com>
+
+        [Qt]r57240 broke Qt build (gcc bug)
+        https://bugs.webkit.org/show_bug.cgi?id=37253
+
+        Reviewed by Noam Rosenthal.
+
+        Removing workaround macro since current gcc/Qt doesn't require it to compile.
+
+        * wtf/PassRefPtr.h:
+        (WTF):
+
+2012-04-30  Oliver Hunt  <oliver@apple.com>
+
+        Investigate overflows in Canvas putImageData routine
+        https://bugs.webkit.org/show_bug.cgi?id=61373
+
+        Reviewed by Gavin Barraclough.
+
+        Allow floating point multiplies of checked types (complete with
+        bounds checks).
+
+        * wtf/CheckedArithmetic.h:
+        (Checked):
+        (WTF::Checked::operator*=):
+
+2012-04-30  Benjamin Poulain  <benjamin@webkit.org>
+
+        Add String::startsWith() and endsWith() for string literals
+        https://bugs.webkit.org/show_bug.cgi?id=85154
+
+        Reviewed by Darin Adler.
+
+        When invoking StringImpl::startsWidth() or StringImpl::endsWith() with
+        a string literal, a new String was constructed implicitly, allocating
+        a new StringImpl and copying the characters for the operation.
+
+        This patch adds a version of those methods for single characters and
+        string literals.
+        This allows us to avoid allocating memory and use the characters in place,
+        and it permits some extra shortcuts in the implementation.
+
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::startsWith):
+        (AtomicString):
+        (WTF::AtomicString::endsWith):
+        * wtf/text/StringImpl.cpp:
+        (WTF::equalInner):
+        (WTF):
+        (WTF::StringImpl::startsWith):
+        (WTF::StringImpl::endsWith):
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::startsWith):
+        (StringImpl):
+        (WTF::StringImpl::endsWith):
+        * wtf/text/WTFString.h:
+        (WTF::String::startsWith):
+        (String):
+        (WTF::String::endsWith):
+
+2012-04-30  Anders Carlsson  <andersca@apple.com>
+
+        WTF::bind should work with blocks
+        https://bugs.webkit.org/show_bug.cgi?id=85227
+
+        Reviewed by Sam Weinig.
+
+        Add a block type FunctionWrapper specialization.
+
+        * wtf/Functional.h:
+
+2012-04-28  Emil A Eklund  <eae@chromium.org>
+
+        Add ENABLE_SUBPIXEL_LAYOUT controlling FractionalLayoutUnit denominator
+        https://bugs.webkit.org/show_bug.cgi?id=85146
+
+        Reviewed by Eric Seidel.
+
+        Add a new flag for controlling the fixed point denominator in
+        FractionalLayoutUnit. Controls whether the denominator is set to 60 or 1.
+        Until we change the LayoutUnit typedef this change will have no effect.
+
+        * wtf/Platform.h:
+
+2012-04-29  Kent Tamura  <tkent@chromium.org>
+
+        [Mac] Add LocalizedDateMac
+        https://bugs.webkit.org/show_bug.cgi?id=85039
+
+        Reviewed by Kentaro Hara.
+
+        * wtf/DateMath.h:
+        (WTF): Add monthFullName[]. It is useful to make fallback month
+        names for calendar/date related features.
+
+2012-04-26  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [SOUP] Add a way to register custom uri schemes in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=84130
+
+        Reviewed by Martin Robinson.
+
+        Add GPtrArray template to be able to use GRefPtr with GPtrArrays.
+
+        * wtf/gobject/GRefPtr.cpp:
+        (WTF::refGPtr):
+        (WTF):
+        (WTF::derefGPtr):
+        * wtf/gobject/GRefPtr.h:
+        (WTF):
+        * wtf/gobject/GTypedefs.h:
+
+2012-04-26  Nico Weber  <thakis@chromium.org>
+
+        Don't define WTF_COMPILER_SUPPORTS_CXX_NULLPTR twice when building with clang on windows.
+        https://bugs.webkit.org/show_bug.cgi?id=85018
+
+        Reviewed by Anders Carlsson.
+
+        Clang sets _MSC_VER when compiling for a -pc-win32 target (just like it sets __GNUC__ on unix).
+        As a result, WTF_COMPILER_SUPPORTS_CXX_NULLPTR gets currently set twice, once for clang and
+        once for _MSC_VER. Guard the second instance with !COMPILER(CLANG). This matches the gcc code
+        for WTF_COMPILER_SUPPORTS_CXX_NULLPTR in the same file.
+
+        * wtf/Compiler.h:
+
+2012-04-26  Antonio Gomes  <agomes@rim.com>
+
+        [BlackBerry] properly disable DRAG_SUPPORT
+        https://bugs.webkit.org/show_bug.cgi?id=84952
+
+        Reviewed by Daniel Bates.
+
+        * wtf/Platform.h: Remove the line that disables drag support from here
+        for the BlackBerry port.
+
+2012-04-25  Benjamin Poulain  <benjamin@webkit.org>
+
+        Add a version of StringImpl::find() without offset
+        https://bugs.webkit.org/show_bug.cgi?id=83968
+
+        Reviewed by Sam Weinig.
+
+        This patch add a version of StringImpl::find() without offset, Instead of using the default
+        value for the index.
+
+        By not having the index, we can skip a couple of branches and a few instructions. This gives
+        significant gains when the strings are short-ish.
+
+        The case of empty string is moved below (matchLength == 1) since it is a less common operation.
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::find):
+        (WTF):
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+        * wtf/text/WTFString.h:
+        (String):
+        (WTF::String::find):
+
+2012-04-25  Darin Adler  <darin@apple.com>
+
+        Iterating a HashMap<String, X> involves a string equality comparison to check for the empty value
+        https://bugs.webkit.org/show_bug.cgi?id=84524
+
+        Reviewed by Antti Koivisto.
+
+        * wtf/HashMap.h: Added a struct template, HashMapValueTraits, that derives from
+        PairHashTraits, adds an isEmptyValue function that looks only at the key, not
+        the mapped value, in the hash table value, and uses the isHashTraitsEmptyValue
+        function template to check if the key is empty.
+
+2012-04-25  Landry Breuil  <landry@openbsd.org>
+
+        Include <sys/param.h>, needed for sysctl() on OpenBSD/NetBSD
+        https://bugs.webkit.org/show_bug.cgi?id=82585
+
+        Reviewed by Zoltan Herczeg.
+
+        * wtf/NumberOfCores.cpp: include <sys/param.h> on the BSDs
+
+2012-04-25  Kenneth Russell  <kbr@google.com>
+
+        Delete CanvasPixelArray, ByteArray, JSByteArray and JSC code once unreferenced
+        https://bugs.webkit.org/show_bug.cgi?id=83655
+
+        Reviewed by Oliver Hunt.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/ByteArray.cpp: Removed.
+        * wtf/ByteArray.h: Removed.
+        * wtf/CMakeLists.txt:
+
+2012-04-25  Philippe Normand  <pnormand@igalia.com>
+
+        Webkit build fails due to missing gstreamer include file on Kubuntu 8.04
+        https://bugs.webkit.org/show_bug.cgi?id=81913
+
+        Reviewed by Tor Arne Vestbø.
+
+        * WTF.pri: GStreamer build support implies GLib support, as it's
+        done in WebCore.pri.
+
+2012-04-24  Benjamin Poulain  <bpoulain@apple.com>
+
+        Generalize the single character optimization of r114072
+        https://bugs.webkit.org/show_bug.cgi?id=83961
+
+        Reviewed by Eric Seidel.
+
+        This patch makes some improvment over String::find() in the case of lookup for a single
+        character.
+
+        The two function find(UChar|LChar) are replaced by a template.
+
+        The case of searching a UChar in a 8bit string has a shortcut if the UChar cannot
+        possibly match any character in the range of the type LChar.
+
+        The slow case StringImpl::find(StringImpl*) is modified to
+        -Do not allocate in the fast case if only one string is 8bit.
+        -Use the shortcut for searching UChar in LChar.
+
+        This speed up the function by about 7% when avoiding string conversion.
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::find):
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+        (WTF):
+        (WTF::find):
+        (WTF::StringImpl::find):
+
+2012-04-24  Darin Adler  <darin@apple.com>
+
+        Iterating a HashMap<String, X> involves a string equality comparison to check for the empty value
+        https://bugs.webkit.org/show_bug.cgi?id=84524
+
+        Reviewed by Antti Koivisto.
+
+        Added a new algorithm for checking for empty buckets that can be specialized.
+        Specialized it for String. We may later want to do the same thing for KURL.
+        It's not important to do it for AtomicString, since AtomicString's == function
+        is already a simple pointer equality compare. We may also later want to do
+        something similar for pairs that have String objects in them.
+
+        * wtf/HashTable.h:
+        (WTF::HashTable::isEmptyBucket): Call the new isHashTraitsEmptyValue function, which
+        will do something more efficient for String.
+
+        * wtf/HashTraits.h: Added hasIsEmptyValueFunction to hash traits, with a default value
+        of false. This allows us to continue to get automatic comparison with the appropriate
+        emptyValue result for all existing traits, but supply a custom isEmptyValue function
+        for HashTraits<String>. Putting an isEmptyValue function into the traits would require
+        overriding it in every class that has a custom value for emptyValue. Specialized
+        HashTraits for String to add hasIsEmptyValueFunction and declare, but not define, the
+        isEmptyValue function.
+        (WTF::isHashTraitsEmptyValue): Added a function that uses the HashTraitsEmptyValueChecker
+        struct to use either == combined with the emptyValue function or the isEmptyValue function.
+
+        * wtf/text/StringHash.h: Removed unneeded includes and sorted the using statements at
+        the bottom of the file.
+        (WTF::HashTraits<String>::isEmptyValue): Define this function here, since here we have
+        included the WTFString.h header; the HashTraits.h header compiles without WTFString.h.
+
+2012-04-23  Kenneth Russell  <kbr@google.com>
+
+        Change ImageData to reference Uint8ClampedArray rather than CanvasPixelArray
+        https://bugs.webkit.org/show_bug.cgi?id=73011
+
+        Reviewed by Oliver Hunt.
+
+        * wtf/ArrayBuffer.h:
+        (ArrayBuffer):
+        (WTF::ArrayBuffer::create):
+        (WTF::ArrayBuffer::createUninitialized):
+        (WTF):
+        (WTF::ArrayBufferContents::tryAllocate):
+        * wtf/TypedArrayBase.h:
+        (WTF::TypedArrayBase::createUninitialized):
+        (TypedArrayBase):
+        * wtf/Uint8ClampedArray.h:
+        (Uint8ClampedArray):
+        (WTF::Uint8ClampedArray::createUninitialized):
+        (WTF):
+        (WTF::Uint8ClampedArray::zeroFill):
+
+2012-04-23  George Staikos  <staikos@webkit.org>
+
+        Enable parallel GC for BlackBerry.
+        https://bugs.webkit.org/show_bug.cgi?id=84633
+
+        Reviewed by Antonio Gomes.
+
+        * wtf/Platform.h:
+
+2012-04-23  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r114914.
+        http://trac.webkit.org/changeset/114914
+        https://bugs.webkit.org/show_bug.cgi?id=84615
+
+        Causing infinite hangs on some tests involving HashMaps with
+        integer keys (Requested by dimich on #webkit).
+
+        * wtf/HashTable.h:
+        (WTF::HashTable::isEmptyBucket):
+        * wtf/HashTraits.h:
+        * wtf/text/StringHash.h:
+
+2012-04-23  Darin Adler  <darin@apple.com>
+
+        Iterating a HashMap<String, X> involves a string equality comparison to check for the empty value
+        https://bugs.webkit.org/show_bug.cgi?id=84524
+
+        Reviewed by Antti Koivisto.
+
+        Added a new algorithm for checking for empty buckets that can be specialized.
+        Specialized it for String. We may later want to do the same thing for KURL.
+        It's not important to do it for AtomicString, since AtomicString's == function
+        is already a simple pointer equality compare.
+
+        * wtf/HashTable.h:
+        (WTF::HashTable::isEmptyBucket): Call the new isHashTraitsEmptyValue function, which
+        will do something more efficient for String.
+
+        * wtf/HashTraits.h: Added hasIsEmptyValueFunction to hash traits, with a default value
+        of false. This allows us to continue to get automatic comparison with the appropriate
+        emptyValue result for all existing traits, but supply a custom isEmptyValue function
+        for HashTraits<String>. Putting an isEmptyValue function into the traits would require
+        overriding it in every class that has a custom value for emptyValue. Specialized
+        HashTraits for String to add hasIsEmptyValueFunction and declare, but not define, the
+        isEmptyValue function.
+        (WTF::isHashTraitsEmptyValue): Added a function that uses the HashTraitsEmptyValueChecker
+        struct to use either == combined with the emptyValue function or the isEmptyValue function.
+        (PairHashTraits): Define hasIsEmptyValueFunction and isEmptyValue.
+
+        * wtf/text/StringHash.h: Removed unneeded includes and sorted the using statements at
+        the bottom of the file.
+        (WTF::HashTraits<String>::isEmptyValue): Define this function here, since here we have
+        included the WTFString.h header; the HashTraits.h header compiles without WTFString.h.
+
+2012-04-18  Myles Maxfield  <mmaxfield@google.com>
+
+        Somehow, there's an errant backslash in my last WTF patch
+        https://bugs.webkit.org/show_bug.cgi?id=84290
+
+        Reviewed by Andreas Kling.
+
+        * wtf/StdLibExtras.h:
+        (WTF::roundUpToMultipleOf):
+
+2012-04-16  Nico Weber  <thakis@chromium.org>
+
+        Make NullPtr.h compile with clang -std=c++11 and libstdc++4.2
+        https://bugs.webkit.org/show_bug.cgi?id=83999
+
+        Reviewed by Sam Weinig.
+
+        Before this patch, NullPtr.h assumed that a working |nullptr| implied
+        a working |std::nullptr_t| as well. With clang and libstdc++4.2, this
+        is not true.
+
+        I tested (-stdlib=libc++, -stdlib=libstdc++) x (-std=c++11, -std=c++03)
+        with clang.
+
+        * wtf/NullPtr.h:
+        (std):
+
+2012-04-14  Sam Weinig  <sam@webkit.org>
+
+        Harden WTF::ByteArray::create()
+        https://bugs.webkit.org/show_bug.cgi?id=83318
+
+        Reviewed by Maciej Stachowiak.
+
+        * wtf/ByteArray.cpp:
+        (WTF::ByteArray::create):
+        Add overflow check. I don't believe there is anyway to trigger this currently,
+        hence no tests, so this should be considered hardening.
+
+2012-04-12  Benjamin Poulain  <bpoulain@apple.com>
+
+        Inline StringImpl::find(UChar, ...)
+        https://bugs.webkit.org/show_bug.cgi?id=83737
+
+        Reviewed by Geoffrey Garen.
+
+        The implementation of StringImpl::find() is a simple branch before invoking one of
+        two inline functions. The overhead of having a function for StringImpl::find() is significant.
+
+        It is better to let the compiler decide if that should be inlined or not.
+
+        * wtf/text/StringImpl.cpp:
+        * wtf/text/StringImpl.h:
+        (StringImpl):
+        (WTF::find):
+        (WTF):
+        (WTF::reverseFind):
+        (WTF::StringImpl::find):
+        * wtf/text/WTFString.h:
+
+2012-04-12  Balazs Kelemen  <kbalazs@webkit.org>
+
+        [Qt] Fix WebKit1 build with V8
+        https://bugs.webkit.org/show_bug.cgi?id=83322
+
+        Reviewed by Adam Barth.
+
+        * wtf/StdLibExtras.h:
+        (WTF):
+
+2012-04-12  Jer Noble  <jer.noble@apple.com>
+
+        ThreadingWin: Mutex::unlock() can be "over-unlocked".
+        https://bugs.webkit.org/show_bug.cgi?id=83725
+
+        Reviewed by David Levin.
+
+        In order to support the behavior of pthread_mutex_trylock(), the Windows Mutex class includes
+        a recursion counter which is incremented in Mutex::lock(), decremented in Mutex::unlock(),
+        and checked in Mutex::tryLock().  If the mutex is "over-unlocked", the counter wraps around to
+        MAX_INT, and subsequent calls to Mutex::trylock() will fail. Raise an ASSERT in this situation
+        so the "over-unlock" will be caught.
+
+        * wtf/ThreadingWin.cpp:
+        (WTF::Mutex::unlock): ASSERT if unlocking a non-locked mutex.
+
+2012-04-10  Mark Rowe  <mrowe@apple.com>
+
+        <rdar://problem/10583749> WebKit2 should log to both ASL and stderr
+
+        Reviewed by Sam Weinig.
+
+        * wtf/Assertions.cpp: Add a WTFLogAlways function that unconditionally logs the given message.
+        * wtf/Assertions.h:
+
+2012-04-10  Patrick Gansterer  <paroga@webkit.org>
+
+        Cleanup wtf/Platform.h and config.h files
+        https://bugs.webkit.org/show_bug.cgi?id=83431
+
+        Reviewed by Eric Seidel.
+
+        The ENABLE() and USE() macros take care about the case when the flag
+        isn't defined. So there is no need to define anything with 0.
+
+        Also move duplicated code from the config.h files to Platform.h and
+        merge a few preprocessor commands to make the file more readable.
+
+        * config.h:
+        * wtf/Platform.h:
+
+2012-04-10  Filip Pizlo  <fpizlo@apple.com>
+
+        DFG should flush SetLocals to arguments
+        https://bugs.webkit.org/show_bug.cgi?id=83554
+
+        Reviewed by Gavin Barraclough.
+        
+        Added an isRoot() method that is a faster shorthand for saying
+        find() == this.
+
+        * wtf/UnionFind.h:
+        (WTF::UnionFind::isRoot):
+        (UnionFind):
+
+2012-04-10  Adam Klein  <adamk@chromium.org>
+
+        Remove unused NonNullPassRefPtr from WTF
+        https://bugs.webkit.org/show_bug.cgi?id=82389
+
+        Reviewed by Kentaro Hara.
+
+        NonNullPassRefPtr seems to be unused since JSC allocation was
+        restructured in r84052.
+
+        If someone decides they need this later, they can always revert this patch.
+
+        * wtf/PassRefPtr.h:
+        * wtf/RefPtr.h:
+        (RefPtr):
+
+2012-04-10  Patrick Gansterer  <paroga@webkit.org>
+
+        [CMake] Enable USE_FOLDERS property
+        https://bugs.webkit.org/show_bug.cgi?id=83571
+
+        Reviewed by Daniel Bates.
+
+        Setting the FOLDER property on targets gives more structure 
+        to the generated Visual Studio solutions.
+        This does not affect other CMake generators.
+
+        * wtf/CMakeLists.txt:
+
+2012-04-09  Patrick Gansterer  <paroga@webkit.org>
+
+        Port BinarySemaphoreWin.cpp to WinCE
+        https://bugs.webkit.org/show_bug.cgi?id=83502
+
+        Reviewed by Daniel Bates.
+
+        Replace WaitForSingleObjectEx with WaitForSingleObject since
+        the additonal parameter supported by the extended function
+        is not used anyway and the function does not exist on WinCE.
+
+        * wtf/CMakeLists.txt:
+        * wtf/PlatformWinCE.cmake:
+        * wtf/threads/win/BinarySemaphoreWin.cpp:
+        (WTF::BinarySemaphore::wait):
+
+2012-04-09  Patrick Gansterer  <paroga@webkit.org>
+
+        [CMake] Build fix for USE_SYSTEM_MALLOC after r113570.
+
+        * wtf/CMakeLists.txt:
+
+2012-04-09  Patrick Gansterer  <paroga@webkit.org>
+
+        Remove HAVE_STDINT_H
+        https://bugs.webkit.org/show_bug.cgi?id=83434
+
+        Reviewed by Kentaro Hara.
+
+        HAVE_STDINT_H is defined with 1 all the time and we us stdint.h without HAVE(STDINT_H) already.
+
+        * config.h:
+        * wtf/FastMalloc.cpp:
+        * wtf/TCPageMap.h:
+        * wtf/TCSpinLock.h:
+        * wtf/TCSystemAlloc.cpp:
+
+2012-04-06  Benjamin Poulain  <bpoulain@apple.com>
+
+        Get rid of the useless flag PREEMPT_GEOLOCATION_PERMISSION
+        https://bugs.webkit.org/show_bug.cgi?id=83325
+
+        Reviewed by Ryosuke Niwa.
+
+        * wtf/Platform.h: Remove the flag.
+
+2012-04-06  Darin Adler  <darin@apple.com>
+
+        Streamline strtod and fix some related problems
+        https://bugs.webkit.org/show_bug.cgi?id=82857
+
+        Reviewed by Geoffrey Garen.
+
+        Replaced the strtod function template with a parseDouble function, eliminating
+        the following unneeded features:
+
+        - need for a trailing null character and a call to strlen
+        - needless conversion of string lengths from size_t to int and back that created
+          the possibility of incorrect truncation
+        - one level of function call; use inlining instead
+        - construction of the StringToDoubleConverter object; it was used to pass
+          arguments that are known at compile time
+        - most of the StringToDoubleConverter::StringToDouble function's body; it was
+          code we did not need
+        - parsing of Infinity and NaN at the strtod level; added recently when we moved
+          from the old strtod to the new one, and not needed or helpful at this level
+        - multiple copies of code to narrow to single byte strings; in many cases
+          this was done even when starting with an LChar string that is already
+          single-byte, now we handle this with an overload of parseDouble
+
+        * wtf/dtoa.cpp:
+        Removed a long comment about the original strtod function that no longer
+        applies since we deleted that function long ago. Removed a lot of includes.
+        Removed the strtod function templates and its instantiations, since they
+        are now replaced by the parseDouble function.
+        (WTF::Internal::parseDoubleFromLongString): Added.
+        * wtf/dtoa.h:
+        Added an include of ASCIICType.h so we can use isASCII in a function in this
+        header. Left the heretofore unneeded include of double-conversion.h, since we
+        now want to use it in a function in this header. Removed the AllowTrailingJunkTag
+        and AllowTrailingSpacesTag enumerations and the strtod function template. Added
+        new parseDouble function, and inline implementation of it.
+
+        * wtf/dtoa/double-conversion.cc: Removed quite a bit of unused code, hardcoding
+        all the StringToDouble function arguments that come from data members so it can
+        be a much smaller static member function. Also changed the types of arguments
+        from int to size_t.
+        * wtf/dtoa/double-conversion.h: Removed most of the StringToDoubleConverter
+        class, leaving only the conversion function as a static member function.
+
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::toDouble): Got rid of didReadNumber.
+        (WTF::StringImpl::toFloat): Ditto.
+        * wtf/text/StringImpl.h: Ditto.
+        * wtf/text/WTFString.cpp:
+        (WTF::String::toDouble): Got rid of didReadNumber.
+        (WTF::String::toFloat): Ditto.
+        (WTF::toDoubleType): Rewrote this function to use parseDouble. Moved the code
+        to skip leading spaces here, because other callers of parseDouble don't want
+        to do that. Repurposed the check for an empty string so it's now the same
+        code shared by all the "parsed nothing" cases. Removed the code to convert
+        the buffer to ASCII for two reasons: (1) We don't need that code at all when
+        CharType is LChar, and (2) We now handle this through the two overloads for
+        the parseDouble function. Disallowing trailing junk is now handled here,
+        rather than inside parseDouble.
+        (WTF::charactersToDouble): Updated for changes to toDoubleType. Removed the
+        didReadNumber argument.
+        (WTF::charactersToFloat): Ditto. Also added overloads that return the parsed
+        length. These are a slightly more powerful way to do what didReadNumber was
+        used for before.
+
+        * wtf/text/WTFString.h: Added comments, eliminated didReadNumber, and added
+        overloads of charactersToFloat that replace charactersToFloatIgnoringJunk.
+
+2012-04-05  Patrick Gansterer  <paroga@webkit.org>
+
+        [WinCE] Remove unnecessary function decleration
+        https://bugs.webkit.org/show_bug.cgi?id=83155
+
+        Reviewed by Kentaro Hara.
+
+        * wtf/DateMath.cpp:
+        * wtf/Platform.h:
+
+2012-04-04  Patrick Gansterer  <paroga@webkit.org>
+
+        Add WTF::getCurrentLocalTime()
+        https://bugs.webkit.org/show_bug.cgi?id=83164
+
+        Reviewed by Alexey Proskuryakov.
+
+        Replace the calls to WTF::getLocalTime() with time(0) with the new function.
+        This allows us to use Win32 API on windows to get the same result in a next step.
+
+        Also remove the inline keyword from WTF::getLocalTime(), since there is no need for
+        it and it will make the later Win32 API changes easier.
+
+        * WTF.gyp/WTF.gyp:
+        * wtf/CurrentTime.cpp:
+        (WTF::getLocalTime):
+        (WTF::getCurrentLocalTime):
+        * wtf/CurrentTime.h:
+
+2012-04-04  Chris Rogers  <crogers@google.com>
+
+        Web Audio should use MutexTryLocker class
+        https://bugs.webkit.org/show_bug.cgi?id=83194
+
+        Reviewed by Kenneth Russell.
+
+        Add MutexTryLocker class which can be used as a stack-based object wrapping a Mutex.
+        It will automatically unlock the Mutex in its destructor if the tryLock() succeeded.
+
+        * wtf/ThreadingPrimitives.h:
+        (MutexTryLocker):
+        (WTF::MutexTryLocker::MutexTryLocker):
+        (WTF::MutexTryLocker::~MutexTryLocker):
+        (WTF::MutexTryLocker::locked):
+        Check if the tryLock() on the Mutex succeeded.
+        (WTF):
+
+2012-04-04  Kausalya Madhusudhanan  <kmadhusu@chromium.org>
+
+        [Coverity] Address some uninit constructor values.
+        https://bugs.webkit.org/show_bug.cgi?id=82424
+
+        Reviewed by Stephen White.
+
+        New tests are not required since I did not modify any code behavior. I just initialized the class member variables in the constructor.
+
+        * wtf/ArrayBufferView.cpp:
+        (WTF::ArrayBufferView::ArrayBufferView):
+
+2012-03-30  David Barr  <davidbarr@chromium.org>
+
+        Split up top-level .gitignore and .gitattributes
+        https://bugs.webkit.org/show_bug.cgi?id=82687
+
+        Reviewed by Tor Arne Vestbø.
+
+        * WTF.gyp/.gitignore: Added.
+
+2012-03-29  Kevin Ollivier  <kevino@theolliviers.com>
+
+        [wx] Unreviewed build fix. Add export symbols needed to
+        build wx under Windows.
+        
+        * wtf/NullPtr.h:
+        * wtf/ParallelJobsGeneric.h:
+        (ParallelEnvironment):
+        * wtf/ThreadSpecific.h:
+        (WTF):
+
+2012-03-29  Kevin Ollivier  <kevino@theolliviers.com>
+
+        [wx] Unreviewed build fix. Add WTF_EXPORT_PRIVATE_NO_RTTI
+        so that ports not using RTTI can add symbol exports to
+        classes that RTTI ports export with WTF_EXPORT_PRIVATE_RTTI.
+
+        * wtf/ArrayBufferView.h:
+        * wtf/ExportMacros.h:
+
+2012-03-29  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        HashMap<>::add should return a more descriptive object
+        https://bugs.webkit.org/show_bug.cgi?id=71063
+
+        Reviewed by Ryosuke Niwa.
+
+        Make HashTable<>::add() and derivate functions return an AddResult struct instead
+        of a pair. This struct contains contains 'iterator' and 'isNewEntry' members, that are
+        more readable at callsites than previous 'first' and 'second'.
+
+        * wtf/HashCountedSet.h:
+        (HashCountedSet):
+        (WTF::::add):
+        * wtf/HashMap.h:
+        (HashMap):
+        (WTF):
+        (WTF::::set):
+        * wtf/HashSet.h:
+        (HashSet):
+        (WTF::::add):
+        (WTF):
+        * wtf/HashTable.h:
+        (WTF::HashTableAddResult::HashTableAddResult):
+        (HashTableAddResult):
+        (WTF):
+        (HashTable):
+        (WTF::HashTable::add):
+        (WTF::::add):
+        (WTF::::addPassingHashCode):
+        * wtf/ListHashSet.h:
+        (ListHashSet):
+        (WTF::::add):
+        (WTF::::insertBefore):
+        * wtf/RefPtrHashMap.h:
+        (WTF):
+        (WTF::::set):
+        * wtf/Spectrum.h:
+        (WTF::Spectrum::add):
+        * wtf/WTFThreadData.cpp:
+        (JSC::IdentifierTable::add):
+        * wtf/WTFThreadData.h:
+        (IdentifierTable):
+        * wtf/text/AtomicString.cpp:
+        (WTF::addToStringTable):
+        (WTF::AtomicString::addSlowCase):
+
+2012-03-29  Andreas Kling  <kling@webkit.org>
+
+        String: Subscript operator shouldn't force conversion to 16-bit characters.
+        <http://webkit.org/b/82613>
+
+        Reviewed by Anders Carlsson.
+
+        Forward String::operator[] to StringImpl::operator[] instead of indexing into characters().
+        This avoid implicit conversion of 8-bit strings to 16-bit, and as an example, reduces memory
+        usage on http://www.allthingsd.com/ by 360kB.
+
+        * wtf/text/WTFString.h:
+        (WTF::String::operator[]):
+
+2012-03-28  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Implement PlatformStrategies
+        https://bugs.webkit.org/show_bug.cgi?id=82454
+
+        Reviewed by Xan Lopez.
+
+        * wtf/Platform.h: Define WTF_USE_PLATFORM_STRATEGIES for GTK+
+        platform too.
+
+2012-03-26  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Set eol-style: native on WTF.sln per Ryan Sleevi's request.
+
+        * WTF.vcproj/WTF.sln: Added property svn:eol-style.
+
+2012-03-26  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Chromium build fix; add BitVector.h/cpp to gypi.
+
+        * WTF.gypi:
+
+2012-03-26  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Touch BitVector as a speculative fix for Chromium Linux.
+
+        * wtf/BitVector.h:
+        (BitVector):
+
+2012-03-23  Ryosuke Niwa  <rniwa@webkit.org>
+
+        cssText should use shorthand notations
+        https://bugs.webkit.org/show_bug.cgi?id=81737
+
+        Reviewed by Enrica Casucci.
+
+        * wtf/BitVector.h:
+        (BitVector):
+        (WTF::BitVector::ensureSizeAndSet): Added.
+
+2012-03-26  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        Unreviewed. Fix make distcheck.
+
+        * GNUmakefile.list.am: Add config.h to the source file list.
+
+2012-03-25  Kevin Ollivier  <kevino@theolliviers.com>
+
+        [wx] Unreviewed build fix. Move WTF to its own static lib build.
+
+        * wscript: Added.
+
+2012-03-23  Tony Chang  <tony@chromium.org>
+
+        [chromium] Unreviewed, move a comment closer to where it matters and
+        make it more specific.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-03-23  Steve Falkenburg  <sfalken@apple.com>
+
+        Update Apple Windows build files for WTF move
+        https://bugs.webkit.org/show_bug.cgi?id=82069
+
+        Reviewed by Jessie Berlin.
+
+        * WTF.vcproj/WTF.make: Added.
+        * WTF.vcproj/WTF.sln: Added.
+
+2012-03-23  Dean Jackson  <dino@apple.com>
+
+        Disable CSS_SHADERS in Apple builds
+        https://bugs.webkit.org/show_bug.cgi?id=81996
+
+        Reviewed by Simon Fraser.
+
+        Put ENABLE_CSS_SHADERS into Platform.h, but disable for
+        Apple builds.
+
+        * wtf/Platform.h:
+
+2012-03-23  Tony Chang  <tony@chromium.org>
+
+        [chromium] rename newwtf target back to wtf
+        https://bugs.webkit.org/show_bug.cgi?id=82064
+
+        Reviewed by Adam Barth.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-03-22  Jessie Berlin  <jberlin@apple.com>
+
+        Windows build fix after r111778.
+
+        * WTF.vcproj/WTF.vcproj:
+        DateMath.h and DateMath.cpp should be built by WTF, since they are part of WTF.
+
+2012-03-22  Raphael Kubo da Costa  <rakuco@FreeBSD.org>
+
+        [CMake] Unreviewed build fix after r111778.
+
+        * CMakeLists.txt: Added.
+        * wtf/CMakeLists.txt: Add ${CMAKE_BINARY_DIR} to the include paths
+        for cmakeconfig.h to be found.
+
+2012-03-22  Tony Chang  <tony@chromium.org>
+
+        Unreviewed, attempt to fix the chromium-win build and another attempt
+        at fixing the chromium-android build.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-03-22  Tony Chang  <tony@chromium.org>
+
+        Unreviewed, attempt to fix chromium-android build.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-03-22  Tony Chang  <tony@chromium.org>
+
+        Unreviewed, fix chromium build after wtf move.
+
+        Move wtf_config and wtf settings to newwtf.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-03-22  Martin Robinson  <mrobinson@igalia.com>
+
+        One more GTK+ build fix after r111778.
+
+        * GNUmakefile.am: Adding missing include path.
+
+2012-03-22  Martin Robinson  <mrobinson@igalia.com>
+
+        Fixed the GTK+ WTF/JavaScriptCore build after r111778.
+
+        * GNUmakefile.am: Remove some extra trailing backslashes and a few uncessary
+          variables.
+        * GNUmakefile.list.am: Ditto.
+
+2012-03-22  Dan Bernstein  <mitz@apple.com>
+
+        Fixed the JavaScriptCore debug build after r111778.
+
+        * WTF.xcodeproj/project.pbxproj: Use debug DEBUG_DEFINES when building
+        the Debug configuration.
+
+2012-03-22  Csaba Osztrogonác  <ossy@webkit.org>
+
+        Actually move WTF files to their new home
+        https://bugs.webkit.org/show_bug.cgi?id=81844
+
+        [Qt] Unreviewed buildfix after r111778.
+
+        * WTF.pri:
+
+2012-03-22  Eric Seidel  <eric@webkit.org>
+
+        Actually move WTF files to their new home
+        https://bugs.webkit.org/show_bug.cgi?id=81844
+
+        Unreviewed attempt to fix AppleWin.
+
+        * WTF.vcproj/WTFCommon.vsprops:
+
+2012-03-22  Eric Seidel  <eric@webkit.org>
+
+        Actually move WTF files to their new home
+        https://bugs.webkit.org/show_bug.cgi?id=81844
+
+        Unreviewed.  The 5MB file move is not very reviewable,
+        but various port representatives have OK'd changes to the
+        individual build systems.
+
+        * Configurations/WTF.xcconfig:
+        * GNUmakefile.list.am:
+        * Stub.cpp: Removed.
+        * Stub.h: Removed.
+        * WTF.gypi:
+        * WTF.pri:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.vcproj/copy-files.cmd:
+        * WTF.xcodeproj/project.pbxproj:
+        * config.h:
+        * wtf/ASCIICType.h: Renamed from Source/JavaScriptCore/wtf/ASCIICType.h.
+        (WTF):
+        (WTF::isASCII):
+        (WTF::isASCIIAlpha):
+        (WTF::isASCIIDigit):
+        (WTF::isASCIIAlphanumeric):
+        (WTF::isASCIIHexDigit):
+        (WTF::isASCIILower):
+        (WTF::isASCIIOctalDigit):
+        (WTF::isASCIIPrintable):
+        (WTF::isASCIISpace):
+        (WTF::isASCIIUpper):
+        (WTF::toASCIILower):
+        (WTF::toASCIILowerUnchecked):
+        (WTF::toASCIIUpper):
+        (WTF::toASCIIHexValue):
+        (WTF::lowerNibbleToASCIIHexDigit):
+        (WTF::upperNibbleToASCIIHexDigit):
+        (WTF::isASCIIAlphaCaselessEqual):
+        * wtf/AVLTree.h: Renamed from Source/JavaScriptCore/wtf/AVLTree.h.
+        (WTF):
+        (AVLTreeDefaultBSet):
+        (WTF::AVLTreeDefaultBSet::operator[]):
+        (WTF::AVLTreeDefaultBSet::set):
+        (WTF::AVLTreeDefaultBSet::reset):
+        (AVLTree):
+        (WTF::AVLTree::abstractor):
+        (WTF::AVLTree::purge):
+        (WTF::AVLTree::is_empty):
+        (WTF::AVLTree::AVLTree):
+        (Iterator):
+        (WTF::AVLTree::Iterator::Iterator):
+        (WTF::AVLTree::Iterator::start_iter):
+        (WTF::AVLTree::Iterator::start_iter_least):
+        (WTF::AVLTree::Iterator::start_iter_greatest):
+        (WTF::AVLTree::Iterator::operator*):
+        (WTF::AVLTree::Iterator::operator++):
+        (WTF::AVLTree::Iterator::operator--):
+        (WTF::AVLTree::Iterator::cmp_k_n):
+        (WTF::AVLTree::Iterator::cmp_n_n):
+        (WTF::AVLTree::Iterator::get_lt):
+        (WTF::AVLTree::Iterator::get_gt):
+        (WTF::AVLTree::Iterator::null):
+        (WTF::AVLTree::build):
+        (abs_plus_root):
+        (WTF::AVLTree::get_lt):
+        (WTF::AVLTree::set_lt):
+        (WTF::AVLTree::get_gt):
+        (WTF::AVLTree::set_gt):
+        (WTF::AVLTree::get_bf):
+        (WTF::AVLTree::set_bf):
+        (WTF::AVLTree::cmp_k_n):
+        (WTF::AVLTree::cmp_n_n):
+        (WTF::AVLTree::null):
+        (WTF::AVLTree::balance):
+        (WTF::::insert):
+        (WTF::::search):
+        (WTF::::search_least):
+        (WTF::::search_greatest):
+        (WTF::::remove):
+        (WTF::::subst):
+        * wtf/Alignment.h: Renamed from Source/JavaScriptCore/wtf/Alignment.h.
+        (WTF):
+        (WTF::swap):
+        * wtf/AlwaysInline.h: Renamed from Source/JavaScriptCore/wtf/AlwaysInline.h.
+        * wtf/ArrayBuffer.cpp: Renamed from Source/JavaScriptCore/wtf/ArrayBuffer.cpp.
+        (WTF):
+        (WTF::ArrayBuffer::transfer):
+        (WTF::ArrayBuffer::addView):
+        (WTF::ArrayBuffer::removeView):
+        * wtf/ArrayBuffer.h: Renamed from Source/JavaScriptCore/wtf/ArrayBuffer.h.
+        (WTF):
+        (ArrayBufferContents):
+        (WTF::ArrayBufferContents::ArrayBufferContents):
+        (WTF::ArrayBufferContents::data):
+        (WTF::ArrayBufferContents::sizeInBytes):
+        (WTF::ArrayBufferContents::transfer):
+        (ArrayBuffer):
+        (WTF::ArrayBuffer::isNeutered):
+        (WTF::ArrayBuffer::~ArrayBuffer):
+        (WTF::ArrayBuffer::clampValue):
+        (WTF::ArrayBuffer::create):
+        (WTF::ArrayBuffer::ArrayBuffer):
+        (WTF::ArrayBuffer::data):
+        (WTF::ArrayBuffer::byteLength):
+        (WTF::ArrayBuffer::slice):
+        (WTF::ArrayBuffer::sliceImpl):
+        (WTF::ArrayBuffer::clampIndex):
+        (WTF::ArrayBufferContents::tryAllocate):
+        (WTF::ArrayBufferContents::~ArrayBufferContents):
+        * wtf/ArrayBufferView.cpp: Renamed from Source/JavaScriptCore/wtf/ArrayBufferView.cpp.
+        (WTF):
+        (WTF::ArrayBufferView::ArrayBufferView):
+        (WTF::ArrayBufferView::~ArrayBufferView):
+        (WTF::ArrayBufferView::neuter):
+        * wtf/ArrayBufferView.h: Renamed from Source/JavaScriptCore/wtf/ArrayBufferView.h.
+        (WTF):
+        (WTF::ArrayBufferView::setImpl):
+        (WTF::ArrayBufferView::setRangeImpl):
+        (WTF::ArrayBufferView::zeroRangeImpl):
+        (WTF::ArrayBufferView::calculateOffsetAndLength):
+        * wtf/Assertions.cpp: Renamed from Source/JavaScriptCore/wtf/Assertions.cpp.
+        * wtf/Assertions.h: Renamed from Source/JavaScriptCore/wtf/Assertions.h.
+        (assertUnused):
+        (assertWithMessageUnused):
+        * wtf/Atomics.h: Renamed from Source/JavaScriptCore/wtf/Atomics.h.
+        (WTF):
+        (WTF::atomicIncrement):
+        (WTF::atomicDecrement):
+        (WTF::weakCompareAndSwap):
+        (WTF::weakCompareAndSwapUIntPtr):
+        * wtf/BitVector.cpp: Renamed from Source/JavaScriptCore/wtf/BitVector.cpp.
+        (WTF):
+        (WTF::BitVector::setSlow):
+        (WTF::BitVector::resize):
+        (WTF::BitVector::clearAll):
+        (WTF::BitVector::OutOfLineBits::create):
+        (WTF::BitVector::OutOfLineBits::destroy):
+        (WTF::BitVector::resizeOutOfLine):
+        (WTF::BitVector::dump):
+        * wtf/BitVector.h: Renamed from Source/JavaScriptCore/wtf/BitVector.h.
+        (WTF):
+        (BitVector):
+        (WTF::BitVector::BitVector):
+        (WTF::BitVector::~BitVector):
+        (WTF::BitVector::operator=):
+        (WTF::BitVector::size):
+        (WTF::BitVector::ensureSize):
+        (WTF::BitVector::quickGet):
+        (WTF::BitVector::quickSet):
+        (WTF::BitVector::quickClear):
+        (WTF::BitVector::get):
+        (WTF::BitVector::set):
+        (WTF::BitVector::clear):
+        (WTF::BitVector::bitsInPointer):
+        (WTF::BitVector::maxInlineBits):
+        (WTF::BitVector::byteCount):
+        (WTF::BitVector::makeInlineBits):
+        (OutOfLineBits):
+        (WTF::BitVector::OutOfLineBits::numBits):
+        (WTF::BitVector::OutOfLineBits::numWords):
+        (WTF::BitVector::OutOfLineBits::bits):
+        (WTF::BitVector::OutOfLineBits::OutOfLineBits):
+        (WTF::BitVector::isInline):
+        (WTF::BitVector::outOfLineBits):
+        (WTF::BitVector::bits):
+        * wtf/Bitmap.h: Renamed from Source/JavaScriptCore/wtf/Bitmap.h.
+        (WTF):
+        (Bitmap):
+        (WTF::::Bitmap):
+        (WTF::::get):
+        (WTF::::set):
+        (WTF::::testAndSet):
+        (WTF::::testAndClear):
+        (WTF::::concurrentTestAndSet):
+        (WTF::::concurrentTestAndClear):
+        (WTF::::clear):
+        (WTF::::clearAll):
+        (WTF::::nextPossiblyUnset):
+        (WTF::::findRunOfZeros):
+        (WTF::::count):
+        (WTF::::isEmpty):
+        (WTF::::isFull):
+        * wtf/BlockStack.h: Renamed from Source/JavaScriptCore/wtf/BlockStack.h.
+        (WTF):
+        (BlockStack):
+        (WTF::::BlockStack):
+        (WTF::::~BlockStack):
+        (WTF::::blocks):
+        (WTF::::grow):
+        (WTF::::shrink):
+        * wtf/BloomFilter.h: Renamed from Source/JavaScriptCore/wtf/BloomFilter.h.
+        (WTF):
+        (BloomFilter):
+        (WTF::BloomFilter::maximumCount):
+        (WTF::BloomFilter::BloomFilter):
+        (WTF::BloomFilter::mayContain):
+        (WTF::BloomFilter::add):
+        (WTF::BloomFilter::remove):
+        (WTF::BloomFilter::firstSlot):
+        (WTF::BloomFilter::secondSlot):
+        (WTF::::add):
+        (WTF::::remove):
+        (WTF::::clear):
+        (WTF::::likelyEmpty):
+        (WTF::::isClear):
+        * wtf/BoundsCheckedPointer.h: Renamed from Source/JavaScriptCore/wtf/BoundsCheckedPointer.h.
+        (WTF):
+        (BoundsCheckedPointer):
+        (WTF::BoundsCheckedPointer::BoundsCheckedPointer):
+        (WTF::BoundsCheckedPointer::operator=):
+        (WTF::BoundsCheckedPointer::operator+=):
+        (WTF::BoundsCheckedPointer::operator-=):
+        (WTF::BoundsCheckedPointer::operator+):
+        (WTF::BoundsCheckedPointer::operator-):
+        (WTF::BoundsCheckedPointer::operator++):
+        (WTF::BoundsCheckedPointer::operator--):
+        (WTF::BoundsCheckedPointer::operator<):
+        (WTF::BoundsCheckedPointer::operator<=):
+        (WTF::BoundsCheckedPointer::operator>):
+        (WTF::BoundsCheckedPointer::operator>=):
+        (WTF::BoundsCheckedPointer::operator==):
+        (WTF::BoundsCheckedPointer::operator!=):
+        (WTF::BoundsCheckedPointer::operator!):
+        (WTF::BoundsCheckedPointer::get):
+        (WTF::BoundsCheckedPointer::operator*):
+        (WTF::BoundsCheckedPointer::operator[]):
+        (WTF::BoundsCheckedPointer::strcat):
+        (WTF::BoundsCheckedPointer::validate):
+        * wtf/BumpPointerAllocator.h: Renamed from Source/JavaScriptCore/wtf/BumpPointerAllocator.h.
+        (WTF):
+        (BumpPointerPool):
+        (WTF::BumpPointerPool::ensureCapacity):
+        (WTF::BumpPointerPool::alloc):
+        (WTF::BumpPointerPool::dealloc):
+        (WTF::BumpPointerPool::operator new):
+        (WTF::BumpPointerPool::BumpPointerPool):
+        (WTF::BumpPointerPool::create):
+        (WTF::BumpPointerPool::shrink):
+        (WTF::BumpPointerPool::destroy):
+        (WTF::BumpPointerPool::ensureCapacityCrossPool):
+        (WTF::BumpPointerPool::deallocCrossPool):
+        (BumpPointerAllocator):
+        (WTF::BumpPointerAllocator::BumpPointerAllocator):
+        (WTF::BumpPointerAllocator::~BumpPointerAllocator):
+        (WTF::BumpPointerAllocator::startAllocator):
+        (WTF::BumpPointerAllocator::stopAllocator):
+        * wtf/ByteArray.cpp: Renamed from Source/JavaScriptCore/wtf/ByteArray.cpp.
+        (WTF):
+        (WTF::ByteArray::create):
+        * wtf/ByteArray.h: Renamed from Source/JavaScriptCore/wtf/ByteArray.h.
+        (ByteArray):
+        (WTF::ByteArray::length):
+        (WTF::ByteArray::set):
+        (WTF::ByteArray::get):
+        (WTF::ByteArray::data):
+        (WTF::ByteArray::clear):
+        (WTF::ByteArray::deref):
+        (WTF::ByteArray::offsetOfSize):
+        (WTF::ByteArray::offsetOfData):
+        (WTF::ByteArray::ByteArray):
+        * wtf/CMakeLists.txt: Renamed from Source/JavaScriptCore/wtf/CMakeLists.txt.
+        * wtf/CONTRIBUTORS.pthreads-win32: Renamed from Source/JavaScriptCore/wtf/CONTRIBUTORS.pthreads-win32.
+        * wtf/CheckedArithmetic.h: Renamed from Source/JavaScriptCore/wtf/CheckedArithmetic.h.
+        (WTF):
+        (CrashOnOverflow):
+        (WTF::CrashOnOverflow::overflowed):
+        (WTF::CrashOnOverflow::clearOverflow):
+        (WTF::CrashOnOverflow::hasOverflowed):
+        (RecordOverflow):
+        (WTF::RecordOverflow::RecordOverflow):
+        (WTF::RecordOverflow::overflowed):
+        (WTF::RecordOverflow::clearOverflow):
+        (WTF::RecordOverflow::hasOverflowed):
+        (WTF::isInBounds):
+        (RemoveChecked):
+        (WTF::safeAdd):
+        (WTF::safeSub):
+        (WTF::safeMultiply):
+        (WTF::safeEquals):
+        (WTF::workAroundClangBug):
+        (Checked):
+        (WTF::Checked::Checked):
+        (WTF::Checked::operator=):
+        (WTF::Checked::operator++):
+        (WTF::Checked::operator--):
+        (WTF::Checked::operator!):
+        (WTF::Checked::operator UnspecifiedBoolType*):
+        (WTF::Checked::unsafeGet):
+        (WTF::Checked::operator+=):
+        (WTF::Checked::operator-=):
+        (WTF::Checked::operator*=):
+        (WTF::Checked::operator==):
+        (WTF::Checked::operator!=):
+        (WTF::operator+):
+        (WTF::operator-):
+        (WTF::operator*):
+        * wtf/CheckedBoolean.h: Renamed from Source/JavaScriptCore/wtf/CheckedBoolean.h.
+        (CheckedBoolean):
+        (CheckedBoolean::CheckedBoolean):
+        (CheckedBoolean::~CheckedBoolean):
+        (CheckedBoolean::operator bool):
+        * wtf/Compiler.h: Renamed from Source/JavaScriptCore/wtf/Compiler.h.
+        * wtf/Complex.h: Renamed from Source/JavaScriptCore/wtf/Complex.h.
+        (WTF):
+        (WTF::complexFromMagnitudePhase):
+        * wtf/CryptographicallyRandomNumber.cpp: Renamed from Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.cpp.
+        (WTF::cryptographicallyRandomNumber):
+        (WTF):
+        (WTF::cryptographicallyRandomValues):
+        * wtf/CryptographicallyRandomNumber.h: Renamed from Source/JavaScriptCore/wtf/CryptographicallyRandomNumber.h.
+        (WTF):
+        * wtf/CurrentTime.cpp: Renamed from Source/JavaScriptCore/wtf/CurrentTime.cpp.
+        (WTF):
+        (WTF::highResUpTime):
+        (WTF::lowResUTCTime):
+        (WTF::qpcAvailable):
+        (WTF::currentTime):
+        (WTF::currentSystemTime):
+        (WTF::monotonicallyIncreasingTime):
+        * wtf/CurrentTime.h: Renamed from Source/JavaScriptCore/wtf/CurrentTime.h.
+        (WTF):
+        (WTF::currentTimeMS):
+        (WTF::getLocalTime):
+        * wtf/DataLog.cpp: Renamed from Source/JavaScriptCore/wtf/DataLog.cpp.
+        (WTF):
+        (WTF::initializeLogFileOnce):
+        (WTF::initializeLogFile):
+        (WTF::dataFile):
+        (WTF::dataLogV):
+        (WTF::dataLog):
+        * wtf/DataLog.h: Renamed from Source/JavaScriptCore/wtf/DataLog.h.
+        (WTF):
+        * wtf/DateMath.cpp: Renamed from Source/JavaScriptCore/wtf/DateMath.cpp.
+        (WTF):
+        (WTF::isLeapYear):
+        (WTF::daysInYear):
+        (WTF::daysFrom1970ToYear):
+        (WTF::msToDays):
+        (WTF::twoDigitStringFromNumber):
+        (WTF::msToYear):
+        (WTF::dayInYear):
+        (WTF::msToMilliseconds):
+        (WTF::msToMinutes):
+        (WTF::msToHours):
+        (WTF::monthFromDayInYear):
+        (WTF::checkMonth):
+        (WTF::dayInMonthFromDayInYear):
+        (WTF::monthToDayInYear):
+        (WTF::dateToDaysFrom1970):
+        (WTF::maximumYearForDST):
+        (WTF::minimumYearForDST):
+        (WTF::equivalentYearForDST):
+        (WTF::calculateUTCOffset):
+        (WTF::calculateDSTOffsetSimple):
+        (WTF::calculateDSTOffset):
+        (WTF::initializeDates):
+        (WTF::ymdhmsToSeconds):
+        (KnownZone):
+        (WTF::skipSpacesAndComments):
+        (WTF::findMonth):
+        (WTF::parseLong):
+        (WTF::parseES5DatePortion):
+        (WTF::parseES5TimePortion):
+        (WTF::parseES5DateFromNullTerminatedCharacters):
+        (WTF::parseDateFromNullTerminatedCharacters):
+        (WTF::timeClip):
+        (WTF::makeRFC2822DateString):
+        * wtf/DateMath.h: Renamed from Source/JavaScriptCore/wtf/DateMath.h.
+        (WTF):
+        (WTF::jsCurrentTime):
+        * wtf/DecimalNumber.cpp: Renamed from Source/JavaScriptCore/wtf/DecimalNumber.cpp.
+        (WTF):
+        (WTF::DecimalNumber::bufferLengthForStringDecimal):
+        (WTF::DecimalNumber::bufferLengthForStringExponential):
+        (WTF::DecimalNumber::toStringDecimal):
+        (WTF::DecimalNumber::toStringExponential):
+        * wtf/DecimalNumber.h: Renamed from Source/JavaScriptCore/wtf/DecimalNumber.h.
+        (WTF):
+        (DecimalNumber):
+        (WTF::DecimalNumber::DecimalNumber):
+        (WTF::DecimalNumber::sign):
+        (WTF::DecimalNumber::exponent):
+        (WTF::DecimalNumber::significand):
+        (WTF::DecimalNumber::precision):
+        * wtf/Decoder.h: Renamed from Source/JavaScriptCore/wtf/Decoder.h.
+        (WTF):
+        (Decoder):
+        (WTF::Decoder::Decoder):
+        (WTF::Decoder::~Decoder):
+        * wtf/Deque.h: Renamed from Source/JavaScriptCore/wtf/Deque.h.
+        (WTF):
+        (Deque):
+        (WTF::Deque::size):
+        (WTF::Deque::isEmpty):
+        (WTF::Deque::begin):
+        (WTF::Deque::end):
+        (WTF::Deque::rbegin):
+        (WTF::Deque::rend):
+        (WTF::Deque::first):
+        (WTF::Deque::last):
+        (DequeIteratorBase):
+        (WTF::DequeIteratorBase::assign):
+        (DequeIterator):
+        (WTF::DequeIterator::DequeIterator):
+        (WTF::DequeIterator::operator=):
+        (WTF::DequeIterator::operator*):
+        (WTF::DequeIterator::operator->):
+        (WTF::DequeIterator::operator==):
+        (WTF::DequeIterator::operator!=):
+        (WTF::DequeIterator::operator++):
+        (WTF::DequeIterator::operator--):
+        (DequeConstIterator):
+        (WTF::DequeConstIterator::DequeConstIterator):
+        (WTF::DequeConstIterator::operator=):
+        (WTF::DequeConstIterator::operator*):
+        (WTF::DequeConstIterator::operator->):
+        (WTF::DequeConstIterator::operator==):
+        (WTF::DequeConstIterator::operator!=):
+        (WTF::DequeConstIterator::operator++):
+        (WTF::DequeConstIterator::operator--):
+        (DequeReverseIterator):
+        (WTF::DequeReverseIterator::DequeReverseIterator):
+        (WTF::DequeReverseIterator::operator=):
+        (WTF::DequeReverseIterator::operator*):
+        (WTF::DequeReverseIterator::operator->):
+        (WTF::DequeReverseIterator::operator==):
+        (WTF::DequeReverseIterator::operator!=):
+        (WTF::DequeReverseIterator::operator++):
+        (WTF::DequeReverseIterator::operator--):
+        (DequeConstReverseIterator):
+        (WTF::DequeConstReverseIterator::DequeConstReverseIterator):
+        (WTF::DequeConstReverseIterator::operator=):
+        (WTF::DequeConstReverseIterator::operator*):
+        (WTF::DequeConstReverseIterator::operator->):
+        (WTF::DequeConstReverseIterator::operator==):
+        (WTF::DequeConstReverseIterator::operator!=):
+        (WTF::DequeConstReverseIterator::operator++):
+        (WTF::DequeConstReverseIterator::operator--):
+        (WTF::::checkValidity):
+        (WTF::::checkIndexValidity):
+        (WTF::::invalidateIterators):
+        (WTF::::Deque):
+        (WTF::deleteAllValues):
+        (WTF::=):
+        (WTF::::destroyAll):
+        (WTF::::~Deque):
+        (WTF::::swap):
+        (WTF::::clear):
+        (WTF::::findIf):
+        (WTF::::expandCapacityIfNeeded):
+        (WTF::::expandCapacity):
+        (WTF::::takeFirst):
+        (WTF::::append):
+        (WTF::::prepend):
+        (WTF::::removeFirst):
+        (WTF::::remove):
+        (WTF::::addToIteratorsList):
+        (WTF::::removeFromIteratorsList):
+        (WTF::::DequeIteratorBase):
+        (WTF::::~DequeIteratorBase):
+        (WTF::::isEqual):
+        (WTF::::increment):
+        (WTF::::decrement):
+        (WTF::::after):
+        (WTF::::before):
+        * wtf/DisallowCType.h: Renamed from Source/JavaScriptCore/wtf/DisallowCType.h.
+        * wtf/DoublyLinkedList.h: Renamed from Source/JavaScriptCore/wtf/DoublyLinkedList.h.
+        (WTF):
+        (DoublyLinkedListNode):
+        (WTF::::DoublyLinkedListNode):
+        (WTF::::setPrev):
+        (WTF::::setNext):
+        (WTF::::prev):
+        (WTF::::next):
+        (DoublyLinkedList):
+        (WTF::::DoublyLinkedList):
+        (WTF::::isEmpty):
+        (WTF::::size):
+        (WTF::::clear):
+        (WTF::::head):
+        (WTF::::tail):
+        (WTF::::push):
+        (WTF::::append):
+        (WTF::::remove):
+        (WTF::::removeHead):
+        * wtf/DynamicAnnotations.cpp: Renamed from Source/JavaScriptCore/wtf/DynamicAnnotations.cpp.
+        (WTFAnnotateBenignRaceSized):
+        (WTFAnnotateHappensBefore):
+        (WTFAnnotateHappensAfter):
+        * wtf/DynamicAnnotations.h: Renamed from Source/JavaScriptCore/wtf/DynamicAnnotations.h.
+        * wtf/Encoder.h: Renamed from Source/JavaScriptCore/wtf/Encoder.h.
+        (WTF):
+        (Encoder):
+        (WTF::Encoder::Encoder):
+        (WTF::Encoder::~Encoder):
+        * wtf/ExportMacros.h: Renamed from Source/JavaScriptCore/wtf/ExportMacros.h.
+        * wtf/FastAllocBase.h: Renamed from Source/JavaScriptCore/wtf/FastAllocBase.h.
+        (WTF):
+        (WTF::fastNew):
+        (Internal):
+        (WTF::Internal::NewArrayImpl::fastNewArray):
+        (WTF::fastNewArray):
+        (WTF::fastDelete):
+        (WTF::fastDeleteSkippingDestructor):
+        (WTF::Internal::DeleteArrayImpl::fastDeleteArray):
+        (WTF::fastDeleteArray):
+        (WTF::fastNonNullDelete):
+        (WTF::Internal::NonNullDeleteArrayImpl::fastNonNullDeleteArray):
+        (WTF::fastNonNullDeleteArray):
+        * wtf/FastMalloc.cpp: Renamed from Source/JavaScriptCore/wtf/FastMalloc.cpp.
+        (WTF):
+        (WTF::isForbidden):
+        (WTF::fastMallocForbid):
+        (WTF::fastMallocAllow):
+        (WTF::initializeIsForbiddenKey):
+        (Internal):
+        (WTF::Internal::fastMallocMatchFailed):
+        (WTF::fastZeroedMalloc):
+        (WTF::fastStrDup):
+        (WTF::tryFastZeroedMalloc):
+        (WTF::tryFastMalloc):
+        (WTF::fastMalloc):
+        (WTF::tryFastCalloc):
+        (WTF::fastCalloc):
+        (WTF::fastFree):
+        (WTF::tryFastRealloc):
+        (WTF::fastRealloc):
+        (WTF::releaseFastMallocFreeMemory):
+        (WTF::fastMallocStatistics):
+        (WTF::fastMallocSize):
+        (FastMallocZone):
+        (WTF::FastMallocZone::goodSize):
+        (WTF::FastMallocZone::check):
+        (WTF::FastMallocZone::print):
+        (WTF::FastMallocZone::log):
+        (WTF::FastMallocZone::forceLock):
+        (WTF::FastMallocZone::forceUnlock):
+        (WTF::FastMallocZone::statistics):
+        (WTF::FastMallocZone::zoneValloc):
+        (WTF::FastMallocZone::zoneDestroy):
+        (WTF::KernelSupportsTLS):
+        (WTF::CheckIfKernelSupportsTLS):
+        (WTF::ClassIndex):
+        (TCEntry):
+        (WTF::LgFloor):
+        (WTF::SLL_Next):
+        (WTF::SLL_SetNext):
+        (WTF::SLL_Push):
+        (WTF::SLL_Pop):
+        (WTF::SLL_PopRange):
+        (WTF::SLL_PushRange):
+        (WTF::SLL_Size):
+        (WTF::SizeClass):
+        (WTF::ByteSizeForClass):
+        (WTF::NumMoveSize):
+        (WTF::InitSizeClasses):
+        (WTF::MetaDataAlloc):
+        (PageHeapAllocator):
+        (WTF::PageHeapAllocator::Init):
+        (WTF::PageHeapAllocator::New):
+        (WTF::PageHeapAllocator::Delete):
+        (WTF::PageHeapAllocator::inuse):
+        (WTF::PageHeapAllocator::recordAdministrativeRegions):
+        (WTF::pages):
+        (WTF::AllocationSize):
+        (Span):
+        (WTF::Event):
+        (WTF::NewSpan):
+        (WTF::DeleteSpan):
+        (WTF::DLL_Init):
+        (WTF::DLL_Remove):
+        (WTF::DLL_IsEmpty):
+        (WTF::DLL_Length):
+        (WTF::DLL_Print):
+        (WTF::DLL_Prepend):
+        (StackTrace):
+        (MapSelector):
+        (TCMalloc_PageHeap):
+        (WTF::TCMalloc_PageHeap::GetDescriptor):
+        (WTF::TCMalloc_PageHeap::GetDescriptorEnsureSafe):
+        (WTF::TCMalloc_PageHeap::SystemBytes):
+        (WTF::TCMalloc_PageHeap::FreeBytes):
+        (WTF::TCMalloc_PageHeap::GetSizeClassIfCached):
+        (WTF::TCMalloc_PageHeap::CacheSizeClass):
+        (SpanList):
+        (WTF::TCMalloc_PageHeap::RecordSpan):
+        (WTF::TCMalloc_PageHeap::init):
+        (WTF::TCMalloc_PageHeap::initializeScavenger):
+        (WTF::TCMalloc_PageHeap::isScavengerSuspended):
+        (WTF::TCMalloc_PageHeap::scheduleScavenger):
+        (WTF::TCMalloc_PageHeap::rescheduleScavenger):
+        (WTF::TCMalloc_PageHeap::suspendScavenger):
+        (WTF::TCMalloc_PageHeap::scavengerTimerFired):
+        (WTF::TCMalloc_PageHeap::runScavengerThread):
+        (WTF::TCMalloc_PageHeap::signalScavenger):
+        (WTF::TCMalloc_PageHeap::scavenge):
+        (WTF::TCMalloc_PageHeap::shouldScavenge):
+        (WTF::TCMalloc_PageHeap::New):
+        (WTF::TCMalloc_PageHeap::AllocLarge):
+        (WTF::TCMalloc_PageHeap::Split):
+        (WTF::TCMalloc_PageHeap::Carve):
+        (WTF::mergeDecommittedStates):
+        (WTF::TCMalloc_PageHeap::Delete):
+        (WTF::TCMalloc_PageHeap::IncrementalScavenge):
+        (WTF::TCMalloc_PageHeap::RegisterSizeClass):
+        (WTF::TCMalloc_PageHeap::ReturnedBytes):
+        (WTF::PagesToMB):
+        (WTF::TCMalloc_PageHeap::Dump):
+        (WTF::TCMalloc_PageHeap::GrowHeap):
+        (WTF::TCMalloc_PageHeap::Check):
+        (WTF::TCMalloc_PageHeap::CheckList):
+        (WTF::TCMalloc_PageHeap::ReleaseFreeList):
+        (WTF::TCMalloc_PageHeap::ReleaseFreePages):
+        (TCMalloc_ThreadCache_FreeList):
+        (WTF::TCMalloc_ThreadCache_FreeList::Init):
+        (WTF::TCMalloc_ThreadCache_FreeList::length):
+        (WTF::TCMalloc_ThreadCache_FreeList::empty):
+        (WTF::TCMalloc_ThreadCache_FreeList::lowwatermark):
+        (WTF::TCMalloc_ThreadCache_FreeList::clear_lowwatermark):
+        (WTF::TCMalloc_ThreadCache_FreeList::Push):
+        (WTF::TCMalloc_ThreadCache_FreeList::PushRange):
+        (WTF::TCMalloc_ThreadCache_FreeList::PopRange):
+        (WTF::TCMalloc_ThreadCache_FreeList::Pop):
+        (WTF::TCMalloc_ThreadCache_FreeList::enumerateFreeObjects):
+        (TCMalloc_ThreadCache):
+        (WTF::TCMalloc_ThreadCache::freelist_length):
+        (WTF::TCMalloc_ThreadCache::Size):
+        (WTF::TCMalloc_ThreadCache::enumerateFreeObjects):
+        (TCMalloc_Central_FreeList):
+        (WTF::TCMalloc_Central_FreeList::length):
+        (WTF::TCMalloc_Central_FreeList::tc_length):
+        (WTF::TCMalloc_Central_FreeList::enumerateFreeObjects):
+        (TCMalloc_Central_FreeListPadded):
+        (WTF::getPageHeap):
+        (WTF::TCMalloc_PageHeap::periodicScavenge):
+        (WTF::TCMalloc_PageHeap::scavengerThread):
+        (WTF::setThreadHeap):
+        (WTF::TCMalloc_Central_FreeList::Init):
+        (WTF::TCMalloc_Central_FreeList::ReleaseListToSpans):
+        (WTF::TCMalloc_Central_FreeList::ReleaseToSpans):
+        (WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass):
+        (WTF::TCMalloc_Central_FreeList::MakeCacheSpace):
+        (WTF::TCMalloc_Central_FreeList::ShrinkCache):
+        (WTF::TCMalloc_Central_FreeList::InsertRange):
+        (WTF::TCMalloc_Central_FreeList::RemoveRange):
+        (WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe):
+        (WTF::TCMalloc_Central_FreeList::FetchFromSpans):
+        (WTF::TCMalloc_Central_FreeList::Populate):
+        (WTF::TCMalloc_ThreadCache::SampleAllocation):
+        (WTF::TCMalloc_ThreadCache::Init):
+        (WTF::TCMalloc_ThreadCache::Cleanup):
+        (WTF::TCMalloc_ThreadCache::Allocate):
+        (WTF::TCMalloc_ThreadCache::Deallocate):
+        (WTF::TCMalloc_ThreadCache::FetchFromCentralCache):
+        (WTF::TCMalloc_ThreadCache::ReleaseToCentralCache):
+        (WTF::TCMalloc_ThreadCache::Scavenge):
+        (WTF::TCMalloc_ThreadCache::PickNextSample):
+        (WTF::TCMalloc_ThreadCache::InitModule):
+        (WTF::TCMalloc_ThreadCache::NewHeap):
+        (WTF::TCMalloc_ThreadCache::GetThreadHeap):
+        (WTF::TCMalloc_ThreadCache::GetCache):
+        (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
+        (WTF::TCMalloc_ThreadCache::InitTSD):
+        (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+        * wtf/FastMalloc.h: Renamed from Source/JavaScriptCore/wtf/FastMalloc.h.
+        (WTF):
+        (WTF::TryMallocReturnValue::TryMallocReturnValue):
+        (WTF::TryMallocReturnValue::~TryMallocReturnValue):
+        (TryMallocReturnValue):
+        (WTF::TryMallocReturnValue::operator PossiblyNull<T>):
+        (WTF::TryMallocReturnValue::getValue):
+        (FastMallocStatistics):
+        (ValidationHeader):
+        (Internal):
+        (WTF::Internal::fastMallocValidationHeader):
+        (WTF::Internal::fastMallocValidationSuffix):
+        (WTF::Internal::fastMallocMatchValidationType):
+        (WTF::Internal::setFastMallocMatchValidationType):
+        (WTF::fastMallocMatchValidateMalloc):
+        (WTF::fastMallocMatchValidateFree):
+        (WTF::fastMallocValidate):
+        (throw):
+        * wtf/FixedArray.h: Renamed from Source/JavaScriptCore/wtf/FixedArray.h.
+        (WTF):
+        (FixedArray):
+        (WTF::FixedArray::operator[]):
+        (WTF::FixedArray::data):
+        (WTF::FixedArray::size):
+        * wtf/Float32Array.h: Renamed from Source/JavaScriptCore/wtf/Float32Array.h.
+        (WTF):
+        (Float32Array):
+        (WTF::Float32Array::set):
+        (WTF::Float32Array::item):
+        (WTF::Float32Array::isFloatArray):
+        (WTF::Float32Array::create):
+        (WTF::Float32Array::Float32Array):
+        (WTF::Float32Array::subarray):
+        * wtf/Float64Array.h: Renamed from Source/JavaScriptCore/wtf/Float64Array.h.
+        (WTF):
+        (Float64Array):
+        (WTF::Float64Array::set):
+        (WTF::Float64Array::item):
+        (WTF::Float64Array::isDoubleArray):
+        (WTF::Float64Array::create):
+        (WTF::Float64Array::Float64Array):
+        (WTF::Float64Array::subarray):
+        * wtf/Forward.h: Renamed from Source/JavaScriptCore/wtf/Forward.h.
+        (WTF):
+        * wtf/Functional.h: Renamed from Source/JavaScriptCore/wtf/Functional.h.
+        (WTF):
+        (HasRefAndDeref):
+        (NoType):
+        (BaseMixin):
+        (WTF::R):
+        (WTF::C::):
+        (WTF::RefAndDeref::ref):
+        (WTF::RefAndDeref::deref):
+        (ParamStorageTraits):
+        (WTF::ParamStorageTraits::wrap):
+        (WTF::ParamStorageTraits::unwrap):
+        (FunctionImplBase):
+        (WTF::FunctionImplBase::~FunctionImplBase):
+        (FunctionBase):
+        (WTF::FunctionBase::isNull):
+        (WTF::FunctionBase::FunctionBase):
+        (WTF::FunctionBase::impl):
+        (WTF::bind):
+        * wtf/GetPtr.h: Renamed from Source/JavaScriptCore/wtf/GetPtr.h.
+        (WTF):
+        (WTF::getPtr):
+        * wtf/HashCountedSet.h: Renamed from Source/JavaScriptCore/wtf/HashCountedSet.h.
+        (WTF):
+        (HashCountedSet):
+        (WTF::HashCountedSet::HashCountedSet):
+        (WTF::::size):
+        (WTF::::capacity):
+        (WTF::::isEmpty):
+        (WTF::::begin):
+        (WTF::::end):
+        (WTF::::find):
+        (WTF::::contains):
+        (WTF::::count):
+        (WTF::::add):
+        (WTF::::remove):
+        (WTF::::removeAll):
+        (WTF::::clear):
+        (WTF::copyToVector):
+        * wtf/HashFunctions.h: Renamed from Source/JavaScriptCore/wtf/HashFunctions.h.
+        (WTF):
+        (WTF::intHash):
+        (WTF::IntHash::hash):
+        (WTF::IntHash::equal):
+        (IntHash):
+        (WTF::FloatHash::hash):
+        (WTF::FloatHash::equal):
+        (FloatHash):
+        (WTF::PtrHash::hash):
+        (WTF::PtrHash::equal):
+        (PtrHash):
+        (WTF::PairHash::hash):
+        (WTF::PairHash::equal):
+        (PairHash):
+        * wtf/HashIterators.h: Renamed from Source/JavaScriptCore/wtf/HashIterators.h.
+        (WTF):
+        (HashTableConstKeysIterator):
+        (WTF::HashTableConstKeysIterator::HashTableConstKeysIterator):
+        (WTF::HashTableConstKeysIterator::get):
+        (WTF::HashTableConstKeysIterator::operator*):
+        (WTF::HashTableConstKeysIterator::operator->):
+        (WTF::HashTableConstKeysIterator::operator++):
+        (HashTableConstValuesIterator):
+        (WTF::HashTableConstValuesIterator::HashTableConstValuesIterator):
+        (WTF::HashTableConstValuesIterator::get):
+        (WTF::HashTableConstValuesIterator::operator*):
+        (WTF::HashTableConstValuesIterator::operator->):
+        (WTF::HashTableConstValuesIterator::operator++):
+        (HashTableKeysIterator):
+        (WTF::HashTableKeysIterator::HashTableKeysIterator):
+        (WTF::HashTableKeysIterator::get):
+        (WTF::HashTableKeysIterator::operator*):
+        (WTF::HashTableKeysIterator::operator->):
+        (WTF::HashTableKeysIterator::operator++):
+        (WTF::HashTableKeysIterator::operator HashTableConstKeysIterator<HashTableType, KeyType, MappedType>):
+        (HashTableValuesIterator):
+        (WTF::HashTableValuesIterator::HashTableValuesIterator):
+        (WTF::HashTableValuesIterator::get):
+        (WTF::HashTableValuesIterator::operator*):
+        (WTF::HashTableValuesIterator::operator->):
+        (WTF::HashTableValuesIterator::operator++):
+        (WTF::HashTableValuesIterator::operator HashTableConstValuesIterator<HashTableType, KeyType, MappedType>):
+        (WTF::operator==):
+        (WTF::operator!=):
+        * wtf/HashMap.h: Renamed from Source/JavaScriptCore/wtf/HashMap.h.
+        (WTF):
+        (ReferenceTypeMaker):
+        (HashMap):
+        (WTF::HashMap::keys):
+        (WTF::HashMap::values):
+        (HashMapKeysProxy):
+        (WTF::HashMap::HashMapKeysProxy::begin):
+        (WTF::HashMap::HashMapKeysProxy::end):
+        (HashMapValuesProxy):
+        (WTF::HashMap::HashMapValuesProxy::begin):
+        (WTF::HashMap::HashMapValuesProxy::end):
+        (WTF::PairFirstExtractor::extract):
+        (WTF::HashMapTranslator::hash):
+        (WTF::HashMapTranslator::equal):
+        (WTF::HashMapTranslator::translate):
+        (WTF::HashMapTranslatorAdapter::hash):
+        (WTF::HashMapTranslatorAdapter::equal):
+        (WTF::HashMapTranslatorAdapter::translate):
+        (WTF::::swap):
+        (WTF::::size):
+        (WTF::::capacity):
+        (WTF::::isEmpty):
+        (WTF::::begin):
+        (WTF::::end):
+        (WTF::::find):
+        (WTF::::contains):
+        (WTF::::inlineAdd):
+        (WTF::::set):
+        (WTF::::add):
+        (WTF::::get):
+        (WTF::::remove):
+        (WTF::::clear):
+        (WTF::::take):
+        (WTF::::checkConsistency):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::deleteAllPairSeconds):
+        (WTF::deleteAllValues):
+        (WTF::deleteAllPairFirsts):
+        (WTF::deleteAllKeys):
+        (WTF::copyKeysToVector):
+        (WTF::copyValuesToVector):
+        * wtf/HashSet.h: Renamed from Source/JavaScriptCore/wtf/HashSet.h.
+        (WTF):
+        (HashSet):
+        (WTF::IdentityExtractor::extract):
+        (WTF::HashSetTranslatorAdapter::hash):
+        (WTF::HashSetTranslatorAdapter::equal):
+        (WTF::HashSetTranslatorAdapter::translate):
+        (WTF::::swap):
+        (WTF::::size):
+        (WTF::::capacity):
+        (WTF::::isEmpty):
+        (WTF::::begin):
+        (WTF::::end):
+        (WTF::::find):
+        (WTF::::contains):
+        (WTF::::add):
+        (WTF::::remove):
+        (WTF::::clear):
+        (WTF::deleteAllValues):
+        (WTF::fastDeleteAllValues):
+        (WTF::copyToVector):
+        * wtf/HashTable.cpp: Renamed from Source/JavaScriptCore/wtf/HashTable.cpp.
+        (WTF):
+        (WTF::hashTableStatsMutex):
+        (WTF::HashTableStats::~HashTableStats):
+        (WTF::HashTableStats::recordCollisionAtCount):
+        * wtf/HashTable.h: Renamed from Source/JavaScriptCore/wtf/HashTable.h.
+        (WTF):
+        (HashTableStats):
+        (WTF::addIterator):
+        (WTF::removeIterator):
+        (HashTableConstIterator):
+        (WTF::HashTableConstIterator::skipEmptyBuckets):
+        (WTF::HashTableConstIterator::HashTableConstIterator):
+        (WTF::HashTableConstIterator::~HashTableConstIterator):
+        (WTF::HashTableConstIterator::operator=):
+        (WTF::HashTableConstIterator::get):
+        (WTF::HashTableConstIterator::operator*):
+        (WTF::HashTableConstIterator::operator->):
+        (WTF::HashTableConstIterator::operator++):
+        (WTF::HashTableConstIterator::operator==):
+        (WTF::HashTableConstIterator::operator!=):
+        (WTF::HashTableConstIterator::checkValidity):
+        (HashTableIterator):
+        (WTF::HashTableIterator::HashTableIterator):
+        (WTF::HashTableIterator::get):
+        (WTF::HashTableIterator::operator*):
+        (WTF::HashTableIterator::operator->):
+        (WTF::HashTableIterator::operator++):
+        (WTF::HashTableIterator::operator==):
+        (WTF::HashTableIterator::operator!=):
+        (WTF::HashTableIterator::operator const_iterator):
+        (WTF::hashTableSwap):
+        (IdentityHashTranslator):
+        (WTF::IdentityHashTranslator::hash):
+        (WTF::IdentityHashTranslator::equal):
+        (WTF::IdentityHashTranslator::translate):
+        (HashTable):
+        (WTF::HashTable::~HashTable):
+        (WTF::HashTable::begin):
+        (WTF::HashTable::end):
+        (WTF::HashTable::size):
+        (WTF::HashTable::capacity):
+        (WTF::HashTable::isEmpty):
+        (WTF::HashTable::add):
+        (WTF::HashTable::find):
+        (WTF::HashTable::contains):
+        (WTF::HashTable::isEmptyBucket):
+        (WTF::HashTable::isDeletedBucket):
+        (WTF::HashTable::isEmptyOrDeletedBucket):
+        (WTF::HashTable::lookup):
+        (WTF::HashTable::checkTableConsistency):
+        (WTF::HashTable::internalCheckTableConsistency):
+        (WTF::HashTable::internalCheckTableConsistencyExceptSize):
+        (WTF::HashTable::lookupForWriting):
+        (WTF::HashTable::shouldExpand):
+        (WTF::HashTable::mustRehashInPlace):
+        (WTF::HashTable::shouldShrink):
+        (WTF::HashTable::shrink):
+        (WTF::HashTable::deleteBucket):
+        (WTF::HashTable::makeLookupResult):
+        (WTF::HashTable::makeIterator):
+        (WTF::HashTable::makeConstIterator):
+        (WTF::HashTable::makeKnownGoodIterator):
+        (WTF::HashTable::makeKnownGoodConstIterator):
+        (WTF::HashTable::checkTableConsistencyExceptSize):
+        (WTF::HashTable::invalidateIterators):
+        (WTF::::HashTable):
+        (WTF::doubleHash):
+        (WTF::::checkKey):
+        (WTF::::lookup):
+        (WTF::::lookupForWriting):
+        (WTF::::fullLookupForWriting):
+        (WTF::::initializeBucket):
+        (WTF::::add):
+        (WTF::::addPassingHashCode):
+        (WTF::::reinsert):
+        (WTF::::find):
+        (WTF::::contains):
+        (WTF::::removeAndInvalidateWithoutEntryConsistencyCheck):
+        (WTF::::removeAndInvalidate):
+        (WTF::::remove):
+        (WTF::::removeWithoutEntryConsistencyCheck):
+        (WTF::::allocateTable):
+        (WTF::::deallocateTable):
+        (WTF::::expand):
+        (WTF::::rehash):
+        (WTF::::clear):
+        (WTF::::swap):
+        (WTF::=):
+        (WTF::::checkTableConsistency):
+        (WTF::::checkTableConsistencyExceptSize):
+        (WTF::::invalidateIterators):
+        (WTF::HashTableConstIteratorAdapter::HashTableConstIteratorAdapter):
+        (HashTableConstIteratorAdapter):
+        (WTF::HashTableConstIteratorAdapter::get):
+        (WTF::HashTableConstIteratorAdapter::operator*):
+        (WTF::HashTableConstIteratorAdapter::operator->):
+        (WTF::HashTableConstIteratorAdapter::operator++):
+        (WTF::HashTableIteratorAdapter::HashTableIteratorAdapter):
+        (HashTableIteratorAdapter):
+        (WTF::HashTableIteratorAdapter::get):
+        (WTF::HashTableIteratorAdapter::operator*):
+        (WTF::HashTableIteratorAdapter::operator->):
+        (WTF::HashTableIteratorAdapter::operator++):
+        (WTF::HashTableIteratorAdapter::operator HashTableConstIteratorAdapter<HashTableType, ValueType>):
+        (WTF::operator==):
+        (WTF::operator!=):
+        * wtf/HashTraits.h: Renamed from Source/JavaScriptCore/wtf/HashTraits.h.
+        (WTF):
+        (GenericHashTraits):
+        (WTF::GenericHashTraits::emptyValue):
+        (WTF::GenericHashTraits::store):
+        (WTF::GenericHashTraits::passOut):
+        (WTF::GenericHashTraits::peek):
+        (FloatHashTraits):
+        (WTF::FloatHashTraits::emptyValue):
+        (WTF::FloatHashTraits::constructDeletedValue):
+        (WTF::FloatHashTraits::isDeletedValue):
+        (UnsignedWithZeroKeyHashTraits):
+        (WTF::UnsignedWithZeroKeyHashTraits::emptyValue):
+        (WTF::UnsignedWithZeroKeyHashTraits::constructDeletedValue):
+        (WTF::UnsignedWithZeroKeyHashTraits::isDeletedValue):
+        (SimpleClassHashTraits):
+        (WTF::SimpleClassHashTraits::constructDeletedValue):
+        (WTF::SimpleClassHashTraits::isDeletedValue):
+        (PairHashTraits):
+        (WTF::PairHashTraits::emptyValue):
+        (WTF::PairHashTraits::constructDeletedValue):
+        (WTF::PairHashTraits::isDeletedValue):
+        * wtf/HexNumber.h: Renamed from Source/JavaScriptCore/wtf/HexNumber.h.
+        (WTF):
+        (Internal):
+        (WTF::Internal::hexDigitsForMode):
+        (WTF::appendByteAsHex):
+        (WTF::placeByteAsHexCompressIfPossible):
+        (WTF::placeByteAsHex):
+        (WTF::appendUnsignedAsHex):
+        (WTF::appendUnsignedAsHexFixedSize):
+        * wtf/InlineASM.h: Renamed from Source/JavaScriptCore/wtf/InlineASM.h.
+        * wtf/Int16Array.h: Renamed from Source/JavaScriptCore/wtf/Int16Array.h.
+        (WTF):
+        (Int16Array):
+        (WTF::Int16Array::set):
+        (WTF::Int16Array::isShortArray):
+        (WTF::Int16Array::create):
+        (WTF::Int16Array::Int16Array):
+        (WTF::Int16Array::subarray):
+        * wtf/Int32Array.h: Renamed from Source/JavaScriptCore/wtf/Int32Array.h.
+        (WTF):
+        (Int32Array):
+        (WTF::Int32Array::set):
+        (WTF::Int32Array::isIntArray):
+        (WTF::Int32Array::create):
+        (WTF::Int32Array::Int32Array):
+        (WTF::Int32Array::subarray):
+        * wtf/Int8Array.h: Renamed from Source/JavaScriptCore/wtf/Int8Array.h.
+        (WTF):
+        (Int8Array):
+        (WTF::Int8Array::set):
+        (WTF::Int8Array::isByteArray):
+        (WTF::Int8Array::create):
+        (WTF::Int8Array::Int8Array):
+        (WTF::Int8Array::subarray):
+        * wtf/IntegralTypedArrayBase.h: Renamed from Source/JavaScriptCore/wtf/IntegralTypedArrayBase.h.
+        (WTF):
+        (IntegralTypedArrayBase):
+        (WTF::IntegralTypedArrayBase::set):
+        (WTF::IntegralTypedArrayBase::item):
+        (WTF::IntegralTypedArrayBase::IntegralTypedArrayBase):
+        * wtf/ListHashSet.h: Renamed from Source/JavaScriptCore/wtf/ListHashSet.h.
+        (WTF):
+        (ListHashSet):
+        (ListHashSetNodeAllocator):
+        (WTF::ListHashSetNodeAllocator::ListHashSetNodeAllocator):
+        (WTF::ListHashSetNodeAllocator::allocate):
+        (WTF::ListHashSetNodeAllocator::deallocate):
+        (WTF::ListHashSetNodeAllocator::pool):
+        (WTF::ListHashSetNodeAllocator::pastPool):
+        (WTF::ListHashSetNodeAllocator::inPool):
+        (ListHashSetNode):
+        (WTF::ListHashSetNode::ListHashSetNode):
+        (WTF::ListHashSetNode::operator new):
+        (WTF::ListHashSetNode::destroy):
+        (WTF::ListHashSetNodeHashFunctions::hash):
+        (WTF::ListHashSetNodeHashFunctions::equal):
+        (ListHashSetNodeHashFunctions):
+        (ListHashSetIterator):
+        (WTF::ListHashSetIterator::ListHashSetIterator):
+        (WTF::ListHashSetIterator::get):
+        (WTF::ListHashSetIterator::operator*):
+        (WTF::ListHashSetIterator::operator->):
+        (WTF::ListHashSetIterator::operator++):
+        (WTF::ListHashSetIterator::operator--):
+        (WTF::ListHashSetIterator::operator==):
+        (WTF::ListHashSetIterator::operator!=):
+        (WTF::ListHashSetIterator::operator const_iterator):
+        (WTF::ListHashSetIterator::node):
+        (ListHashSetConstIterator):
+        (WTF::ListHashSetConstIterator::ListHashSetConstIterator):
+        (WTF::ListHashSetConstIterator::get):
+        (WTF::ListHashSetConstIterator::operator*):
+        (WTF::ListHashSetConstIterator::operator->):
+        (WTF::ListHashSetConstIterator::operator++):
+        (WTF::ListHashSetConstIterator::operator--):
+        (WTF::ListHashSetConstIterator::operator==):
+        (WTF::ListHashSetConstIterator::operator!=):
+        (WTF::ListHashSetConstIterator::node):
+        (ListHashSetReverseIterator):
+        (WTF::ListHashSetReverseIterator::ListHashSetReverseIterator):
+        (WTF::ListHashSetReverseIterator::get):
+        (WTF::ListHashSetReverseIterator::operator*):
+        (WTF::ListHashSetReverseIterator::operator->):
+        (WTF::ListHashSetReverseIterator::operator++):
+        (WTF::ListHashSetReverseIterator::operator--):
+        (WTF::ListHashSetReverseIterator::operator==):
+        (WTF::ListHashSetReverseIterator::operator!=):
+        (WTF::ListHashSetReverseIterator::operator const_reverse_iterator):
+        (WTF::ListHashSetReverseIterator::node):
+        (ListHashSetConstReverseIterator):
+        (WTF::ListHashSetConstReverseIterator::ListHashSetConstReverseIterator):
+        (WTF::ListHashSetConstReverseIterator::get):
+        (WTF::ListHashSetConstReverseIterator::operator*):
+        (WTF::ListHashSetConstReverseIterator::operator->):
+        (WTF::ListHashSetConstReverseIterator::operator++):
+        (WTF::ListHashSetConstReverseIterator::operator--):
+        (WTF::ListHashSetConstReverseIterator::operator==):
+        (WTF::ListHashSetConstReverseIterator::operator!=):
+        (WTF::ListHashSetConstReverseIterator::node):
+        (WTF::ListHashSetTranslator::hash):
+        (WTF::ListHashSetTranslator::equal):
+        (WTF::ListHashSetTranslator::translate):
+        (WTF::::ListHashSet):
+        (WTF::=):
+        (WTF::::swap):
+        (WTF::::~ListHashSet):
+        (WTF::::size):
+        (WTF::::capacity):
+        (WTF::::isEmpty):
+        (WTF::::begin):
+        (WTF::::end):
+        (WTF::::rbegin):
+        (WTF::::rend):
+        (WTF::::first):
+        (WTF::::last):
+        (WTF::::removeLast):
+        (WTF::::find):
+        (WTF::ListHashSetTranslatorAdapter::hash):
+        (WTF::ListHashSetTranslatorAdapter::equal):
+        (WTF::::contains):
+        (WTF::::add):
+        (WTF::::insertBefore):
+        (WTF::::remove):
+        (WTF::::clear):
+        (WTF::::unlinkAndDelete):
+        (WTF::::appendNode):
+        (WTF::::insertNodeBefore):
+        (WTF::::deleteAllNodes):
+        (WTF::::makeReverseIterator):
+        (WTF::::makeConstReverseIterator):
+        (WTF::::makeIterator):
+        (WTF::::makeConstIterator):
+        (WTF::deleteAllValues):
+        * wtf/ListRefPtr.h: Renamed from Source/JavaScriptCore/wtf/ListRefPtr.h.
+        (WTF):
+        (ListRefPtr):
+        (WTF::ListRefPtr::ListRefPtr):
+        (WTF::ListRefPtr::~ListRefPtr):
+        (WTF::ListRefPtr::operator=):
+        (WTF::getPtr):
+        * wtf/Locker.h: Renamed from Source/JavaScriptCore/wtf/Locker.h.
+        (WTF):
+        (Locker):
+        (WTF::Locker::Locker):
+        (WTF::Locker::~Locker):
+        * wtf/MD5.cpp: Renamed from Source/JavaScriptCore/wtf/MD5.cpp.
+        (WTF):
+        (WTF::testMD5):
+        (WTF::expectMD5):
+        (WTF::reverseBytes):
+        (WTF::MD5Transform):
+        (WTF::MD5::MD5):
+        (WTF::MD5::addBytes):
+        (WTF::MD5::checksum):
+        * wtf/MD5.h: Renamed from Source/JavaScriptCore/wtf/MD5.h.
+        (WTF):
+        (MD5):
+        (WTF::MD5::addBytes):
+        * wtf/MainThread.cpp: Renamed from Source/JavaScriptCore/wtf/MainThread.cpp.
+        (WTF):
+        (FunctionWithContext):
+        (WTF::FunctionWithContext::FunctionWithContext):
+        (WTF::FunctionWithContext::operator == ):
+        (FunctionWithContextFinder):
+        (WTF::FunctionWithContextFinder::FunctionWithContextFinder):
+        (WTF::FunctionWithContextFinder::operator()):
+        (WTF::mainThreadFunctionQueueMutex):
+        (WTF::functionQueue):
+        (WTF::initializeMainThread):
+        (WTF::initializeMainThreadOnce):
+        (WTF::initializeMainThreadToProcessMainThreadOnce):
+        (WTF::initializeMainThreadToProcessMainThread):
+        (WTF::dispatchFunctionsFromMainThread):
+        (WTF::callOnMainThread):
+        (WTF::callOnMainThreadAndWait):
+        (WTF::cancelCallOnMainThread):
+        (WTF::callFunctionObject):
+        (WTF::setMainThreadCallbacksPaused):
+        (WTF::isMainThread):
+        (WTF::initializeGCThreads):
+        (WTF::registerGCThread):
+        (WTF::isMainThreadOrGCThread):
+        * wtf/MainThread.h: Renamed from Source/JavaScriptCore/wtf/MainThread.h.
+        (WTF):
+        (WTF::isMainThreadOrGCThread):
+        * wtf/MallocZoneSupport.h: Renamed from Source/JavaScriptCore/wtf/MallocZoneSupport.h.
+        (WTF):
+        (RemoteMemoryReader):
+        (WTF::RemoteMemoryReader::RemoteMemoryReader):
+        (WTF::RemoteMemoryReader::operator()):
+        (WTF::RemoteMemoryReader::nextEntryInLinkedList):
+        * wtf/MathExtras.h: Renamed from Source/JavaScriptCore/wtf/MathExtras.h.
+        (wtf_ceil):
+        (isfinite):
+        (isinf):
+        (signbit):
+        (round):
+        (roundf):
+        (llround):
+        (llroundf):
+        (lround):
+        (lroundf):
+        (trunc):
+        (abs):
+        (isnan):
+        (nextafter):
+        (nextafterf):
+        (copysign):
+        (log2):
+        (log2f):
+        (wtf_atan2):
+        (wtf_fmod):
+        (wtf_pow):
+        (deg2rad):
+        (rad2deg):
+        (deg2grad):
+        (grad2deg):
+        (turn2deg):
+        (deg2turn):
+        (rad2grad):
+        (grad2rad):
+        (defaultMinimumForClamp):
+        (defaultMaximumForClamp):
+        (clampTo):
+        (clampToInteger):
+        (clampToFloat):
+        (clampToPositiveInteger):
+        (isWithinIntRange):
+        (decomposeDouble):
+        (doubleToInteger):
+        * wtf/MessageQueue.h: Renamed from Source/JavaScriptCore/wtf/MessageQueue.h.
+        (WTF):
+        (MessageQueue):
+        (WTF::MessageQueue::MessageQueue):
+        (WTF::MessageQueue::infiniteTime):
+        (WTF::MessageQueue::alwaysTruePredicate):
+        (WTF::::~MessageQueue):
+        (WTF::::append):
+        (WTF::::appendAndCheckEmpty):
+        (WTF::::prepend):
+        (WTF::::waitForMessage):
+        (WTF::::waitForMessageFilteredWithTimeout):
+        (WTF::::tryGetMessage):
+        (WTF::::tryGetMessageIgnoringKilled):
+        (WTF::::removeIf):
+        (WTF::::isEmpty):
+        (WTF::::kill):
+        (WTF::::killed):
+        * wtf/MetaAllocator.cpp: Renamed from Source/JavaScriptCore/wtf/MetaAllocator.cpp.
+        (WTF):
+        (WTF::MetaAllocator::~MetaAllocator):
+        (WTF::MetaAllocatorTracker::notify):
+        (WTF::MetaAllocatorTracker::release):
+        (WTF::MetaAllocator::release):
+        (WTF::MetaAllocatorHandle::MetaAllocatorHandle):
+        (WTF::MetaAllocatorHandle::~MetaAllocatorHandle):
+        (WTF::MetaAllocatorHandle::shrink):
+        (WTF::MetaAllocator::MetaAllocator):
+        (WTF::MetaAllocator::allocate):
+        (WTF::MetaAllocator::currentStatistics):
+        (WTF::MetaAllocator::findAndRemoveFreeSpace):
+        (WTF::MetaAllocator::addFreeSpaceFromReleasedHandle):
+        (WTF::MetaAllocator::addFreshFreeSpace):
+        (WTF::MetaAllocator::debugFreeSpaceSize):
+        (WTF::MetaAllocator::addFreeSpace):
+        (WTF::MetaAllocator::incrementPageOccupancy):
+        (WTF::MetaAllocator::decrementPageOccupancy):
+        (WTF::MetaAllocator::roundUp):
+        (WTF::MetaAllocator::allocFreeSpaceNode):
+        (WTF::MetaAllocator::freeFreeSpaceNode):
+        (WTF::MetaAllocator::dumpProfile):
+        * wtf/MetaAllocator.h: Renamed from Source/JavaScriptCore/wtf/MetaAllocator.h.
+        (WTF):
+        (MetaAllocatorTracker):
+        (WTF::MetaAllocatorTracker::find):
+        (MetaAllocator):
+        (WTF::MetaAllocator::trackAllocations):
+        (WTF::MetaAllocator::bytesAllocated):
+        (WTF::MetaAllocator::bytesReserved):
+        (WTF::MetaAllocator::bytesCommitted):
+        (Statistics):
+        (WTF::MetaAllocator::dumpProfile):
+        (FreeSpaceNode):
+        (WTF::MetaAllocator::FreeSpaceNode::FreeSpaceNode):
+        (WTF::MetaAllocator::FreeSpaceNode::key):
+        * wtf/MetaAllocatorHandle.h: Renamed from Source/JavaScriptCore/wtf/MetaAllocatorHandle.h.
+        (WTF):
+        (MetaAllocatorHandle):
+        (WTF::MetaAllocatorHandle::start):
+        (WTF::MetaAllocatorHandle::end):
+        (WTF::MetaAllocatorHandle::sizeInBytes):
+        (WTF::MetaAllocatorHandle::isManaged):
+        (WTF::MetaAllocatorHandle::allocator):
+        (WTF::MetaAllocatorHandle::ownerUID):
+        (WTF::MetaAllocatorHandle::key):
+        * wtf/NonCopyingSort.h: Renamed from Source/JavaScriptCore/wtf/NonCopyingSort.h.
+        (WTF):
+        (WTF::siftDown):
+        (WTF::heapify):
+        (WTF::heapSort):
+        (WTF::nonCopyingSort):
+        * wtf/Noncopyable.h: Renamed from Source/JavaScriptCore/wtf/Noncopyable.h.
+        * wtf/NotFound.h: Renamed from Source/JavaScriptCore/wtf/NotFound.h.
+        (WTF):
+        * wtf/NullPtr.cpp: Renamed from Source/JavaScriptCore/wtf/NullPtr.cpp.
+        * wtf/NullPtr.h: Renamed from Source/JavaScriptCore/wtf/NullPtr.h.
+        * wtf/NumberOfCores.cpp: Renamed from Source/JavaScriptCore/wtf/NumberOfCores.cpp.
+        (WTF):
+        (WTF::numberOfProcessorCores):
+        * wtf/NumberOfCores.h: Renamed from Source/JavaScriptCore/wtf/NumberOfCores.h.
+        (WTF):
+        * wtf/OSAllocator.h: Renamed from Source/JavaScriptCore/wtf/OSAllocator.h.
+        (WTF):
+        (OSAllocator):
+        (WTF::OSAllocator::reserveAndCommit):
+        (WTF::OSAllocator::decommitAndRelease):
+        (WTF::OSAllocator::reallocateCommitted):
+        * wtf/OSAllocatorPosix.cpp: Renamed from Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp.
+        (WTF):
+        (WTF::OSAllocator::reserveUncommitted):
+        (WTF::OSAllocator::reserveAndCommit):
+        (WTF::OSAllocator::commit):
+        (WTF::OSAllocator::decommit):
+        (WTF::OSAllocator::releaseDecommitted):
+        * wtf/OSAllocatorWin.cpp: Renamed from Source/JavaScriptCore/wtf/OSAllocatorWin.cpp.
+        (WTF):
+        (WTF::protection):
+        (WTF::OSAllocator::reserveUncommitted):
+        (WTF::OSAllocator::reserveAndCommit):
+        (WTF::OSAllocator::commit):
+        (WTF::OSAllocator::decommit):
+        (WTF::OSAllocator::releaseDecommitted):
+        * wtf/OSRandomSource.cpp: Renamed from Source/JavaScriptCore/wtf/OSRandomSource.cpp.
+        (WTF):
+        (WTF::cryptographicallyRandomValuesFromOS):
+        * wtf/OSRandomSource.h: Renamed from Source/JavaScriptCore/wtf/OSRandomSource.h.
+        (WTF):
+        * wtf/OwnArrayPtr.h: Renamed from Source/JavaScriptCore/wtf/OwnArrayPtr.h.
+        (WTF):
+        (OwnArrayPtr):
+        (WTF::OwnArrayPtr::OwnArrayPtr):
+        (WTF::OwnArrayPtr::~OwnArrayPtr):
+        (WTF::OwnArrayPtr::get):
+        (WTF::OwnArrayPtr::operator*):
+        (WTF::OwnArrayPtr::operator->):
+        (WTF::OwnArrayPtr::operator[]):
+        (WTF::OwnArrayPtr::operator!):
+        (WTF::OwnArrayPtr::operator UnspecifiedBoolType):
+        (WTF::OwnArrayPtr::operator=):
+        (WTF::OwnArrayPtr::swap):
+        (WTF::::OwnArrayPtr):
+        (WTF::::clear):
+        (WTF::::release):
+        (WTF::::leakPtr):
+        (WTF::=):
+        (WTF::swap):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::getPtr):
+        * wtf/OwnPtr.h: Renamed from Source/JavaScriptCore/wtf/OwnPtr.h.
+        (WTF):
+        (OwnPtr):
+        (WTF::OwnPtr::OwnPtr):
+        (WTF::OwnPtr::~OwnPtr):
+        (WTF::OwnPtr::get):
+        (WTF::OwnPtr::operator*):
+        (WTF::OwnPtr::operator->):
+        (WTF::OwnPtr::operator!):
+        (WTF::OwnPtr::operator UnspecifiedBoolType):
+        (WTF::OwnPtr::operator=):
+        (WTF::OwnPtr::swap):
+        (WTF::OwnPtr::operator==):
+        (WTF::OwnPtr::operator!=):
+        (WTF::::OwnPtr):
+        (WTF::::clear):
+        (WTF::::release):
+        (WTF::::leakPtr):
+        (WTF::=):
+        (WTF::swap):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::getPtr):
+        * wtf/OwnPtrCommon.h: Renamed from Source/JavaScriptCore/wtf/OwnPtrCommon.h.
+        (WTF):
+        (WTF::deleteOwnedPtr):
+        * wtf/PackedIntVector.h: Renamed from Source/JavaScriptCore/wtf/PackedIntVector.h.
+        (WTF):
+        (PackedIntVector):
+        (WTF::PackedIntVector::PackedIntVector):
+        (WTF::PackedIntVector::operator=):
+        (WTF::PackedIntVector::size):
+        (WTF::PackedIntVector::ensureSize):
+        (WTF::PackedIntVector::resize):
+        (WTF::PackedIntVector::clearAll):
+        (WTF::PackedIntVector::get):
+        (WTF::PackedIntVector::set):
+        (WTF::PackedIntVector::mask):
+        * wtf/PageAllocation.h: Renamed from Source/JavaScriptCore/wtf/PageAllocation.h.
+        (WTF):
+        (PageAllocation):
+        (WTF::PageAllocation::PageAllocation):
+        (WTF::PageAllocation::operator bool):
+        (WTF::PageAllocation::allocate):
+        (WTF::PageAllocation::deallocate):
+        * wtf/PageAllocationAligned.cpp: Renamed from Source/JavaScriptCore/wtf/PageAllocationAligned.cpp.
+        (WTF):
+        (WTF::PageAllocationAligned::allocate):
+        (WTF::PageAllocationAligned::deallocate):
+        * wtf/PageAllocationAligned.h: Renamed from Source/JavaScriptCore/wtf/PageAllocationAligned.h.
+        (WTF):
+        (PageAllocationAligned):
+        (WTF::PageAllocationAligned::PageAllocationAligned):
+        * wtf/PageBlock.cpp: Renamed from Source/JavaScriptCore/wtf/PageBlock.cpp.
+        (WTF):
+        (WTF::systemPageSize):
+        (WTF::pageSize):
+        (WTF::pageMask):
+        * wtf/PageBlock.h: Renamed from Source/JavaScriptCore/wtf/PageBlock.h.
+        (WTF):
+        (WTF::isPageAligned):
+        (WTF::isPowerOfTwo):
+        (PageBlock):
+        (WTF::PageBlock::base):
+        (WTF::PageBlock::size):
+        (WTF::PageBlock::operator bool):
+        (WTF::PageBlock::contains):
+        (WTF::PageBlock::PageBlock):
+        * wtf/PageReservation.h: Renamed from Source/JavaScriptCore/wtf/PageReservation.h.
+        (WTF):
+        (PageReservation):
+        (WTF::PageReservation::PageReservation):
+        (WTF::PageReservation::operator bool):
+        (WTF::PageReservation::commit):
+        (WTF::PageReservation::decommit):
+        (WTF::PageReservation::committed):
+        (WTF::PageReservation::reserve):
+        (WTF::PageReservation::reserveWithGuardPages):
+        (WTF::PageReservation::deallocate):
+        * wtf/ParallelJobs.h: Renamed from Source/JavaScriptCore/wtf/ParallelJobs.h.
+        (WTF):
+        (ParallelJobs):
+        (WTF::ParallelJobs::ParallelJobs):
+        (WTF::ParallelJobs::numberOfJobs):
+        (WTF::ParallelJobs::parameter):
+        (WTF::ParallelJobs::execute):
+        * wtf/ParallelJobsGeneric.cpp: Renamed from Source/JavaScriptCore/wtf/ParallelJobsGeneric.cpp.
+        (WTF):
+        (WTF::ParallelEnvironment::ParallelEnvironment):
+        (WTF::ParallelEnvironment::execute):
+        (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
+        (WTF::ParallelEnvironment::ThreadPrivate::execute):
+        (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish):
+        (WTF::ParallelEnvironment::ThreadPrivate::workerThread):
+        * wtf/ParallelJobsGeneric.h: Renamed from Source/JavaScriptCore/wtf/ParallelJobsGeneric.h.
+        (WTF):
+        (ParallelEnvironment):
+        (WTF::ParallelEnvironment::numberOfJobs):
+        (ThreadPrivate):
+        (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate):
+        (WTF::ParallelEnvironment::ThreadPrivate::create):
+        * wtf/ParallelJobsLibdispatch.h: Renamed from Source/JavaScriptCore/wtf/ParallelJobsLibdispatch.h.
+        (WTF):
+        (ParallelEnvironment):
+        (WTF::ParallelEnvironment::ParallelEnvironment):
+        (WTF::ParallelEnvironment::numberOfJobs):
+        (WTF::ParallelEnvironment::execute):
+        * wtf/ParallelJobsOpenMP.h: Renamed from Source/JavaScriptCore/wtf/ParallelJobsOpenMP.h.
+        (WTF):
+        (ParallelEnvironment):
+        (WTF::ParallelEnvironment::ParallelEnvironment):
+        (WTF::ParallelEnvironment::numberOfJobs):
+        (WTF::ParallelEnvironment::execute):
+        * wtf/PassOwnArrayPtr.h: Renamed from Source/JavaScriptCore/wtf/PassOwnArrayPtr.h.
+        (WTF):
+        (PassOwnArrayPtr):
+        (WTF::PassOwnArrayPtr::PassOwnArrayPtr):
+        (WTF::PassOwnArrayPtr::~PassOwnArrayPtr):
+        (WTF::PassOwnArrayPtr::get):
+        (WTF::PassOwnArrayPtr::operator*):
+        (WTF::PassOwnArrayPtr::operator->):
+        (WTF::PassOwnArrayPtr::operator!):
+        (WTF::PassOwnArrayPtr::operator UnspecifiedBoolType):
+        (WTF::PassOwnArrayPtr::operator=):
+        (WTF::::leakPtr):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::adoptArrayPtr):
+        (WTF::deleteOwnedArrayPtr):
+        (WTF::static_pointer_cast):
+        (WTF::const_pointer_cast):
+        (WTF::getPtr):
+        * wtf/PassOwnPtr.h: Renamed from Source/JavaScriptCore/wtf/PassOwnPtr.h.
+        (WTF):
+        (PassOwnPtr):
+        (WTF::PassOwnPtr::PassOwnPtr):
+        (WTF::PassOwnPtr::~PassOwnPtr):
+        (WTF::PassOwnPtr::get):
+        (WTF::PassOwnPtr::operator*):
+        (WTF::PassOwnPtr::operator->):
+        (WTF::PassOwnPtr::operator!):
+        (WTF::PassOwnPtr::operator UnspecifiedBoolType):
+        (WTF::PassOwnPtr::operator=):
+        (WTF::PassOwnPtr::operator==):
+        (WTF::PassOwnPtr::operator!=):
+        (WTF::::leakPtr):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::adoptPtr):
+        (WTF::static_pointer_cast):
+        (WTF::const_pointer_cast):
+        (WTF::getPtr):
+        * wtf/PassRefPtr.h: Renamed from Source/JavaScriptCore/wtf/PassRefPtr.h.
+        (WTF):
+        (WTF::adopted):
+        (WTF::refIfNotNull):
+        (WTF::derefIfNotNull):
+        (PassRefPtr):
+        (WTF::PassRefPtr::PassRefPtr):
+        (WTF::PassRefPtr::~PassRefPtr):
+        (WTF::PassRefPtr::get):
+        (WTF::PassRefPtr::operator*):
+        (WTF::PassRefPtr::operator->):
+        (WTF::PassRefPtr::operator!):
+        (WTF::PassRefPtr::operator UnspecifiedBoolType):
+        (WTF::PassRefPtr::operator=):
+        (NonNullPassRefPtr):
+        (WTF::NonNullPassRefPtr::NonNullPassRefPtr):
+        (WTF::NonNullPassRefPtr::~NonNullPassRefPtr):
+        (WTF::NonNullPassRefPtr::get):
+        (WTF::NonNullPassRefPtr::operator*):
+        (WTF::NonNullPassRefPtr::operator->):
+        (WTF::NonNullPassRefPtr::operator=):
+        (WTF::::PassRefPtr):
+        (WTF::::leakRef):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::adoptRef):
+        (WTF::static_pointer_cast):
+        (WTF::const_pointer_cast):
+        (WTF::getPtr):
+        * wtf/PassTraits.h: Renamed from Source/JavaScriptCore/wtf/PassTraits.h.
+        (WTF):
+        (PassTraits):
+        (WTF::PassTraits::transfer):
+        * wtf/PlatformBlackBerry.cmake: Renamed from Source/JavaScriptCore/wtf/PlatformBlackBerry.cmake.
+        * wtf/PlatformEfl.cmake: Renamed from Source/JavaScriptCore/wtf/PlatformEfl.cmake.
+        * wtf/PlatformWinCE.cmake: Renamed from Source/JavaScriptCore/wtf/PlatformWinCE.cmake.
+        * wtf/PossiblyNull.h: Renamed from Source/JavaScriptCore/wtf/PossiblyNull.h.
+        (WTF):
+        (WTF::PossiblyNull::PossiblyNull):
+        (WTF::PossiblyNull::~PossiblyNull):
+        (PossiblyNull):
+        (WTF::::getValue):
+        * wtf/RandomNumber.cpp: Renamed from Source/JavaScriptCore/wtf/RandomNumber.cpp.
+        (WTF):
+        (WTF::randomNumber):
+        * wtf/RandomNumber.h: Renamed from Source/JavaScriptCore/wtf/RandomNumber.h.
+        (WTF):
+        * wtf/RandomNumberSeed.h: Renamed from Source/JavaScriptCore/wtf/RandomNumberSeed.h.
+        (WTF):
+        (WTF::initializeRandomNumberGenerator):
+        * wtf/RedBlackTree.h: Renamed from Source/JavaScriptCore/wtf/RedBlackTree.h.
+        (WTF):
+        (RedBlackTree):
+        (Node):
+        (WTF::RedBlackTree::Node::successor):
+        (WTF::RedBlackTree::Node::predecessor):
+        (WTF::RedBlackTree::Node::reset):
+        (WTF::RedBlackTree::Node::parent):
+        (WTF::RedBlackTree::Node::setParent):
+        (WTF::RedBlackTree::Node::left):
+        (WTF::RedBlackTree::Node::setLeft):
+        (WTF::RedBlackTree::Node::right):
+        (WTF::RedBlackTree::Node::setRight):
+        (WTF::RedBlackTree::Node::color):
+        (WTF::RedBlackTree::Node::setColor):
+        (WTF::RedBlackTree::RedBlackTree):
+        (WTF::RedBlackTree::insert):
+        (WTF::RedBlackTree::remove):
+        (WTF::RedBlackTree::findExact):
+        (WTF::RedBlackTree::findLeastGreaterThanOrEqual):
+        (WTF::RedBlackTree::findGreatestLessThanOrEqual):
+        (WTF::RedBlackTree::first):
+        (WTF::RedBlackTree::last):
+        (WTF::RedBlackTree::size):
+        (WTF::RedBlackTree::isEmpty):
+        (WTF::RedBlackTree::treeMinimum):
+        (WTF::RedBlackTree::treeMaximum):
+        (WTF::RedBlackTree::treeInsert):
+        (WTF::RedBlackTree::leftRotate):
+        (WTF::RedBlackTree::rightRotate):
+        (WTF::RedBlackTree::removeFixup):
+        * wtf/RefCounted.h: Renamed from Source/JavaScriptCore/wtf/RefCounted.h.
+        (WTF):
+        (RefCountedBase):
+        (WTF::RefCountedBase::ref):
+        (WTF::RefCountedBase::hasOneRef):
+        (WTF::RefCountedBase::refCount):
+        (WTF::RefCountedBase::turnOffVerifier):
+        (WTF::RefCountedBase::relaxAdoptionRequirement):
+        (WTF::RefCountedBase::addressOfCount):
+        (WTF::RefCountedBase::RefCountedBase):
+        (WTF::RefCountedBase::~RefCountedBase):
+        (WTF::RefCountedBase::derefBase):
+        (WTF::RefCountedBase::deletionHasBegun):
+        (WTF::adopted):
+        (RefCounted):
+        (WTF::RefCounted::deref):
+        (WTF::RefCounted::RefCounted):
+        (WTF::RefCounted::~RefCounted):
+        (RefCountedCustomAllocated):
+        (WTF::RefCountedCustomAllocated::deref):
+        (WTF::RefCountedCustomAllocated::~RefCountedCustomAllocated):
+        (WTF::RefCountedBase::setMutexForVerifier):
+        (WTF::RefCountedBase::setDispatchQueueForVerifier):
+        * wtf/RefCountedArray.h: Renamed from Source/JavaScriptCore/wtf/RefCountedArray.h.
+        (WTF):
+        (RefCountedArray):
+        (WTF::RefCountedArray::RefCountedArray):
+        (WTF::RefCountedArray::operator=):
+        (WTF::RefCountedArray::~RefCountedArray):
+        (WTF::RefCountedArray::size):
+        (WTF::RefCountedArray::data):
+        (WTF::RefCountedArray::begin):
+        (WTF::RefCountedArray::end):
+        (WTF::RefCountedArray::at):
+        (WTF::RefCountedArray::operator[]):
+        (Header):
+        (WTF::RefCountedArray::Header::size):
+        (WTF::RefCountedArray::Header::payload):
+        (WTF::RefCountedArray::Header::fromPayload):
+        * wtf/RefCountedLeakCounter.cpp: Renamed from Source/JavaScriptCore/wtf/RefCountedLeakCounter.cpp.
+        (WTF):
+        (WTF::RefCountedLeakCounter::suppressMessages):
+        (WTF::RefCountedLeakCounter::cancelMessageSuppression):
+        (WTF::RefCountedLeakCounter::RefCountedLeakCounter):
+        (WTF::RefCountedLeakCounter::~RefCountedLeakCounter):
+        (WTF::RefCountedLeakCounter::increment):
+        (WTF::RefCountedLeakCounter::decrement):
+        * wtf/RefCountedLeakCounter.h: Renamed from Source/JavaScriptCore/wtf/RefCountedLeakCounter.h.
+        (WTF):
+        (RefCountedLeakCounter):
+        * wtf/RefPtr.h: Renamed from Source/JavaScriptCore/wtf/RefPtr.h.
+        (WTF):
+        (RefPtr):
+        (WTF::RefPtr::RefPtr):
+        (WTF::RefPtr::isHashTableDeletedValue):
+        (WTF::RefPtr::~RefPtr):
+        (WTF::RefPtr::get):
+        (WTF::RefPtr::release):
+        (WTF::RefPtr::operator*):
+        (WTF::RefPtr::operator->):
+        (WTF::RefPtr::operator!):
+        (WTF::RefPtr::operator UnspecifiedBoolType):
+        (WTF::RefPtr::operator=):
+        (WTF::RefPtr::hashTableDeletedValue):
+        (WTF::::RefPtr):
+        (WTF::::clear):
+        (WTF::=):
+        (WTF::::swap):
+        (WTF::swap):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::static_pointer_cast):
+        (WTF::const_pointer_cast):
+        (WTF::getPtr):
+        * wtf/RefPtrHashMap.h: Renamed from Source/JavaScriptCore/wtf/RefPtrHashMap.h.
+        (WTF):
+        (WTF::::swap):
+        (WTF::::size):
+        (WTF::::capacity):
+        (WTF::::isEmpty):
+        (WTF::::begin):
+        (WTF::::end):
+        (WTF::::find):
+        (WTF::::contains):
+        (WTF::::inlineAdd):
+        (WTF::::set):
+        (WTF::::add):
+        (WTF::::get):
+        (WTF::::inlineGet):
+        (WTF::::remove):
+        (WTF::::clear):
+        (WTF::::take):
+        * wtf/RetainPtr.h: Renamed from Source/JavaScriptCore/wtf/RetainPtr.h.
+        (WTF):
+        (WTF::adoptNSReference):
+        (RetainPtr):
+        (WTF::RetainPtr::RetainPtr):
+        (WTF::RetainPtr::isHashTableDeletedValue):
+        (WTF::RetainPtr::~RetainPtr):
+        (WTF::RetainPtr::get):
+        (WTF::RetainPtr::operator->):
+        (WTF::RetainPtr::operator!):
+        (WTF::RetainPtr::operator UnspecifiedBoolType):
+        (WTF::RetainPtr::operator=):
+        (WTF::RetainPtr::hashTableDeletedValue):
+        (WTF::::RetainPtr):
+        (WTF::::clear):
+        (WTF::::leakRef):
+        (WTF::=):
+        (WTF::::adoptCF):
+        (WTF::::adoptNS):
+        (WTF::::swap):
+        (WTF::swap):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::adoptCF):
+        (WTF::adoptNS):
+        (WTF::retainPtr):
+        * wtf/SHA1.cpp: Renamed from Source/JavaScriptCore/wtf/SHA1.cpp.
+        (WTF):
+        (WTF::testSHA1):
+        (WTF::expectSHA1):
+        (WTF::f):
+        (WTF::k):
+        (WTF::rotateLeft):
+        (WTF::SHA1::SHA1):
+        (WTF::SHA1::addBytes):
+        (WTF::SHA1::computeHash):
+        (WTF::SHA1::finalize):
+        (WTF::SHA1::processBlock):
+        (WTF::SHA1::reset):
+        * wtf/SHA1.h: Renamed from Source/JavaScriptCore/wtf/SHA1.h.
+        (WTF):
+        (SHA1):
+        (WTF::SHA1::addBytes):
+        * wtf/SegmentedVector.h: Renamed from Source/JavaScriptCore/wtf/SegmentedVector.h.
+        (WTF):
+        (SegmentedVectorIterator):
+        (WTF::SegmentedVectorIterator::~SegmentedVectorIterator):
+        (WTF::SegmentedVectorIterator::operator*):
+        (WTF::SegmentedVectorIterator::operator->):
+        (WTF::SegmentedVectorIterator::operator++):
+        (WTF::SegmentedVectorIterator::operator==):
+        (WTF::SegmentedVectorIterator::operator!=):
+        (WTF::SegmentedVectorIterator::operator=):
+        (WTF::SegmentedVectorIterator::SegmentedVectorIterator):
+        (SegmentedVector):
+        (WTF::SegmentedVector::SegmentedVector):
+        (WTF::SegmentedVector::~SegmentedVector):
+        (WTF::SegmentedVector::size):
+        (WTF::SegmentedVector::isEmpty):
+        (WTF::SegmentedVector::at):
+        (WTF::SegmentedVector::operator[]):
+        (WTF::SegmentedVector::last):
+        (WTF::SegmentedVector::append):
+        (WTF::SegmentedVector::alloc):
+        (WTF::SegmentedVector::removeLast):
+        (WTF::SegmentedVector::grow):
+        (WTF::SegmentedVector::clear):
+        (WTF::SegmentedVector::begin):
+        (WTF::SegmentedVector::end):
+        (WTF::SegmentedVector::deleteAllSegments):
+        (WTF::SegmentedVector::segmentExistsFor):
+        (WTF::SegmentedVector::segmentFor):
+        (WTF::SegmentedVector::subscriptFor):
+        (WTF::SegmentedVector::ensureSegmentsFor):
+        (WTF::SegmentedVector::ensureSegment):
+        * wtf/SentinelLinkedList.h: Renamed from Source/JavaScriptCore/wtf/SentinelLinkedList.h.
+        (WTF):
+        (BasicRawSentinelNode):
+        (WTF::BasicRawSentinelNode::BasicRawSentinelNode):
+        (WTF::BasicRawSentinelNode::setPrev):
+        (WTF::BasicRawSentinelNode::setNext):
+        (WTF::BasicRawSentinelNode::prev):
+        (WTF::BasicRawSentinelNode::next):
+        (WTF::BasicRawSentinelNode::isOnList):
+        (SentinelLinkedList):
+        (WTF::SentinelLinkedList::isEmpty):
+        (WTF::::remove):
+        (WTF::::SentinelLinkedList):
+        (WTF::::begin):
+        (WTF::::end):
+        (WTF::::push):
+        * wtf/SimpleStats.h: Renamed from Source/JavaScriptCore/wtf/SimpleStats.h.
+        (WTF):
+        (SimpleStats):
+        (WTF::SimpleStats::SimpleStats):
+        (WTF::SimpleStats::add):
+        (WTF::SimpleStats::operator!):
+        (WTF::SimpleStats::count):
+        (WTF::SimpleStats::sum):
+        (WTF::SimpleStats::sumOfSquares):
+        (WTF::SimpleStats::mean):
+        (WTF::SimpleStats::variance):
+        (WTF::SimpleStats::standardDeviation):
+        * wtf/SinglyLinkedList.h: Renamed from Source/JavaScriptCore/wtf/SinglyLinkedList.h.
+        (WTF):
+        (SinglyLinkedList):
+        (WTF::::SinglyLinkedList):
+        (WTF::::isEmpty):
+        (WTF::::push):
+        (WTF::::pop):
+        * wtf/SizeLimits.cpp: Renamed from Source/JavaScriptCore/wtf/SizeLimits.cpp.
+        (WTF):
+        (SameSizeAsRefCounted):
+        * wtf/Spectrum.h: Renamed from Source/JavaScriptCore/wtf/Spectrum.h.
+        (WTF):
+        (Spectrum):
+        (WTF::Spectrum::Spectrum):
+        (WTF::Spectrum::add):
+        (WTF::Spectrum::get):
+        (WTF::Spectrum::begin):
+        (WTF::Spectrum::end):
+        (WTF::Spectrum::KeyAndCount::KeyAndCount):
+        (KeyAndCount):
+        (WTF::Spectrum::KeyAndCount::operator<):
+        (WTF::Spectrum::buildList):
+        * wtf/StackBounds.cpp: Renamed from Source/JavaScriptCore/wtf/StackBounds.cpp.
+        (WTF):
+        (WTF::estimateStackBound):
+        (WTF::StackBounds::initialize):
+        (WTF::detectGrowingDownward):
+        (WTF::isPageWritable):
+        (WTF::getLowerStackBound):
+        (WTF::getUpperStackBound):
+        * wtf/StackBounds.h: Renamed from Source/JavaScriptCore/wtf/StackBounds.h.
+        (WTF):
+        (StackBounds):
+        (WTF::StackBounds::StackBounds):
+        (WTF::StackBounds::currentThreadStackBounds):
+        (WTF::StackBounds::origin):
+        (WTF::StackBounds::current):
+        (WTF::StackBounds::recursionLimit):
+        (WTF::StackBounds::recursionCheck):
+        (WTF::StackBounds::isGrowingDownward):
+        (WTF::StackBounds::checkConsistency):
+        * wtf/StaticConstructors.h: Renamed from Source/JavaScriptCore/wtf/StaticConstructors.h.
+        * wtf/StdLibExtras.h: Renamed from Source/JavaScriptCore/wtf/StdLibExtras.h.
+        (isPointerTypeAlignmentOkay):
+        (reinterpret_cast_ptr):
+        (WTF):
+        (WTF::isPointerAligned):
+        (WTF::is8ByteAligned):
+        (WTF::bitwise_cast):
+        (WTF::safeCast):
+        (WTF::bitCount):
+        (WTF::roundUpToMultipleOf):
+        (WTF::binarySearch):
+        (WTF::binarySearchWithFunctor):
+        (WTF::genericBinarySearch):
+        (operator new):
+        * wtf/StringExtras.cpp: Renamed from Source/JavaScriptCore/wtf/StringExtras.cpp.
+        (strcasecmp):
+        (strncasecmp):
+        * wtf/StringExtras.h: Renamed from Source/JavaScriptCore/wtf/StringExtras.h.
+        (snprintf):
+        (wtf_vsnprintf):
+        (strnicmp):
+        (stricmp):
+        (strdup):
+        (strncasecmp):
+        (strcasecmp):
+        (strnstr):
+        * wtf/StringHasher.h: Renamed from Source/JavaScriptCore/wtf/StringHasher.h.
+        (WTF):
+        (StringHasher):
+        (WTF::StringHasher::StringHasher):
+        (WTF::StringHasher::addCharacters):
+        (WTF::StringHasher::addCharacter):
+        (WTF::StringHasher::hash):
+        (WTF::StringHasher::computeHash):
+        (WTF::StringHasher::hashMemory):
+        (WTF::StringHasher::defaultConverter):
+        (WTF::StringHasher::addCharactersToHash):
+        * wtf/TCPackedCache.h: Renamed from Source/JavaScriptCore/wtf/TCPackedCache.h.
+        (PackedCache):
+        (PackedCache::PackedCache):
+        (PackedCache::Put):
+        (PackedCache::Has):
+        (PackedCache::GetOrDefault):
+        (PackedCache::Clear):
+        (PackedCache::EntryToValue):
+        (PackedCache::EntryToUpper):
+        (PackedCache::KeyToUpper):
+        (PackedCache::UpperToPartialKey):
+        (PackedCache::Hash):
+        (PackedCache::KeyMatch):
+        * wtf/TCPageMap.h: Renamed from Source/JavaScriptCore/wtf/TCPageMap.h.
+        (TCMalloc_PageMap1):
+        (TCMalloc_PageMap1::init):
+        (TCMalloc_PageMap1::Ensure):
+        (TCMalloc_PageMap1::PreallocateMoreMemory):
+        (TCMalloc_PageMap1::get):
+        (TCMalloc_PageMap1::set):
+        (TCMalloc_PageMap2):
+        (Leaf):
+        (TCMalloc_PageMap2::init):
+        (TCMalloc_PageMap2::get):
+        (TCMalloc_PageMap2::set):
+        (TCMalloc_PageMap2::Ensure):
+        (TCMalloc_PageMap2::PreallocateMoreMemory):
+        (TCMalloc_PageMap2::visitValues):
+        (TCMalloc_PageMap2::visitAllocations):
+        (TCMalloc_PageMap3):
+        (Node):
+        (TCMalloc_PageMap3::NewNode):
+        (TCMalloc_PageMap3::init):
+        (TCMalloc_PageMap3::get):
+        (TCMalloc_PageMap3::set):
+        (TCMalloc_PageMap3::Ensure):
+        (TCMalloc_PageMap3::PreallocateMoreMemory):
+        (TCMalloc_PageMap3::visitValues):
+        (TCMalloc_PageMap3::visitAllocations):
+        * wtf/TCSpinLock.h: Renamed from Source/JavaScriptCore/wtf/TCSpinLock.h.
+        (TCMalloc_SpinLock):
+        (TCMalloc_SpinLock::Lock):
+        (TCMalloc_SpinLock::Unlock):
+        (TCMalloc_SpinLock::IsHeld):
+        (TCMalloc_SpinLock::Init):
+        (TCMalloc_SpinLock::Finalize):
+        (TCMalloc_SlowLock):
+        (TCMalloc_SpinLockHolder):
+        (TCMalloc_SpinLockHolder::TCMalloc_SpinLockHolder):
+        (TCMalloc_SpinLockHolder::~TCMalloc_SpinLockHolder):
+        * wtf/TCSystemAlloc.cpp: Renamed from Source/JavaScriptCore/wtf/TCSystemAlloc.cpp.
+        (TrySbrk):
+        (TryMmap):
+        (TryVirtualAlloc):
+        (TryDevMem):
+        (TCMalloc_SystemAlloc):
+        (TCMalloc_SystemRelease):
+        (TCMalloc_SystemCommit):
+        * wtf/TCSystemAlloc.h: Renamed from Source/JavaScriptCore/wtf/TCSystemAlloc.h.
+        (TCMalloc_SystemRelease):
+        (TCMalloc_SystemCommit):
+        * wtf/TemporaryChange.h: Renamed from Source/JavaScriptCore/wtf/TemporaryChange.h.
+        (WTF):
+        (TemporaryChange):
+        (WTF::TemporaryChange::TemporaryChange):
+        (WTF::TemporaryChange::~TemporaryChange):
+        * wtf/ThreadFunctionInvocation.h: Renamed from Source/JavaScriptCore/wtf/ThreadFunctionInvocation.h.
+        (WTF):
+        (WTF::ThreadFunctionInvocation::ThreadFunctionInvocation):
+        (ThreadFunctionInvocation):
+        * wtf/ThreadIdentifierDataPthreads.cpp: Renamed from Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp.
+        (WTF):
+        (WTF::ThreadIdentifierData::~ThreadIdentifierData):
+        (WTF::ThreadIdentifierData::initializeOnce):
+        (WTF::ThreadIdentifierData::identifier):
+        (WTF::ThreadIdentifierData::initialize):
+        (WTF::ThreadIdentifierData::destruct):
+        * wtf/ThreadIdentifierDataPthreads.h: Renamed from Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h.
+        (WTF):
+        (ThreadIdentifierData):
+        (WTF::ThreadIdentifierData::ThreadIdentifierData):
+        * wtf/ThreadRestrictionVerifier.h: Renamed from Source/JavaScriptCore/wtf/ThreadRestrictionVerifier.h.
+        (WTF):
+        (ThreadRestrictionVerifier):
+        (WTF::ThreadRestrictionVerifier::ThreadRestrictionVerifier):
+        (WTF::ThreadRestrictionVerifier::~ThreadRestrictionVerifier):
+        (WTF::ThreadRestrictionVerifier::setMutexMode):
+        (WTF::ThreadRestrictionVerifier::setDispatchQueueMode):
+        (WTF::ThreadRestrictionVerifier::turnOffVerification):
+        (WTF::ThreadRestrictionVerifier::setShared):
+        (WTF::ThreadRestrictionVerifier::isSafeToUse):
+        * wtf/ThreadSafeRefCounted.h: Renamed from Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h.
+        (WTF):
+        (ThreadSafeRefCountedBase):
+        (WTF::ThreadSafeRefCountedBase::ThreadSafeRefCountedBase):
+        (WTF::ThreadSafeRefCountedBase::ref):
+        (WTF::ThreadSafeRefCountedBase::hasOneRef):
+        (WTF::ThreadSafeRefCountedBase::refCount):
+        (WTF::ThreadSafeRefCountedBase::derefBase):
+        (ThreadSafeRefCounted):
+        (WTF::ThreadSafeRefCounted::deref):
+        (WTF::ThreadSafeRefCounted::ThreadSafeRefCounted):
+        * wtf/ThreadSpecific.h: Renamed from Source/JavaScriptCore/wtf/ThreadSpecific.h.
+        (WTF):
+        (ThreadSpecific):
+        (Data):
+        (WTF::ThreadSpecific::Data::Data):
+        (WTF::::ThreadSpecific):
+        (WTF::::get):
+        (WTF::::set):
+        (WTF::::~ThreadSpecific):
+        (WTF::::destroy):
+        (WTF::::isSet):
+        (WTF::T):
+        (WTF::::operator):
+        * wtf/ThreadSpecificWin.cpp: Renamed from Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp.
+        (WTF):
+        (WTF::tlsKeyCount):
+        (WTF::tlsKeys):
+        (WTF::ThreadSpecificThreadExit):
+        * wtf/Threading.cpp: Renamed from Source/JavaScriptCore/wtf/Threading.cpp.
+        (WTF):
+        (NewThreadContext):
+        (WTF::NewThreadContext::NewThreadContext):
+        (WTF::threadEntryPoint):
+        (WTF::createThread):
+        (WTF::ThreadFunctionWithReturnValueInvocation::ThreadFunctionWithReturnValueInvocation):
+        (ThreadFunctionWithReturnValueInvocation):
+        (WTF::compatEntryPoint):
+        (WTF::waitForThreadCompletion):
+        * wtf/Threading.h: Renamed from Source/JavaScriptCore/wtf/Threading.h.
+        (WTF):
+        * wtf/ThreadingNone.cpp: Renamed from Source/JavaScriptCore/wtf/ThreadingNone.cpp.
+        * wtf/ThreadingPrimitives.h: Renamed from Source/JavaScriptCore/wtf/ThreadingPrimitives.h.
+        (WTF):
+        (PlatformMutex):
+        (PlatformCondition):
+        (Mutex):
+        (WTF::Mutex::impl):
+        (ReadWriteLock):
+        (ThreadCondition):
+        * wtf/ThreadingPthreads.cpp: Renamed from Source/JavaScriptCore/wtf/ThreadingPthreads.cpp.
+        (WTF):
+        (WTF::threadMapMutex):
+        (WTF::initializeThreading):
+        (WTF::lockAtomicallyInitializedStaticMutex):
+        (WTF::unlockAtomicallyInitializedStaticMutex):
+        (WTF::threadMap):
+        (WTF::identifierByPthreadHandle):
+        (WTF::establishIdentifierForPthreadHandle):
+        (WTF::pthreadHandleForIdentifier):
+        (WTF::clearPthreadHandleForIdentifier):
+        (WTF::wtfThreadEntryPoint):
+        (WTF::createThreadInternal):
+        (WTF::initializeCurrentThreadInternal):
+        (WTF::waitForThreadCompletion):
+        (WTF::detachThread):
+        (WTF::yield):
+        (WTF::currentThread):
+        (WTF::Mutex::Mutex):
+        (WTF::Mutex::~Mutex):
+        (WTF::Mutex::lock):
+        (WTF::Mutex::tryLock):
+        (WTF::Mutex::unlock):
+        (WTF::ReadWriteLock::ReadWriteLock):
+        (WTF::ReadWriteLock::~ReadWriteLock):
+        (WTF::ReadWriteLock::readLock):
+        (WTF::ReadWriteLock::tryReadLock):
+        (WTF::ReadWriteLock::writeLock):
+        (WTF::ReadWriteLock::tryWriteLock):
+        (WTF::ReadWriteLock::unlock):
+        (WTF::ThreadCondition::ThreadCondition):
+        (WTF::ThreadCondition::~ThreadCondition):
+        (WTF::ThreadCondition::wait):
+        (WTF::ThreadCondition::timedWait):
+        (WTF::ThreadCondition::signal):
+        (WTF::ThreadCondition::broadcast):
+        * wtf/ThreadingWin.cpp: Renamed from Source/JavaScriptCore/wtf/ThreadingWin.cpp.
+        (WTF):
+        (tagTHREADNAME_INFO):
+        (WTF::initializeCurrentThreadInternal):
+        (WTF::lockAtomicallyInitializedStaticMutex):
+        (WTF::unlockAtomicallyInitializedStaticMutex):
+        (WTF::threadMapMutex):
+        (WTF::initializeThreading):
+        (WTF::threadMap):
+        (WTF::storeThreadHandleByIdentifier):
+        (WTF::threadHandleForIdentifier):
+        (WTF::clearThreadHandleForIdentifier):
+        (WTF::wtfThreadEntryPoint):
+        (WTF::createThreadInternal):
+        (WTF::waitForThreadCompletion):
+        (WTF::detachThread):
+        (WTF::yield):
+        (WTF::currentThread):
+        (WTF::Mutex::Mutex):
+        (WTF::Mutex::~Mutex):
+        (WTF::Mutex::lock):
+        (WTF::Mutex::tryLock):
+        (WTF::Mutex::unlock):
+        (WTF::PlatformCondition::timedWait):
+        (WTF::PlatformCondition::signal):
+        (WTF::ThreadCondition::ThreadCondition):
+        (WTF::ThreadCondition::~ThreadCondition):
+        (WTF::ThreadCondition::wait):
+        (WTF::ThreadCondition::timedWait):
+        (WTF::ThreadCondition::signal):
+        (WTF::ThreadCondition::broadcast):
+        (WTF::absoluteTimeToWaitTimeoutInterval):
+        * wtf/TypeTraits.cpp: Renamed from Source/JavaScriptCore/wtf/TypeTraits.cpp.
+        (WTF):
+        * wtf/TypeTraits.h: Renamed from Source/JavaScriptCore/wtf/TypeTraits.h.
+        (WTF):
+        (IsConvertibleToInteger):
+        (IsArray):
+        (IsSameType):
+        (IsSubclass):
+        (NoType):
+        (IsSubclassOfTemplate):
+        (RemoveTemplate):
+        (RemoveConst):
+        (RemoveVolatile):
+        (RemoveConstVolatile):
+        (RemovePointer):
+        (RemoveReference):
+        (RemoveExtent):
+        (DecayArray):
+        (IntegralConstant):
+        * wtf/TypedArrayBase.h: Renamed from Source/JavaScriptCore/wtf/TypedArrayBase.h.
+        (WTF):
+        (TypedArrayBase):
+        (WTF::TypedArrayBase::data):
+        (WTF::TypedArrayBase::set):
+        (WTF::TypedArrayBase::setRange):
+        (WTF::TypedArrayBase::zeroRange):
+        (WTF::TypedArrayBase::length):
+        (WTF::TypedArrayBase::byteLength):
+        (WTF::TypedArrayBase::TypedArrayBase):
+        (WTF::TypedArrayBase::create):
+        (WTF::TypedArrayBase::subarrayImpl):
+        (WTF::TypedArrayBase::neuter):
+        * wtf/Uint16Array.h: Renamed from Source/JavaScriptCore/wtf/Uint16Array.h.
+        (WTF):
+        (Uint16Array):
+        (WTF::Uint16Array::set):
+        (WTF::Uint16Array::isUnsignedShortArray):
+        (WTF::Uint16Array::create):
+        (WTF::Uint16Array::Uint16Array):
+        (WTF::Uint16Array::subarray):
+        * wtf/Uint32Array.h: Renamed from Source/JavaScriptCore/wtf/Uint32Array.h.
+        (WTF):
+        (Uint32Array):
+        (WTF::Uint32Array::set):
+        (WTF::Uint32Array::isUnsignedIntArray):
+        (WTF::Uint32Array::create):
+        (WTF::Uint32Array::Uint32Array):
+        (WTF::Uint32Array::subarray):
+        * wtf/Uint8Array.h: Renamed from Source/JavaScriptCore/wtf/Uint8Array.h.
+        (WTF):
+        (Uint8Array):
+        (WTF::Uint8Array::set):
+        (WTF::Uint8Array::isUnsignedByteArray):
+        (WTF::Uint8Array::create):
+        (WTF::Uint8Array::Uint8Array):
+        (WTF::Uint8Array::subarray):
+        * wtf/Uint8ClampedArray.h: Renamed from Source/JavaScriptCore/wtf/Uint8ClampedArray.h.
+        (WTF):
+        (Uint8ClampedArray):
+        (WTF::Uint8ClampedArray::set):
+        (WTF::Uint8ClampedArray::isUnsignedByteClampedArray):
+        (WTF::Uint8ClampedArray::create):
+        (WTF::Uint8ClampedArray::Uint8ClampedArray):
+        (WTF::Uint8ClampedArray::subarray):
+        * wtf/UnionFind.h: Renamed from Source/JavaScriptCore/wtf/UnionFind.h.
+        (WTF):
+        (UnionFind):
+        (WTF::UnionFind::UnionFind):
+        (WTF::UnionFind::find):
+        (WTF::UnionFind::unify):
+        * wtf/UnusedParam.h: Renamed from Source/JavaScriptCore/wtf/UnusedParam.h.
+        (unusedParam):
+        * wtf/VMTags.h: Renamed from Source/JavaScriptCore/wtf/VMTags.h.
+        * wtf/ValueCheck.h: Renamed from Source/JavaScriptCore/wtf/ValueCheck.h.
+        (WTF):
+        (ValueCheck):
+        (WTF::ValueCheck::checkConsistency):
+        * wtf/Vector.h: Renamed from Source/JavaScriptCore/wtf/Vector.h.
+        (WTF):
+        (WTF::VectorTypeOperations::destruct):
+        (VectorTypeOperations):
+        (WTF::VectorTypeOperations::initialize):
+        (WTF::VectorTypeOperations::move):
+        (WTF::VectorTypeOperations::moveOverlapping):
+        (WTF::VectorTypeOperations::uninitializedCopy):
+        (WTF::VectorTypeOperations::uninitializedFill):
+        (WTF::VectorTypeOperations::compare):
+        (VectorBufferBase):
+        (WTF::VectorBufferBase::allocateBuffer):
+        (WTF::VectorBufferBase::tryAllocateBuffer):
+        (WTF::VectorBufferBase::deallocateBuffer):
+        (WTF::VectorBufferBase::buffer):
+        (WTF::VectorBufferBase::bufferSlot):
+        (WTF::VectorBufferBase::capacity):
+        (WTF::VectorBufferBase::releaseBuffer):
+        (WTF::VectorBufferBase::VectorBufferBase):
+        (WTF::VectorBufferBase::~VectorBufferBase):
+        (VectorBuffer):
+        (WTF::VectorBuffer::VectorBuffer):
+        (WTF::VectorBuffer::~VectorBuffer):
+        (WTF::VectorBuffer::allocateBuffer):
+        (WTF::VectorBuffer::tryAllocateBuffer):
+        (WTF::VectorBuffer::deallocateBuffer):
+        (WTF::VectorBuffer::swap):
+        (WTF::VectorBuffer::restoreInlineBufferIfNeeded):
+        (WTF::VectorBuffer::releaseBuffer):
+        (WTF::VectorBuffer::inlineBuffer):
+        (Vector):
+        (WTF::Vector::Vector):
+        (WTF::Vector::~Vector):
+        (WTF::Vector::size):
+        (WTF::Vector::capacity):
+        (WTF::Vector::isEmpty):
+        (WTF::Vector::at):
+        (WTF::Vector::operator[]):
+        (WTF::Vector::data):
+        (WTF::Vector::dataSlot):
+        (WTF::Vector::begin):
+        (WTF::Vector::end):
+        (WTF::Vector::rbegin):
+        (WTF::Vector::rend):
+        (WTF::Vector::reversed):
+        (WTF::Vector::first):
+        (WTF::Vector::last):
+        (WTF::Vector::shrinkToFit):
+        (WTF::Vector::clear):
+        (WTF::Vector::removeLast):
+        (WTF::Vector::fill):
+        (WTF::Vector::swap):
+        (VectorReverseProxy):
+        (WTF::Vector::VectorReverseProxy::begin):
+        (WTF::Vector::VectorReverseProxy::end):
+        (WTF::operator<<):
+        (WTF::operator>>):
+        (WTF::::Vector):
+        (WTF::=):
+        (WTF::typelessPointersAreEqual):
+        (WTF::::contains):
+        (WTF::::find):
+        (WTF::::reverseFind):
+        (WTF::::fill):
+        (WTF::::appendRange):
+        (WTF::::expandCapacity):
+        (WTF::::tryExpandCapacity):
+        (WTF::::resize):
+        (WTF::::shrink):
+        (WTF::::grow):
+        (WTF::::reserveCapacity):
+        (WTF::::tryReserveCapacity):
+        (WTF::::reserveInitialCapacity):
+        (WTF::::shrinkCapacity):
+        (WTF::::append):
+        (WTF::::tryAppend):
+        (WTF::::appendSlowCase):
+        (WTF::::uncheckedAppend):
+        (WTF::::insert):
+        (WTF::::prepend):
+        (WTF::::remove):
+        (WTF::::reverse):
+        (WTF::::releaseBuffer):
+        (WTF::::checkConsistency):
+        (WTF::deleteAllValues):
+        (WTF::swap):
+        (WTF::operator==):
+        (WTF::operator!=):
+        * wtf/VectorTraits.h: Renamed from Source/JavaScriptCore/wtf/VectorTraits.h.
+        (WTF):
+        (SimpleClassVectorTraits):
+        * wtf/WTFThreadData.cpp: Renamed from Source/JavaScriptCore/wtf/WTFThreadData.cpp.
+        (WTF):
+        (WTF::WTFThreadData::WTFThreadData):
+        (WTF::WTFThreadData::~WTFThreadData):
+        (JSC):
+        (JSC::IdentifierTable::~IdentifierTable):
+        (JSC::IdentifierTable::add):
+        * wtf/WTFThreadData.h: Renamed from Source/JavaScriptCore/wtf/WTFThreadData.h.
+        (JSC):
+        (IdentifierTable):
+        (JSC::IdentifierTable::remove):
+        (JSC::IdentifierTable::literalTable):
+        (WTF):
+        (WTFThreadData):
+        (WTF::WTFThreadData::atomicStringTable):
+        (WTF::WTFThreadData::currentIdentifierTable):
+        (WTF::WTFThreadData::setCurrentIdentifierTable):
+        (WTF::WTFThreadData::resetCurrentIdentifierTable):
+        (WTF::WTFThreadData::stack):
+        (WTF::wtfThreadData):
+        * wtf/blackberry/MainThreadBlackBerry.cpp: Renamed from Source/JavaScriptCore/wtf/blackberry/MainThreadBlackBerry.cpp.
+        (WTF):
+        (WTF::initializeMainThreadPlatform):
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+        * wtf/chromium/ChromiumThreading.h: Renamed from Source/JavaScriptCore/wtf/chromium/ChromiumThreading.h.
+        (WTF):
+        (ChromiumThreading):
+        * wtf/chromium/MainThreadChromium.cpp: Renamed from Source/JavaScriptCore/wtf/chromium/MainThreadChromium.cpp.
+        (WTF):
+        (WTF::initializeMainThread):
+        (WTF::callOnMainThread):
+        (WTF::callOnMainThreadAndWait):
+        (WTF::setMainThreadCallbacksPaused):
+        (WTF::isMainThread):
+        * wtf/dtoa.cpp: Renamed from Source/JavaScriptCore/wtf/dtoa.cpp.
+        (WTF):
+        (WTF::storeInc):
+        (WTF::BigInt::BigInt):
+        (BigInt):
+        (WTF::BigInt::clear):
+        (WTF::BigInt::size):
+        (WTF::BigInt::resize):
+        (WTF::BigInt::words):
+        (WTF::BigInt::append):
+        (WTF::multadd):
+        (WTF::hi0bits):
+        (WTF::lo0bits):
+        (WTF::i2b):
+        (WTF::mult):
+        (P5Node):
+        (WTF::P5Node::P5Node):
+        (WTF::pow5mult):
+        (WTF::lshift):
+        (WTF::cmp):
+        (WTF::diff):
+        (WTF::d2b):
+        (WTF::strtod):
+        (WTF::quorem):
+        (WTF::dtoa):
+        * wtf/dtoa.h: Renamed from Source/JavaScriptCore/wtf/dtoa.h.
+        (WTF):
+        * wtf/dtoa/COPYING: Renamed from Source/JavaScriptCore/wtf/dtoa/COPYING.
+        * wtf/dtoa/LICENSE: Renamed from Source/JavaScriptCore/wtf/dtoa/LICENSE.
+        * wtf/dtoa/README: Renamed from Source/JavaScriptCore/wtf/dtoa/README.
+        * wtf/dtoa/bignum-dtoa.cc: Renamed from Source/JavaScriptCore/wtf/dtoa/bignum-dtoa.cc.
+        * wtf/dtoa/bignum-dtoa.h: Renamed from Source/JavaScriptCore/wtf/dtoa/bignum-dtoa.h.
+        (WTF):
+        (double_conversion):
+        * wtf/dtoa/bignum.cc: Renamed from Source/JavaScriptCore/wtf/dtoa/bignum.cc.
+        * wtf/dtoa/bignum.h: Renamed from Source/JavaScriptCore/wtf/dtoa/bignum.h.
+        (WTF):
+        (double_conversion):
+        (Bignum):
+        (WTF::double_conversion::Bignum::Times10):
+        (WTF::double_conversion::Bignum::Equal):
+        (WTF::double_conversion::Bignum::LessEqual):
+        (WTF::double_conversion::Bignum::Less):
+        (WTF::double_conversion::Bignum::PlusEqual):
+        (WTF::double_conversion::Bignum::PlusLessEqual):
+        (WTF::double_conversion::Bignum::PlusLess):
+        (WTF::double_conversion::Bignum::EnsureCapacity):
+        (WTF::double_conversion::Bignum::BigitLength):
+        * wtf/dtoa/cached-powers.cc: Renamed from Source/JavaScriptCore/wtf/dtoa/cached-powers.cc.
+        * wtf/dtoa/cached-powers.h: Renamed from Source/JavaScriptCore/wtf/dtoa/cached-powers.h.
+        (WTF):
+        (double_conversion):
+        (PowersOfTenCache):
+        * wtf/dtoa/diy-fp.cc: Renamed from Source/JavaScriptCore/wtf/dtoa/diy-fp.cc.
+        * wtf/dtoa/diy-fp.h: Renamed from Source/JavaScriptCore/wtf/dtoa/diy-fp.h.
+        (WTF):
+        (double_conversion):
+        (DiyFp):
+        (WTF::double_conversion::DiyFp::DiyFp):
+        (WTF::double_conversion::DiyFp::Subtract):
+        (WTF::double_conversion::DiyFp::Minus):
+        (WTF::double_conversion::DiyFp::Times):
+        (WTF::double_conversion::DiyFp::Normalize):
+        (WTF::double_conversion::DiyFp::f):
+        (WTF::double_conversion::DiyFp::e):
+        (WTF::double_conversion::DiyFp::set_f):
+        (WTF::double_conversion::DiyFp::set_e):
+        * wtf/dtoa/double-conversion.cc: Renamed from Source/JavaScriptCore/wtf/dtoa/double-conversion.cc.
+        * wtf/dtoa/double-conversion.h: Renamed from Source/JavaScriptCore/wtf/dtoa/double-conversion.h.
+        (WTF):
+        (double_conversion):
+        (DoubleToStringConverter):
+        (WTF::double_conversion::DoubleToStringConverter::DoubleToStringConverter):
+        (StringToDoubleConverter):
+        (WTF::double_conversion::StringToDoubleConverter::StringToDoubleConverter):
+        * wtf/dtoa/double.h: Renamed from Source/JavaScriptCore/wtf/dtoa/double.h.
+        (WTF):
+        (double_conversion):
+        (WTF::double_conversion::double_to_uint64):
+        (WTF::double_conversion::uint64_to_double):
+        (Double):
+        (WTF::double_conversion::Double::Double):
+        (WTF::double_conversion::Double::AsDiyFp):
+        (WTF::double_conversion::Double::AsNormalizedDiyFp):
+        (WTF::double_conversion::Double::AsUint64):
+        (WTF::double_conversion::Double::NextDouble):
+        (WTF::double_conversion::Double::Exponent):
+        (WTF::double_conversion::Double::Significand):
+        (WTF::double_conversion::Double::IsDenormal):
+        (WTF::double_conversion::Double::IsSpecial):
+        (WTF::double_conversion::Double::IsNan):
+        (WTF::double_conversion::Double::IsInfinite):
+        (WTF::double_conversion::Double::Sign):
+        (WTF::double_conversion::Double::UpperBoundary):
+        (WTF::double_conversion::Double::NormalizedBoundaries):
+        (WTF::double_conversion::Double::value):
+        (WTF::double_conversion::Double::SignificandSizeForOrderOfMagnitude):
+        (WTF::double_conversion::Double::Infinity):
+        (WTF::double_conversion::Double::NaN):
+        (WTF::double_conversion::Double::DiyFpToUint64):
+        * wtf/dtoa/fast-dtoa.cc: Renamed from Source/JavaScriptCore/wtf/dtoa/fast-dtoa.cc.
+        * wtf/dtoa/fast-dtoa.h: Renamed from Source/JavaScriptCore/wtf/dtoa/fast-dtoa.h.
+        (WTF):
+        (double_conversion):
+        * wtf/dtoa/fixed-dtoa.cc: Renamed from Source/JavaScriptCore/wtf/dtoa/fixed-dtoa.cc.
+        * wtf/dtoa/fixed-dtoa.h: Renamed from Source/JavaScriptCore/wtf/dtoa/fixed-dtoa.h.
+        (WTF):
+        (double_conversion):
+        * wtf/dtoa/strtod.cc: Renamed from Source/JavaScriptCore/wtf/dtoa/strtod.cc.
+        * wtf/dtoa/strtod.h: Renamed from Source/JavaScriptCore/wtf/dtoa/strtod.h.
+        (WTF):
+        (double_conversion):
+        * wtf/dtoa/utils.h: Renamed from Source/JavaScriptCore/wtf/dtoa/utils.h.
+        (WTF):
+        (double_conversion):
+        (WTF::double_conversion::Max):
+        (WTF::double_conversion::Min):
+        (WTF::double_conversion::StrLength):
+        (Vector):
+        (WTF::double_conversion::Vector::Vector):
+        (WTF::double_conversion::Vector::SubVector):
+        (WTF::double_conversion::Vector::length):
+        (WTF::double_conversion::Vector::is_empty):
+        (WTF::double_conversion::Vector::start):
+        (WTF::double_conversion::Vector::operator[]):
+        (WTF::double_conversion::Vector::first):
+        (WTF::double_conversion::Vector::last):
+        (StringBuilder):
+        (WTF::double_conversion::StringBuilder::StringBuilder):
+        (WTF::double_conversion::StringBuilder::~StringBuilder):
+        (WTF::double_conversion::StringBuilder::size):
+        (WTF::double_conversion::StringBuilder::position):
+        (WTF::double_conversion::StringBuilder::SetPosition):
+        (WTF::double_conversion::StringBuilder::Reset):
+        (WTF::double_conversion::StringBuilder::AddCharacter):
+        (WTF::double_conversion::StringBuilder::AddString):
+        (WTF::double_conversion::StringBuilder::AddSubstring):
+        (WTF::double_conversion::StringBuilder::AddPadding):
+        (WTF::double_conversion::StringBuilder::Finalize):
+        (WTF::double_conversion::StringBuilder::is_finalized):
+        (WTF::double_conversion::BitCast):
+        * wtf/efl/MainThreadEfl.cpp: Renamed from Source/JavaScriptCore/wtf/efl/MainThreadEfl.cpp.
+        (WTF):
+        (WTF::pipeObject):
+        (WTF::monitorDispatchFunctions):
+        (WTF::initializeMainThreadPlatform):
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+        * wtf/efl/OwnPtrEfl.cpp: Renamed from Source/JavaScriptCore/wtf/efl/OwnPtrEfl.cpp.
+        (WTF):
+        (WTF::deleteOwnedPtr):
+        * wtf/gobject/GOwnPtr.cpp: Renamed from Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp.
+        (WTF):
+        (WTF::GError):
+        (WTF::GList):
+        (WTF::GSList):
+        (WTF::GPatternSpec):
+        (WTF::GDir):
+        (WTF::GTimer):
+        (WTF::GKeyFile):
+        * wtf/gobject/GOwnPtr.h: Renamed from Source/JavaScriptCore/wtf/gobject/GOwnPtr.h.
+        (WTF):
+        (GOwnPtr):
+        (WTF::GOwnPtr::GOwnPtr):
+        (WTF::GOwnPtr::~GOwnPtr):
+        (WTF::GOwnPtr::get):
+        (WTF::GOwnPtr::release):
+        (WTF::GOwnPtr::outPtr):
+        (WTF::GOwnPtr::set):
+        (WTF::GOwnPtr::clear):
+        (WTF::GOwnPtr::operator*):
+        (WTF::GOwnPtr::operator->):
+        (WTF::GOwnPtr::operator!):
+        (WTF::GOwnPtr::operator UnspecifiedBoolType):
+        (WTF::GOwnPtr::swap):
+        (WTF::swap):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::getPtr):
+        (WTF::freeOwnedGPtr):
+        * wtf/gobject/GRefPtr.cpp: Renamed from Source/JavaScriptCore/wtf/gobject/GRefPtr.cpp.
+        (WTF):
+        (WTF::refGPtr):
+        (WTF::derefGPtr):
+        (_GVariant):
+        * wtf/gobject/GRefPtr.h: Renamed from Source/JavaScriptCore/wtf/gobject/GRefPtr.h.
+        (WTF):
+        (GRefPtr):
+        (WTF::GRefPtr::GRefPtr):
+        (WTF::GRefPtr::~GRefPtr):
+        (WTF::GRefPtr::clear):
+        (WTF::GRefPtr::isHashTableDeletedValue):
+        (WTF::GRefPtr::get):
+        (WTF::GRefPtr::operator*):
+        (WTF::GRefPtr::operator->):
+        (WTF::GRefPtr::operator!):
+        (WTF::GRefPtr::operator UnspecifiedBoolType):
+        (WTF::GRefPtr::hashTableDeletedValue):
+        (WTF::=):
+        (WTF::::swap):
+        (WTF::swap):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::static_pointer_cast):
+        (WTF::const_pointer_cast):
+        (WTF::getPtr):
+        (WTF::adoptGRef):
+        (WTF::refGPtr):
+        (WTF::derefGPtr):
+        * wtf/gobject/GTypedefs.h: Renamed from Source/JavaScriptCore/wtf/gobject/GTypedefs.h.
+        * wtf/gobject/GlibUtilities.cpp: Renamed from Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp.
+        (getCurrentExecutablePath):
+        * wtf/gobject/GlibUtilities.h: Renamed from Source/JavaScriptCore/wtf/gobject/GlibUtilities.h.
+        * wtf/gtk/MainThreadGtk.cpp: Renamed from Source/JavaScriptCore/wtf/gtk/MainThreadGtk.cpp.
+        (WTF):
+        (WTF::initializeMainThreadPlatform):
+        (WTF::timeoutFired):
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+        * wtf/mac/MainThreadMac.mm: Renamed from Source/JavaScriptCore/wtf/mac/MainThreadMac.mm.
+        (-[JSWTFMainThreadCaller call]):
+        (WTF):
+        (WTF::initializeMainThreadPlatform):
+        (WTF::initializeMainThreadToProcessMainThreadPlatform):
+        (WTF::timerFired):
+        (WTF::postTimer):
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+        (WTF::isMainThread):
+        * wtf/qt/MainThreadQt.cpp: Renamed from Source/JavaScriptCore/wtf/qt/MainThreadQt.cpp.
+        (WTF):
+        (MainThreadInvoker):
+        (WTF::MainThreadInvoker::MainThreadInvoker):
+        (WTF::MainThreadInvoker::event):
+        (WTF::initializeMainThreadPlatform):
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+        * wtf/qt/StringQt.cpp: Renamed from Source/JavaScriptCore/wtf/qt/StringQt.cpp.
+        (WTF):
+        (WTF::String::String):
+        (WTF::String::operator QString):
+        (WTF::operator<<):
+        (WTF::operator>>):
+        * wtf/qt/UtilsQt.h: Renamed from Source/JavaScriptCore/wtf/qt/UtilsQt.h.
+        (escapeHtml):
+        * wtf/qt/compat/QGuiApplication: Renamed from Source/JavaScriptCore/wtf/qt/compat/QGuiApplication.
+        * wtf/qt/compat/qguiapplication.h: Renamed from Source/JavaScriptCore/wtf/qt/compat/qguiapplication.h.
+        (QGuiApplication):
+        (QGuiApplication::styleHints):
+        * wtf/text/ASCIIFastPath.h: Renamed from Source/JavaScriptCore/wtf/text/ASCIIFastPath.h.
+        (WTF):
+        (WTF::isAlignedToMachineWord):
+        (WTF::alignToMachineWord):
+        (WTF::isAllASCII):
+        (WTF::charactersAreAllASCII):
+        * wtf/text/AtomicString.cpp: Renamed from Source/JavaScriptCore/wtf/text/AtomicString.cpp.
+        (WTF):
+        (AtomicStringTable):
+        (WTF::AtomicStringTable::create):
+        (WTF::AtomicStringTable::table):
+        (WTF::AtomicStringTable::destroy):
+        (WTF::stringTable):
+        (WTF::addToStringTable):
+        (WTF::CStringTranslator::hash):
+        (CStringTranslator):
+        (WTF::CStringTranslator::equal):
+        (WTF::CStringTranslator::translate):
+        (WTF::AtomicString::add):
+        (UCharBuffer):
+        (WTF::UCharBufferTranslator::hash):
+        (UCharBufferTranslator):
+        (WTF::UCharBufferTranslator::equal):
+        (WTF::UCharBufferTranslator::translate):
+        (HashAndCharacters):
+        (WTF::HashAndCharactersTranslator::hash):
+        (HashAndCharactersTranslator):
+        (WTF::HashAndCharactersTranslator::equal):
+        (WTF::HashAndCharactersTranslator::translate):
+        (HashAndUTF8Characters):
+        (WTF::HashAndUTF8CharactersTranslator::hash):
+        (HashAndUTF8CharactersTranslator):
+        (WTF::HashAndUTF8CharactersTranslator::equal):
+        (WTF::HashAndUTF8CharactersTranslator::translate):
+        (SubstringLocation):
+        (WTF::SubstringTranslator::hash):
+        (SubstringTranslator):
+        (WTF::SubstringTranslator::equal):
+        (WTF::SubstringTranslator::translate):
+        (WTF::AtomicString::addSlowCase):
+        (WTF::AtomicString::find):
+        (WTF::AtomicString::remove):
+        (WTF::AtomicString::lower):
+        (WTF::AtomicString::fromUTF8Internal):
+        (WTF::AtomicString::show):
+        * wtf/text/AtomicString.h: Renamed from Source/JavaScriptCore/wtf/text/AtomicString.h.
+        (WTF):
+        (AtomicString):
+        (WTF::AtomicString::AtomicString):
+        (WTF::AtomicString::isHashTableDeletedValue):
+        (WTF::AtomicString::operator const String&):
+        (WTF::AtomicString::string):
+        (WTF::AtomicString::impl):
+        (WTF::AtomicString::characters):
+        (WTF::AtomicString::length):
+        (WTF::AtomicString::operator[]):
+        (WTF::AtomicString::contains):
+        (WTF::AtomicString::find):
+        (WTF::AtomicString::startsWith):
+        (WTF::AtomicString::endsWith):
+        (WTF::AtomicString::upper):
+        (WTF::AtomicString::toInt):
+        (WTF::AtomicString::toDouble):
+        (WTF::AtomicString::toFloat):
+        (WTF::AtomicString::percentage):
+        (WTF::AtomicString::isNull):
+        (WTF::AtomicString::isEmpty):
+        (WTF::AtomicString::createCFString):
+        (WTF::AtomicString::operator NSString*):
+        (WTF::AtomicString::operator QString):
+        (WTF::AtomicString::add):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::equalIgnoringCase):
+        (WTF::AtomicString::fromUTF8):
+        * wtf/text/AtomicStringHash.h: Renamed from Source/JavaScriptCore/wtf/text/AtomicStringHash.h.
+        (WTF):
+        (WTF::AtomicStringHash::hash):
+        (AtomicStringHash):
+        (WTF::AtomicStringHash::equal):
+        * wtf/text/AtomicStringImpl.h: Renamed from Source/JavaScriptCore/wtf/text/AtomicStringImpl.h.
+        (WTF):
+        (AtomicStringImpl):
+        (WTF::AtomicStringImpl::AtomicStringImpl):
+        * wtf/text/CString.cpp: Renamed from Source/JavaScriptCore/wtf/text/CString.cpp.
+        (WTF):
+        (WTF::CString::CString):
+        (WTF::CString::init):
+        (WTF::CString::mutableData):
+        (WTF::CString::newUninitialized):
+        (WTF::CString::copyBufferIfNeeded):
+        (WTF::operator==):
+        * wtf/text/CString.h: Renamed from Source/JavaScriptCore/wtf/text/CString.h.
+        (WTF):
+        (CStringBuffer):
+        (WTF::CStringBuffer::data):
+        (WTF::CStringBuffer::length):
+        (WTF::CStringBuffer::create):
+        (WTF::CStringBuffer::CStringBuffer):
+        (WTF::CStringBuffer::mutableData):
+        (CString):
+        (WTF::CString::CString):
+        (WTF::CString::data):
+        (WTF::CString::length):
+        (WTF::CString::isNull):
+        (WTF::CString::buffer):
+        (WTF::operator!=):
+        * wtf/text/StringBuffer.h: Renamed from Source/JavaScriptCore/wtf/text/StringBuffer.h.
+        (WTF):
+        (StringBuffer):
+        (WTF::StringBuffer::StringBuffer):
+        (WTF::StringBuffer::~StringBuffer):
+        (WTF::StringBuffer::shrink):
+        (WTF::StringBuffer::resize):
+        (WTF::StringBuffer::length):
+        (WTF::StringBuffer::characters):
+        (WTF::StringBuffer::operator[]):
+        (WTF::StringBuffer::release):
+        * wtf/text/StringBuilder.cpp: Renamed from Source/JavaScriptCore/wtf/text/StringBuilder.cpp.
+        (WTF):
+        (WTF::StringBuilder::reifyString):
+        (WTF::StringBuilder::resize):
+        (WTF::StringBuilder::allocateBuffer):
+        (WTF::StringBuilder::allocateBufferUpConvert):
+        (WTF::LChar):
+        (WTF::UChar):
+        (WTF::StringBuilder::reserveCapacity):
+        (WTF::StringBuilder::appendUninitialized):
+        (WTF::StringBuilder::appendUninitializedSlow):
+        (WTF::StringBuilder::append):
+        (WTF::StringBuilder::canShrink):
+        (WTF::StringBuilder::shrinkToFit):
+        * wtf/text/StringBuilder.h: Renamed from Source/JavaScriptCore/wtf/text/StringBuilder.h.
+        (WTF):
+        (StringBuilder):
+        (WTF::StringBuilder::StringBuilder):
+        (WTF::StringBuilder::append):
+        (WTF::StringBuilder::toString):
+        (WTF::StringBuilder::toStringPreserveCapacity):
+        (WTF::StringBuilder::toAtomicString):
+        (WTF::StringBuilder::length):
+        (WTF::StringBuilder::isEmpty):
+        (WTF::StringBuilder::capacity):
+        (WTF::StringBuilder::operator[]):
+        (WTF::StringBuilder::characters8):
+        (WTF::StringBuilder::characters16):
+        (WTF::StringBuilder::characters):
+        (WTF::StringBuilder::is8Bit):
+        (WTF::StringBuilder::clear):
+        (WTF::StringBuilder::swap):
+        (WTF::LChar):
+        (WTF::UChar):
+        (WTF::equal):
+        (WTF::operator==):
+        (WTF::operator!=):
+        * wtf/text/StringConcatenate.h: Renamed from Source/JavaScriptCore/wtf/text/StringConcatenate.h.
+        (WTF):
+        (WTF::sumWithOverflow):
+        (WTF::tryMakeString):
+        (WTF::makeString):
+        * wtf/text/StringHash.h: Renamed from Source/JavaScriptCore/wtf/text/StringHash.h.
+        (WTF):
+        (WTF::StringHash::hash):
+        (WTF::StringHash::equal):
+        (StringHash):
+        (CaseFoldingHash):
+        (WTF::CaseFoldingHash::foldCase):
+        (WTF::CaseFoldingHash::hash):
+        (WTF::CaseFoldingHash::equal):
+        (WTF::AlreadyHashed::hash):
+        (AlreadyHashed):
+        (WTF::AlreadyHashed::avoidDeletedValue):
+        * wtf/text/StringImpl.cpp: Renamed from Source/JavaScriptCore/wtf/text/StringImpl.cpp.
+        (WTF):
+        (WTF::StringImpl::~StringImpl):
+        (WTF::StringImpl::createUninitialized):
+        (WTF::StringImpl::reallocate):
+        (WTF::StringImpl::create):
+        (WTF::StringImpl::getData16SlowCase):
+        (WTF::StringImpl::upconvertCharacters):
+        (WTF::StringImpl::containsOnlyWhitespace):
+        (WTF::StringImpl::substring):
+        (WTF::StringImpl::characterStartingAt):
+        (WTF::StringImpl::lower):
+        (WTF::StringImpl::upper):
+        (WTF::StringImpl::fill):
+        (WTF::StringImpl::foldCase):
+        (WTF::StringImpl::stripMatchedCharacters):
+        (UCharPredicate):
+        (WTF::UCharPredicate::UCharPredicate):
+        (WTF::UCharPredicate::operator()):
+        (SpaceOrNewlinePredicate):
+        (WTF::SpaceOrNewlinePredicate::operator()):
+        (WTF::StringImpl::stripWhiteSpace):
+        (WTF::StringImpl::removeCharacters):
+        (WTF::StringImpl::simplifyMatchedCharactersToSpace):
+        (WTF::StringImpl::simplifyWhiteSpace):
+        (WTF::StringImpl::toIntStrict):
+        (WTF::StringImpl::toUIntStrict):
+        (WTF::StringImpl::toInt64Strict):
+        (WTF::StringImpl::toUInt64Strict):
+        (WTF::StringImpl::toIntPtrStrict):
+        (WTF::StringImpl::toInt):
+        (WTF::StringImpl::toUInt):
+        (WTF::StringImpl::toInt64):
+        (WTF::StringImpl::toUInt64):
+        (WTF::StringImpl::toIntPtr):
+        (WTF::StringImpl::toDouble):
+        (WTF::StringImpl::toFloat):
+        (WTF::equalIgnoringCase):
+        (WTF::StringImpl::find):
+        (WTF::StringImpl::findIgnoringCase):
+        (WTF::findInner):
+        (WTF::StringImpl::reverseFind):
+        (WTF::reverseFindInner):
+        (WTF::StringImpl::reverseFindIgnoringCase):
+        (WTF::StringImpl::endsWith):
+        (WTF::StringImpl::replace):
+        (WTF::equal):
+        (WTF::equalIgnoringNullity):
+        (WTF::StringImpl::defaultWritingDirection):
+        (WTF::StringImpl::adopt):
+        (WTF::StringImpl::createWithTerminatingNullCharacter):
+        * wtf/text/StringImpl.h: Renamed from Source/JavaScriptCore/wtf/text/StringImpl.h.
+        (JSC):
+        (WTF):
+        (StringImpl):
+        (WTF::StringImpl::StringImpl):
+        (WTF::StringImpl::create):
+        (WTF::StringImpl::create8):
+        (WTF::StringImpl::tryCreateUninitialized):
+        (WTF::StringImpl::flagsOffset):
+        (WTF::StringImpl::flagIs8Bit):
+        (WTF::StringImpl::dataOffset):
+        (WTF::StringImpl::adopt):
+        (WTF::StringImpl::length):
+        (WTF::StringImpl::is8Bit):
+        (WTF::StringImpl::characters8):
+        (WTF::StringImpl::characters16):
+        (WTF::StringImpl::characters):
+        (WTF::StringImpl::cost):
+        (WTF::StringImpl::has16BitShadow):
+        (WTF::StringImpl::isIdentifier):
+        (WTF::StringImpl::setIsIdentifier):
+        (WTF::StringImpl::hasTerminatingNullCharacter):
+        (WTF::StringImpl::isAtomic):
+        (WTF::StringImpl::setIsAtomic):
+        (WTF::StringImpl::setHash):
+        (WTF::StringImpl::rawHash):
+        (WTF::StringImpl::hasHash):
+        (WTF::StringImpl::existingHash):
+        (WTF::StringImpl::hash):
+        (WTF::StringImpl::hasOneRef):
+        (WTF::StringImpl::ref):
+        (WTF::StringImpl::deref):
+        (WTF::StringImpl::copyChars):
+        (WTF::StringImpl::operator[]):
+        (WTF::StringImpl::find):
+        (WTF::StringImpl::findIgnoringCase):
+        (WTF::StringImpl::startsWith):
+        (WTF::StringImpl::bufferOwnership):
+        (WTF::StringImpl::isStatic):
+        (WTF::LChar):
+        (WTF::UChar):
+        (WTF::equal):
+        (WTF::equalIgnoringCase):
+        (WTF::equalIgnoringNullity):
+        (WTF::codePointCompare):
+        (WTF::codePointCompare8):
+        (WTF::codePointCompare16):
+        (WTF::codePointCompare8To16):
+        (WTF::isSpaceOrNewline):
+        (WTF::StringImpl::isolatedCopy):
+        * wtf/text/StringOperators.h: Renamed from Source/JavaScriptCore/wtf/text/StringOperators.h.
+        (WTF):
+        (StringAppend):
+        (WTF::StringAppend::StringAppend):
+        (WTF::StringAppend::operator String):
+        (WTF::StringAppend::operator AtomicString):
+        (WTF::StringAppend::is8Bit):
+        (WTF::StringAppend::writeTo):
+        (WTF::StringAppend::length):
+        (WTF::operator+):
+        * wtf/text/StringStatics.cpp: Renamed from Source/JavaScriptCore/wtf/text/StringStatics.cpp.
+        (WTF):
+        (WTF::StringImpl::empty):
+        (WTF::StringImpl::hashSlowCase):
+        (WTF::AtomicString::init):
+        * wtf/text/TextPosition.h: Renamed from Source/JavaScriptCore/wtf/text/TextPosition.h.
+        (WTF):
+        (OrdinalNumber):
+        (WTF::OrdinalNumber::fromZeroBasedInt):
+        (WTF::OrdinalNumber::fromOneBasedInt):
+        (WTF::OrdinalNumber::OrdinalNumber):
+        (WTF::OrdinalNumber::zeroBasedInt):
+        (WTF::OrdinalNumber::oneBasedInt):
+        (WTF::OrdinalNumber::operator==):
+        (WTF::OrdinalNumber::operator!=):
+        (WTF::OrdinalNumber::first):
+        (WTF::OrdinalNumber::beforeFirst):
+        (TextPosition):
+        (WTF::TextPosition::TextPosition):
+        (WTF::TextPosition::operator==):
+        (WTF::TextPosition::operator!=):
+        (WTF::TextPosition::minimumPosition):
+        (WTF::TextPosition::belowRangePosition):
+        * wtf/text/WTFString.cpp: Renamed from Source/JavaScriptCore/wtf/text/WTFString.cpp.
+        (WTF):
+        (WTF::String::String):
+        (WTF::String::append):
+        (WTF::codePointCompare):
+        (WTF::String::insert):
+        (WTF::String::characterStartingAt):
+        (WTF::String::truncate):
+        (WTF::String::remove):
+        (WTF::String::substring):
+        (WTF::String::substringSharingImpl):
+        (WTF::String::lower):
+        (WTF::String::upper):
+        (WTF::String::stripWhiteSpace):
+        (WTF::String::simplifyWhiteSpace):
+        (WTF::String::removeCharacters):
+        (WTF::String::foldCase):
+        (WTF::String::percentage):
+        (WTF::String::charactersWithNullTermination):
+        (WTF::String::format):
+        (WTF::String::number):
+        (WTF::String::toIntStrict):
+        (WTF::String::toUIntStrict):
+        (WTF::String::toInt64Strict):
+        (WTF::String::toUInt64Strict):
+        (WTF::String::toIntPtrStrict):
+        (WTF::String::toInt):
+        (WTF::String::toUInt):
+        (WTF::String::toInt64):
+        (WTF::String::toUInt64):
+        (WTF::String::toIntPtr):
+        (WTF::String::toDouble):
+        (WTF::String::toFloat):
+        (WTF::String::isolatedCopy):
+        (WTF::String::split):
+        (WTF::String::ascii):
+        (WTF::String::latin1):
+        (WTF::putUTF8Triple):
+        (WTF::String::utf8):
+        (WTF::String::fromUTF8):
+        (WTF::String::fromUTF8WithLatin1Fallback):
+        (WTF::isCharacterAllowedInBase):
+        (WTF::toIntegralType):
+        (WTF::lengthOfCharactersAsInteger):
+        (WTF::charactersToIntStrict):
+        (WTF::charactersToUIntStrict):
+        (WTF::charactersToInt64Strict):
+        (WTF::charactersToUInt64Strict):
+        (WTF::charactersToIntPtrStrict):
+        (WTF::charactersToInt):
+        (WTF::charactersToUInt):
+        (WTF::charactersToInt64):
+        (WTF::charactersToUInt64):
+        (WTF::charactersToIntPtr):
+        (WTF::toDoubleType):
+        (WTF::charactersToDouble):
+        (WTF::charactersToFloat):
+        (WTF::charactersToFloatIgnoringJunk):
+        (WTF::emptyString):
+        (String::show):
+        (string):
+        (asciiDebug):
+        * wtf/text/WTFString.h: Renamed from Source/JavaScriptCore/wtf/text/WTFString.h.
+        (WebKit):
+        (WTF):
+        (String):
+        (WTF::String::String):
+        (WTF::String::~String):
+        (WTF::String::swap):
+        (WTF::String::adopt):
+        (WTF::String::isNull):
+        (WTF::String::isEmpty):
+        (WTF::String::impl):
+        (WTF::String::length):
+        (WTF::String::characters):
+        (WTF::String::characters8):
+        (WTF::String::characters16):
+        (WTF::String::is8Bit):
+        (WTF::String::operator[]):
+        (WTF::String::find):
+        (WTF::String::reverseFind):
+        (WTF::String::findIgnoringCase):
+        (WTF::String::reverseFindIgnoringCase):
+        (WTF::String::contains):
+        (WTF::String::startsWith):
+        (WTF::String::endsWith):
+        (WTF::String::append):
+        (WTF::String::replace):
+        (WTF::String::makeLower):
+        (WTF::String::makeUpper):
+        (WTF::String::fill):
+        (WTF::String::left):
+        (WTF::String::right):
+        (WTF::String::createUninitialized):
+        (WTF::String::operator NSString*):
+        (WTF::String::fromUTF8):
+        (WTF::String::fromUTF8WithLatin1Fallback):
+        (WTF::String::defaultWritingDirection):
+        (WTF::String::containsOnlyWhitespace):
+        (WTF::String::isHashTableDeletedValue):
+        (WTF::operator+=):
+        (WTF::operator==):
+        (WTF::operator!=):
+        (WTF::equalIgnoringCase):
+        (WTF::equalPossiblyIgnoringCase):
+        (WTF::equalIgnoringNullity):
+        (WTF::operator!):
+        (WTF::swap):
+        (WTF::LChar):
+        (WTF::UChar):
+        (WTF::String::containsOnlyLatin1):
+        (WTF::nsStringNilIfEmpty):
+        (WTF::String::containsOnlyASCII):
+        (WTF::codePointCompareLessThan):
+        (WTF::find):
+        (WTF::reverseFind):
+        (WTF::append):
+        (WTF::appendNumber):
+        (WTF::isAllSpecialCharacters):
+        (WTF::String::isAllSpecialCharacters):
+        * wtf/threads/BinarySemaphore.cpp: Renamed from Source/JavaScriptCore/wtf/threads/BinarySemaphore.cpp.
+        (WTF):
+        (WTF::BinarySemaphore::BinarySemaphore):
+        (WTF::BinarySemaphore::~BinarySemaphore):
+        (WTF::BinarySemaphore::signal):
+        (WTF::BinarySemaphore::wait):
+        * wtf/threads/BinarySemaphore.h: Renamed from Source/JavaScriptCore/wtf/threads/BinarySemaphore.h.
+        (WTF):
+        (BinarySemaphore):
+        (WTF::BinarySemaphore::event):
+        * wtf/threads/win/BinarySemaphoreWin.cpp: Renamed from Source/JavaScriptCore/wtf/threads/win/BinarySemaphoreWin.cpp.
+        (WTF):
+        (WTF::BinarySemaphore::BinarySemaphore):
+        (WTF::BinarySemaphore::~BinarySemaphore):
+        (WTF::BinarySemaphore::signal):
+        (WTF::BinarySemaphore::wait):
+        * wtf/unicode/CharacterNames.h: Renamed from Source/JavaScriptCore/wtf/unicode/CharacterNames.h.
+        (Unicode):
+        * wtf/unicode/Collator.h: Renamed from Source/JavaScriptCore/wtf/unicode/Collator.h.
+        (WTF):
+        (Collator):
+        * wtf/unicode/CollatorDefault.cpp: Renamed from Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp.
+        (WTF):
+        (WTF::Collator::Collator):
+        (WTF::Collator::~Collator):
+        (WTF::Collator::setOrderLowerFirst):
+        (WTF::Collator::userDefault):
+        (WTF::Collator::collate):
+        * wtf/unicode/ScriptCodesFromICU.h: Renamed from Source/JavaScriptCore/wtf/unicode/ScriptCodesFromICU.h.
+        * wtf/unicode/UTF8.cpp: Renamed from Source/JavaScriptCore/wtf/unicode/UTF8.cpp.
+        (Unicode):
+        (WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
+        (WTF::Unicode::inlineUTF8SequenceLength):
+        (WTF::Unicode::UTF8SequenceLength):
+        (WTF::Unicode::decodeUTF8Sequence):
+        (WTF::Unicode::convertLatin1ToUTF8):
+        (WTF::Unicode::convertUTF16ToUTF8):
+        (WTF::Unicode::isLegalUTF8):
+        (WTF::Unicode::readUTF8Sequence):
+        (WTF::Unicode::convertUTF8ToUTF16):
+        (WTF::Unicode::calculateStringHashAndLengthFromUTF8):
+        (WTF::Unicode::equalUTF16WithUTF8):
+        * wtf/unicode/UTF8.h: Renamed from Source/JavaScriptCore/wtf/unicode/UTF8.h.
+        (Unicode):
+        * wtf/unicode/Unicode.h: Renamed from Source/JavaScriptCore/wtf/unicode/Unicode.h.
+        * wtf/unicode/UnicodeMacrosFromICU.h: Renamed from Source/JavaScriptCore/wtf/unicode/UnicodeMacrosFromICU.h.
+        * wtf/unicode/glib/UnicodeGLib.cpp: Renamed from Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp.
+        (Unicode):
+        (WTF::Unicode::foldCase):
+        (WTF::Unicode::getUTF16LengthFromUTF8):
+        (WTF::Unicode::convertCase):
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        (WTF::Unicode::direction):
+        (WTF::Unicode::umemcasecmp):
+        * wtf/unicode/glib/UnicodeGLib.h: Renamed from Source/JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h.
+        (Unicode):
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        (WTF::Unicode::toTitleCase):
+        (WTF::Unicode::isArabicChar):
+        (WTF::Unicode::isAlphanumeric):
+        (WTF::Unicode::isFormatChar):
+        (WTF::Unicode::isSeparatorSpace):
+        (WTF::Unicode::isPrintableChar):
+        (WTF::Unicode::isDigit):
+        (WTF::Unicode::isPunct):
+        (WTF::Unicode::hasLineBreakingPropertyComplexContext):
+        (WTF::Unicode::hasLineBreakingPropertyComplexContextOrIdeographic):
+        (WTF::Unicode::mirroredChar):
+        (WTF::Unicode::category):
+        (WTF::Unicode::isLower):
+        (WTF::Unicode::digitValue):
+        (WTF::Unicode::combiningClass):
+        (WTF::Unicode::decompositionType):
+        * wtf/unicode/icu/CollatorICU.cpp: Renamed from Source/JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp.
+        (WTF):
+        (WTF::cachedCollatorMutex):
+        (WTF::Collator::Collator):
+        (WTF::Collator::userDefault):
+        (WTF::Collator::~Collator):
+        (WTF::Collator::setOrderLowerFirst):
+        (WTF::Collator::collate):
+        (WTF::Collator::createCollator):
+        (WTF::Collator::releaseCollator):
+        * wtf/unicode/icu/UnicodeIcu.h: Renamed from Source/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h.
+        (Unicode):
+        (WTF::Unicode::foldCase):
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        (WTF::Unicode::toTitleCase):
+        (WTF::Unicode::isArabicChar):
+        (WTF::Unicode::isAlphanumeric):
+        (WTF::Unicode::isSeparatorSpace):
+        (WTF::Unicode::isPrintableChar):
+        (WTF::Unicode::isPunct):
+        (WTF::Unicode::hasLineBreakingPropertyComplexContext):
+        (WTF::Unicode::hasLineBreakingPropertyComplexContextOrIdeographic):
+        (WTF::Unicode::mirroredChar):
+        (WTF::Unicode::category):
+        (WTF::Unicode::direction):
+        (WTF::Unicode::isLower):
+        (WTF::Unicode::combiningClass):
+        (WTF::Unicode::decompositionType):
+        (WTF::Unicode::umemcasecmp):
+        * wtf/unicode/qt4/UnicodeQt4.h: Renamed from Source/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h.
+        (Properties):
+        (QUnicodeTables):
+        (Unicode):
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        (WTF::Unicode::toTitleCase):
+        (WTF::Unicode::foldCase):
+        (WTF::Unicode::isArabicChar):
+        (WTF::Unicode::isPrintableChar):
+        (WTF::Unicode::isSeparatorSpace):
+        (WTF::Unicode::isPunct):
+        (WTF::Unicode::isLower):
+        (WTF::Unicode::hasLineBreakingPropertyComplexContext):
+        (WTF::Unicode::mirroredChar):
+        (WTF::Unicode::combiningClass):
+        (WTF::Unicode::decompositionType):
+        (WTF::Unicode::umemcasecmp):
+        (WTF::Unicode::direction):
+        (WTF::Unicode::category):
+        * wtf/unicode/wince/UnicodeWinCE.cpp: Renamed from Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp.
+        (Unicode):
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        (WTF::Unicode::foldCase):
+        (WTF::Unicode::isPrintableChar):
+        (WTF::Unicode::isSpace):
+        (WTF::Unicode::isLetter):
+        (WTF::Unicode::isUpper):
+        (WTF::Unicode::isLower):
+        (WTF::Unicode::isDigit):
+        (WTF::Unicode::isPunct):
+        (WTF::Unicode::isAlphanumeric):
+        (WTF::Unicode::toTitleCase):
+        (WTF::Unicode::direction):
+        (WTF::Unicode::category):
+        (WTF::Unicode::decompositionType):
+        (WTF::Unicode::combiningClass):
+        (WTF::Unicode::mirroredChar):
+        (WTF::Unicode::digitValue):
+        * wtf/unicode/wince/UnicodeWinCE.h: Renamed from Source/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h.
+        (Unicode):
+        (WTF::Unicode::isSeparatorSpace):
+        (WTF::Unicode::isHighSurrogate):
+        (WTF::Unicode::isLowSurrogate):
+        (WTF::Unicode::isArabicChar):
+        (WTF::Unicode::hasLineBreakingPropertyComplexContext):
+        (WTF::Unicode::umemcasecmp):
+        (WTF::Unicode::surrogateToUcs4):
+        * wtf/url/api/ParsedURL.cpp: Renamed from Source/JavaScriptCore/wtf/url/api/ParsedURL.cpp.
+        (WTF):
+        (WTF::ParsedURL::ParsedURL):
+        (WTF::ParsedURL::isolatedCopy):
+        (WTF::ParsedURL::scheme):
+        (WTF::ParsedURL::username):
+        (WTF::ParsedURL::password):
+        (WTF::ParsedURL::host):
+        (WTF::ParsedURL::port):
+        (WTF::ParsedURL::path):
+        (WTF::ParsedURL::query):
+        (WTF::ParsedURL::fragment):
+        (WTF::ParsedURL::baseAsString):
+        (WTF::ParsedURL::segment):
+        * wtf/url/api/ParsedURL.h: Renamed from Source/JavaScriptCore/wtf/url/api/ParsedURL.h.
+        (WTF):
+        (ParsedURL):
+        (WTF::ParsedURL::ParsedURL):
+        (WTF::ParsedURL::isValid):
+        (WTF::ParsedURL::spec):
+        * wtf/url/api/URLString.h: Renamed from Source/JavaScriptCore/wtf/url/api/URLString.h.
+        (WTF):
+        (URLString):
+        (WTF::URLString::URLString):
+        (WTF::URLString::string):
+        * wtf/url/src/RawURLBuffer.h: Renamed from Source/JavaScriptCore/wtf/url/src/RawURLBuffer.h.
+        (WTF):
+        (RawURLBuffer):
+        (WTF::RawURLBuffer::RawURLBuffer):
+        (WTF::RawURLBuffer::~RawURLBuffer):
+        (WTF::RawURLBuffer::resize):
+        * wtf/url/src/URLBuffer.h: Renamed from Source/JavaScriptCore/wtf/url/src/URLBuffer.h.
+        (WTF):
+        (URLBuffer):
+        (WTF::URLBuffer::URLBuffer):
+        (WTF::URLBuffer::~URLBuffer):
+        (WTF::URLBuffer::at):
+        (WTF::URLBuffer::set):
+        (WTF::URLBuffer::capacity):
+        (WTF::URLBuffer::length):
+        (WTF::URLBuffer::data):
+        (WTF::URLBuffer::setLength):
+        (WTF::URLBuffer::append):
+        (WTF::URLBuffer::grow):
+        * wtf/url/src/URLCharacterTypes.cpp: Renamed from Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.cpp.
+        (WTF):
+        * wtf/url/src/URLCharacterTypes.h: Renamed from Source/JavaScriptCore/wtf/url/src/URLCharacterTypes.h.
+        (WTF):
+        (URLCharacterTypes):
+        (WTF::URLCharacterTypes::isQueryChar):
+        (WTF::URLCharacterTypes::isIPv4Char):
+        (WTF::URLCharacterTypes::isHexChar):
+        (WTF::URLCharacterTypes::isCharOfType):
+        * wtf/url/src/URLComponent.h: Renamed from Source/JavaScriptCore/wtf/url/src/URLComponent.h.
+        (WTF):
+        (URLComponent):
+        (WTF::URLComponent::URLComponent):
+        (WTF::URLComponent::fromRange):
+        (WTF::URLComponent::isValid):
+        (WTF::URLComponent::isNonEmpty):
+        (WTF::URLComponent::isEmptyOrInvalid):
+        (WTF::URLComponent::reset):
+        (WTF::URLComponent::operator==):
+        (WTF::URLComponent::begin):
+        (WTF::URLComponent::setBegin):
+        (WTF::URLComponent::length):
+        (WTF::URLComponent::setLength):
+        (WTF::URLComponent::end):
+        * wtf/url/src/URLEscape.cpp: Renamed from Source/JavaScriptCore/wtf/url/src/URLEscape.cpp.
+        (WTF):
+        * wtf/url/src/URLEscape.h: Renamed from Source/JavaScriptCore/wtf/url/src/URLEscape.h.
+        (WTF):
+        (WTF::appendURLEscapedCharacter):
+        * wtf/url/src/URLParser.h: Renamed from Source/JavaScriptCore/wtf/url/src/URLParser.h.
+        (WTF):
+        (URLParser):
+        (WTF::URLParser::isPossibleAuthorityTerminator):
+        (WTF::URLParser::parseAuthority):
+        (WTF::URLParser::extractScheme):
+        (WTF::URLParser::parseAfterScheme):
+        (WTF::URLParser::parseStandardURL):
+        (WTF::URLParser::parsePath):
+        (WTF::URLParser::parsePathURL):
+        (WTF::URLParser::parseMailtoURL):
+        (WTF::URLParser::parsePort):
+        (WTF::URLParser::extractFileName):
+        (WTF::URLParser::extractQueryKeyValue):
+        (WTF::URLParser::isURLSlash):
+        (WTF::URLParser::shouldTrimFromURL):
+        (WTF::URLParser::trimURL):
+        (WTF::URLParser::consecutiveSlashes):
+        (WTF::URLParser::isPortDigit):
+        (WTF::URLParser::nextAuthorityTerminator):
+        (WTF::URLParser::parseUserInfo):
+        (WTF::URLParser::parseServerInfo):
+        * wtf/url/src/URLQueryCanonicalizer.h: Renamed from Source/JavaScriptCore/wtf/url/src/URLQueryCanonicalizer.h.
+        (WTF):
+        (URLQueryCanonicalizer):
+        (WTF::URLQueryCanonicalizer::canonicalize):
+        (WTF::URLQueryCanonicalizer::isAllASCII):
+        (WTF::URLQueryCanonicalizer::isRaw8Bit):
+        (WTF::URLQueryCanonicalizer::appendRaw8BitQueryString):
+        (WTF::URLQueryCanonicalizer::convertToQueryEncoding):
+        * wtf/url/src/URLSegments.cpp: Renamed from Source/JavaScriptCore/wtf/url/src/URLSegments.cpp.
+        (WTF):
+        (WTF::URLSegments::length):
+        (WTF::URLSegments::charactersBefore):
+        * wtf/url/src/URLSegments.h: Renamed from Source/JavaScriptCore/wtf/url/src/URLSegments.h.
+        (WTF):
+        (URLSegments):
+        (WTF::URLSegments::URLSegments):
+        * wtf/win/MainThreadWin.cpp: Renamed from Source/JavaScriptCore/wtf/win/MainThreadWin.cpp.
+        (WTF):
+        (WTF::ThreadingWindowWndProc):
+        (WTF::initializeMainThreadPlatform):
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+        * wtf/win/OwnPtrWin.cpp: Renamed from Source/JavaScriptCore/wtf/win/OwnPtrWin.cpp.
+        (WTF):
+        (WTF::deleteOwnedPtr):
+        * wtf/wince/FastMallocWinCE.h: Renamed from Source/JavaScriptCore/wtf/wince/FastMallocWinCE.h.
+        (operator new):
+        (operator delete):
+        (operator new[]):
+        (operator delete[]):
+        (throw):
+        (WTF):
+        (Internal):
+        (WTF::Internal::fastMallocMatchValidationType):
+        (WTF::Internal::fastMallocMatchValidationValue):
+        (WTF::Internal::setFastMallocMatchValidationType):
+        (WTF::fastMallocMatchValidateMalloc):
+        (WTF::fastMallocMatchValidateFree):
+        * wtf/wince/MemoryManager.cpp: Renamed from Source/JavaScriptCore/wtf/wince/MemoryManager.cpp.
+        (WTF):
+        (WTF::memoryManager):
+        (WTF::MemoryManager::MemoryManager):
+        (WTF::MemoryManager::~MemoryManager):
+        (WTF::MemoryManager::createCompatibleBitmap):
+        (WTF::MemoryManager::createDIBSection):
+        (WTF::MemoryManager::m_malloc):
+        (WTF::MemoryManager::m_calloc):
+        (WTF::MemoryManager::m_realloc):
+        (WTF::MemoryManager::m_free):
+        (WTF::MemoryManager::resizeMemory):
+        (WTF::MemoryManager::allocate64kBlock):
+        (WTF::MemoryManager::free64kBlock):
+        (WTF::MemoryManager::onIdle):
+        (WTF::MemoryManager::virtualAlloc):
+        (WTF::MemoryManager::virtualFree):
+        (WTF::fastMalloc):
+        (WTF::fastCalloc):
+        (WTF::fastFree):
+        (WTF::fastRealloc):
+        (WTF::fastMallocForbid):
+        (WTF::fastMallocAllow):
+        (WTF::fastZeroedMalloc):
+        (WTF::tryFastMalloc):
+        (WTF::tryFastZeroedMalloc):
+        (WTF::tryFastCalloc):
+        (WTF::tryFastRealloc):
+        (WTF::fastStrDup):
+        * wtf/wince/MemoryManager.h: Renamed from Source/JavaScriptCore/wtf/wince/MemoryManager.h.
+        (WTF):
+        (MemoryManager):
+        (WTF::MemoryManager::allocationCanFail):
+        (WTF::MemoryManager::setAllocationCanFail):
+        (MemoryAllocationCanFail):
+        (WTF::MemoryAllocationCanFail::MemoryAllocationCanFail):
+        (WTF::MemoryAllocationCanFail::~MemoryAllocationCanFail):
+        (MemoryAllocationCannotFail):
+        (WTF::MemoryAllocationCannotFail::MemoryAllocationCannotFail):
+        (WTF::MemoryAllocationCannotFail::~MemoryAllocationCannotFail):
+        * wtf/wx/MainThreadWx.cpp: Renamed from Source/JavaScriptCore/wtf/wx/MainThreadWx.cpp.
+        (wxCallAfter):
+        (wxCallAfter::wxCallAfter):
+        (wxCallAfter::OnCallback):
+        (WTF):
+        (WTF::initializeMainThreadPlatform):
+        (WTF::scheduleDispatchFunctionsOnMainThread):
+        * wtf/wx/StringWx.cpp: Renamed from Source/JavaScriptCore/wtf/wx/StringWx.cpp.
+        (WTF):
+        (WTF::String::String):
+        (WTF::String::operator wxString):
+
+2012-03-22  Hyowon Kim  <hw1008.kim@samsung.com>
+
+        [EFL] Add PageClientEfl to WebCoreSupport.
+        https://bugs.webkit.org/show_bug.cgi?id=80748
+
+        Reviewed by Noam Rosenthal.
+
+        * wtf/Platform.h: Disable accelerated compositing. It's not ready yet.
+
+2012-03-21  Beth Dakin  <bdakin@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=80322
+        Implement image-set
+
+        Reviewed by Dean Jackson.
+
+        For the time being, image-set is opt-in since the implementation is 
+        incomplete. 
+
+        Add an ENABLE flag for image-set.
+        * wtf/Platform.h:
+
+2012-03-21  Jessie Berlin  <jberlin@apple.com>
+
+        Fix the Windows build after r111504.
+
+        * WTF.vcproj/WTF.vcproj:
+        Platform.h was moved to Source/WTF.
+        * WTF.vcproj/copy-files.cmd:
+        Copy Platform.h from its new source location. This separate copy will not be necessary once
+        the full move is done and all the headers are being copied at once from the new locations.
+
+2012-03-21  Jessie Berlin  <jberlin@apple.com>
+
+        WTF headers should be in $(ConfigurationBuildDir)\include\private\wtf, not
+        $(ConfigurationBuildDir)\include\private\JavaScriptCore\wtf.
+        https://bugs.webkit.org/show_bug.cgi?id=81739
+
+        Reviewed by Dan Bernstein.
+
+        * WTF.vcproj/copy-files.cmd:
+        Copy the headers to private/include/wtf instead of private/include/JavaScriptCore/wtf.
+
+2012-03-20  Eric Seidel  <eric@webkit.org>
+
+        Move wtf/Platform.h from JavaScriptCore to Source/WTF/wtf
+        https://bugs.webkit.org/show_bug.cgi?id=80911
+
+        Reviewed by Adam Barth.
+
+        Update build systems to account for the new location of Platform.h
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.vcproj/work-around-vs-dependency-tracking-bugs.py:
+        (react_to_vsprops_changes):
+        * WTF.xcodeproj/project.pbxproj:
+        * config.h: I don't think this change is 100% correct (but seemed to be needed to make qt-wk2 build)
+         - This dependency on JSC should be removed regardless (in a later patch).
+        * wtf/Platform.h: Renamed from Source/JavaScriptCore/wtf/Platform.h.
+
+2012-03-20  Steve Falkenburg  <sfalken@apple.com>
+
+        Move WTF-related Windows project files out of JavaScriptCore
+        https://bugs.webkit.org/show_bug.cgi?id=80680
+        
+        This change only moves the vcproj and related files from JavaScriptCore/JavaScriptCore.vcproj/WTF.
+        It does not move any source code. This is in preparation for the WTF source move out of
+        JavaScriptCore.
+
+        Reviewed by Jessie Berlin.
+
+        * WTF.vcproj: Added.
+        * WTF.vcproj/WTF.vcproj: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj.
+        * WTF.vcproj/WTFCommon.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops.
+        * WTF.vcproj/WTFDebug.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFDebug.vsprops.
+        * WTF.vcproj/WTFDebugAll.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFDebugAll.vsprops.
+        * WTF.vcproj/WTFDebugCairoCFLite.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFDebugCairoCFLite.vsprops.
+        * WTF.vcproj/WTFGenerated.make: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFGenerated.make.
+        * WTF.vcproj/WTFGenerated.vcproj: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFGenerated.vcproj.
+        * WTF.vcproj/WTFGeneratedCommon.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFGeneratedCommon.vsprops.
+        * WTF.vcproj/WTFGeneratedDebug.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFGeneratedDebug.vsprops.
+        * WTF.vcproj/WTFGeneratedDebugAll.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFGeneratedDebugAll.vsprops.
+        * WTF.vcproj/WTFGeneratedDebugCairoCFLite.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFGeneratedDebugCairoCFLite.vsprops.
+        * WTF.vcproj/WTFGeneratedProduction.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFGeneratedProduction.vsprops.
+        * WTF.vcproj/WTFGeneratedRelease.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFGeneratedRelease.vsprops.
+        * WTF.vcproj/WTFGeneratedReleaseCairoCFLite.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFGeneratedReleaseCairoCFLite.vsprops.
+        * WTF.vcproj/WTFPostBuild.cmd: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFPostBuild.cmd.
+        * WTF.vcproj/WTFPreBuild.cmd: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFPreBuild.cmd.
+        * WTF.vcproj/WTFProduction.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFProduction.vsprops.
+        * WTF.vcproj/WTFRelease.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFRelease.vsprops.
+        * WTF.vcproj/WTFReleaseCairoCFLite.vsprops: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFReleaseCairoCFLite.vsprops.
+        * WTF.vcproj/build-generated-files.sh: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/build-generated-files.sh.
+        * WTF.vcproj/copy-files.cmd: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/copy-files.cmd.
+        * WTF.vcproj/work-around-vs-dependency-tracking-bugs.py: Copied from Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/work-around-vs-dependency-tracking-bugs.py.
+
+2012-03-20  Peter Beverloo  <peter@chromium.org>
+
+        [Chromium] Fix the Android build by building NEWWTF for host
+        https://bugs.webkit.org/show_bug.cgi?id=81643
+
+        Reviewed by Tony Gentilcore.
+
+        Chromium for Android builds the ImageDiff target for the host architecture,
+        so all dependencies it has need to be able to build for host as well.
+        r111258 added (new)WTF as a dependency instead of just including the
+        header files, so make it possible to build the newwtf target for host.
+
+        * WTF.gyp/WTF.gyp:
+
+2012-03-19  Dan Bernstein  <mitz@apple.com>
+
+        Set the svn:ignore property on the Xcode project.
+
+        * WTF.xcodeproj: Added property svn:ignore.
+
+2012-03-16  Mark Rowe  <mrowe@apple.com>
+
+        Build fix. Do not preserve owner and group information when installing the WTF headers.
+
+        * WTF.xcodeproj/project.pbxproj:
+
+2012-03-07  Mark Rowe  <mrowe@apple.com>
+
+        Teach make to build WTF.
+
+        * Makefile: Added.
+
+2012-02-11  Filip Pizlo  <fpizlo@apple.com>
+
+        It should be possible to send all JSC debug logging to a file
+        https://bugs.webkit.org/show_bug.cgi?id=78418
+
+        Reviewed by Sam Weinig.
+        
+        Introduced wtf/DataLog, which defines WTF::dataFile, WTF::dataLog,
+        and WTF::dataLogV. Changed all debugging- and profiling-related printfs
+        to use WTF::dataLog() or one of its friends. By default, debug logging
+        goes to stderr, unless you change the setting in wtf/DataLog.cpp.
+
+        * WTF.pro:
+
+2012-02-03  Simon Hausmann  <simon.hausmann@nokia.com>
+
+        [Qt] Fix build when cross-compiling
+        https://bugs.webkit.org/show_bug.cgi?id=77634
+
+        Reviewed by Tor Arne Vestbø.
+
+        * WTF.pri: Don't use icu-config for determining the library search
+        path and libraries needed for ICU. Either we use icu-config for includes
+        _and_ libraries or we don't. Right now we assume that icu is a system library
+        and expect the headers in the default include search pathes (/usr/include for example).
+        However we use icu-config to figure out where the libraries are, which breaks when
+        cross-compiling, because icu-config isn't cross-compile friendly (I wish icu was using
+        pkg-config). I think for the time being we should require ICU as a _system_ library,
+        which implies the header and library availability in default search paths. This also
+        makes the build succeed when cross-compiling with --sysroot.
+
+2012-01-27  Zeno Albisser  <zeno@webkit.org>
+
+        [Qt][Mac] Build fails after adding ICU support (r105997).
+        https://bugs.webkit.org/show_bug.cgi?id=77118
+
+        Link to libicucore if platform Mac.
+
+        Reviewed by Tor Arne Vestbø.
+
+        * WTF.pri:
+
+2012-01-26  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        [Qt] Use ICU if available
+        https://bugs.webkit.org/show_bug.cgi?id=76821
+
+        Reviewed by Simon Hausmann.
+
+        Adding libicu dependencies for a Qt5 based build.
+
+        * WTF.pri:
+
+2012-01-26  Csaba Osztrogonác  <ossy@webkit.org>
+
+        [Qt][Win] One more speculative buildfix after r105970.
+
+        * WTF.pri:
+
+2012-01-26  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        Not reviewed. Try to fix Qt/Win build by building OwnPtrWin.cpp into the WTF library.
+
+        * WTF.pro:
+
+2012-01-19  Joi Sigurdsson  <joi@chromium.org>
+
+        Enable use of precompiled headers in Chromium port on Windows.
+
+        Bug 76381 - Use precompiled headers in Chromium port on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=76381
+
+        Reviewed by Tony Chang.
+
+        * WTF.gyp/WTF.gyp: Include WinPrecompile.gypi.
+
+2012-01-18  Roland Takacs  <takacs.roland@stud.u-szeged.hu>
+
+        Cross-platform processor core counter
+        https://bugs.webkit.org/show_bug.cgi?id=76530
+
+        Reviewed by Zoltan Herczeg.
+
+        Two files have been added to the project, namely NumberOfCores.h/cpp,
+        that include a CPU core number determining function.
+
+        * WTF.pro:
+
+2012-01-17  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        Uint8ClampedArray support
+        https://bugs.webkit.org/show_bug.cgi?id=74455
+
+        Reviewed by Filip Pizlo.
+
+        * WTF.pro:
+
+2012-01-13  Alexis Menard  <alexis.menard@openbossa.org>
+
+        Unreviewed build fix for Qt SnowLeopard build bot.
+
+        This is a workaround for the moment.
+
+        * wtf/Platform.h:
+
+2012-01-12  Simon Hausmann  <simon.hausmann@nokia.com>
+
+        Make the new WTF module build on Qt
+        https://bugs.webkit.org/show_bug.cgi?id=76163
+
+        Reviewed by Tor Arne Vestbø.
+
+        With this change the WTF sources are built _here_ but _from_ their old location using a VPATH.
+
+        * WTF.pri: Renamed from Source/JavaScriptCore/wtf/wtf.pri.
+        * WTF.pro: Renamed from Source/JavaScriptCore/wtf/wtf.pro.
+        * config.h: Bring this file in sync with JavaScriptCore/config.h with regards to the inclusion
+        / definition of the export macros.
+
+2012-01-06  Benjamin Poulain  <bpoulain@apple.com>
+
+        [Mac] Sort the resources of WTF.xcodeproj
+        https://bugs.webkit.org/show_bug.cgi?id=75639
+
+        Reviewed by Andreas Kling.
+
+        * WTF.xcodeproj/project.pbxproj:
+
+2012-01-06  Eric Seidel  <eric@webkit.org> and Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
+
+        Make the new WTF module build on Gtk
+        https://bugs.webkit.org/show_bug.cgi?id=75669
+
+        * GNUmakefile.am: Added.
+        * GNUmakefile.list.am: Added.
+
+2011-11-19  Adam Barth  <abarth@webkit.org>
+
+        Integrate Source/WTF with the Chromium build system
+        https://bugs.webkit.org/show_bug.cgi?id=72790
+
+        Reviewed by Eric Seidel.
+
+        Rename the target in this file to "newwtf" to avoid naming conflicts.
+
+        * WTF.gyp/WTF.gyp:
+
+2011-11-19  Mark Rowe  <mrowe@apple.com>
+
+        WTF should have an Xcode project
+        https://bugs.webkit.org/show_bug.cgi?id=71752
+
+        Reviewed by Adam Barth.
+
+        This adds an Xcode project that includes only Stub.cpp and Stub.h.
+        They’re built in to a library at the appropriate path for each
+        configuration (WebKitBuild/{Debug,Release}/libWTF.a and
+        /usr/local/lib/libWTF.a) and headers are installed in to the
+        appropriate location (WebKitBuild/{Debug,Release}/usr/local/include/wtf
+        and /usr/local/include/wtf). I tested building WTF in this project and
+        everything appears to build except for DateMath.cpp (due to bug 71747).
+        I have not yet done any work on making JavaScriptCore and other
+        projects use the built products of this new project.
+
+        * Configurations: Added.
+        * Configurations/Base.xcconfig: Copied from Source/JavaScriptCore/Configurations/Base.xcconfig.
+        * Configurations/CompilerVersion.xcconfig: Copied from Source/JavaScriptCore/Configurations/CompilerVersion.xcconfig.
+        * Configurations/DebugRelease.xcconfig: Copied from Source/JavaScriptCore/Configurations/DebugRelease.xcconfig.
+        * Configurations/WTF.xcconfig: Copied from Source/WebKit2/Configurations/Shim.xcconfig.
+        * WTF.xcodeproj: Added.
+        * WTF.xcodeproj/project.pbxproj: Added.
+        * config.h: Copied from Source/JavaScriptCore/config.h.
+        * icu: Added.
+        * icu/LICENSE: Copied from Source/JavaScriptCore/icu/LICENSE.
+        * icu/README: Copied from Source/JavaScriptCore/icu/README.
+        * icu/unicode: Added.
+        * icu/unicode/parseerr.h: Copied from Source/JavaScriptCore/icu/unicode/parseerr.h.
+        * icu/unicode/platform.h: Copied from Source/JavaScriptCore/icu/unicode/platform.h.
+        * icu/unicode/putil.h: Copied from Source/JavaScriptCore/icu/unicode/putil.h.
+        * icu/unicode/uchar.h: Copied from Source/JavaScriptCore/icu/unicode/uchar.h.
+        * icu/unicode/ucnv.h: Copied from Source/JavaScriptCore/icu/unicode/ucnv.h.
+        * icu/unicode/ucnv_err.h: Copied from Source/JavaScriptCore/icu/unicode/ucnv_err.h.
+        * icu/unicode/ucol.h: Copied from Source/JavaScriptCore/icu/unicode/ucol.h.
+        * icu/unicode/uconfig.h: Copied from Source/JavaScriptCore/icu/unicode/uconfig.h.
+        * icu/unicode/uenum.h: Copied from Source/JavaScriptCore/icu/unicode/uenum.h.
+        * icu/unicode/uiter.h: Copied from Source/JavaScriptCore/icu/unicode/uiter.h.
+        * icu/unicode/uloc.h: Copied from Source/JavaScriptCore/icu/unicode/uloc.h.
+        * icu/unicode/umachine.h: Copied from Source/JavaScriptCore/icu/unicode/umachine.h.
+        * icu/unicode/unorm.h: Copied from Source/JavaScriptCore/icu/unicode/unorm.h.
+        * icu/unicode/urename.h: Copied from Source/JavaScriptCore/icu/unicode/urename.h.
+        * icu/unicode/uscript.h: Copied from Source/JavaScriptCore/icu/unicode/uscript.h.
+        * icu/unicode/uset.h: Copied from Source/JavaScriptCore/icu/unicode/uset.h.
+        * icu/unicode/ustring.h: Copied from Source/JavaScriptCore/icu/unicode/ustring.h.
+        * icu/unicode/utf.h: Copied from Source/JavaScriptCore/icu/unicode/utf.h.
+        * icu/unicode/utf16.h: Copied from Source/JavaScriptCore/icu/unicode/utf16.h.
+        * icu/unicode/utf8.h: Copied from Source/JavaScriptCore/icu/unicode/utf8.h.
+        * icu/unicode/utf_old.h: Copied from Source/JavaScriptCore/icu/unicode/utf_old.h.
+        * icu/unicode/utypes.h: Copied from Source/JavaScriptCore/icu/unicode/utypes.h.
+        * icu/unicode/uversion.h: Copied from Source/JavaScriptCore/icu/unicode/uversion.h.
+
+2011-11-03  Adam Barth  <abarth@webkit.org>
+
+        Add Stub.h and Stub.cpp to Source-level WTF project
+        https://bugs.webkit.org/show_bug.cgi?id=71497
+
+        Reviewed by Eric Seidel.
+
+        This patch adds some stub files and a skelton GYP build file as a
+        starting point for the new Source-level WTF project.  Other build
+        systems and actual code will arrive in future patches.
+
+        * Stub.cpp: Added.
+        * Stub.h: Added.
+        * WTF.gyp/WTF.gyp: Added.
+        * WTF.gypi: Added.
+
+2011-11-02  Adam Barth  <abarth@webkit.org>
+
+        Add stubs for WTF and Platform
+        https://bugs.webkit.org/show_bug.cgi?id=71492
+
+        Reviewed by Eric Seidel.
+
+        This patch creates the WTF directory, which begins the process of
+        moving WTF out of JavaScriptCore.
diff --git a/Source/WTF/Configurations/Base.xcconfig b/Source/WTF/Configurations/Base.xcconfig
new file mode 100644
index 0000000..5f00c83
--- /dev/null
+++ b/Source/WTF/Configurations/Base.xcconfig
@@ -0,0 +1,109 @@
+// Copyright (C) 2009, 2010, 2011 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. ``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
+// 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. 
+
+CLANG_CXX_LANGUAGE_STANDARD = gnu++0x;
+CLANG_CXX_LIBRARY = libc++;
+CLANG_WARN_CXX0X_EXTENSIONS = NO;
+DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
+GCC_C_LANGUAGE_STANDARD = gnu99;
+GCC_DEBUGGING_SYMBOLS = default;
+GCC_DYNAMIC_NO_PIC = NO;
+GCC_ENABLE_CPP_EXCEPTIONS = NO;
+GCC_ENABLE_CPP_RTTI = NO;
+GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+GCC_ENABLE_OBJC_GC = $(GCC_ENABLE_OBJC_GC_$(PLATFORM_NAME));
+GCC_ENABLE_OBJC_GC_iphoneos = NO;
+GCC_ENABLE_OBJC_GC_iphonesimulator = NO;
+GCC_ENABLE_OBJC_GC_macosx = supported;
+GCC_ENABLE_SYMBOL_SEPARATION = NO;
+GCC_FAST_OBJC_DISPATCH = YES;
+GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
+GCC_MODEL_TUNING = $(GCC_MODEL_TUNING_$(PLATFORM_NAME));
+GCC_MODEL_TUNING_macosx = G5;
+GCC_OBJC_CALL_CXX_CDTORS = YES;
+GCC_PRECOMPILE_PREFIX_HEADER = YES;
+GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST HAVE_HEADER_DETECTION_H $(GCC_PREPROCESSOR_DEFINITIONS);
+GCC_STRICT_ALIASING = YES;
+GCC_THREADSAFE_STATICS = NO;
+GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
+GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
+GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
+GCC_WARN_SIGN_COMPARE = YES;
+LINKER_DISPLAYS_MANGLED_NAMES = YES;
+PREBINDING = NO;
+VALID_ARCHS = $(VALID_ARCHS_$(PLATFORM_NAME));
+VALID_ARCHS_iphoneos = $(ARCHS_STANDARD_32_BIT);
+VALID_ARCHS_iphonesimulator = $(ARCHS_STANDARD_32_BIT);
+VALID_ARCHS_macosx = i386 ppc x86_64 ppc64 $(ARCHS_UNIVERSAL_IPHONE_OS);
+WARNING_CFLAGS_BASE = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare;
+WARNING_CFLAGS = $(WARNING_CFLAGS_$(PLATFORM_NAME));
+WARNING_CFLAGS_iphoneos = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
+WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
+WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_macosx_$(CURRENT_ARCH));
+WARNING_CFLAGS_macosx_ = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
+WARNING_CFLAGS_macosx_i386 = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
+WARNING_CFLAGS_macosx_ppc = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
+// FIXME: JavaScriptCore 64-bit builds should build with -Wshorten-64-to-32
+WARNING_CFLAGS_macosx_x86_64 = $(WARNING_CFLAGS_BASE);
+HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include $(DSTROOT)/usr/local/include icu $(HEADER_SEARCH_PATHS);
+
+
+TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR);
+
+
+JAVASCRIPTCORE_FRAMEWORKS_DIR = $(JAVASCRIPTCORE_FRAMEWORKS_DIR_$(PLATFORM_NAME));
+JAVASCRIPTCORE_FRAMEWORKS_DIR_iphoneos = $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
+JAVASCRIPTCORE_FRAMEWORKS_DIR_iphonesimulator = $(JAVASCRIPTCORE_FRAMEWORKS_DIR_iphoneos);
+JAVASCRIPTCORE_FRAMEWORKS_DIR_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks;
+
+
+// DEBUG_DEFINES, GCC_OPTIMIZATION_LEVEL, STRIP_INSTALLED_PRODUCT and DEAD_CODE_STRIPPING vary between the debug and normal variants.
+// We set up the values for each variant here, and have the Debug configuration in the Xcode project use the _debug variant.
+DEBUG_DEFINES_debug = ;
+DEBUG_DEFINES_normal = NDEBUG;
+DEBUG_DEFINES = $(DEBUG_DEFINES_$(CURRENT_VARIANT));
+
+GCC_OPTIMIZATION_LEVEL = $(GCC_OPTIMIZATION_LEVEL_$(CURRENT_VARIANT));
+GCC_OPTIMIZATION_LEVEL_normal = 3;
+GCC_OPTIMIZATION_LEVEL_debug = 0;
+
+STRIP_INSTALLED_PRODUCT = $(STRIP_INSTALLED_PRODUCT_$(CURRENT_VARIANT));
+STRIP_INSTALLED_PRODUCT_normal = YES;
+STRIP_INSTALLED_PRODUCT_debug = NO;
+
+DEAD_CODE_STRIPPING_debug = NO;
+DEAD_CODE_STRIPPING_normal = YES;
+DEAD_CODE_STRIPPING = $(DEAD_CODE_STRIPPING_$(CURRENT_VARIANT));
+
+TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+TARGETING_SAME_OS_X_VERSION_1070_1070 = YES;
+TARGETING_SAME_OS_X_VERSION_1080_1080 = YES;
+TARGETING_SAME_OS_X_VERSION_1090_1090 = YES;
+
+// Don't build against an SDK unless we're targeting an older OS version.
+SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION));
+SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx;
diff --git a/Source/WTF/Configurations/CopyWTFHeaders.xcconfig b/Source/WTF/Configurations/CopyWTFHeaders.xcconfig
new file mode 100644
index 0000000..112af7a
--- /dev/null
+++ b/Source/WTF/Configurations/CopyWTFHeaders.xcconfig
@@ -0,0 +1,26 @@
+// Copyright (C) 2011 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. ``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
+// 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. 
+
+
+PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/wtf;
+INSTALLHDRS_SCRIPT_PHASE = YES;
diff --git a/Source/WTF/Configurations/DebugRelease.xcconfig b/Source/WTF/Configurations/DebugRelease.xcconfig
new file mode 100644
index 0000000..b4d3522
--- /dev/null
+++ b/Source/WTF/Configurations/DebugRelease.xcconfig
@@ -0,0 +1,42 @@
+// Copyright (C) 2009, 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. ``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
+// 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 "Base.xcconfig"
+
+ARCHS = $(ARCHS_$(PLATFORM_NAME));
+ARCHS_iphoneos = $(ARCHS_UNIVERSAL_IPHONE_OS);
+ARCHS_iphonesimulator = $(NATIVE_ARCH);
+ARCHS_macosx = $(ARCHS_STANDARD_32_64_BIT);
+
+ONLY_ACTIVE_ARCH = YES;
+
+MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(PLATFORM_NAME));
+MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.5;
+MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.5;
+MACOSX_DEPLOYMENT_TARGET_macosx = $(MACOSX_DEPLOYMENT_TARGET_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+MACOSX_DEPLOYMENT_TARGET_macosx_1070 = 10.7;
+MACOSX_DEPLOYMENT_TARGET_macosx_1080 = 10.8;
+MACOSX_DEPLOYMENT_TARGET_macosx_1090 = 10.9;
+
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
+DEBUG_INFORMATION_FORMAT = dwarf;
diff --git a/Source/WTF/Configurations/WTF.xcconfig b/Source/WTF/Configurations/WTF.xcconfig
new file mode 100644
index 0000000..8d7887e
--- /dev/null
+++ b/Source/WTF/Configurations/WTF.xcconfig
@@ -0,0 +1,27 @@
+// Copyright (C) 2011 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. ``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
+// 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. 
+
+EXECUTABLE_PREFIX = lib;
+PRODUCT_NAME = WTF;
+
+GCC_SYMBOLS_PRIVATE_EXTERN = YES;
diff --git a/Source/WTF/GNUmakefile.am b/Source/WTF/GNUmakefile.am
new file mode 100644
index 0000000..7eab5c6
--- /dev/null
+++ b/Source/WTF/GNUmakefile.am
@@ -0,0 +1,38 @@
+include $(srcdir)/Source/WTF/GNUmakefile.list.am
+
+noinst_LTLIBRARIES += \
+	libWTF.la
+
+libWTF_la_LDFLAGS = \
+	$(no_undefined)
+
+libWTF_la_SOURCES = \
+	$(wtf_sources)
+
+libWTF_la_LIBADD = \
+	$(UNICODE_LIBS) \
+	$(GLIB_LIBS) \
+	$(WINMM_LIBS) \
+	-lpthread
+
+if TARGET_WIN32
+# OwnPtrWin.cpp needs the symbols from gdi32 dll
+libWTF_la_LIBADD += -lgdi32
+endif
+
+libWTF_la_CXXFLAGS = \
+	$(global_cxxflags) \
+	$(libWTF_la_CFLAGS)
+
+libWTF_la_CFLAGS = \
+	-fstrict-aliasing \
+	-O3 \
+	$(global_cflags) \
+	$(GLIB_CFLAGS) \
+	$(UNICODE_CFLAGS)
+
+libWTF_la_CPPFLAGS = \
+	$(global_cppflags) \
+	-I$(srcdir)/Source \
+	-I$(srcdir)/Source/WTF \
+	-I$(srcdir)/Source/WTF/wtf
diff --git a/Source/WTF/GNUmakefile.list.am b/Source/WTF/GNUmakefile.list.am
new file mode 100644
index 0000000..9d4f0d7
--- /dev/null
+++ b/Source/WTF/GNUmakefile.list.am
@@ -0,0 +1,277 @@
+wtf_sources += \
+    Source/WTF/config.h \
+    Source/WTF/wtf/Platform.h \
+    Source/WTF/wtf/ASCIICType.h \
+    Source/WTF/wtf/AVLTree.h \
+    Source/WTF/wtf/Alignment.h \
+    Source/WTF/wtf/AlwaysInline.h \
+    Source/WTF/wtf/ArrayBuffer.cpp \
+    Source/WTF/wtf/ArrayBuffer.h \
+    Source/WTF/wtf/ArrayBufferView.cpp \
+    Source/WTF/wtf/ArrayBufferView.h \
+    Source/WTF/wtf/Assertions.cpp \
+    Source/WTF/wtf/Assertions.h \
+    Source/WTF/wtf/Atomics.h \
+    Source/WTF/wtf/BitArray.h \
+    Source/WTF/wtf/BitVector.cpp \
+    Source/WTF/wtf/BitVector.h \
+    Source/WTF/wtf/Bitmap.h \
+    Source/WTF/wtf/BlockStack.h \
+    Source/WTF/wtf/BloomFilter.h \
+    Source/WTF/wtf/BoundsCheckedPointer.h \
+    Source/WTF/wtf/BumpPointerAllocator.h \
+    Source/WTF/wtf/ByteOrder.h \
+    Source/WTF/wtf/CheckedArithmetic.h \
+    Source/WTF/wtf/CheckedBoolean.h \
+    Source/WTF/wtf/Compiler.h \
+    Source/WTF/wtf/Complex.h \
+    Source/WTF/wtf/CryptographicallyRandomNumber.cpp \
+    Source/WTF/wtf/CryptographicallyRandomNumber.h \
+    Source/WTF/wtf/CurrentTime.cpp \
+    Source/WTF/wtf/CurrentTime.h \
+    Source/WTF/wtf/DataLog.cpp \
+    Source/WTF/wtf/DataLog.h \
+    Source/WTF/wtf/DateMath.cpp \
+    Source/WTF/wtf/DateMath.h \
+    Source/WTF/wtf/DecimalNumber.cpp \
+    Source/WTF/wtf/DecimalNumber.h \
+    Source/WTF/wtf/Decoder.h \
+    Source/WTF/wtf/Deque.h \
+    Source/WTF/wtf/DisallowCType.h \
+    Source/WTF/wtf/DoublyLinkedList.h \
+    Source/WTF/wtf/DynamicAnnotations.cpp \
+    Source/WTF/wtf/DynamicAnnotations.h \
+    Source/WTF/wtf/Encoder.h \
+    Source/WTF/wtf/ExportMacros.h \
+    Source/WTF/wtf/FastAllocBase.h \
+    Source/WTF/wtf/FastBitVector.h \
+    Source/WTF/wtf/FastMalloc.cpp \
+    Source/WTF/wtf/FastMalloc.h \
+    Source/WTF/wtf/FixedArray.h \
+    Source/WTF/wtf/Float32Array.h \
+    Source/WTF/wtf/Float64Array.h \
+    Source/WTF/wtf/Forward.h \
+    Source/WTF/wtf/Functional.h \
+    Source/WTF/wtf/GetPtr.h \
+    Source/WTF/wtf/GregorianDateTime.cpp \
+    Source/WTF/wtf/GregorianDateTime.h \
+    Source/WTF/wtf/HashCountedSet.h \
+    Source/WTF/wtf/HashFunctions.h \
+    Source/WTF/wtf/HashIterators.h \
+    Source/WTF/wtf/HashMap.h \
+    Source/WTF/wtf/HashSet.h \
+    Source/WTF/wtf/HashTable.cpp \
+    Source/WTF/wtf/HashTable.h \
+    Source/WTF/wtf/HashTraits.h \
+    Source/WTF/wtf/HexNumber.h \
+    Source/WTF/wtf/InlineASM.h \
+    Source/WTF/wtf/Int16Array.h \
+    Source/WTF/wtf/Int32Array.h \
+    Source/WTF/wtf/Int8Array.h \
+    Source/WTF/wtf/IntegralTypedArrayBase.h \
+    Source/WTF/wtf/ListHashSet.h \
+    Source/WTF/wtf/ListRefPtr.h \
+    Source/WTF/wtf/Locker.h \
+    Source/WTF/wtf/MD5.cpp \
+    Source/WTF/wtf/MD5.h \
+    Source/WTF/wtf/MainThread.cpp \
+    Source/WTF/wtf/MainThread.h \
+    Source/WTF/wtf/MallocZoneSupport.h \
+    Source/WTF/wtf/MathExtras.h \
+    Source/WTF/wtf/MediaTime.h \
+    Source/WTF/wtf/MediaTime.cpp \
+    Source/WTF/wtf/MemoryInstrumentation.h \
+    Source/WTF/wtf/MemoryInstrumentationArrayBufferView.h \
+    Source/WTF/wtf/MemoryInstrumentationHashCountedSet.h \
+    Source/WTF/wtf/MemoryInstrumentationHashMap.h \
+    Source/WTF/wtf/MemoryInstrumentationHashSet.h \
+    Source/WTF/wtf/MemoryInstrumentationListHashSet.h \
+    Source/WTF/wtf/MemoryInstrumentationParsedURL.h \
+    Source/WTF/wtf/MemoryInstrumentationSequence.h \
+    Source/WTF/wtf/MemoryInstrumentationString.h \
+    Source/WTF/wtf/MemoryInstrumentationVector.h \
+    Source/WTF/wtf/MessageQueue.h \
+    Source/WTF/wtf/MetaAllocator.cpp \
+    Source/WTF/wtf/MetaAllocator.h \
+    Source/WTF/wtf/MetaAllocatorHandle.h \
+    Source/WTF/wtf/NonCopyingSort.h \
+    Source/WTF/wtf/Noncopyable.h \
+    Source/WTF/wtf/NotFound.h \
+    Source/WTF/wtf/NullPtr.h \
+    Source/WTF/wtf/NumberOfCores.cpp \
+    Source/WTF/wtf/NumberOfCores.h \
+    Source/WTF/wtf/RAMSize.cpp \
+    Source/WTF/wtf/RAMSize.h \
+    Source/WTF/wtf/OSAllocator.h \
+    Source/WTF/wtf/OSRandomSource.cpp \
+    Source/WTF/wtf/OSRandomSource.h \
+    Source/WTF/wtf/OwnArrayPtr.h \
+    Source/WTF/wtf/OwnPtr.h \
+    Source/WTF/wtf/OwnPtrCommon.h \
+    Source/WTF/wtf/PackedIntVector.h \
+    Source/WTF/wtf/PageAllocation.h \
+    Source/WTF/wtf/PageAllocationAligned.cpp \
+    Source/WTF/wtf/PageAllocationAligned.h \
+    Source/WTF/wtf/PageBlock.cpp \
+    Source/WTF/wtf/PageBlock.h \
+    Source/WTF/wtf/PageReservation.h \
+    Source/WTF/wtf/ParallelJobs.h \
+    Source/WTF/wtf/ParallelJobsGeneric.cpp \
+    Source/WTF/wtf/ParallelJobsGeneric.h \
+    Source/WTF/wtf/ParallelJobsLibdispatch.h \
+    Source/WTF/wtf/ParallelJobsOpenMP.h \
+    Source/WTF/wtf/PassOwnArrayPtr.h \
+    Source/WTF/wtf/PassOwnPtr.h \
+    Source/WTF/wtf/PassRefPtr.h \
+    Source/WTF/wtf/PassTraits.h \
+    Source/WTF/wtf/Platform.h \
+    Source/WTF/wtf/PossiblyNull.h \
+    Source/WTF/wtf/RandomNumber.cpp \
+    Source/WTF/wtf/RandomNumber.h \
+    Source/WTF/wtf/RandomNumberSeed.h \
+    Source/WTF/wtf/RedBlackTree.h \
+    Source/WTF/wtf/RefCounted.h \
+    Source/WTF/wtf/RefCountedArray.h \
+    Source/WTF/wtf/RefCountedLeakCounter.cpp \
+    Source/WTF/wtf/RefCountedLeakCounter.h \
+    Source/WTF/wtf/RefPtr.h \
+    Source/WTF/wtf/RefPtrHashMap.h \
+    Source/WTF/wtf/RetainPtr.h \
+    Source/WTF/wtf/SHA1.cpp \
+    Source/WTF/wtf/SHA1.h \
+    Source/WTF/wtf/SaturatedArithmetic.h \
+    Source/WTF/wtf/SegmentedVector.h \
+    Source/WTF/wtf/SentinelLinkedList.h \
+    Source/WTF/wtf/SimpleStats.h \
+    Source/WTF/wtf/SinglyLinkedList.h \
+    Source/WTF/wtf/Spectrum.h \
+    Source/WTF/wtf/StackBounds.cpp \
+    Source/WTF/wtf/StackBounds.h \
+    Source/WTF/wtf/StackStats.h \
+    Source/WTF/wtf/StaticConstructors.h \
+    Source/WTF/wtf/StdLibExtras.h \
+    Source/WTF/wtf/StreamBuffer.h \
+    Source/WTF/wtf/StringExtras.h \
+    Source/WTF/wtf/StringHasher.h \
+    Source/WTF/wtf/TCPackedCache.h \
+    Source/WTF/wtf/TCPageMap.h \
+    Source/WTF/wtf/TCSpinLock.h \
+    Source/WTF/wtf/TCSystemAlloc.cpp \
+    Source/WTF/wtf/TCSystemAlloc.h \
+    Source/WTF/wtf/TemporaryChange.h \
+    Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp \
+    Source/WTF/wtf/ThreadIdentifierDataPthreads.h \
+    Source/WTF/wtf/ThreadRestrictionVerifier.h \
+    Source/WTF/wtf/ThreadSafeRefCounted.h \
+    Source/WTF/wtf/ThreadSpecific.h \
+    Source/WTF/wtf/Threading.cpp \
+    Source/WTF/wtf/Threading.h \
+    Source/WTF/wtf/ThreadingPrimitives.h \
+    Source/WTF/wtf/ThreadingPthreads.cpp \
+    Source/WTF/wtf/TypeTraits.cpp \
+    Source/WTF/wtf/TypeTraits.h \
+    Source/WTF/wtf/TypedArrayBase.h \
+    Source/WTF/wtf/Uint16Array.h \
+    Source/WTF/wtf/Uint32Array.h \
+    Source/WTF/wtf/Uint8Array.h \
+    Source/WTF/wtf/Uint8ClampedArray.h \
+    Source/WTF/wtf/UnionFind.h \
+    Source/WTF/wtf/UnusedParam.h \
+    Source/WTF/wtf/VMTags.h \
+    Source/WTF/wtf/ValueCheck.h \
+    Source/WTF/wtf/Vector.h \
+    Source/WTF/wtf/VectorTraits.h \
+    Source/WTF/wtf/WTFThreadData.cpp \
+    Source/WTF/wtf/WTFThreadData.h \
+    Source/WTF/wtf/dtoa.cpp \
+    Source/WTF/wtf/dtoa.h \
+    Source/WTF/wtf/dtoa/bignum-dtoa.cc \
+    Source/WTF/wtf/dtoa/bignum-dtoa.h \
+    Source/WTF/wtf/dtoa/bignum.cc \
+    Source/WTF/wtf/dtoa/bignum.h \
+    Source/WTF/wtf/dtoa/cached-powers.cc \
+    Source/WTF/wtf/dtoa/cached-powers.h \
+    Source/WTF/wtf/dtoa/diy-fp.cc \
+    Source/WTF/wtf/dtoa/diy-fp.h \
+    Source/WTF/wtf/dtoa/double-conversion.cc \
+    Source/WTF/wtf/dtoa/double-conversion.h \
+    Source/WTF/wtf/dtoa/double.h \
+    Source/WTF/wtf/dtoa/fast-dtoa.cc \
+    Source/WTF/wtf/dtoa/fast-dtoa.h \
+    Source/WTF/wtf/dtoa/fixed-dtoa.cc \
+    Source/WTF/wtf/dtoa/fixed-dtoa.h \
+    Source/WTF/wtf/dtoa/strtod.cc \
+    Source/WTF/wtf/dtoa/strtod.h \
+    Source/WTF/wtf/dtoa/utils.h \
+    Source/WTF/wtf/gobject/GOwnPtr.cpp \
+    Source/WTF/wtf/gobject/GOwnPtr.h \
+    Source/WTF/wtf/gobject/GRefPtr.cpp \
+    Source/WTF/wtf/gobject/GRefPtr.h \
+    Source/WTF/wtf/gobject/GTypedefs.h \
+    Source/WTF/wtf/gobject/GlibUtilities.cpp \
+    Source/WTF/wtf/gobject/GlibUtilities.h \
+    Source/WTF/wtf/gtk/MainThreadGtk.cpp \
+    Source/WTF/wtf/text/ASCIIFastPath.h \
+    Source/WTF/wtf/text/AtomicString.cpp \
+    Source/WTF/wtf/text/AtomicString.h \
+    Source/WTF/wtf/text/AtomicStringHash.h \
+    Source/WTF/wtf/text/AtomicStringImpl.h \
+    Source/WTF/wtf/text/Base64.cpp \
+    Source/WTF/wtf/text/Base64.h \
+    Source/WTF/wtf/text/CString.cpp \
+    Source/WTF/wtf/text/CString.h \
+    Source/WTF/wtf/text/IntegerToStringConversion.h \
+    Source/WTF/wtf/text/StringBuffer.h \
+    Source/WTF/wtf/text/StringBuilder.cpp \
+    Source/WTF/wtf/text/StringBuilder.h \
+    Source/WTF/wtf/text/StringConcatenate.h \
+    Source/WTF/wtf/text/StringHash.h \
+    Source/WTF/wtf/text/StringImpl.cpp \
+    Source/WTF/wtf/text/StringImpl.h \
+    Source/WTF/wtf/text/StringOperators.h \
+    Source/WTF/wtf/text/StringStatics.cpp \
+    Source/WTF/wtf/text/TextPosition.h \
+    Source/WTF/wtf/text/WTFString.cpp \
+    Source/WTF/wtf/text/WTFString.h \
+    Source/WTF/wtf/threads/BinarySemaphore.cpp \
+    Source/WTF/wtf/threads/BinarySemaphore.h \
+    Source/WTF/wtf/unicode/CharacterNames.h \
+    Source/WTF/wtf/unicode/Collator.h \
+    Source/WTF/wtf/unicode/CollatorDefault.cpp \
+    Source/WTF/wtf/unicode/UTF8.cpp \
+    Source/WTF/wtf/unicode/UTF8.h \
+    Source/WTF/wtf/unicode/Unicode.h \
+    Source/WTF/wtf/url/api/URLBuffer.h \
+    Source/WTF/wtf/url/api/URLQueryCharsetConverter.h
+
+if TARGET_WIN32
+wtf_sources += \
+    Source/WTF/wtf/OSAllocatorWin.cpp \
+    Source/WTF/wtf/ThreadFunctionInvocation.h \
+    Source/WTF/wtf/ThreadingWin.cpp \
+    Source/WTF/wtf/ThreadSpecificWin.cpp \
+    Source/WTF/wtf/win/OwnPtrWin.cpp
+else
+wtf_sources += \
+    Source/WTF/wtf/OSAllocatorPosix.cpp
+endif
+
+# ----
+# icu unicode backend
+# ----
+if USE_ICU_UNICODE
+wtf_sources += \
+    Source/WTF/wtf/unicode/icu/CollatorICU.cpp \
+    Source/WTF/wtf/unicode/icu/UnicodeIcu.h
+endif # USE_ICU_UNICODE
+
+# ----
+# glib unicode backend
+# ----
+if USE_GLIB_UNICODE
+wtf_sources += \
+    Source/WTF/wtf/unicode/UnicodeMacrosFromICU.h \
+    Source/WTF/wtf/unicode/ScriptCodesFromICU.h \
+    Source/WTF/wtf/unicode/glib/UnicodeGLib.h \
+    Source/WTF/wtf/unicode/glib/UnicodeGLib.cpp
+endif # USE_GLIB_UNICODE
diff --git a/Source/WTF/Makefile b/Source/WTF/Makefile
new file mode 100644
index 0000000..cb4c11a
--- /dev/null
+++ b/Source/WTF/Makefile
@@ -0,0 +1 @@
+include ../Makefile.shared
diff --git a/Source/WTF/WTF.gyp/.gitignore b/Source/WTF/WTF.gyp/.gitignore
new file mode 100644
index 0000000..0664198
--- /dev/null
+++ b/Source/WTF/WTF.gyp/.gitignore
@@ -0,0 +1,6 @@
+*.Makefile
+*.mk
+*.sln
+*.vcproj*
+*.vcxproj*
+WTF.xcodeproj
diff --git a/Source/WTF/WTF.gyp/WTF.gyp b/Source/WTF/WTF.gyp/WTF.gyp
new file mode 100644
index 0000000..50b1327
--- /dev/null
+++ b/Source/WTF/WTF.gyp/WTF.gyp
@@ -0,0 +1,187 @@
+# Copyright (C) 2012 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.
+#     * 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.
+#     * 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.
+{
+  'includes': [
+    '../../WebKit/chromium/WinPrecompile.gypi',
+    '../../WebKit/chromium/features.gypi',
+    '../WTF.gypi',
+  ],
+  'variables': {
+    # Location of the chromium src directory.
+    'conditions': [
+      ['inside_chromium_build==0', {
+        # Webkit is being built outside of the full chromium project.
+        'chromium_src_dir': '../../WebKit/chromium',
+      },{
+        # WebKit is checked out in src/chromium/third_party/WebKit
+        'chromium_src_dir': '../../../../..',
+      }],
+    ],
+  },
+  'conditions': [
+    ['os_posix == 1 and OS != "mac" and gcc_version>=46', {
+      'target_defaults': {
+        # Disable warnings about c++0x compatibility, as some names (such as nullptr) conflict
+        # with upcoming c++0x types.
+        'cflags_cc': ['-Wno-c++0x-compat'],
+      },
+    }],
+  ],
+  'targets': [
+    {
+      # This target sets up defines and includes that are required by WTF and
+      # its dependents.
+      'target_name': 'wtf_config',
+      'type': 'none',
+      'direct_dependent_settings': {
+        'defines': [
+          # Import features_defines from features.gypi
+          '<@(feature_defines)',
+
+          # Turns on #if PLATFORM(CHROMIUM)
+          'BUILDING_CHROMIUM__=1',
+          # Controls wtf/FastMalloc
+          # FIXME: consider moving into config.h
+          'USE_SYSTEM_MALLOC=1',
+        ],
+        'conditions': [
+          ['OS=="win"', {
+            'defines': [
+              '__STD_C',
+              '_CRT_SECURE_NO_DEPRECATE',
+              '_SCL_SECURE_NO_DEPRECATE',
+              'CRASH=__debugbreak',
+            ],
+            'include_dirs': [
+              '../../JavaScriptCore/os-win32',
+            ],
+          }],
+          ['OS=="mac"', {
+            'defines': [
+              # Use USE_NEW_THEME on Mac.
+              'WTF_USE_NEW_THEME=1',
+            ],
+          }],
+          ['os_posix == 1 and OS != "mac"', {
+            'defines': [
+              'WTF_USE_PTHREADS=1',
+            ],
+          }],
+        ],
+      },
+    },
+    {
+      'target_name': 'wtf',
+      'type': 'static_library',
+      'include_dirs': [
+        '../',
+        '../wtf',
+        '../wtf/unicode',
+      ],
+      'dependencies': [
+          'wtf_config',
+          '<(chromium_src_dir)/third_party/icu/icu.gyp:icui18n',
+          '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc',
+      ],
+      'sources': [
+        '<@(wtf_privateheader_files)',
+        '<@(wtf_files)',
+      ],
+      'sources/': [
+        # FIXME: This is clearly not sustainable.
+        ['exclude', '../wtf/efl'],
+        ['exclude', '../wtf/gobject'],
+        ['exclude', '../wtf/gtk'],
+        ['exclude', '../wtf/mac'],
+        ['exclude', '../wtf/qt'],
+        ['exclude', '../wtf/url'],
+        ['exclude', '../wtf/wince'],
+        ['exclude', '../wtf/wx'],
+        ['exclude', '../wtf/unicode/glib'],
+        ['exclude', '../wtf/unicode/qt4'],
+        ['exclude', '../wtf/unicode/wchar'],
+        # GLib/GTK, even though its name doesn't really indicate.
+        ['exclude', '/(gtk|glib|gobject)/.*\\.(cpp|h)$'],
+        ['exclude', '(Default|Gtk|Mac|None|Qt|Win|Wx|Efl|Symbian)\\.(cpp|mm)$'],
+        ['exclude', 'wtf/OSRandomSource\\.cpp$'],
+        ['exclude', 'wtf/MainThread.cpp$'],
+        ['exclude', 'wtf/TC.*\\.(cpp|h)$'],
+      ],
+      'direct_dependent_settings': {
+        'include_dirs': [
+          '../',
+          # FIXME: This is too broad, but is needed for runtime/JSExportMacros.h and yarr.
+          '../../JavaScriptCore',
+        ],
+        # Some warnings occur in JSC headers, so they must also be disabled
+        # in targets that use JSC.
+        'msvs_disabled_warnings': [
+          # Don't complain about calling specific versions of templatized
+          # functions (e.g. in RefPtrHashMap.h).
+          4344,
+          # Don't complain about using "this" in an initializer list
+          # (e.g. in StringImpl.h).
+          4355,
+        ],
+      },
+      'export_dependent_settings': [
+        'wtf_config',
+        '<(chromium_src_dir)/third_party/icu/icu.gyp:icui18n',
+        '<(chromium_src_dir)/third_party/icu/icu.gyp:icuuc',
+      ],
+      'msvs_disabled_warnings': [4127, 4355, 4510, 4512, 4610, 4706, 4068],
+      'conditions': [
+        ['OS=="win"', {
+          'sources/': [
+            ['exclude', 'ThreadIdentifierDataPthreads\\.(h|cpp)$'],
+            ['exclude', 'ThreadingPthreads\\.cpp$'],
+            ['include', 'Thread(ing|Specific)Win\\.cpp$'],
+            ['exclude', 'OSAllocatorPosix\\.cpp$'],
+            ['include', 'OSAllocatorWin\\.cpp$'],
+            ['include', 'win/OwnPtrWin\\.cpp$'],
+          ],
+          'include_dirs!': [
+            '<(SHARED_INTERMEDIATE_DIR)/webkit',
+          ],
+          'conditions': [
+            ['inside_chromium_build==1 and component=="shared_library"', {
+              # Chromium windows multi-dll build enables c++ exception and this
+              # causes wtf generates 4291 warning due to operator new/delete
+              # implementations. Disable the warning for chromium windows
+              # multi-dll build.
+              'msvs_disabled_warnings': [4291],
+              'direct_dependent_settings': {
+                'msvs_disabled_warnings': [4291],
+              },
+            }],
+          ],
+        }],
+      ],
+    },
+  ]
+}
diff --git a/Source/WTF/WTF.gyp/wtf.target.mk b/Source/WTF/WTF.gyp/wtf.target.mk
new file mode 100644
index 0000000..a159b6d
--- /dev/null
+++ b/Source/WTF/WTF.gyp/wtf.target.mk
@@ -0,0 +1,352 @@
+# This file is generated by gyp; do not edit.
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_MODULE := third_party_WebKit_Source_WTF_WTF_gyp_wtf_gyp
+LOCAL_MODULE_SUFFIX := .a
+LOCAL_MODULE_TAGS := optional
+gyp_intermediate_dir := $(call local-intermediates-dir)
+gyp_shared_intermediate_dir := $(call intermediates-dir-for,GYP,shared)
+
+# Make sure our deps are built first.
+GYP_TARGET_DEPENDENCIES := \
+	$(call intermediates-dir-for,GYP,third_party_WebKit_Source_WTF_WTF_gyp_wtf_config_gyp)/wtf_config.stamp \
+	$(call intermediates-dir-for,GYP,third_party_icu_icui18n_gyp)/icui18n.stamp \
+	$(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp
+
+GYP_GENERATED_OUTPUTS :=
+
+# Make sure our deps and generated files are built first.
+LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
+
+$(gyp_intermediate_dir)/bignum-dtoa.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/WTF/wtf/dtoa/bignum-dtoa.cc
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/bignum.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/WTF/wtf/dtoa/bignum.cc
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/cached-powers.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/WTF/wtf/dtoa/cached-powers.cc
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/diy-fp.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/WTF/wtf/dtoa/diy-fp.cc
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/double-conversion.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/WTF/wtf/dtoa/double-conversion.cc
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/fast-dtoa.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/WTF/wtf/dtoa/fast-dtoa.cc
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/fixed-dtoa.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/WTF/wtf/dtoa/fixed-dtoa.cc
+	mkdir -p $(@D); cp $< $@
+$(gyp_intermediate_dir)/strtod.cpp: $(LOCAL_PATH)/third_party/WebKit/Source/WTF/wtf/dtoa/strtod.cc
+	mkdir -p $(@D); cp $< $@
+LOCAL_GENERATED_SOURCES := \
+	$(gyp_intermediate_dir)/bignum-dtoa.cpp \
+	$(gyp_intermediate_dir)/bignum.cpp \
+	$(gyp_intermediate_dir)/cached-powers.cpp \
+	$(gyp_intermediate_dir)/diy-fp.cpp \
+	$(gyp_intermediate_dir)/double-conversion.cpp \
+	$(gyp_intermediate_dir)/fast-dtoa.cpp \
+	$(gyp_intermediate_dir)/fixed-dtoa.cpp \
+	$(gyp_intermediate_dir)/strtod.cpp
+
+GYP_COPIED_SOURCE_ORIGIN_DIRS := \
+	$(LOCAL_PATH)/third_party/WebKit/Source/WTF/wtf/dtoa
+
+LOCAL_SRC_FILES := \
+	third_party/WebKit/Source/WTF/wtf/ArrayBuffer.cpp \
+	third_party/WebKit/Source/WTF/wtf/ArrayBufferView.cpp \
+	third_party/WebKit/Source/WTF/wtf/Assertions.cpp \
+	third_party/WebKit/Source/WTF/wtf/BitVector.cpp \
+	third_party/WebKit/Source/WTF/wtf/CryptographicallyRandomNumber.cpp \
+	third_party/WebKit/Source/WTF/wtf/CurrentTime.cpp \
+	third_party/WebKit/Source/WTF/wtf/DataLog.cpp \
+	third_party/WebKit/Source/WTF/wtf/DateMath.cpp \
+	third_party/WebKit/Source/WTF/wtf/DecimalNumber.cpp \
+	third_party/WebKit/Source/WTF/wtf/DynamicAnnotations.cpp \
+	third_party/WebKit/Source/WTF/wtf/FastMalloc.cpp \
+	third_party/WebKit/Source/WTF/wtf/GregorianDateTime.cpp \
+	third_party/WebKit/Source/WTF/wtf/HashTable.cpp \
+	third_party/WebKit/Source/WTF/wtf/MD5.cpp \
+	third_party/WebKit/Source/WTF/wtf/MediaTime.cpp \
+	third_party/WebKit/Source/WTF/wtf/NullPtr.cpp \
+	third_party/WebKit/Source/WTF/wtf/NumberOfCores.cpp \
+	third_party/WebKit/Source/WTF/wtf/RAMSize.cpp \
+	third_party/WebKit/Source/WTF/wtf/OSAllocatorPosix.cpp \
+	third_party/WebKit/Source/WTF/wtf/PageAllocationAligned.cpp \
+	third_party/WebKit/Source/WTF/wtf/PageBlock.cpp \
+	third_party/WebKit/Source/WTF/wtf/ParallelJobsGeneric.cpp \
+	third_party/WebKit/Source/WTF/wtf/RandomNumber.cpp \
+	third_party/WebKit/Source/WTF/wtf/RefCountedLeakCounter.cpp \
+	third_party/WebKit/Source/WTF/wtf/SHA1.cpp \
+	third_party/WebKit/Source/WTF/wtf/SizeLimits.cpp \
+	third_party/WebKit/Source/WTF/wtf/StackBounds.cpp \
+	third_party/WebKit/Source/WTF/wtf/StringExtras.cpp \
+	third_party/WebKit/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp \
+	third_party/WebKit/Source/WTF/wtf/Threading.cpp \
+	third_party/WebKit/Source/WTF/wtf/ThreadingPthreads.cpp \
+	third_party/WebKit/Source/WTF/wtf/TypeTraits.cpp \
+	third_party/WebKit/Source/WTF/wtf/WTFThreadData.cpp \
+	third_party/WebKit/Source/WTF/wtf/chromium/MainThreadChromium.cpp \
+	third_party/WebKit/Source/WTF/wtf/dtoa.cpp \
+	third_party/WebKit/Source/WTF/wtf/text/AtomicString.cpp \
+	third_party/WebKit/Source/WTF/wtf/text/Base64.cpp \
+	third_party/WebKit/Source/WTF/wtf/text/CString.cpp \
+	third_party/WebKit/Source/WTF/wtf/text/StringBuilder.cpp \
+	third_party/WebKit/Source/WTF/wtf/text/StringImpl.cpp \
+	third_party/WebKit/Source/WTF/wtf/text/StringStatics.cpp \
+	third_party/WebKit/Source/WTF/wtf/text/WTFString.cpp \
+	third_party/WebKit/Source/WTF/wtf/threads/BinarySemaphore.cpp \
+	third_party/WebKit/Source/WTF/wtf/unicode/UTF8.cpp \
+	third_party/WebKit/Source/WTF/wtf/unicode/icu/CollatorICU.cpp
+
+
+# Flags passed to both C and C++ files.
+MY_CFLAGS := \
+	-fno-exceptions \
+	-fno-strict-aliasing \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-fvisibility=hidden \
+	-pipe \
+	-fPIC \
+	-Wno-format \
+	-mthumb \
+	-march=armv7-a \
+	-mtune=cortex-a8 \
+	-mfloat-abi=softfp \
+	-mfpu=vfpv3-d16 \
+	-fno-tree-sra \
+	-fuse-ld=gold \
+	-Wno-psabi \
+	-mthumb-interwork \
+	-ffunction-sections \
+	-funwind-tables \
+	-g \
+	-fstack-protector \
+	-fno-short-enums \
+	-finline-limit=64 \
+	-Wa,--noexecstack \
+	-Wno-error=extra \
+	-Wno-error=ignored-qualifiers \
+	-Wno-error=type-limits \
+	-Wno-error=non-virtual-dtor \
+	-Wno-error=sign-promo \
+	-Wno-error=address \
+	-Wno-error=format-security \
+	-Wno-error=non-virtual-dtor \
+	-Wno-error=return-type \
+	-Wno-error=sequence-point \
+	-Os \
+	-g \
+	-fomit-frame-pointer \
+	-fdata-sections \
+	-ffunction-sections
+
+MY_CFLAGS_C :=
+
+MY_DEFS := \
+	'-D_FILE_OFFSET_BITS=64' \
+	'-DNO_TCMALLOC' \
+	'-DDISABLE_NACL' \
+	'-DCHROMIUM_BUILD' \
+	'-DUSE_LIBJPEG_TURBO=1' \
+	'-DUSE_PROPRIETARY_CODECS' \
+	'-DENABLE_PEPPER_THREADING' \
+	'-DENABLE_GPU=1' \
+	'-DUSE_OPENSSL=1' \
+	'-DENABLE_EGLIMAGE=1' \
+	'-DUSE_SKIA=1' \
+	'-DENABLE_3D_PLUGIN=1' \
+	'-DENABLE_BATTERY_STATUS=0' \
+	'-DENABLE_BLOB=1' \
+	'-DENABLE_BLOB_SLICE=1' \
+	'-DENABLE_CHANNEL_MESSAGING=1' \
+	'-DENABLE_CSP_NEXT=1' \
+	'-DENABLE_CSS3_CONDITIONAL_RULES=0' \
+	'-DENABLE_CSS3_TEXT=0' \
+	'-DENABLE_CSS_BOX_DECORATION_BREAK=1' \
+	'-DENABLE_CSS_COMPOSITING=0' \
+	'-DENABLE_CSS_DEVICE_ADAPTATION=0' \
+	'-DENABLE_CSS_EXCLUSIONS=1' \
+	'-DENABLE_CSS_FILTERS=1' \
+	'-DENABLE_CSS_HIERARCHIES=0' \
+	'-DENABLE_CSS_IMAGE_SET=1' \
+	'-DENABLE_CSS_IMAGE_RESOLUTION=0' \
+	'-DENABLE_CSS_REGIONS=1' \
+	'-DENABLE_CSS_SHADERS=1' \
+	'-DENABLE_CSS_VARIABLES=1' \
+	'-DENABLE_CSS_STICKY_POSITION=1' \
+	'-DENABLE_CUSTOM_SCHEME_HANDLER=0' \
+	'-DENABLE_DASHBOARD_SUPPORT=0' \
+	'-DENABLE_DATA_TRANSFER_ITEMS=1' \
+	'-DENABLE_DETAILS_ELEMENT=1' \
+	'-DENABLE_DEVICE_ORIENTATION=1' \
+	'-DENABLE_DIALOG_ELEMENT=1' \
+	'-DENABLE_DIRECTORY_UPLOAD=1' \
+	'-DENABLE_DOWNLOAD_ATTRIBUTE=1' \
+	'-DENABLE_DRAGGABLE_REGION=1' \
+	'-DENABLE_ENCRYPTED_MEDIA=1' \
+	'-DENABLE_FILE_SYSTEM=1' \
+	'-DENABLE_FILTERS=1' \
+	'-DENABLE_FULLSCREEN_API=1' \
+	'-DENABLE_GAMEPAD=1' \
+	'-DENABLE_GEOLOCATION=1' \
+	'-DENABLE_GESTURE_EVENTS=1' \
+	'-DENABLE_ICONDATABASE=0' \
+	'-DENABLE_IFRAME_SEAMLESS=1' \
+	'-DENABLE_INDEXED_DATABASE=1' \
+	'-DENABLE_INPUT_TYPE_DATE=1' \
+	'-DENABLE_INPUT_TYPE_DATETIME=1' \
+	'-DENABLE_INPUT_TYPE_DATETIMELOCAL=1' \
+	'-DENABLE_INPUT_TYPE_MONTH=1' \
+	'-DENABLE_INPUT_TYPE_TIME=1' \
+	'-DENABLE_JAVASCRIPT_DEBUGGER=1' \
+	'-DENABLE_JAVASCRIPT_I18N_API=1' \
+	'-DENABLE_LEGACY_CSS_VENDOR_PREFIXES=0' \
+	'-DENABLE_LEGACY_VIEWPORT_ADAPTION=1' \
+	'-DENABLE_LEGACY_VENDOR_PREFIXES=0' \
+	'-DENABLE_LEGACY_WEB_AUDIO=1' \
+	'-DENABLE_LINK_PREFETCH=1' \
+	'-DENABLE_LINK_PRERENDER=1' \
+	'-DENABLE_MATHML=1' \
+	'-DENABLE_MEDIA_SOURCE=1' \
+	'-DENABLE_MEDIA_STATISTICS=1' \
+	'-DENABLE_METER_ELEMENT=1' \
+	'-DENABLE_MHTML=1' \
+	'-DENABLE_MICRODATA=0' \
+	'-DENABLE_MUTATION_OBSERVERS=1' \
+	'-DENABLE_NAVIGATOR_CONTENT_UTILS=1' \
+	'-DENABLE_PAGE_VISIBILITY_API=1' \
+	'-DENABLE_POINTER_LOCK=1' \
+	'-DENABLE_PROGRESS_ELEMENT=1' \
+	'-DENABLE_QUOTA=1' \
+	'-DENABLE_RESOLUTION_MEDIA_QUERY=0' \
+	'-DENABLE_REQUEST_ANIMATION_FRAME=1' \
+	'-DENABLE_REQUEST_AUTOCOMPLETE=1' \
+	'-DENABLE_RUBY=1' \
+	'-DENABLE_SANDBOX=1' \
+	'-DENABLE_SCRIPTED_SPEECH=1' \
+	'-DENABLE_SHADOW_DOM=1' \
+	'-DENABLE_SMOOTH_SCROLLING=1' \
+	'-DENABLE_SQL_DATABASE=1' \
+	'-DENABLE_STYLE_SCOPED=1' \
+	'-DENABLE_SVG=1' \
+	'-DENABLE_SVG_FONTS=1' \
+	'-DENABLE_TEXT_AUTOSIZING=1' \
+	'-DENABLE_TOUCH_ADJUSTMENT=1' \
+	'-DENABLE_TOUCH_EVENTS=1' \
+	'-DENABLE_TOUCH_ICON_LOADING=1' \
+	'-DENABLE_TOUCH_SLIDER=1' \
+	'-DENABLE_V8_SCRIPT_DEBUG_SERVER=1' \
+	'-DENABLE_VIDEO=1' \
+	'-DENABLE_VIDEO_TRACK=1' \
+	'-DENABLE_VIEWPORT=1' \
+	'-DENABLE_WEBGL=1' \
+	'-DENABLE_WEB_INTENTS=1' \
+	'-DENABLE_WEB_SOCKETS=1' \
+	'-DENABLE_WEB_TIMING=1' \
+	'-DENABLE_WORKERS=1' \
+	'-DENABLE_XHR_RESPONSE_BLOB=1' \
+	'-DENABLE_XHR_TIMEOUT=0' \
+	'-DENABLE_XSLT=1' \
+	'-DWTF_USE_LEVELDB=1' \
+	'-DWTF_USE_BUILTIN_UTF8_CODEC=1' \
+	'-DWTF_USE_OPENTYPE_SANITIZER=1' \
+	'-DWTF_USE_RTL_SCROLLBAR=1' \
+	'-DWTF_USE_SKIA_TEXT=1' \
+	'-DWTF_USE_WEBP=1' \
+	'-DWTF_USE_WEBKIT_IMAGE_DECODERS=1' \
+	'-DENABLE_ACCELERATED_OVERFLOW_SCROLLING=1' \
+	'-DENABLE_CALENDAR_PICKER=0' \
+	'-DENABLE_DATALIST_ELEMENT=0' \
+	'-DENABLE_FAST_MOBILE_SCROLLING=1' \
+	'-DENABLE_INPUT_SPEECH=0' \
+	'-DENABLE_INPUT_TYPE_COLOR=0' \
+	'-DENABLE_INPUT_TYPE_WEEK=0' \
+	'-DENABLE_LEGACY_NOTIFICATIONS=0' \
+	'-DENABLE_MEDIA_CAPTURE=1' \
+	'-DENABLE_MEDIA_STREAM=0' \
+	'-DENABLE_NOTIFICATIONS=0' \
+	'-DENABLE_ORIENTATION_EVENTS=1' \
+	'-DENABLE_PAGE_POPUP=0' \
+	'-DENABLE_PRINTING=0' \
+	'-DENABLE_REGISTER_PROTOCOL_HANDLER=0' \
+	'-DENABLE_SHARED_WORKERS=1' \
+	'-DENABLE_WEB_AUDIO=0' \
+	'-DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1' \
+	'-DENABLE_3D_RENDERING=1' \
+	'-DENABLE_ACCELERATED_2D_CANVAS=1' \
+	'-DWTF_USE_ACCELERATED_COMPOSITING=1' \
+	'-DENABLE_OPENTYPE_VERTICAL=1' \
+	'-DBUILDING_CHROMIUM__=1' \
+	'-DUSE_SYSTEM_MALLOC=1' \
+	'-DWTF_USE_PTHREADS=1' \
+	'-DU_USING_ICU_NAMESPACE=0' \
+	'-DUSE_SYSTEM_ICU' \
+	'-DANDROID' \
+	'-D__GNU_SOURCE=1' \
+	'-DUSE_STLPORT=1' \
+	'-D_STLP_USE_PTR_SPECIALIZATIONS=1' \
+	'-DCHROME_SYMBOLS_ID=""' \
+	'-DANDROID_UPSTREAM_BRINGUP=1' \
+	'-DDYNAMIC_ANNOTATIONS_ENABLED=1' \
+	'-DWTF_USE_DYNAMIC_ANNOTATIONS=1' \
+	'-D_DEBUG'
+
+LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS)
+
+# Include paths placed before CFLAGS/CPPFLAGS
+LOCAL_C_INCLUDES := \
+	$(LOCAL_PATH)/third_party/WebKit/Source/WTF \
+	$(LOCAL_PATH)/third_party/WebKit/Source/WTF/wtf \
+	$(LOCAL_PATH)/third_party/WebKit/Source/WTF/wtf/unicode \
+	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/common \
+	$(GYP_ABS_ANDROID_TOP_DIR)/external/icu4c/i18n \
+	$(GYP_ABS_ANDROID_TOP_DIR)/frameworks/wilhelm/include \
+	$(GYP_ABS_ANDROID_TOP_DIR)/bionic \
+	$(GYP_ABS_ANDROID_TOP_DIR)/external/stlport/stlport
+
+LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) $(LOCAL_C_INCLUDES)
+
+# Flags passed to only C++ (and not C) files.
+LOCAL_CPPFLAGS := \
+	-Wno-c++0x-compat \
+	-fno-rtti \
+	-fno-threadsafe-statics \
+	-fvisibility-inlines-hidden \
+	-Wno-deprecated \
+	-Wno-abi \
+	-Wno-error=c++0x-compat
+
+### Rules for final target.
+
+LOCAL_LDFLAGS := \
+	-Wl,-z,noexecstack \
+	-fPIC \
+	-Wl,-z,relro \
+	-Wl,-z,now \
+	-fuse-ld=gold \
+	-nostdlib \
+	-Wl,--no-undefined \
+	-Wl,--exclude-libs=ALL \
+	-Wl,--icf=safe \
+	-Wl,-O1 \
+	-Wl,--as-needed \
+	-Wl,--gc-sections
+
+
+LOCAL_STATIC_LIBRARIES :=
+
+# Enable grouping to fix circular references
+LOCAL_GROUP_STATIC_LIBRARIES := true
+
+LOCAL_SHARED_LIBRARIES := \
+	libstlport \
+	libdl
+
+# Add target alias to "gyp_all_modules" target.
+.PHONY: gyp_all_modules
+gyp_all_modules: third_party_WebKit_Source_WTF_WTF_gyp_wtf_gyp
+
+# Alias gyp target name.
+.PHONY: wtf
+wtf: third_party_WebKit_Source_WTF_WTF_gyp_wtf_gyp
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/Source/WTF/WTF.gyp/wtf_config.target.mk b/Source/WTF/WTF.gyp/wtf_config.target.mk
new file mode 100644
index 0000000..87d2f23
--- /dev/null
+++ b/Source/WTF/WTF.gyp/wtf_config.target.mk
@@ -0,0 +1,38 @@
+# This file is generated by gyp; do not edit.
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_CLASS := GYP
+LOCAL_MODULE := third_party_WebKit_Source_WTF_WTF_gyp_wtf_config_gyp
+LOCAL_MODULE_STEM := wtf_config
+LOCAL_MODULE_SUFFIX := .stamp
+LOCAL_MODULE_TAGS := optional
+gyp_intermediate_dir := $(call local-intermediates-dir)
+gyp_shared_intermediate_dir := $(call intermediates-dir-for,GYP,shared)
+
+# Make sure our deps are built first.
+GYP_TARGET_DEPENDENCIES :=
+
+GYP_GENERATED_OUTPUTS :=
+
+# Make sure our deps and generated files are built first.
+LOCAL_ADDITIONAL_DEPENDENCIES := $(GYP_TARGET_DEPENDENCIES) $(GYP_GENERATED_OUTPUTS)
+
+### Rules for final target.
+# Add target alias to "gyp_all_modules" target.
+.PHONY: gyp_all_modules
+gyp_all_modules: third_party_WebKit_Source_WTF_WTF_gyp_wtf_config_gyp
+
+# Alias gyp target name.
+.PHONY: wtf_config
+wtf_config: third_party_WebKit_Source_WTF_WTF_gyp_wtf_config_gyp
+
+LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp
+LOCAL_UNINSTALLABLE_MODULE := true
+
+include $(BUILD_SYSTEM)/base_rules.mk
+
+$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)
+	$(hide) echo "Gyp timestamp: $@"
+	$(hide) mkdir -p $(dir $@)
+	$(hide) touch $@
diff --git a/Source/WTF/WTF.gypi b/Source/WTF/WTF.gypi
new file mode 100644
index 0000000..f54077d
--- /dev/null
+++ b/Source/WTF/WTF.gypi
@@ -0,0 +1,262 @@
+{
+    'variables': {
+        'project_dir': ['.'],
+        'wtf_privateheader_files': [
+            'wtf/ASCIICType.h',
+            'wtf/AVLTree.h',
+            'wtf/Alignment.h',
+            'wtf/AlwaysInline.h',
+            'wtf/Assertions.h',
+            'wtf/Atomics.h',
+            'wtf/BitArray.h',
+            'wtf/BitVector.h',
+            'wtf/Bitmap.h',
+            'wtf/BlockStack.h',
+            'wtf/BloomFilter.h',
+            'wtf/BumpPointerAllocator.h',
+            'wtf/ByteOrder.h',
+            'wtf/CheckedArithmetic.h',
+            'wtf/CheckedBoolean.h',
+            'wtf/Compiler.h',
+            'wtf/Complex.h',
+            'wtf/CryptographicallyRandomNumber.h',
+            'wtf/CurrentTime.h',
+            'wtf/DataLog.h',
+            'wtf/DateMath.h',
+            'wtf/DecimalNumber.h',
+            'wtf/Decoder.h',
+            'wtf/Deque.h',
+            'wtf/DisallowCType.h',
+            'wtf/DoublyLinkedList.h',
+            'wtf/Encoder.h',
+            'wtf/FastAllocBase.h',
+            'wtf/FastMalloc.h',
+            'wtf/FixedArray.h',
+            'wtf/Forward.h',
+            'wtf/Functional.h',
+            'wtf/GetPtr.h',
+            'wtf/GregorianDateTime.h',
+            'wtf/HashCountedSet.h',
+            'wtf/HashFunctions.h',
+            'wtf/HashIterators.h',
+            'wtf/HashMap.h',
+            'wtf/HashSet.h',
+            'wtf/HashTable.h',
+            'wtf/HashTraits.h',
+            'wtf/HexNumber.h',
+            'wtf/ListHashSet.h',
+            'wtf/ListRefPtr.h',
+            'wtf/Locker.h',
+            'wtf/MD5.h',
+            'wtf/MainThread.h',
+            'wtf/MathExtras.h',
+            'wtf/MemoryInstrumentation.h',
+            'wtf/MemoryInstrumentationArrayBufferView.h',
+            'wtf/MemoryInstrumentationHashCountedSet.h',
+            'wtf/MemoryInstrumentationHashMap.h',
+            'wtf/MemoryInstrumentationHashSet.h',
+            'wtf/MemoryInstrumentationListHashSet.h',
+            'wtf/MemoryInstrumentationParsedURL.h',
+            'wtf/MemoryInstrumentationSequence.h',
+            'wtf/MemoryInstrumentationString.h',
+            'wtf/MemoryInstrumentationVector.h',
+            'wtf/MessageQueue.h',
+            'wtf/NonCopyingSort.h',
+            'wtf/Noncopyable.h',
+            'wtf/NotFound.h',
+            'wtf/NullPtr.h',
+            'wtf/OSAllocator.h',
+            'wtf/OwnArrayPtr.h',
+            'wtf/OwnPtr.h',
+            'wtf/OwnPtrCommon.h',
+            'wtf/PageAllocation.h',
+            'wtf/PageAllocationAligned.h',
+            'wtf/PageBlock.h',
+            'wtf/PageReservation.h',
+            'wtf/PassOwnArrayPtr.h',
+            'wtf/PassOwnPtr.h',
+            'wtf/PassRefPtr.h',
+            'wtf/PassTraits.h',
+            'wtf/Platform.h',
+            'wtf/Platform.h',
+            'wtf/PossiblyNull.h',
+            'wtf/RandomNumber.h',
+            'wtf/RefCounted.h',
+            'wtf/RefCountedLeakCounter.h',
+            'wtf/RefPtr.h',
+            'wtf/RefPtrHashMap.h',
+            'wtf/RetainPtr.h',
+            'wtf/SaturatedArithmetic.h',
+            'wtf/SentinelLinkedList.h',
+            'wtf/SinglyLinkedList.h',
+            'wtf/StackBounds.h',
+            'wtf/StaticConstructors.h',
+            'wtf/StdLibExtras.h',
+            'wtf/StringExtras.h',
+            'wtf/StringHasher.h',
+            'wtf/TemporaryChange.h',
+            'wtf/ThreadRestrictionVerifier.h',
+            'wtf/ThreadSafeRefCounted.h',
+            'wtf/ThreadSpecific.h',
+            'wtf/Threading.h',
+            'wtf/ThreadingPrimitives.h',
+            'wtf/TypeTraits.h',
+            'wtf/UnusedParam.h',
+            'wtf/VMTags.h',
+            'wtf/ValueCheck.h',
+            'wtf/Vector.h',
+            'wtf/VectorTraits.h',
+            'wtf/WTFThreadData.h',
+            'wtf/dtoa.h',
+            'wtf/dtoa/bignum-dtoa.h',
+            'wtf/dtoa/bignum.h',
+            'wtf/dtoa/cached-powers.h',
+            'wtf/dtoa/diy-fp.h',
+            'wtf/dtoa/double-conversion.h',
+            'wtf/dtoa/double.h',
+            'wtf/dtoa/fast-dtoa.h',
+            'wtf/dtoa/fixed-dtoa.h',
+            'wtf/dtoa/strtod.h',
+            'wtf/dtoa/utils.h',
+            'wtf/text/ASCIIFastPath.h',
+            'wtf/text/AtomicString.h',
+            'wtf/text/AtomicStringHash.h',
+            'wtf/text/AtomicStringImpl.h',
+            'wtf/text/Base64.h',
+            'wtf/text/CString.h',
+            'wtf/text/IntegerToStringConversion.h',
+            'wtf/text/StringBuffer.h',
+            'wtf/text/StringBuilder.h',
+            'wtf/text/StringConcatenate.h',
+            'wtf/text/StringHash.h',
+            'wtf/text/StringImpl.h',
+            'wtf/text/StringOperators.h',
+            'wtf/text/TextPosition.h',
+            'wtf/text/WTFString.h',
+            'wtf/threads/BinarySemaphore.h',
+            'wtf/unicode/CharacterNames.h',
+            'wtf/unicode/Collator.h',
+            'wtf/unicode/UTF8.h',
+            'wtf/unicode/Unicode.h',
+            'wtf/unicode/icu/UnicodeIcu.h',
+        ],
+        'wtf_files': [
+            'wtf/ArrayBuffer.cpp',
+            'wtf/ArrayBuffer.h',
+            'wtf/ArrayBufferView.cpp',
+            'wtf/ArrayBufferView.h',
+            'wtf/Assertions.cpp',
+            'wtf/BitVector.cpp',
+            'wtf/CryptographicallyRandomNumber.cpp',
+            'wtf/CurrentTime.cpp',
+            'wtf/DataLog.cpp',
+            'wtf/DateMath.cpp',
+            'wtf/DecimalNumber.cpp',
+            'wtf/DynamicAnnotations.cpp',
+            'wtf/DynamicAnnotations.h',
+            'wtf/FastMalloc.cpp',
+            'wtf/Float32Array.h',
+            'wtf/Float64Array.h',
+            'wtf/GregorianDateTime.cpp',
+            'wtf/HashTable.cpp',
+            'wtf/Int16Array.h',
+            'wtf/Int32Array.h',
+            'wtf/Int8Array.h',
+            'wtf/IntegralTypedArrayBase.h',
+            'wtf/MD5.cpp',
+            'wtf/MainThread.cpp',
+            'wtf/MallocZoneSupport.h',
+            'wtf/MediaTime.h',
+            'wtf/MediaTime.cpp',
+            'wtf/NullPtr.cpp',
+            'wtf/NumberOfCores.cpp',
+            'wtf/NumberOfCores.h',
+            'wtf/RAMSize.cpp',
+            'wtf/RAMSize.h',
+            'wtf/OSAllocatorPosix.cpp',
+            'wtf/OSAllocatorWin.cpp',
+            'wtf/OSRandomSource.cpp',
+            'wtf/OSRandomSource.h',
+            'wtf/PageAllocationAligned.cpp',
+            'wtf/PageBlock.cpp',
+            'wtf/ParallelJobs.h',
+            'wtf/ParallelJobsGeneric.cpp',
+            'wtf/ParallelJobsGeneric.h',
+            'wtf/ParallelJobsLibdispatch.h',
+            'wtf/ParallelJobsOpenMP.h',
+            'wtf/RandomNumber.cpp',
+            'wtf/RandomNumberSeed.h',
+            'wtf/RefCountedLeakCounter.cpp',
+            'wtf/SHA1.cpp',
+            'wtf/SHA1.h',
+            'wtf/SegmentedVector.h',
+            'wtf/SizeLimits.cpp',
+            'wtf/StackBounds.cpp',
+            'wtf/StringExtras.cpp',
+            'wtf/TCPackedCache.h',
+            'wtf/TCPageMap.h',
+            'wtf/TCSpinLock.h',
+            'wtf/TCSystemAlloc.cpp',
+            'wtf/TCSystemAlloc.h',
+            'wtf/ThreadFunctionInvocation.h',
+            'wtf/ThreadIdentifierDataPthreads.cpp',
+            'wtf/ThreadIdentifierDataPthreads.h',
+            'wtf/ThreadSpecificWin.cpp',
+            'wtf/Threading.cpp',
+            'wtf/ThreadingPthreads.cpp',
+            'wtf/ThreadingWin.cpp',
+            'wtf/TypeTraits.cpp',
+            'wtf/TypedArrayBase.h',
+            'wtf/Uint16Array.h',
+            'wtf/Uint32Array.h',
+            'wtf/Uint8Array.h',
+            'wtf/WTFThreadData.cpp',
+            'wtf/chromium/ChromiumThreading.h',
+            'wtf/chromium/MainThreadChromium.cpp',
+            'wtf/dtoa.cpp',
+            'wtf/dtoa/bignum-dtoa.cc',
+            'wtf/dtoa/bignum.cc',
+            'wtf/dtoa/cached-powers.cc',
+            'wtf/dtoa/diy-fp.cc',
+            'wtf/dtoa/double-conversion.cc',
+            'wtf/dtoa/fast-dtoa.cc',
+            'wtf/dtoa/fixed-dtoa.cc',
+            'wtf/dtoa/strtod.cc',
+            'wtf/efl/MainThreadEfl.cpp',
+            'wtf/gobject/GOwnPtr.cpp',
+            'wtf/gobject/GOwnPtr.h',
+            'wtf/gobject/GRefPtr.cpp',
+            'wtf/gobject/GRefPtr.h',
+            'wtf/gobject/GTypedefs.h',
+            'wtf/gtk/MainThreadGtk.cpp',
+            'wtf/mac/MainThreadMac.mm',
+            'wtf/qt/MainThreadQt.cpp',
+            'wtf/qt/StringQt.cpp',
+            'wtf/text/AtomicString.cpp',
+            'wtf/text/Base64.cpp',
+            'wtf/text/CString.cpp',
+            'wtf/text/StringBuilder.cpp',
+            'wtf/text/StringImpl.cpp',
+            'wtf/text/StringStatics.cpp',
+            'wtf/text/WTFString.cpp',
+            'wtf/threads/BinarySemaphore.cpp',
+            'wtf/unicode/CollatorDefault.cpp',
+            'wtf/unicode/ScriptCodesFromICU.h',
+            'wtf/unicode/UTF8.cpp',
+            'wtf/unicode/UnicodeMacrosFromICU.h',
+            'wtf/unicode/glib/UnicodeGLib.cpp',
+            'wtf/unicode/glib/UnicodeGLib.h',
+            'wtf/unicode/icu/CollatorICU.cpp',
+            'wtf/unicode/qt4/UnicodeQt4.h',
+            'wtf/unicode/wchar/UnicodeWchar.cpp',
+            'wtf/unicode/wchar/UnicodeWchar.h',
+            'wtf/win/MainThreadWin.cpp',
+            'wtf/win/OwnPtrWin.cpp',
+            'wtf/wince/FastMallocWinCE.h',
+            'wtf/wince/MemoryManager.cpp',
+            'wtf/wince/MemoryManager.h',
+            'wtf/wx/MainThreadWx.cpp',
+            'wtf/wx/StringWx.cpp',
+        ],
+    }
+}
diff --git a/Source/WTF/WTF.pri b/Source/WTF/WTF.pri
new file mode 100644
index 0000000..2b4e8bc
--- /dev/null
+++ b/Source/WTF/WTF.pri
@@ -0,0 +1,43 @@
+# -------------------------------------------------------------------
+# This file contains shared rules used both when building WTF itself
+# and for targets that depend in some way on WTF.
+#
+# See 'Tools/qmake/README' for an overview of the build system
+# -------------------------------------------------------------------
+
+# All external modules should include WTF headers by prefixing with "wtf" (#include <wtf/some/thing.h>).
+INCLUDEPATH += $$PWD
+
+mac {
+    # Mac OS does ship libicu but not the associated header files.
+    # Therefore WebKit provides adequate header files.
+    INCLUDEPATH += $${ROOT_WEBKIT_DIR}/Source/WTF/icu
+    LIBS += -licucore
+} else {
+    contains(QT_CONFIG,icu) {
+        win32: LIBS += -licuin -licuuc -licudt
+        else: LIBS += -licui18n -licuuc -licudata
+    }
+}
+
+linux-*:use?(GSTREAMER) {
+    DEFINES += ENABLE_GLIB_SUPPORT=1
+    PKGCONFIG += glib-2.0 gio-2.0
+}
+
+win32-* {
+    LIBS += -lwinmm
+    LIBS += -lgdi32
+}
+
+qnx {
+    # required for timegm
+    LIBS += -lnbutil
+}
+
+mac {
+    LIBS += -framework AppKit
+}
+
+# MSVC is lacking stdint.h as well as inttypes.h.
+win32-msvc*|win32-icc|wince*: INCLUDEPATH += $$ROOT_WEBKIT_DIR/Source/JavaScriptCore/os-win32
diff --git a/Source/WTF/WTF.pro b/Source/WTF/WTF.pro
new file mode 100644
index 0000000..8bd303b
--- /dev/null
+++ b/Source/WTF/WTF.pro
@@ -0,0 +1,273 @@
+# -------------------------------------------------------------------
+# Project file for WTF
+#
+# See 'Tools/qmake/README' for an overview of the build system
+# -------------------------------------------------------------------
+TEMPLATE = lib
+TARGET = WTF
+
+include(WTF.pri)
+
+CONFIG += staticlib
+
+VPATH += $$PWD/wtf
+
+INCLUDEPATH += $$PWD/wtf
+
+wince* {
+    # for mt19937ar.c
+    INCLUDEPATH += $${ROOT_WEBKIT_DIR}/Source/ThirdParty
+}
+
+HEADERS += \
+    Alignment.h \
+    AlwaysInline.h \
+    ArrayBuffer.h \
+    ArrayBufferView.h \
+    ASCIICType.h \
+    Assertions.h \
+    Atomics.h \
+    AVLTree.h \
+    Bitmap.h \
+    BitArray.h \
+    BitVector.h \
+    BloomFilter.h \
+    BoundsCheckedPointer.h \
+    BumpPointerAllocator.h \
+    ByteOrder.h \
+    CheckedArithmetic.h \
+    Compiler.h \
+    CryptographicallyRandomNumber.h \
+    CurrentTime.h \
+    DateMath.h \
+    DecimalNumber.h \
+    Decoder.h \
+    DataLog.h \ 
+    Deque.h \
+    DisallowCType.h \
+    dtoa.h \
+    dtoa/bignum-dtoa.h \
+    dtoa/bignum.h \
+    dtoa/cached-powers.h \
+    dtoa/diy-fp.h \
+    dtoa/double-conversion.h \
+    dtoa/double.h \
+    dtoa/fast-dtoa.h \
+    dtoa/fixed-dtoa.h \
+    dtoa/strtod.h \
+    dtoa/utils.h \
+    DynamicAnnotations.h \
+    Encoder.h \
+    ExportMacros.h \
+    FastAllocBase.h \
+    FastMalloc.h \
+    FixedArray.h \
+    Float32Array.h \
+    Float64Array.h \
+    Forward.h \
+    Functional.h \
+    GetPtr.h \
+    GregorianDateTime.h \
+    HashCountedSet.h \
+    HashFunctions.h \
+    HashIterators.h \
+    HashMap.h \
+    HashSet.h \
+    HashTable.h \
+    HashTraits.h \
+    HexNumber.h \
+    Int16Array.h \
+    Int32Array.h \
+    Int8Array.h \
+    ListHashSet.h \
+    ListRefPtr.h \
+    Locker.h \
+    MainThread.h \
+    MallocZoneSupport.h \
+    MathExtras.h \
+    MD5.h \
+    MediaTime.h \
+    MemoryInstrumentation.h \
+    MemoryInstrumentationArrayBufferView.h \
+    MemoryInstrumentationHashCountedSet.h \
+    MemoryInstrumentationHashMap.h \
+    MemoryInstrumentationHashSet.h \
+    MemoryInstrumentationListHashSet.h \
+    MemoryInstrumentationParsedURL.h \
+    MemoryInstrumentationSequence.h \
+    MemoryInstrumentationString.h \
+    MemoryInstrumentationVector.h \
+    MessageQueue.h \
+    MetaAllocator.h \
+    MetaAllocatorHandle.h \
+    Noncopyable.h \
+    NonCopyingSort.h \
+    NotFound.h \
+    NullPtr.h \
+    NumberOfCores.h \
+    RAMSize.h \
+    OSAllocator.h \
+    OSRandomSource.h \
+    OwnArrayPtr.h \
+    OwnPtr.h \
+    OwnPtrCommon.h \
+    PackedIntVector.h \
+    PageAllocation.h \
+    PageAllocationAligned.h \
+    PageBlock.h \
+    PageReservation.h \
+    ParallelJobs.h \
+    ParallelJobsGeneric.h \
+    ParallelJobsLibdispatch.h \
+    ParallelJobsOpenMP.h \
+    PassOwnArrayPtr.h \
+    PassOwnPtr.h \
+    PassRefPtr.h \
+    PassTraits.h \
+    Platform.h \
+    PossiblyNull.h \
+    RandomNumber.h \
+    RandomNumberSeed.h \
+    RedBlackTree.h \
+    RefCounted.h \
+    RefCountedLeakCounter.h \
+    RefPtr.h \
+    RefPtrHashMap.h \
+    RetainPtr.h \
+    SHA1.h \
+    SaturatedArithmetic.h \
+    Spectrum.h \
+    StackBounds.h \
+    StaticConstructors.h \
+    StdLibExtras.h \
+    StringExtras.h \
+    StringHasher.h \
+    TCPackedCache.h \
+    TCSpinLock.h \
+    TCSystemAlloc.h \
+    text/ASCIIFastPath.h \
+    text/AtomicString.h \
+    text/AtomicStringHash.h \
+    text/AtomicStringImpl.h \
+    text/Base64.h \
+    text/CString.h \
+    text/IntegerToStringConversion.h \
+    text/StringBuffer.h \
+    text/StringBuilder.h \
+    text/StringConcatenate.h \
+    text/StringHash.h \
+    text/StringImpl.h \
+    text/StringOperators.h \
+    text/TextPosition.h \
+    text/WTFString.h \
+    Threading.h \
+    ThreadingPrimitives.h \
+    ThreadRestrictionVerifier.h \
+    ThreadSafeRefCounted.h \
+    ThreadSpecific.h \
+    TypeTraits.h \
+    Uint16Array.h \
+    Uint32Array.h \
+    Uint8Array.h \
+    Uint8ClampedArray.h \
+    unicode/CharacterNames.h \
+    unicode/Collator.h \
+    unicode/icu/UnicodeIcu.h \
+    unicode/qt4/UnicodeQt4.h \
+    unicode/ScriptCodesFromICU.h \
+    unicode/Unicode.h \
+    unicode/UnicodeMacrosFromICU.h \
+    unicode/UTF8.h \
+    UnusedParam.h \
+    ValueCheck.h \
+    Vector.h \
+    VectorTraits.h \
+    VMTags.h \
+    WTFThreadData.h
+
+unix: HEADERS += ThreadIdentifierDataPthreads.h
+
+SOURCES += \
+    ArrayBuffer.cpp \
+    ArrayBufferView.cpp \
+    Assertions.cpp \
+    BitVector.cpp \
+    CryptographicallyRandomNumber.cpp \
+    CurrentTime.cpp \
+    DateMath.cpp \
+    DataLog.cpp \
+    DecimalNumber.cpp \
+    dtoa.cpp \
+    dtoa/bignum-dtoa.cc \
+    dtoa/bignum.cc \
+    dtoa/cached-powers.cc \
+    dtoa/diy-fp.cc \
+    dtoa/double-conversion.cc \
+    dtoa/fast-dtoa.cc \
+    dtoa/fixed-dtoa.cc \
+    dtoa/strtod.cc \
+    FastMalloc.cpp \
+    GregorianDateTime.cpp \
+    gobject/GOwnPtr.cpp \
+    gobject/GRefPtr.cpp \
+    HashTable.cpp \
+    MD5.cpp \
+    MainThread.cpp \
+    MediaTime.cpp \
+    MetaAllocator.cpp \
+    NullPtr.cpp \
+    NumberOfCores.cpp \
+    RAMSize.cpp \
+    OSRandomSource.cpp \
+    qt/MainThreadQt.cpp \
+    qt/StringQt.cpp \
+    PageAllocationAligned.cpp \
+    PageBlock.cpp \
+    ParallelJobsGeneric.cpp \
+    RandomNumber.cpp \
+    RefCountedLeakCounter.cpp \
+    SHA1.cpp \
+    StackBounds.cpp \
+    TCSystemAlloc.cpp \
+    Threading.cpp \
+    TypeTraits.cpp \
+    WTFThreadData.cpp \
+    text/AtomicString.cpp \
+    text/Base64.cpp \
+    text/CString.cpp \
+    text/StringBuilder.cpp \
+    text/StringImpl.cpp \
+    text/StringStatics.cpp \
+    text/WTFString.cpp \
+    unicode/CollatorDefault.cpp \
+    unicode/icu/CollatorICU.cpp \
+    unicode/UTF8.cpp
+
+unix: SOURCES += \
+    OSAllocatorPosix.cpp \
+    ThreadIdentifierDataPthreads.cpp \
+    ThreadingPthreads.cpp
+
+win*|wince*: SOURCES += \
+    win/OwnPtrWin.cpp \
+    OSAllocatorWin.cpp \
+    ThreadSpecificWin.cpp \
+    ThreadingWin.cpp
+
+
+QT += core
+QT -= gui
+
+*-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2
+*-g++*:QMAKE_CXXFLAGS_RELEASE += -O3
+
+*sh4* {
+    QMAKE_CXXFLAGS += -mieee -w
+    QMAKE_CFLAGS   += -mieee -w
+}
+
+*-g++*:lessThan(QT_GCC_MAJOR_VERSION, 5):lessThan(QT_GCC_MINOR_VERSION, 6) {
+    # For GCC 4.5 and before we disable C++0x mode in JSC for if enabled in Qt's mkspec
+    QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11
+}
+
diff --git a/Source/WTF/WTF.vcproj/WTF.make b/Source/WTF/WTF.vcproj/WTF.make
new file mode 100644
index 0000000..1fc6b53
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTF.make
@@ -0,0 +1,16 @@
+!IF defined(BUILDSTYLE) && "$(BUILDSTYLE)"=="DEBUG"

+BUILDSTYLE=Debug_All

+!ELSE

+BUILDSTYLE=Production

+!ENDIF

+

+install:

+    set OFFICIAL_BUILD=1

+    set WebKitLibrariesDir=$(SRCROOT)\AppleInternal

+    set WebKitOutputDir=$(OBJROOT)

+	set ConfigurationBuildDir=$(OBJROOT)\$(BUILDSTYLE)

+    set WebKitVSPropsRedirectionDir=$(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\1\2\3\ 

+    devenv "WTF.sln" /clean $(BUILDSTYLE)

+    devenv "WTF.sln" /build $(BUILDSTYLE)

+    xcopy "%ConfigurationBuildDir%\include\*" "$(DSTROOT)\AppleInternal\include\" /e/v/i/h/y    

+    xcopy "%ConfigurationBuildDir%\lib\*" "$(DSTROOT)\AppleInternal\lib\" /e/v/i/h/y    

diff --git a/Source/WTF/WTF.vcproj/WTF.sln b/Source/WTF/WTF.vcproj/WTF.sln
new file mode 100644
index 0000000..76dc631
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTF.sln
@@ -0,0 +1,49 @@
+

+Microsoft Visual Studio Solution File, Format Version 9.00

+# Visual Studio 2005

+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WTFGenerated", "WTFGenerated.vcproj", "{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}"

+EndProject

+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WTF", "WTF.vcproj", "{AA8A5A85-592B-4357-BC60-E0E91E026AF6}"

+	ProjectSection(ProjectDependencies) = postProject

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950} = {5AE5F5E4-782D-4F63-B4D7-3977B52B9950}

+	EndProjectSection

+EndProject

+Global

+	GlobalSection(SolutionConfigurationPlatforms) = preSolution

+		Debug_All|Win32 = Debug_All|Win32

+		Debug_Cairo_CFLite|Win32 = Debug_Cairo_CFLite|Win32

+		Debug|Win32 = Debug|Win32

+		Production|Win32 = Production|Win32

+		Release_Cairo_CFLite|Win32 = Release_Cairo_CFLite|Win32

+		Release|Win32 = Release|Win32

+	EndGlobalSection

+	GlobalSection(ProjectConfigurationPlatforms) = postSolution

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Debug_All|Win32.ActiveCfg = Debug_All|Win32

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Debug_All|Win32.Build.0 = Debug_All|Win32

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Debug_Cairo_CFLite|Win32.ActiveCfg = Debug_Cairo_CFLite|Win32

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Debug_Cairo_CFLite|Win32.Build.0 = Debug_Cairo_CFLite|Win32

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Debug|Win32.ActiveCfg = Debug|Win32

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Debug|Win32.Build.0 = Debug|Win32

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Production|Win32.ActiveCfg = Production|Win32

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Production|Win32.Build.0 = Production|Win32

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Release_Cairo_CFLite|Win32.ActiveCfg = Release_Cairo_CFLite|Win32

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Release_Cairo_CFLite|Win32.Build.0 = Release_Cairo_CFLite|Win32

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Release|Win32.ActiveCfg = Release|Win32

+		{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}.Release|Win32.Build.0 = Release|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug_All|Win32.ActiveCfg = Debug_All|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug_All|Win32.Build.0 = Debug_All|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug_Cairo_CFLite|Win32.ActiveCfg = Debug_Cairo_CFLite|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug_Cairo_CFLite|Win32.Build.0 = Debug_Cairo_CFLite|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug|Win32.ActiveCfg = Debug|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Debug|Win32.Build.0 = Debug|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Production|Win32.ActiveCfg = Production|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Production|Win32.Build.0 = Production|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_Cairo_CFLite|Win32.ActiveCfg = Release_Cairo_CFLite|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release_Cairo_CFLite|Win32.Build.0 = Release_Cairo_CFLite|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.ActiveCfg = Release|Win32

+		{AA8A5A85-592B-4357-BC60-E0E91E026AF6}.Release|Win32.Build.0 = Release|Win32

+	EndGlobalSection

+	GlobalSection(SolutionProperties) = preSolution

+		HideSolutionNode = FALSE

+	EndGlobalSection

+EndGlobal

diff --git a/Source/WTF/WTF.vcproj/WTF.vcproj b/Source/WTF/WTF.vcproj/WTF.vcproj
new file mode 100644
index 0000000..e547fc2
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTF.vcproj
@@ -0,0 +1,1298 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTF"
+	ProjectGUID="{AA8A5A85-592B-4357-BC60-E0E91E026AF6}"
+	RootNamespace="WTF"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\WTFDebug.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\WTFRelease.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_All|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\WTFDebugAll.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Production|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\WTFProduction.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Cairo_CFLite|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\WTFReleaseCairoCFLite.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_Cairo_CFLite|Win32"
+			ConfigurationType="4"
+			InheritedPropertySheets=".\WTFDebugCairoCFLite.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="win"
+			>
+			<File
+				RelativePath="..\wtf\win\MainThreadWin.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\win\OwnPtrWin.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="unicode"
+			>
+			<File
+				RelativePath="..\wtf\unicode\CharacterNames.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\unicode\Collator.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\unicode\Unicode.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\unicode\UnicodeMacrosFromICU.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\unicode\UTF8.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\unicode\UTF8.h"
+				>
+			</File>
+			<Filter
+				Name="icu"
+				>
+				<File
+					RelativePath="..\wtf\unicode\icu\CollatorICU.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\wtf\unicode\icu\UnicodeIcu.h"
+					>
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="text"
+			>
+			<File
+				RelativePath="..\wtf\text\ASCIIFastPath.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\AtomicString.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\AtomicString.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\AtomicStringHash.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\AtomicStringImpl.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\Base64.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\Base64.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\CString.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\CString.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\IntegerToStringConversion.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\StringBuffer.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\StringBuilder.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\StringBuilder.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\StringConcatenate.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\StringHash.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\StringImpl.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\StringImpl.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\StringOperators.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\StringStatics.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\WTFString.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\text\WTFString.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="dtoa"
+			>
+			<File
+				RelativePath="..\wtf\dtoa\bignum-dtoa.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\bignum-dtoa.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\bignum.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\bignum.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\cached-powers.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\cached-powers.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\diy-fp.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\diy-fp.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\double-conversion.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\double-conversion.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\double.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\fast-dtoa.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\fast-dtoa.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\fixed-dtoa.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\fixed-dtoa.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\strtod.cc"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\strtod.h"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\dtoa\utils.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="threads"
+			>
+			<File
+				RelativePath="..\wtf\threads\BinarySemaphore.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\wtf\threads\BinarySemaphore.h"
+				>
+			</File>
+			<Filter
+				Name="win"
+				>
+				<File
+					RelativePath="..\wtf\threads\win\BinarySemaphoreWin.cpp"
+					>
+				</File>
+			</Filter>
+		</Filter>
+		<File
+			RelativePath="..\wtf\Alignment.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\AlwaysInline.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ArrayBuffer.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ArrayBuffer.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ArrayBufferView.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ArrayBufferView.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ASCIICType.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Assertions.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Assertions.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Atomics.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\AVLTree.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Bitmap.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\BitArray.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\BitVector.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\BitVector.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\BlockStack.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\BloomFilter.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\BoundsCheckedPointer.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\BumpPointerAllocator.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ByteOrder.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\CheckedArithmetic.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\CheckedBoolean.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Compiler.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Complex.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\CryptographicallyRandomNumber.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\CryptographicallyRandomNumber.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\CurrentTime.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\CurrentTime.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\DataLog.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\DataLog.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\DateMath.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\DateMath.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\DecimalNumber.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\DecimalNumber.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Decoder.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Deque.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\DisallowCType.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\DoublyLinkedList.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\dtoa.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\dtoa.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\DynamicAnnotations.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\DynamicAnnotations.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Encoder.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\FastAllocBase.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\FastBitVector.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\FastMalloc.cpp"
+			>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					DisableSpecificWarnings="4702"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Production|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					DisableSpecificWarnings="4702"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release_Cairo_CFLite|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					DisableSpecificWarnings="4702"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\wtf\FastMalloc.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\FixedArray.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Float32Array.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Float64Array.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Forward.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Functional.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\GetPtr.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\GregorianDateTime.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\GregorianDateTime.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\HashCountedSet.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\HashFunctions.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\HashIterators.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\HashMap.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\HashSet.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\HashTable.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\HashTable.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\HashTraits.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\HexNumber.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Int16Array.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Int32Array.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Int8Array.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ListHashSet.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ListRefPtr.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Locker.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MainThread.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MainThread.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MallocZoneSupport.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MathExtras.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MD5.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MD5.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MediaTime.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MediaTime.cpp"
+			>
+		</File>
+		<File
+		        RelativePath="..\wtf\MemoryInstrumentation.h"
+			>
+		</File>
+		<File
+		        RelativePath="..\wtf\MemoryInstrumentationArrayBufferView.h"
+			>
+		</File>
+		<File
+		        RelativePath="..\wtf\MemoryInstrumentationHashCountedSet.h"
+			>
+		</File>
+		<File
+		        RelativePath="..\wtf\MemoryInstrumentationHashMap.h"
+			>
+		</File>
+		<File
+		        RelativePath="..\wtf\MemoryInstrumentationHashSet.h"
+			>
+		</File>
+		<File
+		        RelativePath="..\wtf\MemoryInstrumentationListHashSet.h"
+			>
+		</File>
+		<File
+		        RelativePath="..\wtf\MemoryInstrumentationSequence.h"
+			>
+		</File>
+		<File
+		        RelativePath="..\wtf\MemoryInstrumentationString.h"
+			>
+		</File>
+		<File
+		        RelativePath="..\wtf\MemoryInstrumentationVector.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MessageQueue.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MetaAllocator.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MetaAllocator.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\MetaAllocatorHandle.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Noncopyable.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\NonCopyingSort.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\NotFound.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\NullPtr.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\NullPtr.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RAMSize.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RAMSize.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\NumberOfCores.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\NumberOfCores.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\OSAllocatorWin.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\OSRandomSource.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\OSRandomSource.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\OwnArrayPtr.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\OwnPtr.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\OwnPtrCommon.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PackedIntVector.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PageAllocation.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PageAllocationAligned.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PageAllocationAligned.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PageBlock.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PageBlock.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PageReservation.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ParallelJobs.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ParallelJobsGeneric.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ParallelJobsGeneric.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ParallelJobsLibdispatch.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ParallelJobsOpenMP.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PassOwnArrayPtr.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PassOwnPtr.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PassRefPtr.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PassTraits.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Platform.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\PossiblyNull.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RandomNumber.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RandomNumber.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RandomNumberSeed.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RedBlackTree.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RefCounted.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RefCountedLeakCounter.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RefCountedLeakCounter.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RefPtr.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RefPtrHashMap.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\RetainPtr.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\SaturatedArithmetic.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\SegmentedVector.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\SentinelLinkedList.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\SHA1.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\SHA1.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\SinglyLinkedList.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\SizeLimits.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\StackBounds.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\StackBounds.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\StaticConstructors.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\StdLibExtras.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\StringExtras.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\StringExtras.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\StringHasher.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\TCPackedCache.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\TCPageMap.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\TCSpinLock.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\TCSystemAlloc.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\TCSystemAlloc.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\TemporaryChange.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Threading.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Threading.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ThreadingPrimitives.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ThreadingWin.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ThreadRestrictionVerifier.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ThreadSafeRefCounted.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ThreadSpecific.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ThreadSpecificWin.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\TypeTraits.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\TypeTraits.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\UInt16Array.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\UInt32Array.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\UInt8Array.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\UnusedParam.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\ValueCheck.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Vector.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\Vector3.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\VectorTraits.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\VMTags.h"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\WTFThreadData.cpp"
+			>
+		</File>
+		<File
+			RelativePath="..\wtf\WTFThreadData.h"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/Source/WTF/WTF.vcproj/WTFCommon.vsprops b/Source/WTF/WTF.vcproj/WTFCommon.vsprops
new file mode 100644
index 0000000..e39ffe6
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFCommon.vsprops
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFCommon"
+	OutputDirectory="$(ConfigurationBuildDir)\lib"
+	>
+	<Tool
+		Name="VCCLCompilerTool"
+		AdditionalIncludeDirectories="../;../wtf/;../wtf/threads/;../wtf/unicode/;&quot;$(ConfigurationBuildDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(ConfigurationBuildDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;"
+		PreprocessorDefinitions="__STD_C"
+		ProgramDataBaseFileName="$(OutDir)\$(TargetName).vc80.pdb"
+		ForcedIncludeFiles="ICUVersion.h"
+	/>
+	<Tool
+		Name="VCLibrarianTool"
+		AdditionalDependencies="user32.lib"
+		OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).lib"
+	/>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFDebug.vsprops b/Source/WTF/WTF.vcproj/WTFDebug.vsprops
new file mode 100644
index 0000000..f94aa75
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFDebug.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFDebug"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\WTFCommon.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFDebugAll.vsprops b/Source/WTF/WTF.vcproj/WTFDebugAll.vsprops
new file mode 100644
index 0000000..6777d7b
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFDebugAll.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFDebugAll"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\WTFCommon.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFDebugCairoCFLite.vsprops b/Source/WTF/WTF.vcproj/WTFDebugCairoCFLite.vsprops
new file mode 100644
index 0000000..54d69a4
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFDebugCairoCFLite.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFDebugCairoCFLite"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\WTFCommon.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFGenerated.make b/Source/WTF/WTF.vcproj/WTFGenerated.make
new file mode 100644
index 0000000..e7896fd
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFGenerated.make
@@ -0,0 +1,13 @@
+all:
+    touch "%ConfigurationBuildDir%\buildfailed"
+    bash build-generated-files.sh "%ConfigurationBuildDir%" "$(WEBKITLIBRARIESDIR)"
+!IF "$(OFFICIAL_BUILD)"!="1"
+    bash -c "python work-around-vs-dependency-tracking-bugs.py"
+!ENDIF
+    copy-files.cmd
+
+    -del "%ConfigurationBuildDir%\buildfailed"
+
+clean:
+    -del "%ConfigurationBuildDir%\buildfailed"
+    copy-files.cmd clean
diff --git a/Source/WTF/WTF.vcproj/WTFGenerated.vcproj b/Source/WTF/WTF.vcproj/WTFGenerated.vcproj
new file mode 100644
index 0000000..3cb8250
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFGenerated.vcproj
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFGenerated"
+	ProjectGUID="{5AE5F5E4-782D-4F63-B4D7-3977B52B9950}"
+	RootNamespace="WTFGenerated"
+	Keyword="MakeFileProj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="0"
+			InheritedPropertySheets=".\WTFGeneratedDebug.vsprops"
+			>
+			<Tool
+				Name="VCNMakeTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_All|Win32"
+			ConfigurationType="0"
+			InheritedPropertySheets=".\WTFGeneratedDebugAll.vsprops"
+			>
+			<Tool
+				Name="VCNMakeTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="0"
+			InheritedPropertySheets=".\WTFGeneratedRelease.vsprops"
+			>
+			<Tool
+				Name="VCNMakeTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Production|Win32"
+			ConfigurationType="0"
+			InheritedPropertySheets=".\WTFGeneratedProduction.vsprops"
+			>
+			<Tool
+				Name="VCNMakeTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_Cairo_CFLite|Win32"
+			ConfigurationType="0"
+			InheritedPropertySheets=".\WTFGeneratedReleaseCairoCFLite.vsprops"
+			>
+			<Tool
+				Name="VCNMakeTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_Cairo_CFLite|Win32"
+			ConfigurationType="0"
+			InheritedPropertySheets=".\WTFGeneratedDebugCairoCFLite.vsprops"
+			>
+			<Tool
+				Name="VCNMakeTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\build-generated-files.sh"
+			>
+		</File>
+		<File
+			RelativePath=".\copy-files.cmd"
+			>
+		</File>
+		<File
+			RelativePath=".\work-around-vs-dependency-tracking-bugs.py"
+			>
+		</File>
+		<File
+			RelativePath=".\WTFGenerated.make"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/Source/WTF/WTF.vcproj/WTFGeneratedCommon.vsprops b/Source/WTF/WTF.vcproj/WTFGeneratedCommon.vsprops
new file mode 100644
index 0000000..5173df8
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFGeneratedCommon.vsprops
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFGeneratedCommon"
+	OutputDirectory="$(ConfigurationBuildDir)\lib"
+	>
+	<Tool
+		Name="VCNMakeTool"
+		BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;&#x0D;&#x0A;set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)&#x0D;&#x0A;set PRODUCTION=$(PRODUCTION)&#x0D;&#x0A;nmake /nologo -f WTFGenerated.make"
+		ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;&#x0D;&#x0A;set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)&#x0D;&#x0A;set PRODUCTION=$(PRODUCTION)&#x0D;&#x0A;nmake /nologo -f WTFGenerated.make clean&#x0D;&#x0A;nmake -f WTFGenerated.make"
+		CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash&#x0D;&#x0A;if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%&#x0D;&#x0A;cmd /c&#x0D;&#x0A;&#x0D;&#x0A;set CONFIGURATIONBUILDDIR=$(WebKitOutputDir)\$(ConfigurationName)&#x0D;&#x0A;set PRODUCTION=$(PRODUCTION)&#x0D;&#x0A;nmake /nologo -f WTFGenerated.make clean"
+	/>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFGeneratedDebug.vsprops b/Source/WTF/WTF.vcproj/WTFGeneratedDebug.vsprops
new file mode 100644
index 0000000..4afc4c9
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFGeneratedDebug.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFGeneratedDebug"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\WTFGeneratedCommon.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFGeneratedDebugAll.vsprops b/Source/WTF/WTF.vcproj/WTFGeneratedDebugAll.vsprops
new file mode 100644
index 0000000..8958269
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFGeneratedDebugAll.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFGeneratedDebugAll"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\WTFGeneratedCommon.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFGeneratedDebugCairoCFLite.vsprops b/Source/WTF/WTF.vcproj/WTFGeneratedDebugCairoCFLite.vsprops
new file mode 100644
index 0000000..6ad9f48
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFGeneratedDebugCairoCFLite.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFGeneratedDebugCairoCFLite"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\WTFGeneratedCommon.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFGeneratedProduction.vsprops b/Source/WTF/WTF.vcproj/WTFGeneratedProduction.vsprops
new file mode 100644
index 0000000..558a1b3
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFGeneratedProduction.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFGeneratedProduction"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops;.\WTFGeneratedCommon.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFGeneratedRelease.vsprops b/Source/WTF/WTF.vcproj/WTFGeneratedRelease.vsprops
new file mode 100644
index 0000000..f6f7d90
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFGeneratedRelease.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFGeneratedRelease"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WTFGeneratedCommon.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFGeneratedReleaseCairoCFLite.vsprops b/Source/WTF/WTF.vcproj/WTFGeneratedReleaseCairoCFLite.vsprops
new file mode 100644
index 0000000..a4d8f29
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFGeneratedReleaseCairoCFLite.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFGeneratedReleaseCairoCFLite"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\WTFGeneratedCommon.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFPostBuild.cmd b/Source/WTF/WTF.vcproj/WTFPostBuild.cmd
new file mode 100644
index 0000000..26707ca
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFPostBuild.cmd
@@ -0,0 +1 @@
+if exist "%CONFIGURATIONBUILDDIR%\buildfailed" del "%CONFIGURATIONBUILDDIR%\buildfailed"
diff --git a/Source/WTF/WTF.vcproj/WTFPreBuild.cmd b/Source/WTF/WTF.vcproj/WTFPreBuild.cmd
new file mode 100644
index 0000000..a770776
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFPreBuild.cmd
@@ -0,0 +1,6 @@
+%SystemDrive%\cygwin\bin\which.exe bash
+if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
+cmd /c
+if exist "%CONFIGURATIONBUILDDIR%\buildfailed" grep XX%PROJECTNAME%XX "%CONFIGURATIONBUILDDIR%\buildfailed"
+if errorlevel 1 exit 1
+echo XX%PROJECTNAME%XX > "%CONFIGURATIONBUILDDIR%\buildfailed"
diff --git a/Source/WTF/WTF.vcproj/WTFProduction.vsprops b/Source/WTF/WTF.vcproj/WTFProduction.vsprops
new file mode 100644
index 0000000..ee613e6
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFProduction.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFProduction"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\production.vsprops;.\WTFCommon.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFRelease.vsprops b/Source/WTF/WTF.vcproj/WTFRelease.vsprops
new file mode 100644
index 0000000..640059b
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFRelease.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFRelease"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefines.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WTFCommon.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/WTFReleaseCairoCFLite.vsprops b/Source/WTF/WTF.vcproj/WTFReleaseCairoCFLite.vsprops
new file mode 100644
index 0000000..a35a1fc
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/WTFReleaseCairoCFLite.vsprops
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="WTFReleaseCairoCFLite"
+	InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\FeatureDefinesCairo.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\WTFCommon.vsprops"
+	>
+</VisualStudioPropertySheet>
diff --git a/Source/WTF/WTF.vcproj/build-generated-files.sh b/Source/WTF/WTF.vcproj/build-generated-files.sh
new file mode 100755
index 0000000..d1a4e56
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/build-generated-files.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/bash
+
+# Determine whether we have the versioned ICU 4.0 or the unversioned ICU 4.4
+UNVERSIONED_ICU_LIB_PATH=$(cygpath -u "${WEBKITLIBRARIESDIR}/lib/libicuuc.lib")
+ICUVERSION_H_PATH=$(cygpath -u "${CONFIGURATIONBUILDDIR}/include/private/ICUVersion.h")
+if test \( ! -f "${ICUVERSION_H_PATH}" \) -o \( -f "${UNVERSIONED_ICU_LIB_PATH}" -a \( "${UNVERSIONED_ICU_LIB_PATH}" -nt "${ICUVERSION_H_PATH}" \) \)
+then
+    mkdir -p "$(dirname "${ICUVERSION_H_PATH}")"
+    test ! -f "${UNVERSIONED_ICU_LIB_PATH}"
+    echo "#define U_DISABLE_RENAMING $?" > "${ICUVERSION_H_PATH}"
+fi
diff --git a/Source/WTF/WTF.vcproj/copy-files.cmd b/Source/WTF/WTF.vcproj/copy-files.cmd
new file mode 100755
index 0000000..f25ef4f
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/copy-files.cmd
@@ -0,0 +1,41 @@
+@echo off

+

+set PrivateHeadersDirectory=%CONFIGURATIONBUILDDIR%\include\private

+set PGOPrivateHeadersDirectory=%CONFIGURATIONBUILDDIR%\..\Release_PGO\include\private

+

+if "%1" EQU "clean" goto :clean

+if "%1" EQU "rebuild" call :clean

+

+echo Copying WTF headers...

+for %%d in (

+    wtf

+    wtf\dtoa

+    wtf\text

+    wtf\threads

+    wtf\unicode

+    wtf\unicode\icu

+) do (

+    mkdir "%PrivateHeadersDirectory%\%%d" 2>NUL

+    xcopy /y /d ..\%%d\*.h "%PrivateHeadersDirectory%\%%d" >NUL

+)

+

+# FIXME: Why is WTF copying over create_hash_table?

+echo Copying other files...

+for %%f in (

+    ..\JavaScriptCore\create_hash_table

+    wtf\text\AtomicString.cpp

+    wtf\text\StringBuilder.cpp

+    wtf\text\StringImpl.cpp

+    wtf\text\WTFString.cpp

+) do (

+    echo F | xcopy /y /d ..\%%f "%PrivateHeadersDirectory%\%%f" >NUL

+    echo F | xcopy /y /d ..\%%f "%PGOPrivateHeadersDirectory%\%%f" >NUL

+)

+

+goto :EOF

+

+:clean

+

+echo Deleting copied files...

+if exist "%PrivateHeadersDirectory%" rmdir /s /q "%PrivateHeadersDirectory%" >NUL

+if exist "%PGOPrivateHeadersDirectory%" rmdir /s /q "%PGOPrivateHeadersDirectory%" >NUL

diff --git a/Source/WTF/WTF.vcproj/work-around-vs-dependency-tracking-bugs.py b/Source/WTF/WTF.vcproj/work-around-vs-dependency-tracking-bugs.py
new file mode 100644
index 0000000..5119118
--- /dev/null
+++ b/Source/WTF/WTF.vcproj/work-around-vs-dependency-tracking-bugs.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+import glob
+import os
+import re
+import sys
+
+
+# It's fragile to rely on the location of this script to find the top-level
+# source directory.
+TOP_LEVEL_DIRECTORY = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
+
+
+def main():
+    react_to_vsprops_changes()
+    react_to_webkit1_interface_changes()
+
+
+def react_to_vsprops_changes():
+    vsprops_directory = os.path.join(TOP_LEVEL_DIRECTORY, 'WebKitLibraries', 'win', 'tools', 'vsprops')
+    newest_vsprops_time = mtime_of_newest_file_matching_glob(os.path.join(vsprops_directory, '*.vsprops'))
+
+    obj_directory = os.path.join(os.environ['CONFIGURATIONBUILDDIR'], 'obj')
+
+    # Visual Studio isn't smart enough to figure out it needs to rebuild these file types when
+    # .vsprops files change (even if we touch wtf/Platform.h below), so we delete them to force them
+    # to be rebuilt.
+    for extension in ('dep', 'manifest', 'pch', 'res'):
+        for filepath in glob.iglob(os.path.join(obj_directory, '*', '*.%s' % extension)):
+            delete_if_older_than(filepath, newest_vsprops_time)
+
+    # Touch wtf/Platform.h so all files will be recompiled. This is necessary
+    # to pick up changes to preprocessor macros (e.g., ENABLE_*).
+    wtf_platform_h = os.path.join(TOP_LEVEL_DIRECTORY, 'Source', 'WTF', 'wtf', 'Platform.h')
+    touch_if_older_than(wtf_platform_h, newest_vsprops_time)
+
+
+def react_to_webkit1_interface_changes():
+    interfaces_directory = os.path.join(TOP_LEVEL_DIRECTORY, 'Source', 'WebKit', 'win', 'Interfaces')
+    newest_idl_time = mtime_of_newest_file_matching_glob(os.path.join(interfaces_directory, '*.idl'))
+    # WebKit.idl includes all the other IDL files, so needs to be rebuilt if any IDL file changes.
+    # But Visual Studio isn't smart enough to figure this out, so we touch WebKit.idl to ensure that
+    # it gets rebuilt.
+    touch_if_older_than(os.path.join(interfaces_directory, 'WebKit.idl'), newest_idl_time)
+
+
+def mtime_of_newest_file_matching_glob(glob_pattern):
+    files = glob.glob(glob_pattern)
+    assert len(files), "Couldn't find any files matching glob %s" % glob_pattern
+    return max(map(os.path.getmtime, files))
+
+
+def delete_if_older_than(path, reference_time):
+    if os.path.getmtime(path) < reference_time:
+        print 'Deleting %s' % path
+        os.remove(path)
+
+
+def touch_if_older_than(path, reference_time):
+    if os.path.getmtime(path) < reference_time:
+        print 'Touching %s' % path
+        os.utime(path, None)
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..8aeebed
--- /dev/null
+++ b/Source/WTF/WTF.xcodeproj/project.pbxproj
@@ -0,0 +1,1506 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXAggregateTarget section */
+		65AFA16F1630B977003D723C /* Copy WTF Headers */ = {
+			isa = PBXAggregateTarget;
+			buildConfigurationList = 65AFA2881630B977003D723C /* Build configuration list for PBXAggregateTarget "Copy WTF Headers" */;
+			buildPhases = (
+				65AFA1701630B977003D723C /* Copy WTF Headers */,
+			);
+			dependencies = (
+			);
+			name = "Copy WTF Headers";
+			productName = "Copy WTF Headers";
+		};
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+		0FD81AC5154FB22E00983E72 /* FastBitVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD81AC4154FB22E00983E72 /* FastBitVector.h */; settings = {ATTRIBUTES = (); }; };
+		143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 143F611D1565F0F900DB514A /* RAMSize.cpp */; };
+		143F61201565F0F900DB514A /* RAMSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 143F611E1565F0F900DB514A /* RAMSize.h */; settings = {ATTRIBUTES = (); }; };
+		14F3B0F715E45E4600210069 /* SaturatedArithmetic.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */; settings = {ATTRIBUTES = (); }; };
+		1A6BB769162F300500DD16DB /* StreamBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6BB768162F300500DD16DB /* StreamBuffer.h */; };
+		26147B0A15DDCCDC00DDB907 /* IntegerToStringConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */; };
+		2661122E160FEAD40013F5C3 /* URLQueryCharsetConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2661122D160FEAD40013F5C3 /* URLQueryCharsetConverter.h */; };
+		26E6C1EE1609037300CA6AF4 /* URLCanonEtc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1CE1609037300CA6AF4 /* URLCanonEtc.cpp */; };
+		26E6C1EF1609037300CA6AF4 /* URLCanonFilesystemurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1CF1609037300CA6AF4 /* URLCanonFilesystemurl.cpp */; };
+		26E6C1F01609037300CA6AF4 /* URLCanonFileurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D01609037300CA6AF4 /* URLCanonFileurl.cpp */; };
+		26E6C1F11609037300CA6AF4 /* URLCanonHost.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D11609037300CA6AF4 /* URLCanonHost.cpp */; };
+		26E6C1F21609037300CA6AF4 /* URLCanonICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D21609037300CA6AF4 /* URLCanonICU.cpp */; };
+		26E6C1F51609037300CA6AF4 /* URLCanonInternal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D51609037300CA6AF4 /* URLCanonInternal.cpp */; };
+		26E6C1F61609037300CA6AF4 /* URLCanonInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1D61609037300CA6AF4 /* URLCanonInternal.h */; };
+		26E6C1F71609037300CA6AF4 /* URLCanonIP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D71609037300CA6AF4 /* URLCanonIP.cpp */; };
+		26E6C1F91609037300CA6AF4 /* URLCanonMailto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1D91609037300CA6AF4 /* URLCanonMailto.cpp */; };
+		26E6C1FA1609037300CA6AF4 /* URLCanonPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1DA1609037300CA6AF4 /* URLCanonPath.cpp */; };
+		26E6C1FB1609037300CA6AF4 /* URLCanonPathurl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1DB1609037300CA6AF4 /* URLCanonPathurl.cpp */; };
+		26E6C1FC1609037300CA6AF4 /* URLCanonQuery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1DC1609037300CA6AF4 /* URLCanonQuery.cpp */; };
+		26E6C1FD1609037300CA6AF4 /* URLCanonRelative.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1DD1609037300CA6AF4 /* URLCanonRelative.cpp */; };
+		26E6C1FF1609037300CA6AF4 /* URLCanonStdURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1DF1609037300CA6AF4 /* URLCanonStdURL.cpp */; };
+		26E6C2011609037300CA6AF4 /* URLCanon.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1E11609037300CA6AF4 /* URLCanon.h */; };
+		26E6C2031609037300CA6AF4 /* URLFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1E31609037300CA6AF4 /* URLFile.h */; };
+		26E6C2041609037300CA6AF4 /* URLParseFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1E41609037300CA6AF4 /* URLParseFile.cpp */; };
+		26E6C2051609037300CA6AF4 /* URLParseInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1E51609037300CA6AF4 /* URLParseInternal.h */; };
+		26E6C2071609037300CA6AF4 /* URLParse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1E71609037300CA6AF4 /* URLParse.cpp */; };
+		26E6C2081609037300CA6AF4 /* URLParse.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1E81609037300CA6AF4 /* URLParse.h */; };
+		26E6C20A1609037300CA6AF4 /* URLUtilInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1EA1609037300CA6AF4 /* URLUtilInternal.h */; };
+		26E6C20C1609037300CA6AF4 /* URLUtil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E6C1EC1609037300CA6AF4 /* URLUtil.cpp */; };
+		26E6C20D1609037300CA6AF4 /* URLUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E6C1ED1609037300CA6AF4 /* URLUtil.h */; };
+		2C05385415BC819000F21B96 /* GregorianDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C05385315BC819000F21B96 /* GregorianDateTime.h */; };
+		2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CCD892915C0390200285083 /* GregorianDateTime.cpp */; };
+		4330F38F15745B0500AAFA8F /* URLString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4330F38E15745B0500AAFA8F /* URLString.cpp */; };
+		4F0321BC156AA8D1006EBAF6 /* BitArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F0321BB156AA8D1006EBAF6 /* BitArray.h */; };
+		4F1B2DB6160B44AA00586559 /* MemoryInstrumentationHashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1B2DB5160B44AA00586559 /* MemoryInstrumentationHashSet.h */; };
+		4F1D115415FF11BE0026E908 /* MemoryInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */; };
+		4FCB710A160A1A07008425EC /* MemoryInstrumentationVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */; };
+		4FCF27E116172E8600CBF037 /* MemoryInstrumentationString.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FCF27E016172E8600CBF037 /* MemoryInstrumentationString.h */; };
+		4FD2A359161B0EE100EBF236 /* MemoryInstrumentationParsedURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FD2A358161B0EE100EBF236 /* MemoryInstrumentationParsedURL.h */; };
+		4FD8554716133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FD8554616133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h */; };
+		7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */; };
+		8134013815B092FD001FF0B8 /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8134013615B092FD001FF0B8 /* Base64.cpp */; };
+		8134013915B092FD001FF0B8 /* Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8134013715B092FD001FF0B8 /* Base64.h */; };
+		A876DBD8151816E500DADB95 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = A876DBD7151816E500DADB95 /* Platform.h */; };
+		A8A4737F151A825B004123FF /* Alignment.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47254151A825A004123FF /* Alignment.h */; };
+		A8A47380151A825B004123FF /* AlwaysInline.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47255151A825A004123FF /* AlwaysInline.h */; };
+		A8A47381151A825B004123FF /* ArrayBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47256151A825A004123FF /* ArrayBuffer.cpp */; };
+		A8A47382151A825B004123FF /* ArrayBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47257151A825A004123FF /* ArrayBuffer.h */; };
+		A8A47383151A825B004123FF /* ArrayBufferView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47258151A825A004123FF /* ArrayBufferView.cpp */; };
+		A8A47384151A825B004123FF /* ArrayBufferView.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47259151A825A004123FF /* ArrayBufferView.h */; };
+		A8A47385151A825B004123FF /* ASCIICType.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4725A151A825A004123FF /* ASCIICType.h */; };
+		A8A47386151A825B004123FF /* Assertions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4725B151A825A004123FF /* Assertions.cpp */; };
+		A8A47387151A825B004123FF /* Assertions.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4725C151A825A004123FF /* Assertions.h */; };
+		A8A47388151A825B004123FF /* Atomics.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4725D151A825A004123FF /* Atomics.h */; };
+		A8A47389151A825B004123FF /* AVLTree.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4725E151A825A004123FF /* AVLTree.h */; };
+		A8A4738A151A825B004123FF /* Bitmap.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4725F151A825A004123FF /* Bitmap.h */; };
+		A8A4738B151A825B004123FF /* BitVector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47260151A825A004123FF /* BitVector.cpp */; };
+		A8A4738C151A825B004123FF /* BitVector.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47261151A825A004123FF /* BitVector.h */; };
+		A8A4738E151A825B004123FF /* BlockStack.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47264151A825A004123FF /* BlockStack.h */; };
+		A8A4738F151A825B004123FF /* BloomFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47265151A825A004123FF /* BloomFilter.h */; };
+		A8A47390151A825B004123FF /* BoundsCheckedPointer.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47266151A825A004123FF /* BoundsCheckedPointer.h */; };
+		A8A47391151A825B004123FF /* BumpPointerAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47267151A825A004123FF /* BumpPointerAllocator.h */; };
+		A8A47394151A825B004123FF /* CheckedArithmetic.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4726A151A825A004123FF /* CheckedArithmetic.h */; };
+		A8A47395151A825B004123FF /* CheckedBoolean.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4726B151A825A004123FF /* CheckedBoolean.h */; };
+		A8A47398151A825B004123FF /* Compiler.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47270151A825A004123FF /* Compiler.h */; };
+		A8A47399151A825B004123FF /* Complex.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47271151A825A004123FF /* Complex.h */; };
+		A8A4739A151A825B004123FF /* CryptographicallyRandomNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47273151A825A004123FF /* CryptographicallyRandomNumber.cpp */; };
+		A8A4739B151A825B004123FF /* CryptographicallyRandomNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47274151A825A004123FF /* CryptographicallyRandomNumber.h */; };
+		A8A4739C151A825B004123FF /* CurrentTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47275151A825A004123FF /* CurrentTime.cpp */; };
+		A8A4739D151A825B004123FF /* CurrentTime.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47276151A825A004123FF /* CurrentTime.h */; };
+		A8A4739E151A825B004123FF /* DataLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47277151A825A004123FF /* DataLog.cpp */; };
+		A8A4739F151A825B004123FF /* DataLog.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47278151A825A004123FF /* DataLog.h */; };
+		A8A473A0151A825B004123FF /* DateMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47279151A825A004123FF /* DateMath.cpp */; };
+		A8A473A1151A825B004123FF /* DateMath.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4727A151A825A004123FF /* DateMath.h */; };
+		A8A473A2151A825B004123FF /* DecimalNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4727B151A825A004123FF /* DecimalNumber.cpp */; };
+		A8A473A3151A825B004123FF /* DecimalNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4727C151A825A004123FF /* DecimalNumber.h */; };
+		A8A473A4151A825B004123FF /* Decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4727D151A825A004123FF /* Decoder.h */; };
+		A8A473A5151A825B004123FF /* Deque.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4727E151A825A004123FF /* Deque.h */; };
+		A8A473A6151A825B004123FF /* DisallowCType.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4727F151A825A004123FF /* DisallowCType.h */; };
+		A8A473A7151A825B004123FF /* DoublyLinkedList.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47280151A825A004123FF /* DoublyLinkedList.h */; };
+		A8A473A8151A825B004123FF /* bignum-dtoa.cc in Sources */ = {isa = PBXBuildFile; fileRef = A8A47282151A825A004123FF /* bignum-dtoa.cc */; };
+		A8A473A9151A825B004123FF /* bignum-dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47283151A825A004123FF /* bignum-dtoa.h */; };
+		A8A473AA151A825B004123FF /* bignum.cc in Sources */ = {isa = PBXBuildFile; fileRef = A8A47284151A825A004123FF /* bignum.cc */; };
+		A8A473AB151A825B004123FF /* bignum.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47285151A825A004123FF /* bignum.h */; };
+		A8A473AC151A825B004123FF /* cached-powers.cc in Sources */ = {isa = PBXBuildFile; fileRef = A8A47286151A825A004123FF /* cached-powers.cc */; };
+		A8A473AD151A825B004123FF /* cached-powers.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47287151A825A004123FF /* cached-powers.h */; };
+		A8A473AE151A825B004123FF /* diy-fp.cc in Sources */ = {isa = PBXBuildFile; fileRef = A8A47289151A825A004123FF /* diy-fp.cc */; };
+		A8A473AF151A825B004123FF /* diy-fp.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4728A151A825A004123FF /* diy-fp.h */; };
+		A8A473B0151A825B004123FF /* double-conversion.cc in Sources */ = {isa = PBXBuildFile; fileRef = A8A4728B151A825A004123FF /* double-conversion.cc */; };
+		A8A473B1151A825B004123FF /* double-conversion.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4728C151A825A004123FF /* double-conversion.h */; };
+		A8A473B2151A825B004123FF /* double.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4728D151A825A004123FF /* double.h */; };
+		A8A473B3151A825B004123FF /* fast-dtoa.cc in Sources */ = {isa = PBXBuildFile; fileRef = A8A4728E151A825A004123FF /* fast-dtoa.cc */; };
+		A8A473B4151A825B004123FF /* fast-dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4728F151A825A004123FF /* fast-dtoa.h */; };
+		A8A473B5151A825B004123FF /* fixed-dtoa.cc in Sources */ = {isa = PBXBuildFile; fileRef = A8A47290151A825A004123FF /* fixed-dtoa.cc */; };
+		A8A473B6151A825B004123FF /* fixed-dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47291151A825A004123FF /* fixed-dtoa.h */; };
+		A8A473B7151A825B004123FF /* strtod.cc in Sources */ = {isa = PBXBuildFile; fileRef = A8A47294151A825A004123FF /* strtod.cc */; };
+		A8A473B8151A825B004123FF /* strtod.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47295151A825A004123FF /* strtod.h */; };
+		A8A473B9151A825B004123FF /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47296151A825A004123FF /* utils.h */; };
+		A8A473BA151A825B004123FF /* dtoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47297151A825A004123FF /* dtoa.cpp */; };
+		A8A473BB151A825B004123FF /* dtoa.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47298151A825A004123FF /* dtoa.h */; };
+		A8A473BC151A825B004123FF /* DynamicAnnotations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47299151A825A004123FF /* DynamicAnnotations.cpp */; };
+		A8A473BD151A825B004123FF /* DynamicAnnotations.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4729A151A825A004123FF /* DynamicAnnotations.h */; };
+		A8A473C0151A825B004123FF /* Encoder.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4729E151A825A004123FF /* Encoder.h */; };
+		A8A473C1151A825B004123FF /* ExportMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4729F151A825A004123FF /* ExportMacros.h */; };
+		A8A473C2151A825B004123FF /* FastAllocBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472A0151A825A004123FF /* FastAllocBase.h */; };
+		A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472A1151A825A004123FF /* FastMalloc.cpp */; };
+		A8A473C4151A825B004123FF /* FastMalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472A2151A825A004123FF /* FastMalloc.h */; };
+		A8A473C5151A825B004123FF /* FixedArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472A3151A825A004123FF /* FixedArray.h */; };
+		A8A473C6151A825B004123FF /* Float32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472A4151A825A004123FF /* Float32Array.h */; };
+		A8A473C7151A825B004123FF /* Float64Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472A5151A825A004123FF /* Float64Array.h */; };
+		A8A473C8151A825B004123FF /* Forward.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472A6151A825A004123FF /* Forward.h */; };
+		A8A473C9151A825B004123FF /* Functional.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472A7151A825A004123FF /* Functional.h */; };
+		A8A473CA151A825B004123FF /* GetPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472A8151A825A004123FF /* GetPtr.h */; };
+		A8A473D3151A825B004123FF /* HashCountedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472B3151A825A004123FF /* HashCountedSet.h */; };
+		A8A473D4151A825B004123FF /* HashFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472B4151A825A004123FF /* HashFunctions.h */; };
+		A8A473D5151A825B004123FF /* HashIterators.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472B5151A825A004123FF /* HashIterators.h */; };
+		A8A473D6151A825B004123FF /* HashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472B6151A825A004123FF /* HashMap.h */; };
+		A8A473D7151A825B004123FF /* HashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472B7151A825A004123FF /* HashSet.h */; };
+		A8A473D8151A825B004123FF /* HashTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472B8151A825A004123FF /* HashTable.cpp */; };
+		A8A473D9151A825B004123FF /* HashTable.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472B9151A825A004123FF /* HashTable.h */; };
+		A8A473DA151A825B004123FF /* HashTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472BA151A825A004123FF /* HashTraits.h */; };
+		A8A473DB151A825B004123FF /* HexNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472BB151A825A004123FF /* HexNumber.h */; };
+		A8A473DC151A825B004123FF /* InlineASM.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472BC151A825A004123FF /* InlineASM.h */; };
+		A8A473DD151A825B004123FF /* Int8Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472BD151A825A004123FF /* Int8Array.h */; };
+		A8A473DE151A825B004123FF /* Int16Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472BE151A825A004123FF /* Int16Array.h */; };
+		A8A473DF151A825B004123FF /* Int32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472BF151A825A004123FF /* Int32Array.h */; };
+		A8A473E0151A825B004123FF /* IntegralTypedArrayBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C0151A825A004123FF /* IntegralTypedArrayBase.h */; };
+		A8A473E1151A825B004123FF /* ListHashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C1151A825A004123FF /* ListHashSet.h */; };
+		A8A473E2151A825B004123FF /* ListRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C2151A825A004123FF /* ListRefPtr.h */; };
+		A8A473E3151A825B004123FF /* Locker.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C3151A825A004123FF /* Locker.h */; };
+		A8A473E4151A825B004123FF /* MainThreadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8A472C5151A825A004123FF /* MainThreadMac.mm */; };
+		A8A473E5151A825B004123FF /* MainThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472C6151A825A004123FF /* MainThread.cpp */; };
+		A8A473E6151A825B004123FF /* MainThread.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C7151A825B004123FF /* MainThread.h */; };
+		A8A473E7151A825B004123FF /* MallocZoneSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C8151A825B004123FF /* MallocZoneSupport.h */; };
+		A8A473E8151A825B004123FF /* MathExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C9151A825B004123FF /* MathExtras.h */; };
+		A8A473E9151A825B004123FF /* MD5.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472CA151A825B004123FF /* MD5.cpp */; };
+		A8A473EA151A825B004123FF /* MD5.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472CB151A825B004123FF /* MD5.h */; };
+		A8A473EB151A825B004123FF /* MessageQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472CC151A825B004123FF /* MessageQueue.h */; };
+		A8A473EC151A825B004123FF /* MetaAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472CD151A825B004123FF /* MetaAllocator.cpp */; };
+		A8A473ED151A825B004123FF /* MetaAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472CE151A825B004123FF /* MetaAllocator.h */; };
+		A8A473EE151A825B004123FF /* MetaAllocatorHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472CF151A825B004123FF /* MetaAllocatorHandle.h */; };
+		A8A473EF151A825B004123FF /* Noncopyable.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472D0151A825B004123FF /* Noncopyable.h */; };
+		A8A473F0151A825B004123FF /* NonCopyingSort.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472D1151A825B004123FF /* NonCopyingSort.h */; };
+		A8A473F1151A825B004123FF /* NotFound.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472D2151A825B004123FF /* NotFound.h */; };
+		A8A473F2151A825B004123FF /* NullPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472D3151A825B004123FF /* NullPtr.cpp */; };
+		A8A473F3151A825B004123FF /* NullPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472D4151A825B004123FF /* NullPtr.h */; };
+		A8A473F4151A825B004123FF /* NumberOfCores.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472D5151A825B004123FF /* NumberOfCores.cpp */; };
+		A8A473F5151A825B004123FF /* NumberOfCores.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472D6151A825B004123FF /* NumberOfCores.h */; };
+		A8A473F6151A825B004123FF /* OSAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472D7151A825B004123FF /* OSAllocator.h */; };
+		A8A473F7151A825B004123FF /* OSAllocatorPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */; };
+		A8A473F9151A825B004123FF /* OSRandomSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472DA151A825B004123FF /* OSRandomSource.cpp */; };
+		A8A473FA151A825B004123FF /* OSRandomSource.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DB151A825B004123FF /* OSRandomSource.h */; };
+		A8A473FB151A825B004123FF /* OwnArrayPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DC151A825B004123FF /* OwnArrayPtr.h */; };
+		A8A473FC151A825B004123FF /* OwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DD151A825B004123FF /* OwnPtr.h */; };
+		A8A473FD151A825B004123FF /* OwnPtrCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DE151A825B004123FF /* OwnPtrCommon.h */; };
+		A8A473FE151A825B004123FF /* PackedIntVector.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472DF151A825B004123FF /* PackedIntVector.h */; };
+		A8A473FF151A825B004123FF /* PageAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E0151A825B004123FF /* PageAllocation.h */; };
+		A8A47400151A825B004123FF /* PageAllocationAligned.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472E1151A825B004123FF /* PageAllocationAligned.cpp */; };
+		A8A47401151A825B004123FF /* PageAllocationAligned.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E2151A825B004123FF /* PageAllocationAligned.h */; };
+		A8A47402151A825B004123FF /* PageBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472E3151A825B004123FF /* PageBlock.cpp */; };
+		A8A47403151A825B004123FF /* PageBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E4151A825B004123FF /* PageBlock.h */; };
+		A8A47404151A825B004123FF /* PageReservation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E5151A825B004123FF /* PageReservation.h */; };
+		A8A47405151A825B004123FF /* ParallelJobs.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E6151A825B004123FF /* ParallelJobs.h */; };
+		A8A47408151A825B004123FF /* ParallelJobsLibdispatch.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */; };
+		A8A4740A151A825B004123FF /* PassOwnArrayPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472EB151A825B004123FF /* PassOwnArrayPtr.h */; };
+		A8A4740B151A825B004123FF /* PassOwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472EC151A825B004123FF /* PassOwnPtr.h */; };
+		A8A4740C151A825B004123FF /* PassRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472ED151A825B004123FF /* PassRefPtr.h */; };
+		A8A4740D151A825B004123FF /* PassTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472EE151A825B004123FF /* PassTraits.h */; };
+		A8A4740E151A825B004123FF /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472EF151A825B004123FF /* Platform.h */; };
+		A8A4740F151A825B004123FF /* PossiblyNull.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472F3151A825B004123FF /* PossiblyNull.h */; };
+		A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472FB151A825B004123FF /* RandomNumber.cpp */; };
+		A8A47415151A825B004123FF /* RandomNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472FC151A825B004123FF /* RandomNumber.h */; };
+		A8A47416151A825B004123FF /* RandomNumberSeed.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472FD151A825B004123FF /* RandomNumberSeed.h */; };
+		A8A47417151A825B004123FF /* RedBlackTree.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472FE151A825B004123FF /* RedBlackTree.h */; };
+		A8A47418151A825B004123FF /* RefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472FF151A825B004123FF /* RefCounted.h */; };
+		A8A47419151A825B004123FF /* RefCountedArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47300151A825B004123FF /* RefCountedArray.h */; };
+		A8A4741A151A825B004123FF /* RefCountedLeakCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47301151A825B004123FF /* RefCountedLeakCounter.cpp */; };
+		A8A4741B151A825B004123FF /* RefCountedLeakCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47302151A825B004123FF /* RefCountedLeakCounter.h */; };
+		A8A4741C151A825B004123FF /* RefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47303151A825B004123FF /* RefPtr.h */; };
+		A8A4741D151A825B004123FF /* RefPtrHashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47304151A825B004123FF /* RefPtrHashMap.h */; };
+		A8A4741E151A825B004123FF /* RetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47305151A825B004123FF /* RetainPtr.h */; };
+		A8A4741F151A825B004123FF /* SegmentedVector.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47306151A825B004123FF /* SegmentedVector.h */; };
+		A8A47420151A825B004123FF /* SentinelLinkedList.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47307151A825B004123FF /* SentinelLinkedList.h */; };
+		A8A47421151A825B004123FF /* SHA1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47308151A825B004123FF /* SHA1.cpp */; };
+		A8A47422151A825B004123FF /* SHA1.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47309151A825B004123FF /* SHA1.h */; };
+		A8A47423151A825B004123FF /* SimpleStats.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4730A151A825B004123FF /* SimpleStats.h */; };
+		A8A47424151A825B004123FF /* SinglyLinkedList.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4730B151A825B004123FF /* SinglyLinkedList.h */; };
+		A8A47425151A825B004123FF /* SizeLimits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4730C151A825B004123FF /* SizeLimits.cpp */; };
+		A8A47426151A825B004123FF /* Spectrum.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4730D151A825B004123FF /* Spectrum.h */; };
+		A8A47427151A825B004123FF /* StackBounds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4730E151A825B004123FF /* StackBounds.cpp */; };
+		A8A47428151A825B004123FF /* StackBounds.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4730F151A825B004123FF /* StackBounds.h */; };
+		A8A47429151A825B004123FF /* StaticConstructors.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47310151A825B004123FF /* StaticConstructors.h */; };
+		A8A4742A151A825B004123FF /* StdLibExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47311151A825B004123FF /* StdLibExtras.h */; };
+		A8A4742B151A825B004123FF /* StringExtras.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47312151A825B004123FF /* StringExtras.cpp */; };
+		A8A4742C151A825B004123FF /* StringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47313151A825B004123FF /* StringExtras.h */; };
+		A8A4742D151A825B004123FF /* StringHasher.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47314151A825B004123FF /* StringHasher.h */; };
+		A8A4742E151A825B004123FF /* TCPackedCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47315151A825B004123FF /* TCPackedCache.h */; };
+		A8A4742F151A825B004123FF /* TCPageMap.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47316151A825B004123FF /* TCPageMap.h */; };
+		A8A47430151A825B004123FF /* TCSpinLock.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47317151A825B004123FF /* TCSpinLock.h */; };
+		A8A47431151A825B004123FF /* TCSystemAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47318151A825B004123FF /* TCSystemAlloc.cpp */; };
+		A8A47432151A825B004123FF /* TCSystemAlloc.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47319151A825B004123FF /* TCSystemAlloc.h */; };
+		A8A47433151A825B004123FF /* TemporaryChange.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4731A151A825B004123FF /* TemporaryChange.h */; };
+		A8A47434151A825B004123FF /* ASCIIFastPath.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4731C151A825B004123FF /* ASCIIFastPath.h */; };
+		A8A47435151A825B004123FF /* AtomicString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4731D151A825B004123FF /* AtomicString.cpp */; };
+		A8A47436151A825B004123FF /* AtomicString.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4731E151A825B004123FF /* AtomicString.h */; };
+		A8A47437151A825B004123FF /* AtomicStringHash.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4731F151A825B004123FF /* AtomicStringHash.h */; };
+		A8A47438151A825B004123FF /* AtomicStringImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47320151A825B004123FF /* AtomicStringImpl.h */; };
+		A8A47439151A825B004123FF /* CString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47321151A825B004123FF /* CString.cpp */; };
+		A8A4743A151A825B004123FF /* CString.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47322151A825B004123FF /* CString.h */; };
+		A8A4743B151A825B004123FF /* StringBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47323151A825B004123FF /* StringBuffer.h */; };
+		A8A4743C151A825B004123FF /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47324151A825B004123FF /* StringBuilder.cpp */; };
+		A8A4743D151A825B004123FF /* StringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47325151A825B004123FF /* StringBuilder.h */; };
+		A8A4743E151A825B004123FF /* StringConcatenate.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47326151A825B004123FF /* StringConcatenate.h */; };
+		A8A4743F151A825B004123FF /* StringHash.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47327151A825B004123FF /* StringHash.h */; };
+		A8A47440151A825B004123FF /* StringImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47328151A825B004123FF /* StringImpl.cpp */; };
+		A8A47441151A825B004123FF /* StringImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47329151A825B004123FF /* StringImpl.h */; };
+		A8A47442151A825B004123FF /* StringOperators.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4732A151A825B004123FF /* StringOperators.h */; };
+		A8A47443151A825B004123FF /* StringStatics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4732B151A825B004123FF /* StringStatics.cpp */; };
+		A8A47444151A825B004123FF /* TextPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4732C151A825B004123FF /* TextPosition.h */; };
+		A8A47445151A825B004123FF /* WTFString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4732D151A825B004123FF /* WTFString.cpp */; };
+		A8A47446151A825B004123FF /* WTFString.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4732E151A825B004123FF /* WTFString.h */; };
+		A8A47447151A825B004123FF /* ThreadFunctionInvocation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4732F151A825B004123FF /* ThreadFunctionInvocation.h */; };
+		A8A47448151A825B004123FF /* ThreadIdentifierDataPthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47330151A825B004123FF /* ThreadIdentifierDataPthreads.cpp */; };
+		A8A47449151A825B004123FF /* ThreadIdentifierDataPthreads.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47331151A825B004123FF /* ThreadIdentifierDataPthreads.h */; };
+		A8A4744A151A825B004123FF /* Threading.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47332151A825B004123FF /* Threading.cpp */; };
+		A8A4744B151A825B004123FF /* Threading.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47333151A825B004123FF /* Threading.h */; };
+		A8A4744D151A825B004123FF /* ThreadingPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47335151A825B004123FF /* ThreadingPrimitives.h */; };
+		A8A4744E151A825B004123FF /* ThreadingPthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47336151A825B004123FF /* ThreadingPthreads.cpp */; };
+		A8A47450151A825B004123FF /* ThreadRestrictionVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47338151A825B004123FF /* ThreadRestrictionVerifier.h */; };
+		A8A47451151A825B004123FF /* BinarySemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4733A151A825B004123FF /* BinarySemaphore.cpp */; };
+		A8A47452151A825B004123FF /* BinarySemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4733B151A825B004123FF /* BinarySemaphore.h */; };
+		A8A47454151A825B004123FF /* ThreadSafeRefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4733E151A825B004123FF /* ThreadSafeRefCounted.h */; };
+		A8A47455151A825B004123FF /* ThreadSpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4733F151A825B004123FF /* ThreadSpecific.h */; };
+		A8A47457151A825B004123FF /* TypedArrayBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47341151A825B004123FF /* TypedArrayBase.h */; };
+		A8A47458151A825B004123FF /* TypeTraits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47342151A825B004123FF /* TypeTraits.cpp */; };
+		A8A47459151A825B004123FF /* TypeTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47343151A825B004123FF /* TypeTraits.h */; };
+		A8A4745A151A825B004123FF /* Uint8Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47344151A825B004123FF /* Uint8Array.h */; };
+		A8A4745B151A825B004123FF /* Uint8ClampedArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47345151A825B004123FF /* Uint8ClampedArray.h */; };
+		A8A4745C151A825B004123FF /* Uint16Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47346151A825B004123FF /* Uint16Array.h */; };
+		A8A4745D151A825B004123FF /* Uint32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47347151A825B004123FF /* Uint32Array.h */; };
+		A8A4745E151A825B004123FF /* CharacterNames.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47349151A825B004123FF /* CharacterNames.h */; };
+		A8A4745F151A825B004123FF /* Collator.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4734A151A825B004123FF /* Collator.h */; };
+		A8A47460151A825B004123FF /* CollatorDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4734B151A825B004123FF /* CollatorDefault.cpp */; };
+		A8A47463151A825B004123FF /* CollatorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47350151A825B004123FF /* CollatorICU.cpp */; };
+		A8A47464151A825B004123FF /* UnicodeIcu.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47351151A825B004123FF /* UnicodeIcu.h */; };
+		A8A47466151A825B004123FF /* ScriptCodesFromICU.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47354151A825B004123FF /* ScriptCodesFromICU.h */; };
+		A8A47467151A825B004123FF /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47355151A825B004123FF /* Unicode.h */; };
+		A8A47468151A825B004123FF /* UnicodeMacrosFromICU.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47356151A825B004123FF /* UnicodeMacrosFromICU.h */; };
+		A8A47469151A825B004123FF /* UTF8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47357151A825B004123FF /* UTF8.cpp */; };
+		A8A4746A151A825B004123FF /* UTF8.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47358151A825B004123FF /* UTF8.h */; };
+		A8A4746D151A825B004123FF /* UnionFind.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4735C151A825B004123FF /* UnionFind.h */; };
+		A8A4746E151A825B004123FF /* UnusedParam.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4735D151A825B004123FF /* UnusedParam.h */; };
+		A8A4746F151A825B004123FF /* ParsedURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47360151A825B004123FF /* ParsedURL.cpp */; };
+		A8A47470151A825B004123FF /* ParsedURL.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47361151A825B004123FF /* ParsedURL.h */; };
+		A8A47471151A825B004123FF /* URLString.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47362151A825B004123FF /* URLString.h */; };
+		A8A47472151A825B004123FF /* RawURLBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47364151A825B004123FF /* RawURLBuffer.h */; };
+		A8A47473151A825B004123FF /* URLBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47365151A825B004123FF /* URLBuffer.h */; };
+		A8A47474151A825B004123FF /* URLCharacterTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47366151A825B004123FF /* URLCharacterTypes.cpp */; };
+		A8A47475151A825B004123FF /* URLCharacterTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47367151A825B004123FF /* URLCharacterTypes.h */; };
+		A8A47476151A825B004123FF /* URLComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47368151A825B004123FF /* URLComponent.h */; };
+		A8A4747B151A825B004123FF /* URLSegments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4736D151A825B004123FF /* URLSegments.cpp */; };
+		A8A4747C151A825B004123FF /* URLSegments.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4736E151A825B004123FF /* URLSegments.h */; };
+		A8A4747D151A825B004123FF /* ValueCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4736F151A825B004123FF /* ValueCheck.h */; };
+		A8A4747E151A825B004123FF /* Vector.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47370151A825B004123FF /* Vector.h */; };
+		A8A4747F151A825B004123FF /* VectorTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47371151A825B004123FF /* VectorTraits.h */; };
+		A8A47480151A825B004123FF /* VMTags.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47372151A825B004123FF /* VMTags.h */; };
+		A8A47486151A825B004123FF /* WTFThreadData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4737A151A825B004123FF /* WTFThreadData.cpp */; };
+		A8A47487151A825B004123FF /* WTFThreadData.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4737B151A825B004123FF /* WTFThreadData.h */; };
+		A8A4748C151A8264004123FF /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4748B151A8264004123FF /* config.h */; };
+		CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497AA15857D0300B5BC30 /* MediaTime.cpp */; };
+		CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5497AB15857D0300B5BC30 /* MediaTime.h */; };
+		EB95E1F0161A72410089A2F5 /* ByteOrder.h in Headers */ = {isa = PBXBuildFile; fileRef = EB95E1EF161A72410089A2F5 /* ByteOrder.h */; };
+		F3525E2A16149FF400278BC1 /* MemoryInstrumentationListHashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = F3525E2916149FF400278BC1 /* MemoryInstrumentationListHashSet.h */; };
+		F3525E461619A4EE00278BC1 /* MemoryInstrumentationHashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = F3525E451619A4EE00278BC1 /* MemoryInstrumentationHashMap.h */; };
+		F3FBC71E161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FBC71D161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h */; };
+		F3FBC720161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FBC71F161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h */; };
+		FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDACD3B1630F83F00C69634 /* StackStats.cpp */; };
+		FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDACD3C1630F83F00C69634 /* StackStats.h */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		65AFA28D1630B99E003D723C /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 5D247B5914689B8600E78B76 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 65AFA16F1630B977003D723C;
+			remoteInfo = "Copy Headers";
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		0FD81AC4154FB22E00983E72 /* FastBitVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastBitVector.h; sourceTree = "<group>"; };
+		143F611D1565F0F900DB514A /* RAMSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RAMSize.cpp; sourceTree = "<group>"; };
+		143F611E1565F0F900DB514A /* RAMSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAMSize.h; sourceTree = "<group>"; };
+		14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SaturatedArithmetic.h; sourceTree = "<group>"; };
+		1A6BB768162F300500DD16DB /* StreamBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamBuffer.h; sourceTree = "<group>"; };
+		26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntegerToStringConversion.h; sourceTree = "<group>"; };
+		2661122D160FEAD40013F5C3 /* URLQueryCharsetConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLQueryCharsetConverter.h; sourceTree = "<group>"; };
+		26E6C1CE1609037300CA6AF4 /* URLCanonEtc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonEtc.cpp; sourceTree = "<group>"; };
+		26E6C1CF1609037300CA6AF4 /* URLCanonFilesystemurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonFilesystemurl.cpp; sourceTree = "<group>"; };
+		26E6C1D01609037300CA6AF4 /* URLCanonFileurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonFileurl.cpp; sourceTree = "<group>"; };
+		26E6C1D11609037300CA6AF4 /* URLCanonHost.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonHost.cpp; sourceTree = "<group>"; };
+		26E6C1D21609037300CA6AF4 /* URLCanonICU.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonICU.cpp; sourceTree = "<group>"; };
+		26E6C1D51609037300CA6AF4 /* URLCanonInternal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonInternal.cpp; sourceTree = "<group>"; };
+		26E6C1D61609037300CA6AF4 /* URLCanonInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLCanonInternal.h; sourceTree = "<group>"; };
+		26E6C1D71609037300CA6AF4 /* URLCanonIP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonIP.cpp; sourceTree = "<group>"; };
+		26E6C1D91609037300CA6AF4 /* URLCanonMailto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonMailto.cpp; sourceTree = "<group>"; };
+		26E6C1DA1609037300CA6AF4 /* URLCanonPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonPath.cpp; sourceTree = "<group>"; };
+		26E6C1DB1609037300CA6AF4 /* URLCanonPathurl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonPathurl.cpp; sourceTree = "<group>"; };
+		26E6C1DC1609037300CA6AF4 /* URLCanonQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonQuery.cpp; sourceTree = "<group>"; };
+		26E6C1DD1609037300CA6AF4 /* URLCanonRelative.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonRelative.cpp; sourceTree = "<group>"; };
+		26E6C1DF1609037300CA6AF4 /* URLCanonStdURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCanonStdURL.cpp; sourceTree = "<group>"; };
+		26E6C1E11609037300CA6AF4 /* URLCanon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLCanon.h; sourceTree = "<group>"; };
+		26E6C1E31609037300CA6AF4 /* URLFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLFile.h; sourceTree = "<group>"; };
+		26E6C1E41609037300CA6AF4 /* URLParseFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLParseFile.cpp; sourceTree = "<group>"; };
+		26E6C1E51609037300CA6AF4 /* URLParseInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLParseInternal.h; sourceTree = "<group>"; };
+		26E6C1E71609037300CA6AF4 /* URLParse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLParse.cpp; sourceTree = "<group>"; };
+		26E6C1E81609037300CA6AF4 /* URLParse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLParse.h; sourceTree = "<group>"; };
+		26E6C1EA1609037300CA6AF4 /* URLUtilInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLUtilInternal.h; sourceTree = "<group>"; };
+		26E6C1EC1609037300CA6AF4 /* URLUtil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLUtil.cpp; sourceTree = "<group>"; };
+		26E6C1ED1609037300CA6AF4 /* URLUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLUtil.h; sourceTree = "<group>"; };
+		2C05385315BC819000F21B96 /* GregorianDateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GregorianDateTime.h; sourceTree = "<group>"; };
+		2CCD892915C0390200285083 /* GregorianDateTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GregorianDateTime.cpp; sourceTree = "<group>"; };
+		4330F38E15745B0500AAFA8F /* URLString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLString.cpp; sourceTree = "<group>"; };
+		4F0321BB156AA8D1006EBAF6 /* BitArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitArray.h; sourceTree = "<group>"; };
+		4F1B2DB5160B44AA00586559 /* MemoryInstrumentationHashSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationHashSet.h; sourceTree = "<group>"; };
+		4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentation.h; sourceTree = "<group>"; };
+		4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationVector.h; sourceTree = "<group>"; };
+		4FCF27E016172E8600CBF037 /* MemoryInstrumentationString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationString.h; sourceTree = "<group>"; };
+		4FD2A358161B0EE100EBF236 /* MemoryInstrumentationParsedURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationParsedURL.h; sourceTree = "<group>"; };
+		4FD8554616133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationArrayBufferView.h; sourceTree = "<group>"; };
+		5D247B6214689B8600E78B76 /* libWTF.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libWTF.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		5D247B6E14689C4700E78B76 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
+		5D247B7014689C4700E78B76 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
+		5D247B7314689C4700E78B76 /* WTF.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WTF.xcconfig; sourceTree = "<group>"; };
+		5D247EB11468B01500E78B76 /* HeaderDetection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HeaderDetection.h; path = DerivedSources/WTF/HeaderDetection.h; sourceTree = BUILT_PRODUCTS_DIR; };
+		6541CAF41630DB26006D0DEC /* CopyWTFHeaders.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CopyWTFHeaders.xcconfig; sourceTree = "<group>"; };
+		7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjcRuntimeExtras.h; sourceTree = "<group>"; };
+		8134013615B092FD001FF0B8 /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Base64.cpp; sourceTree = "<group>"; };
+		8134013715B092FD001FF0B8 /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; };
+		A876DBD7151816E500DADB95 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
+		A8A47254151A825A004123FF /* Alignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Alignment.h; sourceTree = "<group>"; };
+		A8A47255151A825A004123FF /* AlwaysInline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlwaysInline.h; sourceTree = "<group>"; };
+		A8A47256151A825A004123FF /* ArrayBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayBuffer.cpp; sourceTree = "<group>"; };
+		A8A47257151A825A004123FF /* ArrayBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayBuffer.h; sourceTree = "<group>"; };
+		A8A47258151A825A004123FF /* ArrayBufferView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayBufferView.cpp; sourceTree = "<group>"; };
+		A8A47259151A825A004123FF /* ArrayBufferView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayBufferView.h; sourceTree = "<group>"; };
+		A8A4725A151A825A004123FF /* ASCIICType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCIICType.h; sourceTree = "<group>"; };
+		A8A4725B151A825A004123FF /* Assertions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Assertions.cpp; sourceTree = "<group>"; };
+		A8A4725C151A825A004123FF /* Assertions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Assertions.h; sourceTree = "<group>"; };
+		A8A4725D151A825A004123FF /* Atomics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Atomics.h; sourceTree = "<group>"; };
+		A8A4725E151A825A004123FF /* AVLTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVLTree.h; sourceTree = "<group>"; };
+		A8A4725F151A825A004123FF /* Bitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bitmap.h; sourceTree = "<group>"; };
+		A8A47260151A825A004123FF /* BitVector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BitVector.cpp; sourceTree = "<group>"; };
+		A8A47261151A825A004123FF /* BitVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitVector.h; sourceTree = "<group>"; };
+		A8A47264151A825A004123FF /* BlockStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlockStack.h; sourceTree = "<group>"; };
+		A8A47265151A825A004123FF /* BloomFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BloomFilter.h; sourceTree = "<group>"; };
+		A8A47266151A825A004123FF /* BoundsCheckedPointer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BoundsCheckedPointer.h; sourceTree = "<group>"; };
+		A8A47267151A825A004123FF /* BumpPointerAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BumpPointerAllocator.h; sourceTree = "<group>"; };
+		A8A4726A151A825A004123FF /* CheckedArithmetic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CheckedArithmetic.h; sourceTree = "<group>"; };
+		A8A4726B151A825A004123FF /* CheckedBoolean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CheckedBoolean.h; sourceTree = "<group>"; };
+		A8A47270151A825A004123FF /* Compiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Compiler.h; sourceTree = "<group>"; };
+		A8A47271151A825A004123FF /* Complex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Complex.h; sourceTree = "<group>"; };
+		A8A47273151A825A004123FF /* CryptographicallyRandomNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptographicallyRandomNumber.cpp; sourceTree = "<group>"; };
+		A8A47274151A825A004123FF /* CryptographicallyRandomNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptographicallyRandomNumber.h; sourceTree = "<group>"; };
+		A8A47275151A825A004123FF /* CurrentTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CurrentTime.cpp; sourceTree = "<group>"; };
+		A8A47276151A825A004123FF /* CurrentTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CurrentTime.h; sourceTree = "<group>"; };
+		A8A47277151A825A004123FF /* DataLog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataLog.cpp; sourceTree = "<group>"; };
+		A8A47278151A825A004123FF /* DataLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataLog.h; sourceTree = "<group>"; };
+		A8A47279151A825A004123FF /* DateMath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateMath.cpp; sourceTree = "<group>"; };
+		A8A4727A151A825A004123FF /* DateMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateMath.h; sourceTree = "<group>"; };
+		A8A4727B151A825A004123FF /* DecimalNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DecimalNumber.cpp; sourceTree = "<group>"; };
+		A8A4727C151A825A004123FF /* DecimalNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecimalNumber.h; sourceTree = "<group>"; };
+		A8A4727D151A825A004123FF /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = "<group>"; };
+		A8A4727E151A825A004123FF /* Deque.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Deque.h; sourceTree = "<group>"; };
+		A8A4727F151A825A004123FF /* DisallowCType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisallowCType.h; sourceTree = "<group>"; };
+		A8A47280151A825A004123FF /* DoublyLinkedList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DoublyLinkedList.h; sourceTree = "<group>"; };
+		A8A47282151A825A004123FF /* bignum-dtoa.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "bignum-dtoa.cc"; sourceTree = "<group>"; };
+		A8A47283151A825A004123FF /* bignum-dtoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "bignum-dtoa.h"; sourceTree = "<group>"; };
+		A8A47284151A825A004123FF /* bignum.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bignum.cc; sourceTree = "<group>"; };
+		A8A47285151A825A004123FF /* bignum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bignum.h; sourceTree = "<group>"; };
+		A8A47286151A825A004123FF /* cached-powers.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "cached-powers.cc"; sourceTree = "<group>"; };
+		A8A47287151A825A004123FF /* cached-powers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "cached-powers.h"; sourceTree = "<group>"; };
+		A8A47288151A825A004123FF /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = "<group>"; };
+		A8A47289151A825A004123FF /* diy-fp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "diy-fp.cc"; sourceTree = "<group>"; };
+		A8A4728A151A825A004123FF /* diy-fp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "diy-fp.h"; sourceTree = "<group>"; };
+		A8A4728B151A825A004123FF /* double-conversion.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "double-conversion.cc"; sourceTree = "<group>"; };
+		A8A4728C151A825A004123FF /* double-conversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "double-conversion.h"; sourceTree = "<group>"; };
+		A8A4728D151A825A004123FF /* double.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = double.h; sourceTree = "<group>"; };
+		A8A4728E151A825A004123FF /* fast-dtoa.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "fast-dtoa.cc"; sourceTree = "<group>"; };
+		A8A4728F151A825A004123FF /* fast-dtoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "fast-dtoa.h"; sourceTree = "<group>"; };
+		A8A47290151A825A004123FF /* fixed-dtoa.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "fixed-dtoa.cc"; sourceTree = "<group>"; };
+		A8A47291151A825A004123FF /* fixed-dtoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "fixed-dtoa.h"; sourceTree = "<group>"; };
+		A8A47292151A825A004123FF /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
+		A8A47293151A825A004123FF /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+		A8A47294151A825A004123FF /* strtod.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strtod.cc; sourceTree = "<group>"; };
+		A8A47295151A825A004123FF /* strtod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strtod.h; sourceTree = "<group>"; };
+		A8A47296151A825A004123FF /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; };
+		A8A47297151A825A004123FF /* dtoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dtoa.cpp; sourceTree = "<group>"; };
+		A8A47298151A825A004123FF /* dtoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dtoa.h; sourceTree = "<group>"; };
+		A8A47299151A825A004123FF /* DynamicAnnotations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DynamicAnnotations.cpp; sourceTree = "<group>"; };
+		A8A4729A151A825A004123FF /* DynamicAnnotations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DynamicAnnotations.h; sourceTree = "<group>"; };
+		A8A4729E151A825A004123FF /* Encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Encoder.h; sourceTree = "<group>"; };
+		A8A4729F151A825A004123FF /* ExportMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExportMacros.h; sourceTree = "<group>"; };
+		A8A472A0151A825A004123FF /* FastAllocBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastAllocBase.h; sourceTree = "<group>"; };
+		A8A472A1151A825A004123FF /* FastMalloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FastMalloc.cpp; sourceTree = "<group>"; };
+		A8A472A2151A825A004123FF /* FastMalloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastMalloc.h; sourceTree = "<group>"; };
+		A8A472A3151A825A004123FF /* FixedArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FixedArray.h; sourceTree = "<group>"; };
+		A8A472A4151A825A004123FF /* Float32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Float32Array.h; sourceTree = "<group>"; };
+		A8A472A5151A825A004123FF /* Float64Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Float64Array.h; sourceTree = "<group>"; };
+		A8A472A6151A825A004123FF /* Forward.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Forward.h; sourceTree = "<group>"; };
+		A8A472A7151A825A004123FF /* Functional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Functional.h; sourceTree = "<group>"; };
+		A8A472A8151A825A004123FF /* GetPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetPtr.h; sourceTree = "<group>"; };
+		A8A472B3151A825A004123FF /* HashCountedSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashCountedSet.h; sourceTree = "<group>"; };
+		A8A472B4151A825A004123FF /* HashFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashFunctions.h; sourceTree = "<group>"; };
+		A8A472B5151A825A004123FF /* HashIterators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashIterators.h; sourceTree = "<group>"; };
+		A8A472B6151A825A004123FF /* HashMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashMap.h; sourceTree = "<group>"; };
+		A8A472B7151A825A004123FF /* HashSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashSet.h; sourceTree = "<group>"; };
+		A8A472B8151A825A004123FF /* HashTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HashTable.cpp; sourceTree = "<group>"; };
+		A8A472B9151A825A004123FF /* HashTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashTable.h; sourceTree = "<group>"; };
+		A8A472BA151A825A004123FF /* HashTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HashTraits.h; sourceTree = "<group>"; };
+		A8A472BB151A825A004123FF /* HexNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HexNumber.h; sourceTree = "<group>"; };
+		A8A472BC151A825A004123FF /* InlineASM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineASM.h; sourceTree = "<group>"; };
+		A8A472BD151A825A004123FF /* Int8Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Int8Array.h; sourceTree = "<group>"; };
+		A8A472BE151A825A004123FF /* Int16Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Int16Array.h; sourceTree = "<group>"; };
+		A8A472BF151A825A004123FF /* Int32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Int32Array.h; sourceTree = "<group>"; };
+		A8A472C0151A825A004123FF /* IntegralTypedArrayBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntegralTypedArrayBase.h; sourceTree = "<group>"; };
+		A8A472C1151A825A004123FF /* ListHashSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListHashSet.h; sourceTree = "<group>"; };
+		A8A472C2151A825A004123FF /* ListRefPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListRefPtr.h; sourceTree = "<group>"; };
+		A8A472C3151A825A004123FF /* Locker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Locker.h; sourceTree = "<group>"; };
+		A8A472C5151A825A004123FF /* MainThreadMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MainThreadMac.mm; sourceTree = "<group>"; };
+		A8A472C6151A825A004123FF /* MainThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainThread.cpp; sourceTree = "<group>"; };
+		A8A472C7151A825B004123FF /* MainThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainThread.h; sourceTree = "<group>"; };
+		A8A472C8151A825B004123FF /* MallocZoneSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MallocZoneSupport.h; sourceTree = "<group>"; };
+		A8A472C9151A825B004123FF /* MathExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathExtras.h; sourceTree = "<group>"; };
+		A8A472CA151A825B004123FF /* MD5.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MD5.cpp; sourceTree = "<group>"; };
+		A8A472CB151A825B004123FF /* MD5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MD5.h; sourceTree = "<group>"; };
+		A8A472CC151A825B004123FF /* MessageQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageQueue.h; sourceTree = "<group>"; };
+		A8A472CD151A825B004123FF /* MetaAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MetaAllocator.cpp; sourceTree = "<group>"; };
+		A8A472CE151A825B004123FF /* MetaAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MetaAllocator.h; sourceTree = "<group>"; };
+		A8A472CF151A825B004123FF /* MetaAllocatorHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MetaAllocatorHandle.h; sourceTree = "<group>"; };
+		A8A472D0151A825B004123FF /* Noncopyable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Noncopyable.h; sourceTree = "<group>"; };
+		A8A472D1151A825B004123FF /* NonCopyingSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NonCopyingSort.h; sourceTree = "<group>"; };
+		A8A472D2151A825B004123FF /* NotFound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotFound.h; sourceTree = "<group>"; };
+		A8A472D3151A825B004123FF /* NullPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NullPtr.cpp; sourceTree = "<group>"; };
+		A8A472D4151A825B004123FF /* NullPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NullPtr.h; sourceTree = "<group>"; };
+		A8A472D5151A825B004123FF /* NumberOfCores.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NumberOfCores.cpp; sourceTree = "<group>"; };
+		A8A472D6151A825B004123FF /* NumberOfCores.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberOfCores.h; sourceTree = "<group>"; };
+		A8A472D7151A825B004123FF /* OSAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSAllocator.h; sourceTree = "<group>"; };
+		A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSAllocatorPosix.cpp; sourceTree = "<group>"; };
+		A8A472DA151A825B004123FF /* OSRandomSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSRandomSource.cpp; sourceTree = "<group>"; };
+		A8A472DB151A825B004123FF /* OSRandomSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSRandomSource.h; sourceTree = "<group>"; };
+		A8A472DC151A825B004123FF /* OwnArrayPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnArrayPtr.h; sourceTree = "<group>"; };
+		A8A472DD151A825B004123FF /* OwnPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnPtr.h; sourceTree = "<group>"; };
+		A8A472DE151A825B004123FF /* OwnPtrCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnPtrCommon.h; sourceTree = "<group>"; };
+		A8A472DF151A825B004123FF /* PackedIntVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackedIntVector.h; sourceTree = "<group>"; };
+		A8A472E0151A825B004123FF /* PageAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocation.h; sourceTree = "<group>"; };
+		A8A472E1151A825B004123FF /* PageAllocationAligned.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageAllocationAligned.cpp; sourceTree = "<group>"; };
+		A8A472E2151A825B004123FF /* PageAllocationAligned.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocationAligned.h; sourceTree = "<group>"; };
+		A8A472E3151A825B004123FF /* PageBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBlock.cpp; sourceTree = "<group>"; };
+		A8A472E4151A825B004123FF /* PageBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageBlock.h; sourceTree = "<group>"; };
+		A8A472E5151A825B004123FF /* PageReservation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageReservation.h; sourceTree = "<group>"; };
+		A8A472E6151A825B004123FF /* ParallelJobs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelJobs.h; sourceTree = "<group>"; };
+		A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelJobsLibdispatch.h; sourceTree = "<group>"; };
+		A8A472EB151A825B004123FF /* PassOwnArrayPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassOwnArrayPtr.h; sourceTree = "<group>"; };
+		A8A472EC151A825B004123FF /* PassOwnPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassOwnPtr.h; sourceTree = "<group>"; };
+		A8A472ED151A825B004123FF /* PassRefPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassRefPtr.h; sourceTree = "<group>"; };
+		A8A472EE151A825B004123FF /* PassTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassTraits.h; sourceTree = "<group>"; };
+		A8A472EF151A825B004123FF /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
+		A8A472F3151A825B004123FF /* PossiblyNull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PossiblyNull.h; sourceTree = "<group>"; };
+		A8A472FB151A825B004123FF /* RandomNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomNumber.cpp; sourceTree = "<group>"; };
+		A8A472FC151A825B004123FF /* RandomNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumber.h; sourceTree = "<group>"; };
+		A8A472FD151A825B004123FF /* RandomNumberSeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumberSeed.h; sourceTree = "<group>"; };
+		A8A472FE151A825B004123FF /* RedBlackTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RedBlackTree.h; sourceTree = "<group>"; };
+		A8A472FF151A825B004123FF /* RefCounted.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCounted.h; sourceTree = "<group>"; };
+		A8A47300151A825B004123FF /* RefCountedArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCountedArray.h; sourceTree = "<group>"; };
+		A8A47301151A825B004123FF /* RefCountedLeakCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefCountedLeakCounter.cpp; sourceTree = "<group>"; };
+		A8A47302151A825B004123FF /* RefCountedLeakCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCountedLeakCounter.h; sourceTree = "<group>"; };
+		A8A47303151A825B004123FF /* RefPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefPtr.h; sourceTree = "<group>"; };
+		A8A47304151A825B004123FF /* RefPtrHashMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefPtrHashMap.h; sourceTree = "<group>"; };
+		A8A47305151A825B004123FF /* RetainPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RetainPtr.h; sourceTree = "<group>"; };
+		A8A47306151A825B004123FF /* SegmentedVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SegmentedVector.h; sourceTree = "<group>"; };
+		A8A47307151A825B004123FF /* SentinelLinkedList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentinelLinkedList.h; sourceTree = "<group>"; };
+		A8A47308151A825B004123FF /* SHA1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SHA1.cpp; sourceTree = "<group>"; };
+		A8A47309151A825B004123FF /* SHA1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SHA1.h; sourceTree = "<group>"; };
+		A8A4730A151A825B004123FF /* SimpleStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleStats.h; sourceTree = "<group>"; };
+		A8A4730B151A825B004123FF /* SinglyLinkedList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SinglyLinkedList.h; sourceTree = "<group>"; };
+		A8A4730C151A825B004123FF /* SizeLimits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SizeLimits.cpp; sourceTree = "<group>"; };
+		A8A4730D151A825B004123FF /* Spectrum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Spectrum.h; sourceTree = "<group>"; };
+		A8A4730E151A825B004123FF /* StackBounds.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackBounds.cpp; sourceTree = "<group>"; };
+		A8A4730F151A825B004123FF /* StackBounds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackBounds.h; sourceTree = "<group>"; };
+		A8A47310151A825B004123FF /* StaticConstructors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticConstructors.h; sourceTree = "<group>"; };
+		A8A47311151A825B004123FF /* StdLibExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StdLibExtras.h; sourceTree = "<group>"; };
+		A8A47312151A825B004123FF /* StringExtras.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringExtras.cpp; sourceTree = "<group>"; };
+		A8A47313151A825B004123FF /* StringExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringExtras.h; sourceTree = "<group>"; };
+		A8A47314151A825B004123FF /* StringHasher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringHasher.h; sourceTree = "<group>"; };
+		A8A47315151A825B004123FF /* TCPackedCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCPackedCache.h; sourceTree = "<group>"; };
+		A8A47316151A825B004123FF /* TCPageMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCPageMap.h; sourceTree = "<group>"; };
+		A8A47317151A825B004123FF /* TCSpinLock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCSpinLock.h; sourceTree = "<group>"; };
+		A8A47318151A825B004123FF /* TCSystemAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TCSystemAlloc.cpp; sourceTree = "<group>"; };
+		A8A47319151A825B004123FF /* TCSystemAlloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCSystemAlloc.h; sourceTree = "<group>"; };
+		A8A4731A151A825B004123FF /* TemporaryChange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemporaryChange.h; sourceTree = "<group>"; };
+		A8A4731C151A825B004123FF /* ASCIIFastPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASCIIFastPath.h; sourceTree = "<group>"; };
+		A8A4731D151A825B004123FF /* AtomicString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomicString.cpp; sourceTree = "<group>"; };
+		A8A4731E151A825B004123FF /* AtomicString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomicString.h; sourceTree = "<group>"; };
+		A8A4731F151A825B004123FF /* AtomicStringHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomicStringHash.h; sourceTree = "<group>"; };
+		A8A47320151A825B004123FF /* AtomicStringImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomicStringImpl.h; sourceTree = "<group>"; };
+		A8A47321151A825B004123FF /* CString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CString.cpp; sourceTree = "<group>"; };
+		A8A47322151A825B004123FF /* CString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CString.h; sourceTree = "<group>"; };
+		A8A47323151A825B004123FF /* StringBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringBuffer.h; sourceTree = "<group>"; };
+		A8A47324151A825B004123FF /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringBuilder.cpp; sourceTree = "<group>"; };
+		A8A47325151A825B004123FF /* StringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringBuilder.h; sourceTree = "<group>"; };
+		A8A47326151A825B004123FF /* StringConcatenate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringConcatenate.h; sourceTree = "<group>"; };
+		A8A47327151A825B004123FF /* StringHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringHash.h; sourceTree = "<group>"; };
+		A8A47328151A825B004123FF /* StringImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringImpl.cpp; sourceTree = "<group>"; };
+		A8A47329151A825B004123FF /* StringImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringImpl.h; sourceTree = "<group>"; };
+		A8A4732A151A825B004123FF /* StringOperators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringOperators.h; sourceTree = "<group>"; };
+		A8A4732B151A825B004123FF /* StringStatics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringStatics.cpp; sourceTree = "<group>"; };
+		A8A4732C151A825B004123FF /* TextPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextPosition.h; sourceTree = "<group>"; };
+		A8A4732D151A825B004123FF /* WTFString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WTFString.cpp; sourceTree = "<group>"; };
+		A8A4732E151A825B004123FF /* WTFString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFString.h; sourceTree = "<group>"; };
+		A8A4732F151A825B004123FF /* ThreadFunctionInvocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadFunctionInvocation.h; sourceTree = "<group>"; };
+		A8A47330151A825B004123FF /* ThreadIdentifierDataPthreads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadIdentifierDataPthreads.cpp; sourceTree = "<group>"; };
+		A8A47331151A825B004123FF /* ThreadIdentifierDataPthreads.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadIdentifierDataPthreads.h; sourceTree = "<group>"; };
+		A8A47332151A825B004123FF /* Threading.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Threading.cpp; sourceTree = "<group>"; };
+		A8A47333151A825B004123FF /* Threading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Threading.h; sourceTree = "<group>"; };
+		A8A47335151A825B004123FF /* ThreadingPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadingPrimitives.h; sourceTree = "<group>"; };
+		A8A47336151A825B004123FF /* ThreadingPthreads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadingPthreads.cpp; sourceTree = "<group>"; };
+		A8A47338151A825B004123FF /* ThreadRestrictionVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadRestrictionVerifier.h; sourceTree = "<group>"; };
+		A8A4733A151A825B004123FF /* BinarySemaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BinarySemaphore.cpp; sourceTree = "<group>"; };
+		A8A4733B151A825B004123FF /* BinarySemaphore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BinarySemaphore.h; sourceTree = "<group>"; };
+		A8A4733E151A825B004123FF /* ThreadSafeRefCounted.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadSafeRefCounted.h; sourceTree = "<group>"; };
+		A8A4733F151A825B004123FF /* ThreadSpecific.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadSpecific.h; sourceTree = "<group>"; };
+		A8A47341151A825B004123FF /* TypedArrayBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypedArrayBase.h; sourceTree = "<group>"; };
+		A8A47342151A825B004123FF /* TypeTraits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TypeTraits.cpp; sourceTree = "<group>"; };
+		A8A47343151A825B004123FF /* TypeTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeTraits.h; sourceTree = "<group>"; };
+		A8A47344151A825B004123FF /* Uint8Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Uint8Array.h; sourceTree = "<group>"; };
+		A8A47345151A825B004123FF /* Uint8ClampedArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Uint8ClampedArray.h; sourceTree = "<group>"; };
+		A8A47346151A825B004123FF /* Uint16Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Uint16Array.h; sourceTree = "<group>"; };
+		A8A47347151A825B004123FF /* Uint32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Uint32Array.h; sourceTree = "<group>"; };
+		A8A47349151A825B004123FF /* CharacterNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CharacterNames.h; sourceTree = "<group>"; };
+		A8A4734A151A825B004123FF /* Collator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Collator.h; sourceTree = "<group>"; };
+		A8A4734B151A825B004123FF /* CollatorDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CollatorDefault.cpp; sourceTree = "<group>"; };
+		A8A47350151A825B004123FF /* CollatorICU.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CollatorICU.cpp; sourceTree = "<group>"; };
+		A8A47351151A825B004123FF /* UnicodeIcu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnicodeIcu.h; sourceTree = "<group>"; };
+		A8A47354151A825B004123FF /* ScriptCodesFromICU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCodesFromICU.h; sourceTree = "<group>"; };
+		A8A47355151A825B004123FF /* Unicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Unicode.h; sourceTree = "<group>"; };
+		A8A47356151A825B004123FF /* UnicodeMacrosFromICU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnicodeMacrosFromICU.h; sourceTree = "<group>"; };
+		A8A47357151A825B004123FF /* UTF8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UTF8.cpp; sourceTree = "<group>"; };
+		A8A47358151A825B004123FF /* UTF8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTF8.h; sourceTree = "<group>"; };
+		A8A4735C151A825B004123FF /* UnionFind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnionFind.h; sourceTree = "<group>"; };
+		A8A4735D151A825B004123FF /* UnusedParam.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnusedParam.h; sourceTree = "<group>"; };
+		A8A47360151A825B004123FF /* ParsedURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParsedURL.cpp; sourceTree = "<group>"; };
+		A8A47361151A825B004123FF /* ParsedURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParsedURL.h; sourceTree = "<group>"; };
+		A8A47362151A825B004123FF /* URLString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLString.h; sourceTree = "<group>"; };
+		A8A47364151A825B004123FF /* RawURLBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RawURLBuffer.h; sourceTree = "<group>"; };
+		A8A47365151A825B004123FF /* URLBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLBuffer.h; sourceTree = "<group>"; };
+		A8A47366151A825B004123FF /* URLCharacterTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLCharacterTypes.cpp; sourceTree = "<group>"; };
+		A8A47367151A825B004123FF /* URLCharacterTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLCharacterTypes.h; sourceTree = "<group>"; };
+		A8A47368151A825B004123FF /* URLComponent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLComponent.h; sourceTree = "<group>"; };
+		A8A4736D151A825B004123FF /* URLSegments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLSegments.cpp; sourceTree = "<group>"; };
+		A8A4736E151A825B004123FF /* URLSegments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLSegments.h; sourceTree = "<group>"; };
+		A8A4736F151A825B004123FF /* ValueCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueCheck.h; sourceTree = "<group>"; };
+		A8A47370151A825B004123FF /* Vector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Vector.h; sourceTree = "<group>"; };
+		A8A47371151A825B004123FF /* VectorTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VectorTraits.h; sourceTree = "<group>"; };
+		A8A47372151A825B004123FF /* VMTags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMTags.h; sourceTree = "<group>"; };
+		A8A4737A151A825B004123FF /* WTFThreadData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WTFThreadData.cpp; sourceTree = "<group>"; };
+		A8A4737B151A825B004123FF /* WTFThreadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFThreadData.h; sourceTree = "<group>"; };
+		A8A4748B151A8264004123FF /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
+		CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; };
+		CD5497AB15857D0300B5BC30 /* MediaTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTime.h; sourceTree = "<group>"; };
+		EB95E1EF161A72410089A2F5 /* ByteOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteOrder.h; sourceTree = "<group>"; };
+		F3525E2916149FF400278BC1 /* MemoryInstrumentationListHashSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationListHashSet.h; sourceTree = "<group>"; };
+		F3525E451619A4EE00278BC1 /* MemoryInstrumentationHashMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationHashMap.h; sourceTree = "<group>"; };
+		F3FBC71D161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationHashCountedSet.h; sourceTree = "<group>"; };
+		F3FBC71F161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationSequence.h; sourceTree = "<group>"; };
+		FEDACD3B1630F83F00C69634 /* StackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackStats.cpp; sourceTree = "<group>"; };
+		FEDACD3C1630F83F00C69634 /* StackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackStats.h; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		5D247B5F14689B8600E78B76 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		5D247B5714689B8600E78B76 = {
+			isa = PBXGroup;
+			children = (
+				5D247B6D14689C4700E78B76 /* Configurations */,
+				5D247B6314689B8600E78B76 /* Products */,
+				5D247B7614689D7600E78B76 /* Source */,
+			);
+			sourceTree = "<group>";
+		};
+		5D247B6314689B8600E78B76 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				5D247B6214689B8600E78B76 /* libWTF.a */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		5D247B6D14689C4700E78B76 /* Configurations */ = {
+			isa = PBXGroup;
+			children = (
+				5D247B6E14689C4700E78B76 /* Base.xcconfig */,
+				6541CAF41630DB26006D0DEC /* CopyWTFHeaders.xcconfig */,
+				5D247B7014689C4700E78B76 /* DebugRelease.xcconfig */,
+				5D247B7314689C4700E78B76 /* WTF.xcconfig */,
+			);
+			path = Configurations;
+			sourceTree = "<group>";
+		};
+		5D247B7614689D7600E78B76 /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				A876DBD6151816E500DADB95 /* wtf */,
+				A8A4748B151A8264004123FF /* config.h */,
+				5D247EB11468B01500E78B76 /* HeaderDetection.h */,
+			);
+			name = Source;
+			sourceTree = "<group>";
+		};
+		A876DBD6151816E500DADB95 /* wtf */ = {
+			isa = PBXGroup;
+			children = (
+				A8A47281151A825A004123FF /* dtoa */,
+				A8A472C4151A825A004123FF /* mac */,
+				A8A4731B151A825B004123FF /* text */,
+				A8A47339151A825B004123FF /* threads */,
+				A8A47348151A825B004123FF /* unicode */,
+				A8A4735E151A825B004123FF /* url */,
+				A8A47254151A825A004123FF /* Alignment.h */,
+				A8A47255151A825A004123FF /* AlwaysInline.h */,
+				A8A47256151A825A004123FF /* ArrayBuffer.cpp */,
+				A8A47257151A825A004123FF /* ArrayBuffer.h */,
+				A8A47258151A825A004123FF /* ArrayBufferView.cpp */,
+				A8A47259151A825A004123FF /* ArrayBufferView.h */,
+				A8A4725A151A825A004123FF /* ASCIICType.h */,
+				A8A4725B151A825A004123FF /* Assertions.cpp */,
+				A8A4725C151A825A004123FF /* Assertions.h */,
+				A8A4725D151A825A004123FF /* Atomics.h */,
+				A8A4725E151A825A004123FF /* AVLTree.h */,
+				4F0321BB156AA8D1006EBAF6 /* BitArray.h */,
+				A8A4725F151A825A004123FF /* Bitmap.h */,
+				A8A47260151A825A004123FF /* BitVector.cpp */,
+				A8A47261151A825A004123FF /* BitVector.h */,
+				A8A47264151A825A004123FF /* BlockStack.h */,
+				A8A47265151A825A004123FF /* BloomFilter.h */,
+				A8A47266151A825A004123FF /* BoundsCheckedPointer.h */,
+				A8A47267151A825A004123FF /* BumpPointerAllocator.h */,
+				EB95E1EF161A72410089A2F5 /* ByteOrder.h */,
+				A8A4726A151A825A004123FF /* CheckedArithmetic.h */,
+				A8A4726B151A825A004123FF /* CheckedBoolean.h */,
+				A8A47270151A825A004123FF /* Compiler.h */,
+				A8A47271151A825A004123FF /* Complex.h */,
+				A8A47273151A825A004123FF /* CryptographicallyRandomNumber.cpp */,
+				A8A47274151A825A004123FF /* CryptographicallyRandomNumber.h */,
+				A8A47275151A825A004123FF /* CurrentTime.cpp */,
+				A8A47276151A825A004123FF /* CurrentTime.h */,
+				A8A47277151A825A004123FF /* DataLog.cpp */,
+				A8A47278151A825A004123FF /* DataLog.h */,
+				A8A47279151A825A004123FF /* DateMath.cpp */,
+				A8A4727A151A825A004123FF /* DateMath.h */,
+				A8A4727B151A825A004123FF /* DecimalNumber.cpp */,
+				A8A4727C151A825A004123FF /* DecimalNumber.h */,
+				A8A4727D151A825A004123FF /* Decoder.h */,
+				A8A4727E151A825A004123FF /* Deque.h */,
+				A8A4727F151A825A004123FF /* DisallowCType.h */,
+				A8A47280151A825A004123FF /* DoublyLinkedList.h */,
+				A8A47297151A825A004123FF /* dtoa.cpp */,
+				A8A47298151A825A004123FF /* dtoa.h */,
+				A8A47299151A825A004123FF /* DynamicAnnotations.cpp */,
+				A8A4729A151A825A004123FF /* DynamicAnnotations.h */,
+				A8A4729E151A825A004123FF /* Encoder.h */,
+				A8A4729F151A825A004123FF /* ExportMacros.h */,
+				A8A472A0151A825A004123FF /* FastAllocBase.h */,
+				0FD81AC4154FB22E00983E72 /* FastBitVector.h */,
+				A8A472A1151A825A004123FF /* FastMalloc.cpp */,
+				A8A472A2151A825A004123FF /* FastMalloc.h */,
+				A8A472A3151A825A004123FF /* FixedArray.h */,
+				A8A472A4151A825A004123FF /* Float32Array.h */,
+				A8A472A5151A825A004123FF /* Float64Array.h */,
+				A8A472A6151A825A004123FF /* Forward.h */,
+				A8A472A7151A825A004123FF /* Functional.h */,
+				A8A472A8151A825A004123FF /* GetPtr.h */,
+				2CCD892915C0390200285083 /* GregorianDateTime.cpp */,
+				2C05385315BC819000F21B96 /* GregorianDateTime.h */,
+				A8A472B3151A825A004123FF /* HashCountedSet.h */,
+				A8A472B4151A825A004123FF /* HashFunctions.h */,
+				A8A472B5151A825A004123FF /* HashIterators.h */,
+				A8A472B6151A825A004123FF /* HashMap.h */,
+				A8A472B7151A825A004123FF /* HashSet.h */,
+				A8A472B8151A825A004123FF /* HashTable.cpp */,
+				A8A472B9151A825A004123FF /* HashTable.h */,
+				A8A472BA151A825A004123FF /* HashTraits.h */,
+				A8A472BB151A825A004123FF /* HexNumber.h */,
+				A8A472BC151A825A004123FF /* InlineASM.h */,
+				A8A472BE151A825A004123FF /* Int16Array.h */,
+				A8A472BF151A825A004123FF /* Int32Array.h */,
+				A8A472BD151A825A004123FF /* Int8Array.h */,
+				A8A472C0151A825A004123FF /* IntegralTypedArrayBase.h */,
+				A8A472C1151A825A004123FF /* ListHashSet.h */,
+				A8A472C2151A825A004123FF /* ListRefPtr.h */,
+				A8A472C3151A825A004123FF /* Locker.h */,
+				A8A472C6151A825A004123FF /* MainThread.cpp */,
+				A8A472C7151A825B004123FF /* MainThread.h */,
+				A8A472C8151A825B004123FF /* MallocZoneSupport.h */,
+				A8A472C9151A825B004123FF /* MathExtras.h */,
+				A8A472CA151A825B004123FF /* MD5.cpp */,
+				A8A472CB151A825B004123FF /* MD5.h */,
+				CD5497AA15857D0300B5BC30 /* MediaTime.cpp */,
+				CD5497AB15857D0300B5BC30 /* MediaTime.h */,
+				4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */,
+				4FD8554616133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h */,
+				F3FBC71D161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h */,
+				F3525E451619A4EE00278BC1 /* MemoryInstrumentationHashMap.h */,
+				4F1B2DB5160B44AA00586559 /* MemoryInstrumentationHashSet.h */,
+				F3525E2916149FF400278BC1 /* MemoryInstrumentationListHashSet.h */,
+				4FD2A358161B0EE100EBF236 /* MemoryInstrumentationParsedURL.h */,
+				F3FBC71F161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h */,
+				4FCF27E016172E8600CBF037 /* MemoryInstrumentationString.h */,
+				4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */,
+				A8A472CC151A825B004123FF /* MessageQueue.h */,
+				A8A472CD151A825B004123FF /* MetaAllocator.cpp */,
+				A8A472CE151A825B004123FF /* MetaAllocator.h */,
+				A8A472CF151A825B004123FF /* MetaAllocatorHandle.h */,
+				A8A472D0151A825B004123FF /* Noncopyable.h */,
+				A8A472D1151A825B004123FF /* NonCopyingSort.h */,
+				A8A472D2151A825B004123FF /* NotFound.h */,
+				A8A472D3151A825B004123FF /* NullPtr.cpp */,
+				A8A472D4151A825B004123FF /* NullPtr.h */,
+				A8A472D5151A825B004123FF /* NumberOfCores.cpp */,
+				A8A472D6151A825B004123FF /* NumberOfCores.h */,
+				7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */,
+				A8A472D7151A825B004123FF /* OSAllocator.h */,
+				A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */,
+				A8A472DA151A825B004123FF /* OSRandomSource.cpp */,
+				A8A472DB151A825B004123FF /* OSRandomSource.h */,
+				A8A472DC151A825B004123FF /* OwnArrayPtr.h */,
+				A8A472DD151A825B004123FF /* OwnPtr.h */,
+				A8A472DE151A825B004123FF /* OwnPtrCommon.h */,
+				A8A472DF151A825B004123FF /* PackedIntVector.h */,
+				A8A472E0151A825B004123FF /* PageAllocation.h */,
+				A8A472E1151A825B004123FF /* PageAllocationAligned.cpp */,
+				A8A472E2151A825B004123FF /* PageAllocationAligned.h */,
+				A8A472E3151A825B004123FF /* PageBlock.cpp */,
+				A8A472E4151A825B004123FF /* PageBlock.h */,
+				A8A472E5151A825B004123FF /* PageReservation.h */,
+				A8A472E6151A825B004123FF /* ParallelJobs.h */,
+				A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */,
+				A8A472EB151A825B004123FF /* PassOwnArrayPtr.h */,
+				A8A472EC151A825B004123FF /* PassOwnPtr.h */,
+				A8A472ED151A825B004123FF /* PassRefPtr.h */,
+				A8A472EE151A825B004123FF /* PassTraits.h */,
+				A8A472EF151A825B004123FF /* Platform.h */,
+				A876DBD7151816E500DADB95 /* Platform.h */,
+				A8A472F3151A825B004123FF /* PossiblyNull.h */,
+				143F611D1565F0F900DB514A /* RAMSize.cpp */,
+				143F611E1565F0F900DB514A /* RAMSize.h */,
+				A8A472FB151A825B004123FF /* RandomNumber.cpp */,
+				A8A472FC151A825B004123FF /* RandomNumber.h */,
+				A8A472FD151A825B004123FF /* RandomNumberSeed.h */,
+				A8A472FE151A825B004123FF /* RedBlackTree.h */,
+				A8A472FF151A825B004123FF /* RefCounted.h */,
+				A8A47300151A825B004123FF /* RefCountedArray.h */,
+				A8A47301151A825B004123FF /* RefCountedLeakCounter.cpp */,
+				A8A47302151A825B004123FF /* RefCountedLeakCounter.h */,
+				A8A47303151A825B004123FF /* RefPtr.h */,
+				A8A47304151A825B004123FF /* RefPtrHashMap.h */,
+				A8A47305151A825B004123FF /* RetainPtr.h */,
+				14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */,
+				A8A47306151A825B004123FF /* SegmentedVector.h */,
+				A8A47307151A825B004123FF /* SentinelLinkedList.h */,
+				A8A47308151A825B004123FF /* SHA1.cpp */,
+				A8A47309151A825B004123FF /* SHA1.h */,
+				A8A4730A151A825B004123FF /* SimpleStats.h */,
+				A8A4730B151A825B004123FF /* SinglyLinkedList.h */,
+				A8A4730C151A825B004123FF /* SizeLimits.cpp */,
+				A8A4730D151A825B004123FF /* Spectrum.h */,
+				A8A4730E151A825B004123FF /* StackBounds.cpp */,
+				A8A4730F151A825B004123FF /* StackBounds.h */,
+				FEDACD3B1630F83F00C69634 /* StackStats.cpp */,
+				FEDACD3C1630F83F00C69634 /* StackStats.h */,
+				A8A47310151A825B004123FF /* StaticConstructors.h */,
+				A8A47311151A825B004123FF /* StdLibExtras.h */,
+				1A6BB768162F300500DD16DB /* StreamBuffer.h */,
+				A8A47312151A825B004123FF /* StringExtras.cpp */,
+				A8A47313151A825B004123FF /* StringExtras.h */,
+				A8A47314151A825B004123FF /* StringHasher.h */,
+				A8A47315151A825B004123FF /* TCPackedCache.h */,
+				A8A47316151A825B004123FF /* TCPageMap.h */,
+				A8A47317151A825B004123FF /* TCSpinLock.h */,
+				A8A47318151A825B004123FF /* TCSystemAlloc.cpp */,
+				A8A47319151A825B004123FF /* TCSystemAlloc.h */,
+				A8A4731A151A825B004123FF /* TemporaryChange.h */,
+				A8A4732F151A825B004123FF /* ThreadFunctionInvocation.h */,
+				A8A47330151A825B004123FF /* ThreadIdentifierDataPthreads.cpp */,
+				A8A47331151A825B004123FF /* ThreadIdentifierDataPthreads.h */,
+				A8A47332151A825B004123FF /* Threading.cpp */,
+				A8A47333151A825B004123FF /* Threading.h */,
+				A8A47335151A825B004123FF /* ThreadingPrimitives.h */,
+				A8A47336151A825B004123FF /* ThreadingPthreads.cpp */,
+				A8A47338151A825B004123FF /* ThreadRestrictionVerifier.h */,
+				A8A4733E151A825B004123FF /* ThreadSafeRefCounted.h */,
+				A8A4733F151A825B004123FF /* ThreadSpecific.h */,
+				A8A47341151A825B004123FF /* TypedArrayBase.h */,
+				A8A47342151A825B004123FF /* TypeTraits.cpp */,
+				A8A47343151A825B004123FF /* TypeTraits.h */,
+				A8A47346151A825B004123FF /* Uint16Array.h */,
+				A8A47347151A825B004123FF /* Uint32Array.h */,
+				A8A47344151A825B004123FF /* Uint8Array.h */,
+				A8A47345151A825B004123FF /* Uint8ClampedArray.h */,
+				A8A4735C151A825B004123FF /* UnionFind.h */,
+				A8A4735D151A825B004123FF /* UnusedParam.h */,
+				A8A4736F151A825B004123FF /* ValueCheck.h */,
+				A8A47370151A825B004123FF /* Vector.h */,
+				A8A47371151A825B004123FF /* VectorTraits.h */,
+				A8A47372151A825B004123FF /* VMTags.h */,
+				A8A4737A151A825B004123FF /* WTFThreadData.cpp */,
+				A8A4737B151A825B004123FF /* WTFThreadData.h */,
+			);
+			path = wtf;
+			sourceTree = "<group>";
+		};
+		A8A47281151A825A004123FF /* dtoa */ = {
+			isa = PBXGroup;
+			children = (
+				A8A47288151A825A004123FF /* COPYING */,
+				A8A47292151A825A004123FF /* LICENSE */,
+				A8A47293151A825A004123FF /* README */,
+				A8A47282151A825A004123FF /* bignum-dtoa.cc */,
+				A8A47283151A825A004123FF /* bignum-dtoa.h */,
+				A8A47284151A825A004123FF /* bignum.cc */,
+				A8A47285151A825A004123FF /* bignum.h */,
+				A8A47286151A825A004123FF /* cached-powers.cc */,
+				A8A47287151A825A004123FF /* cached-powers.h */,
+				A8A47289151A825A004123FF /* diy-fp.cc */,
+				A8A4728A151A825A004123FF /* diy-fp.h */,
+				A8A4728B151A825A004123FF /* double-conversion.cc */,
+				A8A4728C151A825A004123FF /* double-conversion.h */,
+				A8A4728D151A825A004123FF /* double.h */,
+				A8A4728E151A825A004123FF /* fast-dtoa.cc */,
+				A8A4728F151A825A004123FF /* fast-dtoa.h */,
+				A8A47290151A825A004123FF /* fixed-dtoa.cc */,
+				A8A47291151A825A004123FF /* fixed-dtoa.h */,
+				A8A47294151A825A004123FF /* strtod.cc */,
+				A8A47295151A825A004123FF /* strtod.h */,
+				A8A47296151A825A004123FF /* utils.h */,
+			);
+			path = dtoa;
+			sourceTree = "<group>";
+		};
+		A8A472C4151A825A004123FF /* mac */ = {
+			isa = PBXGroup;
+			children = (
+				A8A472C5151A825A004123FF /* MainThreadMac.mm */,
+			);
+			path = mac;
+			sourceTree = "<group>";
+		};
+		A8A4731B151A825B004123FF /* text */ = {
+			isa = PBXGroup;
+			children = (
+				A8A4731C151A825B004123FF /* ASCIIFastPath.h */,
+				A8A4731D151A825B004123FF /* AtomicString.cpp */,
+				A8A4731E151A825B004123FF /* AtomicString.h */,
+				A8A4731F151A825B004123FF /* AtomicStringHash.h */,
+				A8A47320151A825B004123FF /* AtomicStringImpl.h */,
+				8134013615B092FD001FF0B8 /* Base64.cpp */,
+				8134013715B092FD001FF0B8 /* Base64.h */,
+				A8A47321151A825B004123FF /* CString.cpp */,
+				A8A47322151A825B004123FF /* CString.h */,
+				26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */,
+				A8A47323151A825B004123FF /* StringBuffer.h */,
+				A8A47324151A825B004123FF /* StringBuilder.cpp */,
+				A8A47325151A825B004123FF /* StringBuilder.h */,
+				A8A47326151A825B004123FF /* StringConcatenate.h */,
+				A8A47327151A825B004123FF /* StringHash.h */,
+				A8A47328151A825B004123FF /* StringImpl.cpp */,
+				A8A47329151A825B004123FF /* StringImpl.h */,
+				A8A4732A151A825B004123FF /* StringOperators.h */,
+				A8A4732B151A825B004123FF /* StringStatics.cpp */,
+				A8A4732C151A825B004123FF /* TextPosition.h */,
+				A8A4732D151A825B004123FF /* WTFString.cpp */,
+				A8A4732E151A825B004123FF /* WTFString.h */,
+			);
+			path = text;
+			sourceTree = "<group>";
+		};
+		A8A47339151A825B004123FF /* threads */ = {
+			isa = PBXGroup;
+			children = (
+				A8A4733A151A825B004123FF /* BinarySemaphore.cpp */,
+				A8A4733B151A825B004123FF /* BinarySemaphore.h */,
+			);
+			path = threads;
+			sourceTree = "<group>";
+		};
+		A8A47348151A825B004123FF /* unicode */ = {
+			isa = PBXGroup;
+			children = (
+				A8A4734F151A825B004123FF /* icu */,
+				A8A47349151A825B004123FF /* CharacterNames.h */,
+				A8A4734A151A825B004123FF /* Collator.h */,
+				A8A4734B151A825B004123FF /* CollatorDefault.cpp */,
+				A8A47354151A825B004123FF /* ScriptCodesFromICU.h */,
+				A8A47355151A825B004123FF /* Unicode.h */,
+				A8A47356151A825B004123FF /* UnicodeMacrosFromICU.h */,
+				A8A47357151A825B004123FF /* UTF8.cpp */,
+				A8A47358151A825B004123FF /* UTF8.h */,
+			);
+			path = unicode;
+			sourceTree = "<group>";
+		};
+		A8A4734F151A825B004123FF /* icu */ = {
+			isa = PBXGroup;
+			children = (
+				A8A47350151A825B004123FF /* CollatorICU.cpp */,
+				A8A47351151A825B004123FF /* UnicodeIcu.h */,
+			);
+			path = icu;
+			sourceTree = "<group>";
+		};
+		A8A4735E151A825B004123FF /* url */ = {
+			isa = PBXGroup;
+			children = (
+				A8A4735F151A825B004123FF /* api */,
+				A8A47363151A825B004123FF /* src */,
+			);
+			path = url;
+			sourceTree = "<group>";
+		};
+		A8A4735F151A825B004123FF /* api */ = {
+			isa = PBXGroup;
+			children = (
+				A8A47360151A825B004123FF /* ParsedURL.cpp */,
+				A8A47361151A825B004123FF /* ParsedURL.h */,
+				A8A47365151A825B004123FF /* URLBuffer.h */,
+				2661122D160FEAD40013F5C3 /* URLQueryCharsetConverter.h */,
+				4330F38E15745B0500AAFA8F /* URLString.cpp */,
+				A8A47362151A825B004123FF /* URLString.h */,
+			);
+			path = api;
+			sourceTree = "<group>";
+		};
+		A8A47363151A825B004123FF /* src */ = {
+			isa = PBXGroup;
+			children = (
+				A8A47364151A825B004123FF /* RawURLBuffer.h */,
+				26E6C1E11609037300CA6AF4 /* URLCanon.h */,
+				26E6C1CE1609037300CA6AF4 /* URLCanonEtc.cpp */,
+				26E6C1CF1609037300CA6AF4 /* URLCanonFilesystemurl.cpp */,
+				26E6C1D01609037300CA6AF4 /* URLCanonFileurl.cpp */,
+				26E6C1D11609037300CA6AF4 /* URLCanonHost.cpp */,
+				26E6C1D21609037300CA6AF4 /* URLCanonICU.cpp */,
+				26E6C1D51609037300CA6AF4 /* URLCanonInternal.cpp */,
+				26E6C1D61609037300CA6AF4 /* URLCanonInternal.h */,
+				26E6C1D71609037300CA6AF4 /* URLCanonIP.cpp */,
+				26E6C1D91609037300CA6AF4 /* URLCanonMailto.cpp */,
+				26E6C1DA1609037300CA6AF4 /* URLCanonPath.cpp */,
+				26E6C1DB1609037300CA6AF4 /* URLCanonPathurl.cpp */,
+				26E6C1DC1609037300CA6AF4 /* URLCanonQuery.cpp */,
+				26E6C1DD1609037300CA6AF4 /* URLCanonRelative.cpp */,
+				26E6C1DF1609037300CA6AF4 /* URLCanonStdURL.cpp */,
+				A8A47366151A825B004123FF /* URLCharacterTypes.cpp */,
+				A8A47367151A825B004123FF /* URLCharacterTypes.h */,
+				A8A47368151A825B004123FF /* URLComponent.h */,
+				26E6C1E31609037300CA6AF4 /* URLFile.h */,
+				26E6C1E71609037300CA6AF4 /* URLParse.cpp */,
+				26E6C1E81609037300CA6AF4 /* URLParse.h */,
+				26E6C1E41609037300CA6AF4 /* URLParseFile.cpp */,
+				26E6C1E51609037300CA6AF4 /* URLParseInternal.h */,
+				A8A4736D151A825B004123FF /* URLSegments.cpp */,
+				A8A4736E151A825B004123FF /* URLSegments.h */,
+				26E6C1EC1609037300CA6AF4 /* URLUtil.cpp */,
+				26E6C1ED1609037300CA6AF4 /* URLUtil.h */,
+				26E6C1EA1609037300CA6AF4 /* URLUtilInternal.h */,
+			);
+			path = src;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		5D247B6014689B8600E78B76 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				A8A4737F151A825B004123FF /* Alignment.h in Headers */,
+				A8A47380151A825B004123FF /* AlwaysInline.h in Headers */,
+				A8A47382151A825B004123FF /* ArrayBuffer.h in Headers */,
+				A8A47384151A825B004123FF /* ArrayBufferView.h in Headers */,
+				A8A47385151A825B004123FF /* ASCIICType.h in Headers */,
+				A8A47434151A825B004123FF /* ASCIIFastPath.h in Headers */,
+				A8A47387151A825B004123FF /* Assertions.h in Headers */,
+				A8A47388151A825B004123FF /* Atomics.h in Headers */,
+				A8A47436151A825B004123FF /* AtomicString.h in Headers */,
+				A8A47437151A825B004123FF /* AtomicStringHash.h in Headers */,
+				A8A47438151A825B004123FF /* AtomicStringImpl.h in Headers */,
+				A8A47389151A825B004123FF /* AVLTree.h in Headers */,
+				8134013915B092FD001FF0B8 /* Base64.h in Headers */,
+				A8A473A9151A825B004123FF /* bignum-dtoa.h in Headers */,
+				A8A473AB151A825B004123FF /* bignum.h in Headers */,
+				A8A47452151A825B004123FF /* BinarySemaphore.h in Headers */,
+				4F0321BC156AA8D1006EBAF6 /* BitArray.h in Headers */,
+				A8A4738A151A825B004123FF /* Bitmap.h in Headers */,
+				A8A4738C151A825B004123FF /* BitVector.h in Headers */,
+				A8A4738E151A825B004123FF /* BlockStack.h in Headers */,
+				A8A4738F151A825B004123FF /* BloomFilter.h in Headers */,
+				A8A47390151A825B004123FF /* BoundsCheckedPointer.h in Headers */,
+				A8A47391151A825B004123FF /* BumpPointerAllocator.h in Headers */,
+				EB95E1F0161A72410089A2F5 /* ByteOrder.h in Headers */,
+				A8A473AD151A825B004123FF /* cached-powers.h in Headers */,
+				A8A4745E151A825B004123FF /* CharacterNames.h in Headers */,
+				A8A47394151A825B004123FF /* CheckedArithmetic.h in Headers */,
+				A8A47395151A825B004123FF /* CheckedBoolean.h in Headers */,
+				A8A4745F151A825B004123FF /* Collator.h in Headers */,
+				A8A47398151A825B004123FF /* Compiler.h in Headers */,
+				A8A47399151A825B004123FF /* Complex.h in Headers */,
+				A8A4748C151A8264004123FF /* config.h in Headers */,
+				A8A4739B151A825B004123FF /* CryptographicallyRandomNumber.h in Headers */,
+				A8A4743A151A825B004123FF /* CString.h in Headers */,
+				A8A4739D151A825B004123FF /* CurrentTime.h in Headers */,
+				A8A4739F151A825B004123FF /* DataLog.h in Headers */,
+				A8A473A1151A825B004123FF /* DateMath.h in Headers */,
+				A8A473A3151A825B004123FF /* DecimalNumber.h in Headers */,
+				A8A473A4151A825B004123FF /* Decoder.h in Headers */,
+				A8A473A5151A825B004123FF /* Deque.h in Headers */,
+				A8A473A6151A825B004123FF /* DisallowCType.h in Headers */,
+				A8A473AF151A825B004123FF /* diy-fp.h in Headers */,
+				A8A473B1151A825B004123FF /* double-conversion.h in Headers */,
+				A8A473B2151A825B004123FF /* double.h in Headers */,
+				A8A473A7151A825B004123FF /* DoublyLinkedList.h in Headers */,
+				A8A473BB151A825B004123FF /* dtoa.h in Headers */,
+				A8A473BD151A825B004123FF /* DynamicAnnotations.h in Headers */,
+				A8A473C0151A825B004123FF /* Encoder.h in Headers */,
+				A8A473C1151A825B004123FF /* ExportMacros.h in Headers */,
+				A8A473B4151A825B004123FF /* fast-dtoa.h in Headers */,
+				A8A473C2151A825B004123FF /* FastAllocBase.h in Headers */,
+				0FD81AC5154FB22E00983E72 /* FastBitVector.h in Headers */,
+				A8A473C4151A825B004123FF /* FastMalloc.h in Headers */,
+				A8A473B6151A825B004123FF /* fixed-dtoa.h in Headers */,
+				A8A473C5151A825B004123FF /* FixedArray.h in Headers */,
+				A8A473C6151A825B004123FF /* Float32Array.h in Headers */,
+				A8A473C7151A825B004123FF /* Float64Array.h in Headers */,
+				A8A473C8151A825B004123FF /* Forward.h in Headers */,
+				A8A473C9151A825B004123FF /* Functional.h in Headers */,
+				A8A473CA151A825B004123FF /* GetPtr.h in Headers */,
+				2C05385415BC819000F21B96 /* GregorianDateTime.h in Headers */,
+				A8A473D3151A825B004123FF /* HashCountedSet.h in Headers */,
+				A8A473D4151A825B004123FF /* HashFunctions.h in Headers */,
+				A8A473D5151A825B004123FF /* HashIterators.h in Headers */,
+				A8A473D6151A825B004123FF /* HashMap.h in Headers */,
+				A8A473D7151A825B004123FF /* HashSet.h in Headers */,
+				A8A473D9151A825B004123FF /* HashTable.h in Headers */,
+				A8A473DA151A825B004123FF /* HashTraits.h in Headers */,
+				A8A473DB151A825B004123FF /* HexNumber.h in Headers */,
+				A8A473DC151A825B004123FF /* InlineASM.h in Headers */,
+				A8A473DE151A825B004123FF /* Int16Array.h in Headers */,
+				A8A473DF151A825B004123FF /* Int32Array.h in Headers */,
+				A8A473DD151A825B004123FF /* Int8Array.h in Headers */,
+				26147B0A15DDCCDC00DDB907 /* IntegerToStringConversion.h in Headers */,
+				A8A473E0151A825B004123FF /* IntegralTypedArrayBase.h in Headers */,
+				A8A473E1151A825B004123FF /* ListHashSet.h in Headers */,
+				A8A473E2151A825B004123FF /* ListRefPtr.h in Headers */,
+				A8A473E3151A825B004123FF /* Locker.h in Headers */,
+				A8A473E6151A825B004123FF /* MainThread.h in Headers */,
+				A8A473E7151A825B004123FF /* MallocZoneSupport.h in Headers */,
+				A8A473E8151A825B004123FF /* MathExtras.h in Headers */,
+				A8A473EA151A825B004123FF /* MD5.h in Headers */,
+				CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */,
+				4F1D115415FF11BE0026E908 /* MemoryInstrumentation.h in Headers */,
+				4FD8554716133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h in Headers */,
+				F3FBC71E161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h in Headers */,
+				F3525E461619A4EE00278BC1 /* MemoryInstrumentationHashMap.h in Headers */,
+				4F1B2DB6160B44AA00586559 /* MemoryInstrumentationHashSet.h in Headers */,
+				F3525E2A16149FF400278BC1 /* MemoryInstrumentationListHashSet.h in Headers */,
+				4FD2A359161B0EE100EBF236 /* MemoryInstrumentationParsedURL.h in Headers */,
+				F3FBC720161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h in Headers */,
+				4FCF27E116172E8600CBF037 /* MemoryInstrumentationString.h in Headers */,
+				4FCB710A160A1A07008425EC /* MemoryInstrumentationVector.h in Headers */,
+				A8A473EB151A825B004123FF /* MessageQueue.h in Headers */,
+				A8A473ED151A825B004123FF /* MetaAllocator.h in Headers */,
+				A8A473EE151A825B004123FF /* MetaAllocatorHandle.h in Headers */,
+				A8A473EF151A825B004123FF /* Noncopyable.h in Headers */,
+				A8A473F0151A825B004123FF /* NonCopyingSort.h in Headers */,
+				A8A473F1151A825B004123FF /* NotFound.h in Headers */,
+				A8A473F3151A825B004123FF /* NullPtr.h in Headers */,
+				A8A473F5151A825B004123FF /* NumberOfCores.h in Headers */,
+				7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */,
+				A8A473F6151A825B004123FF /* OSAllocator.h in Headers */,
+				A8A473FA151A825B004123FF /* OSRandomSource.h in Headers */,
+				A8A473FB151A825B004123FF /* OwnArrayPtr.h in Headers */,
+				A8A473FC151A825B004123FF /* OwnPtr.h in Headers */,
+				A8A473FD151A825B004123FF /* OwnPtrCommon.h in Headers */,
+				A8A473FE151A825B004123FF /* PackedIntVector.h in Headers */,
+				A8A473FF151A825B004123FF /* PageAllocation.h in Headers */,
+				A8A47401151A825B004123FF /* PageAllocationAligned.h in Headers */,
+				A8A47403151A825B004123FF /* PageBlock.h in Headers */,
+				A8A47404151A825B004123FF /* PageReservation.h in Headers */,
+				A8A47405151A825B004123FF /* ParallelJobs.h in Headers */,
+				A8A47408151A825B004123FF /* ParallelJobsLibdispatch.h in Headers */,
+				A8A47470151A825B004123FF /* ParsedURL.h in Headers */,
+				A8A4740A151A825B004123FF /* PassOwnArrayPtr.h in Headers */,
+				A8A4740B151A825B004123FF /* PassOwnPtr.h in Headers */,
+				A8A4740C151A825B004123FF /* PassRefPtr.h in Headers */,
+				A8A4740D151A825B004123FF /* PassTraits.h in Headers */,
+				A876DBD8151816E500DADB95 /* Platform.h in Headers */,
+				A8A4740E151A825B004123FF /* Platform.h in Headers */,
+				A8A4740F151A825B004123FF /* PossiblyNull.h in Headers */,
+				143F61201565F0F900DB514A /* RAMSize.h in Headers */,
+				A8A47415151A825B004123FF /* RandomNumber.h in Headers */,
+				A8A47416151A825B004123FF /* RandomNumberSeed.h in Headers */,
+				A8A47472151A825B004123FF /* RawURLBuffer.h in Headers */,
+				A8A47417151A825B004123FF /* RedBlackTree.h in Headers */,
+				A8A47418151A825B004123FF /* RefCounted.h in Headers */,
+				A8A47419151A825B004123FF /* RefCountedArray.h in Headers */,
+				A8A4741B151A825B004123FF /* RefCountedLeakCounter.h in Headers */,
+				A8A4741C151A825B004123FF /* RefPtr.h in Headers */,
+				A8A4741D151A825B004123FF /* RefPtrHashMap.h in Headers */,
+				A8A4741E151A825B004123FF /* RetainPtr.h in Headers */,
+				14F3B0F715E45E4600210069 /* SaturatedArithmetic.h in Headers */,
+				A8A47466151A825B004123FF /* ScriptCodesFromICU.h in Headers */,
+				A8A4741F151A825B004123FF /* SegmentedVector.h in Headers */,
+				A8A47420151A825B004123FF /* SentinelLinkedList.h in Headers */,
+				A8A47422151A825B004123FF /* SHA1.h in Headers */,
+				A8A47423151A825B004123FF /* SimpleStats.h in Headers */,
+				A8A47424151A825B004123FF /* SinglyLinkedList.h in Headers */,
+				A8A47426151A825B004123FF /* Spectrum.h in Headers */,
+				A8A47428151A825B004123FF /* StackBounds.h in Headers */,
+				FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */,
+				A8A47429151A825B004123FF /* StaticConstructors.h in Headers */,
+				A8A4742A151A825B004123FF /* StdLibExtras.h in Headers */,
+				1A6BB769162F300500DD16DB /* StreamBuffer.h in Headers */,
+				A8A4743B151A825B004123FF /* StringBuffer.h in Headers */,
+				A8A4743D151A825B004123FF /* StringBuilder.h in Headers */,
+				A8A4743E151A825B004123FF /* StringConcatenate.h in Headers */,
+				A8A4742C151A825B004123FF /* StringExtras.h in Headers */,
+				A8A4743F151A825B004123FF /* StringHash.h in Headers */,
+				A8A4742D151A825B004123FF /* StringHasher.h in Headers */,
+				A8A47441151A825B004123FF /* StringImpl.h in Headers */,
+				A8A47442151A825B004123FF /* StringOperators.h in Headers */,
+				A8A473B8151A825B004123FF /* strtod.h in Headers */,
+				A8A4742E151A825B004123FF /* TCPackedCache.h in Headers */,
+				A8A4742F151A825B004123FF /* TCPageMap.h in Headers */,
+				A8A47430151A825B004123FF /* TCSpinLock.h in Headers */,
+				A8A47432151A825B004123FF /* TCSystemAlloc.h in Headers */,
+				A8A47433151A825B004123FF /* TemporaryChange.h in Headers */,
+				A8A47444151A825B004123FF /* TextPosition.h in Headers */,
+				A8A47447151A825B004123FF /* ThreadFunctionInvocation.h in Headers */,
+				A8A47449151A825B004123FF /* ThreadIdentifierDataPthreads.h in Headers */,
+				A8A4744B151A825B004123FF /* Threading.h in Headers */,
+				A8A4744D151A825B004123FF /* ThreadingPrimitives.h in Headers */,
+				A8A47450151A825B004123FF /* ThreadRestrictionVerifier.h in Headers */,
+				A8A47454151A825B004123FF /* ThreadSafeRefCounted.h in Headers */,
+				A8A47455151A825B004123FF /* ThreadSpecific.h in Headers */,
+				A8A47457151A825B004123FF /* TypedArrayBase.h in Headers */,
+				A8A47459151A825B004123FF /* TypeTraits.h in Headers */,
+				A8A4745C151A825B004123FF /* Uint16Array.h in Headers */,
+				A8A4745D151A825B004123FF /* Uint32Array.h in Headers */,
+				A8A4745A151A825B004123FF /* Uint8Array.h in Headers */,
+				A8A4745B151A825B004123FF /* Uint8ClampedArray.h in Headers */,
+				A8A47467151A825B004123FF /* Unicode.h in Headers */,
+				A8A47464151A825B004123FF /* UnicodeIcu.h in Headers */,
+				A8A47468151A825B004123FF /* UnicodeMacrosFromICU.h in Headers */,
+				A8A4746D151A825B004123FF /* UnionFind.h in Headers */,
+				A8A4746E151A825B004123FF /* UnusedParam.h in Headers */,
+				A8A47473151A825B004123FF /* URLBuffer.h in Headers */,
+				26E6C2011609037300CA6AF4 /* URLCanon.h in Headers */,
+				26E6C1F61609037300CA6AF4 /* URLCanonInternal.h in Headers */,
+				A8A47475151A825B004123FF /* URLCharacterTypes.h in Headers */,
+				A8A47476151A825B004123FF /* URLComponent.h in Headers */,
+				26E6C2031609037300CA6AF4 /* URLFile.h in Headers */,
+				26E6C2081609037300CA6AF4 /* URLParse.h in Headers */,
+				26E6C2051609037300CA6AF4 /* URLParseInternal.h in Headers */,
+				2661122E160FEAD40013F5C3 /* URLQueryCharsetConverter.h in Headers */,
+				A8A4747C151A825B004123FF /* URLSegments.h in Headers */,
+				A8A47471151A825B004123FF /* URLString.h in Headers */,
+				26E6C20D1609037300CA6AF4 /* URLUtil.h in Headers */,
+				26E6C20A1609037300CA6AF4 /* URLUtilInternal.h in Headers */,
+				A8A4746A151A825B004123FF /* UTF8.h in Headers */,
+				A8A473B9151A825B004123FF /* utils.h in Headers */,
+				A8A4747D151A825B004123FF /* ValueCheck.h in Headers */,
+				A8A4747E151A825B004123FF /* Vector.h in Headers */,
+				A8A4747F151A825B004123FF /* VectorTraits.h in Headers */,
+				A8A47480151A825B004123FF /* VMTags.h in Headers */,
+				A8A47446151A825B004123FF /* WTFString.h in Headers */,
+				A8A47487151A825B004123FF /* WTFThreadData.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		5D247B6114689B8600E78B76 /* WTF */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 5D247B6614689B8600E78B76 /* Build configuration list for PBXNativeTarget "WTF" */;
+			buildPhases = (
+				5D247E9D1468AEE200E78B76 /* Detect Available Headers */,
+				5D247B5E14689B8600E78B76 /* Sources */,
+				5D247B5F14689B8600E78B76 /* Frameworks */,
+				5D247B6014689B8600E78B76 /* Headers */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				65AFA28E1630B99E003D723C /* PBXTargetDependency */,
+			);
+			name = WTF;
+			productName = WTF;
+			productReference = 5D247B6214689B8600E78B76 /* libWTF.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		5D247B5914689B8600E78B76 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0440;
+			};
+			buildConfigurationList = 5D247B5C14689B8600E78B76 /* Build configuration list for PBXProject "WTF" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 5D247B5714689B8600E78B76;
+			productRefGroup = 5D247B6314689B8600E78B76 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				5D247B6114689B8600E78B76 /* WTF */,
+				65AFA16F1630B977003D723C /* Copy WTF Headers */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		5D247E9D1468AEE200E78B76 /* Detect Available Headers */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+				"$(SDKROOT)/System/Library/CoreServices/SystemVersion.plist",
+			);
+			name = "Detect Available Headers";
+			outputPaths = (
+				"$(BUILT_PRODUCTS_DIR)/DerivedSources/WTF/HeaderDetection.h",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "OUTPUT_FILE=\"${BUILT_PRODUCTS_DIR}/DerivedSources/WTF/HeaderDetection.h\"\necho \"/* This is a generated file. Do not edit. */\" > \"${OUTPUT_FILE}\"\n\nif [[ -f \"${SDKROOT}/System/Library/Frameworks/System.framework/PrivateHeaders/pthread_machdep.h\" ]]; then\n    echo \"#define HAVE_PTHREAD_MACHDEP_H 1\" >> \"${OUTPUT_FILE}\"\nfi\n";
+		};
+		65AFA1701630B977003D723C /* Copy WTF Headers */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+			);
+			name = "Copy WTF Headers";
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "if [[ \"${DEPLOYMENT_LOCATION}\" == \"NO\" ]]; then\n    PRIVATE_HEADERS_PATH=\"${TARGET_BUILD_DIR%%/}${PRIVATE_HEADERS_FOLDER_PATH}\"\nelse\n    PRIVATE_HEADERS_PATH=\"${DSTROOT%%/}${PRIVATE_HEADERS_FOLDER_PATH}\"\nfi;\n\nmkdir -p \"${PRIVATE_HEADERS_PATH}\"\nrsync -av --no-owner --no-group --prune-empty-dirs --exclude \".svn\" --exclude \"usr\" --exclude \"DerivedSources\" --include \"*/\" --include \"*.h\" --exclude \"*\" \"${SRCROOT}/wtf/\" \"${PRIVATE_HEADERS_PATH}\"\n\n";
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		5D247B5E14689B8600E78B76 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				A8A47381151A825B004123FF /* ArrayBuffer.cpp in Sources */,
+				A8A47383151A825B004123FF /* ArrayBufferView.cpp in Sources */,
+				A8A47386151A825B004123FF /* Assertions.cpp in Sources */,
+				A8A47435151A825B004123FF /* AtomicString.cpp in Sources */,
+				8134013815B092FD001FF0B8 /* Base64.cpp in Sources */,
+				A8A473A8151A825B004123FF /* bignum-dtoa.cc in Sources */,
+				A8A473AA151A825B004123FF /* bignum.cc in Sources */,
+				A8A47451151A825B004123FF /* BinarySemaphore.cpp in Sources */,
+				A8A4738B151A825B004123FF /* BitVector.cpp in Sources */,
+				A8A473AC151A825B004123FF /* cached-powers.cc in Sources */,
+				A8A47460151A825B004123FF /* CollatorDefault.cpp in Sources */,
+				A8A47463151A825B004123FF /* CollatorICU.cpp in Sources */,
+				A8A4739A151A825B004123FF /* CryptographicallyRandomNumber.cpp in Sources */,
+				A8A47439151A825B004123FF /* CString.cpp in Sources */,
+				A8A4739C151A825B004123FF /* CurrentTime.cpp in Sources */,
+				A8A4739E151A825B004123FF /* DataLog.cpp in Sources */,
+				A8A473A0151A825B004123FF /* DateMath.cpp in Sources */,
+				A8A473A2151A825B004123FF /* DecimalNumber.cpp in Sources */,
+				A8A473AE151A825B004123FF /* diy-fp.cc in Sources */,
+				A8A473B0151A825B004123FF /* double-conversion.cc in Sources */,
+				A8A473BA151A825B004123FF /* dtoa.cpp in Sources */,
+				A8A473BC151A825B004123FF /* DynamicAnnotations.cpp in Sources */,
+				A8A473B3151A825B004123FF /* fast-dtoa.cc in Sources */,
+				A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */,
+				A8A473B5151A825B004123FF /* fixed-dtoa.cc in Sources */,
+				2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */,
+				A8A473D8151A825B004123FF /* HashTable.cpp in Sources */,
+				A8A473E5151A825B004123FF /* MainThread.cpp in Sources */,
+				A8A473E4151A825B004123FF /* MainThreadMac.mm in Sources */,
+				A8A473E9151A825B004123FF /* MD5.cpp in Sources */,
+				CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */,
+				A8A473EC151A825B004123FF /* MetaAllocator.cpp in Sources */,
+				A8A473F2151A825B004123FF /* NullPtr.cpp in Sources */,
+				A8A473F4151A825B004123FF /* NumberOfCores.cpp in Sources */,
+				A8A473F7151A825B004123FF /* OSAllocatorPosix.cpp in Sources */,
+				A8A473F9151A825B004123FF /* OSRandomSource.cpp in Sources */,
+				A8A47400151A825B004123FF /* PageAllocationAligned.cpp in Sources */,
+				A8A47402151A825B004123FF /* PageBlock.cpp in Sources */,
+				A8A4746F151A825B004123FF /* ParsedURL.cpp in Sources */,
+				143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */,
+				A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */,
+				A8A4741A151A825B004123FF /* RefCountedLeakCounter.cpp in Sources */,
+				A8A47421151A825B004123FF /* SHA1.cpp in Sources */,
+				A8A47425151A825B004123FF /* SizeLimits.cpp in Sources */,
+				A8A47427151A825B004123FF /* StackBounds.cpp in Sources */,
+				FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */,
+				A8A4743C151A825B004123FF /* StringBuilder.cpp in Sources */,
+				A8A4742B151A825B004123FF /* StringExtras.cpp in Sources */,
+				A8A47440151A825B004123FF /* StringImpl.cpp in Sources */,
+				A8A47443151A825B004123FF /* StringStatics.cpp in Sources */,
+				A8A473B7151A825B004123FF /* strtod.cc in Sources */,
+				A8A47431151A825B004123FF /* TCSystemAlloc.cpp in Sources */,
+				A8A47448151A825B004123FF /* ThreadIdentifierDataPthreads.cpp in Sources */,
+				A8A4744A151A825B004123FF /* Threading.cpp in Sources */,
+				A8A4744E151A825B004123FF /* ThreadingPthreads.cpp in Sources */,
+				A8A47458151A825B004123FF /* TypeTraits.cpp in Sources */,
+				26E6C1EE1609037300CA6AF4 /* URLCanonEtc.cpp in Sources */,
+				26E6C1EF1609037300CA6AF4 /* URLCanonFilesystemurl.cpp in Sources */,
+				26E6C1F01609037300CA6AF4 /* URLCanonFileurl.cpp in Sources */,
+				26E6C1F11609037300CA6AF4 /* URLCanonHost.cpp in Sources */,
+				26E6C1F21609037300CA6AF4 /* URLCanonICU.cpp in Sources */,
+				26E6C1F51609037300CA6AF4 /* URLCanonInternal.cpp in Sources */,
+				26E6C1F71609037300CA6AF4 /* URLCanonIP.cpp in Sources */,
+				26E6C1F91609037300CA6AF4 /* URLCanonMailto.cpp in Sources */,
+				26E6C1FA1609037300CA6AF4 /* URLCanonPath.cpp in Sources */,
+				26E6C1FB1609037300CA6AF4 /* URLCanonPathurl.cpp in Sources */,
+				26E6C1FC1609037300CA6AF4 /* URLCanonQuery.cpp in Sources */,
+				26E6C1FD1609037300CA6AF4 /* URLCanonRelative.cpp in Sources */,
+				26E6C1FF1609037300CA6AF4 /* URLCanonStdURL.cpp in Sources */,
+				A8A47474151A825B004123FF /* URLCharacterTypes.cpp in Sources */,
+				26E6C2071609037300CA6AF4 /* URLParse.cpp in Sources */,
+				26E6C2041609037300CA6AF4 /* URLParseFile.cpp in Sources */,
+				A8A4747B151A825B004123FF /* URLSegments.cpp in Sources */,
+				4330F38F15745B0500AAFA8F /* URLString.cpp in Sources */,
+				26E6C20C1609037300CA6AF4 /* URLUtil.cpp in Sources */,
+				A8A47469151A825B004123FF /* UTF8.cpp in Sources */,
+				A8A47445151A825B004123FF /* WTFString.cpp in Sources */,
+				A8A47486151A825B004123FF /* WTFThreadData.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		65AFA28E1630B99E003D723C /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 65AFA16F1630B977003D723C /* Copy WTF Headers */;
+			targetProxy = 65AFA28D1630B99E003D723C /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		5D247B6414689B8600E78B76 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 5D247B7014689C4700E78B76 /* DebugRelease.xcconfig */;
+			buildSettings = {
+				DEAD_CODE_STRIPPING = "$(DEAD_CODE_STRIPPING_debug)";
+				DEBUG_DEFINES = "$(DEBUG_DEFINES_debug)";
+				GCC_OPTIMIZATION_LEVEL = "$(GCC_OPTIMIZATION_LEVEL_debug)";
+				STRIP_INSTALLED_PRODUCT = "$(STRIP_INSTALLED_PRODUCT_debug)";
+			};
+			name = Debug;
+		};
+		5D247B6514689B8600E78B76 /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 5D247B7014689C4700E78B76 /* DebugRelease.xcconfig */;
+			buildSettings = {
+			};
+			name = Release;
+		};
+		5D247B6714689B8600E78B76 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 5D247B7314689C4700E78B76 /* WTF.xcconfig */;
+			buildSettings = {
+			};
+			name = Debug;
+		};
+		5D247B6814689B8600E78B76 /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 5D247B7314689C4700E78B76 /* WTF.xcconfig */;
+			buildSettings = {
+			};
+			name = Release;
+		};
+		5D247B7414689CC900E78B76 /* Production */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 5D247B6E14689C4700E78B76 /* Base.xcconfig */;
+			buildSettings = {
+			};
+			name = Production;
+		};
+		5D247B7514689CC900E78B76 /* Production */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 5D247B7314689C4700E78B76 /* WTF.xcconfig */;
+			buildSettings = {
+			};
+			name = Production;
+		};
+		65AFA2891630B977003D723C /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6541CAF41630DB26006D0DEC /* CopyWTFHeaders.xcconfig */;
+			buildSettings = {
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		65AFA28A1630B977003D723C /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6541CAF41630DB26006D0DEC /* CopyWTFHeaders.xcconfig */;
+			buildSettings = {
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+		65AFA28B1630B977003D723C /* Production */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6541CAF41630DB26006D0DEC /* CopyWTFHeaders.xcconfig */;
+			buildSettings = {
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Production;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		5D247B5C14689B8600E78B76 /* Build configuration list for PBXProject "WTF" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				5D247B6414689B8600E78B76 /* Debug */,
+				5D247B6514689B8600E78B76 /* Release */,
+				5D247B7414689CC900E78B76 /* Production */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Production;
+		};
+		5D247B6614689B8600E78B76 /* Build configuration list for PBXNativeTarget "WTF" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				5D247B6714689B8600E78B76 /* Debug */,
+				5D247B6814689B8600E78B76 /* Release */,
+				5D247B7514689CC900E78B76 /* Production */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Production;
+		};
+		65AFA2881630B977003D723C /* Build configuration list for PBXAggregateTarget "Copy WTF Headers" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				65AFA2891630B977003D723C /* Debug */,
+				65AFA28A1630B977003D723C /* Release */,
+				65AFA28B1630B977003D723C /* Production */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Production;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 5D247B5914689B8600E78B76 /* Project object */;
+}
diff --git a/Source/WTF/config.h b/Source/WTF/config.h
new file mode 100644
index 0000000..dabdd0e
--- /dev/null
+++ b/Source/WTF/config.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * 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.
+ *
+ */
+
+#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
+#ifdef BUILDING_WITH_CMAKE
+#include "cmakeconfig.h"
+#else
+#include "autotoolsconfig.h"
+#endif
+#endif
+
+#include <wtf/Platform.h>
+#include <wtf/ExportMacros.h>
+
+#if OS(WINDOWS)
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+#endif
+
+#ifndef WINVER
+#define WINVER 0x0500
+#endif
+
+// If we don't define these, they get defined in windef.h. 
+// We want to use std::min and std::max
+#define max max
+#define min min
+
+#if !COMPILER(MSVC7_OR_LOWER) && !OS(WINCE)
+// We need to define this before the first #include of stdlib.h or it won't contain rand_s.
+#ifndef _CRT_RAND_S
+#define _CRT_RAND_S
+#endif
+#endif
+
+#endif
+
+#define WTF_CHANGES 1
+
+#ifdef __cplusplus
+#undef new
+#undef delete
+#include <wtf/FastMalloc.h>
+#endif
+
+#include <wtf/DisallowCType.h>
+
+#if COMPILER(MSVC)
+#define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1
+#else
+#define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1
+#endif
diff --git a/Source/WTF/icu/LICENSE b/Source/WTF/icu/LICENSE
new file mode 100644
index 0000000..385d130
--- /dev/null
+++ b/Source/WTF/icu/LICENSE
@@ -0,0 +1,25 @@
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 1995-2006 International Business Machines Corporation and others
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this
+software and associated documentation files (the "Software"), to deal in the Software
+without restriction, including without limitation the rights to use, copy, modify,
+merge, publish, distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above copyright notice(s)
+and this permission notice appear in all copies of the Software and that both the above
+copyright notice(s) and this permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR
+CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not be used in
+advertising or otherwise to promote the sale, use or other dealings in this Software
+without prior written authorization of the copyright holder.
diff --git a/Source/WTF/icu/README b/Source/WTF/icu/README
new file mode 100644
index 0000000..389e2e8
--- /dev/null
+++ b/Source/WTF/icu/README
@@ -0,0 +1,4 @@
+The headers in this directory are for compiling on Mac OS X 10.4.
+The Mac OS X 10.4 release includes the ICU binary, but not ICU headers.
+For other platforms, installed ICU headers should be used rather than these.
+They are specific to Mac OS X 10.4.
diff --git a/Source/WTF/icu/unicode/bytestream.h b/Source/WTF/icu/unicode/bytestream.h
new file mode 100644
index 0000000..fb9e07a
--- /dev/null
+++ b/Source/WTF/icu/unicode/bytestream.h
@@ -0,0 +1,252 @@
+// Copyright (C) 2009-2010, International Business Machines
+// Corporation and others. All Rights Reserved.
+//
+// Copyright 2007 Google Inc. All Rights Reserved.
+// Author: sanjay@google.com (Sanjay Ghemawat)
+//
+// Abstract interface that consumes a sequence of bytes (ByteSink).
+//
+// Used so that we can write a single piece of code that can operate
+// on a variety of output string types.
+//
+// Various implementations of this interface are provided:
+//   ByteSink:
+//      CheckedArrayByteSink    Write to a flat array, with bounds checking
+//      StringByteSink          Write to an STL string
+
+// This code is a contribution of Google code, and the style used here is
+// a compromise between the original Google code and the ICU coding guidelines.
+// For example, data types are ICU-ified (size_t,int->int32_t),
+// and API comments doxygen-ified, but function names and behavior are
+// as in the original, if possible.
+// Assertion-style error handling, not available in ICU, was changed to
+// parameter "pinning" similar to UnicodeString.
+//
+// In addition, this is only a partial port of the original Google code,
+// limited to what was needed so far. The (nearly) complete original code
+// is in the ICU svn repository at icuhtml/trunk/design/strings/contrib
+// (see ICU ticket 6765, r25517).
+
+#ifndef __BYTESTREAM_H__
+#define __BYTESTREAM_H__
+
+/**
+ * \file
+ * \brief C++ API: Interface for writing bytes, and implementation classes.
+ */
+
+#include "unicode/utypes.h"
+#include "unicode/uobject.h"
+#include "unicode/std_string.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * A ByteSink can be filled with bytes.
+ * @stable ICU 4.2
+ */
+class U_COMMON_API ByteSink : public UMemory {
+public:
+  /**
+   * Default constructor.
+   * @stable ICU 4.2
+   */
+  ByteSink() { }
+  /**
+   * Virtual destructor.
+   * @stable ICU 4.2
+   */
+  virtual ~ByteSink() { }
+
+  /**
+   * Append "bytes[0,n-1]" to this.
+   * @param bytes the pointer to the bytes
+   * @param n the number of bytes; must be non-negative
+   * @stable ICU 4.2
+   */
+  virtual void Append(const char* bytes, int32_t n) = 0;
+
+  /**
+   * Returns a writable buffer for appending and writes the buffer's capacity to
+   * *result_capacity. Guarantees *result_capacity>=min_capacity.
+   * May return a pointer to the caller-owned scratch buffer which must have
+   * scratch_capacity>=min_capacity.
+   * The returned buffer is only valid until the next operation
+   * on this ByteSink.
+   *
+   * After writing at most *result_capacity bytes, call Append() with the
+   * pointer returned from this function and the number of bytes written.
+   * Many Append() implementations will avoid copying bytes if this function
+   * returned an internal buffer.
+   *
+   * Partial usage example:
+   *  int32_t capacity;
+   *  char* buffer = sink->GetAppendBuffer(..., &capacity);
+   *  ... Write n bytes into buffer, with n <= capacity.
+   *  sink->Append(buffer, n);
+   * In many implementations, that call to Append will avoid copying bytes.
+   *
+   * If the ByteSink allocates or reallocates an internal buffer, it should use
+   * the desired_capacity_hint if appropriate.
+   * If a caller cannot provide a reasonable guess at the desired capacity,
+   * it should pass desired_capacity_hint=0.
+   *
+   * If a non-scratch buffer is returned, the caller may only pass
+   * a prefix to it to Append().
+   * That is, it is not correct to pass an interior pointer to Append().
+   *
+   * The default implementation always returns the scratch buffer.
+   *
+   * @param min_capacity required minimum capacity of the returned buffer;
+   *                     must be non-negative
+   * @param desired_capacity_hint desired capacity of the returned buffer;
+   *                              must be non-negative
+   * @param scratch default caller-owned buffer
+   * @param scratch_capacity capacity of the scratch buffer
+   * @param result_capacity pointer to an integer which will be set to the
+   *                        capacity of the returned buffer
+   * @return a buffer with *result_capacity>=min_capacity
+   * @stable ICU 4.2
+   */
+  virtual char* GetAppendBuffer(int32_t min_capacity,
+                                int32_t desired_capacity_hint,
+                                char* scratch, int32_t scratch_capacity,
+                                int32_t* result_capacity);
+
+  /**
+   * Flush internal buffers.
+   * Some byte sinks use internal buffers or provide buffering
+   * and require calling Flush() at the end of the stream.
+   * The ByteSink should be ready for further Append() calls after Flush().
+   * The default implementation of Flush() does nothing.
+   * @stable ICU 4.2
+   */
+  virtual void Flush();
+
+private:
+  ByteSink(const ByteSink &); // copy constructor not implemented
+  ByteSink &operator=(const ByteSink &); // assignment operator not implemented
+};
+
+// -------------------------------------------------------------
+// Some standard implementations
+
+/** 
+ * Implementation of ByteSink that writes to a flat byte array,
+ * with bounds-checking:
+ * This sink will not write more than capacity bytes to outbuf.
+ * If more than capacity bytes are Append()ed, then excess bytes are ignored,
+ * and Overflowed() will return true.
+ * Overflow does not cause a runtime error.
+ * @stable ICU 4.2
+ */
+class U_COMMON_API CheckedArrayByteSink : public ByteSink {
+public:
+  /**
+   * Constructs a ByteSink that will write to outbuf[0..capacity-1].
+   * @param outbuf buffer to write to
+   * @param capacity size of the buffer
+   * @stable ICU 4.2
+   */
+  CheckedArrayByteSink(char* outbuf, int32_t capacity);
+  /**
+   * Returns the sink to its original state, without modifying the buffer.
+   * Useful for reusing both the buffer and the sink for multiple streams.
+   * Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0
+   * and Overflowed()=FALSE.
+   * @return *this
+   * @draft ICU 4.6
+   */
+  virtual CheckedArrayByteSink& Reset();
+  /**
+   * Append "bytes[0,n-1]" to this.
+   * @param bytes the pointer to the bytes
+   * @param n the number of bytes; must be non-negative
+   * @stable ICU 4.2
+   */
+  virtual void Append(const char* bytes, int32_t n);
+  /**
+   * Returns a writable buffer for appending and writes the buffer's capacity to
+   * *result_capacity. For details see the base class documentation.
+   * @param min_capacity required minimum capacity of the returned buffer;
+   *                     must be non-negative
+   * @param desired_capacity_hint desired capacity of the returned buffer;
+   *                              must be non-negative
+   * @param scratch default caller-owned buffer
+   * @param scratch_capacity capacity of the scratch buffer
+   * @param result_capacity pointer to an integer which will be set to the
+   *                        capacity of the returned buffer
+   * @return a buffer with *result_capacity>=min_capacity
+   * @stable ICU 4.2
+   */
+  virtual char* GetAppendBuffer(int32_t min_capacity,
+                                int32_t desired_capacity_hint,
+                                char* scratch, int32_t scratch_capacity,
+                                int32_t* result_capacity);
+  /**
+   * Returns the number of bytes actually written to the sink.
+   * @return number of bytes written to the buffer
+   * @stable ICU 4.2
+   */
+  int32_t NumberOfBytesWritten() const { return size_; }
+  /**
+   * Returns true if any bytes were discarded, i.e., if there was an
+   * attempt to write more than 'capacity' bytes.
+   * @return TRUE if more than 'capacity' bytes were Append()ed
+   * @stable ICU 4.2
+   */
+  UBool Overflowed() const { return overflowed_; }
+  /**
+   * Returns the number of bytes appended to the sink.
+   * If Overflowed() then NumberOfBytesAppended()>NumberOfBytesWritten()
+   * else they return the same number.
+   * @return number of bytes written to the buffer
+   * @draft ICU 4.6
+   */
+  int32_t NumberOfBytesAppended() const { return appended_; }
+private:
+  char* outbuf_;
+  const int32_t capacity_;
+  int32_t size_;
+  int32_t appended_;
+  UBool overflowed_;
+  CheckedArrayByteSink(); ///< default constructor not implemented 
+  CheckedArrayByteSink(const CheckedArrayByteSink &); ///< copy constructor not implemented
+  CheckedArrayByteSink &operator=(const CheckedArrayByteSink &); ///< assignment operator not implemented
+};
+
+#if U_HAVE_STD_STRING
+
+/** 
+ * Implementation of ByteSink that writes to a "string".
+ * The StringClass is usually instantiated with a std::string.
+ * @stable ICU 4.2
+ */
+template<typename StringClass>
+class StringByteSink : public ByteSink {
+ public:
+  /**
+   * Constructs a ByteSink that will append bytes to the dest string.
+   * @param dest pointer to string object to append to
+   * @stable ICU 4.2
+   */
+  StringByteSink(StringClass* dest) : dest_(dest) { }
+  /**
+   * Append "bytes[0,n-1]" to this.
+   * @param data the pointer to the bytes
+   * @param n the number of bytes; must be non-negative
+   * @stable ICU 4.2
+   */
+  virtual void Append(const char* data, int32_t n) { dest_->append(data, n); }
+ private:
+  StringClass* dest_;
+  StringByteSink(); ///< default constructor not implemented 
+  StringByteSink(const StringByteSink &); ///< copy constructor not implemented
+  StringByteSink &operator=(const StringByteSink &); ///< assignment operator not implemented
+};
+
+#endif
+
+U_NAMESPACE_END
+
+#endif  // __BYTESTREAM_H__
diff --git a/Source/WTF/icu/unicode/localpointer.h b/Source/WTF/icu/unicode/localpointer.h
new file mode 100644
index 0000000..b76a1f8
--- /dev/null
+++ b/Source/WTF/icu/unicode/localpointer.h
@@ -0,0 +1,300 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2009-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  localpointer.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 2009nov13
+*   created by: Markus W. Scherer
+*/
+
+#ifndef __LOCALPOINTER_H__
+#define __LOCALPOINTER_H__
+
+/**
+ * \file 
+ * \brief C++ API: "Smart pointers" for use with and in ICU4C C++ code.
+ *
+ * These classes are inspired by
+ * - std::auto_ptr
+ * - boost::scoped_ptr & boost::scoped_array
+ * - Taligent Safe Pointers (TOnlyPointerTo)
+ *
+ * but none of those provide for all of the goals for ICU smart pointers:
+ * - Smart pointer owns the object and releases it when it goes out of scope.
+ * - No transfer of ownership via copy/assignment to reduce misuse. Simpler & more robust.
+ * - ICU-compatible: No exceptions.
+ * - Need to be able to orphan/release the pointer and its ownership.
+ * - Need variants for normal C++ object pointers, C++ arrays, and ICU C service objects.
+ *
+ * For details see http://site.icu-project.org/design/cpp/scoped_ptr
+ */
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * "Smart pointer" base class; do not use directly: use LocalPointer etc.
+ *
+ * Base class for smart pointer classes that do not throw exceptions.
+ *
+ * Do not use this base class directly, since it does not delete its pointer.
+ * A subclass must implement methods that delete the pointer:
+ * Destructor and adoptInstead().
+ *
+ * There is no operator T *() provided because the programmer must decide
+ * whether to use getAlias() (without transfer of ownership) or orpan()
+ * (with transfer of ownership and NULLing of the pointer).
+ *
+ * @see LocalPointer
+ * @see LocalArray
+ * @see U_DEFINE_LOCAL_OPEN_POINTER
+ * @stable ICU 4.4
+ */
+template<typename T>
+class LocalPointerBase {
+public:
+    /**
+     * Constructor takes ownership.
+     * @param p simple pointer to an object that is adopted
+     * @stable ICU 4.4
+     */
+    explicit LocalPointerBase(T *p=NULL) : ptr(p) {}
+    /**
+     * Destructor deletes the object it owns.
+     * Subclass must override: Base class does nothing.
+     * @stable ICU 4.4
+     */
+    ~LocalPointerBase() { /* delete ptr; */ }
+    /**
+     * NULL check.
+     * @return TRUE if ==NULL
+     * @stable ICU 4.4
+     */
+    UBool isNull() const { return ptr==NULL; }
+    /**
+     * NULL check.
+     * @return TRUE if !=NULL
+     * @stable ICU 4.4
+     */
+    UBool isValid() const { return ptr!=NULL; }
+    /**
+     * Comparison with a simple pointer, so that existing code
+     * with ==NULL need not be changed.
+     * @param other simple pointer for comparison
+     * @return true if this pointer value equals other
+     * @stable ICU 4.4
+     */
+    bool operator==(const T *other) const { return ptr==other; }
+    /**
+     * Comparison with a simple pointer, so that existing code
+     * with !=NULL need not be changed.
+     * @param other simple pointer for comparison
+     * @return true if this pointer value differs from other
+     * @stable ICU 4.4
+     */
+    bool operator!=(const T *other) const { return ptr!=other; }
+    /**
+     * Access without ownership change.
+     * @return the pointer value
+     * @stable ICU 4.4
+     */
+    T *getAlias() const { return ptr; }
+    /**
+     * Access without ownership change.
+     * @return the pointer value as a reference
+     * @stable ICU 4.4
+     */
+    T &operator*() const { return *ptr; }
+    /**
+     * Access without ownership change.
+     * @return the pointer value
+     * @stable ICU 4.4
+     */
+    T *operator->() const { return ptr; }
+    /**
+     * Gives up ownership; the internal pointer becomes NULL.
+     * @return the pointer value;
+     *         caller becomes responsible for deleting the object
+     * @stable ICU 4.4
+     */
+    T *orphan() {
+        T *p=ptr;
+        ptr=NULL;
+        return p;
+    }
+    /**
+     * Deletes the object it owns,
+     * and adopts (takes ownership of) the one passed in.
+     * Subclass must override: Base class does not delete the object.
+     * @param p simple pointer to an object that is adopted
+     * @stable ICU 4.4
+     */
+    void adoptInstead(T *p) {
+        // delete ptr;
+        ptr=p;
+    }
+protected:
+    T *ptr;
+private:
+    // No comparison operators with other LocalPointerBases.
+    bool operator==(const LocalPointerBase &other);
+    bool operator!=(const LocalPointerBase &other);
+    // No ownership transfer: No copy constructor, no assignment operator.
+    LocalPointerBase(const LocalPointerBase &other);
+    void operator=(const LocalPointerBase &other);
+    // No heap allocation. Use only on the stack.
+    static void * U_EXPORT2 operator new(size_t size);
+    static void * U_EXPORT2 operator new[](size_t size);
+#if U_HAVE_PLACEMENT_NEW
+    static void * U_EXPORT2 operator new(size_t, void *ptr);
+#endif
+};
+
+/**
+ * "Smart pointer" class, deletes objects via the standard C++ delete operator.
+ * For most methods see the LocalPointerBase base class.
+ *
+ * Usage example:
+ * \code
+ * LocalPointer<UnicodeString> s(new UnicodeString((UChar32)0x50005));
+ * int32_t length=s->length();  // 2
+ * UChar lead=s->charAt(0);  // 0xd900
+ * if(some condition) { return; }  // no need to explicitly delete the pointer
+ * s.adoptInstead(new UnicodeString((UChar)0xfffc));
+ * length=s->length();  // 1
+ * // no need to explicitly delete the pointer
+ * \endcode
+ *
+ * @see LocalPointerBase
+ * @stable ICU 4.4
+ */
+template<typename T>
+class LocalPointer : public LocalPointerBase<T> {
+public:
+    /**
+     * Constructor takes ownership.
+     * @param p simple pointer to an object that is adopted
+     * @stable ICU 4.4
+     */
+    explicit LocalPointer(T *p=NULL) : LocalPointerBase<T>(p) {}
+    /**
+     * Destructor deletes the object it owns.
+     * @stable ICU 4.4
+     */
+    ~LocalPointer() {
+        delete LocalPointerBase<T>::ptr;
+    }
+    /**
+     * Deletes the object it owns,
+     * and adopts (takes ownership of) the one passed in.
+     * @param p simple pointer to an object that is adopted
+     * @stable ICU 4.4
+     */
+    void adoptInstead(T *p) {
+        delete LocalPointerBase<T>::ptr;
+        LocalPointerBase<T>::ptr=p;
+    }
+};
+
+/**
+ * "Smart pointer" class, deletes objects via the C++ array delete[] operator.
+ * For most methods see the LocalPointerBase base class.
+ * Adds operator[] for array item access.
+ *
+ * Usage example:
+ * \code
+ * LocalArray<UnicodeString> a(new UnicodeString[2]);
+ * a[0].append((UChar)0x61);
+ * if(some condition) { return; }  // no need to explicitly delete the array
+ * a.adoptInstead(new UnicodeString[4]);
+ * a[3].append((UChar)0x62).append((UChar)0x63).reverse();
+ * // no need to explicitly delete the array
+ * \endcode
+ *
+ * @see LocalPointerBase
+ * @stable ICU 4.4
+ */
+template<typename T>
+class LocalArray : public LocalPointerBase<T> {
+public:
+    /**
+     * Constructor takes ownership.
+     * @param p simple pointer to an array of T objects that is adopted
+     * @stable ICU 4.4
+     */
+    explicit LocalArray(T *p=NULL) : LocalPointerBase<T>(p) {}
+    /**
+     * Destructor deletes the array it owns.
+     * @stable ICU 4.4
+     */
+    ~LocalArray() {
+        delete[] LocalPointerBase<T>::ptr;
+    }
+    /**
+     * Deletes the array it owns,
+     * and adopts (takes ownership of) the one passed in.
+     * @param p simple pointer to an array of T objects that is adopted
+     * @stable ICU 4.4
+     */
+    void adoptInstead(T *p) {
+        delete[] LocalPointerBase<T>::ptr;
+        LocalPointerBase<T>::ptr=p;
+    }
+    /**
+     * Array item access (writable).
+     * No index bounds check.
+     * @param i array index
+     * @return reference to the array item
+     * @stable ICU 4.4
+     */
+    T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; }
+};
+
+/**
+ * \def U_DEFINE_LOCAL_OPEN_POINTER
+ * "Smart pointer" definition macro, deletes objects via the closeFunction.
+ * Defines a subclass of LocalPointerBase which works just
+ * like LocalPointer<Type> except that this subclass will use the closeFunction
+ * rather than the C++ delete operator.
+ *
+ * Requirement: The closeFunction must tolerate a NULL pointer.
+ * (We could add a NULL check here but it is normally redundant.)
+ *
+ * Usage example:
+ * \code
+ * LocalUCaseMapPointer csm(ucasemap_open(localeID, options, &errorCode));
+ * utf8OutLength=ucasemap_utf8ToLower(csm.getAlias(),
+ *     utf8Out, (int32_t)sizeof(utf8Out),
+ *     utf8In, utf8InLength, &errorCode);
+ * if(U_FAILURE(errorCode)) { return; }  // no need to explicitly delete the UCaseMap
+ * \endcode
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 4.4
+ */
+#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \
+    class LocalPointerClassName : public LocalPointerBase<Type> { \
+    public: \
+        explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase<Type>(p) {} \
+        ~LocalPointerClassName() { closeFunction(ptr); } \
+        void adoptInstead(Type *p) { \
+            closeFunction(ptr); \
+            ptr=p; \
+        } \
+    }
+
+U_NAMESPACE_END
+
+#endif  /* U_SHOW_CPLUSPLUS_API */
+#endif  /* __LOCALPOINTER_H__ */
diff --git a/Source/WTF/icu/unicode/parseerr.h b/Source/WTF/icu/unicode/parseerr.h
new file mode 100644
index 0000000..44ff008
--- /dev/null
+++ b/Source/WTF/icu/unicode/parseerr.h
@@ -0,0 +1,92 @@
+/*
+**********************************************************************
+*   Copyright (C) 1999-2005, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+**********************************************************************
+*   Date        Name        Description
+*   03/14/00    aliu        Creation.
+*   06/27/00    aliu        Change from C++ class to C struct
+**********************************************************************
+*/
+#ifndef PARSEERR_H
+#define PARSEERR_H
+
+#include "unicode/utypes.h"
+
+
+/**
+ * \file
+ * \brief C API: Parse Error Information
+ */
+/**
+ * The capacity of the context strings in UParseError.
+ * @stable ICU 2.0
+ */ 
+enum { U_PARSE_CONTEXT_LEN = 16 };
+
+/**
+ * A UParseError struct is used to returned detailed information about
+ * parsing errors.  It is used by ICU parsing engines that parse long
+ * rules, patterns, or programs, where the text being parsed is long
+ * enough that more information than a UErrorCode is needed to
+ * localize the error.
+ *
+ * <p>The line, offset, and context fields are optional; parsing
+ * engines may choose not to use to use them.
+ *
+ * <p>The preContext and postContext strings include some part of the
+ * context surrounding the error.  If the source text is "let for=7"
+ * and "for" is the error (e.g., because it is a reserved word), then
+ * some examples of what a parser might produce are the following:
+ *
+ * <pre>
+ * preContext   postContext
+ * ""           ""            The parser does not support context
+ * "let "       "=7"          Pre- and post-context only
+ * "let "       "for=7"       Pre- and post-context and error text
+ * ""           "for"         Error text only
+ * </pre>
+ *
+ * <p>Examples of engines which use UParseError (or may use it in the
+ * future) are Transliterator, RuleBasedBreakIterator, and
+ * RegexPattern.
+ * 
+ * @stable ICU 2.0
+ */
+typedef struct UParseError {
+
+    /**
+     * The line on which the error occured.  If the parser uses this
+     * field, it sets it to the line number of the source text line on
+     * which the error appears, which will be be a value >= 1.  If the
+     * parse does not support line numbers, the value will be <= 0.
+     * @stable ICU 2.0
+     */
+    int32_t        line;
+
+    /**
+     * The character offset to the error.  If the line field is >= 1,
+     * then this is the offset from the start of the line.  Otherwise,
+     * this is the offset from the start of the text.  If the parser
+     * does not support this field, it will have a value < 0.
+     * @stable ICU 2.0
+     */
+    int32_t        offset;
+
+    /**
+     * Textual context before the error.  Null-terminated.  The empty
+     * string if not supported by parser.
+     * @stable ICU 2.0   
+     */
+    UChar          preContext[U_PARSE_CONTEXT_LEN];
+
+    /**
+     * The error itself and/or textual context after the error.
+     * Null-terminated.  The empty string if not supported by parser.
+     * @stable ICU 2.0   
+     */
+    UChar          postContext[U_PARSE_CONTEXT_LEN];
+
+} UParseError;
+
+#endif
diff --git a/Source/WTF/icu/unicode/platform.h b/Source/WTF/icu/unicode/platform.h
new file mode 100644
index 0000000..3de40d2
--- /dev/null
+++ b/Source/WTF/icu/unicode/platform.h
@@ -0,0 +1,401 @@
+/*
+******************************************************************************
+*
+*   Copyright (C) 1997-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+******************************************************************************
+*
+* Note: autoconf creates platform.h from platform.h.in at configure time.
+*
+******************************************************************************
+*
+*  FILE NAME : platform.h
+*
+*   Date        Name        Description
+*   05/13/98    nos         Creation (content moved here from ptypes.h).
+*   03/02/99    stephen     Added AS400 support.
+*   03/30/99    stephen     Added Linux support.
+*   04/13/99    stephen     Reworked for autoconf.
+******************************************************************************
+*/
+
+#ifndef _PLATFORM_H
+#define _PLATFORM_H
+
+/**
+ * \file 
+ * \brief Basic types for the platform 
+ */
+
+/* This file should be included before uvernum.h. */
+#if defined(UVERNUM_H)
+# error Do not include unicode/uvernum.h before #including unicode/platform.h.  Instead of unicode/uvernum.h, #include unicode/uversion.h
+#endif
+
+/**
+ * Determine wheter to enable auto cleanup of libraries. 
+ * @internal
+ */
+#ifndef UCLN_NO_AUTO_CLEANUP
+#define UCLN_NO_AUTO_CLEANUP 1
+#endif
+
+/* Need platform.h when using CYGWINMSVC to get definitions above. Ignore everything else. */
+#ifndef CYGWINMSVC
+
+/** Define the platform we're on. */
+#ifndef U_DARWIN
+#define U_DARWIN
+#endif
+
+/**
+ * \def U_HAVE_DIRENT_H
+ * Define whether dirent.h is available 
+ * @internal
+ */
+#ifndef U_HAVE_DIRENT_H
+#define U_HAVE_DIRENT_H 1
+#endif
+
+/** Define whether inttypes.h is available */
+#ifndef U_HAVE_INTTYPES_H
+#define U_HAVE_INTTYPES_H 1
+#endif
+
+/**
+ * Define what support for C++ streams is available.
+ *     If U_IOSTREAM_SOURCE is set to 199711, then &lt;iostream&gt; is available
+ * (1997711 is the date the ISO/IEC C++ FDIS was published), and then
+ * one should qualify streams using the std namespace in ICU header
+ * files.
+ *     If U_IOSTREAM_SOURCE is set to 198506, then &lt;iostream.h&gt; is
+ * available instead (198506 is the date when Stroustrup published
+ * "An Extensible I/O Facility for C++" at the summer USENIX conference).
+ *     If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and
+ * support for them will be silently suppressed in ICU.
+ *
+ */
+
+#ifndef U_IOSTREAM_SOURCE
+#define U_IOSTREAM_SOURCE 199711
+#endif
+
+/**
+ * \def U_HAVE_STD_STRING
+ * Define whether the standard C++ (STL) &lt;string&gt; header is available.
+ * For platforms that do not use platform.h and do not define this constant
+ * in their platform-specific headers, std_string.h defaults
+ * U_HAVE_STD_STRING to 1.
+ * @internal
+ */
+#ifndef U_HAVE_STD_STRING
+#define U_HAVE_STD_STRING 1
+#endif
+
+/** @{ Determines whether specific types are available */
+#ifndef U_HAVE_INT8_T
+#define U_HAVE_INT8_T 1
+#endif
+
+#ifndef U_HAVE_UINT8_T
+#define U_HAVE_UINT8_T 0
+#endif
+
+#ifndef U_HAVE_INT16_T
+#define U_HAVE_INT16_T 1
+#endif
+
+#ifndef U_HAVE_UINT16_T
+#define U_HAVE_UINT16_T 0
+#endif
+
+#ifndef U_HAVE_INT32_T
+#define U_HAVE_INT32_T 1
+#endif
+
+#ifndef U_HAVE_UINT32_T
+#define U_HAVE_UINT32_T 0
+#endif
+
+#ifndef U_HAVE_INT64_T
+#define U_HAVE_INT64_T 1
+#endif
+
+#ifndef U_HAVE_UINT64_T
+#define U_HAVE_UINT64_T 0
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/** @{ Compiler and environment features                                     */
+/*===========================================================================*/
+
+/* Define whether namespace is supported */
+#ifndef U_HAVE_NAMESPACE
+#define U_HAVE_NAMESPACE 1
+#endif
+
+/* Determines the endianness of the platform
+   It's done this way in case multiple architectures are being built at once.
+   For example, Darwin supports fat binaries, which can be both PPC and x86 based. */
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN)
+#define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
+#else
+#define U_IS_BIG_ENDIAN 1
+#endif
+
+/* 1 or 0 to enable or disable threads.  If undefined, default is: enable threads. */
+#ifndef ICU_USE_THREADS 
+#define ICU_USE_THREADS 1
+#endif
+
+/* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check lock. */
+#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
+#define UMTX_STRONG_MEMORY_MODEL 1
+#endif
+
+#ifndef U_DEBUG
+#define U_DEBUG 0
+#endif
+
+#ifndef U_RELEASE
+#define U_RELEASE 1
+#endif
+
+/* Determine whether to disable renaming or not. This overrides the
+   setting in umachine.h which is for all platforms. */
+#ifndef U_DISABLE_RENAMING
+#define U_DISABLE_RENAMING 1
+#endif
+
+/* Determine whether to override new and delete. */
+#ifndef U_OVERRIDE_CXX_ALLOCATION
+#define U_OVERRIDE_CXX_ALLOCATION 1
+#endif
+/* Determine whether to override placement new and delete for STL. */
+#ifndef U_HAVE_PLACEMENT_NEW
+#define U_HAVE_PLACEMENT_NEW 1
+#endif
+
+/* Determine whether to enable tracing. */
+#ifndef U_ENABLE_TRACING
+#define U_ENABLE_TRACING 1
+#endif
+
+/**
+ * Whether to enable Dynamic loading in ICU
+ * @internal
+ */
+#ifndef U_ENABLE_DYLOAD
+#define U_ENABLE_DYLOAD 1
+#endif
+
+/**
+ * Whether to test Dynamic loading as an OS capabilty
+ * @internal
+ */
+#ifndef U_CHECK_DYLOAD
+#define U_CHECK_DYLOAD 1
+#endif
+
+
+/** Do we allow ICU users to use the draft APIs by default? */
+#ifndef U_DEFAULT_SHOW_DRAFT
+#define U_DEFAULT_SHOW_DRAFT 1
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/** @{ Character data types                                                      */
+/*===========================================================================*/
+
+#if ((defined(OS390) && (!defined(__CHARSET_LIB) || !__CHARSET_LIB))) || defined(OS400)
+#   define U_CHARSET_FAMILY 1
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/** @{ Information about wchar support                                           */
+/*===========================================================================*/
+
+#ifndef U_HAVE_WCHAR_H
+#define U_HAVE_WCHAR_H      1
+#endif
+
+#ifndef U_SIZEOF_WCHAR_T
+#define U_SIZEOF_WCHAR_T    4
+#endif
+
+#ifndef U_HAVE_WCSCPY
+#define U_HAVE_WCSCPY       1
+#endif
+
+/** @} */
+
+/**
+ * @{
+ * \def U_DECLARE_UTF16
+ * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros
+ * instead.
+ * @internal
+ *
+ * \def U_GNUC_UTF16_STRING
+ * @internal
+ */
+#ifndef U_GNUC_UTF16_STRING
+#define U_GNUC_UTF16_STRING 0
+#endif
+#if 1 || defined(U_CHECK_UTF16_STRING)
+#if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
+    || (defined(__HP_aCC) && __HP_aCC >= 035000) \
+    || (defined(__HP_cc) && __HP_cc >= 111106) \
+    || U_GNUC_UTF16_STRING
+#define U_DECLARE_UTF16(string) u ## string
+#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550)
+/* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */
+/* Sun's C compiler has issues with this notation, and it's unreliable. */
+#define U_DECLARE_UTF16(string) U ## string
+#elif U_SIZEOF_WCHAR_T == 2 \
+    && (U_CHARSET_FAMILY == 0 || ((defined(OS390) || defined(OS400)) && defined(__UCS2__)))
+#define U_DECLARE_UTF16(string) L ## string
+#endif
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/** @{ Information about POSIX support                                           */
+/*===========================================================================*/
+
+#ifndef U_HAVE_NL_LANGINFO_CODESET
+#define U_HAVE_NL_LANGINFO_CODESET  1
+#endif
+
+#ifndef U_NL_LANGINFO_CODESET
+#define U_NL_LANGINFO_CODESET       CODESET
+#endif
+
+#if 1
+#define U_TZSET         tzset
+#endif
+#if 0
+#define U_TIMEZONE      timezone
+#endif
+#if 1
+#define U_TZNAME        tzname
+#endif
+
+#define U_HAVE_MMAP     1
+#define U_HAVE_POPEN    1
+
+/** @} */
+
+/*===========================================================================*/
+/** @{ Symbol import-export control                                              */
+/*===========================================================================*/
+
+#if 1
+#define U_EXPORT __attribute__((visibility("default")))
+#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
+   || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) 
+#define U_EXPORT __global
+/*#elif defined(__HP_aCC) || defined(__HP_cc)
+#define U_EXPORT __declspec(dllexport)*/
+#else
+#define U_EXPORT
+#endif
+
+/* U_CALLCONV is releated to U_EXPORT2 */
+#define U_EXPORT2
+
+/* cygwin needs to export/import data */
+#if defined(U_CYGWIN) && !defined(__GNUC__)
+#define U_IMPORT __declspec(dllimport)
+#else
+#define U_IMPORT 
+#endif
+
+/* @} */
+
+/*===========================================================================*/
+/** @{ Code alignment and C function inlining                                    */
+/*===========================================================================*/
+
+#ifndef U_INLINE
+#   ifdef __cplusplus
+#       define U_INLINE inline
+#   else
+#       define U_INLINE __inline__
+#   endif
+#endif
+
+#ifndef U_ALIGN_CODE
+#define U_ALIGN_CODE(n) 
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/** @{ GCC built in functions for atomic memory operations                       */
+/*===========================================================================*/
+
+/**
+ * \def U_HAVE_GCC_ATOMICS
+ * @internal
+ */
+#ifndef U_HAVE_GCC_ATOMICS
+#define U_HAVE_GCC_ATOMICS 1
+#endif
+
+/** @} */
+
+/*===========================================================================*/
+/** @{ Programs used by ICU code                                                 */
+/*===========================================================================*/
+
+/**
+ * \def U_MAKE
+ * What program to execute to run 'make'
+ */
+#ifndef U_MAKE
+#define U_MAKE  "/usr/bin/gnumake"
+#endif
+
+/** @} */
+
+#endif /* CYGWINMSVC */
+
+/*===========================================================================*/
+/* Custom icu entry point renaming                                                  */
+/*===========================================================================*/
+
+/**
+ * Define the library suffix with C syntax.
+ * @internal
+ */
+# define U_LIB_SUFFIX_C_NAME 
+/**
+ * Define the library suffix as a string with C syntax
+ * @internal
+ */
+# define U_LIB_SUFFIX_C_NAME_STRING ""
+/**
+ * 1 if a custom library suffix is set
+ * @internal
+ */
+# define U_HAVE_LIB_SUFFIX 0
+
+#if U_HAVE_LIB_SUFFIX
+# ifndef U_ICU_ENTRY_POINT_RENAME
+/* Renaming pattern:    u_strcpy_41_suffix */
+#  define U_ICU_ENTRY_POINT_RENAME(x)    x ## _ ## 46 ## 
+#  define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt####major##minor##_dat
+
+# endif
+#endif
+
+#endif
diff --git a/Source/WTF/icu/unicode/ptypes.h b/Source/WTF/icu/unicode/ptypes.h
new file mode 100644
index 0000000..1f34d2f
--- /dev/null
+++ b/Source/WTF/icu/unicode/ptypes.h
@@ -0,0 +1,92 @@
+/*
+******************************************************************************
+*
+*   Copyright (C) 1997-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+******************************************************************************
+*
+*  FILE NAME : ptypes.h
+*
+*   Date        Name        Description
+*   05/13/98    nos         Creation (content moved here from ptypes.h).
+*   03/02/99    stephen     Added AS400 support.
+*   03/30/99    stephen     Added Linux support.
+*   04/13/99    stephen     Reworked for autoconf.
+*   09/18/08    srl         Moved basic types back to ptypes.h from platform.h
+******************************************************************************
+*/
+
+#ifndef _PTYPES_H
+#define _PTYPES_H
+
+#include <sys/types.h>
+
+#include "unicode/platform.h"
+
+/*===========================================================================*/
+/* Generic data types                                                        */
+/*===========================================================================*/
+
+/* If your platform does not have the <inttypes.h> header, you may
+   need to edit the typedefs below. */
+#if U_HAVE_INTTYPES_H
+
+/* autoconf 2.13 sometimes can't properly find the data types in <inttypes.h> */
+/* os/390 needs <inttypes.h>, but it doesn't have int8_t, and it sometimes */
+/* doesn't have uint8_t depending on the OS version. */
+/* So we have this work around. */
+#ifdef OS390
+/* The features header is needed to get (u)int64_t sometimes. */
+#include <features.h>
+#if ! U_HAVE_INT8_T
+typedef signed char int8_t;
+#endif
+#if !defined(__uint8_t)
+#define __uint8_t 1
+typedef unsigned char uint8_t;
+#endif
+#endif /* OS390 */
+
+#include <inttypes.h>
+
+#else /* U_HAVE_INTTYPES_H */
+
+#if ! U_HAVE_INT8_T
+typedef signed char int8_t;
+#endif
+
+#if ! U_HAVE_UINT8_T
+typedef unsigned char uint8_t;
+#endif
+
+#if ! U_HAVE_INT16_T
+typedef signed short int16_t;
+#endif
+
+#if ! U_HAVE_UINT16_T
+typedef unsigned short uint16_t;
+#endif
+
+#if ! U_HAVE_INT32_T
+typedef signed int int32_t;
+#endif
+
+#if ! U_HAVE_UINT32_T
+typedef unsigned int uint32_t;
+#endif
+
+#if ! U_HAVE_INT64_T
+    typedef signed long long int64_t;
+/* else we may not have a 64-bit type */
+#endif
+
+#if ! U_HAVE_UINT64_T
+    typedef unsigned long long uint64_t;
+/* else we may not have a 64-bit type */
+#endif
+
+#endif /* U_HAVE_INTTYPES_H */
+
+#endif /* _PTYPES_H */
+
diff --git a/Source/WTF/icu/unicode/putil.h b/Source/WTF/icu/unicode/putil.h
new file mode 100644
index 0000000..71d5d26
--- /dev/null
+++ b/Source/WTF/icu/unicode/putil.h
@@ -0,0 +1,193 @@
+/*
+******************************************************************************
+*
+*   Copyright (C) 1997-2009, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+******************************************************************************
+*
+*  FILE NAME : putil.h
+*
+*   Date        Name        Description
+*   05/14/98    nos         Creation (content moved here from utypes.h).
+*   06/17/99    erm         Added IEEE_754
+*   07/22/98    stephen     Added IEEEremainder, max, min, trunc
+*   08/13/98    stephen     Added isNegativeInfinity, isPositiveInfinity
+*   08/24/98    stephen     Added longBitsFromDouble
+*   03/02/99    stephen     Removed openFile().  Added AS400 support.
+*   04/15/99    stephen     Converted to C
+*   11/15/99    helena      Integrated S/390 changes for IEEE support.
+*   01/11/00    helena      Added u_getVersion.
+******************************************************************************
+*/
+
+#ifndef PUTIL_H
+#define PUTIL_H
+
+#include "unicode/utypes.h"
+ /**
+  * \file
+  * \brief C API: Platform Utilities
+  */
+
+/** Define this to 1 if your platform supports IEEE 754 floating point,
+   to 0 if it does not. */
+#ifndef IEEE_754
+#   define IEEE_754 1
+#endif
+
+/*==========================================================================*/
+/* Platform utilities                                                       */
+/*==========================================================================*/
+
+/**
+ * Platform utilities isolates the platform dependencies of the
+ * libarary.  For each platform which this code is ported to, these
+ * functions may have to be re-implemented.
+ */
+
+/**
+ * Return the ICU data directory. 
+ * The data directory is where common format ICU data files (.dat files)
+ *   are loaded from.  Note that normal use of the built-in ICU
+ *   facilities does not require loading of an external data file;
+ *   unless you are adding custom data to ICU, the data directory
+ *   does not need to be set.
+ *
+ * The data directory is determined as follows:
+ *    If u_setDataDirectory() has been called, that is it, otherwise
+ *    if the ICU_DATA environment variable is set, use that, otherwise
+ *    If a data directory was specifed at ICU build time
+ *      <code>
+ * \code
+ *        #define ICU_DATA_DIR "path" 
+ * \endcode
+ * </code> use that,
+ *    otherwise no data directory is available.
+ *
+ * @return the data directory, or an empty string ("") if no data directory has
+ *         been specified.
+ *   
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2 u_getDataDirectory(void);
+
+/** 
+ * Set the ICU data directory. 
+ * The data directory is where common format ICU data files (.dat files)
+ *   are loaded from.  Note that normal use of the built-in ICU
+ *   facilities does not require loading of an external data file;
+ *   unless you are adding custom data to ICU, the data directory
+ *   does not need to be set.
+ *
+ * This function should be called at most once in a process, before the
+ * first ICU operation (e.g., u_init()) that will require the loading of an
+ * ICU data file.
+ * This function is not thread-safe. Use it before calling ICU APIs from
+ * multiple threads.
+ *
+ * @param directory The directory to be set.
+ *
+ * @see u_init
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);
+
+#if !U_CHARSET_IS_UTF8
+/**
+ * Please use ucnv_getDefaultName() instead.
+ * Return the default codepage for this platform and locale.
+ * This function can call setlocale() on Unix platforms. Please read the
+ * platform documentation on setlocale() before calling this function.
+ * @return the default codepage for this platform 
+ * @internal
+ */
+U_INTERNAL const char*  U_EXPORT2 uprv_getDefaultCodepage(void);
+#endif
+
+/**
+ * Please use uloc_getDefault() instead.
+ * Return the default locale ID string by querying ths system, or
+ *     zero if one cannot be found. 
+ * This function can call setlocale() on Unix platforms. Please read the
+ * platform documentation on setlocale() before calling this function.
+ * @return the default locale ID string
+ * @internal
+ */
+U_INTERNAL const char*  U_EXPORT2 uprv_getDefaultLocaleID(void);
+
+/**
+ * @{
+ * Filesystem file and path separator characters.
+ * Example: '/' and ':' on Unix, '\\' and ';' on Windows.
+ * @stable ICU 2.0
+ */
+#ifdef XP_MAC
+#   define U_FILE_SEP_CHAR ':'
+#   define U_FILE_ALT_SEP_CHAR ':'
+#   define U_PATH_SEP_CHAR ';'
+#   define U_FILE_SEP_STRING ":"
+#   define U_FILE_ALT_SEP_STRING ":"
+#   define U_PATH_SEP_STRING ";"
+#elif defined(WIN32) || defined(OS2)
+#   define U_FILE_SEP_CHAR '\\'
+#   define U_FILE_ALT_SEP_CHAR '/'
+#   define U_PATH_SEP_CHAR ';'
+#   define U_FILE_SEP_STRING "\\"
+#   define U_FILE_ALT_SEP_STRING "/"
+#   define U_PATH_SEP_STRING ";"
+#else
+#   define U_FILE_SEP_CHAR '/'
+#   define U_FILE_ALT_SEP_CHAR '/'
+#   define U_PATH_SEP_CHAR ':'
+#   define U_FILE_SEP_STRING "/"
+#   define U_FILE_ALT_SEP_STRING "/"
+#   define U_PATH_SEP_STRING ":"
+#endif
+
+/** @} */
+
+/**
+ * Convert char characters to UChar characters.
+ * This utility function is useful only for "invariant characters"
+ * that are encoded in the platform default encoding.
+ * They are a small, constant subset of the encoding and include
+ * just the latin letters, digits, and some punctuation.
+ * For details, see U_CHARSET_FAMILY.
+ *
+ * @param cs Input string, points to <code>length</code>
+ *           character bytes from a subset of the platform encoding.
+ * @param us Output string, points to memory for <code>length</code>
+ *           Unicode characters.
+ * @param length The number of characters to convert; this may
+ *               include the terminating <code>NUL</code>.
+ *
+ * @see U_CHARSET_FAMILY
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_charsToUChars(const char *cs, UChar *us, int32_t length);
+
+/**
+ * Convert UChar characters to char characters.
+ * This utility function is useful only for "invariant characters"
+ * that can be encoded in the platform default encoding.
+ * They are a small, constant subset of the encoding and include
+ * just the latin letters, digits, and some punctuation.
+ * For details, see U_CHARSET_FAMILY.
+ *
+ * @param us Input string, points to <code>length</code>
+ *           Unicode characters that can be encoded with the
+ *           codepage-invariant subset of the platform encoding.
+ * @param cs Output string, points to memory for <code>length</code>
+ *           character bytes.
+ * @param length The number of characters to convert; this may
+ *               include the terminating <code>NUL</code>.
+ *
+ * @see U_CHARSET_FAMILY
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_UCharsToChars(const UChar *us, char *cs, int32_t length);
+
+#endif
diff --git a/Source/WTF/icu/unicode/rep.h b/Source/WTF/icu/unicode/rep.h
new file mode 100644
index 0000000..3fab6fa
--- /dev/null
+++ b/Source/WTF/icu/unicode/rep.h
@@ -0,0 +1,259 @@
+/*
+**************************************************************************
+* Copyright (C) 1999-2005, International Business Machines Corporation and
+* others. All Rights Reserved.
+**************************************************************************
+*   Date        Name        Description
+*   11/17/99    aliu        Creation.  Ported from java.  Modified to
+*                           match current UnicodeString API.  Forced
+*                           to use name "handleReplaceBetween" because
+*                           of existing methods in UnicodeString.
+**************************************************************************
+*/
+
+#ifndef REP_H
+#define REP_H
+
+#include "unicode/uobject.h"
+
+/**
+ * \file 
+ * \brief C++ API: Replaceable String
+ */
+ 
+U_NAMESPACE_BEGIN
+
+class UnicodeString;
+
+/**
+ * <code>Replaceable</code> is an abstract base class representing a
+ * string of characters that supports the replacement of a range of
+ * itself with a new string of characters.  It is used by APIs that
+ * change a piece of text while retaining metadata.  Metadata is data
+ * other than the Unicode characters returned by char32At().  One
+ * example of metadata is style attributes; another is an edit
+ * history, marking each character with an author and revision number.
+ *
+ * <p>An implicit aspect of the <code>Replaceable</code> API is that
+ * during a replace operation, new characters take on the metadata of
+ * the old characters.  For example, if the string "the <b>bold</b>
+ * font" has range (4, 8) replaced with "strong", then it becomes "the
+ * <b>strong</b> font".
+ *
+ * <p><code>Replaceable</code> specifies ranges using a start
+ * offset and a limit offset.  The range of characters thus specified
+ * includes the characters at offset start..limit-1.  That is, the
+ * start offset is inclusive, and the limit offset is exclusive.
+ *
+ * <p><code>Replaceable</code> also includes API to access characters
+ * in the string: <code>length()</code>, <code>charAt()</code>,
+ * <code>char32At()</code>, and <code>extractBetween()</code>.
+ *
+ * <p>For a subclass to support metadata, typical behavior of
+ * <code>replace()</code> is the following:
+ * <ul>
+ *   <li>Set the metadata of the new text to the metadata of the first
+ *   character replaced</li>
+ *   <li>If no characters are replaced, use the metadata of the
+ *   previous character</li>
+ *   <li>If there is no previous character (i.e. start == 0), use the
+ *   following character</li>
+ *   <li>If there is no following character (i.e. the replaceable was
+ *   empty), use default metadata.<br>
+ *   <li>If the code point U+FFFF is seen, it should be interpreted as
+ *   a special marker having no metadata<li>
+ *   </li>
+ * </ul>
+ * If this is not the behavior, the subclass should document any differences.
+ * @author Alan Liu
+ * @stable ICU 2.0
+ */
+class U_COMMON_API Replaceable : public UObject {
+
+public:
+    /**
+     * Destructor.
+     * @stable ICU 2.0
+     */
+    virtual ~Replaceable();
+
+    /**
+     * Returns the number of 16-bit code units in the text.
+     * @return number of 16-bit code units in text
+     * @stable ICU 1.8
+     */ 
+    inline int32_t length() const;
+
+    /**
+     * Returns the 16-bit code unit at the given offset into the text.
+     * @param offset an integer between 0 and <code>length()</code>-1
+     * inclusive
+     * @return 16-bit code unit of text at given offset
+     * @stable ICU 1.8
+     */
+    inline UChar charAt(int32_t offset) const;
+
+    /**
+     * Returns the 32-bit code point at the given 16-bit offset into
+     * the text.  This assumes the text is stored as 16-bit code units
+     * with surrogate pairs intermixed.  If the offset of a leading or
+     * trailing code unit of a surrogate pair is given, return the
+     * code point of the surrogate pair.
+     *
+     * @param offset an integer between 0 and <code>length()</code>-1
+     * inclusive
+     * @return 32-bit code point of text at given offset
+     * @stable ICU 1.8
+     */
+    inline UChar32 char32At(int32_t offset) const;
+
+    /**
+     * Copies characters in the range [<tt>start</tt>, <tt>limit</tt>) 
+     * into the UnicodeString <tt>target</tt>.
+     * @param start offset of first character which will be copied
+     * @param limit offset immediately following the last character to
+     * be copied
+     * @param target UnicodeString into which to copy characters.
+     * @return A reference to <TT>target</TT>
+     * @stable ICU 2.1
+     */
+    virtual void extractBetween(int32_t start,
+                                int32_t limit,
+                                UnicodeString& target) const = 0;
+
+    /**
+     * Replaces a substring of this object with the given text.  If the
+     * characters being replaced have metadata, the new characters
+     * that replace them should be given the same metadata.
+     *
+     * <p>Subclasses must ensure that if the text between start and
+     * limit is equal to the replacement text, that replace has no
+     * effect. That is, any metadata
+     * should be unaffected. In addition, subclasses are encouraged to
+     * check for initial and trailing identical characters, and make a
+     * smaller replacement if possible. This will preserve as much
+     * metadata as possible.
+     * @param start the beginning index, inclusive; <code>0 <= start
+     * <= limit</code>.
+     * @param limit the ending index, exclusive; <code>start <= limit
+     * <= length()</code>.
+     * @param text the text to replace characters <code>start</code>
+     * to <code>limit - 1</code> 
+     * @stable ICU 2.0
+     */
+    virtual void handleReplaceBetween(int32_t start,
+                                      int32_t limit,
+                                      const UnicodeString& text) = 0;
+    // Note: All other methods in this class take the names of
+    // existing UnicodeString methods.  This method is the exception.
+    // It is named differently because all replace methods of
+    // UnicodeString return a UnicodeString&.  The 'between' is
+    // required in order to conform to the UnicodeString naming
+    // convention; API taking start/length are named <operation>, and
+    // those taking start/limit are named <operationBetween>.  The
+    // 'handle' is added because 'replaceBetween' and
+    // 'doReplaceBetween' are already taken.
+
+    /**
+     * Copies a substring of this object, retaining metadata.
+     * This method is used to duplicate or reorder substrings.
+     * The destination index must not overlap the source range.
+     * 
+     * @param start the beginning index, inclusive; <code>0 <= start <=
+     * limit</code>.
+     * @param limit the ending index, exclusive; <code>start <= limit <=
+     * length()</code>.
+     * @param dest the destination index.  The characters from
+     * <code>start..limit-1</code> will be copied to <code>dest</code>.
+     * Implementations of this method may assume that <code>dest <= start ||
+     * dest >= limit</code>.
+     * @stable ICU 2.0
+     */
+    virtual void copy(int32_t start, int32_t limit, int32_t dest) = 0;
+
+    /**
+     * Returns true if this object contains metadata.  If a
+     * Replaceable object has metadata, calls to the Replaceable API
+     * must be made so as to preserve metadata.  If it does not, calls
+     * to the Replaceable API may be optimized to improve performance.
+     * The default implementation returns true.
+     * @return true if this object contains metadata
+     * @stable ICU 2.2
+     */
+    virtual UBool hasMetaData() const;
+
+    /**
+     * Clone this object, an instance of a subclass of Replaceable.
+     * Clones can be used concurrently in multiple threads.
+     * If a subclass does not implement clone(), or if an error occurs,
+     * then NULL is returned.
+     * The clone functions in all subclasses return a pointer to a Replaceable
+     * because some compilers do not support covariant (same-as-this)
+     * return types; cast to the appropriate subclass if necessary.
+     * The caller must delete the clone.
+     *
+     * @return a clone of this object
+     *
+     * @see getDynamicClassID
+     * @stable ICU 2.6
+     */
+    virtual Replaceable *clone() const;
+
+protected:
+
+    /**
+     * Default constructor.
+     * @stable ICU 2.4
+     */
+    Replaceable();
+
+    /*
+     * Assignment operator not declared. The compiler will provide one
+     * which does nothing since this class does not contain any data members.
+     * API/code coverage may show the assignment operator as present and
+     * untested - ignore.
+     * Subclasses need this assignment operator if they use compiler-provided
+     * assignment operators of their own. An alternative to not declaring one
+     * here would be to declare and empty-implement a protected or public one.
+    Replaceable &Replaceable::operator=(const Replaceable &);
+     */
+
+    /**
+     * Virtual version of length().
+     * @stable ICU 2.4
+     */ 
+    virtual int32_t getLength() const = 0;
+
+    /**
+     * Virtual version of charAt().
+     * @stable ICU 2.4
+     */
+    virtual UChar getCharAt(int32_t offset) const = 0;
+
+    /**
+     * Virtual version of char32At().
+     * @stable ICU 2.4
+     */
+    virtual UChar32 getChar32At(int32_t offset) const = 0;
+};
+
+inline int32_t
+Replaceable::length() const {
+    return getLength();
+}
+
+inline UChar
+Replaceable::charAt(int32_t offset) const {
+    return getCharAt(offset);
+}
+
+inline UChar32
+Replaceable::char32At(int32_t offset) const {
+    return getChar32At(offset);
+}
+
+// There is no rep.cpp, see unistr.cpp for Replaceable function implementations.
+
+U_NAMESPACE_END
+
+#endif
diff --git a/Source/WTF/icu/unicode/std_string.h b/Source/WTF/icu/unicode/std_string.h
new file mode 100644
index 0000000..dd43b74
--- /dev/null
+++ b/Source/WTF/icu/unicode/std_string.h
@@ -0,0 +1,78 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2009-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  std_string.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 2009feb19
+*   created by: Markus W. Scherer
+*/
+
+#ifndef __STD_STRING_H__
+#define __STD_STRING_H__
+
+/**
+ * \file 
+ * \brief C++ API: Central ICU header for including the C++ standard &lt;string&gt;
+ *                 header and for related definitions.
+ */
+
+#include "unicode/utypes.h"
+
+/**
+ * \def U_HAVE_STD_STRING
+ * Define whether the standard C++ (STL) &lt;string&gt; header is available.
+ * @internal
+ */
+#ifndef U_HAVE_STD_STRING
+#define U_HAVE_STD_STRING 1
+#endif
+
+#if U_HAVE_STD_STRING
+
+#include <string>
+
+/**
+ * \def U_STD_NS
+ * Define the namespace to use for standard C++ (STL) classes.
+ * Either std or empty.
+ * @draft ICU 4.2
+ */
+
+/**
+ * \def U_STD_NSQ
+ * Define the namespace qualifier to use for standard C++ (STL) classes.
+ * Either std:: or empty.
+ * For example,
+ *   U_STD_NSQ string StringFromUnicodeString(const UnicodeString &unistr);
+ * @draft ICU 4.2
+ */
+
+/**
+ * \def U_STD_NS_USE
+ * This is used to specify that the rest of the code uses the
+ * standard (STL) namespace.
+ * Either "using namespace std;" or empty.
+ * @draft ICU 4.2
+ */
+#ifndef U_STD_NSQ
+#   if U_HAVE_NAMESPACE
+#       define U_STD_NS std
+#       define U_STD_NSQ U_STD_NS::
+#       define U_STD_NS_USE using namespace U_STD_NS;
+#   else
+#       define U_STD_NS
+#       define U_STD_NSQ
+#       define U_STD_NS_USE
+#   endif
+#endif
+
+#endif  // U_HAVE_STD_STRING
+
+#endif  // __STD_STRING_H__
diff --git a/Source/WTF/icu/unicode/strenum.h b/Source/WTF/icu/unicode/strenum.h
new file mode 100644
index 0000000..ce42195
--- /dev/null
+++ b/Source/WTF/icu/unicode/strenum.h
@@ -0,0 +1,271 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2002-2007, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*/
+
+#ifndef STRENUM_H
+#define STRENUM_H
+
+#include "unicode/uobject.h"
+#include "unicode/unistr.h"
+
+/**
+ * \file 
+ * \brief C++ API: String Enumeration
+ */
+ 
+U_NAMESPACE_BEGIN
+
+/**
+ * Base class for 'pure' C++ implementations of uenum api.  Adds a
+ * method that returns the next UnicodeString since in C++ this can
+ * be a common storage format for strings.
+ *
+ * <p>The model is that the enumeration is over strings maintained by
+ * a 'service.'  At any point, the service might change, invalidating
+ * the enumerator (though this is expected to be rare).  The iterator
+ * returns an error if this has occurred.  Lack of the error is no
+ * guarantee that the service didn't change immediately after the
+ * call, so the returned string still might not be 'valid' on
+ * subsequent use.</p>
+ *
+ * <p>Strings may take the form of const char*, const UChar*, or const
+ * UnicodeString*.  The type you get is determine by the variant of
+ * 'next' that you call.  In general the StringEnumeration is
+ * optimized for one of these types, but all StringEnumerations can
+ * return all types.  Returned strings are each terminated with a NUL.
+ * Depending on the service data, they might also include embedded NUL
+ * characters, so API is provided to optionally return the true
+ * length, counting the embedded NULs but not counting the terminating
+ * NUL.</p>
+ *
+ * <p>The pointers returned by next, unext, and snext become invalid
+ * upon any subsequent call to the enumeration's destructor, next,
+ * unext, snext, or reset.</p>
+ *
+ * ICU 2.8 adds some default implementations and helper functions
+ * for subclasses.
+ *
+ * @stable ICU 2.4 
+ */
+class U_COMMON_API StringEnumeration : public UObject { 
+public:
+    /**
+     * Destructor.
+     * @stable ICU 2.4
+     */
+    virtual ~StringEnumeration();
+
+    /**
+     * Clone this object, an instance of a subclass of StringEnumeration.
+     * Clones can be used concurrently in multiple threads.
+     * If a subclass does not implement clone(), or if an error occurs,
+     * then NULL is returned.
+     * The clone functions in all subclasses return a base class pointer
+     * because some compilers do not support covariant (same-as-this)
+     * return types; cast to the appropriate subclass if necessary.
+     * The caller must delete the clone.
+     *
+     * @return a clone of this object
+     *
+     * @see getDynamicClassID
+     * @stable ICU 2.8
+     */
+    virtual StringEnumeration *clone() const;
+
+    /**
+     * <p>Return the number of elements that the iterator traverses.  If
+     * the iterator is out of sync with its service, status is set to
+     * U_ENUM_OUT_OF_SYNC_ERROR, and the return value is zero.</p>
+     *
+     * <p>The return value will not change except possibly as a result of
+     * a subsequent call to reset, or if the iterator becomes out of sync.</p>
+     *
+     * <p>This is a convenience function. It can end up being very
+     * expensive as all the items might have to be pre-fetched
+     * (depending on the storage format of the data being
+     * traversed).</p>
+     *
+     * @param status the error code.
+     * @return number of elements in the iterator.
+     *
+     * @stable ICU 2.4 */
+    virtual int32_t count(UErrorCode& status) const = 0;
+
+    /**
+     * <p>Returns the next element as a NUL-terminated char*.  If there
+     * are no more elements, returns NULL.  If the resultLength pointer
+     * is not NULL, the length of the string (not counting the
+     * terminating NUL) is returned at that address.  If an error
+     * status is returned, the value at resultLength is undefined.</p>
+     *
+     * <p>The returned pointer is owned by this iterator and must not be
+     * deleted by the caller.  The pointer is valid until the next call
+     * to next, unext, snext, reset, or the enumerator's destructor.</p>
+     *
+     * <p>If the iterator is out of sync with its service, status is set
+     * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p>
+     *
+     * <p>If the native service string is a UChar* string, it is
+     * converted to char* with the invariant converter.  If the
+     * conversion fails (because a character cannot be converted) then
+     * status is set to U_INVARIANT_CONVERSION_ERROR and the return
+     * value is undefined (though not NULL).</p>
+     *
+     * Starting with ICU 2.8, the default implementation calls snext()
+     * and handles the conversion.
+     *
+     * @param status the error code.
+     * @param resultLength a pointer to receive the length, can be NULL.
+     * @return a pointer to the string, or NULL.
+     *
+     * @stable ICU 2.4 
+     */
+    virtual const char* next(int32_t *resultLength, UErrorCode& status);
+
+    /**
+     * <p>Returns the next element as a NUL-terminated UChar*.  If there
+     * are no more elements, returns NULL.  If the resultLength pointer
+     * is not NULL, the length of the string (not counting the
+     * terminating NUL) is returned at that address.  If an error
+     * status is returned, the value at resultLength is undefined.</p>
+     *
+     * <p>The returned pointer is owned by this iterator and must not be
+     * deleted by the caller.  The pointer is valid until the next call
+     * to next, unext, snext, reset, or the enumerator's destructor.</p>
+     *
+     * <p>If the iterator is out of sync with its service, status is set
+     * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p>
+     *
+     * Starting with ICU 2.8, the default implementation calls snext()
+     * and handles the conversion.
+     *
+     * @param status the error code.
+     * @param resultLength a ponter to receive the length, can be NULL.
+     * @return a pointer to the string, or NULL.
+     *
+     * @stable ICU 2.4 
+     */
+    virtual const UChar* unext(int32_t *resultLength, UErrorCode& status);
+
+    /**
+     * <p>Returns the next element a UnicodeString*.  If there are no
+     * more elements, returns NULL.</p>
+     *
+     * <p>The returned pointer is owned by this iterator and must not be
+     * deleted by the caller.  The pointer is valid until the next call
+     * to next, unext, snext, reset, or the enumerator's destructor.</p>
+     *
+     * <p>If the iterator is out of sync with its service, status is set
+     * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p>
+     *
+     * @param status the error code.
+     * @return a pointer to the string, or NULL.
+     *
+     * @stable ICU 2.4 
+     */
+    virtual const UnicodeString* snext(UErrorCode& status) = 0;
+
+    /**
+     * <p>Resets the iterator.  This re-establishes sync with the
+     * service and rewinds the iterator to start at the first
+     * element.</p>
+     *
+     * <p>Previous pointers returned by next, unext, or snext become
+     * invalid, and the value returned by count might change.</p>
+     *
+     * @param status the error code.
+     *
+     * @stable ICU 2.4 
+     */
+    virtual void reset(UErrorCode& status) = 0;
+
+    /**
+     * Compares this enumeration to other to check if both are equal
+     *
+     * @param that The other string enumeration to compare this object to
+     * @return TRUE if the enumerations are equal. FALSE if not.
+     * @stable ICU 3.6 
+     */
+    virtual UBool operator==(const StringEnumeration& that)const;
+    /**
+     * Compares this enumeration to other to check if both are not equal
+     *
+     * @param that The other string enumeration to compare this object to
+     * @return TRUE if the enumerations are equal. FALSE if not.
+     * @stable ICU 3.6 
+     */
+    virtual UBool operator!=(const StringEnumeration& that)const;
+
+protected:
+    /**
+     * UnicodeString field for use with default implementations and subclasses.
+     * @stable ICU 2.8
+     */
+    UnicodeString unistr;
+    /**
+     * char * default buffer for use with default implementations and subclasses.
+     * @stable ICU 2.8
+     */
+    char charsBuffer[32];
+    /**
+     * char * buffer for use with default implementations and subclasses.
+     * Allocated in constructor and in ensureCharsCapacity().
+     * @stable ICU 2.8
+     */
+    char *chars;
+    /**
+     * Capacity of chars, for use with default implementations and subclasses.
+     * @stable ICU 2.8
+     */
+    int32_t charsCapacity;
+
+    /**
+     * Default constructor for use with default implementations and subclasses.
+     * @stable ICU 2.8
+     */
+    StringEnumeration();
+
+    /**
+     * Ensures that chars is at least as large as the requested capacity.
+     * For use with default implementations and subclasses.
+     *
+     * @param capacity Requested capacity.
+     * @param status ICU in/out error code.
+     * @stable ICU 2.8
+     */
+    void ensureCharsCapacity(int32_t capacity, UErrorCode &status);
+
+    /**
+     * Converts s to Unicode and sets unistr to the result.
+     * For use with default implementations and subclasses,
+     * especially for implementations of snext() in terms of next().
+     * This is provided with a helper function instead of a default implementation
+     * of snext() to avoid potential infinite loops between next() and snext().
+     *
+     * For example:
+     * \code
+     * const UnicodeString* snext(UErrorCode& status) {
+     *   int32_t resultLength=0;
+     *   const char *s=next(&resultLength, status);
+     *   return setChars(s, resultLength, status);
+     * }
+     * \endcode
+     *
+     * @param s String to be converted to Unicode.
+     * @param length Length of the string.
+     * @param status ICU in/out error code.
+     * @return A pointer to unistr.
+     * @stable ICU 2.8
+     */
+    UnicodeString *setChars(const char *s, int32_t length, UErrorCode &status);
+};
+
+U_NAMESPACE_END
+
+/* STRENUM_H */
+#endif
diff --git a/Source/WTF/icu/unicode/stringpiece.h b/Source/WTF/icu/unicode/stringpiece.h
new file mode 100644
index 0000000..79d5a05
--- /dev/null
+++ b/Source/WTF/icu/unicode/stringpiece.h
@@ -0,0 +1,224 @@
+// Copyright (C) 2010, International Business Machines
+// Corporation and others. All Rights Reserved.
+//
+// Copyright 2001 and onwards Google Inc.
+// Author: Sanjay Ghemawat
+
+// This code is a contribution of Google code, and the style used here is
+// a compromise between the original Google code and the ICU coding guidelines.
+// For example, data types are ICU-ified (size_t,int->int32_t),
+// and API comments doxygen-ified, but function names and behavior are
+// as in the original, if possible.
+// Assertion-style error handling, not available in ICU, was changed to
+// parameter "pinning" similar to UnicodeString.
+//
+// In addition, this is only a partial port of the original Google code,
+// limited to what was needed so far. The (nearly) complete original code
+// is in the ICU svn repository at icuhtml/trunk/design/strings/contrib
+// (see ICU ticket 6765, r25517).
+
+#ifndef __STRINGPIECE_H__
+#define __STRINGPIECE_H__
+
+/**
+ * \file 
+ * \brief C++ API: StringPiece: Read-only byte string wrapper class.
+ */
+
+#include "unicode/utypes.h"
+#include "unicode/uobject.h"
+#include "unicode/std_string.h"
+
+// Arghh!  I wish C++ literals were "string".
+
+U_NAMESPACE_BEGIN
+
+/**
+ * A string-like object that points to a sized piece of memory.
+ *
+ * We provide non-explicit singleton constructors so users can pass
+ * in a "const char*" or a "string" wherever a "StringPiece" is
+ * expected.
+ *
+ * Functions or methods may use const StringPiece& parameters to accept either
+ * a "const char*" or a "string" value that will be implicitly converted to
+ * a StringPiece.
+ *
+ * Systematic usage of StringPiece is encouraged as it will reduce unnecessary
+ * conversions from "const char*" to "string" and back again.
+ *
+ * @stable ICU 4.2
+ */
+class U_COMMON_API StringPiece : public UMemory {
+ private:
+  const char*   ptr_;
+  int32_t       length_;
+
+ public:
+  /**
+   * Default constructor, creates an empty StringPiece.
+   * @stable ICU 4.2
+   */
+  StringPiece() : ptr_(NULL), length_(0) { }
+  /**
+   * Constructs from a NUL-terminated const char * pointer.
+   * @param str a NUL-terminated const char * pointer
+   * @stable ICU 4.2
+   */
+  StringPiece(const char* str);
+#if U_HAVE_STD_STRING
+  /**
+   * Constructs from a std::string.
+   * @stable ICU 4.2
+   */
+  StringPiece(const U_STD_NSQ string& str)
+    : ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { }
+#endif
+  /**
+   * Constructs from a const char * pointer and a specified length.
+   * @param offset a const char * pointer (need not be terminated)
+   * @param len the length of the string; must be non-negative
+   * @stable ICU 4.2
+   */
+  StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len) { }
+  /**
+   * Substring of another StringPiece.
+   * @param x the other StringPiece
+   * @param pos start position in x; must be non-negative and <= x.length().
+   * @stable ICU 4.2
+   */
+  StringPiece(const StringPiece& x, int32_t pos);
+  /**
+   * Substring of another StringPiece.
+   * @param x the other StringPiece
+   * @param pos start position in x; must be non-negative and <= x.length().
+   * @param len length of the substring;
+   *            must be non-negative and will be pinned to at most x.length() - pos.
+   * @stable ICU 4.2
+   */
+  StringPiece(const StringPiece& x, int32_t pos, int32_t len);
+
+  /**
+   * Returns the string pointer. May be NULL if it is empty.
+   *
+   * data() may return a pointer to a buffer with embedded NULs, and the
+   * returned buffer may or may not be null terminated.  Therefore it is
+   * typically a mistake to pass data() to a routine that expects a NUL
+   * terminated string.
+   * @return the string pointer
+   * @stable ICU 4.2
+   */
+  const char* data() const { return ptr_; }
+  /**
+   * Returns the string length. Same as length().
+   * @return the string length
+   * @stable ICU 4.2
+   */
+  int32_t size() const { return length_; }
+  /**
+   * Returns the string length. Same as size().
+   * @return the string length
+   * @stable ICU 4.2
+   */
+  int32_t length() const { return length_; }
+  /**
+   * Returns whether the string is empty.
+   * @return TRUE if the string is empty
+   * @stable ICU 4.2
+   */
+  UBool empty() const { return length_ == 0; }
+
+  /**
+   * Sets to an empty string.
+   * @stable ICU 4.2
+   */
+  void clear() { ptr_ = NULL; length_ = 0; }
+
+  /**
+   * Reset the stringpiece to refer to new data.
+   * @param data pointer the new string data.  Need not be nul terminated.
+   * @param len the length of the new data
+   * @internal
+   */
+  void set(const char* data, int32_t len) { ptr_ = data; length_ = len; }
+
+  /**
+   * Reset the stringpiece to refer to new data.
+   * @param str a pointer to a NUL-terminated string. 
+   * @internal
+   */
+  void set(const char* str);
+
+  /**
+   * Removes the first n string units.
+   * @param n prefix length, must be non-negative and <=length()
+   * @stable ICU 4.2
+   */
+  void remove_prefix(int32_t n) {
+    if (n >= 0) {
+      if (n > length_) {
+        n = length_;
+      }
+      ptr_ += n;
+      length_ -= n;
+    }
+  }
+
+  /**
+   * Removes the last n string units.
+   * @param n suffix length, must be non-negative and <=length()
+   * @stable ICU 4.2
+   */
+  void remove_suffix(int32_t n) {
+    if (n >= 0) {
+      if (n <= length_) {
+        length_ -= n;
+      } else {
+        length_ = 0;
+      }
+    }
+  }
+
+  /**
+   * Maximum integer, used as a default value for substring methods.
+   * @stable ICU 4.2
+   */
+  static const int32_t npos = 0x7fffffff;
+
+  /**
+   * Returns a substring of this StringPiece.
+   * @param pos start position; must be non-negative and <= length().
+   * @param len length of the substring;
+   *            must be non-negative and will be pinned to at most length() - pos.
+   * @return the substring StringPiece
+   * @stable ICU 4.2
+   */
+  StringPiece substr(int32_t pos, int32_t len = npos) const {
+    return StringPiece(*this, pos, len);
+  }
+};
+
+/**
+ * Global operator == for StringPiece
+ * @param x The first StringPiece to compare.
+ * @param y The second StringPiece to compare.
+ * @return TRUE if the string data is equal
+ * @internal
+ */
+U_EXPORT UBool U_EXPORT2 
+operator==(const StringPiece& x, const StringPiece& y);
+
+/**
+ * Global operator != for StringPiece
+ * @param x The first StringPiece to compare.
+ * @param y The second StringPiece to compare.
+ * @return TRUE if the string data is not equal
+ * @internal
+ */
+inline UBool operator!=(const StringPiece& x, const StringPiece& y) {
+  return !(x == y);
+}
+
+U_NAMESPACE_END
+
+#endif  // __STRINGPIECE_H__
diff --git a/Source/WTF/icu/unicode/uchar.h b/Source/WTF/icu/unicode/uchar.h
new file mode 100644
index 0000000..93aa663
--- /dev/null
+++ b/Source/WTF/icu/unicode/uchar.h
@@ -0,0 +1,3168 @@
+/*
+**********************************************************************
+*   Copyright (C) 1997-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+**********************************************************************
+*
+* File UCHAR.H
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   04/02/97    aliu        Creation.
+*   03/29/99    helena      Updated for C APIs.
+*   4/15/99     Madhu       Updated for C Implementation and Javadoc
+*   5/20/99     Madhu       Added the function u_getVersion()
+*   8/19/1999   srl         Upgraded scripts to Unicode 3.0
+*   8/27/1999   schererm    UCharDirection constants: U_...
+*   11/11/1999  weiv        added u_isalnum(), cleaned comments
+*   01/11/2000  helena      Renamed u_getVersion to u_getUnicodeVersion().
+******************************************************************************
+*/
+
+#ifndef UCHAR_H
+#define UCHAR_H
+
+#include "unicode/utypes.h"
+
+U_CDECL_BEGIN
+
+/*==========================================================================*/
+/* Unicode version number                                                   */
+/*==========================================================================*/
+/**
+ * Unicode version number, default for the current ICU version.
+ * The actual Unicode Character Database (UCD) data is stored in uprops.dat
+ * and may be generated from UCD files from a different Unicode version.
+ * Call u_getUnicodeVersion to get the actual Unicode version of the data.
+ *
+ * @see u_getUnicodeVersion
+ * @stable ICU 2.0
+ */
+#define U_UNICODE_VERSION "6.0"
+
+/**
+ * \file
+ * \brief C API: Unicode Properties
+ *
+ * This C API provides low-level access to the Unicode Character Database.
+ * In addition to raw property values, some convenience functions calculate
+ * derived properties, for example for Java-style programming.
+ *
+ * Unicode assigns each code point (not just assigned character) values for
+ * many properties.
+ * Most of them are simple boolean flags, or constants from a small enumerated list.
+ * For some properties, values are strings or other relatively more complex types.
+ *
+ * For more information see
+ * "About the Unicode Character Database" (http://www.unicode.org/ucd/)
+ * and the ICU User Guide chapter on Properties (http://icu-project.org/userguide/properties.html).
+ *
+ * Many functions are designed to match java.lang.Character functions.
+ * See the individual function documentation,
+ * and see the JDK 1.4 java.lang.Character documentation
+ * at http://java.sun.com/j2se/1.4/docs/api/java/lang/Character.html
+ *
+ * There are also functions that provide easy migration from C/POSIX functions
+ * like isblank(). Their use is generally discouraged because the C/POSIX
+ * standards do not define their semantics beyond the ASCII range, which means
+ * that different implementations exhibit very different behavior.
+ * Instead, Unicode properties should be used directly.
+ *
+ * There are also only a few, broad C/POSIX character classes, and they tend
+ * to be used for conflicting purposes. For example, the "isalpha()" class
+ * is sometimes used to determine word boundaries, while a more sophisticated
+ * approach would at least distinguish initial letters from continuation
+ * characters (the latter including combining marks).
+ * (In ICU, BreakIterator is the most sophisticated API for word boundaries.)
+ * Another example: There is no "istitle()" class for titlecase characters.
+ *
+ * ICU 3.4 and later provides API access for all twelve C/POSIX character classes.
+ * ICU implements them according to the Standard Recommendations in
+ * Annex C: Compatibility Properties of UTS #18 Unicode Regular Expressions
+ * (http://www.unicode.org/reports/tr18/#Compatibility_Properties).
+ *
+ * API access for C/POSIX character classes is as follows:
+ * - alpha:     u_isUAlphabetic(c) or u_hasBinaryProperty(c, UCHAR_ALPHABETIC)
+ * - lower:     u_isULowercase(c) or u_hasBinaryProperty(c, UCHAR_LOWERCASE)
+ * - upper:     u_isUUppercase(c) or u_hasBinaryProperty(c, UCHAR_UPPERCASE)
+ * - punct:     u_ispunct(c)
+ * - digit:     u_isdigit(c) or u_charType(c)==U_DECIMAL_DIGIT_NUMBER
+ * - xdigit:    u_isxdigit(c) or u_hasBinaryProperty(c, UCHAR_POSIX_XDIGIT)
+ * - alnum:     u_hasBinaryProperty(c, UCHAR_POSIX_ALNUM)
+ * - space:     u_isUWhiteSpace(c) or u_hasBinaryProperty(c, UCHAR_WHITE_SPACE)
+ * - blank:     u_isblank(c) or u_hasBinaryProperty(c, UCHAR_POSIX_BLANK)
+ * - cntrl:     u_charType(c)==U_CONTROL_CHAR
+ * - graph:     u_hasBinaryProperty(c, UCHAR_POSIX_GRAPH)
+ * - print:     u_hasBinaryProperty(c, UCHAR_POSIX_PRINT)
+ *
+ * Note: Some of the u_isxyz() functions in uchar.h predate, and do not match,
+ * the Standard Recommendations in UTS #18. Instead, they match Java
+ * functions according to their API documentation.
+ *
+ * \htmlonly
+ * The C/POSIX character classes are also available in UnicodeSet patterns,
+ * using patterns like [:graph:] or \p{graph}.
+ * \endhtmlonly
+ *
+ * Note: There are several ICU whitespace functions.
+ * Comparison:
+ * - u_isUWhiteSpace=UCHAR_WHITE_SPACE: Unicode White_Space property;
+ *       most of general categories "Z" (separators) + most whitespace ISO controls
+ *       (including no-break spaces, but excluding IS1..IS4 and ZWSP)
+ * - u_isWhitespace: Java isWhitespace; Z + whitespace ISO controls but excluding no-break spaces
+ * - u_isJavaSpaceChar: Java isSpaceChar; just Z (including no-break spaces)
+ * - u_isspace: Z + whitespace ISO controls (including no-break spaces)
+ * - u_isblank: "horizontal spaces" = TAB + Zs - ZWSP
+ */
+
+/**
+ * Constants.
+ */
+
+/** The lowest Unicode code point value. Code points are non-negative. @stable ICU 2.0 */
+#define UCHAR_MIN_VALUE 0
+
+/**
+ * The highest Unicode code point value (scalar value) according to
+ * The Unicode Standard. This is a 21-bit value (20.1 bits, rounded up).
+ * For a single character, UChar32 is a simple type that can hold any code point value.
+ *
+ * @see UChar32
+ * @stable ICU 2.0
+ */
+#define UCHAR_MAX_VALUE 0x10ffff
+
+/**
+ * Get a single-bit bit set (a flag) from a bit number 0..31.
+ * @stable ICU 2.1
+ */
+#define U_MASK(x) ((uint32_t)1<<(x))
+
+/*
+ * !! Note: Several comments in this file are machine-read by the
+ * genpname tool.  These comments describe the correspondence between
+ * icu enum constants and UCD entities.  Do not delete them.  Update
+ * these comments as needed.
+ *
+ * Any comment of the form "/ *[name]* /" (spaces added) is such
+ * a comment.
+ *
+ * The U_JG_* and U_GC_*_MASK constants are matched by their symbolic
+ * name, which must match PropertyValueAliases.txt.
+ */
+
+/**
+ * Selection constants for Unicode properties.
+ * These constants are used in functions like u_hasBinaryProperty to select
+ * one of the Unicode properties.
+ *
+ * The properties APIs are intended to reflect Unicode properties as defined
+ * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR).
+ * For details about the properties see http://www.unicode.org/ucd/ .
+ * For names of Unicode properties see the UCD file PropertyAliases.txt.
+ *
+ * Important: If ICU is built with UCD files from Unicode versions below, e.g., 3.2,
+ * then properties marked with "new in Unicode 3.2" are not or not fully available.
+ * Check u_getUnicodeVersion to be sure.
+ *
+ * @see u_hasBinaryProperty
+ * @see u_getIntPropertyValue
+ * @see u_getUnicodeVersion
+ * @stable ICU 2.1
+ */
+typedef enum UProperty {
+    /*  See note !!.  Comments of the form "Binary property Dash",
+        "Enumerated property Script", "Double property Numeric_Value",
+        and "String property Age" are read by genpname. */
+
+    /*  Note: Place UCHAR_ALPHABETIC before UCHAR_BINARY_START so that
+    debuggers display UCHAR_ALPHABETIC as the symbolic name for 0,
+    rather than UCHAR_BINARY_START.  Likewise for other *_START
+    identifiers. */
+
+    /** Binary property Alphabetic. Same as u_isUAlphabetic, different from u_isalpha.
+        Lu+Ll+Lt+Lm+Lo+Nl+Other_Alphabetic @stable ICU 2.1 */
+    UCHAR_ALPHABETIC=0,
+    /** First constant for binary Unicode properties. @stable ICU 2.1 */
+    UCHAR_BINARY_START=UCHAR_ALPHABETIC,
+    /** Binary property ASCII_Hex_Digit. 0-9 A-F a-f @stable ICU 2.1 */
+    UCHAR_ASCII_HEX_DIGIT=1,
+    /** Binary property Bidi_Control.
+        Format controls which have specific functions
+        in the Bidi Algorithm. @stable ICU 2.1 */
+    UCHAR_BIDI_CONTROL=2,
+    /** Binary property Bidi_Mirrored.
+        Characters that may change display in RTL text.
+        Same as u_isMirrored.
+        See Bidi Algorithm, UTR 9. @stable ICU 2.1 */
+    UCHAR_BIDI_MIRRORED=3,
+    /** Binary property Dash. Variations of dashes. @stable ICU 2.1 */
+    UCHAR_DASH=4,
+    /** Binary property Default_Ignorable_Code_Point (new in Unicode 3.2).
+        Ignorable in most processing.
+        <2060..206F, FFF0..FFFB, E0000..E0FFF>+Other_Default_Ignorable_Code_Point+(Cf+Cc+Cs-White_Space) @stable ICU 2.1 */
+    UCHAR_DEFAULT_IGNORABLE_CODE_POINT=5,
+    /** Binary property Deprecated (new in Unicode 3.2).
+        The usage of deprecated characters is strongly discouraged. @stable ICU 2.1 */
+    UCHAR_DEPRECATED=6,
+    /** Binary property Diacritic. Characters that linguistically modify
+        the meaning of another character to which they apply. @stable ICU 2.1 */
+    UCHAR_DIACRITIC=7,
+    /** Binary property Extender.
+        Extend the value or shape of a preceding alphabetic character,
+        e.g., length and iteration marks. @stable ICU 2.1 */
+    UCHAR_EXTENDER=8,
+    /** Binary property Full_Composition_Exclusion.
+        CompositionExclusions.txt+Singleton Decompositions+
+        Non-Starter Decompositions. @stable ICU 2.1 */
+    UCHAR_FULL_COMPOSITION_EXCLUSION=9,
+    /** Binary property Grapheme_Base (new in Unicode 3.2).
+        For programmatic determination of grapheme cluster boundaries.
+        [0..10FFFF]-Cc-Cf-Cs-Co-Cn-Zl-Zp-Grapheme_Link-Grapheme_Extend-CGJ @stable ICU 2.1 */
+    UCHAR_GRAPHEME_BASE=10,
+    /** Binary property Grapheme_Extend (new in Unicode 3.2).
+        For programmatic determination of grapheme cluster boundaries.
+        Me+Mn+Mc+Other_Grapheme_Extend-Grapheme_Link-CGJ @stable ICU 2.1 */
+    UCHAR_GRAPHEME_EXTEND=11,
+    /** Binary property Grapheme_Link (new in Unicode 3.2).
+        For programmatic determination of grapheme cluster boundaries. @stable ICU 2.1 */
+    UCHAR_GRAPHEME_LINK=12,
+    /** Binary property Hex_Digit.
+        Characters commonly used for hexadecimal numbers. @stable ICU 2.1 */
+    UCHAR_HEX_DIGIT=13,
+    /** Binary property Hyphen. Dashes used to mark connections
+        between pieces of words, plus the Katakana middle dot. @stable ICU 2.1 */
+    UCHAR_HYPHEN=14,
+    /** Binary property ID_Continue.
+        Characters that can continue an identifier.
+        DerivedCoreProperties.txt also says "NOTE: Cf characters should be filtered out."
+        ID_Start+Mn+Mc+Nd+Pc @stable ICU 2.1 */
+    UCHAR_ID_CONTINUE=15,
+    /** Binary property ID_Start.
+        Characters that can start an identifier.
+        Lu+Ll+Lt+Lm+Lo+Nl @stable ICU 2.1 */
+    UCHAR_ID_START=16,
+    /** Binary property Ideographic.
+        CJKV ideographs. @stable ICU 2.1 */
+    UCHAR_IDEOGRAPHIC=17,
+    /** Binary property IDS_Binary_Operator (new in Unicode 3.2).
+        For programmatic determination of
+        Ideographic Description Sequences. @stable ICU 2.1 */
+    UCHAR_IDS_BINARY_OPERATOR=18,
+    /** Binary property IDS_Trinary_Operator (new in Unicode 3.2).
+        For programmatic determination of
+        Ideographic Description Sequences. @stable ICU 2.1 */
+    UCHAR_IDS_TRINARY_OPERATOR=19,
+    /** Binary property Join_Control.
+        Format controls for cursive joining and ligation. @stable ICU 2.1 */
+    UCHAR_JOIN_CONTROL=20,
+    /** Binary property Logical_Order_Exception (new in Unicode 3.2).
+        Characters that do not use logical order and
+        require special handling in most processing. @stable ICU 2.1 */
+    UCHAR_LOGICAL_ORDER_EXCEPTION=21,
+    /** Binary property Lowercase. Same as u_isULowercase, different from u_islower.
+        Ll+Other_Lowercase @stable ICU 2.1 */
+    UCHAR_LOWERCASE=22,
+    /** Binary property Math. Sm+Other_Math @stable ICU 2.1 */
+    UCHAR_MATH=23,
+    /** Binary property Noncharacter_Code_Point.
+        Code points that are explicitly defined as illegal
+        for the encoding of characters. @stable ICU 2.1 */
+    UCHAR_NONCHARACTER_CODE_POINT=24,
+    /** Binary property Quotation_Mark. @stable ICU 2.1 */
+    UCHAR_QUOTATION_MARK=25,
+    /** Binary property Radical (new in Unicode 3.2).
+        For programmatic determination of
+        Ideographic Description Sequences. @stable ICU 2.1 */
+    UCHAR_RADICAL=26,
+    /** Binary property Soft_Dotted (new in Unicode 3.2).
+        Characters with a "soft dot", like i or j.
+        An accent placed on these characters causes
+        the dot to disappear. @stable ICU 2.1 */
+    UCHAR_SOFT_DOTTED=27,
+    /** Binary property Terminal_Punctuation.
+        Punctuation characters that generally mark
+        the end of textual units. @stable ICU 2.1 */
+    UCHAR_TERMINAL_PUNCTUATION=28,
+    /** Binary property Unified_Ideograph (new in Unicode 3.2).
+        For programmatic determination of
+        Ideographic Description Sequences. @stable ICU 2.1 */
+    UCHAR_UNIFIED_IDEOGRAPH=29,
+    /** Binary property Uppercase. Same as u_isUUppercase, different from u_isupper.
+        Lu+Other_Uppercase @stable ICU 2.1 */
+    UCHAR_UPPERCASE=30,
+    /** Binary property White_Space.
+        Same as u_isUWhiteSpace, different from u_isspace and u_isWhitespace.
+        Space characters+TAB+CR+LF-ZWSP-ZWNBSP @stable ICU 2.1 */
+    UCHAR_WHITE_SPACE=31,
+    /** Binary property XID_Continue.
+        ID_Continue modified to allow closure under
+        normalization forms NFKC and NFKD. @stable ICU 2.1 */
+    UCHAR_XID_CONTINUE=32,
+    /** Binary property XID_Start. ID_Start modified to allow
+        closure under normalization forms NFKC and NFKD. @stable ICU 2.1 */
+    UCHAR_XID_START=33,
+    /** Binary property Case_Sensitive. Either the source of a case
+        mapping or _in_ the target of a case mapping. Not the same as
+        the general category Cased_Letter. @stable ICU 2.6 */
+   UCHAR_CASE_SENSITIVE=34,
+    /** Binary property STerm (new in Unicode 4.0.1).
+        Sentence Terminal. Used in UAX #29: Text Boundaries
+        (http://www.unicode.org/reports/tr29/)
+        @stable ICU 3.0 */
+    UCHAR_S_TERM=35,
+    /** Binary property Variation_Selector (new in Unicode 4.0.1).
+        Indicates all those characters that qualify as Variation Selectors.
+        For details on the behavior of these characters,
+        see StandardizedVariants.html and 15.6 Variation Selectors.
+        @stable ICU 3.0 */
+    UCHAR_VARIATION_SELECTOR=36,
+    /** Binary property NFD_Inert.
+        ICU-specific property for characters that are inert under NFD,
+        i.e., they do not interact with adjacent characters.
+        See the documentation for the Normalizer2 class and the
+        Normalizer2::isInert() method.
+        @stable ICU 3.0 */
+    UCHAR_NFD_INERT=37,
+    /** Binary property NFKD_Inert.
+        ICU-specific property for characters that are inert under NFKD,
+        i.e., they do not interact with adjacent characters.
+        See the documentation for the Normalizer2 class and the
+        Normalizer2::isInert() method.
+        @stable ICU 3.0 */
+    UCHAR_NFKD_INERT=38,
+    /** Binary property NFC_Inert.
+        ICU-specific property for characters that are inert under NFC,
+        i.e., they do not interact with adjacent characters.
+        See the documentation for the Normalizer2 class and the
+        Normalizer2::isInert() method.
+        @stable ICU 3.0 */
+    UCHAR_NFC_INERT=39,
+    /** Binary property NFKC_Inert.
+        ICU-specific property for characters that are inert under NFKC,
+        i.e., they do not interact with adjacent characters.
+        See the documentation for the Normalizer2 class and the
+        Normalizer2::isInert() method.
+        @stable ICU 3.0 */
+    UCHAR_NFKC_INERT=40,
+    /** Binary Property Segment_Starter.
+        ICU-specific property for characters that are starters in terms of
+        Unicode normalization and combining character sequences.
+        They have ccc=0 and do not occur in non-initial position of the
+        canonical decomposition of any character
+        (like a-umlaut in NFD and a Jamo T in an NFD(Hangul LVT)).
+        ICU uses this property for segmenting a string for generating a set of
+        canonically equivalent strings, e.g. for canonical closure while
+        processing collation tailoring rules.
+        @stable ICU 3.0 */
+    UCHAR_SEGMENT_STARTER=41,
+    /** Binary property Pattern_Syntax (new in Unicode 4.1).
+        See UAX #31 Identifier and Pattern Syntax
+        (http://www.unicode.org/reports/tr31/)
+        @stable ICU 3.4 */
+    UCHAR_PATTERN_SYNTAX=42,
+    /** Binary property Pattern_White_Space (new in Unicode 4.1).
+        See UAX #31 Identifier and Pattern Syntax
+        (http://www.unicode.org/reports/tr31/)
+        @stable ICU 3.4 */
+    UCHAR_PATTERN_WHITE_SPACE=43,
+    /** Binary property alnum (a C/POSIX character class).
+        Implemented according to the UTS #18 Annex C Standard Recommendation.
+        See the uchar.h file documentation.
+        @stable ICU 3.4 */
+    UCHAR_POSIX_ALNUM=44,
+    /** Binary property blank (a C/POSIX character class).
+        Implemented according to the UTS #18 Annex C Standard Recommendation.
+        See the uchar.h file documentation.
+        @stable ICU 3.4 */
+    UCHAR_POSIX_BLANK=45,
+    /** Binary property graph (a C/POSIX character class).
+        Implemented according to the UTS #18 Annex C Standard Recommendation.
+        See the uchar.h file documentation.
+        @stable ICU 3.4 */
+    UCHAR_POSIX_GRAPH=46,
+    /** Binary property print (a C/POSIX character class).
+        Implemented according to the UTS #18 Annex C Standard Recommendation.
+        See the uchar.h file documentation.
+        @stable ICU 3.4 */
+    UCHAR_POSIX_PRINT=47,
+    /** Binary property xdigit (a C/POSIX character class).
+        Implemented according to the UTS #18 Annex C Standard Recommendation.
+        See the uchar.h file documentation.
+        @stable ICU 3.4 */
+    UCHAR_POSIX_XDIGIT=48,
+    /** Binary property Cased. For Lowercase, Uppercase and Titlecase characters. @stable ICU 4.4 */
+    UCHAR_CASED=49,
+    /** Binary property Case_Ignorable. Used in context-sensitive case mappings. @stable ICU 4.4 */
+    UCHAR_CASE_IGNORABLE=50,
+    /** Binary property Changes_When_Lowercased. @stable ICU 4.4 */
+    UCHAR_CHANGES_WHEN_LOWERCASED=51,
+    /** Binary property Changes_When_Uppercased. @stable ICU 4.4 */
+    UCHAR_CHANGES_WHEN_UPPERCASED=52,
+    /** Binary property Changes_When_Titlecased. @stable ICU 4.4 */
+    UCHAR_CHANGES_WHEN_TITLECASED=53,
+    /** Binary property Changes_When_Casefolded. @stable ICU 4.4 */
+    UCHAR_CHANGES_WHEN_CASEFOLDED=54,
+    /** Binary property Changes_When_Casemapped. @stable ICU 4.4 */
+    UCHAR_CHANGES_WHEN_CASEMAPPED=55,
+    /** Binary property Changes_When_NFKC_Casefolded. @stable ICU 4.4 */
+    UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED=56,
+    /** One more than the last constant for binary Unicode properties. @stable ICU 2.1 */
+    UCHAR_BINARY_LIMIT=57,
+
+    /** Enumerated property Bidi_Class.
+        Same as u_charDirection, returns UCharDirection values. @stable ICU 2.2 */
+    UCHAR_BIDI_CLASS=0x1000,
+    /** First constant for enumerated/integer Unicode properties. @stable ICU 2.2 */
+    UCHAR_INT_START=UCHAR_BIDI_CLASS,
+    /** Enumerated property Block.
+        Same as ublock_getCode, returns UBlockCode values. @stable ICU 2.2 */
+    UCHAR_BLOCK=0x1001,
+    /** Enumerated property Canonical_Combining_Class.
+        Same as u_getCombiningClass, returns 8-bit numeric values. @stable ICU 2.2 */
+    UCHAR_CANONICAL_COMBINING_CLASS=0x1002,
+    /** Enumerated property Decomposition_Type.
+        Returns UDecompositionType values. @stable ICU 2.2 */
+    UCHAR_DECOMPOSITION_TYPE=0x1003,
+    /** Enumerated property East_Asian_Width.
+        See http://www.unicode.org/reports/tr11/
+        Returns UEastAsianWidth values. @stable ICU 2.2 */
+    UCHAR_EAST_ASIAN_WIDTH=0x1004,
+    /** Enumerated property General_Category.
+        Same as u_charType, returns UCharCategory values. @stable ICU 2.2 */
+    UCHAR_GENERAL_CATEGORY=0x1005,
+    /** Enumerated property Joining_Group.
+        Returns UJoiningGroup values. @stable ICU 2.2 */
+    UCHAR_JOINING_GROUP=0x1006,
+    /** Enumerated property Joining_Type.
+        Returns UJoiningType values. @stable ICU 2.2 */
+    UCHAR_JOINING_TYPE=0x1007,
+    /** Enumerated property Line_Break.
+        Returns ULineBreak values. @stable ICU 2.2 */
+    UCHAR_LINE_BREAK=0x1008,
+    /** Enumerated property Numeric_Type.
+        Returns UNumericType values. @stable ICU 2.2 */
+    UCHAR_NUMERIC_TYPE=0x1009,
+    /** Enumerated property Script.
+        Same as uscript_getScript, returns UScriptCode values. @stable ICU 2.2 */
+    UCHAR_SCRIPT=0x100A,
+    /** Enumerated property Hangul_Syllable_Type, new in Unicode 4.
+        Returns UHangulSyllableType values. @stable ICU 2.6 */
+    UCHAR_HANGUL_SYLLABLE_TYPE=0x100B,
+    /** Enumerated property NFD_Quick_Check.
+        Returns UNormalizationCheckResult values. @stable ICU 3.0 */
+    UCHAR_NFD_QUICK_CHECK=0x100C,
+    /** Enumerated property NFKD_Quick_Check.
+        Returns UNormalizationCheckResult values. @stable ICU 3.0 */
+    UCHAR_NFKD_QUICK_CHECK=0x100D,
+    /** Enumerated property NFC_Quick_Check.
+        Returns UNormalizationCheckResult values. @stable ICU 3.0 */
+    UCHAR_NFC_QUICK_CHECK=0x100E,
+    /** Enumerated property NFKC_Quick_Check.
+        Returns UNormalizationCheckResult values. @stable ICU 3.0 */
+    UCHAR_NFKC_QUICK_CHECK=0x100F,
+    /** Enumerated property Lead_Canonical_Combining_Class.
+        ICU-specific property for the ccc of the first code point
+        of the decomposition, or lccc(c)=ccc(NFD(c)[0]).
+        Useful for checking for canonically ordered text;
+        see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD .
+        Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @stable ICU 3.0 */
+    UCHAR_LEAD_CANONICAL_COMBINING_CLASS=0x1010,
+    /** Enumerated property Trail_Canonical_Combining_Class.
+        ICU-specific property for the ccc of the last code point
+        of the decomposition, or tccc(c)=ccc(NFD(c)[last]).
+        Useful for checking for canonically ordered text;
+        see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD .
+        Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @stable ICU 3.0 */
+    UCHAR_TRAIL_CANONICAL_COMBINING_CLASS=0x1011,
+    /** Enumerated property Grapheme_Cluster_Break (new in Unicode 4.1).
+        Used in UAX #29: Text Boundaries
+        (http://www.unicode.org/reports/tr29/)
+        Returns UGraphemeClusterBreak values. @stable ICU 3.4 */
+    UCHAR_GRAPHEME_CLUSTER_BREAK=0x1012,
+    /** Enumerated property Sentence_Break (new in Unicode 4.1).
+        Used in UAX #29: Text Boundaries
+        (http://www.unicode.org/reports/tr29/)
+        Returns USentenceBreak values. @stable ICU 3.4 */
+    UCHAR_SENTENCE_BREAK=0x1013,
+    /** Enumerated property Word_Break (new in Unicode 4.1).
+        Used in UAX #29: Text Boundaries
+        (http://www.unicode.org/reports/tr29/)
+        Returns UWordBreakValues values. @stable ICU 3.4 */
+    UCHAR_WORD_BREAK=0x1014,
+    /** One more than the last constant for enumerated/integer Unicode properties. @stable ICU 2.2 */
+    UCHAR_INT_LIMIT=0x1015,
+
+    /** Bitmask property General_Category_Mask.
+        This is the General_Category property returned as a bit mask.
+        When used in u_getIntPropertyValue(c), same as U_MASK(u_charType(c)),
+        returns bit masks for UCharCategory values where exactly one bit is set.
+        When used with u_getPropertyValueName() and u_getPropertyValueEnum(),
+        a multi-bit mask is used for sets of categories like "Letters".
+        Mask values should be cast to uint32_t.
+        @stable ICU 2.4 */
+    UCHAR_GENERAL_CATEGORY_MASK=0x2000,
+    /** First constant for bit-mask Unicode properties. @stable ICU 2.4 */
+    UCHAR_MASK_START=UCHAR_GENERAL_CATEGORY_MASK,
+    /** One more than the last constant for bit-mask Unicode properties. @stable ICU 2.4 */
+    UCHAR_MASK_LIMIT=0x2001,
+
+    /** Double property Numeric_Value.
+        Corresponds to u_getNumericValue. @stable ICU 2.4 */
+    UCHAR_NUMERIC_VALUE=0x3000,
+    /** First constant for double Unicode properties. @stable ICU 2.4 */
+    UCHAR_DOUBLE_START=UCHAR_NUMERIC_VALUE,
+    /** One more than the last constant for double Unicode properties. @stable ICU 2.4 */
+    UCHAR_DOUBLE_LIMIT=0x3001,
+
+    /** String property Age.
+        Corresponds to u_charAge. @stable ICU 2.4 */
+    UCHAR_AGE=0x4000,
+    /** First constant for string Unicode properties. @stable ICU 2.4 */
+    UCHAR_STRING_START=UCHAR_AGE,
+    /** String property Bidi_Mirroring_Glyph.
+        Corresponds to u_charMirror. @stable ICU 2.4 */
+    UCHAR_BIDI_MIRRORING_GLYPH=0x4001,
+    /** String property Case_Folding.
+        Corresponds to u_strFoldCase in ustring.h. @stable ICU 2.4 */
+    UCHAR_CASE_FOLDING=0x4002,
+    /** String property ISO_Comment.
+        Corresponds to u_getISOComment. @stable ICU 2.4 */
+    UCHAR_ISO_COMMENT=0x4003,
+    /** String property Lowercase_Mapping.
+        Corresponds to u_strToLower in ustring.h. @stable ICU 2.4 */
+    UCHAR_LOWERCASE_MAPPING=0x4004,
+    /** String property Name.
+        Corresponds to u_charName. @stable ICU 2.4 */
+    UCHAR_NAME=0x4005,
+    /** String property Simple_Case_Folding.
+        Corresponds to u_foldCase. @stable ICU 2.4 */
+    UCHAR_SIMPLE_CASE_FOLDING=0x4006,
+    /** String property Simple_Lowercase_Mapping.
+        Corresponds to u_tolower. @stable ICU 2.4 */
+    UCHAR_SIMPLE_LOWERCASE_MAPPING=0x4007,
+    /** String property Simple_Titlecase_Mapping.
+        Corresponds to u_totitle. @stable ICU 2.4 */
+    UCHAR_SIMPLE_TITLECASE_MAPPING=0x4008,
+    /** String property Simple_Uppercase_Mapping.
+        Corresponds to u_toupper. @stable ICU 2.4 */
+    UCHAR_SIMPLE_UPPERCASE_MAPPING=0x4009,
+    /** String property Titlecase_Mapping.
+        Corresponds to u_strToTitle in ustring.h. @stable ICU 2.4 */
+    UCHAR_TITLECASE_MAPPING=0x400A,
+    /** String property Unicode_1_Name.
+        Corresponds to u_charName. @stable ICU 2.4 */
+    UCHAR_UNICODE_1_NAME=0x400B,
+    /** String property Uppercase_Mapping.
+        Corresponds to u_strToUpper in ustring.h. @stable ICU 2.4 */
+    UCHAR_UPPERCASE_MAPPING=0x400C,
+    /** One more than the last constant for string Unicode properties. @stable ICU 2.4 */
+    UCHAR_STRING_LIMIT=0x400D,
+
+    /** Provisional property Script_Extensions (new in Unicode 6.0).
+        As a provisional property, it may be modified or removed
+        in future versions of the Unicode Standard, and thus in ICU.
+        Some characters are commonly used in multiple scripts.
+        For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
+        Corresponds to uscript_hasScript and uscript_getScriptExtensions in uscript.h.
+        @draft ICU 4.6 */
+    UCHAR_SCRIPT_EXTENSIONS=0x7000,
+    /** First constant for Unicode properties with unusual value types. @draft ICU 4.6 */
+    UCHAR_OTHER_PROPERTY_START=UCHAR_SCRIPT_EXTENSIONS,
+    /** One more than the last constant for Unicode properties with unusual value types.
+     * @draft ICU 4.6 */
+    UCHAR_OTHER_PROPERTY_LIMIT=0x7001,
+
+    /** Represents a nonexistent or invalid property or property value. @stable ICU 2.4 */
+    UCHAR_INVALID_CODE = -1
+} UProperty;
+
+/**
+ * Data for enumerated Unicode general category types.
+ * See http://www.unicode.org/Public/UNIDATA/UnicodeData.html .
+ * @stable ICU 2.0
+ */
+typedef enum UCharCategory
+{
+    /** See note !!.  Comments of the form "Cn" are read by genpname. */
+
+    /** Non-category for unassigned and non-character code points. @stable ICU 2.0 */
+    U_UNASSIGNED              = 0,
+    /** Cn "Other, Not Assigned (no characters in [UnicodeData.txt] have this property)" (same as U_UNASSIGNED!) @stable ICU 2.0 */
+    U_GENERAL_OTHER_TYPES     = 0,
+    /** Lu @stable ICU 2.0 */
+    U_UPPERCASE_LETTER        = 1,
+    /** Ll @stable ICU 2.0 */
+    U_LOWERCASE_LETTER        = 2,
+    /** Lt @stable ICU 2.0 */
+    U_TITLECASE_LETTER        = 3,
+    /** Lm @stable ICU 2.0 */
+    U_MODIFIER_LETTER         = 4,
+    /** Lo @stable ICU 2.0 */
+    U_OTHER_LETTER            = 5,
+    /** Mn @stable ICU 2.0 */
+    U_NON_SPACING_MARK        = 6,
+    /** Me @stable ICU 2.0 */
+    U_ENCLOSING_MARK          = 7,
+    /** Mc @stable ICU 2.0 */
+    U_COMBINING_SPACING_MARK  = 8,
+    /** Nd @stable ICU 2.0 */
+    U_DECIMAL_DIGIT_NUMBER    = 9,
+    /** Nl @stable ICU 2.0 */
+    U_LETTER_NUMBER           = 10,
+    /** No @stable ICU 2.0 */
+    U_OTHER_NUMBER            = 11,
+    /** Zs @stable ICU 2.0 */
+    U_SPACE_SEPARATOR         = 12,
+    /** Zl @stable ICU 2.0 */
+    U_LINE_SEPARATOR          = 13,
+    /** Zp @stable ICU 2.0 */
+    U_PARAGRAPH_SEPARATOR     = 14,
+    /** Cc @stable ICU 2.0 */
+    U_CONTROL_CHAR            = 15,
+    /** Cf @stable ICU 2.0 */
+    U_FORMAT_CHAR             = 16,
+    /** Co @stable ICU 2.0 */
+    U_PRIVATE_USE_CHAR        = 17,
+    /** Cs @stable ICU 2.0 */
+    U_SURROGATE               = 18,
+    /** Pd @stable ICU 2.0 */
+    U_DASH_PUNCTUATION        = 19,
+    /** Ps @stable ICU 2.0 */
+    U_START_PUNCTUATION       = 20,
+    /** Pe @stable ICU 2.0 */
+    U_END_PUNCTUATION         = 21,
+    /** Pc @stable ICU 2.0 */
+    U_CONNECTOR_PUNCTUATION   = 22,
+    /** Po @stable ICU 2.0 */
+    U_OTHER_PUNCTUATION       = 23,
+    /** Sm @stable ICU 2.0 */
+    U_MATH_SYMBOL             = 24,
+    /** Sc @stable ICU 2.0 */
+    U_CURRENCY_SYMBOL         = 25,
+    /** Sk @stable ICU 2.0 */
+    U_MODIFIER_SYMBOL         = 26,
+    /** So @stable ICU 2.0 */
+    U_OTHER_SYMBOL            = 27,
+    /** Pi @stable ICU 2.0 */
+    U_INITIAL_PUNCTUATION     = 28,
+    /** Pf @stable ICU 2.0 */
+    U_FINAL_PUNCTUATION       = 29,
+    /** One higher than the last enum UCharCategory constant. @stable ICU 2.0 */
+    U_CHAR_CATEGORY_COUNT
+} UCharCategory;
+
+/**
+ * U_GC_XX_MASK constants are bit flags corresponding to Unicode
+ * general category values.
+ * For each category, the nth bit is set if the numeric value of the
+ * corresponding UCharCategory constant is n.
+ *
+ * There are also some U_GC_Y_MASK constants for groups of general categories
+ * like L for all letter categories.
+ *
+ * @see u_charType
+ * @see U_GET_GC_MASK
+ * @see UCharCategory
+ * @stable ICU 2.1
+ */
+#define U_GC_CN_MASK    U_MASK(U_GENERAL_OTHER_TYPES)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_LU_MASK    U_MASK(U_UPPERCASE_LETTER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_LL_MASK    U_MASK(U_LOWERCASE_LETTER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_LT_MASK    U_MASK(U_TITLECASE_LETTER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_LM_MASK    U_MASK(U_MODIFIER_LETTER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_LO_MASK    U_MASK(U_OTHER_LETTER)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_MN_MASK    U_MASK(U_NON_SPACING_MARK)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_ME_MASK    U_MASK(U_ENCLOSING_MARK)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_MC_MASK    U_MASK(U_COMBINING_SPACING_MARK)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_ND_MASK    U_MASK(U_DECIMAL_DIGIT_NUMBER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_NL_MASK    U_MASK(U_LETTER_NUMBER)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_NO_MASK    U_MASK(U_OTHER_NUMBER)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_ZS_MASK    U_MASK(U_SPACE_SEPARATOR)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_ZL_MASK    U_MASK(U_LINE_SEPARATOR)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_ZP_MASK    U_MASK(U_PARAGRAPH_SEPARATOR)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_CC_MASK    U_MASK(U_CONTROL_CHAR)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_CF_MASK    U_MASK(U_FORMAT_CHAR)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_CO_MASK    U_MASK(U_PRIVATE_USE_CHAR)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_CS_MASK    U_MASK(U_SURROGATE)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PD_MASK    U_MASK(U_DASH_PUNCTUATION)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PS_MASK    U_MASK(U_START_PUNCTUATION)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PE_MASK    U_MASK(U_END_PUNCTUATION)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PC_MASK    U_MASK(U_CONNECTOR_PUNCTUATION)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PO_MASK    U_MASK(U_OTHER_PUNCTUATION)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_SM_MASK    U_MASK(U_MATH_SYMBOL)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_SC_MASK    U_MASK(U_CURRENCY_SYMBOL)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_SK_MASK    U_MASK(U_MODIFIER_SYMBOL)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_SO_MASK    U_MASK(U_OTHER_SYMBOL)
+
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PI_MASK    U_MASK(U_INITIAL_PUNCTUATION)
+/** Mask constant for a UCharCategory. @stable ICU 2.1 */
+#define U_GC_PF_MASK    U_MASK(U_FINAL_PUNCTUATION)
+
+
+/** Mask constant for multiple UCharCategory bits (L Letters). @stable ICU 2.1 */
+#define U_GC_L_MASK \
+            (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK|U_GC_LM_MASK|U_GC_LO_MASK)
+
+/** Mask constant for multiple UCharCategory bits (LC Cased Letters). @stable ICU 2.1 */
+#define U_GC_LC_MASK \
+            (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK)
+
+/** Mask constant for multiple UCharCategory bits (M Marks). @stable ICU 2.1 */
+#define U_GC_M_MASK (U_GC_MN_MASK|U_GC_ME_MASK|U_GC_MC_MASK)
+
+/** Mask constant for multiple UCharCategory bits (N Numbers). @stable ICU 2.1 */
+#define U_GC_N_MASK (U_GC_ND_MASK|U_GC_NL_MASK|U_GC_NO_MASK)
+
+/** Mask constant for multiple UCharCategory bits (Z Separators). @stable ICU 2.1 */
+#define U_GC_Z_MASK (U_GC_ZS_MASK|U_GC_ZL_MASK|U_GC_ZP_MASK)
+
+/** Mask constant for multiple UCharCategory bits (C Others). @stable ICU 2.1 */
+#define U_GC_C_MASK \
+            (U_GC_CN_MASK|U_GC_CC_MASK|U_GC_CF_MASK|U_GC_CO_MASK|U_GC_CS_MASK)
+
+/** Mask constant for multiple UCharCategory bits (P Punctuation). @stable ICU 2.1 */
+#define U_GC_P_MASK \
+            (U_GC_PD_MASK|U_GC_PS_MASK|U_GC_PE_MASK|U_GC_PC_MASK|U_GC_PO_MASK| \
+             U_GC_PI_MASK|U_GC_PF_MASK)
+
+/** Mask constant for multiple UCharCategory bits (S Symbols). @stable ICU 2.1 */
+#define U_GC_S_MASK (U_GC_SM_MASK|U_GC_SC_MASK|U_GC_SK_MASK|U_GC_SO_MASK)
+
+/**
+ * This specifies the language directional property of a character set.
+ * @stable ICU 2.0
+ */
+typedef enum UCharDirection {
+    /** See note !!.  Comments of the form "EN" are read by genpname. */
+
+    /** L @stable ICU 2.0 */
+    U_LEFT_TO_RIGHT               = 0,
+    /** R @stable ICU 2.0 */
+    U_RIGHT_TO_LEFT               = 1,
+    /** EN @stable ICU 2.0 */
+    U_EUROPEAN_NUMBER             = 2,
+    /** ES @stable ICU 2.0 */
+    U_EUROPEAN_NUMBER_SEPARATOR   = 3,
+    /** ET @stable ICU 2.0 */
+    U_EUROPEAN_NUMBER_TERMINATOR  = 4,
+    /** AN @stable ICU 2.0 */
+    U_ARABIC_NUMBER               = 5,
+    /** CS @stable ICU 2.0 */
+    U_COMMON_NUMBER_SEPARATOR     = 6,
+    /** B @stable ICU 2.0 */
+    U_BLOCK_SEPARATOR             = 7,
+    /** S @stable ICU 2.0 */
+    U_SEGMENT_SEPARATOR           = 8,
+    /** WS @stable ICU 2.0 */
+    U_WHITE_SPACE_NEUTRAL         = 9,
+    /** ON @stable ICU 2.0 */
+    U_OTHER_NEUTRAL               = 10,
+    /** LRE @stable ICU 2.0 */
+    U_LEFT_TO_RIGHT_EMBEDDING     = 11,
+    /** LRO @stable ICU 2.0 */
+    U_LEFT_TO_RIGHT_OVERRIDE      = 12,
+    /** AL @stable ICU 2.0 */
+    U_RIGHT_TO_LEFT_ARABIC        = 13,
+    /** RLE @stable ICU 2.0 */
+    U_RIGHT_TO_LEFT_EMBEDDING     = 14,
+    /** RLO @stable ICU 2.0 */
+    U_RIGHT_TO_LEFT_OVERRIDE      = 15,
+    /** PDF @stable ICU 2.0 */
+    U_POP_DIRECTIONAL_FORMAT      = 16,
+    /** NSM @stable ICU 2.0 */
+    U_DIR_NON_SPACING_MARK        = 17,
+    /** BN @stable ICU 2.0 */
+    U_BOUNDARY_NEUTRAL            = 18,
+    /** @stable ICU 2.0 */
+    U_CHAR_DIRECTION_COUNT
+} UCharDirection;
+
+/**
+ * Constants for Unicode blocks, see the Unicode Data file Blocks.txt
+ * @stable ICU 2.0
+ */
+enum UBlockCode {
+
+    /** New No_Block value in Unicode 4. @stable ICU 2.6 */
+    UBLOCK_NO_BLOCK = 0, /*[none]*/ /* Special range indicating No_Block */
+
+    /** @stable ICU 2.0 */
+    UBLOCK_BASIC_LATIN = 1, /*[0000]*/ /*See note !!*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_LATIN_1_SUPPLEMENT=2, /*[0080]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_LATIN_EXTENDED_A =3, /*[0100]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_LATIN_EXTENDED_B =4, /*[0180]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_IPA_EXTENSIONS =5, /*[0250]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_SPACING_MODIFIER_LETTERS =6, /*[02B0]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_COMBINING_DIACRITICAL_MARKS =7, /*[0300]*/
+
+    /**
+     * Unicode 3.2 renames this block to "Greek and Coptic".
+     * @stable ICU 2.0
+     */
+    UBLOCK_GREEK =8, /*[0370]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_CYRILLIC =9, /*[0400]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_ARMENIAN =10, /*[0530]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_HEBREW =11, /*[0590]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_ARABIC =12, /*[0600]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_SYRIAC =13, /*[0700]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_THAANA =14, /*[0780]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_DEVANAGARI =15, /*[0900]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_BENGALI =16, /*[0980]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_GURMUKHI =17, /*[0A00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_GUJARATI =18, /*[0A80]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_ORIYA =19, /*[0B00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_TAMIL =20, /*[0B80]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_TELUGU =21, /*[0C00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_KANNADA =22, /*[0C80]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_MALAYALAM =23, /*[0D00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_SINHALA =24, /*[0D80]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_THAI =25, /*[0E00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_LAO =26, /*[0E80]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_TIBETAN =27, /*[0F00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_MYANMAR =28, /*[1000]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_GEORGIAN =29, /*[10A0]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_HANGUL_JAMO =30, /*[1100]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_ETHIOPIC =31, /*[1200]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_CHEROKEE =32, /*[13A0]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS =33, /*[1400]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_OGHAM =34, /*[1680]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_RUNIC =35, /*[16A0]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_KHMER =36, /*[1780]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_MONGOLIAN =37, /*[1800]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_LATIN_EXTENDED_ADDITIONAL =38, /*[1E00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_GREEK_EXTENDED =39, /*[1F00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_GENERAL_PUNCTUATION =40, /*[2000]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_SUPERSCRIPTS_AND_SUBSCRIPTS =41, /*[2070]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_CURRENCY_SYMBOLS =42, /*[20A0]*/
+
+    /**
+     * Unicode 3.2 renames this block to "Combining Diacritical Marks for Symbols".
+     * @stable ICU 2.0
+     */
+    UBLOCK_COMBINING_MARKS_FOR_SYMBOLS =43, /*[20D0]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_LETTERLIKE_SYMBOLS =44, /*[2100]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_NUMBER_FORMS =45, /*[2150]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_ARROWS =46, /*[2190]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_MATHEMATICAL_OPERATORS =47, /*[2200]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_MISCELLANEOUS_TECHNICAL =48, /*[2300]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_CONTROL_PICTURES =49, /*[2400]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_OPTICAL_CHARACTER_RECOGNITION =50, /*[2440]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_ENCLOSED_ALPHANUMERICS =51, /*[2460]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_BOX_DRAWING =52, /*[2500]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_BLOCK_ELEMENTS =53, /*[2580]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_GEOMETRIC_SHAPES =54, /*[25A0]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_MISCELLANEOUS_SYMBOLS =55, /*[2600]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_DINGBATS =56, /*[2700]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_BRAILLE_PATTERNS =57, /*[2800]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_CJK_RADICALS_SUPPLEMENT =58, /*[2E80]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_KANGXI_RADICALS =59, /*[2F00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_IDEOGRAPHIC_DESCRIPTION_CHARACTERS =60, /*[2FF0]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION =61, /*[3000]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_HIRAGANA =62, /*[3040]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_KATAKANA =63, /*[30A0]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_BOPOMOFO =64, /*[3100]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_HANGUL_COMPATIBILITY_JAMO =65, /*[3130]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_KANBUN =66, /*[3190]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_BOPOMOFO_EXTENDED =67, /*[31A0]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS =68, /*[3200]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_CJK_COMPATIBILITY =69, /*[3300]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A =70, /*[3400]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_CJK_UNIFIED_IDEOGRAPHS =71, /*[4E00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_YI_SYLLABLES =72, /*[A000]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_YI_RADICALS =73, /*[A490]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_HANGUL_SYLLABLES =74, /*[AC00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_HIGH_SURROGATES =75, /*[D800]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_HIGH_PRIVATE_USE_SURROGATES =76, /*[DB80]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_LOW_SURROGATES =77, /*[DC00]*/
+
+    /**
+     * Same as UBLOCK_PRIVATE_USE_AREA.
+     * Until Unicode 3.1.1, the corresponding block name was "Private Use",
+     * and multiple code point ranges had this block.
+     * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and
+     * adds separate blocks for the supplementary PUAs.
+     *
+     * @stable ICU 2.0
+     */
+    UBLOCK_PRIVATE_USE = 78,
+    /**
+     * Same as UBLOCK_PRIVATE_USE.
+     * Until Unicode 3.1.1, the corresponding block name was "Private Use",
+     * and multiple code point ranges had this block.
+     * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and
+     * adds separate blocks for the supplementary PUAs.
+     *
+     * @stable ICU 2.0
+     */
+    UBLOCK_PRIVATE_USE_AREA =UBLOCK_PRIVATE_USE, /*[E000]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS =79, /*[F900]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_ALPHABETIC_PRESENTATION_FORMS =80, /*[FB00]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_ARABIC_PRESENTATION_FORMS_A =81, /*[FB50]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_COMBINING_HALF_MARKS =82, /*[FE20]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_CJK_COMPATIBILITY_FORMS =83, /*[FE30]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_SMALL_FORM_VARIANTS =84, /*[FE50]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_ARABIC_PRESENTATION_FORMS_B =85, /*[FE70]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_SPECIALS =86, /*[FFF0]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS =87, /*[FF00]*/
+
+    /* New blocks in Unicode 3.1 */
+
+    /** @stable ICU 2.0 */
+    UBLOCK_OLD_ITALIC = 88  , /*[10300]*/
+    /** @stable ICU 2.0 */
+    UBLOCK_GOTHIC = 89 , /*[10330]*/
+    /** @stable ICU 2.0 */
+    UBLOCK_DESERET = 90 , /*[10400]*/
+    /** @stable ICU 2.0 */
+    UBLOCK_BYZANTINE_MUSICAL_SYMBOLS = 91 , /*[1D000]*/
+    /** @stable ICU 2.0 */
+    UBLOCK_MUSICAL_SYMBOLS = 92 , /*[1D100]*/
+    /** @stable ICU 2.0 */
+    UBLOCK_MATHEMATICAL_ALPHANUMERIC_SYMBOLS = 93  , /*[1D400]*/
+    /** @stable ICU 2.0 */
+    UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B  = 94 , /*[20000]*/
+    /** @stable ICU 2.0 */
+    UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT = 95 , /*[2F800]*/
+    /** @stable ICU 2.0 */
+    UBLOCK_TAGS = 96, /*[E0000]*/
+
+    /* New blocks in Unicode 3.2 */
+
+    /**
+     * Unicode 4.0.1 renames the "Cyrillic Supplementary" block to "Cyrillic Supplement".
+     * @stable ICU 2.2
+     */
+    UBLOCK_CYRILLIC_SUPPLEMENTARY = 97, 
+    /** @stable ICU 3.0  */
+    UBLOCK_CYRILLIC_SUPPLEMENT = UBLOCK_CYRILLIC_SUPPLEMENTARY, /*[0500]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_TAGALOG = 98, /*[1700]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_HANUNOO = 99, /*[1720]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_BUHID = 100, /*[1740]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_TAGBANWA = 101, /*[1760]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A = 102, /*[27C0]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_SUPPLEMENTAL_ARROWS_A = 103, /*[27F0]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_SUPPLEMENTAL_ARROWS_B = 104, /*[2900]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B = 105, /*[2980]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_SUPPLEMENTAL_MATHEMATICAL_OPERATORS = 106, /*[2A00]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_KATAKANA_PHONETIC_EXTENSIONS = 107, /*[31F0]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_VARIATION_SELECTORS = 108, /*[FE00]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_A = 109, /*[F0000]*/
+    /** @stable ICU 2.2 */
+    UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B = 110, /*[100000]*/
+
+    /* New blocks in Unicode 4 */
+
+    /** @stable ICU 2.6 */
+    UBLOCK_LIMBU = 111, /*[1900]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_TAI_LE = 112, /*[1950]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_KHMER_SYMBOLS = 113, /*[19E0]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_PHONETIC_EXTENSIONS = 114, /*[1D00]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_MISCELLANEOUS_SYMBOLS_AND_ARROWS = 115, /*[2B00]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_YIJING_HEXAGRAM_SYMBOLS = 116, /*[4DC0]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_LINEAR_B_SYLLABARY = 117, /*[10000]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_LINEAR_B_IDEOGRAMS = 118, /*[10080]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_AEGEAN_NUMBERS = 119, /*[10100]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_UGARITIC = 120, /*[10380]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_SHAVIAN = 121, /*[10450]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_OSMANYA = 122, /*[10480]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_CYPRIOT_SYLLABARY = 123, /*[10800]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_TAI_XUAN_JING_SYMBOLS = 124, /*[1D300]*/
+    /** @stable ICU 2.6 */
+    UBLOCK_VARIATION_SELECTORS_SUPPLEMENT = 125, /*[E0100]*/
+
+    /* New blocks in Unicode 4.1 */
+
+    /** @stable ICU 3.4 */
+    UBLOCK_ANCIENT_GREEK_MUSICAL_NOTATION = 126, /*[1D200]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_ANCIENT_GREEK_NUMBERS = 127, /*[10140]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_ARABIC_SUPPLEMENT = 128, /*[0750]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_BUGINESE = 129, /*[1A00]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_CJK_STROKES = 130, /*[31C0]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT = 131, /*[1DC0]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_COPTIC = 132, /*[2C80]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_ETHIOPIC_EXTENDED = 133, /*[2D80]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_ETHIOPIC_SUPPLEMENT = 134, /*[1380]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_GEORGIAN_SUPPLEMENT = 135, /*[2D00]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_GLAGOLITIC = 136, /*[2C00]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_KHAROSHTHI = 137, /*[10A00]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_MODIFIER_TONE_LETTERS = 138, /*[A700]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_NEW_TAI_LUE = 139, /*[1980]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_OLD_PERSIAN = 140, /*[103A0]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_PHONETIC_EXTENSIONS_SUPPLEMENT = 141, /*[1D80]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_SUPPLEMENTAL_PUNCTUATION = 142, /*[2E00]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_SYLOTI_NAGRI = 143, /*[A800]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_TIFINAGH = 144, /*[2D30]*/
+    /** @stable ICU 3.4 */
+    UBLOCK_VERTICAL_FORMS = 145, /*[FE10]*/
+
+    /* New blocks in Unicode 5.0 */
+
+    /** @stable ICU 3.6 */
+    UBLOCK_NKO = 146, /*[07C0]*/
+    /** @stable ICU 3.6 */
+    UBLOCK_BALINESE = 147, /*[1B00]*/
+    /** @stable ICU 3.6 */
+    UBLOCK_LATIN_EXTENDED_C = 148, /*[2C60]*/
+    /** @stable ICU 3.6 */
+    UBLOCK_LATIN_EXTENDED_D = 149, /*[A720]*/
+    /** @stable ICU 3.6 */
+    UBLOCK_PHAGS_PA = 150, /*[A840]*/
+    /** @stable ICU 3.6 */
+    UBLOCK_PHOENICIAN = 151, /*[10900]*/
+    /** @stable ICU 3.6 */
+    UBLOCK_CUNEIFORM = 152, /*[12000]*/
+    /** @stable ICU 3.6 */
+    UBLOCK_CUNEIFORM_NUMBERS_AND_PUNCTUATION = 153, /*[12400]*/
+    /** @stable ICU 3.6 */
+    UBLOCK_COUNTING_ROD_NUMERALS = 154, /*[1D360]*/
+
+    /* New blocks in Unicode 5.1 */
+
+    /** @stable ICU 4.0 */
+    UBLOCK_SUNDANESE = 155, /*[1B80]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_LEPCHA = 156, /*[1C00]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_OL_CHIKI = 157, /*[1C50]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_CYRILLIC_EXTENDED_A = 158, /*[2DE0]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_VAI = 159, /*[A500]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_CYRILLIC_EXTENDED_B = 160, /*[A640]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_SAURASHTRA = 161, /*[A880]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_KAYAH_LI = 162, /*[A900]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_REJANG = 163, /*[A930]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_CHAM = 164, /*[AA00]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_ANCIENT_SYMBOLS = 165, /*[10190]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_PHAISTOS_DISC = 166, /*[101D0]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_LYCIAN = 167, /*[10280]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_CARIAN = 168, /*[102A0]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_LYDIAN = 169, /*[10920]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_MAHJONG_TILES = 170, /*[1F000]*/
+    /** @stable ICU 4.0 */
+    UBLOCK_DOMINO_TILES = 171, /*[1F030]*/
+
+    /* New blocks in Unicode 5.2 */
+
+    /** @stable ICU 4.4 */
+    UBLOCK_SAMARITAN = 172, /*[0800]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED = 173, /*[18B0]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_TAI_THAM = 174, /*[1A20]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_VEDIC_EXTENSIONS = 175, /*[1CD0]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_LISU = 176, /*[A4D0]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_BAMUM = 177, /*[A6A0]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_COMMON_INDIC_NUMBER_FORMS = 178, /*[A830]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_DEVANAGARI_EXTENDED = 179, /*[A8E0]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_HANGUL_JAMO_EXTENDED_A = 180, /*[A960]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_JAVANESE = 181, /*[A980]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_MYANMAR_EXTENDED_A = 182, /*[AA60]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_TAI_VIET = 183, /*[AA80]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_MEETEI_MAYEK = 184, /*[ABC0]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_HANGUL_JAMO_EXTENDED_B = 185, /*[D7B0]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_IMPERIAL_ARAMAIC = 186, /*[10840]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_OLD_SOUTH_ARABIAN = 187, /*[10A60]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_AVESTAN = 188, /*[10B00]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_INSCRIPTIONAL_PARTHIAN = 189, /*[10B40]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_INSCRIPTIONAL_PAHLAVI = 190, /*[10B60]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_OLD_TURKIC = 191, /*[10C00]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_RUMI_NUMERAL_SYMBOLS = 192, /*[10E60]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_KAITHI = 193, /*[11080]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_EGYPTIAN_HIEROGLYPHS = 194, /*[13000]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_ENCLOSED_ALPHANUMERIC_SUPPLEMENT = 195, /*[1F100]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT = 196, /*[1F200]*/
+    /** @stable ICU 4.4 */
+    UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C = 197, /*[2A700]*/
+
+    /* New blocks in Unicode 6.0 */
+
+    /** @stable ICU 4.6 */
+    UBLOCK_MANDAIC = 198, /*[0840]*/
+    /** @stable ICU 4.6 */
+    UBLOCK_BATAK = 199, /*[1BC0]*/
+    /** @stable ICU 4.6 */
+    UBLOCK_ETHIOPIC_EXTENDED_A = 200, /*[AB00]*/
+    /** @stable ICU 4.6 */
+    UBLOCK_BRAHMI = 201, /*[11000]*/
+    /** @stable ICU 4.6 */
+    UBLOCK_BAMUM_SUPPLEMENT = 202, /*[16800]*/
+    /** @stable ICU 4.6 */
+    UBLOCK_KANA_SUPPLEMENT = 203, /*[1B000]*/
+    /** @stable ICU 4.6 */
+    UBLOCK_PLAYING_CARDS = 204, /*[1F0A0]*/
+    /** @stable ICU 4.6 */
+    UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS = 205, /*[1F300]*/
+    /** @stable ICU 4.6 */
+    UBLOCK_EMOTICONS = 206, /*[1F600]*/
+    /** @stable ICU 4.6 */
+    UBLOCK_TRANSPORT_AND_MAP_SYMBOLS = 207, /*[1F680]*/
+    /** @stable ICU 4.6 */
+    UBLOCK_ALCHEMICAL_SYMBOLS = 208, /*[1F700]*/
+    /** @stable ICU 4.6 */
+    UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D = 209, /*[2B740]*/
+
+    /** @stable ICU 2.0 */
+    UBLOCK_COUNT = 210,
+
+    /** @stable ICU 2.0 */
+    UBLOCK_INVALID_CODE=-1
+};
+
+/** @stable ICU 2.0 */
+typedef enum UBlockCode UBlockCode;
+
+/**
+ * East Asian Width constants.
+ *
+ * @see UCHAR_EAST_ASIAN_WIDTH
+ * @see u_getIntPropertyValue
+ * @stable ICU 2.2
+ */
+typedef enum UEastAsianWidth {
+    U_EA_NEUTRAL,   /*[N]*/ /*See note !!*/
+    U_EA_AMBIGUOUS, /*[A]*/
+    U_EA_HALFWIDTH, /*[H]*/
+    U_EA_FULLWIDTH, /*[F]*/
+    U_EA_NARROW,    /*[Na]*/
+    U_EA_WIDE,      /*[W]*/
+    U_EA_COUNT
+} UEastAsianWidth;
+/*
+ * Implementation note:
+ * Keep UEastAsianWidth constant values in sync with names list in genprops/props2.c.
+ */
+
+/**
+ * Selector constants for u_charName().
+ * u_charName() returns the "modern" name of a
+ * Unicode character; or the name that was defined in
+ * Unicode version 1.0, before the Unicode standard merged
+ * with ISO-10646; or an "extended" name that gives each
+ * Unicode code point a unique name.
+ *
+ * @see u_charName
+ * @stable ICU 2.0
+ */
+typedef enum UCharNameChoice {
+    U_UNICODE_CHAR_NAME,
+    U_UNICODE_10_CHAR_NAME,
+    U_EXTENDED_CHAR_NAME,
+    U_CHAR_NAME_ALIAS,          /**< Corrected name from NameAliases.txt. @stable ICU 4.4 */
+    U_CHAR_NAME_CHOICE_COUNT
+} UCharNameChoice;
+
+/**
+ * Selector constants for u_getPropertyName() and
+ * u_getPropertyValueName().  These selectors are used to choose which
+ * name is returned for a given property or value.  All properties and
+ * values have a long name.  Most have a short name, but some do not.
+ * Unicode allows for additional names, beyond the long and short
+ * name, which would be indicated by U_LONG_PROPERTY_NAME + i, where
+ * i=1, 2,...
+ *
+ * @see u_getPropertyName()
+ * @see u_getPropertyValueName()
+ * @stable ICU 2.4
+ */
+typedef enum UPropertyNameChoice {
+    U_SHORT_PROPERTY_NAME,
+    U_LONG_PROPERTY_NAME,
+    U_PROPERTY_NAME_CHOICE_COUNT
+} UPropertyNameChoice;
+
+/**
+ * Decomposition Type constants.
+ *
+ * @see UCHAR_DECOMPOSITION_TYPE
+ * @stable ICU 2.2
+ */
+typedef enum UDecompositionType {
+    U_DT_NONE,              /*[none]*/ /*See note !!*/
+    U_DT_CANONICAL,         /*[can]*/
+    U_DT_COMPAT,            /*[com]*/
+    U_DT_CIRCLE,            /*[enc]*/
+    U_DT_FINAL,             /*[fin]*/
+    U_DT_FONT,              /*[font]*/
+    U_DT_FRACTION,          /*[fra]*/
+    U_DT_INITIAL,           /*[init]*/
+    U_DT_ISOLATED,          /*[iso]*/
+    U_DT_MEDIAL,            /*[med]*/
+    U_DT_NARROW,            /*[nar]*/
+    U_DT_NOBREAK,           /*[nb]*/
+    U_DT_SMALL,             /*[sml]*/
+    U_DT_SQUARE,            /*[sqr]*/
+    U_DT_SUB,               /*[sub]*/
+    U_DT_SUPER,             /*[sup]*/
+    U_DT_VERTICAL,          /*[vert]*/
+    U_DT_WIDE,              /*[wide]*/
+    U_DT_COUNT /* 18 */
+} UDecompositionType;
+
+/**
+ * Joining Type constants.
+ *
+ * @see UCHAR_JOINING_TYPE
+ * @stable ICU 2.2
+ */
+typedef enum UJoiningType {
+    U_JT_NON_JOINING,       /*[U]*/ /*See note !!*/
+    U_JT_JOIN_CAUSING,      /*[C]*/
+    U_JT_DUAL_JOINING,      /*[D]*/
+    U_JT_LEFT_JOINING,      /*[L]*/
+    U_JT_RIGHT_JOINING,     /*[R]*/
+    U_JT_TRANSPARENT,       /*[T]*/
+    U_JT_COUNT /* 6 */
+} UJoiningType;
+
+/**
+ * Joining Group constants.
+ *
+ * @see UCHAR_JOINING_GROUP
+ * @stable ICU 2.2
+ */
+typedef enum UJoiningGroup {
+    U_JG_NO_JOINING_GROUP,
+    U_JG_AIN,
+    U_JG_ALAPH,
+    U_JG_ALEF,
+    U_JG_BEH,
+    U_JG_BETH,
+    U_JG_DAL,
+    U_JG_DALATH_RISH,
+    U_JG_E,
+    U_JG_FEH,
+    U_JG_FINAL_SEMKATH,
+    U_JG_GAF,
+    U_JG_GAMAL,
+    U_JG_HAH,
+    U_JG_TEH_MARBUTA_GOAL,  /**< @stable ICU 4.6 */
+    U_JG_HAMZA_ON_HEH_GOAL=U_JG_TEH_MARBUTA_GOAL,
+    U_JG_HE,
+    U_JG_HEH,
+    U_JG_HEH_GOAL,
+    U_JG_HETH,
+    U_JG_KAF,
+    U_JG_KAPH,
+    U_JG_KNOTTED_HEH,
+    U_JG_LAM,
+    U_JG_LAMADH,
+    U_JG_MEEM,
+    U_JG_MIM,
+    U_JG_NOON,
+    U_JG_NUN,
+    U_JG_PE,
+    U_JG_QAF,
+    U_JG_QAPH,
+    U_JG_REH,
+    U_JG_REVERSED_PE,
+    U_JG_SAD,
+    U_JG_SADHE,
+    U_JG_SEEN,
+    U_JG_SEMKATH,
+    U_JG_SHIN,
+    U_JG_SWASH_KAF,
+    U_JG_SYRIAC_WAW,
+    U_JG_TAH,
+    U_JG_TAW,
+    U_JG_TEH_MARBUTA,
+    U_JG_TETH,
+    U_JG_WAW,
+    U_JG_YEH,
+    U_JG_YEH_BARREE,
+    U_JG_YEH_WITH_TAIL,
+    U_JG_YUDH,
+    U_JG_YUDH_HE,
+    U_JG_ZAIN,
+    U_JG_FE,        /**< @stable ICU 2.6 */
+    U_JG_KHAPH,     /**< @stable ICU 2.6 */
+    U_JG_ZHAIN,     /**< @stable ICU 2.6 */
+    U_JG_BURUSHASKI_YEH_BARREE, /**< @stable ICU 4.0 */
+    U_JG_FARSI_YEH, /**< @stable ICU 4.4 */
+    U_JG_NYA,       /**< @stable ICU 4.4 */
+    U_JG_COUNT
+} UJoiningGroup;
+
+/**
+ * Grapheme Cluster Break constants.
+ *
+ * @see UCHAR_GRAPHEME_CLUSTER_BREAK
+ * @stable ICU 3.4
+ */
+typedef enum UGraphemeClusterBreak {
+    U_GCB_OTHER = 0,            /*[XX]*/ /*See note !!*/
+    U_GCB_CONTROL = 1,          /*[CN]*/
+    U_GCB_CR = 2,               /*[CR]*/
+    U_GCB_EXTEND = 3,           /*[EX]*/
+    U_GCB_L = 4,                /*[L]*/
+    U_GCB_LF = 5,               /*[LF]*/
+    U_GCB_LV = 6,               /*[LV]*/
+    U_GCB_LVT = 7,              /*[LVT]*/
+    U_GCB_T = 8,                /*[T]*/
+    U_GCB_V = 9,                /*[V]*/
+    U_GCB_SPACING_MARK = 10,    /*[SM]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */
+    U_GCB_PREPEND = 11,         /*[PP]*/
+    U_GCB_COUNT = 12
+} UGraphemeClusterBreak;
+
+/**
+ * Word Break constants.
+ * (UWordBreak is a pre-existing enum type in ubrk.h for word break status tags.)
+ *
+ * @see UCHAR_WORD_BREAK
+ * @stable ICU 3.4
+ */
+typedef enum UWordBreakValues {
+    U_WB_OTHER = 0,             /*[XX]*/ /*See note !!*/
+    U_WB_ALETTER = 1,           /*[LE]*/
+    U_WB_FORMAT = 2,            /*[FO]*/
+    U_WB_KATAKANA = 3,          /*[KA]*/
+    U_WB_MIDLETTER = 4,         /*[ML]*/
+    U_WB_MIDNUM = 5,            /*[MN]*/
+    U_WB_NUMERIC = 6,           /*[NU]*/
+    U_WB_EXTENDNUMLET = 7,      /*[EX]*/
+    U_WB_CR = 8,                /*[CR]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */
+    U_WB_EXTEND = 9,            /*[Extend]*/
+    U_WB_LF = 10,               /*[LF]*/
+    U_WB_MIDNUMLET =11,         /*[MB]*/
+    U_WB_NEWLINE =12,           /*[NL]*/
+    U_WB_COUNT = 13
+} UWordBreakValues;
+
+/**
+ * Sentence Break constants.
+ *
+ * @see UCHAR_SENTENCE_BREAK
+ * @stable ICU 3.4
+ */
+typedef enum USentenceBreak {
+    U_SB_OTHER = 0,             /*[XX]*/ /*See note !!*/
+    U_SB_ATERM = 1,             /*[AT]*/
+    U_SB_CLOSE = 2,             /*[CL]*/
+    U_SB_FORMAT = 3,            /*[FO]*/
+    U_SB_LOWER = 4,             /*[LO]*/
+    U_SB_NUMERIC = 5,           /*[NU]*/
+    U_SB_OLETTER = 6,           /*[LE]*/
+    U_SB_SEP = 7,               /*[SE]*/
+    U_SB_SP = 8,                /*[SP]*/
+    U_SB_STERM = 9,             /*[ST]*/
+    U_SB_UPPER = 10,            /*[UP]*/
+    U_SB_CR = 11,               /*[CR]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */
+    U_SB_EXTEND = 12,           /*[EX]*/
+    U_SB_LF = 13,               /*[LF]*/
+    U_SB_SCONTINUE = 14,        /*[SC]*/
+    U_SB_COUNT = 15
+} USentenceBreak;
+
+/**
+ * Line Break constants.
+ *
+ * @see UCHAR_LINE_BREAK
+ * @stable ICU 2.2
+ */
+typedef enum ULineBreak {
+    U_LB_UNKNOWN = 0,           /*[XX]*/ /*See note !!*/
+    U_LB_AMBIGUOUS = 1,         /*[AI]*/
+    U_LB_ALPHABETIC = 2,        /*[AL]*/
+    U_LB_BREAK_BOTH = 3,        /*[B2]*/
+    U_LB_BREAK_AFTER = 4,       /*[BA]*/
+    U_LB_BREAK_BEFORE = 5,      /*[BB]*/
+    U_LB_MANDATORY_BREAK = 6,   /*[BK]*/
+    U_LB_CONTINGENT_BREAK = 7,  /*[CB]*/
+    U_LB_CLOSE_PUNCTUATION = 8, /*[CL]*/
+    U_LB_COMBINING_MARK = 9,    /*[CM]*/
+    U_LB_CARRIAGE_RETURN = 10,   /*[CR]*/
+    U_LB_EXCLAMATION = 11,       /*[EX]*/
+    U_LB_GLUE = 12,              /*[GL]*/
+    U_LB_HYPHEN = 13,            /*[HY]*/
+    U_LB_IDEOGRAPHIC = 14,       /*[ID]*/
+    U_LB_INSEPERABLE = 15,
+    /** Renamed from the misspelled "inseperable" in Unicode 4.0.1/ICU 3.0 @stable ICU 3.0 */
+    U_LB_INSEPARABLE=U_LB_INSEPERABLE,/*[IN]*/
+    U_LB_INFIX_NUMERIC = 16,     /*[IS]*/
+    U_LB_LINE_FEED = 17,         /*[LF]*/
+    U_LB_NONSTARTER = 18,        /*[NS]*/
+    U_LB_NUMERIC = 19,           /*[NU]*/
+    U_LB_OPEN_PUNCTUATION = 20,  /*[OP]*/
+    U_LB_POSTFIX_NUMERIC = 21,   /*[PO]*/
+    U_LB_PREFIX_NUMERIC = 22,    /*[PR]*/
+    U_LB_QUOTATION = 23,         /*[QU]*/
+    U_LB_COMPLEX_CONTEXT = 24,   /*[SA]*/
+    U_LB_SURROGATE = 25,         /*[SG]*/
+    U_LB_SPACE = 26,             /*[SP]*/
+    U_LB_BREAK_SYMBOLS = 27,     /*[SY]*/
+    U_LB_ZWSPACE = 28,           /*[ZW]*/
+    U_LB_NEXT_LINE = 29,         /*[NL]*/ /* from here on: new in Unicode 4/ICU 2.6 */
+    U_LB_WORD_JOINER = 30,       /*[WJ]*/
+    U_LB_H2 = 31,                /*[H2]*/ /* from here on: new in Unicode 4.1/ICU 3.4 */
+    U_LB_H3 = 32,                /*[H3]*/
+    U_LB_JL = 33,                /*[JL]*/
+    U_LB_JT = 34,                /*[JT]*/
+    U_LB_JV = 35,                /*[JV]*/
+    U_LB_CLOSE_PARENTHESIS = 36, /*[CP]*/ /* new in Unicode 5.2/ICU 4.4 */
+    U_LB_COUNT = 37
+} ULineBreak;
+
+/**
+ * Numeric Type constants.
+ *
+ * @see UCHAR_NUMERIC_TYPE
+ * @stable ICU 2.2
+ */
+typedef enum UNumericType {
+    U_NT_NONE,              /*[None]*/ /*See note !!*/
+    U_NT_DECIMAL,           /*[de]*/
+    U_NT_DIGIT,             /*[di]*/
+    U_NT_NUMERIC,           /*[nu]*/
+    U_NT_COUNT
+} UNumericType;
+
+/**
+ * Hangul Syllable Type constants.
+ *
+ * @see UCHAR_HANGUL_SYLLABLE_TYPE
+ * @stable ICU 2.6
+ */
+typedef enum UHangulSyllableType {
+    U_HST_NOT_APPLICABLE,   /*[NA]*/ /*See note !!*/
+    U_HST_LEADING_JAMO,     /*[L]*/
+    U_HST_VOWEL_JAMO,       /*[V]*/
+    U_HST_TRAILING_JAMO,    /*[T]*/
+    U_HST_LV_SYLLABLE,      /*[LV]*/
+    U_HST_LVT_SYLLABLE,     /*[LVT]*/
+    U_HST_COUNT
+} UHangulSyllableType;
+
+/**
+ * Check a binary Unicode property for a code point.
+ *
+ * Unicode, especially in version 3.2, defines many more properties than the
+ * original set in UnicodeData.txt.
+ *
+ * The properties APIs are intended to reflect Unicode properties as defined
+ * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR).
+ * For details about the properties see http://www.unicode.org/ucd/ .
+ * For names of Unicode properties see the UCD file PropertyAliases.txt.
+ *
+ * Important: If ICU is built with UCD files from Unicode versions below 3.2,
+ * then properties marked with "new in Unicode 3.2" are not or not fully available.
+ *
+ * @param c Code point to test.
+ * @param which UProperty selector constant, identifies which binary property to check.
+ *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT.
+ * @return TRUE or FALSE according to the binary Unicode property value for c.
+ *         Also FALSE if 'which' is out of bounds or if the Unicode version
+ *         does not have data for the property at all, or not for this code point.
+ *
+ * @see UProperty
+ * @see u_getIntPropertyValue
+ * @see u_getUnicodeVersion
+ * @stable ICU 2.1
+ */
+U_STABLE UBool U_EXPORT2
+u_hasBinaryProperty(UChar32 c, UProperty which);
+
+/**
+ * Check if a code point has the Alphabetic Unicode property.
+ * Same as u_hasBinaryProperty(c, UCHAR_ALPHABETIC).
+ * This is different from u_isalpha!
+ * @param c Code point to test
+ * @return true if the code point has the Alphabetic Unicode property, false otherwise
+ *
+ * @see UCHAR_ALPHABETIC
+ * @see u_isalpha
+ * @see u_hasBinaryProperty
+ * @stable ICU 2.1
+ */
+U_STABLE UBool U_EXPORT2
+u_isUAlphabetic(UChar32 c);
+
+/**
+ * Check if a code point has the Lowercase Unicode property.
+ * Same as u_hasBinaryProperty(c, UCHAR_LOWERCASE).
+ * This is different from u_islower!
+ * @param c Code point to test
+ * @return true if the code point has the Lowercase Unicode property, false otherwise
+ *
+ * @see UCHAR_LOWERCASE
+ * @see u_islower
+ * @see u_hasBinaryProperty
+ * @stable ICU 2.1
+ */
+U_STABLE UBool U_EXPORT2
+u_isULowercase(UChar32 c);
+
+/**
+ * Check if a code point has the Uppercase Unicode property.
+ * Same as u_hasBinaryProperty(c, UCHAR_UPPERCASE).
+ * This is different from u_isupper!
+ * @param c Code point to test
+ * @return true if the code point has the Uppercase Unicode property, false otherwise
+ *
+ * @see UCHAR_UPPERCASE
+ * @see u_isupper
+ * @see u_hasBinaryProperty
+ * @stable ICU 2.1
+ */
+U_STABLE UBool U_EXPORT2
+u_isUUppercase(UChar32 c);
+
+/**
+ * Check if a code point has the White_Space Unicode property.
+ * Same as u_hasBinaryProperty(c, UCHAR_WHITE_SPACE).
+ * This is different from both u_isspace and u_isWhitespace!
+ *
+ * Note: There are several ICU whitespace functions; please see the uchar.h
+ * file documentation for a detailed comparison.
+ *
+ * @param c Code point to test
+ * @return true if the code point has the White_Space Unicode property, false otherwise.
+ *
+ * @see UCHAR_WHITE_SPACE
+ * @see u_isWhitespace
+ * @see u_isspace
+ * @see u_isJavaSpaceChar
+ * @see u_hasBinaryProperty
+ * @stable ICU 2.1
+ */
+U_STABLE UBool U_EXPORT2
+u_isUWhiteSpace(UChar32 c);
+
+/**
+ * Get the property value for an enumerated or integer Unicode property for a code point.
+ * Also returns binary and mask property values.
+ *
+ * Unicode, especially in version 3.2, defines many more properties than the
+ * original set in UnicodeData.txt.
+ *
+ * The properties APIs are intended to reflect Unicode properties as defined
+ * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR).
+ * For details about the properties see http://www.unicode.org/ .
+ * For names of Unicode properties see the UCD file PropertyAliases.txt.
+ *
+ * Sample usage:
+ * UEastAsianWidth ea=(UEastAsianWidth)u_getIntPropertyValue(c, UCHAR_EAST_ASIAN_WIDTH);
+ * UBool b=(UBool)u_getIntPropertyValue(c, UCHAR_IDEOGRAPHIC);
+ *
+ * @param c Code point to test.
+ * @param which UProperty selector constant, identifies which property to check.
+ *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
+ *        or UCHAR_INT_START<=which<UCHAR_INT_LIMIT
+ *        or UCHAR_MASK_START<=which<UCHAR_MASK_LIMIT.
+ * @return Numeric value that is directly the property value or,
+ *         for enumerated properties, corresponds to the numeric value of the enumerated
+ *         constant of the respective property value enumeration type
+ *         (cast to enum type if necessary).
+ *         Returns 0 or 1 (for FALSE/TRUE) for binary Unicode properties.
+ *         Returns a bit-mask for mask properties.
+ *         Returns 0 if 'which' is out of bounds or if the Unicode version
+ *         does not have data for the property at all, or not for this code point.
+ *
+ * @see UProperty
+ * @see u_hasBinaryProperty
+ * @see u_getIntPropertyMinValue
+ * @see u_getIntPropertyMaxValue
+ * @see u_getUnicodeVersion
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_getIntPropertyValue(UChar32 c, UProperty which);
+
+/**
+ * Get the minimum value for an enumerated/integer/binary Unicode property.
+ * Can be used together with u_getIntPropertyMaxValue
+ * to allocate arrays of UnicodeSet or similar.
+ *
+ * @param which UProperty selector constant, identifies which binary property to check.
+ *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
+ *        or UCHAR_INT_START<=which<UCHAR_INT_LIMIT.
+ * @return Minimum value returned by u_getIntPropertyValue for a Unicode property.
+ *         0 if the property selector is out of range.
+ *
+ * @see UProperty
+ * @see u_hasBinaryProperty
+ * @see u_getUnicodeVersion
+ * @see u_getIntPropertyMaxValue
+ * @see u_getIntPropertyValue
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_getIntPropertyMinValue(UProperty which);
+
+/**
+ * Get the maximum value for an enumerated/integer/binary Unicode property.
+ * Can be used together with u_getIntPropertyMinValue
+ * to allocate arrays of UnicodeSet or similar.
+ *
+ * Examples for min/max values (for Unicode 3.2):
+ *
+ * - UCHAR_BIDI_CLASS:    0/18 (U_LEFT_TO_RIGHT/U_BOUNDARY_NEUTRAL)
+ * - UCHAR_SCRIPT:        0/45 (USCRIPT_COMMON/USCRIPT_TAGBANWA)
+ * - UCHAR_IDEOGRAPHIC:   0/1  (FALSE/TRUE)
+ *
+ * For undefined UProperty constant values, min/max values will be 0/-1.
+ *
+ * @param which UProperty selector constant, identifies which binary property to check.
+ *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
+ *        or UCHAR_INT_START<=which<UCHAR_INT_LIMIT.
+ * @return Maximum value returned by u_getIntPropertyValue for a Unicode property.
+ *         <=0 if the property selector is out of range.
+ *
+ * @see UProperty
+ * @see u_hasBinaryProperty
+ * @see u_getUnicodeVersion
+ * @see u_getIntPropertyMaxValue
+ * @see u_getIntPropertyValue
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_getIntPropertyMaxValue(UProperty which);
+
+/**
+ * Get the numeric value for a Unicode code point as defined in the
+ * Unicode Character Database.
+ *
+ * A "double" return type is necessary because
+ * some numeric values are fractions, negative, or too large for int32_t.
+ *
+ * For characters without any numeric values in the Unicode Character Database,
+ * this function will return U_NO_NUMERIC_VALUE.
+ *
+ * Similar to java.lang.Character.getNumericValue(), but u_getNumericValue()
+ * also supports negative values, large values, and fractions,
+ * while Java's getNumericValue() returns values 10..35 for ASCII letters.
+ *
+ * @param c Code point to get the numeric value for.
+ * @return Numeric value of c, or U_NO_NUMERIC_VALUE if none is defined.
+ *
+ * @see U_NO_NUMERIC_VALUE
+ * @stable ICU 2.2
+ */
+U_STABLE double U_EXPORT2
+u_getNumericValue(UChar32 c);
+
+/**
+ * Special value that is returned by u_getNumericValue when
+ * no numeric value is defined for a code point.
+ *
+ * @see u_getNumericValue
+ * @stable ICU 2.2
+ */
+#define U_NO_NUMERIC_VALUE ((double)-123456789.)
+
+/**
+ * Determines whether the specified code point has the general category "Ll"
+ * (lowercase letter).
+ *
+ * Same as java.lang.Character.isLowerCase().
+ *
+ * This misses some characters that are also lowercase but
+ * have a different general category value.
+ * In order to include those, use UCHAR_LOWERCASE.
+ *
+ * In addition to being equivalent to a Java function, this also serves
+ * as a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is an Ll lowercase letter
+ *
+ * @see UCHAR_LOWERCASE
+ * @see u_isupper
+ * @see u_istitle
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_islower(UChar32 c);
+
+/**
+ * Determines whether the specified code point has the general category "Lu"
+ * (uppercase letter).
+ *
+ * Same as java.lang.Character.isUpperCase().
+ *
+ * This misses some characters that are also uppercase but
+ * have a different general category value.
+ * In order to include those, use UCHAR_UPPERCASE.
+ *
+ * In addition to being equivalent to a Java function, this also serves
+ * as a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is an Lu uppercase letter
+ *
+ * @see UCHAR_UPPERCASE
+ * @see u_islower
+ * @see u_istitle
+ * @see u_tolower
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isupper(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a titlecase letter.
+ * True for general category "Lt" (titlecase letter).
+ *
+ * Same as java.lang.Character.isTitleCase().
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is an Lt titlecase letter
+ *
+ * @see u_isupper
+ * @see u_islower
+ * @see u_totitle
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_istitle(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a digit character according to Java.
+ * True for characters with general category "Nd" (decimal digit numbers).
+ * Beginning with Unicode 4, this is the same as
+ * testing for the Numeric_Type of Decimal.
+ *
+ * Same as java.lang.Character.isDigit().
+ *
+ * In addition to being equivalent to a Java function, this also serves
+ * as a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a digit character according to Character.isDigit()
+ *
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isdigit(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a letter character.
+ * True for general categories "L" (letters).
+ *
+ * Same as java.lang.Character.isLetter().
+ *
+ * In addition to being equivalent to a Java function, this also serves
+ * as a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a letter character
+ *
+ * @see u_isdigit
+ * @see u_isalnum
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isalpha(UChar32 c);
+
+/**
+ * Determines whether the specified code point is an alphanumeric character
+ * (letter or digit) according to Java.
+ * True for characters with general categories
+ * "L" (letters) and "Nd" (decimal digit numbers).
+ *
+ * Same as java.lang.Character.isLetterOrDigit().
+ *
+ * In addition to being equivalent to a Java function, this also serves
+ * as a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is an alphanumeric character according to Character.isLetterOrDigit()
+ *
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isalnum(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a hexadecimal digit.
+ * This is equivalent to u_digit(c, 16)>=0.
+ * True for characters with general category "Nd" (decimal digit numbers)
+ * as well as Latin letters a-f and A-F in both ASCII and Fullwidth ASCII.
+ * (That is, for letters with code points
+ * 0041..0046, 0061..0066, FF21..FF26, FF41..FF46.)
+ *
+ * In order to narrow the definition of hexadecimal digits to only ASCII
+ * characters, use (c<=0x7f && u_isxdigit(c)).
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a hexadecimal digit
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_isxdigit(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a punctuation character.
+ * True for characters with general categories "P" (punctuation).
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a punctuation character
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_ispunct(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a "graphic" character
+ * (printable, excluding spaces).
+ * TRUE for all characters except those with general categories
+ * "Cc" (control codes), "Cf" (format controls), "Cs" (surrogates),
+ * "Cn" (unassigned), and "Z" (separators).
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a "graphic" character
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_isgraph(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a "blank" or "horizontal space",
+ * a character that visibly separates words on a line.
+ * The following are equivalent definitions:
+ *
+ * TRUE for Unicode White_Space characters except for "vertical space controls"
+ * where "vertical space controls" are the following characters:
+ * U+000A (LF) U+000B (VT) U+000C (FF) U+000D (CR) U+0085 (NEL) U+2028 (LS) U+2029 (PS)
+ *
+ * same as
+ *
+ * TRUE for U+0009 (TAB) and characters with general category "Zs" (space separators)
+ * except Zero Width Space (ZWSP, U+200B).
+ *
+ * Note: There are several ICU whitespace functions; please see the uchar.h
+ * file documentation for a detailed comparison.
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a "blank"
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_isblank(UChar32 c);
+
+/**
+ * Determines whether the specified code point is "defined",
+ * which usually means that it is assigned a character.
+ * True for general categories other than "Cn" (other, not assigned),
+ * i.e., true for all code points mentioned in UnicodeData.txt.
+ *
+ * Note that non-character code points (e.g., U+FDD0) are not "defined"
+ * (they are Cn), but surrogate code points are "defined" (Cs).
+ *
+ * Same as java.lang.Character.isDefined().
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is assigned a character
+ *
+ * @see u_isdigit
+ * @see u_isalpha
+ * @see u_isalnum
+ * @see u_isupper
+ * @see u_islower
+ * @see u_istitle
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isdefined(UChar32 c);
+
+/**
+ * Determines if the specified character is a space character or not.
+ *
+ * Note: There are several ICU whitespace functions; please see the uchar.h
+ * file documentation for a detailed comparison.
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c    the character to be tested
+ * @return  true if the character is a space character; false otherwise.
+ *
+ * @see u_isJavaSpaceChar
+ * @see u_isWhitespace
+ * @see u_isUWhiteSpace
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isspace(UChar32 c);
+
+/**
+ * Determine if the specified code point is a space character according to Java.
+ * True for characters with general categories "Z" (separators),
+ * which does not include control codes (e.g., TAB or Line Feed).
+ *
+ * Same as java.lang.Character.isSpaceChar().
+ *
+ * Note: There are several ICU whitespace functions; please see the uchar.h
+ * file documentation for a detailed comparison.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a space character according to Character.isSpaceChar()
+ *
+ * @see u_isspace
+ * @see u_isWhitespace
+ * @see u_isUWhiteSpace
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_isJavaSpaceChar(UChar32 c);
+
+/**
+ * Determines if the specified code point is a whitespace character according to Java/ICU.
+ * A character is considered to be a Java whitespace character if and only
+ * if it satisfies one of the following criteria:
+ *
+ * - It is a Unicode Separator character (categories "Z" = "Zs" or "Zl" or "Zp"), but is not
+ *      also a non-breaking space (U+00A0 NBSP or U+2007 Figure Space or U+202F Narrow NBSP).
+ * - It is U+0009 HORIZONTAL TABULATION.
+ * - It is U+000A LINE FEED.
+ * - It is U+000B VERTICAL TABULATION.
+ * - It is U+000C FORM FEED.
+ * - It is U+000D CARRIAGE RETURN.
+ * - It is U+001C FILE SEPARATOR.
+ * - It is U+001D GROUP SEPARATOR.
+ * - It is U+001E RECORD SEPARATOR.
+ * - It is U+001F UNIT SEPARATOR.
+ *
+ * This API tries to sync with the semantics of Java's
+ * java.lang.Character.isWhitespace(), but it may not return
+ * the exact same results because of the Unicode version
+ * difference.
+ *
+ * Note: Unicode 4.0.1 changed U+200B ZERO WIDTH SPACE from a Space Separator (Zs)
+ * to a Format Control (Cf). Since then, isWhitespace(0x200b) returns false.
+ * See http://www.unicode.org/versions/Unicode4.0.1/
+ *
+ * Note: There are several ICU whitespace functions; please see the uchar.h
+ * file documentation for a detailed comparison.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a whitespace character according to Java/ICU
+ *
+ * @see u_isspace
+ * @see u_isJavaSpaceChar
+ * @see u_isUWhiteSpace
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isWhitespace(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a control character
+ * (as defined by this function).
+ * A control character is one of the following:
+ * - ISO 8-bit control character (U+0000..U+001f and U+007f..U+009f)
+ * - U_CONTROL_CHAR (Cc)
+ * - U_FORMAT_CHAR (Cf)
+ * - U_LINE_SEPARATOR (Zl)
+ * - U_PARAGRAPH_SEPARATOR (Zp)
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a control character
+ *
+ * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT
+ * @see u_isprint
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_iscntrl(UChar32 c);
+
+/**
+ * Determines whether the specified code point is an ISO control code.
+ * True for U+0000..U+001f and U+007f..U+009f (general category "Cc").
+ *
+ * Same as java.lang.Character.isISOControl().
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is an ISO control code
+ *
+ * @see u_iscntrl
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+u_isISOControl(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a printable character.
+ * True for general categories <em>other</em> than "C" (controls).
+ *
+ * This is a C/POSIX migration function.
+ * See the comments about C/POSIX character classification functions in the
+ * documentation at the top of this header file.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a printable character
+ *
+ * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT
+ * @see u_iscntrl
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isprint(UChar32 c);
+
+/**
+ * Determines whether the specified code point is a base character.
+ * True for general categories "L" (letters), "N" (numbers),
+ * "Mc" (spacing combining marks), and "Me" (enclosing marks).
+ *
+ * Note that this is different from the Unicode definition in
+ * chapter 3.5, conformance clause D13,
+ * which defines base characters to be all characters (not Cn)
+ * that do not graphically combine with preceding characters (M)
+ * and that are neither control (Cc) or format (Cf) characters.
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is a base character according to this function
+ *
+ * @see u_isalpha
+ * @see u_isdigit
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isbase(UChar32 c);
+
+/**
+ * Returns the bidirectional category value for the code point,
+ * which is used in the Unicode bidirectional algorithm
+ * (UAX #9 http://www.unicode.org/reports/tr9/).
+ * Note that some <em>unassigned</em> code points have bidi values
+ * of R or AL because they are in blocks that are reserved
+ * for Right-To-Left scripts.
+ *
+ * Same as java.lang.Character.getDirectionality()
+ *
+ * @param c the code point to be tested
+ * @return the bidirectional category (UCharDirection) value
+ *
+ * @see UCharDirection
+ * @stable ICU 2.0
+ */
+U_STABLE UCharDirection U_EXPORT2
+u_charDirection(UChar32 c);
+
+/**
+ * Determines whether the code point has the Bidi_Mirrored property.
+ * This property is set for characters that are commonly used in
+ * Right-To-Left contexts and need to be displayed with a "mirrored"
+ * glyph.
+ *
+ * Same as java.lang.Character.isMirrored().
+ * Same as UCHAR_BIDI_MIRRORED
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the character has the Bidi_Mirrored property
+ *
+ * @see UCHAR_BIDI_MIRRORED
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isMirrored(UChar32 c);
+
+/**
+ * Maps the specified character to a "mirror-image" character.
+ * For characters with the Bidi_Mirrored property, implementations
+ * sometimes need a "poor man's" mapping to another Unicode
+ * character (code point) such that the default glyph may serve
+ * as the mirror-image of the default glyph of the specified
+ * character. This is useful for text conversion to and from
+ * codepages with visual order, and for displays without glyph
+ * selecetion capabilities.
+ *
+ * @param c the code point to be mapped
+ * @return another Unicode code point that may serve as a mirror-image
+ *         substitute, or c itself if there is no such mapping or c
+ *         does not have the Bidi_Mirrored property
+ *
+ * @see UCHAR_BIDI_MIRRORED
+ * @see u_isMirrored
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_charMirror(UChar32 c);
+
+/**
+ * Returns the general category value for the code point.
+ *
+ * Same as java.lang.Character.getType().
+ *
+ * @param c the code point to be tested
+ * @return the general category (UCharCategory) value
+ *
+ * @see UCharCategory
+ * @stable ICU 2.0
+ */
+U_STABLE int8_t U_EXPORT2
+u_charType(UChar32 c);
+
+/**
+ * Get a single-bit bit set for the general category of a character.
+ * This bit set can be compared bitwise with U_GC_SM_MASK, U_GC_L_MASK, etc.
+ * Same as U_MASK(u_charType(c)).
+ *
+ * @param c the code point to be tested
+ * @return a single-bit mask corresponding to the general category (UCharCategory) value
+ *
+ * @see u_charType
+ * @see UCharCategory
+ * @see U_GC_CN_MASK
+ * @stable ICU 2.1
+ */
+#define U_GET_GC_MASK(c) U_MASK(u_charType(c))
+
+/**
+ * Callback from u_enumCharTypes(), is called for each contiguous range
+ * of code points c (where start<=c<limit)
+ * with the same Unicode general category ("character type").
+ *
+ * The callback function can stop the enumeration by returning FALSE.
+ *
+ * @param context an opaque pointer, as passed into utrie_enum()
+ * @param start the first code point in a contiguous range with value
+ * @param limit one past the last code point in a contiguous range with value
+ * @param type the general category for all code points in [start..limit[
+ * @return FALSE to stop the enumeration
+ *
+ * @stable ICU 2.1
+ * @see UCharCategory
+ * @see u_enumCharTypes
+ */
+typedef UBool U_CALLCONV
+UCharEnumTypeRange(const void *context, UChar32 start, UChar32 limit, UCharCategory type);
+
+/**
+ * Enumerate efficiently all code points with their Unicode general categories.
+ *
+ * This is useful for building data structures (e.g., UnicodeSet's),
+ * for enumerating all assigned code points (type!=U_UNASSIGNED), etc.
+ *
+ * For each contiguous range of code points with a given general category ("character type"),
+ * the UCharEnumTypeRange function is called.
+ * Adjacent ranges have different types.
+ * The Unicode Standard guarantees that the numeric value of the type is 0..31.
+ *
+ * @param enumRange a pointer to a function that is called for each contiguous range
+ *                  of code points with the same general category
+ * @param context an opaque pointer that is passed on to the callback function
+ *
+ * @stable ICU 2.1
+ * @see UCharCategory
+ * @see UCharEnumTypeRange
+ */
+U_STABLE void U_EXPORT2
+u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context);
+
+#if !UCONFIG_NO_NORMALIZATION
+
+/**
+ * Returns the combining class of the code point as specified in UnicodeData.txt.
+ *
+ * @param c the code point of the character
+ * @return the combining class of the character
+ * @stable ICU 2.0
+ */
+U_STABLE uint8_t U_EXPORT2
+u_getCombiningClass(UChar32 c);
+
+#endif
+
+/**
+ * Returns the decimal digit value of a decimal digit character.
+ * Such characters have the general category "Nd" (decimal digit numbers)
+ * and a Numeric_Type of Decimal.
+ *
+ * Unlike ICU releases before 2.6, no digit values are returned for any
+ * Han characters because Han number characters are often used with a special
+ * Chinese-style number format (with characters for powers of 10 in between)
+ * instead of in decimal-positional notation.
+ * Unicode 4 explicitly assigns Han number characters the Numeric_Type
+ * Numeric instead of Decimal.
+ * See Jitterbug 1483 for more details.
+ *
+ * Use u_getIntPropertyValue(c, UCHAR_NUMERIC_TYPE) and u_getNumericValue()
+ * for complete numeric Unicode properties.
+ *
+ * @param c the code point for which to get the decimal digit value
+ * @return the decimal digit value of c,
+ *         or -1 if c is not a decimal digit character
+ *
+ * @see u_getNumericValue
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_charDigitValue(UChar32 c);
+
+/**
+ * Returns the Unicode allocation block that contains the character.
+ *
+ * @param c the code point to be tested
+ * @return the block value (UBlockCode) for c
+ *
+ * @see UBlockCode
+ * @stable ICU 2.0
+ */
+U_STABLE UBlockCode U_EXPORT2
+ublock_getCode(UChar32 c);
+
+/**
+ * Retrieve the name of a Unicode character.
+ * Depending on <code>nameChoice</code>, the character name written
+ * into the buffer is the "modern" name or the name that was defined
+ * in Unicode version 1.0.
+ * The name contains only "invariant" characters
+ * like A-Z, 0-9, space, and '-'.
+ * Unicode 1.0 names are only retrieved if they are different from the modern
+ * names and if the data file contains the data for them. gennames may or may
+ * not be called with a command line option to include 1.0 names in unames.dat.
+ *
+ * @param code The character (code point) for which to get the name.
+ *             It must be <code>0<=code<=0x10ffff</code>.
+ * @param nameChoice Selector for which name to get.
+ * @param buffer Destination address for copying the name.
+ *               The name will always be zero-terminated.
+ *               If there is no name, then the buffer will be set to the empty string.
+ * @param bufferLength <code>==sizeof(buffer)</code>
+ * @param pErrorCode Pointer to a UErrorCode variable;
+ *        check for <code>U_SUCCESS()</code> after <code>u_charName()</code>
+ *        returns.
+ * @return The length of the name, or 0 if there is no name for this character.
+ *         If the bufferLength is less than or equal to the length, then the buffer
+ *         contains the truncated name and the returned length indicates the full
+ *         length of the name.
+ *         The length does not include the zero-termination.
+ *
+ * @see UCharNameChoice
+ * @see u_charFromName
+ * @see u_enumCharNames
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_charName(UChar32 code, UCharNameChoice nameChoice,
+           char *buffer, int32_t bufferLength,
+           UErrorCode *pErrorCode);
+
+/**
+ * Get the ISO 10646 comment for a character.
+ * The ISO 10646 comment is an informative field in the Unicode Character
+ * Database (UnicodeData.txt field 11) and is from the ISO 10646 names list.
+ *
+ * Note: Unicode 5.2 removes all ISO comment data, resulting in empty strings
+ * returned for all characters.
+ *
+ * @param c The character (code point) for which to get the ISO comment.
+ *             It must be <code>0<=c<=0x10ffff</code>.
+ * @param dest Destination address for copying the comment.
+ *             The comment will be zero-terminated if possible.
+ *             If there is no comment, then the buffer will be set to the empty string.
+ * @param destCapacity <code>==sizeof(dest)</code>
+ * @param pErrorCode Pointer to a UErrorCode variable;
+ *        check for <code>U_SUCCESS()</code> after <code>u_getISOComment()</code>
+ *        returns.
+ * @return The length of the comment, or 0 if there is no comment for this character.
+ *         If the destCapacity is less than or equal to the length, then the buffer
+ *         contains the truncated name and the returned length indicates the full
+ *         length of the name.
+ *         The length does not include the zero-termination.
+ *
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_getISOComment(UChar32 c,
+                char *dest, int32_t destCapacity,
+                UErrorCode *pErrorCode);
+
+/**
+ * Find a Unicode character by its name and return its code point value.
+ * The name is matched exactly and completely.
+ * If the name does not correspond to a code point, <i>pErrorCode</i>
+ * is set to <code>U_INVALID_CHAR_FOUND</code>.
+ * A Unicode 1.0 name is matched only if it differs from the modern name.
+ * Unicode names are all uppercase. Extended names are lowercase followed
+ * by an uppercase hexadecimal number, and within angle brackets.
+ *
+ * @param nameChoice Selector for which name to match.
+ * @param name The name to match.
+ * @param pErrorCode Pointer to a UErrorCode variable
+ * @return The Unicode value of the code point with the given name,
+ *         or an undefined value if there is no such code point.
+ *
+ * @see UCharNameChoice
+ * @see u_charName
+ * @see u_enumCharNames
+ * @stable ICU 1.7
+ */
+U_STABLE UChar32 U_EXPORT2
+u_charFromName(UCharNameChoice nameChoice,
+               const char *name,
+               UErrorCode *pErrorCode);
+
+/**
+ * Type of a callback function for u_enumCharNames() that gets called
+ * for each Unicode character with the code point value and
+ * the character name.
+ * If such a function returns FALSE, then the enumeration is stopped.
+ *
+ * @param context The context pointer that was passed to u_enumCharNames().
+ * @param code The Unicode code point for the character with this name.
+ * @param nameChoice Selector for which kind of names is enumerated.
+ * @param name The character's name, zero-terminated.
+ * @param length The length of the name.
+ * @return TRUE if the enumeration should continue, FALSE to stop it.
+ *
+ * @see UCharNameChoice
+ * @see u_enumCharNames
+ * @stable ICU 1.7
+ */
+typedef UBool U_CALLCONV UEnumCharNamesFn(void *context,
+                               UChar32 code,
+                               UCharNameChoice nameChoice,
+                               const char *name,
+                               int32_t length);
+
+/**
+ * Enumerate all assigned Unicode characters between the start and limit
+ * code points (start inclusive, limit exclusive) and call a function
+ * for each, passing the code point value and the character name.
+ * For Unicode 1.0 names, only those are enumerated that differ from the
+ * modern names.
+ *
+ * @param start The first code point in the enumeration range.
+ * @param limit One more than the last code point in the enumeration range
+ *              (the first one after the range).
+ * @param fn The function that is to be called for each character name.
+ * @param context An arbitrary pointer that is passed to the function.
+ * @param nameChoice Selector for which kind of names to enumerate.
+ * @param pErrorCode Pointer to a UErrorCode variable
+ *
+ * @see UCharNameChoice
+ * @see UEnumCharNamesFn
+ * @see u_charName
+ * @see u_charFromName
+ * @stable ICU 1.7
+ */
+U_STABLE void U_EXPORT2
+u_enumCharNames(UChar32 start, UChar32 limit,
+                UEnumCharNamesFn *fn,
+                void *context,
+                UCharNameChoice nameChoice,
+                UErrorCode *pErrorCode);
+
+/**
+ * Return the Unicode name for a given property, as given in the
+ * Unicode database file PropertyAliases.txt.
+ *
+ * In addition, this function maps the property
+ * UCHAR_GENERAL_CATEGORY_MASK to the synthetic names "gcm" /
+ * "General_Category_Mask".  These names are not in
+ * PropertyAliases.txt.
+ *
+ * @param property UProperty selector other than UCHAR_INVALID_CODE.
+ *         If out of range, NULL is returned.
+ *
+ * @param nameChoice selector for which name to get.  If out of range,
+ *         NULL is returned.  All properties have a long name.  Most
+ *         have a short name, but some do not.  Unicode allows for
+ *         additional names; if present these will be returned by
+ *         U_LONG_PROPERTY_NAME + i, where i=1, 2,...
+ *
+ * @return a pointer to the name, or NULL if either the
+ *         property or the nameChoice is out of range.  If a given
+ *         nameChoice returns NULL, then all larger values of
+ *         nameChoice will return NULL, with one exception: if NULL is
+ *         returned for U_SHORT_PROPERTY_NAME, then
+ *         U_LONG_PROPERTY_NAME (and higher) may still return a
+ *         non-NULL value.  The returned pointer is valid until
+ *         u_cleanup() is called.
+ *
+ * @see UProperty
+ * @see UPropertyNameChoice
+ * @stable ICU 2.4
+ */
+U_STABLE const char* U_EXPORT2
+u_getPropertyName(UProperty property,
+                  UPropertyNameChoice nameChoice);
+
+/**
+ * Return the UProperty enum for a given property name, as specified
+ * in the Unicode database file PropertyAliases.txt.  Short, long, and
+ * any other variants are recognized.
+ *
+ * In addition, this function maps the synthetic names "gcm" /
+ * "General_Category_Mask" to the property
+ * UCHAR_GENERAL_CATEGORY_MASK.  These names are not in
+ * PropertyAliases.txt.
+ *
+ * @param alias the property name to be matched.  The name is compared
+ *         using "loose matching" as described in PropertyAliases.txt.
+ *
+ * @return a UProperty enum, or UCHAR_INVALID_CODE if the given name
+ *         does not match any property.
+ *
+ * @see UProperty
+ * @stable ICU 2.4
+ */
+U_STABLE UProperty U_EXPORT2
+u_getPropertyEnum(const char* alias);
+
+/**
+ * Return the Unicode name for a given property value, as given in the
+ * Unicode database file PropertyValueAliases.txt.
+ *
+ * Note: Some of the names in PropertyValueAliases.txt can only be
+ * retrieved using UCHAR_GENERAL_CATEGORY_MASK, not
+ * UCHAR_GENERAL_CATEGORY.  These include: "C" / "Other", "L" /
+ * "Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P"
+ * / "Punctuation", "S" / "Symbol", and "Z" / "Separator".
+ *
+ * @param property UProperty selector constant.
+ *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
+ *        or UCHAR_INT_START<=which<UCHAR_INT_LIMIT
+ *        or UCHAR_MASK_START<=which<UCHAR_MASK_LIMIT.
+ *        If out of range, NULL is returned.
+ *
+ * @param value selector for a value for the given property.  If out
+ *         of range, NULL is returned.  In general, valid values range
+ *         from 0 up to some maximum.  There are a few exceptions:
+ *         (1.) UCHAR_BLOCK values begin at the non-zero value
+ *         UBLOCK_BASIC_LATIN.  (2.)  UCHAR_CANONICAL_COMBINING_CLASS
+ *         values are not contiguous and range from 0..240.  (3.)
+ *         UCHAR_GENERAL_CATEGORY_MASK values are not values of
+ *         UCharCategory, but rather mask values produced by
+ *         U_GET_GC_MASK().  This allows grouped categories such as
+ *         [:L:] to be represented.  Mask values range
+ *         non-contiguously from 1..U_GC_P_MASK.
+ *
+ * @param nameChoice selector for which name to get.  If out of range,
+ *         NULL is returned.  All values have a long name.  Most have
+ *         a short name, but some do not.  Unicode allows for
+ *         additional names; if present these will be returned by
+ *         U_LONG_PROPERTY_NAME + i, where i=1, 2,...
+
+ * @return a pointer to the name, or NULL if either the
+ *         property or the nameChoice is out of range.  If a given
+ *         nameChoice returns NULL, then all larger values of
+ *         nameChoice will return NULL, with one exception: if NULL is
+ *         returned for U_SHORT_PROPERTY_NAME, then
+ *         U_LONG_PROPERTY_NAME (and higher) may still return a
+ *         non-NULL value.  The returned pointer is valid until
+ *         u_cleanup() is called.
+ *
+ * @see UProperty
+ * @see UPropertyNameChoice
+ * @stable ICU 2.4
+ */
+U_STABLE const char* U_EXPORT2
+u_getPropertyValueName(UProperty property,
+                       int32_t value,
+                       UPropertyNameChoice nameChoice);
+
+/**
+ * Return the property value integer for a given value name, as
+ * specified in the Unicode database file PropertyValueAliases.txt.
+ * Short, long, and any other variants are recognized.
+ *
+ * Note: Some of the names in PropertyValueAliases.txt will only be
+ * recognized with UCHAR_GENERAL_CATEGORY_MASK, not
+ * UCHAR_GENERAL_CATEGORY.  These include: "C" / "Other", "L" /
+ * "Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P"
+ * / "Punctuation", "S" / "Symbol", and "Z" / "Separator".
+ *
+ * @param property UProperty selector constant.
+ *        Must be UCHAR_BINARY_START<=which<UCHAR_BINARY_LIMIT
+ *        or UCHAR_INT_START<=which<UCHAR_INT_LIMIT
+ *        or UCHAR_MASK_START<=which<UCHAR_MASK_LIMIT.
+ *        If out of range, UCHAR_INVALID_CODE is returned.
+ *
+ * @param alias the value name to be matched.  The name is compared
+ *         using "loose matching" as described in
+ *         PropertyValueAliases.txt.
+ *
+ * @return a value integer or UCHAR_INVALID_CODE if the given name
+ *         does not match any value of the given property, or if the
+ *         property is invalid.  Note: UCHAR_GENERAL_CATEGORY_MASK values
+ *         are not values of UCharCategory, but rather mask values
+ *         produced by U_GET_GC_MASK().  This allows grouped
+ *         categories such as [:L:] to be represented.
+ *
+ * @see UProperty
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+u_getPropertyValueEnum(UProperty property,
+                       const char* alias);
+
+/**
+ * Determines if the specified character is permissible as the
+ * first character in an identifier according to Unicode
+ * (The Unicode Standard, Version 3.0, chapter 5.16 Identifiers).
+ * True for characters with general categories "L" (letters) and "Nl" (letter numbers).
+ *
+ * Same as java.lang.Character.isUnicodeIdentifierStart().
+ * Same as UCHAR_ID_START
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point may start an identifier
+ *
+ * @see UCHAR_ID_START
+ * @see u_isalpha
+ * @see u_isIDPart
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isIDStart(UChar32 c);
+
+/**
+ * Determines if the specified character is permissible
+ * in an identifier according to Java.
+ * True for characters with general categories "L" (letters),
+ * "Nl" (letter numbers), "Nd" (decimal digits),
+ * "Mc" and "Mn" (combining marks), "Pc" (connecting punctuation), and
+ * u_isIDIgnorable(c).
+ *
+ * Same as java.lang.Character.isUnicodeIdentifierPart().
+ * Almost the same as Unicode's ID_Continue (UCHAR_ID_CONTINUE)
+ * except that Unicode recommends to ignore Cf which is less than
+ * u_isIDIgnorable(c).
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point may occur in an identifier according to Java
+ *
+ * @see UCHAR_ID_CONTINUE
+ * @see u_isIDStart
+ * @see u_isIDIgnorable
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isIDPart(UChar32 c);
+
+/**
+ * Determines if the specified character should be regarded
+ * as an ignorable character in an identifier,
+ * according to Java.
+ * True for characters with general category "Cf" (format controls) as well as
+ * non-whitespace ISO controls
+ * (U+0000..U+0008, U+000E..U+001B, U+007F..U+009F).
+ *
+ * Same as java.lang.Character.isIdentifierIgnorable().
+ *
+ * Note that Unicode just recommends to ignore Cf (format controls).
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point is ignorable in identifiers according to Java
+ *
+ * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT
+ * @see u_isIDStart
+ * @see u_isIDPart
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isIDIgnorable(UChar32 c);
+
+/**
+ * Determines if the specified character is permissible as the
+ * first character in a Java identifier.
+ * In addition to u_isIDStart(c), true for characters with
+ * general categories "Sc" (currency symbols) and "Pc" (connecting punctuation).
+ *
+ * Same as java.lang.Character.isJavaIdentifierStart().
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point may start a Java identifier
+ *
+ * @see     u_isJavaIDPart
+ * @see     u_isalpha
+ * @see     u_isIDStart
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isJavaIDStart(UChar32 c);
+
+/**
+ * Determines if the specified character is permissible
+ * in a Java identifier.
+ * In addition to u_isIDPart(c), true for characters with
+ * general category "Sc" (currency symbols).
+ *
+ * Same as java.lang.Character.isJavaIdentifierPart().
+ *
+ * @param c the code point to be tested
+ * @return TRUE if the code point may occur in a Java identifier
+ *
+ * @see     u_isIDIgnorable
+ * @see     u_isJavaIDStart
+ * @see     u_isalpha
+ * @see     u_isdigit
+ * @see     u_isIDPart
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+u_isJavaIDPart(UChar32 c);
+
+/**
+ * The given character is mapped to its lowercase equivalent according to
+ * UnicodeData.txt; if the character has no lowercase equivalent, the character
+ * itself is returned.
+ *
+ * Same as java.lang.Character.toLowerCase().
+ *
+ * This function only returns the simple, single-code point case mapping.
+ * Full case mappings should be used whenever possible because they produce
+ * better results by working on whole strings.
+ * They take into account the string context and the language and can map
+ * to a result string with a different length as appropriate.
+ * Full case mappings are applied by the string case mapping functions,
+ * see ustring.h and the UnicodeString class.
+ * See also the User Guide chapter on C/POSIX migration:
+ * http://icu-project.org/userguide/posix.html#case_mappings
+ *
+ * @param c the code point to be mapped
+ * @return the Simple_Lowercase_Mapping of the code point, if any;
+ *         otherwise the code point itself.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_tolower(UChar32 c);
+
+/**
+ * The given character is mapped to its uppercase equivalent according to UnicodeData.txt;
+ * if the character has no uppercase equivalent, the character itself is
+ * returned.
+ *
+ * Same as java.lang.Character.toUpperCase().
+ *
+ * This function only returns the simple, single-code point case mapping.
+ * Full case mappings should be used whenever possible because they produce
+ * better results by working on whole strings.
+ * They take into account the string context and the language and can map
+ * to a result string with a different length as appropriate.
+ * Full case mappings are applied by the string case mapping functions,
+ * see ustring.h and the UnicodeString class.
+ * See also the User Guide chapter on C/POSIX migration:
+ * http://icu-project.org/userguide/posix.html#case_mappings
+ *
+ * @param c the code point to be mapped
+ * @return the Simple_Uppercase_Mapping of the code point, if any;
+ *         otherwise the code point itself.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_toupper(UChar32 c);
+
+/**
+ * The given character is mapped to its titlecase equivalent
+ * according to UnicodeData.txt;
+ * if none is defined, the character itself is returned.
+ *
+ * Same as java.lang.Character.toTitleCase().
+ *
+ * This function only returns the simple, single-code point case mapping.
+ * Full case mappings should be used whenever possible because they produce
+ * better results by working on whole strings.
+ * They take into account the string context and the language and can map
+ * to a result string with a different length as appropriate.
+ * Full case mappings are applied by the string case mapping functions,
+ * see ustring.h and the UnicodeString class.
+ * See also the User Guide chapter on C/POSIX migration:
+ * http://icu-project.org/userguide/posix.html#case_mappings
+ *
+ * @param c the code point to be mapped
+ * @return the Simple_Titlecase_Mapping of the code point, if any;
+ *         otherwise the code point itself.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_totitle(UChar32 c);
+
+/** Option value for case folding: use default mappings defined in CaseFolding.txt. @stable ICU 2.0 */
+#define U_FOLD_CASE_DEFAULT 0
+
+/**
+ * Option value for case folding:
+ *
+ * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I
+ * and dotless i appropriately for Turkic languages (tr, az).
+ *
+ * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that
+ * are to be included for default mappings and
+ * excluded for the Turkic-specific mappings.
+ *
+ * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that
+ * are to be excluded for default mappings and
+ * included for the Turkic-specific mappings.
+ *
+ * @stable ICU 2.0
+ */
+#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1
+
+/**
+ * The given character is mapped to its case folding equivalent according to
+ * UnicodeData.txt and CaseFolding.txt;
+ * if the character has no case folding equivalent, the character
+ * itself is returned.
+ *
+ * This function only returns the simple, single-code point case mapping.
+ * Full case mappings should be used whenever possible because they produce
+ * better results by working on whole strings.
+ * They take into account the string context and the language and can map
+ * to a result string with a different length as appropriate.
+ * Full case mappings are applied by the string case mapping functions,
+ * see ustring.h and the UnicodeString class.
+ * See also the User Guide chapter on C/POSIX migration:
+ * http://icu-project.org/userguide/posix.html#case_mappings
+ *
+ * @param c the code point to be mapped
+ * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ * @return the Simple_Case_Folding of the code point, if any;
+ *         otherwise the code point itself.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_foldCase(UChar32 c, uint32_t options);
+
+/**
+ * Returns the decimal digit value of the code point in the
+ * specified radix.
+ *
+ * If the radix is not in the range <code>2<=radix<=36</code> or if the
+ * value of <code>c</code> is not a valid digit in the specified
+ * radix, <code>-1</code> is returned. A character is a valid digit
+ * if at least one of the following is true:
+ * <ul>
+ * <li>The character has a decimal digit value.
+ *     Such characters have the general category "Nd" (decimal digit numbers)
+ *     and a Numeric_Type of Decimal.
+ *     In this case the value is the character's decimal digit value.</li>
+ * <li>The character is one of the uppercase Latin letters
+ *     <code>'A'</code> through <code>'Z'</code>.
+ *     In this case the value is <code>c-'A'+10</code>.</li>
+ * <li>The character is one of the lowercase Latin letters
+ *     <code>'a'</code> through <code>'z'</code>.
+ *     In this case the value is <code>ch-'a'+10</code>.</li>
+ * <li>Latin letters from both the ASCII range (0061..007A, 0041..005A)
+ *     as well as from the Fullwidth ASCII range (FF41..FF5A, FF21..FF3A)
+ *     are recognized.</li>
+ * </ul>
+ *
+ * Same as java.lang.Character.digit().
+ *
+ * @param   ch      the code point to be tested.
+ * @param   radix   the radix.
+ * @return  the numeric value represented by the character in the
+ *          specified radix,
+ *          or -1 if there is no value or if the value exceeds the radix.
+ *
+ * @see     UCHAR_NUMERIC_TYPE
+ * @see     u_forDigit
+ * @see     u_charDigitValue
+ * @see     u_isdigit
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_digit(UChar32 ch, int8_t radix);
+
+/**
+ * Determines the character representation for a specific digit in
+ * the specified radix. If the value of <code>radix</code> is not a
+ * valid radix, or the value of <code>digit</code> is not a valid
+ * digit in the specified radix, the null character
+ * (<code>U+0000</code>) is returned.
+ * <p>
+ * The <code>radix</code> argument is valid if it is greater than or
+ * equal to 2 and less than or equal to 36.
+ * The <code>digit</code> argument is valid if
+ * <code>0 <= digit < radix</code>.
+ * <p>
+ * If the digit is less than 10, then
+ * <code>'0' + digit</code> is returned. Otherwise, the value
+ * <code>'a' + digit - 10</code> is returned.
+ *
+ * Same as java.lang.Character.forDigit().
+ *
+ * @param   digit   the number to convert to a character.
+ * @param   radix   the radix.
+ * @return  the <code>char</code> representation of the specified digit
+ *          in the specified radix.
+ *
+ * @see     u_digit
+ * @see     u_charDigitValue
+ * @see     u_isdigit
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_forDigit(int32_t digit, int8_t radix);
+
+/**
+ * Get the "age" of the code point.
+ * The "age" is the Unicode version when the code point was first
+ * designated (as a non-character or for Private Use)
+ * or assigned a character.
+ * This can be useful to avoid emitting code points to receiving
+ * processes that do not accept newer characters.
+ * The data is from the UCD file DerivedAge.txt.
+ *
+ * @param c The code point.
+ * @param versionArray The Unicode version number array, to be filled in.
+ *
+ * @stable ICU 2.1
+ */
+U_STABLE void U_EXPORT2
+u_charAge(UChar32 c, UVersionInfo versionArray);
+
+/**
+ * Gets the Unicode version information.
+ * The version array is filled in with the version information
+ * for the Unicode standard that is currently used by ICU.
+ * For example, Unicode version 3.1.1 is represented as an array with
+ * the values { 3, 1, 1, 0 }.
+ *
+ * @param versionArray an output array that will be filled in with
+ *                     the Unicode version number
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_getUnicodeVersion(UVersionInfo versionArray);
+
+#if !UCONFIG_NO_NORMALIZATION
+/**
+ * Get the FC_NFKC_Closure property string for a character.
+ * See Unicode Standard Annex #15 for details, search for "FC_NFKC_Closure"
+ * or for "FNC": http://www.unicode.org/reports/tr15/
+ *
+ * @param c The character (code point) for which to get the FC_NFKC_Closure string.
+ *             It must be <code>0<=c<=0x10ffff</code>.
+ * @param dest Destination address for copying the string.
+ *             The string will be zero-terminated if possible.
+ *             If there is no FC_NFKC_Closure string,
+ *             then the buffer will be set to the empty string.
+ * @param destCapacity <code>==sizeof(dest)</code>
+ * @param pErrorCode Pointer to a UErrorCode variable.
+ * @return The length of the string, or 0 if there is no FC_NFKC_Closure string for this character.
+ *         If the destCapacity is less than or equal to the length, then the buffer
+ *         contains the truncated name and the returned length indicates the full
+ *         length of the name.
+ *         The length does not include the zero-termination.
+ *
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode);
+
+#endif
+
+
+U_CDECL_END
+
+#endif /*_UCHAR*/
+/*eof*/
diff --git a/Source/WTF/icu/unicode/ucnv.h b/Source/WTF/icu/unicode/ucnv.h
new file mode 100644
index 0000000..98da8ff
--- /dev/null
+++ b/Source/WTF/icu/unicode/ucnv.h
@@ -0,0 +1,1997 @@
+/*
+**********************************************************************
+*   Copyright (C) 1999-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+**********************************************************************
+ *  ucnv.h:
+ *  External APIs for the ICU's codeset conversion library
+ *  Bertrand A. Damiba
+ *
+ * Modification History:
+ *
+ *   Date        Name        Description
+ *   04/04/99    helena      Fixed internal header inclusion.
+ *   05/11/00    helena      Added setFallback and usesFallback APIs.
+ *   06/29/2000  helena      Major rewrite of the callback APIs.
+ *   12/07/2000  srl         Update of documentation
+ */
+
+/**
+ * \file
+ * \brief C API: Character conversion 
+ *
+ * <h2>Character Conversion C API</h2>
+ *
+ * <p>This API is used to convert codepage or character encoded data to and
+ * from UTF-16. You can open a converter with {@link ucnv_open() }. With that
+ * converter, you can get its properties, set options, convert your data and
+ * close the converter.</p>
+ *
+ * <p>Since many software programs recogize different converter names for
+ * different types of converters, there are other functions in this API to
+ * iterate over the converter aliases. The functions {@link ucnv_getAvailableName() },
+ * {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the
+ * more frequently used alias functions to get this information.</p>
+ *
+ * <p>When a converter encounters an illegal, irregular, invalid or unmappable character
+ * its default behavior is to use a substitution character to replace the
+ * bad byte sequence. This behavior can be changed by using {@link ucnv_setFromUCallBack() }
+ * or {@link ucnv_setToUCallBack() } on the converter. The header ucnv_err.h defines
+ * many other callback actions that can be used instead of a character substitution.</p>
+ *
+ * <p>More information about this API can be found in our 
+ * <a href="http://icu-project.org/userguide/conversion.html">User's
+ * Guide</a>.</p>
+ */
+
+#ifndef UCNV_H
+#define UCNV_H
+
+#include "unicode/ucnv_err.h"
+#include "unicode/uenum.h"
+#include "unicode/localpointer.h"
+
+#ifndef __USET_H__
+
+/**
+ * USet is the C API type for Unicode sets.
+ * It is forward-declared here to avoid including the header file if related
+ * conversion APIs are not used.
+ * See unicode/uset.h
+ *
+ * @see ucnv_getUnicodeSet
+ * @stable ICU 2.6
+ */
+struct USet;
+/** @stable ICU 2.6 */
+typedef struct USet USet;
+
+#endif
+
+#if !UCONFIG_NO_CONVERSION
+
+U_CDECL_BEGIN
+
+/** Maximum length of a converter name including the terminating NULL @stable ICU 2.0 */
+#define UCNV_MAX_CONVERTER_NAME_LENGTH 60
+/** Maximum length of a converter name including path and terminating NULL @stable ICU 2.0 */
+#define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
+
+/** Shift in for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */
+#define  UCNV_SI 0x0F
+/** Shift out for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */
+#define  UCNV_SO 0x0E
+
+/**
+ * Enum for specifying basic types of converters
+ * @see ucnv_getType
+ * @stable ICU 2.0
+ */
+typedef enum {
+    UCNV_UNSUPPORTED_CONVERTER = -1,
+    UCNV_SBCS = 0,
+    UCNV_DBCS = 1,
+    UCNV_MBCS = 2,
+    UCNV_LATIN_1 = 3,
+    UCNV_UTF8 = 4,
+    UCNV_UTF16_BigEndian = 5,
+    UCNV_UTF16_LittleEndian = 6,
+    UCNV_UTF32_BigEndian = 7,
+    UCNV_UTF32_LittleEndian = 8,
+    UCNV_EBCDIC_STATEFUL = 9,
+    UCNV_ISO_2022 = 10,
+
+    UCNV_LMBCS_1 = 11,
+    UCNV_LMBCS_2, 
+    UCNV_LMBCS_3,
+    UCNV_LMBCS_4,
+    UCNV_LMBCS_5,
+    UCNV_LMBCS_6,
+    UCNV_LMBCS_8,
+    UCNV_LMBCS_11,
+    UCNV_LMBCS_16,
+    UCNV_LMBCS_17,
+    UCNV_LMBCS_18,
+    UCNV_LMBCS_19,
+    UCNV_LMBCS_LAST = UCNV_LMBCS_19,
+    UCNV_HZ,
+    UCNV_SCSU,
+    UCNV_ISCII,
+    UCNV_US_ASCII,
+    UCNV_UTF7,
+    UCNV_BOCU1,
+    UCNV_UTF16,
+    UCNV_UTF32,
+    UCNV_CESU8,
+    UCNV_IMAP_MAILBOX,
+
+    /* Number of converter types for which we have conversion routines. */
+    UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
+
+} UConverterType;
+
+/**
+ * Enum for specifying which platform a converter ID refers to.
+ * The use of platform/CCSID is not recommended. See ucnv_openCCSID().
+ *
+ * @see ucnv_getPlatform
+ * @see ucnv_openCCSID
+ * @see ucnv_getCCSID
+ * @stable ICU 2.0
+ */
+typedef enum {
+    UCNV_UNKNOWN = -1,
+    UCNV_IBM = 0
+} UConverterPlatform;
+
+/**
+ * Function pointer for error callback in the codepage to unicode direction.
+ * Called when an error has occured in conversion to unicode, or on open/close of the callback (see reason).
+ * @param context Pointer to the callback's private data
+ * @param args Information about the conversion in progress
+ * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param reason Defines the reason the callback was invoked
+ * @param pErrorCode    ICU error code in/out parameter.
+ *                      For converter callback functions, set to a conversion error
+ *                      before the call, and the callback may reset it to U_ZERO_ERROR.
+ * @see ucnv_setToUCallBack
+ * @see UConverterToUnicodeArgs
+ * @stable ICU 2.0
+ */
+typedef void (U_EXPORT2 *UConverterToUCallback) (
+                  const void* context,
+                  UConverterToUnicodeArgs *args,
+                  const char *codeUnits,
+                  int32_t length,
+                  UConverterCallbackReason reason,
+                  UErrorCode *pErrorCode);
+
+/**
+ * Function pointer for error callback in the unicode to codepage direction.
+ * Called when an error has occured in conversion from unicode, or on open/close of the callback (see reason).
+ * @param context Pointer to the callback's private data
+ * @param args Information about the conversion in progress
+ * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
+ * @param reason Defines the reason the callback was invoked
+ * @param pErrorCode    ICU error code in/out parameter.
+ *                      For converter callback functions, set to a conversion error
+ *                      before the call, and the callback may reset it to U_ZERO_ERROR.
+ * @see ucnv_setFromUCallBack
+ * @stable ICU 2.0
+ */
+typedef void (U_EXPORT2 *UConverterFromUCallback) (
+                    const void* context,
+                    UConverterFromUnicodeArgs *args,
+                    const UChar* codeUnits,
+                    int32_t length,
+                    UChar32 codePoint,
+                    UConverterCallbackReason reason,
+                    UErrorCode *pErrorCode);
+
+U_CDECL_END
+
+/**
+ * Character that separates converter names from options and options from each other.
+ * @see ucnv_open
+ * @stable ICU 2.0
+ */
+#define UCNV_OPTION_SEP_CHAR ','
+
+/**
+ * String version of UCNV_OPTION_SEP_CHAR. 
+ * @see ucnv_open
+ * @stable ICU 2.0
+ */
+#define UCNV_OPTION_SEP_STRING ","
+
+/**
+ * Character that separates a converter option from its value.
+ * @see ucnv_open
+ * @stable ICU 2.0
+ */
+#define UCNV_VALUE_SEP_CHAR '='
+
+/**
+ * String version of UCNV_VALUE_SEP_CHAR. 
+ * @see ucnv_open
+ * @stable ICU 2.0
+ */
+#define UCNV_VALUE_SEP_STRING "="
+
+/**
+ * Converter option for specifying a locale.
+ * For example, ucnv_open("SCSU,locale=ja", &errorCode);
+ * See convrtrs.txt.
+ *
+ * @see ucnv_open
+ * @stable ICU 2.0
+ */
+#define UCNV_LOCALE_OPTION_STRING ",locale="
+
+/**
+ * Converter option for specifying a version selector (0..9) for some converters.
+ * For example, 
+ * \code
+ *   ucnv_open("UTF-7,version=1", &errorCode);
+ * \endcode
+ * See convrtrs.txt.
+ *
+ * @see ucnv_open
+ * @stable ICU 2.4
+ */
+#define UCNV_VERSION_OPTION_STRING ",version="
+
+/**
+ * Converter option for EBCDIC SBCS or mixed-SBCS/DBCS (stateful) codepages.
+ * Swaps Unicode mappings for EBCDIC LF and NL codes, as used on
+ * S/390 (z/OS) Unix System Services (Open Edition).
+ * For example, ucnv_open("ibm-1047,swaplfnl", &errorCode);
+ * See convrtrs.txt.
+ *
+ * @see ucnv_open
+ * @stable ICU 2.4
+ */
+#define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
+
+/**
+ * Do a fuzzy compare of two converter/alias names.
+ * The comparison is case-insensitive, ignores leading zeroes if they are not
+ * followed by further digits, and ignores all but letters and digits.
+ * Thus the strings "UTF-8", "utf_8", "u*T@f08" and "Utf 8" are exactly equivalent.
+ * See section 1.4, Charset Alias Matching in Unicode Technical Standard #22
+ * at http://www.unicode.org/reports/tr22/
+ *
+ * @param name1 a converter name or alias, zero-terminated
+ * @param name2 a converter name or alias, zero-terminated
+ * @return 0 if the names match, or a negative value if the name1
+ * lexically precedes name2, or a positive value if the name1
+ * lexically follows name2.
+ * @stable ICU 2.0
+ */
+U_STABLE int U_EXPORT2
+ucnv_compareNames(const char *name1, const char *name2);
+
+
+/**
+ * Creates a UConverter object with the name of a coded character set specified as a C string.
+ * The actual name will be resolved with the alias file
+ * using a case-insensitive string comparison that ignores
+ * leading zeroes and all non-alphanumeric characters.
+ * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent.
+ * (See also ucnv_compareNames().)
+ * If <code>NULL</code> is passed for the converter name, it will create one with the
+ * getDefaultName return value.
+ *
+ * <p>A converter name for ICU 1.5 and above may contain options
+ * like a locale specification to control the specific behavior of
+ * the newly instantiated converter.
+ * The meaning of the options depends on the particular converter.
+ * If an option is not defined for or recognized by a given converter, then it is ignored.</p>
+ *
+ * <p>Options are appended to the converter name string, with a
+ * <code>UCNV_OPTION_SEP_CHAR</code> between the name and the first option and
+ * also between adjacent options.</p>
+ *
+ * <p>If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.</p>
+ *
+ * <p>The conversion behavior and names can vary between platforms. ICU may
+ * convert some characters differently from other platforms. Details on this topic
+ * are in the <a href="http://icu-project.org/userguide/conversion.html">User's
+ * Guide</a>. Aliases starting with a "cp" prefix have no specific meaning
+ * other than its an alias starting with the letters "cp". Please do not
+ * associate any meaning to these aliases.</p>
+ *
+ * @param converterName Name of the coded character set table.
+ *          This may have options appended to the string.
+ *          IANA alias character set names, IBM CCSIDs starting with "ibm-",
+ *          Windows codepage numbers starting with "windows-" are frequently
+ *          used for this parameter. See ucnv_getAvailableName and
+ *          ucnv_getAlias for a complete list that is available.
+ *          If this parameter is NULL, the default converter will be used.
+ * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
+ * @return the created Unicode converter object, or <TT>NULL</TT> if an error occured
+ * @see ucnv_openU
+ * @see ucnv_openCCSID
+ * @see ucnv_getAvailableName
+ * @see ucnv_getAlias
+ * @see ucnv_getDefaultName
+ * @see ucnv_close
+ * @see ucnv_compareNames
+ * @stable ICU 2.0
+ */
+U_STABLE UConverter* U_EXPORT2 
+ucnv_open(const char *converterName, UErrorCode *err);
+
+
+/**
+ * Creates a Unicode converter with the names specified as unicode string. 
+ * The name should be limited to the ASCII-7 alphanumerics range.
+ * The actual name will be resolved with the alias file
+ * using a case-insensitive string comparison that ignores
+ * leading zeroes and all non-alphanumeric characters.
+ * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent.
+ * (See also ucnv_compareNames().)
+ * If <TT>NULL</TT> is passed for the converter name, it will create 
+ * one with the ucnv_getDefaultName() return value.
+ * If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
+ *
+ * <p>See ucnv_open for the complete details</p>
+ * @param name Name of the UConverter table in a zero terminated 
+ *        Unicode string
+ * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, 
+ *        U_FILE_ACCESS_ERROR</TT>
+ * @return the created Unicode converter object, or <TT>NULL</TT> if an 
+ *        error occured
+ * @see ucnv_open
+ * @see ucnv_openCCSID
+ * @see ucnv_close
+ * @see ucnv_compareNames
+ * @stable ICU 2.0
+ */
+U_STABLE UConverter* U_EXPORT2 
+ucnv_openU(const UChar *name,
+           UErrorCode *err);
+
+/**
+ * Creates a UConverter object from a CCSID number and platform pair.
+ * Note that the usefulness of this function is limited to platforms with numeric
+ * encoding IDs. Only IBM and Microsoft platforms use numeric (16-bit) identifiers for
+ * encodings.
+ *
+ * In addition, IBM CCSIDs and Unicode conversion tables are not 1:1 related.
+ * For many IBM CCSIDs there are multiple (up to six) Unicode conversion tables, and
+ * for some Unicode conversion tables there are multiple CCSIDs.
+ * Some "alternate" Unicode conversion tables are provided by the
+ * IBM CDRA conversion table registry.
+ * The most prominent example of a systematic modification of conversion tables that is
+ * not provided in the form of conversion table files in the repository is
+ * that S/390 Unix System Services swaps the codes for Line Feed and New Line in all
+ * EBCDIC codepages, which requires such a swap in the Unicode conversion tables as well.
+ *
+ * Only IBM default conversion tables are accessible with ucnv_openCCSID().
+ * ucnv_getCCSID() will return the same CCSID for all conversion tables that are associated
+ * with that CCSID.
+ *
+ * Currently, the only "platform" supported in the ICU converter API is UCNV_IBM.
+ *
+ * In summary, the use of CCSIDs and the associated API functions is not recommended.
+ *
+ * In order to open a converter with the default IBM CDRA Unicode conversion table,
+ * you can use this function or use the prefix "ibm-":
+ * \code
+ *     char name[20];
+ *     sprintf(name, "ibm-%hu", ccsid);
+ *     cnv=ucnv_open(name, &errorCode);
+ * \endcode
+ *
+ * In order to open a converter with the IBM S/390 Unix System Services variant
+ * of a Unicode/EBCDIC conversion table,
+ * you can use the prefix "ibm-" together with the option string UCNV_SWAP_LFNL_OPTION_STRING:
+ * \code
+ *     char name[20];
+ *     sprintf(name, "ibm-%hu" UCNV_SWAP_LFNL_OPTION_STRING, ccsid);
+ *     cnv=ucnv_open(name, &errorCode);
+ * \endcode
+ *
+ * In order to open a converter from a Microsoft codepage number, use the prefix "cp":
+ * \code
+ *     char name[20];
+ *     sprintf(name, "cp%hu", codepageID);
+ *     cnv=ucnv_open(name, &errorCode);
+ * \endcode
+ *
+ * If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
+ *
+ * @param codepage codepage number to create
+ * @param platform the platform in which the codepage number exists
+ * @param err error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
+ * @return the created Unicode converter object, or <TT>NULL</TT> if an error
+ *   occured.
+ * @see ucnv_open
+ * @see ucnv_openU
+ * @see ucnv_close
+ * @see ucnv_getCCSID
+ * @see ucnv_getPlatform
+ * @see UConverterPlatform
+ * @stable ICU 2.0
+ */
+U_STABLE UConverter* U_EXPORT2
+ucnv_openCCSID(int32_t codepage,
+               UConverterPlatform platform,
+               UErrorCode * err);
+
+/**
+ * <p>Creates a UConverter object specified from a packageName and a converterName.</p>
+ * 
+ * <p>The packageName and converterName must point to an ICU udata object, as defined by
+ *   <code> udata_open( packageName, "cnv", converterName, err) </code> or equivalent.
+ * Typically, packageName will refer to a (.dat) file, or to a package registered with
+ * udata_setAppData(). Using a full file or directory pathname for packageName is deprecated.</p>
+ * 
+ * <p>The name will NOT be looked up in the alias mechanism, nor will the converter be
+ * stored in the converter cache or the alias table. The only way to open further converters
+ * is call this function multiple times, or use the ucnv_safeClone() function to clone a 
+ * 'master' converter.</p>
+ *
+ * <p>A future version of ICU may add alias table lookups and/or caching
+ * to this function.</p>
+ * 
+ * <p>Example Use:
+ *      <code>cnv = ucnv_openPackage("myapp", "myconverter", &err);</code>
+ * </p>
+ *
+ * @param packageName name of the package (equivalent to 'path' in udata_open() call)
+ * @param converterName name of the data item to be used, without suffix.
+ * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT>
+ * @return the created Unicode converter object, or <TT>NULL</TT> if an error occured
+ * @see udata_open
+ * @see ucnv_open
+ * @see ucnv_safeClone
+ * @see ucnv_close
+ * @stable ICU 2.2
+ */
+U_STABLE UConverter* U_EXPORT2 
+ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
+
+/**
+ * Thread safe converter cloning operation.
+ * For most efficient operation, pass in a stackBuffer (and a *pBufferSize)
+ * with at least U_CNV_SAFECLONE_BUFFERSIZE bytes of space.
+ * If the buffer size is sufficient, then the clone will use the stack buffer;
+ * otherwise, it will be allocated, and *pBufferSize will indicate
+ * the actual size. (This should not occur with U_CNV_SAFECLONE_BUFFERSIZE.)
+ *
+ * You must ucnv_close() the clone in any case.
+ *
+ * If *pBufferSize==0, (regardless of whether stackBuffer==NULL or not)
+ * then *pBufferSize will be changed to a sufficient size
+ * for cloning this converter,
+ * without actually cloning the converter ("pure pre-flighting").
+ *
+ * If *pBufferSize is greater than zero but not large enough for a stack-based
+ * clone, then the converter is cloned using newly allocated memory
+ * and *pBufferSize is changed to the necessary size.
+ *
+ * If the converter clone fits into the stack buffer but the stack buffer is not
+ * sufficiently aligned for the clone, then the clone will use an
+ * adjusted pointer and use an accordingly smaller buffer size.
+ *
+ * @param cnv converter to be cloned
+ * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated. 
+ *  If buffer is not large enough, new memory will be allocated.
+ *  Clients can use the U_CNV_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations.
+ * @param pBufferSize pointer to size of allocated space. pBufferSize must not be NULL.
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ *  An informational status value, U_SAFECLONE_ALLOCATED_WARNING,
+ *  is used if any allocations were necessary.
+ *  However, it is better to check if *pBufferSize grew for checking for
+ *  allocations because warning codes can be overridden by subsequent
+ *  function calls.
+ * @return pointer to the new clone
+ * @stable ICU 2.0
+ */
+U_STABLE UConverter * U_EXPORT2 
+ucnv_safeClone(const UConverter *cnv, 
+               void             *stackBuffer,
+               int32_t          *pBufferSize, 
+               UErrorCode       *status);
+
+/**
+ * \def U_CNV_SAFECLONE_BUFFERSIZE
+ * Definition of a buffer size that is designed to be large enough for
+ * converters to be cloned with ucnv_safeClone().
+ * @stable ICU 2.0
+ */
+#define U_CNV_SAFECLONE_BUFFERSIZE  1024
+
+/**
+ * Deletes the unicode converter and releases resources associated
+ * with just this instance.
+ * Does not free up shared converter tables.
+ *
+ * @param converter the converter object to be deleted
+ * @see ucnv_open
+ * @see ucnv_openU
+ * @see ucnv_openCCSID
+ * @stable ICU 2.0
+ */
+U_STABLE void  U_EXPORT2
+ucnv_close(UConverter * converter);
+
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUConverterPointer
+ * "Smart pointer" class, closes a UConverter via ucnv_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 4.4
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
+
+U_NAMESPACE_END
+
+#endif
+
+/**
+ * Fills in the output parameter, subChars, with the substitution characters
+ * as multiple bytes.
+ * If ucnv_setSubstString() set a Unicode string because the converter is
+ * stateful, then subChars will be an empty string.
+ *
+ * @param converter the Unicode converter
+ * @param subChars the subsitution characters
+ * @param len on input the capacity of subChars, on output the number 
+ * of bytes copied to it
+ * @param  err the outgoing error status code.
+ * If the substitution character array is too small, an
+ * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned.
+ * @see ucnv_setSubstString
+ * @see ucnv_setSubstChars
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getSubstChars(const UConverter *converter,
+                   char *subChars,
+                   int8_t *len,
+                   UErrorCode *err);
+
+/**
+ * Sets the substitution chars when converting from unicode to a codepage. The
+ * substitution is specified as a string of 1-4 bytes, and may contain
+ * <TT>NULL</TT> bytes.
+ * The subChars must represent a single character. The caller needs to know the
+ * byte sequence of a valid character in the converter's charset.
+ * For some converters, for example some ISO 2022 variants, only single-byte
+ * substitution characters may be supported.
+ * The newer ucnv_setSubstString() function relaxes these limitations.
+ *
+ * @param converter the Unicode converter
+ * @param subChars the substitution character byte sequence we want set
+ * @param len the number of bytes in subChars
+ * @param err the error status code.  <TT>U_INDEX_OUTOFBOUNDS_ERROR </TT> if
+ * len is bigger than the maximum number of bytes allowed in subchars
+ * @see ucnv_setSubstString
+ * @see ucnv_getSubstChars
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_setSubstChars(UConverter *converter,
+                   const char *subChars,
+                   int8_t len,
+                   UErrorCode *err);
+
+/**
+ * Set a substitution string for converting from Unicode to a charset.
+ * The caller need not know the charset byte sequence for each charset.
+ *
+ * Unlike ucnv_setSubstChars() which is designed to set a charset byte sequence
+ * for a single character, this function takes a Unicode string with
+ * zero, one or more characters, and immediately verifies that the string can be
+ * converted to the charset.
+ * If not, or if the result is too long (more than 32 bytes as of ICU 3.6),
+ * then the function returns with an error accordingly.
+ *
+ * Also unlike ucnv_setSubstChars(), this function works for stateful charsets
+ * by converting on the fly at the point of substitution rather than setting
+ * a fixed byte sequence.
+ *
+ * @param cnv The UConverter object.
+ * @param s The Unicode string.
+ * @param length The number of UChars in s, or -1 for a NUL-terminated string.
+ * @param err Pointer to a standard ICU error code. Its input value must
+ *            pass the U_SUCCESS() test, or else the function returns
+ *            immediately. Check for U_FAILURE() on output or use with
+ *            function chaining. (See User Guide for details.)
+ *
+ * @see ucnv_setSubstChars
+ * @see ucnv_getSubstChars
+ * @stable ICU 3.6
+ */
+U_STABLE void U_EXPORT2
+ucnv_setSubstString(UConverter *cnv,
+                    const UChar *s,
+                    int32_t length,
+                    UErrorCode *err);
+
+/**
+ * Fills in the output parameter, errBytes, with the error characters from the
+ * last failing conversion.
+ *
+ * @param converter the Unicode converter
+ * @param errBytes the codepage bytes which were in error
+ * @param len on input the capacity of errBytes, on output the number of
+ *  bytes which were copied to it
+ * @param err the error status code.
+ * If the substitution character array is too small, an
+ * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getInvalidChars(const UConverter *converter,
+                     char *errBytes,
+                     int8_t *len,
+                     UErrorCode *err);
+
+/**
+ * Fills in the output parameter, errChars, with the error characters from the
+ * last failing conversion.
+ *
+ * @param converter the Unicode converter
+ * @param errUChars the UChars which were in error
+ * @param len on input the capacity of errUChars, on output the number of 
+ *  UChars which were copied to it
+ * @param err the error status code.
+ * If the substitution character array is too small, an
+ * <TT>U_INDEX_OUTOFBOUNDS_ERROR</TT> will be returned.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getInvalidUChars(const UConverter *converter,
+                      UChar *errUChars,
+                      int8_t *len,
+                      UErrorCode *err);
+
+/**
+ * Resets the state of a converter to the default state. This is used
+ * in the case of an error, to restart a conversion from a known default state.
+ * It will also empty the internal output buffers.
+ * @param converter the Unicode converter
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_reset(UConverter *converter);
+
+/**
+ * Resets the to-Unicode part of a converter state to the default state.
+ * This is used in the case of an error to restart a conversion to
+ * Unicode to a known default state. It will also empty the internal
+ * output buffers used for the conversion to Unicode codepoints.
+ * @param converter the Unicode converter
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 
+ucnv_resetToUnicode(UConverter *converter);
+
+/**
+ * Resets the from-Unicode part of a converter state to the default state.
+ * This is used in the case of an error to restart a conversion from
+ * Unicode to a known default state. It will also empty the internal output
+ * buffers used for the conversion from Unicode codepoints.
+ * @param converter the Unicode converter
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 
+ucnv_resetFromUnicode(UConverter *converter);
+
+/**
+ * Returns the maximum number of bytes that are output per UChar in conversion
+ * from Unicode using this converter.
+ * The returned number can be used with UCNV_GET_MAX_BYTES_FOR_STRING
+ * to calculate the size of a target buffer for conversion from Unicode.
+ *
+ * Note: Before ICU 2.8, this function did not return reliable numbers for
+ * some stateful converters (EBCDIC_STATEFUL, ISO-2022) and LMBCS.
+ *
+ * This number may not be the same as the maximum number of bytes per
+ * "conversion unit". In other words, it may not be the intuitively expected
+ * number of bytes per character that would be published for a charset,
+ * and may not fulfill any other purpose than the allocation of an output
+ * buffer of guaranteed sufficient size for a given input length and converter.
+ *
+ * Examples for special cases that are taken into account:
+ * - Supplementary code points may convert to more bytes than BMP code points.
+ *   This function returns bytes per UChar (UTF-16 code unit), not per
+ *   Unicode code point, for efficient buffer allocation.
+ * - State-shifting output (SI/SO, escapes, etc.) from stateful converters.
+ * - When m input UChars are converted to n output bytes, then the maximum m/n
+ *   is taken into account.
+ *
+ * The number returned here does not take into account
+ * (see UCNV_GET_MAX_BYTES_FOR_STRING):
+ * - callbacks which output more than one charset character sequence per call,
+ *   like escape callbacks
+ * - initial and final non-character bytes that are output by some converters
+ *   (automatic BOMs, initial escape sequence, final SI, etc.)
+ *
+ * Examples for returned values:
+ * - SBCS charsets: 1
+ * - Shift-JIS: 2
+ * - UTF-16: 2 (2 per BMP, 4 per surrogate _pair_, BOM not counted)
+ * - UTF-8: 3 (3 per BMP, 4 per surrogate _pair_)
+ * - EBCDIC_STATEFUL (EBCDIC mixed SBCS/DBCS): 3 (SO + DBCS)
+ * - ISO-2022: 3 (always outputs UTF-8)
+ * - ISO-2022-JP: 6 (4-byte escape sequences + DBCS)
+ * - ISO-2022-CN: 8 (4-byte designator sequences + 2-byte SS2/SS3 + DBCS)
+ *
+ * @param converter The Unicode converter.
+ * @return The maximum number of bytes per UChar that are output by ucnv_fromUnicode(),
+ *         to be used together with UCNV_GET_MAX_BYTES_FOR_STRING for buffer allocation.
+ *
+ * @see UCNV_GET_MAX_BYTES_FOR_STRING
+ * @see ucnv_getMinCharSize
+ * @stable ICU 2.0
+ */
+U_STABLE int8_t U_EXPORT2
+ucnv_getMaxCharSize(const UConverter *converter);
+
+/**
+ * Calculates the size of a buffer for conversion from Unicode to a charset.
+ * The calculated size is guaranteed to be sufficient for this conversion.
+ *
+ * It takes into account initial and final non-character bytes that are output
+ * by some converters.
+ * It does not take into account callbacks which output more than one charset
+ * character sequence per call, like escape callbacks.
+ * The default (substitution) callback only outputs one charset character sequence.
+ *
+ * @param length Number of UChars to be converted.
+ * @param maxCharSize Return value from ucnv_getMaxCharSize() for the converter
+ *                    that will be used.
+ * @return Size of a buffer that will be large enough to hold the output bytes of
+ *         converting length UChars with the converter that returned the maxCharSize.
+ *
+ * @see ucnv_getMaxCharSize
+ * @stable ICU 2.8
+ */
+#define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
+     (((int32_t)(length)+10)*(int32_t)(maxCharSize))
+
+/**
+ * Returns the minimum byte length for characters in this codepage. 
+ * This is usually either 1 or 2.
+ * @param converter the Unicode converter
+ * @return the minimum number of bytes allowed by this particular converter
+ * @see ucnv_getMaxCharSize
+ * @stable ICU 2.0
+ */
+U_STABLE int8_t U_EXPORT2
+ucnv_getMinCharSize(const UConverter *converter);
+
+/**
+ * Returns the display name of the converter passed in based on the Locale 
+ * passed in. If the locale contains no display name, the internal ASCII
+ * name will be filled in.
+ *
+ * @param converter the Unicode converter.
+ * @param displayLocale is the specific Locale we want to localised for
+ * @param displayName user provided buffer to be filled in
+ * @param displayNameCapacity size of displayName Buffer
+ * @param err error status code
+ * @return displayNameLength number of UChar needed in displayName
+ * @see ucnv_getName
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_getDisplayName(const UConverter *converter,
+                    const char *displayLocale,
+                    UChar *displayName,
+                    int32_t displayNameCapacity,
+                    UErrorCode *err);
+
+/**
+ * Gets the internal, canonical name of the converter (zero-terminated).
+ * The lifetime of the returned string will be that of the converter 
+ * passed to this function.
+ * @param converter the Unicode converter
+ * @param err UErrorCode status
+ * @return the internal name of the converter
+ * @see ucnv_getDisplayName
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2 
+ucnv_getName(const UConverter *converter, UErrorCode *err);
+
+/**
+ * Gets a codepage number associated with the converter. This is not guaranteed
+ * to be the one used to create the converter. Some converters do not represent
+ * platform registered codepages and return zero for the codepage number.
+ * The error code fill-in parameter indicates if the codepage number
+ * is available.
+ * Does not check if the converter is <TT>NULL</TT> or if converter's data
+ * table is <TT>NULL</TT>.
+ *
+ * Important: The use of CCSIDs is not recommended because it is limited
+ * to only two platforms in principle and only one (UCNV_IBM) in the current
+ * ICU converter API.
+ * Also, CCSIDs are insufficient to identify IBM Unicode conversion tables precisely.
+ * For more details see ucnv_openCCSID().
+ *
+ * @param converter the Unicode converter
+ * @param err the error status code.
+ * @return If any error occurrs, -1 will be returned otherwise, the codepage number
+ * will be returned
+ * @see ucnv_openCCSID
+ * @see ucnv_getPlatform
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_getCCSID(const UConverter *converter,
+              UErrorCode *err);
+
+/**
+ * Gets a codepage platform associated with the converter. Currently, 
+ * only <TT>UCNV_IBM</TT> will be returned.
+ * Does not test if the converter is <TT>NULL</TT> or if converter's data 
+ * table is <TT>NULL</TT>. 
+ * @param converter the Unicode converter
+ * @param err the error status code.
+ * @return The codepage platform
+ * @stable ICU 2.0
+ */
+U_STABLE UConverterPlatform U_EXPORT2
+ucnv_getPlatform(const UConverter *converter,
+                 UErrorCode *err);
+
+/**
+ * Gets the type of the converter
+ * e.g. SBCS, MBCS, DBCS, UTF8, UTF16_BE, UTF16_LE, ISO_2022, 
+ * EBCDIC_STATEFUL, LATIN_1
+ * @param converter a valid, opened converter
+ * @return the type of the converter
+ * @stable ICU 2.0
+ */
+U_STABLE UConverterType U_EXPORT2
+ucnv_getType(const UConverter * converter);
+
+/**
+ * Gets the "starter" (lead) bytes for converters of type MBCS.
+ * Will fill in an <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if converter passed in
+ * is not MBCS. Fills in an array of type UBool, with the value of the byte 
+ * as offset to the array. For example, if (starters[0x20] == TRUE) at return,
+ * it means that the byte 0x20 is a starter byte in this converter.
+ * Context pointers are always owned by the caller.
+ * 
+ * @param converter a valid, opened converter of type MBCS
+ * @param starters an array of size 256 to be filled in
+ * @param err error status, <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if the 
+ * converter is not a type which can return starters.
+ * @see ucnv_getType
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getStarters(const UConverter* converter, 
+                 UBool starters[256],
+                 UErrorCode* err);
+
+
+/**
+ * Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet().
+ * @see ucnv_getUnicodeSet
+ * @stable ICU 2.6
+ */
+typedef enum UConverterUnicodeSet {
+    /** Select the set of roundtrippable Unicode code points. @stable ICU 2.6 */
+    UCNV_ROUNDTRIP_SET,
+    /** Select the set of Unicode code points with roundtrip or fallback mappings. @stable ICU 4.0 */
+    UCNV_ROUNDTRIP_AND_FALLBACK_SET,
+    /** Number of UConverterUnicodeSet selectors. @stable ICU 2.6 */
+    UCNV_SET_COUNT
+} UConverterUnicodeSet;
+
+
+/**
+ * Returns the set of Unicode code points that can be converted by an ICU converter.
+ *
+ * Returns one of several kinds of set:
+ *
+ * 1. UCNV_ROUNDTRIP_SET
+ *
+ * The set of all Unicode code points that can be roundtrip-converted
+ * (converted without any data loss) with the converter (ucnv_fromUnicode()).
+ * This set will not include code points that have fallback mappings
+ * or are only the result of reverse fallback mappings.
+ * This set will also not include PUA code points with fallbacks, although
+ * ucnv_fromUnicode() will always uses those mappings despite ucnv_setFallback().
+ * See UTR #22 "Character Mapping Markup Language"
+ * at http://www.unicode.org/reports/tr22/
+ *
+ * This is useful for example for
+ * - checking that a string or document can be roundtrip-converted with a converter,
+ *   without/before actually performing the conversion
+ * - testing if a converter can be used for text for typical text for a certain locale,
+ *   by comparing its roundtrip set with the set of ExemplarCharacters from
+ *   ICU's locale data or other sources
+ *
+ * 2. UCNV_ROUNDTRIP_AND_FALLBACK_SET
+ *
+ * The set of all Unicode code points that can be converted with the converter (ucnv_fromUnicode())
+ * when fallbacks are turned on (see ucnv_setFallback()).
+ * This set includes all code points with roundtrips and fallbacks (but not reverse fallbacks).
+ *
+ * In the future, there may be more UConverterUnicodeSet choices to select
+ * sets with different properties.
+ *
+ * @param cnv The converter for which a set is requested.
+ * @param setFillIn A valid USet *. It will be cleared by this function before
+ *            the converter's specific set is filled into the USet.
+ * @param whichSet A UConverterUnicodeSet selector;
+ *              currently UCNV_ROUNDTRIP_SET is the only supported value.
+ * @param pErrorCode ICU error code in/out parameter.
+ *                   Must fulfill U_SUCCESS before the function call.
+ *
+ * @see UConverterUnicodeSet
+ * @see uset_open
+ * @see uset_close
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+ucnv_getUnicodeSet(const UConverter *cnv,
+                   USet *setFillIn,
+                   UConverterUnicodeSet whichSet,
+                   UErrorCode *pErrorCode);
+
+/**
+ * Gets the current calback function used by the converter when an illegal
+ *  or invalid codepage sequence is found. 
+ * Context pointers are always owned by the caller.
+ *
+ * @param converter the unicode converter
+ * @param action fillin: returns the callback function pointer
+ * @param context fillin: returns the callback's private void* context
+ * @see ucnv_setToUCallBack
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getToUCallBack (const UConverter * converter,
+                     UConverterToUCallback *action,
+                     const void **context);
+
+/**
+ * Gets the current callback function used by the converter when illegal 
+ * or invalid Unicode sequence is found.
+ * Context pointers are always owned by the caller.
+ *
+ * @param converter the unicode converter
+ * @param action fillin: returns the callback function pointer
+ * @param context fillin: returns the callback's private void* context
+ * @see ucnv_setFromUCallBack
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_getFromUCallBack (const UConverter * converter,
+                       UConverterFromUCallback *action,
+                       const void **context);
+
+/**
+ * Changes the callback function used by the converter when
+ * an illegal or invalid sequence is found.
+ * Context pointers are always owned by the caller.
+ * Predefined actions and contexts can be found in the ucnv_err.h header.
+ *
+ * @param converter the unicode converter
+ * @param newAction the new callback function
+ * @param newContext the new toUnicode callback context pointer. This can be NULL.
+ * @param oldAction fillin: returns the old callback function pointer. This can be NULL.
+ * @param oldContext fillin: returns the old callback's private void* context. This can be NULL.
+ * @param err The error code status
+ * @see ucnv_getToUCallBack
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_setToUCallBack (UConverter * converter,
+                     UConverterToUCallback newAction,
+                     const void* newContext,
+                     UConverterToUCallback *oldAction,
+                     const void** oldContext,
+                     UErrorCode * err);
+
+/**
+ * Changes the current callback function used by the converter when
+ * an illegal or invalid sequence is found.
+ * Context pointers are always owned by the caller.
+ * Predefined actions and contexts can be found in the ucnv_err.h header.
+ *
+ * @param converter the unicode converter
+ * @param newAction the new callback function
+ * @param newContext the new fromUnicode callback context pointer. This can be NULL.
+ * @param oldAction fillin: returns the old callback function pointer. This can be NULL.
+ * @param oldContext fillin: returns the old callback's private void* context. This can be NULL.
+ * @param err The error code status
+ * @see ucnv_getFromUCallBack
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_setFromUCallBack (UConverter * converter,
+                       UConverterFromUCallback newAction,
+                       const void *newContext,
+                       UConverterFromUCallback *oldAction,
+                       const void **oldContext,
+                       UErrorCode * err);
+
+/**
+ * Converts an array of unicode characters to an array of codepage
+ * characters. This function is optimized for converting a continuous
+ * stream of data in buffer-sized chunks, where the entire source and
+ * target does not fit in available buffers.
+ * 
+ * The source pointer is an in/out parameter. It starts out pointing where the 
+ * conversion is to begin, and ends up pointing after the last UChar consumed. 
+ * 
+ * Target similarly starts out pointer at the first available byte in the output
+ * buffer, and ends up pointing after the last byte written to the output.
+ * 
+ * The converter always attempts to consume the entire source buffer, unless 
+ * (1.) the target buffer is full, or (2.) a failing error is returned from the
+ * current callback function.  When a successful error status has been
+ * returned, it means that all of the source buffer has been
+ *  consumed. At that point, the caller should reset the source and
+ *  sourceLimit pointers to point to the next chunk.
+ * 
+ * At the end of the stream (flush==TRUE), the input is completely consumed
+ * when *source==sourceLimit and no error code is set.
+ * The converter object is then automatically reset by this function.
+ * (This means that a converter need not be reset explicitly between data
+ * streams if it finishes the previous stream without errors.)
+ * 
+ * This is a <I>stateful</I> conversion. Additionally, even when all source data has
+ * been consumed, some data may be in the converters' internal state.
+ * Call this function repeatedly, updating the target pointers with
+ * the next empty chunk of target in case of a
+ * <TT>U_BUFFER_OVERFLOW_ERROR</TT>, and updating the source  pointers
+ *  with the next chunk of source when a successful error status is
+ * returned, until there are no more chunks of source data.
+ * @param converter the Unicode converter
+ * @param target I/O parameter. Input : Points to the beginning of the buffer to copy
+ *  codepage characters to. Output : points to after the last codepage character copied
+ *  to <TT>target</TT>.
+ * @param targetLimit the pointer just after last of the <TT>target</TT> buffer
+ * @param source I/O parameter, pointer to pointer to the source Unicode character buffer. 
+ * @param sourceLimit the pointer just after the last of the source buffer
+ * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number
+ * of allocated cells as <TT>target</TT>. Will fill in offsets from target to source pointer
+ * e.g: <TT>offsets[3]</TT> is equal to 6, it means that the <TT>target[3]</TT> was a result of transcoding <TT>source[6]</TT>
+ * For output data carried across calls, and other data without a specific source character
+ * (such as from escape sequences or callbacks)  -1 will be placed for offsets. 
+ * @param flush set to <TT>TRUE</TT> if the current source buffer is the last available
+ * chunk of the source, <TT>FALSE</TT> otherwise. Note that if a failing status is returned,
+ * this function may have to be called multiple times with flush set to <TT>TRUE</TT> until
+ * the source buffer is consumed.
+ * @param err the error status.  <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> will be set if the
+ * converter is <TT>NULL</TT>.
+ * <code>U_BUFFER_OVERFLOW_ERROR</code> will be set if the target is full and there is 
+ * still data to be written to the target.
+ * @see ucnv_fromUChars
+ * @see ucnv_convert
+ * @see ucnv_getMinCharSize
+ * @see ucnv_setToUCallBack
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 
+ucnv_fromUnicode (UConverter * converter,
+                  char **target,
+                  const char *targetLimit,
+                  const UChar ** source,
+                  const UChar * sourceLimit,
+                  int32_t* offsets,
+                  UBool flush,
+                  UErrorCode * err);
+
+/**
+ * Converts a buffer of codepage bytes into an array of unicode UChars
+ * characters. This function is optimized for converting a continuous
+ * stream of data in buffer-sized chunks, where the entire source and
+ * target does not fit in available buffers.
+ * 
+ * The source pointer is an in/out parameter. It starts out pointing where the 
+ * conversion is to begin, and ends up pointing after the last byte of source consumed. 
+ * 
+ * Target similarly starts out pointer at the first available UChar in the output
+ * buffer, and ends up pointing after the last UChar written to the output. 
+ * It does NOT necessarily keep UChar sequences together.
+ * 
+ * The converter always attempts to consume the entire source buffer, unless 
+ * (1.) the target buffer is full, or (2.) a failing error is returned from the
+ * current callback function.  When a successful error status has been
+ * returned, it means that all of the source buffer has been
+ *  consumed. At that point, the caller should reset the source and
+ *  sourceLimit pointers to point to the next chunk.
+ *
+ * At the end of the stream (flush==TRUE), the input is completely consumed
+ * when *source==sourceLimit and no error code is set
+ * The converter object is then automatically reset by this function.
+ * (This means that a converter need not be reset explicitly between data
+ * streams if it finishes the previous stream without errors.)
+ * 
+ * This is a <I>stateful</I> conversion. Additionally, even when all source data has
+ * been consumed, some data may be in the converters' internal state.
+ * Call this function repeatedly, updating the target pointers with
+ * the next empty chunk of target in case of a
+ * <TT>U_BUFFER_OVERFLOW_ERROR</TT>, and updating the source  pointers
+ *  with the next chunk of source when a successful error status is
+ * returned, until there are no more chunks of source data.
+ * @param converter the Unicode converter
+ * @param target I/O parameter. Input : Points to the beginning of the buffer to copy
+ *  UChars into. Output : points to after the last UChar copied.
+ * @param targetLimit the pointer just after the end of the <TT>target</TT> buffer
+ * @param source I/O parameter, pointer to pointer to the source codepage buffer. 
+ * @param sourceLimit the pointer to the byte after the end of the source buffer
+ * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number
+ * of allocated cells as <TT>target</TT>. Will fill in offsets from target to source pointer
+ * e.g: <TT>offsets[3]</TT> is equal to 6, it means that the <TT>target[3]</TT> was a result of transcoding <TT>source[6]</TT>
+ * For output data carried across calls, and other data without a specific source character
+ * (such as from escape sequences or callbacks)  -1 will be placed for offsets. 
+ * @param flush set to <TT>TRUE</TT> if the current source buffer is the last available
+ * chunk of the source, <TT>FALSE</TT> otherwise. Note that if a failing status is returned,
+ * this function may have to be called multiple times with flush set to <TT>TRUE</TT> until
+ * the source buffer is consumed.
+ * @param err the error status.  <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> will be set if the
+ * converter is <TT>NULL</TT>.
+ * <code>U_BUFFER_OVERFLOW_ERROR</code> will be set if the target is full and there is 
+ * still data to be written to the target. 
+ * @see ucnv_fromUChars
+ * @see ucnv_convert
+ * @see ucnv_getMinCharSize
+ * @see ucnv_setFromUCallBack
+ * @see ucnv_getNextUChar
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 
+ucnv_toUnicode(UConverter *converter,
+               UChar **target,
+               const UChar *targetLimit,
+               const char **source,
+               const char *sourceLimit,
+               int32_t *offsets,
+               UBool flush,
+               UErrorCode *err);
+
+/**
+ * Convert the Unicode string into a codepage string using an existing UConverter.
+ * The output string is NUL-terminated if possible.
+ *
+ * This function is a more convenient but less powerful version of ucnv_fromUnicode().
+ * It is only useful for whole strings, not for streaming conversion.
+ *
+ * The maximum output buffer capacity required (barring output from callbacks) will be
+ * UCNV_GET_MAX_BYTES_FOR_STRING(srcLength, ucnv_getMaxCharSize(cnv)).
+ *
+ * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called)
+ * @param src the input Unicode string
+ * @param srcLength the input string length, or -1 if NUL-terminated
+ * @param dest destination string buffer, can be NULL if destCapacity==0
+ * @param destCapacity the number of chars available at dest
+ * @param pErrorCode normal ICU error code;
+ *                  common error codes that may be set by this function include
+ *                  U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING,
+ *                  U_ILLEGAL_ARGUMENT_ERROR, and conversion errors
+ * @return the length of the output string, not counting the terminating NUL;
+ *         if the length is greater than destCapacity, then the string will not fit
+ *         and a buffer of the indicated length would need to be passed in
+ * @see ucnv_fromUnicode
+ * @see ucnv_convert
+ * @see UCNV_GET_MAX_BYTES_FOR_STRING
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_fromUChars(UConverter *cnv,
+                char *dest, int32_t destCapacity,
+                const UChar *src, int32_t srcLength,
+                UErrorCode *pErrorCode);
+
+/**
+ * Convert the codepage string into a Unicode string using an existing UConverter.
+ * The output string is NUL-terminated if possible.
+ *
+ * This function is a more convenient but less powerful version of ucnv_toUnicode().
+ * It is only useful for whole strings, not for streaming conversion.
+ *
+ * The maximum output buffer capacity required (barring output from callbacks) will be
+ * 2*srcLength (each char may be converted into a surrogate pair).
+ *
+ * @param cnv the converter object to be used (ucnv_resetToUnicode() will be called)
+ * @param src the input codepage string
+ * @param srcLength the input string length, or -1 if NUL-terminated
+ * @param dest destination string buffer, can be NULL if destCapacity==0
+ * @param destCapacity the number of UChars available at dest
+ * @param pErrorCode normal ICU error code;
+ *                  common error codes that may be set by this function include
+ *                  U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING,
+ *                  U_ILLEGAL_ARGUMENT_ERROR, and conversion errors
+ * @return the length of the output string, not counting the terminating NUL;
+ *         if the length is greater than destCapacity, then the string will not fit
+ *         and a buffer of the indicated length would need to be passed in
+ * @see ucnv_toUnicode
+ * @see ucnv_convert
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_toUChars(UConverter *cnv,
+              UChar *dest, int32_t destCapacity,
+              const char *src, int32_t srcLength,
+              UErrorCode *pErrorCode);
+
+/**
+ * Convert a codepage buffer into Unicode one character at a time.
+ * The input is completely consumed when the U_INDEX_OUTOFBOUNDS_ERROR is set.
+ *
+ * Advantage compared to ucnv_toUnicode() or ucnv_toUChars():
+ * - Faster for small amounts of data, for most converters, e.g.,
+ *   US-ASCII, ISO-8859-1, UTF-8/16/32, and most "normal" charsets.
+ *   (For complex converters, e.g., SCSU, UTF-7 and ISO 2022 variants,
+ *    it uses ucnv_toUnicode() internally.)
+ * - Convenient.
+ *
+ * Limitations compared to ucnv_toUnicode():
+ * - Always assumes flush=TRUE.
+ *   This makes ucnv_getNextUChar() unsuitable for "streaming" conversion,
+ *   that is, for where the input is supplied in multiple buffers,
+ *   because ucnv_getNextUChar() will assume the end of the input at the end
+ *   of the first buffer.
+ * - Does not provide offset output.
+ *
+ * It is possible to "mix" ucnv_getNextUChar() and ucnv_toUnicode() because
+ * ucnv_getNextUChar() uses the current state of the converter
+ * (unlike ucnv_toUChars() which always resets first).
+ * However, if ucnv_getNextUChar() is called after ucnv_toUnicode()
+ * stopped in the middle of a character sequence (with flush=FALSE),
+ * then ucnv_getNextUChar() will always use the slower ucnv_toUnicode()
+ * internally until the next character boundary.
+ * (This is new in ICU 2.6. In earlier releases, ucnv_getNextUChar() had to
+ * start at a character boundary.)
+ *
+ * Instead of using ucnv_getNextUChar(), it is recommended
+ * to convert using ucnv_toUnicode() or ucnv_toUChars()
+ * and then iterate over the text using U16_NEXT() or a UCharIterator (uiter.h)
+ * or a C++ CharacterIterator or similar.
+ * This allows streaming conversion and offset output, for example.
+ *
+ * <p>Handling of surrogate pairs and supplementary-plane code points:<br>
+ * There are two different kinds of codepages that provide mappings for surrogate characters:
+ * <ul>
+ *   <li>Codepages like UTF-8, UTF-32, and GB 18030 provide direct representations for Unicode
+ *       code points U+10000-U+10ffff as well as for single surrogates U+d800-U+dfff.
+ *       Each valid sequence will result in exactly one returned code point.
+ *       If a sequence results in a single surrogate, then that will be returned
+ *       by itself, even if a neighboring sequence encodes the matching surrogate.</li>
+ *   <li>Codepages like SCSU and LMBCS (and UTF-16) provide direct representations only for BMP code points
+ *       including surrogates. Code points in supplementary planes are represented with
+ *       two sequences, each encoding a surrogate.
+ *       For these codepages, matching pairs of surrogates will be combined into single
+ *       code points for returning from this function.
+ *       (Note that SCSU is actually a mix of these codepage types.)</li>
+ * </ul></p>
+ *
+ * @param converter an open UConverter
+ * @param source the address of a pointer to the codepage buffer, will be
+ *  updated to point after the bytes consumed in the conversion call.
+ * @param sourceLimit points to the end of the input buffer
+ * @param err fills in error status (see ucnv_toUnicode)
+ * <code>U_INDEX_OUTOFBOUNDS_ERROR</code> will be set if the input 
+ * is empty or does not convert to any output (e.g.: pure state-change 
+ * codes SI/SO, escape sequences for ISO 2022,
+ * or if the callback did not output anything, ...).
+ * This function will not set a <code>U_BUFFER_OVERFLOW_ERROR</code> because
+ *  the "buffer" is the return code. However, there might be subsequent output
+ *  stored in the converter object
+ * that will be returned in following calls to this function.
+ * @return a UChar32 resulting from the partial conversion of source
+ * @see ucnv_toUnicode
+ * @see ucnv_toUChars
+ * @see ucnv_convert
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+ucnv_getNextUChar(UConverter * converter,
+                  const char **source,
+                  const char * sourceLimit,
+                  UErrorCode * err);
+
+/**
+ * Convert from one external charset to another using two existing UConverters.
+ * Internally, two conversions - ucnv_toUnicode() and ucnv_fromUnicode() -
+ * are used, "pivoting" through 16-bit Unicode.
+ *
+ * Important: For streaming conversion (multiple function calls for successive
+ * parts of a text stream), the caller must provide a pivot buffer explicitly,
+ * and must preserve the pivot buffer and associated pointers from one
+ * call to another. (The buffer may be moved if its contents and the relative
+ * pointer positions are preserved.)
+ *
+ * There is a similar function, ucnv_convert(),
+ * which has the following limitations:
+ * - it takes charset names, not converter objects, so that
+ *   - two converters are opened for each call
+ *   - only single-string conversion is possible, not streaming operation
+ * - it does not provide enough information to find out,
+ *   in case of failure, whether the toUnicode or
+ *   the fromUnicode conversion failed
+ *
+ * By contrast, ucnv_convertEx()
+ * - takes UConverter parameters instead of charset names
+ * - fully exposes the pivot buffer for streaming conversion and complete error handling
+ *
+ * ucnv_convertEx() also provides further convenience:
+ * - an option to reset the converters at the beginning
+ *   (if reset==TRUE, see parameters;
+ *    also sets *pivotTarget=*pivotSource=pivotStart)
+ * - allow NUL-terminated input
+ *   (only a single NUL byte, will not work for charsets with multi-byte NULs)
+ *   (if sourceLimit==NULL, see parameters)
+ * - terminate with a NUL on output
+ *   (only a single NUL byte, not useful for charsets with multi-byte NULs),
+ *   or set U_STRING_NOT_TERMINATED_WARNING if the output exactly fills
+ *   the target buffer
+ * - the pivot buffer can be provided internally;
+ *   possible only for whole-string conversion, not streaming conversion;
+ *   in this case, the caller will not be able to get details about where an
+ *   error occurred
+ *   (if pivotStart==NULL, see below)
+ *
+ * The function returns when one of the following is true:
+ * - the entire source text has been converted successfully to the target buffer
+ * - a target buffer overflow occurred (U_BUFFER_OVERFLOW_ERROR)
+ * - a conversion error occurred
+ *   (other U_FAILURE(), see description of pErrorCode)
+ *
+ * Limitation compared to the direct use of
+ * ucnv_fromUnicode() and ucnv_toUnicode():
+ * ucnv_convertEx() does not provide offset information.
+ *
+ * Limitation compared to ucnv_fromUChars() and ucnv_toUChars():
+ * ucnv_convertEx() does not support preflighting directly.
+ *
+ * Sample code for converting a single string from
+ * one external charset to UTF-8, ignoring the location of errors:
+ *
+ * \code
+ * int32_t
+ * myToUTF8(UConverter *cnv,
+ *          const char *s, int32_t length,
+ *          char *u8, int32_t capacity,
+ *          UErrorCode *pErrorCode) {
+ *     UConverter *utf8Cnv;
+ *     char *target;
+ *
+ *     if(U_FAILURE(*pErrorCode)) {
+ *         return 0;
+ *     }
+ *
+ *     utf8Cnv=myGetCachedUTF8Converter(pErrorCode);
+ *     if(U_FAILURE(*pErrorCode)) {
+ *         return 0;
+ *     }
+ *
+ *     if(length<0) {
+ *         length=strlen(s);
+ *     }
+ *     target=u8;
+ *     ucnv_convertEx(utf8Cnv, cnv,
+ *                    &target, u8+capacity,
+ *                    &s, s+length,
+ *                    NULL, NULL, NULL, NULL,
+ *                    TRUE, TRUE,
+ *                    pErrorCode);
+ * 
+ *     myReleaseCachedUTF8Converter(utf8Cnv);
+ *
+ *     // return the output string length, but without preflighting
+ *     return (int32_t)(target-u8);
+ * }
+ * \endcode
+ *
+ * @param targetCnv     Output converter, used to convert from the UTF-16 pivot
+ *                      to the target using ucnv_fromUnicode().
+ * @param sourceCnv     Input converter, used to convert from the source to
+ *                      the UTF-16 pivot using ucnv_toUnicode().
+ * @param target        I/O parameter, same as for ucnv_fromUChars().
+ *                      Input: *target points to the beginning of the target buffer.
+ *                      Output: *target points to the first unit after the last char written.
+ * @param targetLimit   Pointer to the first unit after the target buffer.
+ * @param source        I/O parameter, same as for ucnv_toUChars().
+ *                      Input: *source points to the beginning of the source buffer.
+ *                      Output: *source points to the first unit after the last char read.
+ * @param sourceLimit   Pointer to the first unit after the source buffer.
+ * @param pivotStart    Pointer to the UTF-16 pivot buffer. If pivotStart==NULL,
+ *                      then an internal buffer is used and the other pivot
+ *                      arguments are ignored and can be NULL as well.
+ * @param pivotSource   I/O parameter, same as source in ucnv_fromUChars() for
+ *                      conversion from the pivot buffer to the target buffer.
+ * @param pivotTarget   I/O parameter, same as target in ucnv_toUChars() for
+ *                      conversion from the source buffer to the pivot buffer.
+ *                      It must be pivotStart<=*pivotSource<=*pivotTarget<=pivotLimit
+ *                      and pivotStart<pivotLimit (unless pivotStart==NULL).
+ * @param pivotLimit    Pointer to the first unit after the pivot buffer.
+ * @param reset         If TRUE, then ucnv_resetToUnicode(sourceCnv) and
+ *                      ucnv_resetFromUnicode(targetCnv) are called, and the
+ *                      pivot pointers are reset (*pivotTarget=*pivotSource=pivotStart).
+ * @param flush         If true, indicates the end of the input.
+ *                      Passed directly to ucnv_toUnicode(), and carried over to
+ *                      ucnv_fromUnicode() when the source is empty as well.
+ * @param pErrorCode    ICU error code in/out parameter.
+ *                      Must fulfill U_SUCCESS before the function call.
+ *                      U_BUFFER_OVERFLOW_ERROR always refers to the target buffer
+ *                      because overflows into the pivot buffer are handled internally.
+ *                      Other conversion errors are from the source-to-pivot
+ *                      conversion if *pivotSource==pivotStart, otherwise from
+ *                      the pivot-to-target conversion.
+ *
+ * @see ucnv_convert
+ * @see ucnv_fromAlgorithmic
+ * @see ucnv_toAlgorithmic
+ * @see ucnv_fromUnicode
+ * @see ucnv_toUnicode
+ * @see ucnv_fromUChars
+ * @see ucnv_toUChars
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
+               char **target, const char *targetLimit,
+               const char **source, const char *sourceLimit,
+               UChar *pivotStart, UChar **pivotSource,
+               UChar **pivotTarget, const UChar *pivotLimit,
+               UBool reset, UBool flush,
+               UErrorCode *pErrorCode);
+
+/**
+ * Convert from one external charset to another.
+ * Internally, two converters are opened according to the name arguments,
+ * then the text is converted to and from the 16-bit Unicode "pivot"
+ * using ucnv_convertEx(), then the converters are closed again.
+ *
+ * This is a convenience function, not an efficient way to convert a lot of text:
+ * ucnv_convert()
+ * - takes charset names, not converter objects, so that
+ *   - two converters are opened for each call
+ *   - only single-string conversion is possible, not streaming operation
+ * - does not provide enough information to find out,
+ *   in case of failure, whether the toUnicode or
+ *   the fromUnicode conversion failed
+ * - allows NUL-terminated input
+ *   (only a single NUL byte, will not work for charsets with multi-byte NULs)
+ *   (if sourceLength==-1, see parameters)
+ * - terminate with a NUL on output
+ *   (only a single NUL byte, not useful for charsets with multi-byte NULs),
+ *   or set U_STRING_NOT_TERMINATED_WARNING if the output exactly fills
+ *   the target buffer
+ * - a pivot buffer is provided internally
+ *
+ * The function returns when one of the following is true:
+ * - the entire source text has been converted successfully to the target buffer
+ *   and either the target buffer is terminated with a single NUL byte
+ *   or the error code is set to U_STRING_NOT_TERMINATED_WARNING
+ * - a target buffer overflow occurred (U_BUFFER_OVERFLOW_ERROR)
+ *   and the full output string length is returned ("preflighting")
+ * - a conversion error occurred
+ *   (other U_FAILURE(), see description of pErrorCode)
+ *
+ * @param toConverterName   The name of the converter that is used to convert
+ *                          from the UTF-16 pivot buffer to the target.
+ * @param fromConverterName The name of the converter that is used to convert
+ *                          from the source to the UTF-16 pivot buffer.
+ * @param target            Pointer to the output buffer.
+ * @param targetCapacity    Capacity of the target, in bytes.
+ * @param source            Pointer to the input buffer.
+ * @param sourceLength      Length of the input text, in bytes, or -1 for NUL-terminated input.
+ * @param pErrorCode        ICU error code in/out parameter.
+ *                          Must fulfill U_SUCCESS before the function call.
+ * @return Length of the complete output text in bytes, even if it exceeds the targetCapacity
+ *         and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see ucnv_convertEx
+ * @see ucnv_fromAlgorithmic
+ * @see ucnv_toAlgorithmic
+ * @see ucnv_fromUnicode
+ * @see ucnv_toUnicode
+ * @see ucnv_fromUChars
+ * @see ucnv_toUChars
+ * @see ucnv_getNextUChar
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_convert(const char *toConverterName,
+             const char *fromConverterName,
+             char *target,
+             int32_t targetCapacity,
+             const char *source,
+             int32_t sourceLength,
+             UErrorCode *pErrorCode);
+
+/**
+ * Convert from one external charset to another.
+ * Internally, the text is converted to and from the 16-bit Unicode "pivot"
+ * using ucnv_convertEx(). ucnv_toAlgorithmic() works exactly like ucnv_convert()
+ * except that the two converters need not be looked up and opened completely.
+ *
+ * The source-to-pivot conversion uses the cnv converter parameter.
+ * The pivot-to-target conversion uses a purely algorithmic converter
+ * according to the specified type, e.g., UCNV_UTF8 for a UTF-8 converter.
+ *
+ * Internally, the algorithmic converter is opened and closed for each
+ * function call, which is more efficient than using the public ucnv_open()
+ * but somewhat less efficient than only resetting an existing converter
+ * and using ucnv_convertEx().
+ *
+ * This function is more convenient than ucnv_convertEx() for single-string
+ * conversions, especially when "preflighting" is desired (returning the length
+ * of the complete output even if it does not fit into the target buffer;
+ * see the User Guide Strings chapter). See ucnv_convert() for details.
+ *
+ * @param algorithmicType   UConverterType constant identifying the desired target
+ *                          charset as a purely algorithmic converter.
+ *                          Those are converters for Unicode charsets like
+ *                          UTF-8, BOCU-1, SCSU, UTF-7, IMAP-mailbox-name, etc.,
+ *                          as well as US-ASCII and ISO-8859-1.
+ * @param cnv               The converter that is used to convert
+ *                          from the source to the UTF-16 pivot buffer.
+ * @param target            Pointer to the output buffer.
+ * @param targetCapacity    Capacity of the target, in bytes.
+ * @param source            Pointer to the input buffer.
+ * @param sourceLength      Length of the input text, in bytes
+ * @param pErrorCode        ICU error code in/out parameter.
+ *                          Must fulfill U_SUCCESS before the function call.
+ * @return Length of the complete output text in bytes, even if it exceeds the targetCapacity
+ *         and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see ucnv_fromAlgorithmic
+ * @see ucnv_convert
+ * @see ucnv_convertEx
+ * @see ucnv_fromUnicode
+ * @see ucnv_toUnicode
+ * @see ucnv_fromUChars
+ * @see ucnv_toUChars
+ * @stable ICU 2.6
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_toAlgorithmic(UConverterType algorithmicType,
+                   UConverter *cnv,
+                   char *target, int32_t targetCapacity,
+                   const char *source, int32_t sourceLength,
+                   UErrorCode *pErrorCode);
+
+/**
+ * Convert from one external charset to another.
+ * Internally, the text is converted to and from the 16-bit Unicode "pivot"
+ * using ucnv_convertEx(). ucnv_fromAlgorithmic() works exactly like ucnv_convert()
+ * except that the two converters need not be looked up and opened completely.
+ *
+ * The source-to-pivot conversion uses a purely algorithmic converter
+ * according to the specified type, e.g., UCNV_UTF8 for a UTF-8 converter.
+ * The pivot-to-target conversion uses the cnv converter parameter.
+ *
+ * Internally, the algorithmic converter is opened and closed for each
+ * function call, which is more efficient than using the public ucnv_open()
+ * but somewhat less efficient than only resetting an existing converter
+ * and using ucnv_convertEx().
+ *
+ * This function is more convenient than ucnv_convertEx() for single-string
+ * conversions, especially when "preflighting" is desired (returning the length
+ * of the complete output even if it does not fit into the target buffer;
+ * see the User Guide Strings chapter). See ucnv_convert() for details.
+ *
+ * @param cnv               The converter that is used to convert
+ *                          from the UTF-16 pivot buffer to the target.
+ * @param algorithmicType   UConverterType constant identifying the desired source
+ *                          charset as a purely algorithmic converter.
+ *                          Those are converters for Unicode charsets like
+ *                          UTF-8, BOCU-1, SCSU, UTF-7, IMAP-mailbox-name, etc.,
+ *                          as well as US-ASCII and ISO-8859-1.
+ * @param target            Pointer to the output buffer.
+ * @param targetCapacity    Capacity of the target, in bytes.
+ * @param source            Pointer to the input buffer.
+ * @param sourceLength      Length of the input text, in bytes
+ * @param pErrorCode        ICU error code in/out parameter.
+ *                          Must fulfill U_SUCCESS before the function call.
+ * @return Length of the complete output text in bytes, even if it exceeds the targetCapacity
+ *         and a U_BUFFER_OVERFLOW_ERROR is set.
+ *
+ * @see ucnv_fromAlgorithmic
+ * @see ucnv_convert
+ * @see ucnv_convertEx
+ * @see ucnv_fromUnicode
+ * @see ucnv_toUnicode
+ * @see ucnv_fromUChars
+ * @see ucnv_toUChars
+ * @stable ICU 2.6
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_fromAlgorithmic(UConverter *cnv,
+                     UConverterType algorithmicType,
+                     char *target, int32_t targetCapacity,
+                     const char *source, int32_t sourceLength,
+                     UErrorCode *pErrorCode);
+
+/**
+ * Frees up memory occupied by unused, cached converter shared data.
+ *
+ * @return the number of cached converters successfully deleted
+ * @see ucnv_close
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_flushCache(void);
+
+/**
+ * Returns the number of available converters, as per the alias file.
+ *
+ * @return the number of available converters
+ * @see ucnv_getAvailableName
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_countAvailable(void);
+
+/**
+ * Gets the canonical converter name of the specified converter from a list of
+ * all available converters contaied in the alias file. All converters
+ * in this list can be opened.
+ *
+ * @param n the index to a converter available on the system (in the range <TT>[0..ucnv_countAvaiable()]</TT>)
+ * @return a pointer a string (library owned), or <TT>NULL</TT> if the index is out of bounds.
+ * @see ucnv_countAvailable
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+ucnv_getAvailableName(int32_t n);
+
+/**
+ * Returns a UEnumeration to enumerate all of the canonical converter
+ * names, as per the alias file, regardless of the ability to open each
+ * converter.
+ *
+ * @return A UEnumeration object for getting all the recognized canonical
+ *   converter names.
+ * @see ucnv_getAvailableName
+ * @see uenum_close
+ * @see uenum_next
+ * @stable ICU 2.4
+ */
+U_STABLE UEnumeration * U_EXPORT2
+ucnv_openAllNames(UErrorCode *pErrorCode);
+
+/**
+ * Gives the number of aliases for a given converter or alias name.
+ * If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
+ * This method only enumerates the listed entries in the alias file.
+ * @param alias alias name
+ * @param pErrorCode error status
+ * @return number of names on alias list for given alias
+ * @stable ICU 2.0
+ */
+U_STABLE uint16_t U_EXPORT2 
+ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
+
+/**
+ * Gives the name of the alias at given index of alias list.
+ * This method only enumerates the listed entries in the alias file.
+ * If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
+ * @param alias alias name
+ * @param n index in alias list
+ * @param pErrorCode result of operation
+ * @return returns the name of the alias at given index
+ * @see ucnv_countAliases
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2 
+ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
+
+/**
+ * Fill-up the list of alias names for the given alias.
+ * This method only enumerates the listed entries in the alias file.
+ * If the alias is ambiguous, then the preferred converter is used
+ * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.
+ * @param alias alias name
+ * @param aliases fill-in list, aliases is a pointer to an array of
+ *        <code>ucnv_countAliases()</code> string-pointers
+ *        (<code>const char *</code>) that will be filled in.
+ *        The strings themselves are owned by the library.
+ * @param pErrorCode result of operation
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 
+ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
+
+/**
+ * Return a new UEnumeration object for enumerating all the
+ * alias names for a given converter that are recognized by a standard.
+ * This method only enumerates the listed entries in the alias file.
+ * The convrtrs.txt file can be modified to change the results of
+ * this function.
+ * The first result in this list is the same result given by
+ * <code>ucnv_getStandardName</code>, which is the default alias for
+ * the specified standard name. The returned object must be closed with
+ * <code>uenum_close</code> when you are done with the object.
+ *
+ * @param convName original converter name
+ * @param standard name of the standard governing the names; MIME and IANA
+ *      are such standards
+ * @param pErrorCode The error code
+ * @return A UEnumeration object for getting all aliases that are recognized
+ *      by a standard. If any of the parameters are invalid, NULL
+ *      is returned.
+ * @see ucnv_getStandardName
+ * @see uenum_close
+ * @see uenum_next
+ * @stable ICU 2.2
+ */
+U_STABLE UEnumeration * U_EXPORT2
+ucnv_openStandardNames(const char *convName,
+                       const char *standard,
+                       UErrorCode *pErrorCode);
+
+/**
+ * Gives the number of standards associated to converter names.
+ * @return number of standards
+ * @stable ICU 2.0
+ */
+U_STABLE uint16_t U_EXPORT2
+ucnv_countStandards(void);
+
+/**
+ * Gives the name of the standard at given index of standard list.
+ * @param n index in standard list
+ * @param pErrorCode result of operation
+ * @return returns the name of the standard at given index. Owned by the library.
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2
+ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
+
+/**
+ * Returns a standard name for a given converter name.
+ * <p>
+ * Example alias table:<br>
+ * conv alias1 { STANDARD1 } alias2 { STANDARD1* }
+ * <p>
+ * Result of ucnv_getStandardName("conv", "STANDARD1") from example
+ * alias table:<br>
+ * <b>"alias2"</b>
+ *
+ * @param name original converter name
+ * @param standard name of the standard governing the names; MIME and IANA
+ *        are such standards
+ * @param pErrorCode result of operation
+ * @return returns the standard converter name;
+ *         if a standard converter name cannot be determined,
+ *         then <code>NULL</code> is returned. Owned by the library.
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2
+ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
+
+/**
+ * This function will return the internal canonical converter name of the
+ * tagged alias. This is the opposite of ucnv_openStandardNames, which
+ * returns the tagged alias given the canonical name.
+ * <p>
+ * Example alias table:<br>
+ * conv alias1 { STANDARD1 } alias2 { STANDARD1* }
+ * <p>
+ * Result of ucnv_getStandardName("alias1", "STANDARD1") from example
+ * alias table:<br>
+ * <b>"conv"</b>
+ *
+ * @return returns the canonical converter name;
+ *         if a standard or alias name cannot be determined,
+ *         then <code>NULL</code> is returned. The returned string is
+ *         owned by the library.
+ * @see ucnv_getStandardName
+ * @stable ICU 2.4
+ */
+U_STABLE const char * U_EXPORT2
+ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
+
+/**
+ * Returns the current default converter name. If you want to open
+ * a default converter, you do not need to use this function.
+ * It is faster if you pass a NULL argument to ucnv_open the
+ * default converter.
+ *
+ * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function
+ * always returns "UTF-8".
+ *
+ * @return returns the current default converter name.
+ *         Storage owned by the library
+ * @see ucnv_setDefaultName
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2
+ucnv_getDefaultName(void);
+
+/**
+ * This function is not thread safe. DO NOT call this function when ANY ICU
+ * function is being used from more than one thread! This function sets the
+ * current default converter name. If this function needs to be called, it
+ * should be called during application initialization. Most of the time, the
+ * results from ucnv_getDefaultName() or ucnv_open with a NULL string argument
+ * is sufficient for your application.
+ *
+ * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function
+ * does nothing.
+ *
+ * @param name the converter name to be the default (must be known by ICU).
+ * @see ucnv_getDefaultName
+ * @system
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_setDefaultName(const char *name);
+
+/**
+ * Fixes the backslash character mismapping.  For example, in SJIS, the backslash 
+ * character in the ASCII portion is also used to represent the yen currency sign.  
+ * When mapping from Unicode character 0x005C, it's unclear whether to map the 
+ * character back to yen or backslash in SJIS.  This function will take the input
+ * buffer and replace all the yen sign characters with backslash.  This is necessary
+ * when the user tries to open a file with the input buffer on Windows.
+ * This function will test the converter to see whether such mapping is
+ * required.  You can sometimes avoid using this function by using the correct version
+ * of Shift-JIS.
+ *
+ * @param cnv The converter representing the target codepage.
+ * @param source the input buffer to be fixed
+ * @param sourceLen the length of the input buffer
+ * @see ucnv_isAmbiguous
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
+
+/**
+ * Determines if the converter contains ambiguous mappings of the same
+ * character or not.
+ * @param cnv the converter to be tested
+ * @return TRUE if the converter contains ambiguous mapping of the same 
+ * character, FALSE otherwise.
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucnv_isAmbiguous(const UConverter *cnv);
+
+/**
+ * Sets the converter to use fallback mappings or not.
+ * Regardless of this flag, the converter will always use
+ * fallbacks from Unicode Private Use code points, as well as
+ * reverse fallbacks (to Unicode).
+ * For details see ".ucm File Format"
+ * in the Conversion Data chapter of the ICU User Guide:
+ * http://www.icu-project.org/userguide/conversion-data.html#ucmformat
+ *
+ * @param cnv The converter to set the fallback mapping usage on.
+ * @param usesFallback TRUE if the user wants the converter to take advantage of the fallback 
+ * mapping, FALSE otherwise.
+ * @stable ICU 2.0
+ * @see ucnv_usesFallback
+ */
+U_STABLE void U_EXPORT2 
+ucnv_setFallback(UConverter *cnv, UBool usesFallback);
+
+/**
+ * Determines if the converter uses fallback mappings or not.
+ * This flag has restrictions, see ucnv_setFallback().
+ *
+ * @param cnv The converter to be tested
+ * @return TRUE if the converter uses fallback, FALSE otherwise.
+ * @stable ICU 2.0
+ * @see ucnv_setFallback
+ */
+U_STABLE UBool U_EXPORT2 
+ucnv_usesFallback(const UConverter *cnv);
+
+/**
+ * Detects Unicode signature byte sequences at the start of the byte stream
+ * and returns the charset name of the indicated Unicode charset.
+ * NULL is returned when no Unicode signature is recognized.
+ * The number of bytes in the signature is output as well.
+ *
+ * The caller can ucnv_open() a converter using the charset name.
+ * The first code unit (UChar) from the start of the stream will be U+FEFF
+ * (the Unicode BOM/signature character) and can usually be ignored.
+ *
+ * For most Unicode charsets it is also possible to ignore the indicated
+ * number of initial stream bytes and start converting after them.
+ * However, there are stateful Unicode charsets (UTF-7 and BOCU-1) for which
+ * this will not work. Therefore, it is best to ignore the first output UChar
+ * instead of the input signature bytes.
+ * <p>
+ * Usage:
+ * @code     
+ *      UErrorCode err = U_ZERO_ERROR;
+ *      char input[] = { '\xEF','\xBB', '\xBF','\x41','\x42','\x43' };
+ *      int32_t signatureLength = 0;
+ *      char *encoding = ucnv_detectUnicodeSignature(input,sizeof(input),&signatureLength,&err);
+ *      UConverter *conv = NULL;
+ *      UChar output[100];
+ *      UChar *target = output, *out;
+ *      char *source = input;
+ *      if(encoding!=NULL && U_SUCCESS(err)){
+ *          // should signature be discarded ?
+ *          conv = ucnv_open(encoding, &err);
+ *          // do the conversion
+ *          ucnv_toUnicode(conv,
+ *                         target, output + sizeof(output)/U_SIZEOF_UCHAR,
+ *                         source, input + sizeof(input),
+ *                         NULL, TRUE, &err);
+ *          out = output;
+ *          if (discardSignature){
+ *              ++out; // ignore initial U+FEFF
+ *          }
+ *          while(out != target) {
+ *              printf("%04x ", *out++);
+ *          }
+ *          puts("");
+ *      }
+ *     
+ * @endcode
+ *
+ * @param source            The source string in which the signature should be detected.
+ * @param sourceLength      Length of the input string, or -1 if terminated with a NUL byte.
+ * @param signatureLength   A pointer to int32_t to receive the number of bytes that make up the signature 
+ *                          of the detected UTF. 0 if not detected.
+ *                          Can be a NULL pointer.
+ * @param pErrorCode        ICU error code in/out parameter.
+ *                          Must fulfill U_SUCCESS before the function call.
+ * @return The name of the encoding detected. NULL if encoding is not detected. 
+ * @stable ICU 2.4
+ */
+U_STABLE const char* U_EXPORT2
+ucnv_detectUnicodeSignature(const char* source,
+                            int32_t sourceLength,
+                            int32_t *signatureLength,
+                            UErrorCode *pErrorCode);
+
+/**
+ * Returns the number of UChars held in the converter's internal state 
+ * because more input is needed for completing the conversion. This function is 
+ * useful for mapping semantics of ICU's converter interface to those of iconv,
+ * and this information is not needed for normal conversion.
+ * @param cnv       The converter in which the input is held
+ * @param status    ICU error code in/out parameter.
+ *                  Must fulfill U_SUCCESS before the function call.
+ * @return The number of UChars in the state. -1 if an error is encountered.
+ * @stable ICU 3.4
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
+
+/**
+ * Returns the number of chars held in the converter's internal state
+ * because more input is needed for completing the conversion. This function is 
+ * useful for mapping semantics of ICU's converter interface to those of iconv,
+ * and this information is not needed for normal conversion.
+ * @param cnv       The converter in which the input is held as internal state
+ * @param status    ICU error code in/out parameter.
+ *                  Must fulfill U_SUCCESS before the function call.
+ * @return The number of chars in the state. -1 if an error is encountered.
+ * @stable ICU 3.4
+ */
+U_STABLE int32_t U_EXPORT2
+ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
+
+#endif
+
+#endif
+/*_UCNV*/
diff --git a/Source/WTF/icu/unicode/ucnv_err.h b/Source/WTF/icu/unicode/ucnv_err.h
new file mode 100644
index 0000000..e092e95
--- /dev/null
+++ b/Source/WTF/icu/unicode/ucnv_err.h
@@ -0,0 +1,463 @@
+/*
+**********************************************************************
+*   Copyright (C) 1999-2009, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+**********************************************************************
+ *
+ *
+ *   ucnv_err.h:
+ */
+
+/**
+ * \file
+ * \brief C UConverter predefined error callbacks
+ *
+ *  <h2>Error Behaviour Functions</h2>
+ *  Defines some error behaviour functions called by ucnv_{from,to}Unicode
+ *  These are provided as part of ICU and many are stable, but they
+ *  can also be considered only as an example of what can be done with
+ *  callbacks.  You may of course write your own.
+ *
+ *  If you want to write your own, you may also find the functions from
+ *  ucnv_cb.h useful when writing your own callbacks.
+ *
+ *  These functions, although public, should NEVER be called directly.
+ *  They should be used as parameters to the ucnv_setFromUCallback
+ *  and ucnv_setToUCallback functions, to set the behaviour of a converter
+ *  when it encounters ILLEGAL/UNMAPPED/INVALID sequences.
+ *
+ *  usage example:  'STOP' doesn't need any context, but newContext
+ *    could be set to something other than 'NULL' if needed. The available
+ *    contexts in this header can modify the default behavior of the callback.
+ *
+ *  \code
+ *  UErrorCode err = U_ZERO_ERROR;
+ *  UConverter *myConverter = ucnv_open("ibm-949", &err);
+ *  const void *oldContext;
+ *  UConverterFromUCallback oldAction;
+ *
+ *
+ *  if (U_SUCCESS(err))
+ *  {
+ *      ucnv_setFromUCallBack(myConverter,
+ *                       UCNV_FROM_U_CALLBACK_STOP,
+ *                       NULL,
+ *                       &oldAction,
+ *                       &oldContext,
+ *                       &status);
+ *  }
+ *  \endcode
+ *
+ *  The code above tells "myConverter" to stop when it encounters an
+ *  ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
+ *  Unicode -> Codepage. The behavior from Codepage to Unicode is not changed,
+ *  and ucnv_setToUCallBack would need to be called in order to change
+ *  that behavior too.
+ *
+ *  Here is an example with a context:
+ *
+ *  \code
+ *  UErrorCode err = U_ZERO_ERROR;
+ *  UConverter *myConverter = ucnv_open("ibm-949", &err);
+ *  const void *oldContext;
+ *  UConverterFromUCallback oldAction;
+ *
+ *
+ *  if (U_SUCCESS(err))
+ *  {
+ *      ucnv_setToUCallBack(myConverter,
+ *                       UCNV_TO_U_CALLBACK_SUBSTITUTE,
+ *                       UCNV_SUB_STOP_ON_ILLEGAL,
+ *                       &oldAction,
+ *                       &oldContext,
+ *                       &status);
+ *  }
+ *  \endcode
+ *
+ *  The code above tells "myConverter" to stop when it encounters an
+ *  ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from
+ *  Codepage -> Unicode. Any unmapped and legal characters will be
+ *  substituted to be the default substitution character.
+ */
+
+#ifndef UCNV_ERR_H
+#define UCNV_ERR_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+
+/** Forward declaring the UConverter structure. @stable ICU 2.0 */
+struct UConverter;
+
+/** @stable ICU 2.0 */
+typedef struct UConverter UConverter;
+
+/**
+ * FROM_U, TO_U context options for sub callback
+ * @stable ICU 2.0
+ */
+#define UCNV_SUB_STOP_ON_ILLEGAL "i"
+
+/**
+ * FROM_U, TO_U context options for skip callback
+ * @stable ICU 2.0
+ */
+#define UCNV_SKIP_STOP_ON_ILLEGAL "i"
+
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX) 
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_ICU       NULL
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to JAVA (\\uXXXX)
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_JAVA      "J"
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX)
+ * TO_U_CALLBACK_ESCAPE option to escape the character value accoding to C (\\xXXXX)
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_C         "C"
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&amp;#DDDD;)\endhtmlonly
+ * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Decimal escape \htmlonly(&amp;#DDDD;)\endhtmlonly
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_XML_DEC   "D"
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&amp;#xXXXX;)\endhtmlonly
+ * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Hex escape \htmlonly(&amp;#xXXXX;)\endhtmlonly
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_XML_HEX   "X"
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to Unicode (U+XXXXX)
+ * @stable ICU 2.0
+ */
+#define UCNV_ESCAPE_UNICODE   "U"
+
+/**
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to CSS2 conventions (\\HH..H<space>, that is,
+ * a backslash, 1..6 hex digits, and a space)
+ * @stable ICU 4.0
+ */
+#define UCNV_ESCAPE_CSS2   "S"
+
+/** 
+ * The process condition code to be used with the callbacks.  
+ * Codes which are greater than UCNV_IRREGULAR should be 
+ * passed on to any chained callbacks.
+ * @stable ICU 2.0
+ */
+typedef enum {
+    UCNV_UNASSIGNED = 0,  /**< The code point is unassigned.
+                             The error code U_INVALID_CHAR_FOUND will be set. */
+    UCNV_ILLEGAL = 1,     /**< The code point is illegal. For example, 
+                             \\x81\\x2E is illegal in SJIS because \\x2E
+                             is not a valid trail byte for the \\x81 
+                             lead byte.
+                             Also, starting with Unicode 3.0.1, non-shortest byte sequences
+                             in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061)
+                             are also illegal, not just irregular.
+                             The error code U_ILLEGAL_CHAR_FOUND will be set. */
+    UCNV_IRREGULAR = 2,   /**< The codepoint is not a regular sequence in 
+                             the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF
+                             are irregular UTF-8 byte sequences for single surrogate
+                             code points.
+                             The error code U_INVALID_CHAR_FOUND will be set. */
+    UCNV_RESET = 3,       /**< The callback is called with this reason when a
+                             'reset' has occured. Callback should reset all
+                             state. */
+    UCNV_CLOSE = 4,        /**< Called when the converter is closed. The
+                             callback should release any allocated memory.*/
+    UCNV_CLONE = 5         /**< Called when ucnv_safeClone() is called on the
+                              converter. the pointer available as the
+                              'context' is an alias to the original converters'
+                              context pointer. If the context must be owned
+                              by the new converter, the callback must clone 
+                              the data and call ucnv_setFromUCallback 
+                              (or setToUCallback) with the correct pointer.
+                              @stable ICU 2.2
+                           */
+} UConverterCallbackReason;
+
+
+/**
+ * The structure for the fromUnicode callback function parameter.
+ * @stable ICU 2.0
+ */
+typedef struct {
+    uint16_t size;              /**< The size of this struct. @stable ICU 2.0 */
+    UBool flush;                /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0    */
+    UConverter *converter;      /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0  */
+    const UChar *source;        /**< Pointer to the source source buffer. @stable ICU 2.0    */
+    const UChar *sourceLimit;   /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0    */
+    char *target;               /**< Pointer to the target buffer. @stable ICU 2.0    */
+    const char *targetLimit;    /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0     */
+    int32_t *offsets;           /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0  */
+} UConverterFromUnicodeArgs;
+
+
+/**
+ * The structure for the toUnicode callback function parameter.
+ * @stable ICU 2.0
+ */
+typedef struct {
+    uint16_t size;              /**< The size of this struct   @stable ICU 2.0 */
+    UBool flush;                /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0   */
+    UConverter *converter;      /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */
+    const char *source;         /**< Pointer to the source source buffer. @stable ICU 2.0    */
+    const char *sourceLimit;    /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0    */
+    UChar *target;              /**< Pointer to the target buffer. @stable ICU 2.0    */
+    const UChar *targetLimit;   /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0     */
+    int32_t *offsets;           /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0  */
+} UConverterToUnicodeArgs;
+
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This From Unicode callback STOPS at the ILLEGAL_SEQUENCE,
+ * returning the error code back to the caller immediately.
+ *
+ * @param context Pointer to the callback's private data
+ * @param fromUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
+ * @param reason Defines the reason the callback was invoked
+ * @param err This should always be set to a failure status prior to calling.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP (
+                  const void *context,
+                  UConverterFromUnicodeArgs *fromUArgs,
+                  const UChar* codeUnits,
+                  int32_t length,
+                  UChar32 codePoint,
+                  UConverterCallbackReason reason,
+                  UErrorCode * err);
+
+
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This To Unicode callback STOPS at the ILLEGAL_SEQUENCE,
+ * returning the error code back to the caller immediately.
+ *
+ * @param context Pointer to the callback's private data
+ * @param toUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param reason Defines the reason the callback was invoked
+ * @param err This should always be set to a failure status prior to calling.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP (
+                  const void *context,
+                  UConverterToUnicodeArgs *toUArgs,
+                  const char* codeUnits,
+                  int32_t length,
+                  UConverterCallbackReason reason,
+                  UErrorCode * err);
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This From Unicode callback skips any ILLEGAL_SEQUENCE, or
+ * skips only UNASSINGED_SEQUENCE depending on the context parameter
+ * simply ignoring those characters. 
+ *
+ * @param context  The function currently recognizes the callback options:
+ *                 UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
+ *                      returning the error code back to the caller immediately.
+ *                 NULL: Skips any ILLEGAL_SEQUENCE
+ * @param fromUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ *      otherwise this value will be set to a failure status.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP (
+                  const void *context,
+                  UConverterFromUnicodeArgs *fromUArgs,
+                  const UChar* codeUnits,
+                  int32_t length,
+                  UChar32 codePoint,
+                  UConverterCallbackReason reason,
+                  UErrorCode * err);
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or 
+ * UNASSIGNED_SEQUENCE depending on context parameter, with the
+ * current substitution string for the converter. This is the default
+ * callback.
+ *
+ * @param context The function currently recognizes the callback options:
+ *                 UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
+ *                      returning the error code back to the caller immediately.
+ *                 NULL: Substitutes any ILLEGAL_SEQUENCE
+ * @param fromUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ *      otherwise this value will be set to a failure status.
+ * @see ucnv_setSubstChars
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE (
+                  const void *context,
+                  UConverterFromUnicodeArgs *fromUArgs,
+                  const UChar* codeUnits,
+                  int32_t length,
+                  UChar32 codePoint,
+                  UConverterCallbackReason reason,
+                  UErrorCode * err);
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This From Unicode callback will Substitute the ILLEGAL SEQUENCE with the
+ * hexadecimal representation of the illegal codepoints
+ *
+ * @param context The function currently recognizes the callback options:
+ *        <ul>
+ *        <li>UCNV_ESCAPE_ICU: Substitues the  ILLEGAL SEQUENCE with the hexadecimal 
+ *          representation in the format  %UXXXX, e.g. "%uFFFE%u00AC%uC8FE"). 
+ *          In the Event the converter doesn't support the characters {%,U}[A-F][0-9], 
+ *          it will  substitute  the illegal sequence with the substitution characters.
+ *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
+ *          %UD84D%UDC56</li>
+ *        <li>UCNV_ESCAPE_JAVA: Substitues the  ILLEGAL SEQUENCE with the hexadecimal 
+ *          representation in the format  \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). 
+ *          In the Event the converter doesn't support the characters {\,u}[A-F][0-9], 
+ *          it will  substitute  the illegal sequence with the substitution characters.
+ *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
+ *          \\uD84D\\uDC56</li>
+ *        <li>UCNV_ESCAPE_C: Substitues the  ILLEGAL SEQUENCE with the hexadecimal 
+ *          representation in the format  \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). 
+ *          In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9], 
+ *          it will  substitute  the illegal sequence with the substitution characters.
+ *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
+ *          \\U00023456</li>
+ *        <li>UCNV_ESCAPE_XML_DEC: Substitues the  ILLEGAL SEQUENCE with the decimal 
+ *          representation in the format \htmlonly&amp;#DDDDDDDD;, e.g. "&amp;#65534;&amp;#172;&amp;#51454;")\endhtmlonly. 
+ *          In the Event the converter doesn't support the characters {&amp;,#}[0-9], 
+ *          it will  substitute  the illegal sequence with the substitution characters.
+ *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
+ *          &amp;#144470; and Zero padding is ignored.</li>
+ *        <li>UCNV_ESCAPE_XML_HEX:Substitues the  ILLEGAL SEQUENCE with the decimal 
+ *          representation in the format \htmlonly&amp;#xXXXX; e.g. "&amp;#xFFFE;&amp;#x00AC;&amp;#xC8FE;")\endhtmlonly. 
+ *          In the Event the converter doesn't support the characters {&,#,x}[0-9], 
+ *          it will  substitute  the illegal sequence with the substitution characters.
+ *          Note that  codeUnit(32bit int eg: unit of a surrogate pair) is represented as
+ *          \htmlonly&amp;#x23456;\endhtmlonly</li>
+ *        </ul>
+ * @param fromUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint.
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ *      otherwise this value will be set to a failure status.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE (
+                  const void *context,
+                  UConverterFromUnicodeArgs *fromUArgs,
+                  const UChar* codeUnits,
+                  int32_t length,
+                  UChar32 codePoint,
+                  UConverterCallbackReason reason,
+                  UErrorCode * err);
+
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This To Unicode callback skips any ILLEGAL_SEQUENCE, or
+ * skips only UNASSINGED_SEQUENCE depending on the context parameter
+ * simply ignoring those characters. 
+ *
+ * @param context  The function currently recognizes the callback options:
+ *                 UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
+ *                      returning the error code back to the caller immediately.
+ *                 NULL: Skips any ILLEGAL_SEQUENCE
+ * @param toUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ *      otherwise this value will be set to a failure status.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP (
+                  const void *context,
+                  UConverterToUnicodeArgs *toUArgs,
+                  const char* codeUnits,
+                  int32_t length,
+                  UConverterCallbackReason reason,
+                  UErrorCode * err);
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or 
+ * UNASSIGNED_SEQUENCE depending on context parameter,  with the
+ * Unicode substitution character, U+FFFD.
+ *
+ * @param context  The function currently recognizes the callback options:
+ *                 UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
+ *                      returning the error code back to the caller immediately.
+ *                 NULL: Substitutes any ILLEGAL_SEQUENCE
+ * @param toUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ *      otherwise this value will be set to a failure status.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE (
+                  const void *context,
+                  UConverterToUnicodeArgs *toUArgs,
+                  const char* codeUnits,
+                  int32_t length,
+                  UConverterCallbackReason reason,
+                  UErrorCode * err);
+
+/**
+ * DO NOT CALL THIS FUNCTION DIRECTLY!
+ * This To Unicode callback will Substitute the ILLEGAL SEQUENCE with the
+ * hexadecimal representation of the illegal bytes
+ *  (in the format  %XNN, e.g. "%XFF%X0A%XC8%X03").
+ *
+ * @param context This function currently recognizes the callback options:
+ *      UCNV_ESCAPE_ICU, UCNV_ESCAPE_JAVA, UCNV_ESCAPE_C, UCNV_ESCAPE_XML_DEC,
+ *      UCNV_ESCAPE_XML_HEX and UCNV_ESCAPE_UNICODE.
+ * @param toUArgs Information about the conversion in progress
+ * @param codeUnits Points to 'length' bytes of the concerned codepage sequence
+ * @param length Size (in bytes) of the concerned codepage sequence
+ * @param reason Defines the reason the callback was invoked
+ * @param err Return value will be set to success if the callback was handled,
+ *      otherwise this value will be set to a failure status.
+ * @stable ICU 2.0
+ */
+
+U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE (
+                  const void *context,
+                  UConverterToUnicodeArgs *toUArgs,
+                  const char* codeUnits,
+                  int32_t length,
+                  UConverterCallbackReason reason,
+                  UErrorCode * err);
+
+#endif
+
+#endif
+
+/*UCNV_ERR_H*/ 
diff --git a/Source/WTF/icu/unicode/ucol.h b/Source/WTF/icu/unicode/ucol.h
new file mode 100644
index 0000000..4a4cd60
--- /dev/null
+++ b/Source/WTF/icu/unicode/ucol.h
@@ -0,0 +1,1227 @@
+/*
+*******************************************************************************
+* Copyright (c) 1996-2010, International Business Machines Corporation and others.
+* All Rights Reserved.
+*******************************************************************************
+*/
+
+#ifndef UCOL_H
+#define UCOL_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_COLLATION
+
+#include "unicode/unorm.h"
+#include "unicode/localpointer.h"
+#include "unicode/parseerr.h"
+#include "unicode/uloc.h"
+#include "unicode/uset.h"
+
+/**
+ * \file
+ * \brief C API: Collator 
+ *
+ * <h2> Collator C API </h2>
+ *
+ * The C API for Collator performs locale-sensitive
+ * string comparison. You use this service to build
+ * searching and sorting routines for natural language text.
+ * <em>Important: </em>The ICU collation service has been reimplemented 
+ * in order to achieve better performance and UCA compliance. 
+ * For details, see the 
+ * <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm">
+ * collation design document</a>.
+ * <p>
+ * For more information about the collation service see 
+ * <a href="http://icu-project.org/userguide/Collate_Intro.html">the users guide</a>.
+ * <p>
+ * Collation service provides correct sorting orders for most locales supported in ICU. 
+ * If specific data for a locale is not available, the orders eventually falls back
+ * to the <a href="http://www.unicode.org/unicode/reports/tr10/">UCA sort order</a>. 
+ * <p>
+ * Sort ordering may be customized by providing your own set of rules. For more on
+ * this subject see the 
+ * <a href="http://icu-project.org/userguide/Collate_Customization.html">
+ * Collation customization</a> section of the users guide.
+ * <p>
+ * @see         UCollationResult
+ * @see         UNormalizationMode
+ * @see         UCollationStrength
+ * @see         UCollationElements
+ */
+
+/** A collator.
+*  For usage in C programs.
+*/
+struct UCollator;
+/** structure representing a collator object instance 
+ * @stable ICU 2.0
+ */
+typedef struct UCollator UCollator;
+
+
+/**
+ * UCOL_LESS is returned if source string is compared to be less than target
+ * string in the u_strcoll() method.
+ * UCOL_EQUAL is returned if source string is compared to be equal to target
+ * string in the u_strcoll() method.
+ * UCOL_GREATER is returned if source string is compared to be greater than
+ * target string in the u_strcoll() method.
+ * @see u_strcoll()
+ * <p>
+ * Possible values for a comparison result 
+ * @stable ICU 2.0
+ */
+typedef enum {
+  /** string a == string b */
+  UCOL_EQUAL    = 0,
+  /** string a > string b */
+  UCOL_GREATER    = 1,
+  /** string a < string b */
+  UCOL_LESS    = -1
+} UCollationResult ;
+
+
+/** Enum containing attribute values for controling collation behavior.
+ * Here are all the allowable values. Not every attribute can take every value. The only
+ * universal value is UCOL_DEFAULT, which resets the attribute value to the predefined  
+ * value for that locale 
+ * @stable ICU 2.0
+ */
+typedef enum {
+  /** accepted by most attributes */
+  UCOL_DEFAULT = -1,
+
+  /** Primary collation strength */
+  UCOL_PRIMARY = 0,
+  /** Secondary collation strength */
+  UCOL_SECONDARY = 1,
+  /** Tertiary collation strength */
+  UCOL_TERTIARY = 2,
+  /** Default collation strength */
+  UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
+  UCOL_CE_STRENGTH_LIMIT,
+  /** Quaternary collation strength */
+  UCOL_QUATERNARY=3,
+  /** Identical collation strength */
+  UCOL_IDENTICAL=15,
+  UCOL_STRENGTH_LIMIT,
+
+  /** Turn the feature off - works for UCOL_FRENCH_COLLATION, 
+      UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
+      & UCOL_DECOMPOSITION_MODE*/
+  UCOL_OFF = 16,
+  /** Turn the feature on - works for UCOL_FRENCH_COLLATION, 
+      UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
+      & UCOL_DECOMPOSITION_MODE*/
+  UCOL_ON = 17,
+  
+  /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be shifted */
+  UCOL_SHIFTED = 20,
+  /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be non ignorable */
+  UCOL_NON_IGNORABLE = 21,
+
+  /** Valid for UCOL_CASE_FIRST - 
+      lower case sorts before upper case */
+  UCOL_LOWER_FIRST = 24,
+  /** upper case sorts before lower case */
+  UCOL_UPPER_FIRST = 25,
+
+  UCOL_ATTRIBUTE_VALUE_COUNT
+
+} UColAttributeValue;
+
+/** Enum containing the codes for reordering segments of the collation table that are not script
+ *  codes. These reordering codes are to be used in conjunction with the script codes.
+ *  @internal
+ */
+typedef enum {
+    UCOL_REORDER_CODE_SPACE          = 0x1000,
+    UCOL_REORDER_CODE_FIRST          = UCOL_REORDER_CODE_SPACE,
+    UCOL_REORDER_CODE_PUNCTUATION    = 0x1001,
+    UCOL_REORDER_CODE_SYMBOL         = 0x1002,
+    UCOL_REORDER_CODE_CURRENCY       = 0x1003,
+    UCOL_REORDER_CODE_DIGIT          = 0x1004,
+    UCOL_REORDER_CODE_LIMIT          = 0x1005
+} UColReorderCode;
+
+/**
+ * Base letter represents a primary difference.  Set comparison
+ * level to UCOL_PRIMARY to ignore secondary and tertiary differences.
+ * Use this to set the strength of a Collator object.
+ * Example of primary difference, "abc" &lt; "abd"
+ * 
+ * Diacritical differences on the same base letter represent a secondary
+ * difference.  Set comparison level to UCOL_SECONDARY to ignore tertiary
+ * differences. Use this to set the strength of a Collator object.
+ * Example of secondary difference, "&auml;" >> "a".
+ *
+ * Uppercase and lowercase versions of the same character represents a
+ * tertiary difference.  Set comparison level to UCOL_TERTIARY to include
+ * all comparison differences. Use this to set the strength of a Collator
+ * object.
+ * Example of tertiary difference, "abc" &lt;&lt;&lt; "ABC".
+ *
+ * Two characters are considered "identical" when they have the same
+ * unicode spellings.  UCOL_IDENTICAL.
+ * For example, "&auml;" == "&auml;".
+ *
+ * UCollationStrength is also used to determine the strength of sort keys 
+ * generated from UCollator objects
+ * These values can be now found in the UColAttributeValue enum.
+ * @stable ICU 2.0
+ **/
+typedef UColAttributeValue UCollationStrength;
+
+/** Attributes that collation service understands. All the attributes can take UCOL_DEFAULT
+ * value, as well as the values specific to each one. 
+ * @stable ICU 2.0
+ */
+typedef enum {
+     /** Attribute for direction of secondary weights - used in French.
+      * Acceptable values are UCOL_ON, which results in secondary weights
+      * being considered backwards and UCOL_OFF which treats secondary
+      * weights in the order they appear.*/
+     UCOL_FRENCH_COLLATION, 
+     /** Attribute for handling variable elements.
+      * Acceptable values are UCOL_NON_IGNORABLE (default)
+      * which treats all the codepoints with non-ignorable 
+      * primary weights in the same way,
+      * and UCOL_SHIFTED which causes codepoints with primary 
+      * weights that are equal or below the variable top value
+      * to be ignored on primary level and moved to the quaternary 
+      * level.*/
+     UCOL_ALTERNATE_HANDLING, 
+     /** Controls the ordering of upper and lower case letters.
+      * Acceptable values are UCOL_OFF (default), which orders
+      * upper and lower case letters in accordance to their tertiary
+      * weights, UCOL_UPPER_FIRST which forces upper case letters to 
+      * sort before lower case letters, and UCOL_LOWER_FIRST which does 
+      * the opposite. */
+     UCOL_CASE_FIRST, 
+     /** Controls whether an extra case level (positioned before the third
+      * level) is generated or not. Acceptable values are UCOL_OFF (default), 
+      * when case level is not generated, and UCOL_ON which causes the case
+      * level to be generated. Contents of the case level are affected by
+      * the value of UCOL_CASE_FIRST attribute. A simple way to ignore 
+      * accent differences in a string is to set the strength to UCOL_PRIMARY
+      * and enable case level. */
+     UCOL_CASE_LEVEL,
+     /** Controls whether the normalization check and necessary normalizations
+      * are performed. When set to UCOL_OFF (default) no normalization check
+      * is performed. The correctness of the result is guaranteed only if the 
+      * input data is in so-called FCD form (see users manual for more info).
+      * When set to UCOL_ON, an incremental check is performed to see whether
+      * the input data is in the FCD form. If the data is not in the FCD form,
+      * incremental NFD normalization is performed. */
+     UCOL_NORMALIZATION_MODE, 
+     /** An alias for UCOL_NORMALIZATION_MODE attribute */
+     UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
+     /** The strength attribute. Can be either UCOL_PRIMARY, UCOL_SECONDARY,
+      * UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL. The usual strength
+      * for most locales (except Japanese) is tertiary. Quaternary strength 
+      * is useful when combined with shifted setting for alternate handling
+      * attribute and for JIS x 4061 collation, when it is used to distinguish
+      * between Katakana  and Hiragana (this is achieved by setting the 
+      * UCOL_HIRAGANA_QUATERNARY mode to on. Otherwise, quaternary level
+      * is affected only by the number of non ignorable code points in
+      * the string. Identical strength is rarely useful, as it amounts 
+      * to codepoints of the NFD form of the string. */
+     UCOL_STRENGTH,  
+     /** When turned on, this attribute positions Hiragana before all  
+      * non-ignorables on quaternary level This is a sneaky way to produce JIS
+      * sort order */
+     UCOL_HIRAGANA_QUATERNARY_MODE,
+     /** When turned on, this attribute generates a collation key
+      * for the numeric value of substrings of digits.
+      * This is a way to get '100' to sort AFTER '2'. Note that the longest
+      * digit substring that can be treated as a single collation element is
+      * 254 digits (not counting leading zeros). If a digit substring is
+      * longer than that, the digits beyond the limit will be treated as a
+      * separate digit substring associated with a separate collation element. */
+     UCOL_NUMERIC_COLLATION, 
+     UCOL_ATTRIBUTE_COUNT
+} UColAttribute;
+
+/** Options for retrieving the rule string 
+ *  @stable ICU 2.0
+ */
+typedef enum {
+  /** Retrieve tailoring only */
+  UCOL_TAILORING_ONLY, 
+  /** Retrieve UCA rules and tailoring */
+  UCOL_FULL_RULES 
+} UColRuleOption ;
+
+/**
+ * Open a UCollator for comparing strings.
+ * The UCollator pointer is used in all the calls to the Collation 
+ * service. After finished, collator must be disposed of by calling
+ * {@link #ucol_close }.
+ * @param loc The locale containing the required collation rules. 
+ *            Special values for locales can be passed in - 
+ *            if NULL is passed for the locale, the default locale
+ *            collation rules will be used. If empty string ("") or
+ *            "root" are passed, UCA rules will be used.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return A pointer to a UCollator, or 0 if an error occurred.
+ * @see ucol_openRules
+ * @see ucol_safeClone
+ * @see ucol_close
+ * @stable ICU 2.0
+ */
+U_STABLE UCollator* U_EXPORT2 
+ucol_open(const char *loc, UErrorCode *status);
+
+/**
+ * Produce an UCollator instance according to the rules supplied.
+ * The rules are used to change the default ordering, defined in the
+ * UCA in a process called tailoring. The resulting UCollator pointer
+ * can be used in the same way as the one obtained by {@link #ucol_strcoll }.
+ * @param rules A string describing the collation rules. For the syntax
+ *              of the rules please see users guide.
+ * @param rulesLength The length of rules, or -1 if null-terminated.
+ * @param normalizationMode The normalization mode: One of
+ *             UCOL_OFF     (expect the text to not need normalization),
+ *             UCOL_ON      (normalize), or
+ *             UCOL_DEFAULT (set the mode according to the rules)
+ * @param strength The default collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
+ * UCOL_TERTIARY, UCOL_IDENTICAL,UCOL_DEFAULT_STRENGTH - can be also set in the rules.
+ * @param parseError  A pointer to UParseError to recieve information about errors
+ *                    occurred during parsing. This argument can currently be set
+ *                    to NULL, but at users own risk. Please provide a real structure.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return A pointer to a UCollator. It is not guaranteed that NULL be returned in case
+ *         of error - please use status argument to check for errors.
+ * @see ucol_open
+ * @see ucol_safeClone
+ * @see ucol_close
+ * @stable ICU 2.0
+ */
+U_STABLE UCollator* U_EXPORT2 
+ucol_openRules( const UChar        *rules,
+                int32_t            rulesLength,
+                UColAttributeValue normalizationMode,
+                UCollationStrength strength,
+                UParseError        *parseError,
+                UErrorCode         *status);
+
+/** 
+ * Open a collator defined by a short form string.
+ * The structure and the syntax of the string is defined in the "Naming collators"
+ * section of the users guide: 
+ * http://icu-project.org/userguide/Collate_Concepts.html#Naming_Collators
+ * Attributes are overriden by the subsequent attributes. So, for "S2_S3", final
+ * strength will be 3. 3066bis locale overrides individual locale parts.
+ * The call to this function is equivalent to a call to ucol_open, followed by a 
+ * series of calls to ucol_setAttribute and ucol_setVariableTop.
+ * @param definition A short string containing a locale and a set of attributes. 
+ *                   Attributes not explicitly mentioned are left at the default
+ *                   state for a locale.
+ * @param parseError if not NULL, structure that will get filled with error's pre
+ *                   and post context in case of error.
+ * @param forceDefaults if FALSE, the settings that are the same as the collator 
+ *                   default settings will not be applied (for example, setting
+ *                   French secondary on a French collator would not be executed). 
+ *                   If TRUE, all the settings will be applied regardless of the 
+ *                   collator default value. If the definition
+ *                   strings are to be cached, should be set to FALSE.
+ * @param status     Error code. Apart from regular error conditions connected to 
+ *                   instantiating collators (like out of memory or similar), this
+ *                   API will return an error if an invalid attribute or attribute/value
+ *                   combination is specified.
+ * @return           A pointer to a UCollator or 0 if an error occured (including an 
+ *                   invalid attribute).
+ * @see ucol_open
+ * @see ucol_setAttribute
+ * @see ucol_setVariableTop
+ * @see ucol_getShortDefinitionString
+ * @see ucol_normalizeShortDefinitionString
+ * @stable ICU 3.0
+ *
+ */
+U_STABLE UCollator* U_EXPORT2
+ucol_openFromShortString( const char *definition,
+                          UBool forceDefaults,
+                          UParseError *parseError,
+                          UErrorCode *status);
+
+/**
+ * Get a set containing the contractions defined by the collator. The set includes
+ * both the UCA contractions and the contractions defined by the collator. This set
+ * will contain only strings. If a tailoring explicitly suppresses contractions from 
+ * the UCA (like Russian), removed contractions will not be in the resulting set.
+ * @param coll collator 
+ * @param conts the set to hold the result. It gets emptied before
+ *              contractions are added. 
+ * @param status to hold the error code
+ * @return the size of the contraction set
+ *
+ * @deprecated ICU 3.4, use ucol_getContractionsAndExpansions instead
+ */
+U_DEPRECATED int32_t U_EXPORT2
+ucol_getContractions( const UCollator *coll,
+                  USet *conts,
+                  UErrorCode *status);
+
+/**
+ * Get a set containing the expansions defined by the collator. The set includes
+ * both the UCA expansions and the expansions defined by the tailoring
+ * @param coll collator
+ * @param contractions if not NULL, the set to hold the contractions
+ * @param expansions if not NULL, the set to hold the expansions
+ * @param addPrefixes add the prefix contextual elements to contractions
+ * @param status to hold the error code
+ *
+ * @stable ICU 3.4
+ */
+U_STABLE void U_EXPORT2
+ucol_getContractionsAndExpansions( const UCollator *coll,
+                  USet *contractions, USet *expansions,
+                  UBool addPrefixes, UErrorCode *status);
+
+/** 
+ * Close a UCollator.
+ * Once closed, a UCollator should not be used. Every open collator should
+ * be closed. Otherwise, a memory leak will result.
+ * @param coll The UCollator to close.
+ * @see ucol_open
+ * @see ucol_openRules
+ * @see ucol_safeClone
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 
+ucol_close(UCollator *coll);
+
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUCollatorPointer
+ * "Smart pointer" class, closes a UCollator via ucol_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 4.4
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
+
+U_NAMESPACE_END
+
+#endif
+
+/**
+ * Compare two strings.
+ * The strings will be compared using the options already specified.
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return The result of comparing the strings; one of UCOL_EQUAL,
+ * UCOL_GREATER, UCOL_LESS
+ * @see ucol_greater
+ * @see ucol_greaterOrEqual
+ * @see ucol_equal
+ * @stable ICU 2.0
+ */
+U_STABLE UCollationResult U_EXPORT2 
+ucol_strcoll(    const    UCollator    *coll,
+        const    UChar        *source,
+        int32_t            sourceLength,
+        const    UChar        *target,
+        int32_t            targetLength);
+
+/**
+ * Determine if one string is greater than another.
+ * This function is equivalent to {@link #ucol_strcoll } == UCOL_GREATER
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return TRUE if source is greater than target, FALSE otherwise.
+ * @see ucol_strcoll
+ * @see ucol_greaterOrEqual
+ * @see ucol_equal
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2 
+ucol_greater(const UCollator *coll,
+             const UChar     *source, int32_t sourceLength,
+             const UChar     *target, int32_t targetLength);
+
+/**
+ * Determine if one string is greater than or equal to another.
+ * This function is equivalent to {@link #ucol_strcoll } != UCOL_LESS
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return TRUE if source is greater than or equal to target, FALSE otherwise.
+ * @see ucol_strcoll
+ * @see ucol_greater
+ * @see ucol_equal
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2 
+ucol_greaterOrEqual(const UCollator *coll,
+                    const UChar     *source, int32_t sourceLength,
+                    const UChar     *target, int32_t targetLength);
+
+/**
+ * Compare two strings for equality.
+ * This function is equivalent to {@link #ucol_strcoll } == UCOL_EQUAL
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return TRUE if source is equal to target, FALSE otherwise
+ * @see ucol_strcoll
+ * @see ucol_greater
+ * @see ucol_greaterOrEqual
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2 
+ucol_equal(const UCollator *coll,
+           const UChar     *source, int32_t sourceLength,
+           const UChar     *target, int32_t targetLength);
+
+/**
+ * Compare two UTF-8 encoded trings.
+ * The strings will be compared using the options already specified.
+ * @param coll The UCollator containing the comparison rules.
+ * @param sIter The source string iterator.
+ * @param tIter The target string iterator.
+ * @return The result of comparing the strings; one of UCOL_EQUAL,
+ * UCOL_GREATER, UCOL_LESS
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @see ucol_strcoll
+ * @stable ICU 2.6
+ */
+U_STABLE UCollationResult U_EXPORT2 
+ucol_strcollIter(  const    UCollator    *coll,
+                  UCharIterator *sIter,
+                  UCharIterator *tIter,
+                  UErrorCode *status);
+
+/**
+ * Get the collation strength used in a UCollator.
+ * The strength influences how strings are compared.
+ * @param coll The UCollator to query.
+ * @return The collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
+ * UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL
+ * @see ucol_setStrength
+ * @stable ICU 2.0
+ */
+U_STABLE UCollationStrength U_EXPORT2 
+ucol_getStrength(const UCollator *coll);
+
+/**
+ * Set the collation strength used in a UCollator.
+ * The strength influences how strings are compared.
+ * @param coll The UCollator to set.
+ * @param strength The desired collation strength; one of UCOL_PRIMARY, 
+ * UCOL_SECONDARY, UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL, UCOL_DEFAULT
+ * @see ucol_getStrength
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 
+ucol_setStrength(UCollator *coll,
+                 UCollationStrength strength);
+
+/**
+ * Get the current reordering of scripts (if one has been set).
+ * @param coll The UCollator to query.
+ * @param dest The array to fill with the script ordering.
+ * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string (pre-flighting).
+ * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
+ * @return The length of the array of the script ordering.
+ * @see ucol_setReorderCodes
+ * @internal 
+ */
+U_INTERNAL int32_t U_EXPORT2 
+ucol_getReorderCodes(const UCollator* coll,
+                    int32_t* dest,
+                    int32_t destCapacity,
+                    UErrorCode *pErrorCode);
+
+/**
+ * Set the ordering of scripts for this collator.
+ * @param coll The UCollator to set.
+ * @param reorderCodes An array of script codes in the new order.
+ * @param reorderCodesLength The length of reorderCodes.
+ * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
+ * @see ucol_getReorderCodes
+ * @internal 
+ */
+U_INTERNAL void U_EXPORT2 
+ucol_setReorderCodes(UCollator* coll,
+                    const int32_t* reorderCodes,
+                    int32_t reorderCodesLength,
+                    UErrorCode *pErrorCode);
+
+/**
+ * Get the display name for a UCollator.
+ * The display name is suitable for presentation to a user.
+ * @param objLoc The locale of the collator in question.
+ * @param dispLoc The locale for display.
+ * @param result A pointer to a buffer to receive the attribute.
+ * @param resultLength The maximum size of result.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return The total buffer size needed; if greater than resultLength,
+ * the output was truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2 
+ucol_getDisplayName(    const    char        *objLoc,
+            const    char        *dispLoc,
+            UChar             *result,
+            int32_t         resultLength,
+            UErrorCode        *status);
+
+/**
+ * Get a locale for which collation rules are available.
+ * A UCollator in a locale returned by this function will perform the correct
+ * collation for the locale.
+ * @param localeIndex The index of the desired locale.
+ * @return A locale for which collation rules are available, or 0 if none.
+ * @see ucol_countAvailable
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2 
+ucol_getAvailable(int32_t localeIndex);
+
+/**
+ * Determine how many locales have collation rules available.
+ * This function is most useful as determining the loop ending condition for
+ * calls to {@link #ucol_getAvailable }.
+ * @return The number of locales for which collation rules are available.
+ * @see ucol_getAvailable
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2 
+ucol_countAvailable(void);
+
+#if !UCONFIG_NO_SERVICE
+/**
+ * Create a string enumerator of all locales for which a valid
+ * collator may be opened.
+ * @param status input-output error code
+ * @return a string enumeration over locale strings. The caller is
+ * responsible for closing the result.
+ * @stable ICU 3.0
+ */
+U_STABLE UEnumeration* U_EXPORT2
+ucol_openAvailableLocales(UErrorCode *status);
+#endif
+
+/**
+ * Create a string enumerator of all possible keywords that are relevant to
+ * collation. At this point, the only recognized keyword for this
+ * service is "collation".
+ * @param status input-output error code
+ * @return a string enumeration over locale strings. The caller is
+ * responsible for closing the result.
+ * @stable ICU 3.0
+ */
+U_STABLE UEnumeration* U_EXPORT2
+ucol_getKeywords(UErrorCode *status);
+
+/**
+ * Given a keyword, create a string enumeration of all values
+ * for that keyword that are currently in use.
+ * @param keyword a particular keyword as enumerated by
+ * ucol_getKeywords. If any other keyword is passed in, *status is set
+ * to U_ILLEGAL_ARGUMENT_ERROR.
+ * @param status input-output error code
+ * @return a string enumeration over collation keyword values, or NULL
+ * upon error. The caller is responsible for closing the result.
+ * @stable ICU 3.0
+ */
+U_STABLE UEnumeration* U_EXPORT2
+ucol_getKeywordValues(const char *keyword, UErrorCode *status);
+
+/**
+ * Given a key and a locale, returns an array of string values in a preferred
+ * order that would make a difference. These are all and only those values where
+ * the open (creation) of the service with the locale formed from the input locale
+ * plus input keyword and that value has different behavior than creation with the
+ * input locale alone.
+ * @param key           one of the keys supported by this service.  For now, only
+ *                      "collation" is supported.
+ * @param locale        the locale
+ * @param commonlyUsed  if set to true it will return only commonly used values
+ *                      with the given locale in preferred order.  Otherwise,
+ *                      it will return all the available values for the locale.
+ * @param status error status
+ * @return a string enumeration over keyword values for the given key and the locale.
+ * @stable ICU 4.2
+ */
+U_STABLE UEnumeration* U_EXPORT2
+ucol_getKeywordValuesForLocale(const char* key,
+                               const char* locale,
+                               UBool commonlyUsed,
+                               UErrorCode* status);
+
+/**
+ * Return the functionally equivalent locale for the given
+ * requested locale, with respect to given keyword, for the
+ * collation service.  If two locales return the same result, then
+ * collators instantiated for these locales will behave
+ * equivalently.  The converse is not always true; two collators
+ * may in fact be equivalent, but return different results, due to
+ * internal details.  The return result has no other meaning than
+ * that stated above, and implies nothing as to the relationship
+ * between the two locales.  This is intended for use by
+ * applications who wish to cache collators, or otherwise reuse
+ * collators when possible.  The functional equivalent may change
+ * over time.  For more information, please see the <a
+ * href="http://icu-project.org/userguide/locale.html#services">
+ * Locales and Services</a> section of the ICU User Guide.
+ * @param result fillin for the functionally equivalent locale
+ * @param resultCapacity capacity of the fillin buffer
+ * @param keyword a particular keyword as enumerated by
+ * ucol_getKeywords.
+ * @param locale the requested locale
+ * @param isAvailable if non-NULL, pointer to a fillin parameter that
+ * indicates whether the requested locale was 'available' to the
+ * collation service. A locale is defined as 'available' if it
+ * physically exists within the collation locale data.
+ * @param status pointer to input-output error code
+ * @return the actual buffer size needed for the locale.  If greater
+ * than resultCapacity, the returned full name will be truncated and
+ * an error code will be returned.
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
+                             const char* keyword, const char* locale,
+                             UBool* isAvailable, UErrorCode* status);
+
+/**
+ * Get the collation rules from a UCollator.
+ * The rules will follow the rule syntax.
+ * @param coll The UCollator to query.
+ * @param length 
+ * @return The collation rules.
+ * @stable ICU 2.0
+ */
+U_STABLE const UChar* U_EXPORT2 
+ucol_getRules(    const    UCollator    *coll, 
+        int32_t            *length);
+
+/** Get the short definition string for a collator. This API harvests the collator's
+ *  locale and the attribute set and produces a string that can be used for opening 
+ *  a collator with the same properties using the ucol_openFromShortString API.
+ *  This string will be normalized.
+ *  The structure and the syntax of the string is defined in the "Naming collators"
+ *  section of the users guide: 
+ *  http://icu-project.org/userguide/Collate_Concepts.html#Naming_Collators
+ *  This API supports preflighting.
+ *  @param coll a collator
+ *  @param locale a locale that will appear as a collators locale in the resulting
+ *                short string definition. If NULL, the locale will be harvested 
+ *                from the collator.
+ *  @param buffer space to hold the resulting string
+ *  @param capacity capacity of the buffer
+ *  @param status for returning errors. All the preflighting errors are featured
+ *  @return length of the resulting string
+ *  @see ucol_openFromShortString
+ *  @see ucol_normalizeShortDefinitionString
+ *  @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getShortDefinitionString(const UCollator *coll,
+                              const char *locale,
+                              char *buffer,
+                              int32_t capacity,
+                              UErrorCode *status);
+
+/** Verifies and normalizes short definition string.
+ *  Normalized short definition string has all the option sorted by the argument name,
+ *  so that equivalent definition strings are the same. 
+ *  This API supports preflighting.
+ *  @param source definition string
+ *  @param destination space to hold the resulting string
+ *  @param capacity capacity of the buffer
+ *  @param parseError if not NULL, structure that will get filled with error's pre
+ *                   and post context in case of error.
+ *  @param status     Error code. This API will return an error if an invalid attribute 
+ *                    or attribute/value combination is specified. All the preflighting 
+ *                    errors are also featured
+ *  @return length of the resulting normalized string.
+ *
+ *  @see ucol_openFromShortString
+ *  @see ucol_getShortDefinitionString
+ * 
+ *  @stable ICU 3.0
+ */
+
+U_STABLE int32_t U_EXPORT2
+ucol_normalizeShortDefinitionString(const char *source,
+                                    char *destination,
+                                    int32_t capacity,
+                                    UParseError *parseError,
+                                    UErrorCode *status);
+
+
+/**
+ * Get a sort key for a string from a UCollator.
+ * Sort keys may be compared using <TT>strcmp</TT>.
+ *
+ * Like ICU functions that write to an output buffer, the buffer contents
+ * is undefined if the buffer capacity (resultLength parameter) is too small.
+ * Unlike ICU functions that write a string to an output buffer,
+ * the terminating zero byte is counted in the sort key length.
+ * @param coll The UCollator containing the collation rules.
+ * @param source The string to transform.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param result A pointer to a buffer to receive the attribute.
+ * @param resultLength The maximum size of result.
+ * @return The size needed to fully store the sort key.
+ *      If there was an internal error generating the sort key,
+ *      a zero value is returned.
+ * @see ucol_keyHashCode
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2 
+ucol_getSortKey(const    UCollator    *coll,
+        const    UChar        *source,
+        int32_t        sourceLength,
+        uint8_t        *result,
+        int32_t        resultLength);
+
+
+/** Gets the next count bytes of a sort key. Caller needs
+ *  to preserve state array between calls and to provide
+ *  the same type of UCharIterator set with the same string.
+ *  The destination buffer provided must be big enough to store
+ *  the number of requested bytes. Generated sortkey is not 
+ *  compatible with sortkeys generated using ucol_getSortKey
+ *  API, since we don't do any compression. If uncompressed
+ *  sortkeys are required, this API can be used.
+ *  @param coll The UCollator containing the collation rules.
+ *  @param iter UCharIterator containing the string we need 
+ *              the sort key to be calculated for.
+ *  @param state Opaque state of sortkey iteration.
+ *  @param dest Buffer to hold the resulting sortkey part
+ *  @param count number of sort key bytes required.
+ *  @param status error code indicator.
+ *  @return the actual number of bytes of a sortkey. It can be
+ *          smaller than count if we have reached the end of 
+ *          the sort key.
+ *  @stable ICU 2.6
+ */
+U_STABLE int32_t U_EXPORT2 
+ucol_nextSortKeyPart(const UCollator *coll,
+                     UCharIterator *iter,
+                     uint32_t state[2],
+                     uint8_t *dest, int32_t count,
+                     UErrorCode *status);
+
+/** enum that is taken by ucol_getBound API 
+ * See below for explanation                
+ * do not change the values assigned to the 
+ * members of this enum. Underlying code    
+ * depends on them having these numbers     
+ * @stable ICU 2.0
+ */
+typedef enum {
+  /** lower bound */
+  UCOL_BOUND_LOWER = 0,
+  /** upper bound that will match strings of exact size */
+  UCOL_BOUND_UPPER = 1,
+  /** upper bound that will match all the strings that have the same initial substring as the given string */
+  UCOL_BOUND_UPPER_LONG = 2,
+  UCOL_BOUND_VALUE_COUNT
+} UColBoundMode;
+
+/**
+ * Produce a bound for a given sortkey and a number of levels.
+ * Return value is always the number of bytes needed, regardless of 
+ * whether the result buffer was big enough or even valid.<br>
+ * Resulting bounds can be used to produce a range of strings that are
+ * between upper and lower bounds. For example, if bounds are produced
+ * for a sortkey of string "smith", strings between upper and lower 
+ * bounds with one level would include "Smith", "SMITH", "sMiTh".<br>
+ * There are two upper bounds that can be produced. If UCOL_BOUND_UPPER
+ * is produced, strings matched would be as above. However, if bound
+ * produced using UCOL_BOUND_UPPER_LONG is used, the above example will
+ * also match "Smithsonian" and similar.<br>
+ * For more on usage, see example in cintltst/capitst.c in procedure
+ * TestBounds.
+ * Sort keys may be compared using <TT>strcmp</TT>.
+ * @param source The source sortkey.
+ * @param sourceLength The length of source, or -1 if null-terminated. 
+ *                     (If an unmodified sortkey is passed, it is always null 
+ *                      terminated).
+ * @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which 
+ *                  produces a lower inclusive bound, UCOL_BOUND_UPPER, that 
+ *                  produces upper bound that matches strings of the same length 
+ *                  or UCOL_BOUND_UPPER_LONG that matches strings that have the 
+ *                  same starting substring as the source string.
+ * @param noOfLevels  Number of levels required in the resulting bound (for most 
+ *                    uses, the recommended value is 1). See users guide for 
+ *                    explanation on number of levels a sortkey can have.
+ * @param result A pointer to a buffer to receive the resulting sortkey.
+ * @param resultLength The maximum size of result.
+ * @param status Used for returning error code if something went wrong. If the 
+ *               number of levels requested is higher than the number of levels
+ *               in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is 
+ *               issued.
+ * @return The size needed to fully store the bound. 
+ * @see ucol_keyHashCode
+ * @stable ICU 2.1
+ */
+U_STABLE int32_t U_EXPORT2 
+ucol_getBound(const uint8_t       *source,
+        int32_t             sourceLength,
+        UColBoundMode       boundType,
+        uint32_t            noOfLevels,
+        uint8_t             *result,
+        int32_t             resultLength,
+        UErrorCode          *status);
+        
+/**
+ * Gets the version information for a Collator. Version is currently
+ * an opaque 32-bit number which depends, among other things, on major
+ * versions of the collator tailoring and UCA.
+ * @param coll The UCollator to query.
+ * @param info the version # information, the result will be filled in
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_getVersion(const UCollator* coll, UVersionInfo info);
+
+/**
+ * Gets the UCA version information for a Collator. Version is the
+ * UCA version number (3.1.1, 4.0).
+ * @param coll The UCollator to query.
+ * @param info the version # information, the result will be filled in
+ * @stable ICU 2.8
+ */
+U_STABLE void U_EXPORT2
+ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
+
+/** 
+ * Merge two sort keys. The levels are merged with their corresponding counterparts
+ * (primaries with primaries, secondaries with secondaries etc.). Between the values
+ * from the same level a separator is inserted.
+ * example (uncompressed): 
+ * 191B1D 01 050505 01 910505 00 and 1F2123 01 050505 01 910505 00
+ * will be merged as 
+ * 191B1D 02 1F212301 050505 02 050505 01 910505 02 910505 00
+ * This allows for concatenating of first and last names for sorting, among other things.
+ * If the destination buffer is not big enough, the results are undefined.
+ * If any of source lengths are zero or any of source pointers are NULL/undefined, 
+ * result is of size zero.
+ * @param src1 pointer to the first sortkey
+ * @param src1Length length of the first sortkey
+ * @param src2 pointer to the second sortkey
+ * @param src2Length length of the second sortkey
+ * @param dest buffer to hold the result
+ * @param destCapacity size of the buffer for the result
+ * @return size of the result. If the buffer is big enough size is always
+ *         src1Length+src2Length-1
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2 
+ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
+                   const uint8_t *src2, int32_t src2Length,
+                   uint8_t *dest, int32_t destCapacity);
+
+/**
+ * Universal attribute setter
+ * @param coll collator which attributes are to be changed
+ * @param attr attribute type 
+ * @param value attribute value
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @see UColAttribute
+ * @see UColAttributeValue
+ * @see ucol_getAttribute
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 
+ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
+
+/**
+ * Universal attribute getter
+ * @param coll collator which attributes are to be changed
+ * @param attr attribute type
+ * @return attribute value
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @see UColAttribute
+ * @see UColAttributeValue
+ * @see ucol_setAttribute
+ * @stable ICU 2.0
+ */
+U_STABLE UColAttributeValue  U_EXPORT2 
+ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
+
+/** Variable top
+ * is a two byte primary value which causes all the codepoints with primary values that
+ * are less or equal than the variable top to be shifted when alternate handling is set
+ * to UCOL_SHIFTED.
+ * Sets the variable top to a collation element value of a string supplied. 
+ * @param coll collator which variable top needs to be changed
+ * @param varTop one or more (if contraction) UChars to which the variable top should be set
+ * @param len length of variable top string. If -1 it is considered to be zero terminated.
+ * @param status error code. If error code is set, the return value is undefined. 
+ *               Errors set by this function are: <br>
+ *    U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such 
+ *    a contraction<br>
+ *    U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes
+ * @return a 32 bit value containing the value of the variable top in upper 16 bits. 
+ *         Lower 16 bits are undefined
+ * @see ucol_getVariableTop
+ * @see ucol_restoreVariableTop
+ * @stable ICU 2.0
+ */
+U_STABLE uint32_t U_EXPORT2 
+ucol_setVariableTop(UCollator *coll, 
+                    const UChar *varTop, int32_t len, 
+                    UErrorCode *status);
+
+/** 
+ * Gets the variable top value of a Collator. 
+ * Lower 16 bits are undefined and should be ignored.
+ * @param coll collator which variable top needs to be retrieved
+ * @param status error code (not changed by function). If error code is set, 
+ *               the return value is undefined.
+ * @return the variable top value of a Collator.
+ * @see ucol_setVariableTop
+ * @see ucol_restoreVariableTop
+ * @stable ICU 2.0
+ */
+U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
+
+/** 
+ * Sets the variable top to a collation element value supplied. Variable top is 
+ * set to the upper 16 bits. 
+ * Lower 16 bits are ignored.
+ * @param coll collator which variable top needs to be changed
+ * @param varTop CE value, as returned by ucol_setVariableTop or ucol)getVariableTop
+ * @param status error code (not changed by function)
+ * @see ucol_getVariableTop
+ * @see ucol_setVariableTop
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2 
+ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
+
+/**
+ * Thread safe cloning operation. The result is a clone of a given collator.
+ * @param coll collator to be cloned
+ * @param stackBuffer user allocated space for the new clone. 
+ * If NULL new memory will be allocated. 
+ *  If buffer is not large enough, new memory will be allocated.
+ *  Clients can use the U_COL_SAFECLONE_BUFFERSIZE. 
+ *  This will probably be enough to avoid memory allocations.
+ * @param pBufferSize pointer to size of allocated space. 
+ *  If *pBufferSize == 0, a sufficient size for use in cloning will 
+ *  be returned ('pre-flighting')
+ *  If *pBufferSize is not enough for a stack-based safe clone, 
+ *  new memory will be allocated.
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ *    An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any
+ * allocations were necessary.
+ * @return pointer to the new clone
+ * @see ucol_open
+ * @see ucol_openRules
+ * @see ucol_close
+ * @stable ICU 2.0
+ */
+U_STABLE UCollator* U_EXPORT2 
+ucol_safeClone(const UCollator *coll,
+               void            *stackBuffer,
+               int32_t         *pBufferSize,
+               UErrorCode      *status);
+
+/** default memory size for the new clone. It needs to be this large for os/400 large pointers 
+ * @stable ICU 2.0
+ */
+#define U_COL_SAFECLONE_BUFFERSIZE 512
+
+/**
+ * Returns current rules. Delta defines whether full rules are returned or just the tailoring. 
+ * Returns number of UChars needed to store rules. If buffer is NULL or bufferLen is not enough 
+ * to store rules, will store up to available space.
+ * @param coll collator to get the rules from
+ * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES. 
+ * @param buffer buffer to store the result in. If NULL, you'll get no rules.
+ * @param bufferLen lenght of buffer to store rules in. If less then needed you'll get only the part that fits in.
+ * @return current rules
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2 
+ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
+
+/**
+ * gets the locale name of the collator. If the collator
+ * is instantiated from the rules, then this function returns
+ * NULL.
+ * @param coll The UCollator for which the locale is needed
+ * @param type You can choose between requested, valid and actual
+ *             locale. For description see the definition of
+ *             ULocDataLocaleType in uloc.h
+ * @param status error code of the operation
+ * @return real locale name from which the collation data comes. 
+ *         If the collator was instantiated from rules, returns
+ *         NULL.
+ * @deprecated ICU 2.8 Use ucol_getLocaleByType instead
+ */
+U_DEPRECATED const char * U_EXPORT2
+ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
+
+
+/**
+ * gets the locale name of the collator. If the collator
+ * is instantiated from the rules, then this function returns
+ * NULL.
+ * @param coll The UCollator for which the locale is needed
+ * @param type You can choose between requested, valid and actual
+ *             locale. For description see the definition of
+ *             ULocDataLocaleType in uloc.h
+ * @param status error code of the operation
+ * @return real locale name from which the collation data comes. 
+ *         If the collator was instantiated from rules, returns
+ *         NULL.
+ * @stable ICU 2.8
+ */
+U_STABLE const char * U_EXPORT2
+ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
+
+/**
+ * Get an Unicode set that contains all the characters and sequences tailored in 
+ * this collator. The result must be disposed of by using uset_close.
+ * @param coll        The UCollator for which we want to get tailored chars
+ * @param status      error code of the operation
+ * @return a pointer to newly created USet. Must be be disposed by using uset_close
+ * @see ucol_openRules
+ * @see uset_close
+ * @stable ICU 2.4
+ */
+U_STABLE USet * U_EXPORT2
+ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
+
+/**
+ * Universal attribute getter that returns UCOL_DEFAULT if the value is default
+ * @param coll collator which attributes are to be changed
+ * @param attr attribute type
+ * @return attribute value or UCOL_DEFAULT if the value is default
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @see UColAttribute
+ * @see UColAttributeValue
+ * @see ucol_setAttribute
+ * @internal ICU 3.0
+ */
+U_INTERNAL UColAttributeValue  U_EXPORT2
+ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
+
+/** Check whether two collators are equal. Collators are considered equal if they
+ *  will sort strings the same. This means that both the current attributes and the
+ *  rules must be equivalent. Currently used for RuleBasedCollator::operator==.
+ *  @param source first collator
+ *  @param target second collator
+ *  @return TRUE or FALSE
+ *  @internal ICU 3.0
+ */
+U_INTERNAL UBool U_EXPORT2
+ucol_equals(const UCollator *source, const UCollator *target);
+
+/** Calculates the set of unsafe code points, given a collator.
+ *   A character is unsafe if you could append any character and cause the ordering to alter significantly.
+ *   Collation sorts in normalized order, so anything that rearranges in normalization can cause this.
+ *   Thus if you have a character like a_umlaut, and you add a lower_dot to it,
+ *   then it normalizes to a_lower_dot + umlaut, and sorts differently.
+ *  @param coll Collator
+ *  @param unsafe a fill-in set to receive the unsafe points
+ *  @param status for catching errors
+ *  @return number of elements in the set
+ *  @internal ICU 3.0
+ */
+U_INTERNAL int32_t U_EXPORT2
+ucol_getUnsafeSet( const UCollator *coll,
+                  USet *unsafe,
+                  UErrorCode *status);
+
+/** Reset UCA's static pointers. You don't want to use this, unless your static memory can go away.
+ * @internal ICU 3.2.1
+ */
+U_INTERNAL void U_EXPORT2
+ucol_forgetUCA(void);
+
+/** Touches all resources needed for instantiating a collator from a short string definition,
+ *  thus filling up the cache.
+ * @param definition A short string containing a locale and a set of attributes. 
+ *                   Attributes not explicitly mentioned are left at the default
+ *                   state for a locale.
+ * @param parseError if not NULL, structure that will get filled with error's pre
+ *                   and post context in case of error.
+ * @param forceDefaults if FALSE, the settings that are the same as the collator 
+ *                   default settings will not be applied (for example, setting
+ *                   French secondary on a French collator would not be executed). 
+ *                   If TRUE, all the settings will be applied regardless of the 
+ *                   collator default value. If the definition
+ *                   strings are to be cached, should be set to FALSE.
+ * @param status     Error code. Apart from regular error conditions connected to 
+ *                   instantiating collators (like out of memory or similar), this
+ *                   API will return an error if an invalid attribute or attribute/value
+ *                   combination is specified.
+ * @see ucol_openFromShortString
+ * @internal ICU 3.2.1
+ */
+U_INTERNAL void U_EXPORT2
+ucol_prepareShortStringOpen( const char *definition,
+                          UBool forceDefaults,
+                          UParseError *parseError,
+                          UErrorCode *status);
+
+/** Creates a binary image of a collator. This binary image can be stored and 
+ *  later used to instantiate a collator using ucol_openBinary.
+ *  This API supports preflighting.
+ *  @param coll Collator
+ *  @param buffer a fill-in buffer to receive the binary image
+ *  @param capacity capacity of the destination buffer
+ *  @param status for catching errors
+ *  @return size of the image
+ *  @see ucol_openBinary
+ *  @stable ICU 3.2
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_cloneBinary(const UCollator *coll,
+                 uint8_t *buffer, int32_t capacity,
+                 UErrorCode *status);
+
+/** Opens a collator from a collator binary image created using
+ *  ucol_cloneBinary. Binary image used in instantiation of the 
+ *  collator remains owned by the user and should stay around for 
+ *  the lifetime of the collator. The API also takes a base collator
+ *  which usualy should be UCA.
+ *  @param bin binary image owned by the user and required through the
+ *             lifetime of the collator
+ *  @param length size of the image. If negative, the API will try to
+ *                figure out the length of the image
+ *  @param base fallback collator, usually UCA. Base is required to be
+ *              present through the lifetime of the collator. Currently 
+ *              it cannot be NULL.
+ *  @param status for catching errors
+ *  @return newly created collator
+ *  @see ucol_cloneBinary
+ *  @stable ICU 3.2
+ */
+U_STABLE UCollator* U_EXPORT2
+ucol_openBinary(const uint8_t *bin, int32_t length, 
+                const UCollator *base, 
+                UErrorCode *status);
+
+
+#endif /* #if !UCONFIG_NO_COLLATION */
+
+#endif
diff --git a/Source/WTF/icu/unicode/uconfig.h b/Source/WTF/icu/unicode/uconfig.h
new file mode 100644
index 0000000..7d2d26e
--- /dev/null
+++ b/Source/WTF/icu/unicode/uconfig.h
@@ -0,0 +1,231 @@
+/*  
+**********************************************************************
+*   Copyright (C) 2002-2009, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+**********************************************************************
+*   file name:  uconfig.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 2002sep19
+*   created by: Markus W. Scherer
+*/
+
+#ifndef __UCONFIG_H__
+#define __UCONFIG_H__
+
+
+/*!
+ * \file
+ * \brief Switches for excluding parts of ICU library code modules.
+ *
+ * Allows to build partial, smaller libraries for special purposes.
+ * By default, all modules are built.
+ * The switches are fairly coarse, controlling large modules.
+ * Basic services cannot be turned off.
+ *
+ * Building with any of these options does not guarantee that the
+ * ICU build process will completely work. It is recommended that
+ * the ICU libraries and data be built using the normal build.
+ * At that time you should remove the data used by those services.
+ * After building the ICU data library, you should rebuild the ICU
+ * libraries with these switches customized to your needs.
+ *
+ * @stable ICU 2.4
+ */
+
+/**
+ * If this switch is defined, ICU will attempt to load a header file named "uconfig_local.h"
+ * prior to determining default settings for uconfig variables.
+ * 
+ * @internal ICU 4.0
+ * 
+ */
+#if defined(UCONFIG_USE_LOCAL)
+#include "uconfig_local.h"
+#endif
+
+/**
+ * \def UCONFIG_ONLY_COLLATION
+ * This switch turns off modules that are not needed for collation.
+ *
+ * It does not turn off legacy conversion because that is necessary
+ * for ICU to work on EBCDIC platforms (for the default converter).
+ * If you want "only collation" and do not build for EBCDIC,
+ * then you can define UCONFIG_NO_LEGACY_CONVERSION 1 as well.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_ONLY_COLLATION
+#   define UCONFIG_ONLY_COLLATION 0
+#endif
+
+#if UCONFIG_ONLY_COLLATION
+    /* common library */
+#   define UCONFIG_NO_BREAK_ITERATION 1
+#   define UCONFIG_NO_IDNA 1
+
+    /* i18n library */
+#   if UCONFIG_NO_COLLATION
+#       error Contradictory collation switches in uconfig.h.
+#   endif
+#   define UCONFIG_NO_FORMATTING 1
+#   define UCONFIG_NO_TRANSLITERATION 1
+#   define UCONFIG_NO_REGULAR_EXPRESSIONS 1
+#endif
+
+/* common library switches -------------------------------------------------- */
+
+/**
+ * \def UCONFIG_NO_FILE_IO
+ * This switch turns off all file access in the common library
+ * where file access is only used for data loading.
+ * ICU data must then be provided in the form of a data DLL (or with an
+ * equivalent way to link to the data residing in an executable,
+ * as in building a combined library with both the common library's code and
+ * the data), or via udata_setCommonData().
+ * Application data must be provided via udata_setAppData() or by using
+ * "open" functions that take pointers to data, for example ucol_openBinary().
+ *
+ * File access is not used at all in the i18n library.
+ *
+ * File access cannot be turned off for the icuio library or for the ICU
+ * test suites and ICU tools.
+ *
+ * @stable ICU 3.6
+ */
+#ifndef UCONFIG_NO_FILE_IO
+#   define UCONFIG_NO_FILE_IO 0
+#endif
+
+/**
+ * \def UCONFIG_NO_CONVERSION
+ * ICU will not completely build with this switch turned on.
+ * This switch turns off all converters.
+ *
+ * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1
+ * in utypes.h if char* strings in your environment are always in UTF-8.
+ *
+ * @stable ICU 3.2
+ * @see U_CHARSET_IS_UTF8
+ */
+#ifndef UCONFIG_NO_CONVERSION
+#   define UCONFIG_NO_CONVERSION 0
+#endif
+
+#if UCONFIG_NO_CONVERSION
+#   define UCONFIG_NO_LEGACY_CONVERSION 1
+#endif
+
+/**
+ * \def UCONFIG_NO_LEGACY_CONVERSION
+ * This switch turns off all converters except for
+ * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1)
+ * - US-ASCII
+ * - ISO-8859-1
+ *
+ * Turning off legacy conversion is not possible on EBCDIC platforms
+ * because they need ibm-37 or ibm-1047 default converters.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_LEGACY_CONVERSION
+#   define UCONFIG_NO_LEGACY_CONVERSION 0
+#endif
+
+/**
+ * \def UCONFIG_NO_NORMALIZATION
+ * This switch turns off normalization.
+ * It implies turning off several other services as well, for example
+ * collation and IDNA.
+ *
+ * @stable ICU 2.6
+ */
+#ifndef UCONFIG_NO_NORMALIZATION
+#   define UCONFIG_NO_NORMALIZATION 0
+#elif UCONFIG_NO_NORMALIZATION
+    /* common library */
+#   define UCONFIG_NO_IDNA 1
+
+    /* i18n library */
+#   if UCONFIG_ONLY_COLLATION
+#       error Contradictory collation switches in uconfig.h.
+#   endif
+#   define UCONFIG_NO_COLLATION 1
+#   define UCONFIG_NO_TRANSLITERATION 1
+#endif
+
+/**
+ * \def UCONFIG_NO_BREAK_ITERATION
+ * This switch turns off break iteration.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_BREAK_ITERATION
+#   define UCONFIG_NO_BREAK_ITERATION 0
+#endif
+
+/**
+ * \def UCONFIG_NO_IDNA
+ * This switch turns off IDNA.
+ *
+ * @stable ICU 2.6
+ */
+#ifndef UCONFIG_NO_IDNA
+#   define UCONFIG_NO_IDNA 0
+#endif
+
+/* i18n library switches ---------------------------------------------------- */
+
+/**
+ * \def UCONFIG_NO_COLLATION
+ * This switch turns off collation and collation-based string search.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_COLLATION
+#   define UCONFIG_NO_COLLATION 0
+#endif
+
+/**
+ * \def UCONFIG_NO_FORMATTING
+ * This switch turns off formatting and calendar/timezone services.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_FORMATTING
+#   define UCONFIG_NO_FORMATTING 0
+#endif
+
+/**
+ * \def UCONFIG_NO_TRANSLITERATION
+ * This switch turns off transliteration.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_TRANSLITERATION
+#   define UCONFIG_NO_TRANSLITERATION 0
+#endif
+
+/**
+ * \def UCONFIG_NO_REGULAR_EXPRESSIONS
+ * This switch turns off regular expressions.
+ *
+ * @stable ICU 2.4
+ */
+#ifndef UCONFIG_NO_REGULAR_EXPRESSIONS
+#   define UCONFIG_NO_REGULAR_EXPRESSIONS 0
+#endif
+
+/**
+ * \def UCONFIG_NO_SERVICE
+ * This switch turns off service registration.
+ *
+ * @stable ICU 3.2
+ */
+#ifndef UCONFIG_NO_SERVICE
+#   define UCONFIG_NO_SERVICE 1
+#endif
+
+#endif
diff --git a/Source/WTF/icu/unicode/uenum.h b/Source/WTF/icu/unicode/uenum.h
new file mode 100644
index 0000000..0e7d90c
--- /dev/null
+++ b/Source/WTF/icu/unicode/uenum.h
@@ -0,0 +1,174 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2002-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  uenum.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:2
+*
+*   created on: 2002jul08
+*   created by: Vladimir Weinstein
+*/
+
+#ifndef __UENUM_H
+#define __UENUM_H
+
+#include "unicode/utypes.h"
+#include "unicode/localpointer.h"
+
+#if U_SHOW_CPLUSPLUS_API
+#include "unicode/strenum.h"
+#endif
+
+/**
+ * \file
+ * \brief C API: String Enumeration 
+ */
+ 
+/**
+ * An enumeration object.
+ * For usage in C programs.
+ * @stable ICU 2.2
+ */
+struct UEnumeration;
+/** structure representing an enumeration object instance @stable ICU 2.2 */
+typedef struct UEnumeration UEnumeration;
+
+/**
+ * Disposes of resources in use by the iterator.  If en is NULL,
+ * does nothing.  After this call, any char* or UChar* pointer
+ * returned by uenum_unext() or uenum_next() is invalid.
+ * @param en UEnumeration structure pointer
+ * @stable ICU 2.2
+ */
+U_STABLE void U_EXPORT2
+uenum_close(UEnumeration* en);
+
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUEnumerationPointer
+ * "Smart pointer" class, closes a UEnumeration via uenum_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 4.4
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUEnumerationPointer, UEnumeration, uenum_close);
+
+U_NAMESPACE_END
+
+#endif
+
+/**
+ * Returns the number of elements that the iterator traverses.  If
+ * the iterator is out-of-sync with its service, status is set to
+ * U_ENUM_OUT_OF_SYNC_ERROR.
+ * This is a convenience function. It can end up being very
+ * expensive as all the items might have to be pre-fetched (depending
+ * on the type of data being traversed). Use with caution and only 
+ * when necessary.
+ * @param en UEnumeration structure pointer
+ * @param status error code, can be U_ENUM_OUT_OF_SYNC_ERROR if the
+ *               iterator is out of sync.
+ * @return number of elements in the iterator
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+uenum_count(UEnumeration* en, UErrorCode* status);
+
+/**
+ * Returns the next element in the iterator's list.  If there are
+ * no more elements, returns NULL.  If the iterator is out-of-sync
+ * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and
+ * NULL is returned.  If the native service string is a char* string,
+ * it is converted to UChar* with the invariant converter.
+ * The result is terminated by (UChar)0.
+ * @param en the iterator object
+ * @param resultLength pointer to receive the length of the result
+ *                     (not including the terminating \\0).
+ *                     If the pointer is NULL it is ignored.
+ * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if
+ *               the iterator is out of sync with its service.
+ * @return a pointer to the string.  The string will be
+ *         zero-terminated.  The return pointer is owned by this iterator
+ *         and must not be deleted by the caller.  The pointer is valid
+ *         until the next call to any uenum_... method, including
+ *         uenum_next() or uenum_unext().  When all strings have been
+ *         traversed, returns NULL.
+ * @stable ICU 2.2
+ */
+U_STABLE const UChar* U_EXPORT2
+uenum_unext(UEnumeration* en,
+            int32_t* resultLength,
+            UErrorCode* status);
+
+/**
+ * Returns the next element in the iterator's list.  If there are
+ * no more elements, returns NULL.  If the iterator is out-of-sync
+ * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and
+ * NULL is returned.  If the native service string is a UChar*
+ * string, it is converted to char* with the invariant converter.
+ * The result is terminated by (char)0.  If the conversion fails
+ * (because a character cannot be converted) then status is set to
+ * U_INVARIANT_CONVERSION_ERROR and the return value is undefined
+ * (but non-NULL).
+ * @param en the iterator object
+ * @param resultLength pointer to receive the length of the result
+ *                     (not including the terminating \\0).
+ *                     If the pointer is NULL it is ignored.
+ * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if
+ *               the iterator is out of sync with its service.  Set to
+ *               U_INVARIANT_CONVERSION_ERROR if the underlying native string is
+ *               UChar* and conversion to char* with the invariant converter
+ *               fails. This error pertains only to current string, so iteration
+ *               might be able to continue successfully.
+ * @return a pointer to the string.  The string will be
+ *         zero-terminated.  The return pointer is owned by this iterator
+ *         and must not be deleted by the caller.  The pointer is valid
+ *         until the next call to any uenum_... method, including
+ *         uenum_next() or uenum_unext().  When all strings have been
+ *         traversed, returns NULL.
+ * @stable ICU 2.2
+ */
+U_STABLE const char* U_EXPORT2
+uenum_next(UEnumeration* en,
+           int32_t* resultLength,
+           UErrorCode* status);
+
+/**
+ * Resets the iterator to the current list of service IDs.  This
+ * re-establishes sync with the service and rewinds the iterator
+ * to start at the first element.
+ * @param en the iterator object
+ * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if
+ *               the iterator is out of sync with its service.  
+ * @stable ICU 2.2
+ */
+U_STABLE void U_EXPORT2
+uenum_reset(UEnumeration* en, UErrorCode* status);
+
+#if U_SHOW_CPLUSPLUS_API
+
+/**
+ * Given a StringEnumeration, wrap it in a UEnumeration.  The
+ * StringEnumeration is adopted; after this call, the caller must not
+ * delete it (regardless of error status).
+ * @param adopted the C++ StringEnumeration to be wrapped in a UEnumeration.
+ * @param ec the error code.
+ * @return a UEnumeration wrapping the adopted StringEnumeration.
+ * @draft ICU 4.2
+ */
+U_CAPI UEnumeration* U_EXPORT2
+uenum_openFromStringEnumeration(U_NAMESPACE_QUALIFIER StringEnumeration* adopted, UErrorCode* ec);
+
+#endif
+
+#endif
diff --git a/Source/WTF/icu/unicode/uiter.h b/Source/WTF/icu/unicode/uiter.h
new file mode 100644
index 0000000..b469e24
--- /dev/null
+++ b/Source/WTF/icu/unicode/uiter.h
@@ -0,0 +1,707 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2002-2006,2009 International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  uiter.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 2002jan18
+*   created by: Markus W. Scherer
+*/
+
+#ifndef __UITER_H__
+#define __UITER_H__
+
+/**
+ * \file
+ * \brief C API: Unicode Character Iteration
+ *
+ * @see UCharIterator
+ */
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+    U_NAMESPACE_BEGIN
+
+    class CharacterIterator;
+    class Replaceable;
+
+    U_NAMESPACE_END
+#endif
+
+U_CDECL_BEGIN
+
+struct UCharIterator;
+typedef struct UCharIterator UCharIterator; /**< C typedef for struct UCharIterator. @stable ICU 2.1 */
+
+/**
+ * Origin constants for UCharIterator.getIndex() and UCharIterator.move().
+ * @see UCharIteratorMove
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef enum UCharIteratorOrigin {
+    UITER_START, UITER_CURRENT, UITER_LIMIT, UITER_ZERO, UITER_LENGTH
+} UCharIteratorOrigin;
+
+/** Constants for UCharIterator. @stable ICU 2.6 */
+enum {
+    /**
+     * Constant value that may be returned by UCharIteratorMove
+     * indicating that the final UTF-16 index is not known, but that the move succeeded.
+     * This can occur when moving relative to limit or length, or
+     * when moving relative to the current index after a setState()
+     * when the current UTF-16 index is not known.
+     *
+     * It would be very inefficient to have to count from the beginning of the text
+     * just to get the current/limit/length index after moving relative to it.
+     * The actual index can be determined with getIndex(UITER_CURRENT)
+     * which will count the UChars if necessary.
+     *
+     * @stable ICU 2.6
+     */
+    UITER_UNKNOWN_INDEX=-2
+};
+
+
+/**
+ * Constant for UCharIterator getState() indicating an error or
+ * an unknown state.
+ * Returned by uiter_getState()/UCharIteratorGetState
+ * when an error occurs.
+ * Also, some UCharIterator implementations may not be able to return
+ * a valid state for each position. This will be clearly documented
+ * for each such iterator (none of the public ones here).
+ *
+ * @stable ICU 2.6
+ */
+#define UITER_NO_STATE ((uint32_t)0xffffffff)
+
+/**
+ * Function type declaration for UCharIterator.getIndex().
+ *
+ * Gets the current position, or the start or limit of the
+ * iteration range.
+ *
+ * This function may perform slowly for UITER_CURRENT after setState() was called,
+ * or for UITER_LENGTH, because an iterator implementation may have to count
+ * UChars if the underlying storage is not UTF-16.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @param origin get the 0, start, limit, length, or current index
+ * @return the requested index, or U_SENTINEL in an error condition
+ *
+ * @see UCharIteratorOrigin
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef int32_t U_CALLCONV
+UCharIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin);
+
+/**
+ * Function type declaration for UCharIterator.move().
+ *
+ * Use iter->move(iter, index, UITER_ZERO) like CharacterIterator::setIndex(index).
+ *
+ * Moves the current position relative to the start or limit of the
+ * iteration range, or relative to the current position itself.
+ * The movement is expressed in numbers of code units forward
+ * or backward by specifying a positive or negative delta.
+ * Out of bounds movement will be pinned to the start or limit.
+ *
+ * This function may perform slowly for moving relative to UITER_LENGTH
+ * because an iterator implementation may have to count the rest of the
+ * UChars if the native storage is not UTF-16.
+ *
+ * When moving relative to the limit or length, or
+ * relative to the current position after setState() was called,
+ * move() may return UITER_UNKNOWN_INDEX (-2) to avoid an inefficient
+ * determination of the actual UTF-16 index.
+ * The actual index can be determined with getIndex(UITER_CURRENT)
+ * which will count the UChars if necessary.
+ * See UITER_UNKNOWN_INDEX for details.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @param delta can be positive, zero, or negative
+ * @param origin move relative to the 0, start, limit, length, or current index
+ * @return the new index, or U_SENTINEL on an error condition,
+ *         or UITER_UNKNOWN_INDEX when the index is not known.
+ *
+ * @see UCharIteratorOrigin
+ * @see UCharIterator
+ * @see UITER_UNKNOWN_INDEX
+ * @stable ICU 2.1
+ */
+typedef int32_t U_CALLCONV
+UCharIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin);
+
+/**
+ * Function type declaration for UCharIterator.hasNext().
+ *
+ * Check if current() and next() can still
+ * return another code unit.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return boolean value for whether current() and next() can still return another code unit
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef UBool U_CALLCONV
+UCharIteratorHasNext(UCharIterator *iter);
+
+/**
+ * Function type declaration for UCharIterator.hasPrevious().
+ *
+ * Check if previous() can still return another code unit.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return boolean value for whether previous() can still return another code unit
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef UBool U_CALLCONV
+UCharIteratorHasPrevious(UCharIterator *iter);
+ 
+/**
+ * Function type declaration for UCharIterator.current().
+ *
+ * Return the code unit at the current position,
+ * or U_SENTINEL if there is none (index is at the limit).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the current code unit
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef UChar32 U_CALLCONV
+UCharIteratorCurrent(UCharIterator *iter);
+
+/**
+ * Function type declaration for UCharIterator.next().
+ *
+ * Return the code unit at the current index and increment
+ * the index (post-increment, like s[i++]),
+ * or return U_SENTINEL if there is none (index is at the limit).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the current code unit (and post-increment the current index)
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef UChar32 U_CALLCONV
+UCharIteratorNext(UCharIterator *iter);
+
+/**
+ * Function type declaration for UCharIterator.previous().
+ *
+ * Decrement the index and return the code unit from there
+ * (pre-decrement, like s[--i]),
+ * or return U_SENTINEL if there is none (index is at the start).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the previous code unit (after pre-decrementing the current index)
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef UChar32 U_CALLCONV
+UCharIteratorPrevious(UCharIterator *iter);
+
+/**
+ * Function type declaration for UCharIterator.reservedFn().
+ * Reserved for future use.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @param something some integer argument
+ * @return some integer
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+typedef int32_t U_CALLCONV
+UCharIteratorReserved(UCharIterator *iter, int32_t something);
+
+/**
+ * Function type declaration for UCharIterator.getState().
+ *
+ * Get the "state" of the iterator in the form of a single 32-bit word.
+ * It is recommended that the state value be calculated to be as small as
+ * is feasible. For strings with limited lengths, fewer than 32 bits may
+ * be sufficient.
+ *
+ * This is used together with setState()/UCharIteratorSetState
+ * to save and restore the iterator position more efficiently than with
+ * getIndex()/move().
+ *
+ * The iterator state is defined as a uint32_t value because it is designed
+ * for use in ucol_nextSortKeyPart() which provides 32 bits to store the state
+ * of the character iterator.
+ *
+ * With some UCharIterator implementations (e.g., UTF-8),
+ * getting and setting the UTF-16 index with existing functions
+ * (getIndex(UITER_CURRENT) followed by move(pos, UITER_ZERO)) is possible but
+ * relatively slow because the iterator has to "walk" from a known index
+ * to the requested one.
+ * This takes more time the farther it needs to go.
+ *
+ * An opaque state value allows an iterator implementation to provide
+ * an internal index (UTF-8: the source byte array index) for
+ * fast, constant-time restoration.
+ *
+ * After calling setState(), a getIndex(UITER_CURRENT) may be slow because
+ * the UTF-16 index may not be restored as well, but the iterator can deliver
+ * the correct text contents and move relative to the current position
+ * without performance degradation.
+ *
+ * Some UCharIterator implementations may not be able to return
+ * a valid state for each position, in which case they return UITER_NO_STATE instead.
+ * This will be clearly documented for each such iterator (none of the public ones here).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the state word
+ *
+ * @see UCharIterator
+ * @see UCharIteratorSetState
+ * @see UITER_NO_STATE
+ * @stable ICU 2.6
+ */
+typedef uint32_t U_CALLCONV
+UCharIteratorGetState(const UCharIterator *iter);
+
+/**
+ * Function type declaration for UCharIterator.setState().
+ *
+ * Restore the "state" of the iterator using a state word from a getState() call.
+ * The iterator object need not be the same one as for which getState() was called,
+ * but it must be of the same type (set up using the same uiter_setXYZ function)
+ * and it must iterate over the same string
+ * (binary identical regardless of memory address).
+ * For more about the state word see UCharIteratorGetState.
+ *
+ * After calling setState(), a getIndex(UITER_CURRENT) may be slow because
+ * the UTF-16 index may not be restored as well, but the iterator can deliver
+ * the correct text contents and move relative to the current position
+ * without performance degradation.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @param state the state word from a getState() call
+ *              on a same-type, same-string iterator
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ *                   which must not indicate a failure before the function call.
+ *
+ * @see UCharIterator
+ * @see UCharIteratorGetState
+ * @stable ICU 2.6
+ */
+typedef void U_CALLCONV
+UCharIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode);
+
+
+/**
+ * C API for code unit iteration.
+ * This can be used as a C wrapper around
+ * CharacterIterator, Replaceable, or implemented using simple strings, etc.
+ *
+ * There are two roles for using UCharIterator:
+ *
+ * A "provider" sets the necessary function pointers and controls the "protected"
+ * fields of the UCharIterator structure. A "provider" passes a UCharIterator
+ * into C APIs that need a UCharIterator as an abstract, flexible string interface.
+ *
+ * Implementations of such C APIs are "callers" of UCharIterator functions;
+ * they only use the "public" function pointers and never access the "protected"
+ * fields directly.
+ *
+ * The current() and next() functions only check the current index against the
+ * limit, and previous() only checks the current index against the start,
+ * to see if the iterator already reached the end of the iteration range.
+ *
+ * The assumption - in all iterators - is that the index is moved via the API,
+ * which means it won't go out of bounds, or the index is modified by
+ * user code that knows enough about the iterator implementation to set valid
+ * index values.
+ *
+ * UCharIterator functions return code unit values 0..0xffff,
+ * or U_SENTINEL if the iteration bounds are reached.
+ *
+ * @stable ICU 2.1
+ */
+struct UCharIterator {
+    /**
+     * (protected) Pointer to string or wrapped object or similar.
+     * Not used by caller.
+     * @stable ICU 2.1
+     */
+    const void *context;
+
+    /**
+     * (protected) Length of string or similar.
+     * Not used by caller.
+     * @stable ICU 2.1
+     */
+    int32_t length;
+
+    /**
+     * (protected) Start index or similar.
+     * Not used by caller.
+     * @stable ICU 2.1
+     */
+    int32_t start;
+
+    /**
+     * (protected) Current index or similar.
+     * Not used by caller.
+     * @stable ICU 2.1
+     */
+    int32_t index;
+
+    /**
+     * (protected) Limit index or similar.
+     * Not used by caller.
+     * @stable ICU 2.1
+     */
+    int32_t limit;
+
+    /**
+     * (protected) Used by UTF-8 iterators and possibly others.
+     * @stable ICU 2.1
+     */
+    int32_t reservedField;
+
+    /**
+     * (public) Returns the current position or the
+     * start or limit index of the iteration range.
+     *
+     * @see UCharIteratorGetIndex
+     * @stable ICU 2.1
+     */
+    UCharIteratorGetIndex *getIndex;
+
+    /**
+     * (public) Moves the current position relative to the start or limit of the
+     * iteration range, or relative to the current position itself.
+     * The movement is expressed in numbers of code units forward
+     * or backward by specifying a positive or negative delta.
+     *
+     * @see UCharIteratorMove
+     * @stable ICU 2.1
+     */
+    UCharIteratorMove *move;
+
+    /**
+     * (public) Check if current() and next() can still
+     * return another code unit.
+     *
+     * @see UCharIteratorHasNext
+     * @stable ICU 2.1
+     */
+    UCharIteratorHasNext *hasNext;
+
+    /**
+     * (public) Check if previous() can still return another code unit.
+     *
+     * @see UCharIteratorHasPrevious
+     * @stable ICU 2.1
+     */
+    UCharIteratorHasPrevious *hasPrevious;
+
+    /**
+     * (public) Return the code unit at the current position,
+     * or U_SENTINEL if there is none (index is at the limit).
+     *
+     * @see UCharIteratorCurrent
+     * @stable ICU 2.1
+     */
+    UCharIteratorCurrent *current;
+
+    /**
+     * (public) Return the code unit at the current index and increment
+     * the index (post-increment, like s[i++]),
+     * or return U_SENTINEL if there is none (index is at the limit).
+     *
+     * @see UCharIteratorNext
+     * @stable ICU 2.1
+     */
+    UCharIteratorNext *next;
+
+    /**
+     * (public) Decrement the index and return the code unit from there
+     * (pre-decrement, like s[--i]),
+     * or return U_SENTINEL if there is none (index is at the start).
+     *
+     * @see UCharIteratorPrevious
+     * @stable ICU 2.1
+     */
+    UCharIteratorPrevious *previous;
+
+    /**
+     * (public) Reserved for future use. Currently NULL.
+     *
+     * @see UCharIteratorReserved
+     * @stable ICU 2.1
+     */
+    UCharIteratorReserved *reservedFn;
+
+    /**
+     * (public) Return the state of the iterator, to be restored later with setState().
+     * This function pointer is NULL if the iterator does not implement it.
+     *
+     * @see UCharIteratorGet
+     * @stable ICU 2.6
+     */
+    UCharIteratorGetState *getState;
+
+    /**
+     * (public) Restore the iterator state from the state word from a call
+     * to getState().
+     * This function pointer is NULL if the iterator does not implement it.
+     *
+     * @see UCharIteratorSet
+     * @stable ICU 2.6
+     */
+    UCharIteratorSetState *setState;
+};
+
+/**
+ * Helper function for UCharIterator to get the code point
+ * at the current index.
+ *
+ * Return the code point that includes the code unit at the current position,
+ * or U_SENTINEL if there is none (index is at the limit).
+ * If the current code unit is a lead or trail surrogate,
+ * then the following or preceding surrogate is used to form
+ * the code point value.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the current code point
+ *
+ * @see UCharIterator
+ * @see U16_GET
+ * @see UnicodeString::char32At()
+ * @stable ICU 2.1
+ */
+U_STABLE UChar32 U_EXPORT2
+uiter_current32(UCharIterator *iter);
+
+/**
+ * Helper function for UCharIterator to get the next code point.
+ *
+ * Return the code point at the current index and increment
+ * the index (post-increment, like s[i++]),
+ * or return U_SENTINEL if there is none (index is at the limit).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the current code point (and post-increment the current index)
+ *
+ * @see UCharIterator
+ * @see U16_NEXT
+ * @stable ICU 2.1
+ */
+U_STABLE UChar32 U_EXPORT2
+uiter_next32(UCharIterator *iter);
+
+/**
+ * Helper function for UCharIterator to get the previous code point.
+ *
+ * Decrement the index and return the code point from there
+ * (pre-decrement, like s[--i]),
+ * or return U_SENTINEL if there is none (index is at the start).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the previous code point (after pre-decrementing the current index)
+ *
+ * @see UCharIterator
+ * @see U16_PREV
+ * @stable ICU 2.1
+ */
+U_STABLE UChar32 U_EXPORT2
+uiter_previous32(UCharIterator *iter);
+
+/**
+ * Get the "state" of the iterator in the form of a single 32-bit word.
+ * This is a convenience function that calls iter->getState(iter)
+ * if iter->getState is not NULL;
+ * if it is NULL or any other error occurs, then UITER_NO_STATE is returned.
+ *
+ * Some UCharIterator implementations may not be able to return
+ * a valid state for each position, in which case they return UITER_NO_STATE instead.
+ * This will be clearly documented for each such iterator (none of the public ones here).
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @return the state word
+ *
+ * @see UCharIterator
+ * @see UCharIteratorGetState
+ * @see UITER_NO_STATE
+ * @stable ICU 2.6
+ */
+U_STABLE uint32_t U_EXPORT2
+uiter_getState(const UCharIterator *iter);
+
+/**
+ * Restore the "state" of the iterator using a state word from a getState() call.
+ * This is a convenience function that calls iter->setState(iter, state, pErrorCode)
+ * if iter->setState is not NULL; if it is NULL, then U_UNSUPPORTED_ERROR is set.
+ *
+ * @param iter the UCharIterator structure ("this pointer")
+ * @param state the state word from a getState() call
+ *              on a same-type, same-string iterator
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ *                   which must not indicate a failure before the function call.
+ *
+ * @see UCharIterator
+ * @see UCharIteratorSetState
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode);
+
+/**
+ * Set up a UCharIterator to iterate over a string.
+ *
+ * Sets the UCharIterator function pointers for iteration over the string s
+ * with iteration boundaries start=index=0 and length=limit=string length.
+ * The "provider" may set the start, index, and limit values at any time
+ * within the range 0..length.
+ * The length field will be ignored.
+ *
+ * The string pointer s is set into UCharIterator.context without copying
+ * or reallocating the string contents.
+ *
+ * getState() simply returns the current index.
+ * move() will always return the final index.
+ *
+ * @param iter UCharIterator structure to be set for iteration
+ * @param s String to iterate over
+ * @param length Length of s, or -1 if NUL-terminated
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+U_STABLE void U_EXPORT2
+uiter_setString(UCharIterator *iter, const UChar *s, int32_t length);
+
+/**
+ * Set up a UCharIterator to iterate over a UTF-16BE string
+ * (byte vector with a big-endian pair of bytes per UChar).
+ *
+ * Everything works just like with a normal UChar iterator (uiter_setString),
+ * except that UChars are assembled from byte pairs,
+ * and that the length argument here indicates an even number of bytes.
+ *
+ * getState() simply returns the current index.
+ * move() will always return the final index.
+ *
+ * @param iter UCharIterator structure to be set for iteration
+ * @param s UTF-16BE string to iterate over
+ * @param length Length of s as an even number of bytes, or -1 if NUL-terminated
+ *               (NUL means pair of 0 bytes at even index from s)
+ *
+ * @see UCharIterator
+ * @see uiter_setString
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length);
+
+/**
+ * Set up a UCharIterator to iterate over a UTF-8 string.
+ *
+ * Sets the UCharIterator function pointers for iteration over the UTF-8 string s
+ * with UTF-8 iteration boundaries 0 and length.
+ * The implementation counts the UTF-16 index on the fly and
+ * lazily evaluates the UTF-16 length of the text.
+ *
+ * The start field is used as the UTF-8 offset, the limit field as the UTF-8 length.
+ * When the reservedField is not 0, then it contains a supplementary code point
+ * and the UTF-16 index is between the two corresponding surrogates.
+ * At that point, the UTF-8 index is behind that code point.
+ *
+ * The UTF-8 string pointer s is set into UCharIterator.context without copying
+ * or reallocating the string contents.
+ *
+ * getState() returns a state value consisting of
+ * - the current UTF-8 source byte index (bits 31..1)
+ * - a flag (bit 0) that indicates whether the UChar position is in the middle
+ *   of a surrogate pair
+ *   (from a 4-byte UTF-8 sequence for the corresponding supplementary code point)
+ *
+ * getState() cannot also encode the UTF-16 index in the state value.
+ * move(relative to limit or length), or
+ * move(relative to current) after setState(), may return UITER_UNKNOWN_INDEX.
+ *
+ * @param iter UCharIterator structure to be set for iteration
+ * @param s UTF-8 string to iterate over
+ * @param length Length of s in bytes, or -1 if NUL-terminated
+ *
+ * @see UCharIterator
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length);
+
+#if U_SHOW_CPLUSPLUS_API
+
+/**
+ * Set up a UCharIterator to wrap around a C++ CharacterIterator.
+ *
+ * Sets the UCharIterator function pointers for iteration using the
+ * CharacterIterator charIter.
+ *
+ * The CharacterIterator pointer charIter is set into UCharIterator.context
+ * without copying or cloning the CharacterIterator object.
+ * The other "protected" UCharIterator fields are set to 0 and will be ignored.
+ * The iteration index and boundaries are controlled by the CharacterIterator.
+ *
+ * getState() simply returns the current index.
+ * move() will always return the final index.
+ *
+ * @param iter UCharIterator structure to be set for iteration
+ * @param charIter CharacterIterator to wrap
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+U_STABLE void U_EXPORT2
+uiter_setCharacterIterator(UCharIterator *iter, U_NAMESPACE_QUALIFIER CharacterIterator *charIter);
+
+/**
+ * Set up a UCharIterator to iterate over a C++ Replaceable.
+ *
+ * Sets the UCharIterator function pointers for iteration over the
+ * Replaceable rep with iteration boundaries start=index=0 and
+ * length=limit=rep->length().
+ * The "provider" may set the start, index, and limit values at any time
+ * within the range 0..length=rep->length().
+ * The length field will be ignored.
+ *
+ * The Replaceable pointer rep is set into UCharIterator.context without copying
+ * or cloning/reallocating the Replaceable object.
+ *
+ * getState() simply returns the current index.
+ * move() will always return the final index.
+ *
+ * @param iter UCharIterator structure to be set for iteration
+ * @param rep Replaceable to iterate over
+ *
+ * @see UCharIterator
+ * @stable ICU 2.1
+ */
+U_STABLE void U_EXPORT2
+uiter_setReplaceable(UCharIterator *iter, const U_NAMESPACE_QUALIFIER Replaceable *rep);
+
+#endif
+
+U_CDECL_END
+
+#endif
diff --git a/Source/WTF/icu/unicode/uloc.h b/Source/WTF/icu/unicode/uloc.h
new file mode 100644
index 0000000..95758c3
--- /dev/null
+++ b/Source/WTF/icu/unicode/uloc.h
@@ -0,0 +1,1126 @@
+/*
+**********************************************************************
+*   Copyright (C) 1997-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+**********************************************************************
+*
+* File ULOC.H
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   04/01/97    aliu        Creation.
+*   08/22/98    stephen     JDK 1.2 sync.
+*   12/08/98    rtg         New C API for Locale
+*   03/30/99    damiba      overhaul
+*   03/31/99    helena      Javadoc for uloc functions.
+*   04/15/99    Madhu       Updated Javadoc
+********************************************************************************
+*/
+
+#ifndef ULOC_H
+#define ULOC_H
+
+#include "unicode/utypes.h"
+#include "unicode/uenum.h"
+
+/**    
+ * \file
+ * \brief  C API: Locale 
+ *
+ * <h2> ULoc C API for Locale </h2>
+ * A <code>Locale</code> represents a specific geographical, political,
+ * or cultural region. An operation that requires a <code>Locale</code> to perform
+ * its task is called <em>locale-sensitive</em> and uses the <code>Locale</code>
+ * to tailor information for the user. For example, displaying a number
+ * is a locale-sensitive operation--the number should be formatted
+ * according to the customs/conventions of the user's native country,
+ * region, or culture.  In the C APIs, a locales is simply a const char string.
+ *
+ * <P>
+ * You create a <code>Locale</code> with one of the three options listed below.
+ * Each of the component is separated by '_' in the locale string.
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ *       newLanguage
+ * 
+ *       newLanguage + newCountry
+ * 
+ *       newLanguage + newCountry + newVariant
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ * The first option is a valid <STRONG>ISO
+ * Language Code.</STRONG> These codes are the lower-case two-letter
+ * codes as defined by ISO-639.
+ * You can find a full list of these codes at a number of sites, such as:
+ * <BR><a href ="http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt">
+ * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt</a>
+ *
+ * <P>
+ * The second option includes an additonal <STRONG>ISO Country
+ * Code.</STRONG> These codes are the upper-case two-letter codes
+ * as defined by ISO-3166.
+ * You can find a full list of these codes at a number of sites, such as:
+ * <BR><a href="http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html">
+ * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a>
+ *
+ * <P>
+ * The third option requires another additonal information--the 
+ * <STRONG>Variant.</STRONG>
+ * The Variant codes are vendor and browser-specific.
+ * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX.
+ * Where there are two variants, separate them with an underscore, and
+ * put the most important one first. For
+ * example, a Traditional Spanish collation might be referenced, with
+ * "ES", "ES", "Traditional_WIN".
+ *
+ * <P>
+ * Because a <code>Locale</code> is just an identifier for a region,
+ * no validity check is performed when you specify a <code>Locale</code>.
+ * If you want to see whether particular resources are available for the
+ * <code>Locale</code> you asked for, you must query those resources. For
+ * example, ask the <code>UNumberFormat</code> for the locales it supports
+ * using its <code>getAvailable</code> method.
+ * <BR><STRONG>Note:</STRONG> When you ask for a resource for a particular
+ * locale, you get back the best available match, not necessarily
+ * precisely what you asked for. For more information, look at
+ * <code>UResourceBundle</code>.
+ *
+ * <P>
+ * The <code>Locale</code> provides a number of convenient constants
+ * that you can use to specify the commonly used
+ * locales. For example, the following refers to a locale
+ * for the United States:
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ *       ULOC_US
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ *
+ * <P>
+ * Once you've specified a locale you can query it for information about
+ * itself. Use <code>uloc_getCountry</code> to get the ISO Country Code and
+ * <code>uloc_getLanguage</code> to get the ISO Language Code. You can
+ * use <code>uloc_getDisplayCountry</code> to get the
+ * name of the country suitable for displaying to the user. Similarly,
+ * you can use <code>uloc_getDisplayLanguage</code> to get the name of
+ * the language suitable for displaying to the user. Interestingly,
+ * the <code>uloc_getDisplayXXX</code> methods are themselves locale-sensitive
+ * and have two versions: one that uses the default locale and one
+ * that takes a locale as an argument and displays the name or country in
+ * a language appropriate to that locale.
+ *
+ * <P>
+ * The ICU provides a number of services that perform locale-sensitive
+ * operations. For example, the <code>unum_xxx</code> functions format
+ * numbers, currency, or percentages in a locale-sensitive manner. 
+ * </P>
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     UNumberFormat *nf;
+ *     const char* myLocale = "fr_FR";
+ * 
+ *     nf = unum_open( UNUM_DEFAULT, NULL, success );          
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_CURRENCY, NULL, success );
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_PERCENT, NULL, success );   
+ *     unum_close(nf);
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ * Each of these methods has two variants; one with an explicit locale
+ * and one without; the latter using the default locale.
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code 
+ * 
+ *     nf = unum_open( UNUM_DEFAULT, myLocale, success );          
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_CURRENCY, myLocale, success );
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_PERCENT, myLocale, success );   
+ *     unum_close(nf);
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ * A <code>Locale</code> is the mechanism for identifying the kind of services
+ * (<code>UNumberFormat</code>) that you would like to get. The locale is
+ * <STRONG>just</STRONG> a mechanism for identifying these services.
+ *
+ * <P>
+ * Each international serivce that performs locale-sensitive operations 
+ * allows you
+ * to get all the available objects of that type. You can sift
+ * through these objects by language, country, or variant,
+ * and use the display names to present a menu to the user.
+ * For example, you can create a menu of all the collation objects
+ * suitable for a given language. Such classes implement these
+ * three class methods:
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ *       const char* uloc_getAvailable(int32_t index);
+ *       int32_t uloc_countAvailable();
+ *       int32_t
+ *       uloc_getDisplayName(const char* localeID,
+ *                 const char* inLocaleID, 
+ *                 UChar* result,
+ *                 int32_t maxResultSize,
+ *                  UErrorCode* err);
+ * 
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ * <P>
+ * Concerning POSIX/RFC1766 Locale IDs, 
+ *  the getLanguage/getCountry/getVariant/getName functions do understand
+ * the POSIX type form of  language_COUNTRY.ENCODING\@VARIANT
+ * and if there is not an ICU-stype variant, uloc_getVariant() for example
+ * will return the one listed after the \@at sign. As well, the hyphen
+ * "-" is recognized as a country/variant separator similarly to RFC1766.
+ * So for example, "en-us" will be interpreted as en_US.  
+ * As a result, uloc_getName() is far from a no-op, and will have the
+ * effect of converting POSIX/RFC1766 IDs into ICU form, although it does
+ * NOT map any of the actual codes (i.e. russian->ru) in any way.
+ * Applications should call uloc_getName() at the point where a locale ID
+ * is coming from an external source (user entry, OS, web browser)
+ * and pass the resulting string to other ICU functions.  For example,
+ * don't use de-de\@EURO as an argument to resourcebundle.
+ *
+ * @see UResourceBundle
+ */
+
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_CHINESE            "zh"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_ENGLISH            "en"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_FRENCH             "fr"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_GERMAN             "de"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_ITALIAN            "it"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_JAPANESE           "ja"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_KOREAN             "ko"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_SIMPLIFIED_CHINESE "zh_CN"
+/** Useful constant for this language. @stable ICU 2.0 */
+#define ULOC_TRADITIONAL_CHINESE "zh_TW"
+
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_CANADA         "en_CA"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_CANADA_FRENCH  "fr_CA"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_CHINA          "zh_CN"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_PRC            "zh_CN"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_FRANCE         "fr_FR"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_GERMANY        "de_DE"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_ITALY          "it_IT"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_JAPAN          "ja_JP"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_KOREA          "ko_KR"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_TAIWAN         "zh_TW"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_UK             "en_GB"
+/** Useful constant for this country/region. @stable ICU 2.0 */
+#define ULOC_US             "en_US"
+
+/**
+ * Useful constant for the maximum size of the language part of a locale ID.
+ * (including the terminating NULL).
+ * @stable ICU 2.0
+ */
+#define ULOC_LANG_CAPACITY 12
+
+/**
+ * Useful constant for the maximum size of the country part of a locale ID
+ * (including the terminating NULL).
+ * @stable ICU 2.0
+ */
+#define ULOC_COUNTRY_CAPACITY 4
+/**
+ * Useful constant for the maximum size of the whole locale ID
+ * (including the terminating NULL and all keywords).
+ * @stable ICU 2.0
+ */
+#define ULOC_FULLNAME_CAPACITY 157
+
+/**
+ * Useful constant for the maximum size of the script part of a locale ID
+ * (including the terminating NULL).
+ * @stable ICU 2.8
+ */
+#define ULOC_SCRIPT_CAPACITY 6
+
+/**
+ * Useful constant for the maximum size of keywords in a locale
+ * @stable ICU 2.8
+ */
+#define ULOC_KEYWORDS_CAPACITY 50
+
+/**
+ * Useful constant for the maximum total size of keywords and their values in a locale
+ * @stable ICU 2.8
+ */
+#define ULOC_KEYWORD_AND_VALUES_CAPACITY 100
+
+/**
+ * Invariant character separating keywords from the locale string
+ * @stable ICU 2.8
+ */
+#define ULOC_KEYWORD_SEPARATOR '@'
+
+/**
+  * Unicode code point for '@' separating keywords from the locale string.
+  * @see ULOC_KEYWORD_SEPARATOR
+  * @draft ICU 4.6
+  */
+#define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40
+
+/**
+ * Invariant character for assigning value to a keyword
+ * @stable ICU 2.8
+ */
+#define ULOC_KEYWORD_ASSIGN '='
+
+/**
+  * Unicode code point for '=' for assigning value to a keyword.
+  * @see ULOC_KEYWORD_ASSIGN
+  * @draft ICU 4.6 
+  */
+#define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D
+
+/**
+ * Invariant character separating keywords
+ * @stable ICU 2.8
+ */
+#define ULOC_KEYWORD_ITEM_SEPARATOR ';'
+
+/**
+  * Unicode code point for ';' separating keywords
+  * @see ULOC_KEYWORD_ITEM_SEPARATOR
+  * @draft ICU 4.6
+  */
+#define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B
+
+/**
+ * Constants for *_getLocale()
+ * Allow user to select whether she wants information on 
+ * requested, valid or actual locale.
+ * For example, a collator for "en_US_CALIFORNIA" was
+ * requested. In the current state of ICU (2.0), 
+ * the requested locale is "en_US_CALIFORNIA",
+ * the valid locale is "en_US" (most specific locale supported by ICU)
+ * and the actual locale is "root" (the collation data comes unmodified 
+ * from the UCA)
+ * The locale is considered supported by ICU if there is a core ICU bundle 
+ * for that locale (although it may be empty).
+ * @stable ICU 2.1
+ */
+typedef enum {
+  /** This is locale the data actually comes from 
+   * @stable ICU 2.1
+   */
+  ULOC_ACTUAL_LOCALE    = 0,
+  /** This is the most specific locale supported by ICU 
+   * @stable ICU 2.1
+   */
+  ULOC_VALID_LOCALE    = 1,
+
+#ifndef U_HIDE_DEPRECATED_API
+  /** This is the requested locale
+   *  @deprecated ICU 2.8 
+   */
+  ULOC_REQUESTED_LOCALE = 2,
+#endif /* U_HIDE_DEPRECATED_API */
+
+  ULOC_DATA_LOCALE_TYPE_LIMIT = 3
+} ULocDataLocaleType ;
+
+
+/**
+ * Gets ICU's default locale.  
+ * The returned string is a snapshot in time, and will remain valid
+ *   and unchanged even when uloc_setDefault() is called.
+ *   The returned storage is owned by ICU, and must not be altered or deleted
+ *   by the caller.
+ *  
+ * @return the ICU default locale
+ * @system
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+uloc_getDefault(void);
+
+/**
+ * Sets ICU's default locale.  
+ *    By default (without calling this function), ICU's default locale will be based
+ *    on information obtained from the underlying system environment.
+ *    <p>
+ *    Changes to ICU's default locale do not propagate back to the
+ *    system environment.
+ *    <p>
+ *    Changes to ICU's default locale to not affect any ICU services that
+ *    may already be open based on the previous default locale value.
+ *
+ * @param localeID the new ICU default locale. A value of NULL will try to get
+ *                 the system's default locale.
+ * @param status the error information if the setting of default locale fails
+ * @system
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+uloc_setDefault(const char* localeID,
+        UErrorCode*       status);
+
+/**
+ * Gets the language code for the specified locale.
+ *
+ * @param localeID the locale to get the ISO language code with
+ * @param language the language code for localeID
+ * @param languageCapacity the size of the language buffer to store the  
+ * language code with
+ * @param err error information if retrieving the language code failed
+ * @return the actual buffer size needed for the language code.  If it's greater 
+ * than languageCapacity, the returned language code will be truncated.  
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getLanguage(const char*    localeID,
+         char* language,
+         int32_t languageCapacity,
+         UErrorCode* err);
+
+/**
+ * Gets the script code for the specified locale.
+ *
+ * @param localeID the locale to get the ISO language code with
+ * @param script the language code for localeID
+ * @param scriptCapacity the size of the language buffer to store the  
+ * language code with
+ * @param err error information if retrieving the language code failed
+ * @return the actual buffer size needed for the language code.  If it's greater 
+ * than scriptCapacity, the returned language code will be truncated.  
+ * @stable ICU 2.8
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getScript(const char*    localeID,
+         char* script,
+         int32_t scriptCapacity,
+         UErrorCode* err);
+
+/**
+ * Gets the  country code for the specified locale.
+ *
+ * @param localeID the locale to get the country code with
+ * @param country the country code for localeID
+ * @param countryCapacity the size of the country buffer to store the  
+ * country code with
+ * @param err error information if retrieving the country code failed
+ * @return the actual buffer size needed for the country code.  If it's greater 
+ * than countryCapacity, the returned country code will be truncated.  
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getCountry(const char*    localeID,
+        char* country,
+        int32_t countryCapacity,
+        UErrorCode* err);
+
+/**
+ * Gets the variant code for the specified locale.
+ *
+ * @param localeID the locale to get the variant code with
+ * @param variant the variant code for localeID
+ * @param variantCapacity the size of the variant buffer to store the 
+ * variant code with
+ * @param err error information if retrieving the variant code failed
+ * @return the actual buffer size needed for the variant code.  If it's greater 
+ * than variantCapacity, the returned variant code will be truncated.  
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getVariant(const char*    localeID,
+        char* variant,
+        int32_t variantCapacity,
+        UErrorCode* err);
+
+
+/**
+ * Gets the full name for the specified locale.
+ * Note: This has the effect of 'canonicalizing' the ICU locale ID to
+ * a certain extent. Upper and lower case are set as needed.
+ * It does NOT map aliased names in any way.
+ * See the top of this header file.
+ * This API supports preflighting.
+ *
+ * @param localeID the locale to get the full name with
+ * @param name fill in buffer for the name without keywords.
+ * @param nameCapacity capacity of the fill in buffer.
+ * @param err error information if retrieving the full name failed
+ * @return the actual buffer size needed for the full name.  If it's greater 
+ * than nameCapacity, the returned full name will be truncated.  
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getName(const char*    localeID,
+         char* name,
+         int32_t nameCapacity,
+         UErrorCode* err);
+
+/**
+ * Gets the full name for the specified locale.
+ * Note: This has the effect of 'canonicalizing' the string to
+ * a certain extent. Upper and lower case are set as needed,
+ * and if the components were in 'POSIX' format they are changed to
+ * ICU format.  It does NOT map aliased names in any way.
+ * See the top of this header file.
+ *
+ * @param localeID the locale to get the full name with
+ * @param name the full name for localeID
+ * @param nameCapacity the size of the name buffer to store the 
+ * full name with
+ * @param err error information if retrieving the full name failed
+ * @return the actual buffer size needed for the full name.  If it's greater 
+ * than nameCapacity, the returned full name will be truncated.  
+ * @stable ICU 2.8
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_canonicalize(const char*    localeID,
+         char* name,
+         int32_t nameCapacity,
+         UErrorCode* err);
+
+/**
+ * Gets the ISO language code for the specified locale.
+ *
+ * @param localeID the locale to get the ISO language code with
+ * @return language the ISO language code for localeID
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+uloc_getISO3Language(const char* localeID);
+
+
+/**
+ * Gets the ISO country code for the specified locale.
+ *
+ * @param localeID the locale to get the ISO country code with
+ * @return country the ISO country code for localeID
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+uloc_getISO3Country(const char* localeID);
+
+/**
+ * Gets the Win32 LCID value for the specified locale.
+ * If the ICU locale is not recognized by Windows, 0 will be returned.
+ *
+ * @param localeID the locale to get the Win32 LCID value with
+ * @return country the Win32 LCID for localeID
+ * @stable ICU 2.0
+ */
+U_STABLE uint32_t U_EXPORT2
+uloc_getLCID(const char* localeID);
+
+/**
+ * Gets the language name suitable for display for the specified locale.
+ *
+ * @param locale the locale to get the ISO language code with
+ * @param displayLocale Specifies the locale to be used to display the name.  In other words,
+ *                 if the locale's language code is "en", passing Locale::getFrench() for
+ *                 inLocale would result in "Anglais", while passing Locale::getGerman()
+ *                 for inLocale would result in "Englisch".
+ * @param language the displayable language code for localeID
+ * @param languageCapacity the size of the language buffer to store the  
+ * displayable language code with
+ * @param status error information if retrieving the displayable language code failed
+ * @return the actual buffer size needed for the displayable language code.  If it's greater 
+ * than languageCapacity, the returned language code will be truncated.  
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getDisplayLanguage(const char* locale,
+            const char* displayLocale,
+            UChar* language,
+            int32_t languageCapacity,
+            UErrorCode* status);
+
+/**
+ * Gets the script name suitable for display for the specified locale.
+ *
+ * @param locale the locale to get the displayable script code with. NULL may be used to specify the default.
+ * @param displayLocale Specifies the locale to be used to display the name.  In other words,
+ *                 if the locale's language code is "en", passing Locale::getFrench() for
+ *                 inLocale would result in "", while passing Locale::getGerman()
+ *                 for inLocale would result in "". NULL may be used to specify the default.
+ * @param script the displayable country code for localeID
+ * @param scriptCapacity the size of the script buffer to store the  
+ * displayable script code with
+ * @param status error information if retrieving the displayable script code failed
+ * @return the actual buffer size needed for the displayable script code.  If it's greater 
+ * than scriptCapacity, the returned displayable script code will be truncated.  
+ * @stable ICU 2.8
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getDisplayScript(const char* locale,
+            const char* displayLocale,
+            UChar* script,
+            int32_t scriptCapacity,
+            UErrorCode* status);
+
+/**
+ * Gets the country name suitable for display for the specified locale.
+ *
+ * @param locale the locale to get the displayable country code with. NULL may be used to specify the default.
+ * @param displayLocale Specifies the locale to be used to display the name.  In other words,
+ *                 if the locale's language code is "en", passing Locale::getFrench() for
+ *                 inLocale would result in "Anglais", while passing Locale::getGerman()
+ *                 for inLocale would result in "Englisch". NULL may be used to specify the default.
+ * @param country the displayable country code for localeID
+ * @param countryCapacity the size of the country buffer to store the  
+ * displayable country code with
+ * @param status error information if retrieving the displayable country code failed
+ * @return the actual buffer size needed for the displayable country code.  If it's greater 
+ * than countryCapacity, the returned displayable country code will be truncated.  
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getDisplayCountry(const char* locale,
+                       const char* displayLocale,
+                       UChar* country,
+                       int32_t countryCapacity,
+                       UErrorCode* status);
+
+
+/**
+ * Gets the variant name suitable for display for the specified locale.
+ *
+ * @param locale the locale to get the displayable variant code with. NULL may be used to specify the default.
+ * @param displayLocale Specifies the locale to be used to display the name.  In other words,
+ *                 if the locale's language code is "en", passing Locale::getFrench() for
+ *                 inLocale would result in "Anglais", while passing Locale::getGerman()
+ *                 for inLocale would result in "Englisch". NULL may be used to specify the default.
+ * @param variant the displayable variant code for localeID
+ * @param variantCapacity the size of the variant buffer to store the 
+ * displayable variant code with
+ * @param status error information if retrieving the displayable variant code failed
+ * @return the actual buffer size needed for the displayable variant code.  If it's greater 
+ * than variantCapacity, the returned displayable variant code will be truncated.  
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getDisplayVariant(const char* locale,
+                       const char* displayLocale,
+                       UChar* variant,
+                       int32_t variantCapacity,
+                       UErrorCode* status);
+
+/**
+ * Gets the keyword name suitable for display for the specified locale.
+ * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display 
+ * string for the keyword collation. 
+ * Usage:
+ * <code>
+ *    UErrorCode status = U_ZERO_ERROR;
+ *    const char* keyword =NULL;
+ *    int32_t keywordLen = 0;
+ *    int32_t keywordCount = 0;
+ *    UChar displayKeyword[256];
+ *    int32_t displayKeywordLen = 0;
+ *    UEnumeration* keywordEnum = uloc_openKeywords("de_DE@collation=PHONEBOOK;calendar=TRADITIONAL", &status);
+ *    for(keywordCount = uenum_count(keywordEnum, &status); keywordCount > 0 ; keywordCount--){
+ *          if(U_FAILURE(status)){
+ *              ...something went wrong so handle the error...
+ *              break;
+ *          }
+ *          // the uenum_next returns NUL terminated string
+ *          keyword = uenum_next(keywordEnum, &keywordLen, &status);
+ *          displayKeywordLen = uloc_getDisplayKeyword(keyword, "en_US", displayKeyword, 256);
+ *          ... do something interesting .....
+ *    }
+ *    uenum_close(keywordEnum);
+ * </code>
+ * @param keyword           The keyword whose display string needs to be returned.
+ * @param displayLocale     Specifies the locale to be used to display the name.  In other words,
+ *                          if the locale's language code is "en", passing Locale::getFrench() for
+ *                          inLocale would result in "Anglais", while passing Locale::getGerman()
+ *                          for inLocale would result in "Englisch". NULL may be used to specify the default.
+ * @param dest              the buffer to which the displayable keyword should be written.
+ * @param destCapacity      The size of the buffer (number of UChars). If it is 0, then
+ *                          dest may be NULL and the function will only return the length of the 
+ *                          result without writing any of the result string (pre-flighting).
+ * @param status            error information if retrieving the displayable string failed. 
+ *                          Should not be NULL and should not indicate failure on entry.
+ * @return the actual buffer size needed for the displayable variant code.  
+ * @see #uloc_openKeywords
+ * @stable ICU 2.8
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getDisplayKeyword(const char* keyword,
+                       const char* displayLocale,
+                       UChar* dest,
+                       int32_t destCapacity,
+                       UErrorCode* status);
+/**
+ * Gets the value of the keyword suitable for display for the specified locale.
+ * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display 
+ * string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword.
+ *
+ * @param locale            The locale to get the displayable variant code with. NULL may be used to specify the default.
+ * @param keyword           The keyword for whose value should be used.
+ * @param displayLocale     Specifies the locale to be used to display the name.  In other words,
+ *                          if the locale's language code is "en", passing Locale::getFrench() for
+ *                          inLocale would result in "Anglais", while passing Locale::getGerman()
+ *                          for inLocale would result in "Englisch". NULL may be used to specify the default.
+ * @param dest              the buffer to which the displayable keyword should be written.
+ * @param destCapacity      The size of the buffer (number of UChars). If it is 0, then
+ *                          dest may be NULL and the function will only return the length of the 
+ *                          result without writing any of the result string (pre-flighting).
+ * @param status            error information if retrieving the displayable string failed. 
+ *                          Should not be NULL and must not indicate failure on entry.
+ * @return the actual buffer size needed for the displayable variant code.  
+ * @stable ICU 2.8
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getDisplayKeywordValue(   const char* locale,
+                               const char* keyword,
+                               const char* displayLocale,
+                               UChar* dest,
+                               int32_t destCapacity,
+                               UErrorCode* status);
+/**
+ * Gets the full name suitable for display for the specified locale.
+ *
+ * @param localeID the locale to get the displayable name with. NULL may be used to specify the default.
+ * @param inLocaleID Specifies the locale to be used to display the name.  In other words,
+ *                   if the locale's language code is "en", passing Locale::getFrench() for
+ *                   inLocale would result in "Anglais", while passing Locale::getGerman()
+ *                   for inLocale would result in "Englisch". NULL may be used to specify the default.
+ * @param result the displayable name for localeID
+ * @param maxResultSize the size of the name buffer to store the 
+ * displayable full name with
+ * @param err error information if retrieving the displayable name failed
+ * @return the actual buffer size needed for the displayable name.  If it's greater 
+ * than maxResultSize, the returned displayable name will be truncated.  
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getDisplayName(const char* localeID,
+            const char* inLocaleID,
+            UChar* result,
+            int32_t maxResultSize,
+            UErrorCode* err);
+
+
+/**
+ * Gets the specified locale from a list of all available locales.  
+ * The return value is a pointer to an item of 
+ * a locale name array.  Both this array and the pointers
+ * it contains are owned by ICU and should not be deleted or written through
+ * by the caller.  The locale name is terminated by a null pointer.
+ * @param n the specific locale name index of the available locale list
+ * @return a specified locale name of all available locales
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+uloc_getAvailable(int32_t n);
+
+/**
+ * Gets the size of the all available locale list.
+ *
+ * @return the size of the locale list
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void);
+
+/**
+ *
+ * Gets a list of all available language codes defined in ISO 639.  This is a pointer
+ * to an array of pointers to arrays of char.  All of these pointers are owned
+ * by ICU-- do not delete them, and do not write through them.  The array is
+ * terminated with a null pointer.
+ * @return a list of all available language codes
+ * @stable ICU 2.0
+ */
+U_STABLE const char* const* U_EXPORT2
+uloc_getISOLanguages(void);
+
+/**
+ *
+ * Gets a list of all available 2-letter country codes defined in ISO 639.  This is a
+ * pointer to an array of pointers to arrays of char.  All of these pointers are
+ * owned by ICU-- do not delete them, and do not write through them.  The array is
+ * terminated with a null pointer.
+ * @return a list of all available country codes
+ * @stable ICU 2.0
+ */
+U_STABLE const char* const* U_EXPORT2
+uloc_getISOCountries(void);
+
+/**
+ * Truncate the locale ID string to get the parent locale ID.
+ * Copies the part of the string before the last underscore.
+ * The parent locale ID will be an empty string if there is no
+ * underscore, or if there is only one underscore at localeID[0].
+ *
+ * @param localeID Input locale ID string.
+ * @param parent   Output string buffer for the parent locale ID.
+ * @param parentCapacity Size of the output buffer.
+ * @param err A UErrorCode value.
+ * @return The length of the parent locale ID.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getParent(const char*    localeID,
+                 char* parent,
+                 int32_t parentCapacity,
+                 UErrorCode* err);
+
+
+
+
+/**
+ * Gets the full name for the specified locale.
+ * Note: This has the effect of 'canonicalizing' the string to
+ * a certain extent. Upper and lower case are set as needed,
+ * and if the components were in 'POSIX' format they are changed to
+ * ICU format.  It does NOT map aliased names in any way.
+ * See the top of this header file.
+ * This API strips off the keyword part, so "de_DE\@collation=phonebook" 
+ * will become "de_DE". 
+ * This API supports preflighting.
+ *
+ * @param localeID the locale to get the full name with
+ * @param name fill in buffer for the name without keywords.
+ * @param nameCapacity capacity of the fill in buffer.
+ * @param err error information if retrieving the full name failed
+ * @return the actual buffer size needed for the full name.  If it's greater 
+ * than nameCapacity, the returned full name will be truncated.  
+ * @stable ICU 2.8
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getBaseName(const char*    localeID,
+         char* name,
+         int32_t nameCapacity,
+         UErrorCode* err);
+
+/**
+ * Gets an enumeration of keywords for the specified locale. Enumeration
+ * must get disposed of by the client using uenum_close function.
+ *
+ * @param localeID the locale to get the variant code with
+ * @param status error information if retrieving the keywords failed
+ * @return enumeration of keywords or NULL if there are no keywords.
+ * @stable ICU 2.8
+ */
+U_STABLE UEnumeration* U_EXPORT2
+uloc_openKeywords(const char* localeID,
+                        UErrorCode* status);
+
+/**
+ * Get the value for a keyword. Locale name does not need to be normalized.
+ * 
+ * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK")
+ * @param keywordName name of the keyword for which we want the value. Case insensitive.
+ * @param buffer receiving buffer
+ * @param bufferCapacity capacity of receiving buffer
+ * @param status containing error code - buffer not big enough.
+ * @return the length of keyword value
+ * @stable ICU 2.8
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getKeywordValue(const char* localeID,
+                     const char* keywordName,
+                     char* buffer, int32_t bufferCapacity,
+                     UErrorCode* status);
+
+
+/**
+ * Set the value of the specified keyword.
+ * NOTE: Unlike almost every other ICU function which takes a
+ * buffer, this function will NOT truncate the output text. If a
+ * BUFFER_OVERFLOW_ERROR is received, it means that the original
+ * buffer is untouched. This is done to prevent incorrect or possibly
+ * even malformed locales from being generated and used.
+ * 
+ * @param keywordName name of the keyword to be set. Case insensitive.
+ * @param keywordValue value of the keyword to be set. If 0-length or
+ *  NULL, will result in the keyword being removed. No error is given if 
+ *  that keyword does not exist.
+ * @param buffer input buffer containing locale to be modified.
+ * @param bufferCapacity capacity of receiving buffer
+ * @param status containing error code - buffer not big enough.
+ * @return the length needed for the buffer
+ * @see uloc_getKeywordValue
+ * @stable ICU 3.2
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_setKeywordValue(const char* keywordName,
+                     const char* keywordValue,
+                     char* buffer, int32_t bufferCapacity,
+                     UErrorCode* status);
+
+/**
+ * enums for the  return value for the character and line orientation
+ * functions.
+ * @stable ICU 4.0
+ */
+typedef enum {
+  ULOC_LAYOUT_LTR   = 0,  /* left-to-right. */
+  ULOC_LAYOUT_RTL    = 1,  /* right-to-left. */
+  ULOC_LAYOUT_TTB    = 2,  /* top-to-bottom. */
+  ULOC_LAYOUT_BTT    = 3,   /* bottom-to-top. */
+  ULOC_LAYOUT_UNKNOWN
+} ULayoutType;
+
+/**
+ * Get the layout character orientation for the specified locale.
+ * 
+ * @param localeId locale name
+ * @param status Error status
+ * @return an enum indicating the layout orientation for characters.
+ * @stable ICU 4.0
+ */
+U_STABLE ULayoutType U_EXPORT2
+uloc_getCharacterOrientation(const char* localeId,
+                             UErrorCode *status);
+
+/**
+ * Get the layout line orientation for the specified locale.
+ * 
+ * @param localeId locale name
+ * @param status Error status
+ * @return an enum indicating the layout orientation for lines.
+ * @stable ICU 4.0
+ */
+U_STABLE ULayoutType U_EXPORT2
+uloc_getLineOrientation(const char* localeId,
+                        UErrorCode *status);
+
+/**
+ * enums for the 'outResult' parameter return value
+ * @see uloc_acceptLanguageFromHTTP
+ * @see uloc_acceptLanguage
+ * @stable ICU 3.2
+ */
+typedef enum {
+  ULOC_ACCEPT_FAILED   = 0,  /* No exact match was found. */
+  ULOC_ACCEPT_VALID    = 1,  /* An exact match was found. */
+  ULOC_ACCEPT_FALLBACK = 2   /* A fallback was found, for example, 
+                                Accept list contained 'ja_JP'
+                                which matched available locale 'ja'. */
+} UAcceptResult;
+
+
+/**
+ * Based on a HTTP header from a web browser and a list of available locales,
+ * determine an acceptable locale for the user.
+ * @param result - buffer to accept the result locale
+ * @param resultAvailable the size of the result buffer.
+ * @param outResult - An out parameter that contains the fallback status
+ * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP.
+ * @param availableLocales - list of available locales to match
+ * @param status Error status, may be BUFFER_OVERFLOW_ERROR
+ * @return length needed for the locale.
+ * @stable ICU 3.2
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
+                            UAcceptResult *outResult,
+                            const char *httpAcceptLanguage,
+                            UEnumeration* availableLocales,
+                            UErrorCode *status);
+
+/**
+ * Based on a list of available locales,
+ * determine an acceptable locale for the user.
+ * @param result - buffer to accept the result locale
+ * @param resultAvailable the size of the result buffer.
+ * @param outResult - An out parameter that contains the fallback status
+ * @param acceptList - list of acceptable languages
+ * @param acceptListCount - count of acceptList items
+ * @param availableLocales - list of available locales to match
+ * @param status Error status, may be BUFFER_OVERFLOW_ERROR
+ * @return length needed for the locale.
+ * @stable ICU 3.2
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_acceptLanguage(char *result, int32_t resultAvailable, 
+                    UAcceptResult *outResult, const char **acceptList,
+                    int32_t acceptListCount,
+                    UEnumeration* availableLocales,
+                    UErrorCode *status);
+
+
+/**
+ * Gets the ICU locale ID for the specified Win32 LCID value.
+ *
+ * @param hostID the Win32 LCID to translate
+ * @param locale the output buffer for the ICU locale ID, which will be NUL-terminated
+ *  if there is room.
+ * @param localeCapacity the size of the output buffer
+ * @param status an error is returned if the LCID is unrecognized or the output buffer
+ *  is too small
+ * @return actual the actual size of the locale ID, not including NUL-termination 
+ * @stable ICU 3.8
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
+                    UErrorCode *status);
+
+
+/**
+ * Add the likely subtags for a provided locale ID, per the algorithm described
+ * in the following CLDR technical report:
+ *
+ *   http://www.unicode.org/reports/tr35/#Likely_Subtags
+ *
+ * If localeID is already in the maximal form, or there is no data available
+ * for maximization, it will be copied to the output buffer.  For example,
+ * "und-Zzzz" cannot be maximized, since there is no reasonable maximization.
+ *
+ * Examples:
+ *
+ * "en" maximizes to "en_Latn_US"
+ *
+ * "de" maximizes to "de_Latn_US"
+ *
+ * "sr" maximizes to "sr_Cyrl_RS"
+ *
+ * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.)
+ *
+ * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.)
+ *
+ * @param localeID The locale to maximize
+ * @param maximizedLocaleID The maximized locale
+ * @param maximizedLocaleIDCapacity The capacity of the maximizedLocaleID buffer
+ * @param err Error information if maximizing the locale failed.  If the length
+ * of the localeID and the null-terminator is greater than the maximum allowed size,
+ * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
+ * @return The actual buffer size needed for the maximized locale.  If it's
+ * greater than maximizedLocaleIDCapacity, the returned ID will be truncated.
+ * On error, the return value is -1.
+ * @stable ICU 4.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_addLikelySubtags(const char*    localeID,
+         char* maximizedLocaleID,
+         int32_t maximizedLocaleIDCapacity,
+         UErrorCode* err);
+
+
+/**
+ * Minimize the subtags for a provided locale ID, per the algorithm described
+ * in the following CLDR technical report:
+ *
+ *   http://www.unicode.org/reports/tr35/#Likely_Subtags
+ *
+ * If localeID is already in the minimal form, or there is no data available
+ * for minimization, it will be copied to the output buffer.  Since the
+ * minimization algorithm relies on proper maximization, see the comments
+ * for uloc_addLikelySubtags for reasons why there might not be any data.
+ *
+ * Examples:
+ *
+ * "en_Latn_US" minimizes to "en"
+ *
+ * "de_Latn_US" minimizes to "de"
+ *
+ * "sr_Cyrl_RS" minimizes to "sr"
+ *
+ * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the
+ * script, and minimizing to "zh" would imply "zh_Hans_CN".)
+ *
+ * @param localeID The locale to minimize
+ * @param minimizedLocaleID The minimized locale
+ * @param minimizedLocaleIDCapacity The capacity of the minimizedLocaleID buffer
+ * @param err Error information if minimizing the locale failed.  If the length
+ * of the localeID and the null-terminator is greater than the maximum allowed size,
+ * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
+ * @return The actual buffer size needed for the minimized locale.  If it's
+ * greater than minimizedLocaleIDCapacity, the returned ID will be truncated.
+ * On error, the return value is -1.
+ * @stable ICU 4.0
+ */
+U_STABLE int32_t U_EXPORT2
+uloc_minimizeSubtags(const char*    localeID,
+         char* minimizedLocaleID,
+         int32_t minimizedLocaleIDCapacity,
+         UErrorCode* err);
+
+/** 
+ * Returns a locale ID for the specified BCP47 language tag string.
+ * If the specified language tag contains any ill-formed subtags,
+ * the first such subtag and all following subtags are ignored.
+ * <p> 
+ * This implements the 'Language-Tag' production of BCP47, and so
+ * supports grandfathered (regular and irregular) as well as private
+ * use language tags.  Private use tags are represented as 'x-whatever',
+ * and grandfathered tags are converted to their canonical replacements
+ * where they exist.  Note that a few grandfathered tags have no modern
+ * replacement, these will be converted using the fallback described in
+ * the first paragraph, so some information might be lost.
+ * @param langtag   the input BCP47 language tag.
+ * @param localeID  the output buffer receiving a locale ID for the
+ *                  specified BCP47 language tag.
+ * @param localeIDCapacity  the size of the locale ID output buffer.
+ * @param parsedLength  if not NULL, succsessfully parsed length
+ *                      for the input language tag is set.
+ * @param err       error information if receiving the locald ID
+ *                  failed.
+ * @return          the length of the locale ID.
+ * @draft ICU 4.2
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_forLanguageTag(const char* langtag,
+                    char* localeID,
+                    int32_t localeIDCapacity,
+                    int32_t* parsedLength,
+                    UErrorCode* err);
+
+/** 
+ * Returns a well-formed language tag for this locale ID. 
+ * <p> 
+ * <b>Note</b>: When <code>strict</code> is FALSE, any locale
+ * fields which do not satisfy the BCP47 syntax requirement will
+ * be omitted from the result.  When <code>strict</code> is
+ * TRUE, this function sets U_ILLEGAL_ARGUMENT_ERROR to the
+ * <code>err</code> if any locale fields do not satisfy the
+ * BCP47 syntax requirement.
+ * @param localeID  the input lcoale ID
+ * @param langtag   the output buffer receiving BCP47 language
+ *                  tag for the locale ID.
+ * @param langtagCapacity   the size of the BCP47 language tag
+ *                          output buffer.
+ * @param strict    boolean value indicating if the function returns
+ *                  an error for an ill-formed input locale ID.
+ * @param err       error information if receiving the language
+ *                  tag failed.
+ * @return          The length of the BCP47 language tag.
+ * @draft ICU 4.2
+ */
+U_DRAFT int32_t U_EXPORT2
+uloc_toLanguageTag(const char* localeID,
+                   char* langtag,
+                   int32_t langtagCapacity,
+                   UBool strict,
+                   UErrorCode* err);
+
+#endif /*_ULOC*/
diff --git a/Source/WTF/icu/unicode/umachine.h b/Source/WTF/icu/unicode/umachine.h
new file mode 100644
index 0000000..abbdcb7
--- /dev/null
+++ b/Source/WTF/icu/unicode/umachine.h
@@ -0,0 +1,374 @@
+/*
+******************************************************************************
+*
+*   Copyright (C) 1999-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+******************************************************************************
+*   file name:  umachine.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 1999sep13
+*   created by: Markus W. Scherer
+*
+*   This file defines basic types and constants for utf.h to be
+*   platform-independent. umachine.h and utf.h are included into
+*   utypes.h to provide all the general definitions for ICU.
+*   All of these definitions used to be in utypes.h before
+*   the UTF-handling macros made this unmaintainable.
+*/
+
+#ifndef __UMACHINE_H__
+#define __UMACHINE_H__
+
+
+/**
+ * \file
+ * \brief Basic types and constants for UTF
+ *
+ * <h2> Basic types and constants for UTF </h2>
+ *   This file defines basic types and constants for utf.h to be
+ *   platform-independent. umachine.h and utf.h are included into
+ *   utypes.h to provide all the general definitions for ICU.
+ *   All of these definitions used to be in utypes.h before
+ *   the UTF-handling macros made this unmaintainable.
+ *
+ */
+/*==========================================================================*/
+/* Include platform-dependent definitions                                   */
+/* which are contained in the platform-specific file platform.h             */
+/*==========================================================================*/
+
+#if defined(U_PALMOS)
+#   include "unicode/ppalmos.h"
+#elif !defined(__MINGW32__) && (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64))
+#ifdef CYGWINMSVC
+#   include "unicode/platform.h"
+#endif
+#   include "unicode/pwin32.h"
+#else
+#   include "unicode/ptypes.h" /* platform.h is included in ptypes.h */
+#endif
+
+/*
+ * ANSI C headers:
+ * stddef.h defines wchar_t
+ */
+#include <stddef.h>
+
+/*==========================================================================*/
+/* XP_CPLUSPLUS is a cross-platform symbol which should be defined when     */
+/* using C++.  It should not be defined when compiling under C.             */
+/*==========================================================================*/
+
+#ifdef __cplusplus
+#   ifndef XP_CPLUSPLUS
+#       define XP_CPLUSPLUS
+#   endif
+#else
+#   undef XP_CPLUSPLUS
+#endif
+
+/*==========================================================================*/
+/* For C wrappers, we use the symbol U_STABLE.                                */
+/* This works properly if the includer is C or C++.                         */
+/* Functions are declared   U_STABLE return-type U_EXPORT2 function-name()... */
+/*==========================================================================*/
+
+/**
+ * \def U_CFUNC
+ * This is used in a declaration of a library private ICU C function.
+ * @stable ICU 2.4
+ */
+
+/**
+ * \def U_CDECL_BEGIN
+ * This is used to begin a declaration of a library private ICU C API.
+ * @stable ICU 2.4
+ */
+
+/**
+ * \def U_CDECL_END
+ * This is used to end a declaration of a library private ICU C API
+ * @stable ICU 2.4
+ */
+
+#ifdef XP_CPLUSPLUS
+#   define U_CFUNC extern "C"
+#   define U_CDECL_BEGIN extern "C" {
+#   define U_CDECL_END   }
+#else
+#   define U_CFUNC extern
+#   define U_CDECL_BEGIN
+#   define U_CDECL_END
+#endif
+
+/**
+ * \def U_ATTRIBUTE_DEPRECATED
+ *  This is used for GCC specific attributes
+ * @internal
+ */
+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
+#    define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
+/**
+ * \def U_ATTRIBUTE_DEPRECATED
+ * This is used for Visual C++ specific attributes 
+ * @internal
+ */
+#elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400)
+#    define U_ATTRIBUTE_DEPRECATED __declspec(deprecated)
+#else
+#    define U_ATTRIBUTE_DEPRECATED
+#endif
+/** This is used to declare a function as a public ICU C API @stable ICU 2.0*/
+#define U_CAPI U_CFUNC U_EXPORT
+/** This is used to declare a function as a stable public ICU C API*/
+#define U_STABLE U_CAPI
+/** This is used to declare a function as a draft public ICU C API  */
+#define U_DRAFT  U_CAPI
+/** This is used to declare a function as a deprecated public ICU C API  */
+#define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED
+/** This is used to declare a function as an obsolete public ICU C API  */
+#define U_OBSOLETE U_CAPI
+/** This is used to declare a function as an internal ICU C API  */
+#define U_INTERNAL U_CAPI
+
+/*==========================================================================*/
+/* limits for int32_t etc., like in POSIX inttypes.h                        */
+/*==========================================================================*/
+
+#ifndef INT8_MIN
+/** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */
+#   define INT8_MIN        ((int8_t)(-128))
+#endif
+#ifndef INT16_MIN
+/** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */
+#   define INT16_MIN       ((int16_t)(-32767-1))
+#endif
+#ifndef INT32_MIN
+/** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */
+#   define INT32_MIN       ((int32_t)(-2147483647-1))
+#endif
+
+#ifndef INT8_MAX
+/** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */
+#   define INT8_MAX        ((int8_t)(127))
+#endif
+#ifndef INT16_MAX
+/** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */
+#   define INT16_MAX       ((int16_t)(32767))
+#endif
+#ifndef INT32_MAX
+/** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */
+#   define INT32_MAX       ((int32_t)(2147483647))
+#endif
+
+#ifndef UINT8_MAX
+/** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */
+#   define UINT8_MAX       ((uint8_t)(255U))
+#endif
+#ifndef UINT16_MAX
+/** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */
+#   define UINT16_MAX      ((uint16_t)(65535U))
+#endif
+#ifndef UINT32_MAX
+/** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */
+#   define UINT32_MAX      ((uint32_t)(4294967295U))
+#endif
+
+#if defined(U_INT64_T_UNAVAILABLE)
+# error int64_t is required for decimal format and rule-based number format.
+#else
+# ifndef INT64_C
+/**
+ * Provides a platform independent way to specify a signed 64-bit integer constant.
+ * note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C
+ * @stable ICU 2.8
+ */
+#   define INT64_C(c) c ## LL
+# endif
+# ifndef UINT64_C
+/**
+ * Provides a platform independent way to specify an unsigned 64-bit integer constant.
+ * note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C
+ * @stable ICU 2.8
+ */
+#   define UINT64_C(c) c ## ULL
+# endif
+# ifndef U_INT64_MIN
+/** The smallest value a 64 bit signed integer can hold @stable ICU 2.8 */
+#     define U_INT64_MIN       ((int64_t)(INT64_C(-9223372036854775807)-1))
+# endif
+# ifndef U_INT64_MAX
+/** The largest value a 64 bit signed integer can hold @stable ICU 2.8 */
+#     define U_INT64_MAX       ((int64_t)(INT64_C(9223372036854775807)))
+# endif
+# ifndef U_UINT64_MAX
+/** The largest value a 64 bit unsigned integer can hold @stable ICU 2.8 */
+#     define U_UINT64_MAX      ((uint64_t)(UINT64_C(18446744073709551615)))
+# endif
+#endif
+
+/*==========================================================================*/
+/* Boolean data type                                                        */
+/*==========================================================================*/
+
+/** The ICU boolean type @stable ICU 2.0 */
+typedef int8_t UBool;
+
+#ifndef TRUE
+/** The TRUE value of a UBool @stable ICU 2.0 */
+#   define TRUE  1
+#endif
+#ifndef FALSE
+/** The FALSE value of a UBool @stable ICU 2.0 */
+#   define FALSE 0
+#endif
+
+
+/*==========================================================================*/
+/* Unicode data types                                                       */
+/*==========================================================================*/
+
+/* wchar_t-related definitions -------------------------------------------- */
+
+/**
+ * \def U_HAVE_WCHAR_H
+ * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.
+ *
+ * @stable ICU 2.0
+ */
+#ifndef U_HAVE_WCHAR_H
+#   define U_HAVE_WCHAR_H 1
+#endif
+
+/**
+ * \def U_SIZEOF_WCHAR_T
+ * U_SIZEOF_WCHAR_T==sizeof(wchar_t) (0 means it is not defined or autoconf could not set it)
+ *
+ * @stable ICU 2.0
+ */
+#if U_SIZEOF_WCHAR_T==0
+#   undef U_SIZEOF_WCHAR_T
+#   define U_SIZEOF_WCHAR_T 4
+#endif
+
+/*
+ * \def U_WCHAR_IS_UTF16
+ * Defined if wchar_t uses UTF-16.
+ *
+ * @stable ICU 2.0
+ */
+/*
+ * \def U_WCHAR_IS_UTF32
+ * Defined if wchar_t uses UTF-32.
+ *
+ * @stable ICU 2.0
+ */
+#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
+#   ifdef __STDC_ISO_10646__
+#       if (U_SIZEOF_WCHAR_T==2)
+#           define U_WCHAR_IS_UTF16
+#       elif (U_SIZEOF_WCHAR_T==4)
+#           define  U_WCHAR_IS_UTF32
+#       endif
+#   elif defined __UCS2__
+#       if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
+#           define U_WCHAR_IS_UTF16
+#       endif
+#   elif defined __UCS4__
+#       if (U_SIZEOF_WCHAR_T==4)
+#           define U_WCHAR_IS_UTF32
+#       endif
+#   elif defined(U_WINDOWS)
+#       define U_WCHAR_IS_UTF16
+#   endif
+#endif
+
+/* UChar and UChar32 definitions -------------------------------------------- */
+
+/** Number of bytes in a UChar. @stable ICU 2.0 */
+#define U_SIZEOF_UCHAR 2
+
+/**
+ * \var UChar
+ * Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
+ * If wchar_t is not 16 bits wide, then define UChar to be uint16_t or char16_t because GCC >=4.4
+ * can handle UTF16 string literals.
+ * This makes the definition of UChar platform-dependent
+ * but allows direct string type compatibility with platforms with
+ * 16-bit wchar_t types.
+ *
+ * @draft ICU 4.4
+ */
+
+/* Define UChar to be compatible with wchar_t if possible. */
+#if U_SIZEOF_WCHAR_T==2
+    typedef wchar_t UChar;
+#elif U_GNUC_UTF16_STRING
+#if defined _GCC_
+    typedef __CHAR16_TYPE__ char16_t;
+#endif
+    typedef char16_t UChar;
+#else
+    typedef uint16_t UChar;
+#endif
+
+/**
+ * Define UChar32 as a type for single Unicode code points.
+ * UChar32 is a signed 32-bit integer (same as int32_t).
+ *
+ * The Unicode code point range is 0..0x10ffff.
+ * All other values (negative or >=0x110000) are illegal as Unicode code points.
+ * They may be used as sentinel values to indicate "done", "error"
+ * or similar non-code point conditions.
+ *
+ * Before ICU 2.4 (Jitterbug 2146), UChar32 was defined
+ * to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned)
+ * or else to be uint32_t.
+ * That is, the definition of UChar32 was platform-dependent.
+ *
+ * @see U_SENTINEL
+ * @stable ICU 2.4
+ */
+typedef int32_t UChar32;
+
+/*==========================================================================*/
+/* U_INLINE and U_ALIGN_CODE   Set default values if these are not already  */
+/*                             defined.  Definitions normally are in        */
+/*                             platform.h or the corresponding file for     */
+/*                             the OS in use.                               */
+/*==========================================================================*/
+
+#ifndef U_HIDE_INTERNAL_API
+
+/**
+ * \def U_ALIGN_CODE
+ * This is used to align code fragments to a specific byte boundary.
+ * This is useful for getting consistent performance test results.
+ * @internal
+ */
+#ifndef U_ALIGN_CODE
+#   define U_ALIGN_CODE(n)
+#endif
+
+#endif /* U_HIDE_INTERNAL_API */
+
+/**
+ * \def U_INLINE
+ * This is used to request inlining of a function, on platforms and languages which support it.
+ */
+ 
+#ifndef U_INLINE
+#   ifdef XP_CPLUSPLUS
+#       define U_INLINE inline
+#   else
+#       define U_INLINE
+#   endif
+#endif
+
+#include "unicode/urename.h"
+
+#endif
diff --git a/Source/WTF/icu/unicode/unistr.h b/Source/WTF/icu/unicode/unistr.h
new file mode 100644
index 0000000..24d0351
--- /dev/null
+++ b/Source/WTF/icu/unicode/unistr.h
@@ -0,0 +1,4440 @@
+/*
+**********************************************************************
+*   Copyright (C) 1998-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+**********************************************************************
+*
+* File unistr.h
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   09/25/98    stephen     Creation.
+*   11/11/98    stephen     Changed per 11/9 code review.
+*   04/20/99    stephen     Overhauled per 4/16 code review.
+*   11/18/99    aliu        Made to inherit from Replaceable.  Added method
+*                           handleReplaceBetween(); other methods unchanged.
+*   06/25/01    grhoten     Remove dependency on iostream.
+******************************************************************************
+*/
+
+#ifndef UNISTR_H
+#define UNISTR_H
+
+/**
+ * \file 
+ * \brief C++ API: Unicode String 
+ */
+
+#include "unicode/utypes.h"
+#include "unicode/rep.h"
+#include "unicode/std_string.h"
+#include "unicode/stringpiece.h"
+#include "unicode/bytestream.h"
+
+struct UConverter;          // unicode/ucnv.h
+class  StringThreadTest;
+
+#ifndef U_COMPARE_CODE_POINT_ORDER
+/* see also ustring.h and unorm.h */
+/**
+ * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
+ * Compare strings in code point order instead of code unit order.
+ * @stable ICU 2.2
+ */
+#define U_COMPARE_CODE_POINT_ORDER  0x8000
+#endif
+
+#ifndef USTRING_H
+/**
+ * \ingroup ustring_ustrlen
+ */
+U_STABLE int32_t U_EXPORT2
+u_strlen(const UChar *s);
+#endif
+
+U_NAMESPACE_BEGIN
+
+class Locale;               // unicode/locid.h
+class StringCharacterIterator;
+class BreakIterator;        // unicode/brkiter.h
+
+/* The <iostream> include has been moved to unicode/ustream.h */
+
+/**
+ * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor
+ * which constructs a Unicode string from an invariant-character char * string.
+ * About invariant characters see utypes.h.
+ * This constructor has no runtime dependency on conversion code and is
+ * therefore recommended over ones taking a charset name string
+ * (where the empty string "" indicates invariant-character conversion).
+ *
+ * @stable ICU 3.2
+ */
+#define US_INV U_NAMESPACE_QUALIFIER UnicodeString::kInvariant
+
+/**
+ * Unicode String literals in C++.
+ * Dependent on the platform properties, different UnicodeString
+ * constructors should be used to create a UnicodeString object from
+ * a string literal.
+ * The macros are defined for maximum performance.
+ * They work only for strings that contain "invariant characters", i.e.,
+ * only latin letters, digits, and some punctuation.
+ * See utypes.h for details.
+ *
+ * The string parameter must be a C string literal.
+ * The length of the string, not including the terminating
+ * <code>NUL</code>, must be specified as a constant.
+ * The U_STRING_DECL macro should be invoked exactly once for one
+ * such string variable before it is used.
+ * @stable ICU 2.0
+ */
+#if defined(U_DECLARE_UTF16)
+#   define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(TRUE, (const UChar *)U_DECLARE_UTF16(cs), _length)
+#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
+#   define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(TRUE, (const UChar *)L ## cs, _length)
+#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
+#   define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(TRUE, (const UChar *)cs, _length)
+#else
+#   define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(cs, _length, US_INV)
+#endif
+
+/**
+ * Unicode String literals in C++.
+ * Dependent on the platform properties, different UnicodeString
+ * constructors should be used to create a UnicodeString object from
+ * a string literal.
+ * The macros are defined for improved performance.
+ * They work only for strings that contain "invariant characters", i.e.,
+ * only latin letters, digits, and some punctuation.
+ * See utypes.h for details.
+ *
+ * The string parameter must be a C string literal.
+ * @stable ICU 2.0
+ */
+#define UNICODE_STRING_SIMPLE(cs) UNICODE_STRING(cs, -1)
+
+/**
+ * UnicodeString is a string class that stores Unicode characters directly and provides
+ * similar functionality as the Java String and StringBuffer classes.
+ * It is a concrete implementation of the abstract class Replaceable (for transliteration).
+ *
+ * The UnicodeString class is not suitable for subclassing.
+ *
+ * <p>For an overview of Unicode strings in C and C++ see the
+ * <a href="http://icu-project.org/userguide/strings.html">User Guide Strings chapter</a>.</p>
+ *
+ * <p>In ICU, a Unicode string consists of 16-bit Unicode <em>code units</em>.
+ * A Unicode character may be stored with either one code unit
+ * (the most common case) or with a matched pair of special code units
+ * ("surrogates"). The data type for code units is UChar. 
+ * For single-character handling, a Unicode character code <em>point</em> is a value
+ * in the range 0..0x10ffff. ICU uses the UChar32 type for code points.</p>
+ *
+ * <p>Indexes and offsets into and lengths of strings always count code units, not code points.
+ * This is the same as with multi-byte char* strings in traditional string handling.
+ * Operations on partial strings typically do not test for code point boundaries.
+ * If necessary, the user needs to take care of such boundaries by testing for the code unit
+ * values or by using functions like
+ * UnicodeString::getChar32Start() and UnicodeString::getChar32Limit()
+ * (or, in C, the equivalent macros U16_SET_CP_START() and U16_SET_CP_LIMIT(), see utf.h).</p>
+ *
+ * UnicodeString methods are more lenient with regard to input parameter values
+ * than other ICU APIs. In particular:
+ * - If indexes are out of bounds for a UnicodeString object
+ *   (<0 or >length()) then they are "pinned" to the nearest boundary.
+ * - If primitive string pointer values (e.g., const UChar * or char *)
+ *   for input strings are NULL, then those input string parameters are treated
+ *   as if they pointed to an empty string.
+ *   However, this is <em>not</em> the case for char * parameters for charset names
+ *   or other IDs.
+ * - Most UnicodeString methods do not take a UErrorCode parameter because
+ *   there are usually very few opportunities for failure other than a shortage
+ *   of memory, error codes in low-level C++ string methods would be inconvenient,
+ *   and the error code as the last parameter (ICU convention) would prevent
+ *   the use of default parameter values.
+ *   Instead, such methods set the UnicodeString into a "bogus" state
+ *   (see isBogus()) if an error occurs.
+ *
+ * In string comparisons, two UnicodeString objects that are both "bogus"
+ * compare equal (to be transitive and prevent endless loops in sorting),
+ * and a "bogus" string compares less than any non-"bogus" one.
+ *
+ * Const UnicodeString methods are thread-safe. Multiple threads can use
+ * const methods on the same UnicodeString object simultaneously,
+ * but non-const methods must not be called concurrently (in multiple threads)
+ * with any other (const or non-const) methods.
+ *
+ * Similarly, const UnicodeString & parameters are thread-safe.
+ * One object may be passed in as such a parameter concurrently in multiple threads.
+ * This includes the const UnicodeString & parameters for
+ * copy construction, assignment, and cloning.
+ *
+ * <p>UnicodeString uses several storage methods.
+ * String contents can be stored inside the UnicodeString object itself,
+ * in an allocated and shared buffer, or in an outside buffer that is "aliased".
+ * Most of this is done transparently, but careful aliasing in particular provides
+ * significant performance improvements.
+ * Also, the internal buffer is accessible via special functions.
+ * For details see the
+ * <a href="http://icu-project.org/userguide/strings.html">User Guide Strings chapter</a>.</p>
+ *
+ * @see utf.h
+ * @see CharacterIterator
+ * @stable ICU 2.0
+ */
+class U_COMMON_API UnicodeString : public Replaceable
+{
+public:
+
+  /**
+   * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor
+   * which constructs a Unicode string from an invariant-character char * string.
+   * Use the macro US_INV instead of the full qualification for this value.
+   *
+   * @see US_INV
+   * @stable ICU 3.2
+   */
+  enum EInvariant {
+    /**
+     * @see EInvariant
+     * @stable ICU 3.2
+     */
+    kInvariant
+  };
+
+  //========================================
+  // Read-only operations
+  //========================================
+
+  /* Comparison - bitwise only - for international comparison use collation */
+
+  /**
+   * Equality operator. Performs only bitwise comparison.
+   * @param text The UnicodeString to compare to this one.
+   * @return TRUE if <TT>text</TT> contains the same characters as this one,
+   * FALSE otherwise.
+   * @stable ICU 2.0
+   */
+  inline UBool operator== (const UnicodeString& text) const;
+
+  /**
+   * Inequality operator. Performs only bitwise comparison.
+   * @param text The UnicodeString to compare to this one.
+   * @return FALSE if <TT>text</TT> contains the same characters as this one,
+   * TRUE otherwise.
+   * @stable ICU 2.0
+   */
+  inline UBool operator!= (const UnicodeString& text) const;
+
+  /**
+   * Greater than operator. Performs only bitwise comparison.
+   * @param text The UnicodeString to compare to this one.
+   * @return TRUE if the characters in this are bitwise
+   * greater than the characters in <code>text</code>, FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool operator> (const UnicodeString& text) const;
+
+  /**
+   * Less than operator. Performs only bitwise comparison.
+   * @param text The UnicodeString to compare to this one.
+   * @return TRUE if the characters in this are bitwise
+   * less than the characters in <code>text</code>, FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool operator< (const UnicodeString& text) const;
+
+  /**
+   * Greater than or equal operator. Performs only bitwise comparison.
+   * @param text The UnicodeString to compare to this one.
+   * @return TRUE if the characters in this are bitwise
+   * greater than or equal to the characters in <code>text</code>, FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool operator>= (const UnicodeString& text) const;
+
+  /**
+   * Less than or equal operator. Performs only bitwise comparison.
+   * @param text The UnicodeString to compare to this one.
+   * @return TRUE if the characters in this are bitwise
+   * less than or equal to the characters in <code>text</code>, FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool operator<= (const UnicodeString& text) const;
+
+  /**
+   * Compare the characters bitwise in this UnicodeString to
+   * the characters in <code>text</code>.
+   * @param text The UnicodeString to compare to this one.
+   * @return The result of bitwise character comparison: 0 if this
+   * contains the same characters as <code>text</code>, -1 if the characters in
+   * this are bitwise less than the characters in <code>text</code>, +1 if the
+   * characters in this are bitwise greater than the characters
+   * in <code>text</code>.
+   * @stable ICU 2.0
+   */
+  inline int8_t compare(const UnicodeString& text) const;
+
+  /**
+   * Compare the characters bitwise in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) with the characters
+   * in <TT>text</TT>
+   * @param start the offset at which the compare operation begins
+   * @param length the number of characters of text to compare.
+   * @param text the other text to be compared against this string.
+   * @return The result of bitwise character comparison: 0 if this
+   * contains the same characters as <code>text</code>, -1 if the characters in
+   * this are bitwise less than the characters in <code>text</code>, +1 if the
+   * characters in this are bitwise greater than the characters
+   * in <code>text</code>.
+   * @stable ICU 2.0
+   */
+  inline int8_t compare(int32_t start,
+         int32_t length,
+         const UnicodeString& text) const;
+
+  /**
+   * Compare the characters bitwise in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) with the characters
+   * in <TT>srcText</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
+   * @param start the offset at which the compare operation begins
+   * @param length the number of characters in this to compare.
+   * @param srcText the text to be compared
+   * @param srcStart the offset into <TT>srcText</TT> to start comparison
+   * @param srcLength the number of characters in <TT>src</TT> to compare
+   * @return The result of bitwise character comparison: 0 if this
+   * contains the same characters as <code>srcText</code>, -1 if the characters in
+   * this are bitwise less than the characters in <code>srcText</code>, +1 if the
+   * characters in this are bitwise greater than the characters
+   * in <code>srcText</code>.
+   * @stable ICU 2.0
+   */
+   inline int8_t compare(int32_t start,
+         int32_t length,
+         const UnicodeString& srcText,
+         int32_t srcStart,
+         int32_t srcLength) const;
+
+  /**
+   * Compare the characters bitwise in this UnicodeString with the first
+   * <TT>srcLength</TT> characters in <TT>srcChars</TT>.
+   * @param srcChars The characters to compare to this UnicodeString.
+   * @param srcLength the number of characters in <TT>srcChars</TT> to compare
+   * @return The result of bitwise character comparison: 0 if this
+   * contains the same characters as <code>srcChars</code>, -1 if the characters in
+   * this are bitwise less than the characters in <code>srcChars</code>, +1 if the
+   * characters in this are bitwise greater than the characters
+   * in <code>srcChars</code>.
+   * @stable ICU 2.0
+   */
+  inline int8_t compare(const UChar *srcChars,
+         int32_t srcLength) const;
+
+  /**
+   * Compare the characters bitwise in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) with the first
+   * <TT>length</TT> characters in <TT>srcChars</TT>
+   * @param start the offset at which the compare operation begins
+   * @param length the number of characters to compare.
+   * @param srcChars the characters to be compared
+   * @return The result of bitwise character comparison: 0 if this
+   * contains the same characters as <code>srcChars</code>, -1 if the characters in
+   * this are bitwise less than the characters in <code>srcChars</code>, +1 if the
+   * characters in this are bitwise greater than the characters
+   * in <code>srcChars</code>.
+   * @stable ICU 2.0
+   */
+  inline int8_t compare(int32_t start,
+         int32_t length,
+         const UChar *srcChars) const;
+
+  /**
+   * Compare the characters bitwise in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) with the characters
+   * in <TT>srcChars</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
+   * @param start the offset at which the compare operation begins
+   * @param length the number of characters in this to compare
+   * @param srcChars the characters to be compared
+   * @param srcStart the offset into <TT>srcChars</TT> to start comparison
+   * @param srcLength the number of characters in <TT>srcChars</TT> to compare
+   * @return The result of bitwise character comparison: 0 if this
+   * contains the same characters as <code>srcChars</code>, -1 if the characters in
+   * this are bitwise less than the characters in <code>srcChars</code>, +1 if the
+   * characters in this are bitwise greater than the characters
+   * in <code>srcChars</code>.
+   * @stable ICU 2.0
+   */
+  inline int8_t compare(int32_t start,
+         int32_t length,
+         const UChar *srcChars,
+         int32_t srcStart,
+         int32_t srcLength) const;
+
+  /**
+   * Compare the characters bitwise in the range
+   * [<TT>start</TT>, <TT>limit</TT>) with the characters
+   * in <TT>srcText</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcLimit</TT>).
+   * @param start the offset at which the compare operation begins
+   * @param limit the offset immediately following the compare operation
+   * @param srcText the text to be compared
+   * @param srcStart the offset into <TT>srcText</TT> to start comparison
+   * @param srcLimit the offset into <TT>srcText</TT> to limit comparison
+   * @return The result of bitwise character comparison: 0 if this
+   * contains the same characters as <code>srcText</code>, -1 if the characters in
+   * this are bitwise less than the characters in <code>srcText</code>, +1 if the
+   * characters in this are bitwise greater than the characters
+   * in <code>srcText</code>.
+   * @stable ICU 2.0
+   */
+  inline int8_t compareBetween(int32_t start,
+            int32_t limit,
+            const UnicodeString& srcText,
+            int32_t srcStart,
+            int32_t srcLimit) const;
+
+  /**
+   * Compare two Unicode strings in code point order.
+   * The result may be different from the results of compare(), operator<, etc.
+   * if supplementary characters are present:
+   *
+   * In UTF-16, supplementary characters (with code points U+10000 and above) are
+   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
+   * which means that they compare as less than some other BMP characters like U+feff.
+   * This function compares Unicode strings in code point order.
+   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
+   *
+   * @param text Another string to compare this one to.
+   * @return a negative/zero/positive integer corresponding to whether
+   * this string is less than/equal to/greater than the second one
+   * in code point order
+   * @stable ICU 2.0
+   */
+  inline int8_t compareCodePointOrder(const UnicodeString& text) const;
+
+  /**
+   * Compare two Unicode strings in code point order.
+   * The result may be different from the results of compare(), operator<, etc.
+   * if supplementary characters are present:
+   *
+   * In UTF-16, supplementary characters (with code points U+10000 and above) are
+   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
+   * which means that they compare as less than some other BMP characters like U+feff.
+   * This function compares Unicode strings in code point order.
+   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
+   *
+   * @param start The start offset in this string at which the compare operation begins.
+   * @param length The number of code units from this string to compare.
+   * @param srcText Another string to compare this one to.
+   * @return a negative/zero/positive integer corresponding to whether
+   * this string is less than/equal to/greater than the second one
+   * in code point order
+   * @stable ICU 2.0
+   */
+  inline int8_t compareCodePointOrder(int32_t start,
+                                      int32_t length,
+                                      const UnicodeString& srcText) const;
+
+  /**
+   * Compare two Unicode strings in code point order.
+   * The result may be different from the results of compare(), operator<, etc.
+   * if supplementary characters are present:
+   *
+   * In UTF-16, supplementary characters (with code points U+10000 and above) are
+   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
+   * which means that they compare as less than some other BMP characters like U+feff.
+   * This function compares Unicode strings in code point order.
+   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
+   *
+   * @param start The start offset in this string at which the compare operation begins.
+   * @param length The number of code units from this string to compare.
+   * @param srcText Another string to compare this one to.
+   * @param srcStart The start offset in that string at which the compare operation begins.
+   * @param srcLength The number of code units from that string to compare.
+   * @return a negative/zero/positive integer corresponding to whether
+   * this string is less than/equal to/greater than the second one
+   * in code point order
+   * @stable ICU 2.0
+   */
+   inline int8_t compareCodePointOrder(int32_t start,
+                                       int32_t length,
+                                       const UnicodeString& srcText,
+                                       int32_t srcStart,
+                                       int32_t srcLength) const;
+
+  /**
+   * Compare two Unicode strings in code point order.
+   * The result may be different from the results of compare(), operator<, etc.
+   * if supplementary characters are present:
+   *
+   * In UTF-16, supplementary characters (with code points U+10000 and above) are
+   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
+   * which means that they compare as less than some other BMP characters like U+feff.
+   * This function compares Unicode strings in code point order.
+   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
+   *
+   * @param srcChars A pointer to another string to compare this one to.
+   * @param srcLength The number of code units from that string to compare.
+   * @return a negative/zero/positive integer corresponding to whether
+   * this string is less than/equal to/greater than the second one
+   * in code point order
+   * @stable ICU 2.0
+   */
+  inline int8_t compareCodePointOrder(const UChar *srcChars,
+                                      int32_t srcLength) const;
+
+  /**
+   * Compare two Unicode strings in code point order.
+   * The result may be different from the results of compare(), operator<, etc.
+   * if supplementary characters are present:
+   *
+   * In UTF-16, supplementary characters (with code points U+10000 and above) are
+   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
+   * which means that they compare as less than some other BMP characters like U+feff.
+   * This function compares Unicode strings in code point order.
+   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
+   *
+   * @param start The start offset in this string at which the compare operation begins.
+   * @param length The number of code units from this string to compare.
+   * @param srcChars A pointer to another string to compare this one to.
+   * @return a negative/zero/positive integer corresponding to whether
+   * this string is less than/equal to/greater than the second one
+   * in code point order
+   * @stable ICU 2.0
+   */
+  inline int8_t compareCodePointOrder(int32_t start,
+                                      int32_t length,
+                                      const UChar *srcChars) const;
+
+  /**
+   * Compare two Unicode strings in code point order.
+   * The result may be different from the results of compare(), operator<, etc.
+   * if supplementary characters are present:
+   *
+   * In UTF-16, supplementary characters (with code points U+10000 and above) are
+   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
+   * which means that they compare as less than some other BMP characters like U+feff.
+   * This function compares Unicode strings in code point order.
+   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
+   *
+   * @param start The start offset in this string at which the compare operation begins.
+   * @param length The number of code units from this string to compare.
+   * @param srcChars A pointer to another string to compare this one to.
+   * @param srcStart The start offset in that string at which the compare operation begins.
+   * @param srcLength The number of code units from that string to compare.
+   * @return a negative/zero/positive integer corresponding to whether
+   * this string is less than/equal to/greater than the second one
+   * in code point order
+   * @stable ICU 2.0
+   */
+  inline int8_t compareCodePointOrder(int32_t start,
+                                      int32_t length,
+                                      const UChar *srcChars,
+                                      int32_t srcStart,
+                                      int32_t srcLength) const;
+
+  /**
+   * Compare two Unicode strings in code point order.
+   * The result may be different from the results of compare(), operator<, etc.
+   * if supplementary characters are present:
+   *
+   * In UTF-16, supplementary characters (with code points U+10000 and above) are
+   * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff,
+   * which means that they compare as less than some other BMP characters like U+feff.
+   * This function compares Unicode strings in code point order.
+   * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined.
+   *
+   * @param start The start offset in this string at which the compare operation begins.
+   * @param limit The offset after the last code unit from this string to compare.
+   * @param srcText Another string to compare this one to.
+   * @param srcStart The start offset in that string at which the compare operation begins.
+   * @param srcLimit The offset after the last code unit from that string to compare.
+   * @return a negative/zero/positive integer corresponding to whether
+   * this string is less than/equal to/greater than the second one
+   * in code point order
+   * @stable ICU 2.0
+   */
+  inline int8_t compareCodePointOrderBetween(int32_t start,
+                                             int32_t limit,
+                                             const UnicodeString& srcText,
+                                             int32_t srcStart,
+                                             int32_t srcLimit) const;
+
+  /**
+   * Compare two strings case-insensitively using full case folding.
+   * This is equivalent to this->foldCase(options).compare(text.foldCase(options)).
+   *
+   * @param text Another string to compare this one to.
+   * @param options A bit set of options:
+   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+   *     Comparison in code unit order with default case folding.
+   *
+   *   - U_COMPARE_CODE_POINT_ORDER
+   *     Set to choose code point order instead of code unit order
+   *     (see u_strCompare for details).
+   *
+   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+   *
+   * @return A negative, zero, or positive integer indicating the comparison result.
+   * @stable ICU 2.0
+   */
+  inline int8_t caseCompare(const UnicodeString& text, uint32_t options) const;
+
+  /**
+   * Compare two strings case-insensitively using full case folding.
+   * This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)).
+   *
+   * @param start The start offset in this string at which the compare operation begins.
+   * @param length The number of code units from this string to compare.
+   * @param srcText Another string to compare this one to.
+   * @param options A bit set of options:
+   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+   *     Comparison in code unit order with default case folding.
+   *
+   *   - U_COMPARE_CODE_POINT_ORDER
+   *     Set to choose code point order instead of code unit order
+   *     (see u_strCompare for details).
+   *
+   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+   *
+   * @return A negative, zero, or positive integer indicating the comparison result.
+   * @stable ICU 2.0
+   */
+  inline int8_t caseCompare(int32_t start,
+         int32_t length,
+         const UnicodeString& srcText,
+         uint32_t options) const;
+
+  /**
+   * Compare two strings case-insensitively using full case folding.
+   * This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)).
+   *
+   * @param start The start offset in this string at which the compare operation begins.
+   * @param length The number of code units from this string to compare.
+   * @param srcText Another string to compare this one to.
+   * @param srcStart The start offset in that string at which the compare operation begins.
+   * @param srcLength The number of code units from that string to compare.
+   * @param options A bit set of options:
+   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+   *     Comparison in code unit order with default case folding.
+   *
+   *   - U_COMPARE_CODE_POINT_ORDER
+   *     Set to choose code point order instead of code unit order
+   *     (see u_strCompare for details).
+   *
+   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+   *
+   * @return A negative, zero, or positive integer indicating the comparison result.
+   * @stable ICU 2.0
+   */
+  inline int8_t caseCompare(int32_t start,
+         int32_t length,
+         const UnicodeString& srcText,
+         int32_t srcStart,
+         int32_t srcLength,
+         uint32_t options) const;
+
+  /**
+   * Compare two strings case-insensitively using full case folding.
+   * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)).
+   *
+   * @param srcChars A pointer to another string to compare this one to.
+   * @param srcLength The number of code units from that string to compare.
+   * @param options A bit set of options:
+   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+   *     Comparison in code unit order with default case folding.
+   *
+   *   - U_COMPARE_CODE_POINT_ORDER
+   *     Set to choose code point order instead of code unit order
+   *     (see u_strCompare for details).
+   *
+   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+   *
+   * @return A negative, zero, or positive integer indicating the comparison result.
+   * @stable ICU 2.0
+   */
+  inline int8_t caseCompare(const UChar *srcChars,
+         int32_t srcLength,
+         uint32_t options) const;
+
+  /**
+   * Compare two strings case-insensitively using full case folding.
+   * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)).
+   *
+   * @param start The start offset in this string at which the compare operation begins.
+   * @param length The number of code units from this string to compare.
+   * @param srcChars A pointer to another string to compare this one to.
+   * @param options A bit set of options:
+   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+   *     Comparison in code unit order with default case folding.
+   *
+   *   - U_COMPARE_CODE_POINT_ORDER
+   *     Set to choose code point order instead of code unit order
+   *     (see u_strCompare for details).
+   *
+   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+   *
+   * @return A negative, zero, or positive integer indicating the comparison result.
+   * @stable ICU 2.0
+   */
+  inline int8_t caseCompare(int32_t start,
+         int32_t length,
+         const UChar *srcChars,
+         uint32_t options) const;
+
+  /**
+   * Compare two strings case-insensitively using full case folding.
+   * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)).
+   *
+   * @param start The start offset in this string at which the compare operation begins.
+   * @param length The number of code units from this string to compare.
+   * @param srcChars A pointer to another string to compare this one to.
+   * @param srcStart The start offset in that string at which the compare operation begins.
+   * @param srcLength The number of code units from that string to compare.
+   * @param options A bit set of options:
+   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+   *     Comparison in code unit order with default case folding.
+   *
+   *   - U_COMPARE_CODE_POINT_ORDER
+   *     Set to choose code point order instead of code unit order
+   *     (see u_strCompare for details).
+   *
+   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+   *
+   * @return A negative, zero, or positive integer indicating the comparison result.
+   * @stable ICU 2.0
+   */
+  inline int8_t caseCompare(int32_t start,
+         int32_t length,
+         const UChar *srcChars,
+         int32_t srcStart,
+         int32_t srcLength,
+         uint32_t options) const;
+
+  /**
+   * Compare two strings case-insensitively using full case folding.
+   * This is equivalent to this->foldCase(options).compareBetween(text.foldCase(options)).
+   *
+   * @param start The start offset in this string at which the compare operation begins.
+   * @param limit The offset after the last code unit from this string to compare.
+   * @param srcText Another string to compare this one to.
+   * @param srcStart The start offset in that string at which the compare operation begins.
+   * @param srcLimit The offset after the last code unit from that string to compare.
+   * @param options A bit set of options:
+   *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+   *     Comparison in code unit order with default case folding.
+   *
+   *   - U_COMPARE_CODE_POINT_ORDER
+   *     Set to choose code point order instead of code unit order
+   *     (see u_strCompare for details).
+   *
+   *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+   *
+   * @return A negative, zero, or positive integer indicating the comparison result.
+   * @stable ICU 2.0
+   */
+  inline int8_t caseCompareBetween(int32_t start,
+            int32_t limit,
+            const UnicodeString& srcText,
+            int32_t srcStart,
+            int32_t srcLimit,
+            uint32_t options) const;
+
+  /**
+   * Determine if this starts with the characters in <TT>text</TT>
+   * @param text The text to match.
+   * @return TRUE if this starts with the characters in <TT>text</TT>,
+   * FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool startsWith(const UnicodeString& text) const;
+
+  /**
+   * Determine if this starts with the characters in <TT>srcText</TT>
+   * in the range [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
+   * @param srcText The text to match.
+   * @param srcStart the offset into <TT>srcText</TT> to start matching
+   * @param srcLength the number of characters in <TT>srcText</TT> to match
+   * @return TRUE if this starts with the characters in <TT>text</TT>,
+   * FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool startsWith(const UnicodeString& srcText,
+            int32_t srcStart,
+            int32_t srcLength) const;
+
+  /**
+   * Determine if this starts with the characters in <TT>srcChars</TT>
+   * @param srcChars The characters to match.
+   * @param srcLength the number of characters in <TT>srcChars</TT>
+   * @return TRUE if this starts with the characters in <TT>srcChars</TT>,
+   * FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool startsWith(const UChar *srcChars,
+            int32_t srcLength) const;
+
+  /**
+   * Determine if this ends with the characters in <TT>srcChars</TT>
+   * in the range  [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
+   * @param srcChars The characters to match.
+   * @param srcStart the offset into <TT>srcText</TT> to start matching
+   * @param srcLength the number of characters in <TT>srcChars</TT> to match
+   * @return TRUE if this ends with the characters in <TT>srcChars</TT>, FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool startsWith(const UChar *srcChars,
+            int32_t srcStart,
+            int32_t srcLength) const;
+
+  /**
+   * Determine if this ends with the characters in <TT>text</TT>
+   * @param text The text to match.
+   * @return TRUE if this ends with the characters in <TT>text</TT>,
+   * FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool endsWith(const UnicodeString& text) const;
+
+  /**
+   * Determine if this ends with the characters in <TT>srcText</TT>
+   * in the range [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
+   * @param srcText The text to match.
+   * @param srcStart the offset into <TT>srcText</TT> to start matching
+   * @param srcLength the number of characters in <TT>srcText</TT> to match
+   * @return TRUE if this ends with the characters in <TT>text</TT>,
+   * FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool endsWith(const UnicodeString& srcText,
+          int32_t srcStart,
+          int32_t srcLength) const;
+
+  /**
+   * Determine if this ends with the characters in <TT>srcChars</TT>
+   * @param srcChars The characters to match.
+   * @param srcLength the number of characters in <TT>srcChars</TT>
+   * @return TRUE if this ends with the characters in <TT>srcChars</TT>,
+   * FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool endsWith(const UChar *srcChars,
+          int32_t srcLength) const;
+
+  /**
+   * Determine if this ends with the characters in <TT>srcChars</TT>
+   * in the range  [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
+   * @param srcChars The characters to match.
+   * @param srcStart the offset into <TT>srcText</TT> to start matching
+   * @param srcLength the number of characters in <TT>srcChars</TT> to match
+   * @return TRUE if this ends with the characters in <TT>srcChars</TT>,
+   * FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool endsWith(const UChar *srcChars,
+          int32_t srcStart,
+          int32_t srcLength) const;
+
+
+  /* Searching - bitwise only */
+
+  /**
+   * Locate in this the first occurrence of the characters in <TT>text</TT>,
+   * using bitwise comparison.
+   * @param text The text to search for.
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(const UnicodeString& text) const;
+
+  /**
+   * Locate in this the first occurrence of the characters in <TT>text</TT>
+   * starting at offset <TT>start</TT>, using bitwise comparison.
+   * @param text The text to search for.
+   * @param start The offset at which searching will start.
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(const UnicodeString& text,
+              int32_t start) const;
+
+  /**
+   * Locate in this the first occurrence in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
+   * in <TT>text</TT>, using bitwise comparison.
+   * @param text The text to search for.
+   * @param start The offset at which searching will start.
+   * @param length The number of characters to search
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(const UnicodeString& text,
+              int32_t start,
+              int32_t length) const;
+
+  /**
+   * Locate in this the first occurrence in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
+   *  in <TT>srcText</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>),
+   * using bitwise comparison.
+   * @param srcText The text to search for.
+   * @param srcStart the offset into <TT>srcText</TT> at which
+   * to start matching
+   * @param srcLength the number of characters in <TT>srcText</TT> to match
+   * @param start the offset into this at which to start matching
+   * @param length the number of characters in this to search
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(const UnicodeString& srcText,
+              int32_t srcStart,
+              int32_t srcLength,
+              int32_t start,
+              int32_t length) const;
+
+  /**
+   * Locate in this the first occurrence of the characters in
+   * <TT>srcChars</TT>
+   * starting at offset <TT>start</TT>, using bitwise comparison.
+   * @param srcChars The text to search for.
+   * @param srcLength the number of characters in <TT>srcChars</TT> to match
+   * @param start the offset into this at which to start matching
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(const UChar *srcChars,
+              int32_t srcLength,
+              int32_t start) const;
+
+  /**
+   * Locate in this the first occurrence in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
+   * in <TT>srcChars</TT>, using bitwise comparison.
+   * @param srcChars The text to search for.
+   * @param srcLength the number of characters in <TT>srcChars</TT>
+   * @param start The offset at which searching will start.
+   * @param length The number of characters to search
+   * @return The offset into this of the start of <TT>srcChars</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(const UChar *srcChars,
+              int32_t srcLength,
+              int32_t start,
+              int32_t length) const;
+
+  /**
+   * Locate in this the first occurrence in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
+   * in <TT>srcChars</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>),
+   * using bitwise comparison.
+   * @param srcChars The text to search for.
+   * @param srcStart the offset into <TT>srcChars</TT> at which
+   * to start matching
+   * @param srcLength the number of characters in <TT>srcChars</TT> to match
+   * @param start the offset into this at which to start matching
+   * @param length the number of characters in this to search
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  int32_t indexOf(const UChar *srcChars,
+              int32_t srcStart,
+              int32_t srcLength,
+              int32_t start,
+              int32_t length) const;
+
+  /**
+   * Locate in this the first occurrence of the BMP code point <code>c</code>,
+   * using bitwise comparison.
+   * @param c The code unit to search for.
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(UChar c) const;
+
+  /**
+   * Locate in this the first occurrence of the code point <TT>c</TT>,
+   * using bitwise comparison.
+   *
+   * @param c The code point to search for.
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(UChar32 c) const;
+
+  /**
+   * Locate in this the first occurrence of the BMP code point <code>c</code>,
+   * starting at offset <TT>start</TT>, using bitwise comparison.
+   * @param c The code unit to search for.
+   * @param start The offset at which searching will start.
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(UChar c,
+              int32_t start) const;
+
+  /**
+   * Locate in this the first occurrence of the code point <TT>c</TT>
+   * starting at offset <TT>start</TT>, using bitwise comparison.
+   *
+   * @param c The code point to search for.
+   * @param start The offset at which searching will start.
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(UChar32 c,
+              int32_t start) const;
+
+  /**
+   * Locate in this the first occurrence of the BMP code point <code>c</code>
+   * in the range [<TT>start</TT>, <TT>start + length</TT>),
+   * using bitwise comparison.
+   * @param c The code unit to search for.
+   * @param start the offset into this at which to start matching
+   * @param length the number of characters in this to search
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(UChar c,
+              int32_t start,
+              int32_t length) const;
+
+  /**
+   * Locate in this the first occurrence of the code point <TT>c</TT>
+   * in the range [<TT>start</TT>, <TT>start + length</TT>),
+   * using bitwise comparison.
+   *
+   * @param c The code point to search for.
+   * @param start the offset into this at which to start matching
+   * @param length the number of characters in this to search
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t indexOf(UChar32 c,
+              int32_t start,
+              int32_t length) const;
+
+  /**
+   * Locate in this the last occurrence of the characters in <TT>text</TT>,
+   * using bitwise comparison.
+   * @param text The text to search for.
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(const UnicodeString& text) const;
+
+  /**
+   * Locate in this the last occurrence of the characters in <TT>text</TT>
+   * starting at offset <TT>start</TT>, using bitwise comparison.
+   * @param text The text to search for.
+   * @param start The offset at which searching will start.
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(const UnicodeString& text,
+              int32_t start) const;
+
+  /**
+   * Locate in this the last occurrence in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
+   * in <TT>text</TT>, using bitwise comparison.
+   * @param text The text to search for.
+   * @param start The offset at which searching will start.
+   * @param length The number of characters to search
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(const UnicodeString& text,
+              int32_t start,
+              int32_t length) const;
+
+  /**
+   * Locate in this the last occurrence in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
+   * in <TT>srcText</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>),
+   * using bitwise comparison.
+   * @param srcText The text to search for.
+   * @param srcStart the offset into <TT>srcText</TT> at which
+   * to start matching
+   * @param srcLength the number of characters in <TT>srcText</TT> to match
+   * @param start the offset into this at which to start matching
+   * @param length the number of characters in this to search
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(const UnicodeString& srcText,
+              int32_t srcStart,
+              int32_t srcLength,
+              int32_t start,
+              int32_t length) const;
+
+  /**
+   * Locate in this the last occurrence of the characters in <TT>srcChars</TT>
+   * starting at offset <TT>start</TT>, using bitwise comparison.
+   * @param srcChars The text to search for.
+   * @param srcLength the number of characters in <TT>srcChars</TT> to match
+   * @param start the offset into this at which to start matching
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(const UChar *srcChars,
+              int32_t srcLength,
+              int32_t start) const;
+
+  /**
+   * Locate in this the last occurrence in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
+   * in <TT>srcChars</TT>, using bitwise comparison.
+   * @param srcChars The text to search for.
+   * @param srcLength the number of characters in <TT>srcChars</TT>
+   * @param start The offset at which searching will start.
+   * @param length The number of characters to search
+   * @return The offset into this of the start of <TT>srcChars</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(const UChar *srcChars,
+              int32_t srcLength,
+              int32_t start,
+              int32_t length) const;
+
+  /**
+   * Locate in this the last occurrence in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) of the characters
+   * in <TT>srcChars</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>),
+   * using bitwise comparison.
+   * @param srcChars The text to search for.
+   * @param srcStart the offset into <TT>srcChars</TT> at which
+   * to start matching
+   * @param srcLength the number of characters in <TT>srcChars</TT> to match
+   * @param start the offset into this at which to start matching
+   * @param length the number of characters in this to search
+   * @return The offset into this of the start of <TT>text</TT>,
+   * or -1 if not found.
+   * @stable ICU 2.0
+   */
+  int32_t lastIndexOf(const UChar *srcChars,
+              int32_t srcStart,
+              int32_t srcLength,
+              int32_t start,
+              int32_t length) const;
+
+  /**
+   * Locate in this the last occurrence of the BMP code point <code>c</code>,
+   * using bitwise comparison.
+   * @param c The code unit to search for.
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(UChar c) const;
+
+  /**
+   * Locate in this the last occurrence of the code point <TT>c</TT>,
+   * using bitwise comparison.
+   *
+   * @param c The code point to search for.
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(UChar32 c) const;
+
+  /**
+   * Locate in this the last occurrence of the BMP code point <code>c</code>
+   * starting at offset <TT>start</TT>, using bitwise comparison.
+   * @param c The code unit to search for.
+   * @param start The offset at which searching will start.
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(UChar c,
+              int32_t start) const;
+
+  /**
+   * Locate in this the last occurrence of the code point <TT>c</TT>
+   * starting at offset <TT>start</TT>, using bitwise comparison.
+   *
+   * @param c The code point to search for.
+   * @param start The offset at which searching will start.
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(UChar32 c,
+              int32_t start) const;
+
+  /**
+   * Locate in this the last occurrence of the BMP code point <code>c</code>
+   * in the range [<TT>start</TT>, <TT>start + length</TT>),
+   * using bitwise comparison.
+   * @param c The code unit to search for.
+   * @param start the offset into this at which to start matching
+   * @param length the number of characters in this to search
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(UChar c,
+              int32_t start,
+              int32_t length) const;
+
+  /**
+   * Locate in this the last occurrence of the code point <TT>c</TT>
+   * in the range [<TT>start</TT>, <TT>start + length</TT>),
+   * using bitwise comparison.
+   *
+   * @param c The code point to search for.
+   * @param start the offset into this at which to start matching
+   * @param length the number of characters in this to search
+   * @return The offset into this of <TT>c</TT>, or -1 if not found.
+   * @stable ICU 2.0
+   */
+  inline int32_t lastIndexOf(UChar32 c,
+              int32_t start,
+              int32_t length) const;
+
+
+  /* Character access */
+
+  /**
+   * Return the code unit at offset <tt>offset</tt>.
+   * If the offset is not valid (0..length()-1) then U+ffff is returned.
+   * @param offset a valid offset into the text
+   * @return the code unit at offset <tt>offset</tt>
+   *         or 0xffff if the offset is not valid for this string
+   * @stable ICU 2.0
+   */
+  inline UChar charAt(int32_t offset) const;
+
+  /**
+   * Return the code unit at offset <tt>offset</tt>.
+   * If the offset is not valid (0..length()-1) then U+ffff is returned.
+   * @param offset a valid offset into the text
+   * @return the code unit at offset <tt>offset</tt>
+   * @stable ICU 2.0
+   */
+  inline UChar operator[] (int32_t offset) const;
+
+  /**
+   * Return the code point that contains the code unit
+   * at offset <tt>offset</tt>.
+   * If the offset is not valid (0..length()-1) then U+ffff is returned.
+   * @param offset a valid offset into the text
+   * that indicates the text offset of any of the code units
+   * that will be assembled into a code point (21-bit value) and returned
+   * @return the code point of text at <tt>offset</tt>
+   *         or 0xffff if the offset is not valid for this string
+   * @stable ICU 2.0
+   */
+  inline UChar32 char32At(int32_t offset) const;
+
+  /**
+   * Adjust a random-access offset so that
+   * it points to the beginning of a Unicode character.
+   * The offset that is passed in points to
+   * any code unit of a code point,
+   * while the returned offset will point to the first code unit
+   * of the same code point.
+   * In UTF-16, if the input offset points to a second surrogate
+   * of a surrogate pair, then the returned offset will point
+   * to the first surrogate.
+   * @param offset a valid offset into one code point of the text
+   * @return offset of the first code unit of the same code point
+   * @see U16_SET_CP_START
+   * @stable ICU 2.0
+   */
+  inline int32_t getChar32Start(int32_t offset) const;
+
+  /**
+   * Adjust a random-access offset so that
+   * it points behind a Unicode character.
+   * The offset that is passed in points behind
+   * any code unit of a code point,
+   * while the returned offset will point behind the last code unit
+   * of the same code point.
+   * In UTF-16, if the input offset points behind the first surrogate
+   * (i.e., to the second surrogate)
+   * of a surrogate pair, then the returned offset will point
+   * behind the second surrogate (i.e., to the first surrogate).
+   * @param offset a valid offset after any code unit of a code point of the text
+   * @return offset of the first code unit after the same code point
+   * @see U16_SET_CP_LIMIT
+   * @stable ICU 2.0
+   */
+  inline int32_t getChar32Limit(int32_t offset) const;
+
+  /**
+   * Move the code unit index along the string by delta code points.
+   * Interpret the input index as a code unit-based offset into the string,
+   * move the index forward or backward by delta code points, and
+   * return the resulting index.
+   * The input index should point to the first code unit of a code point,
+   * if there is more than one.
+   *
+   * Both input and output indexes are code unit-based as for all
+   * string indexes/offsets in ICU (and other libraries, like MBCS char*).
+   * If delta<0 then the index is moved backward (toward the start of the string).
+   * If delta>0 then the index is moved forward (toward the end of the string).
+   *
+   * This behaves like CharacterIterator::move32(delta, kCurrent).
+   *
+   * Behavior for out-of-bounds indexes:
+   * <code>moveIndex32</code> pins the input index to 0..length(), i.e.,
+   * if the input index<0 then it is pinned to 0;
+   * if it is index>length() then it is pinned to length().
+   * Afterwards, the index is moved by <code>delta</code> code points
+   * forward or backward,
+   * but no further backward than to 0 and no further forward than to length().
+   * The resulting index return value will be in between 0 and length(), inclusively.
+   *
+   * Examples:
+   * <pre>
+   * // s has code points 'a' U+10000 'b' U+10ffff U+2029
+   * UnicodeString s=UNICODE_STRING("a\\U00010000b\\U0010ffff\\u2029", 31).unescape();
+   *
+   * // initial index: position of U+10000
+   * int32_t index=1;
+   *
+   * // the following examples will all result in index==4, position of U+10ffff
+   *
+   * // skip 2 code points from some position in the string
+   * index=s.moveIndex32(index, 2); // skips U+10000 and 'b'
+   *
+   * // go to the 3rd code point from the start of s (0-based)
+   * index=s.moveIndex32(0, 3); // skips 'a', U+10000, and 'b'
+   *
+   * // go to the next-to-last code point of s
+   * index=s.moveIndex32(s.length(), -2); // backward-skips U+2029 and U+10ffff
+   * </pre>
+   *
+   * @param index input code unit index
+   * @param delta (signed) code point count to move the index forward or backward
+   *        in the string
+   * @return the resulting code unit index
+   * @stable ICU 2.0
+   */
+  int32_t moveIndex32(int32_t index, int32_t delta) const;
+
+  /* Substring extraction */
+
+  /**
+   * Copy the characters in the range
+   * [<tt>start</tt>, <tt>start + length</tt>) into the array <tt>dst</tt>,
+   * beginning at <tt>dstStart</tt>.
+   * If the string aliases to <code>dst</code> itself as an external buffer,
+   * then extract() will not copy the contents.
+   *
+   * @param start offset of first character which will be copied into the array
+   * @param length the number of characters to extract
+   * @param dst array in which to copy characters.  The length of <tt>dst</tt>
+   * must be at least (<tt>dstStart + length</tt>).
+   * @param dstStart the offset in <TT>dst</TT> where the first character
+   * will be extracted
+   * @stable ICU 2.0
+   */
+  inline void extract(int32_t start,
+           int32_t length,
+           UChar *dst,
+           int32_t dstStart = 0) const;
+
+  /**
+   * Copy the contents of the string into dest.
+   * This is a convenience function that
+   * checks if there is enough space in dest,
+   * extracts the entire string if possible,
+   * and NUL-terminates dest if possible.
+   *
+   * If the string fits into dest but cannot be NUL-terminated
+   * (length()==destCapacity) then the error code is set to U_STRING_NOT_TERMINATED_WARNING.
+   * If the string itself does not fit into dest
+   * (length()>destCapacity) then the error code is set to U_BUFFER_OVERFLOW_ERROR.
+   *
+   * If the string aliases to <code>dest</code> itself as an external buffer,
+   * then extract() will not copy the contents.
+   *
+   * @param dest Destination string buffer.
+   * @param destCapacity Number of UChars available at dest.
+   * @param errorCode ICU error code.
+   * @return length()
+   * @stable ICU 2.0
+   */
+  int32_t
+  extract(UChar *dest, int32_t destCapacity,
+          UErrorCode &errorCode) const;
+
+  /**
+   * Copy the characters in the range
+   * [<tt>start</tt>, <tt>start + length</tt>) into the  UnicodeString
+   * <tt>target</tt>.
+   * @param start offset of first character which will be copied
+   * @param length the number of characters to extract
+   * @param target UnicodeString into which to copy characters.
+   * @return A reference to <TT>target</TT>
+   * @stable ICU 2.0
+   */
+  inline void extract(int32_t start,
+           int32_t length,
+           UnicodeString& target) const;
+
+  /**
+   * Copy the characters in the range [<tt>start</tt>, <tt>limit</tt>)
+   * into the array <tt>dst</tt>, beginning at <tt>dstStart</tt>.
+   * @param start offset of first character which will be copied into the array
+   * @param limit offset immediately following the last character to be copied
+   * @param dst array in which to copy characters.  The length of <tt>dst</tt>
+   * must be at least (<tt>dstStart + (limit - start)</tt>).
+   * @param dstStart the offset in <TT>dst</TT> where the first character
+   * will be extracted
+   * @stable ICU 2.0
+   */
+  inline void extractBetween(int32_t start,
+              int32_t limit,
+              UChar *dst,
+              int32_t dstStart = 0) const;
+
+  /**
+   * Copy the characters in the range [<tt>start</tt>, <tt>limit</tt>)
+   * into the UnicodeString <tt>target</tt>.  Replaceable API.
+   * @param start offset of first character which will be copied
+   * @param limit offset immediately following the last character to be copied
+   * @param target UnicodeString into which to copy characters.
+   * @return A reference to <TT>target</TT>
+   * @stable ICU 2.0
+   */
+  virtual void extractBetween(int32_t start,
+              int32_t limit,
+              UnicodeString& target) const;
+
+  /**
+   * Copy the characters in the range 
+   * [<tt>start</TT>, <tt>start + length</TT>) into an array of characters.
+   * All characters must be invariant (see utypes.h).
+   * Use US_INV as the last, signature-distinguishing parameter.
+   *
+   * This function does not write any more than <code>targetLength</code>
+   * characters but returns the length of the entire output string
+   * so that one can allocate a larger buffer and call the function again
+   * if necessary.
+   * The output string is NUL-terminated if possible.
+   *
+   * @param start offset of first character which will be copied
+   * @param startLength the number of characters to extract
+   * @param target the target buffer for extraction, can be NULL
+   *               if targetLength is 0
+   * @param targetCapacity the length of the target buffer
+   * @param inv Signature-distinguishing paramater, use US_INV.
+   * @return the output string length, not including the terminating NUL
+   * @stable ICU 3.2
+   */
+  int32_t extract(int32_t start,
+           int32_t startLength,
+           char *target,
+           int32_t targetCapacity,
+           enum EInvariant inv) const;
+
+#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
+
+  /**
+   * Copy the characters in the range
+   * [<tt>start</TT>, <tt>start + length</TT>) into an array of characters
+   * in the platform's default codepage.
+   * This function does not write any more than <code>targetLength</code>
+   * characters but returns the length of the entire output string
+   * so that one can allocate a larger buffer and call the function again
+   * if necessary.
+   * The output string is NUL-terminated if possible.
+   *
+   * @param start offset of first character which will be copied
+   * @param startLength the number of characters to extract
+   * @param target the target buffer for extraction
+   * @param targetLength the length of the target buffer
+   * If <TT>target</TT> is NULL, then the number of bytes required for
+   * <TT>target</TT> is returned.
+   * @return the output string length, not including the terminating NUL
+   * @stable ICU 2.0
+   */
+  int32_t extract(int32_t start,
+           int32_t startLength,
+           char *target,
+           uint32_t targetLength) const;
+
+#endif
+
+#if !UCONFIG_NO_CONVERSION
+
+  /**
+   * Copy the characters in the range
+   * [<tt>start</TT>, <tt>start + length</TT>) into an array of characters
+   * in a specified codepage.
+   * The output string is NUL-terminated.
+   *
+   * Recommendation: For invariant-character strings use
+   * extract(int32_t start, int32_t length, char *target, int32_t targetCapacity, enum EInvariant inv) const
+   * because it avoids object code dependencies of UnicodeString on
+   * the conversion code.
+   *
+   * @param start offset of first character which will be copied
+   * @param startLength the number of characters to extract
+   * @param target the target buffer for extraction
+   * @param codepage the desired codepage for the characters.  0 has
+   * the special meaning of the default codepage
+   * If <code>codepage</code> is an empty string (<code>""</code>),
+   * then a simple conversion is performed on the codepage-invariant
+   * subset ("invariant characters") of the platform encoding. See utypes.h.
+   * If <TT>target</TT> is NULL, then the number of bytes required for
+   * <TT>target</TT> is returned. It is assumed that the target is big enough
+   * to fit all of the characters.
+   * @return the output string length, not including the terminating NUL
+   * @stable ICU 2.0
+   */
+  inline int32_t extract(int32_t start,
+                 int32_t startLength,
+                 char *target,
+                 const char *codepage = 0) const;
+
+  /**
+   * Copy the characters in the range
+   * [<tt>start</TT>, <tt>start + length</TT>) into an array of characters
+   * in a specified codepage.
+   * This function does not write any more than <code>targetLength</code>
+   * characters but returns the length of the entire output string
+   * so that one can allocate a larger buffer and call the function again
+   * if necessary.
+   * The output string is NUL-terminated if possible.
+   *
+   * Recommendation: For invariant-character strings use
+   * extract(int32_t start, int32_t length, char *target, int32_t targetCapacity, enum EInvariant inv) const
+   * because it avoids object code dependencies of UnicodeString on
+   * the conversion code.
+   *
+   * @param start offset of first character which will be copied
+   * @param startLength the number of characters to extract
+   * @param target the target buffer for extraction
+   * @param targetLength the length of the target buffer
+   * @param codepage the desired codepage for the characters.  0 has
+   * the special meaning of the default codepage
+   * If <code>codepage</code> is an empty string (<code>""</code>),
+   * then a simple conversion is performed on the codepage-invariant
+   * subset ("invariant characters") of the platform encoding. See utypes.h.
+   * If <TT>target</TT> is NULL, then the number of bytes required for
+   * <TT>target</TT> is returned.
+   * @return the output string length, not including the terminating NUL
+   * @stable ICU 2.0
+   */
+  int32_t extract(int32_t start,
+           int32_t startLength,
+           char *target,
+           uint32_t targetLength,
+           const char *codepage) const;
+
+  /**
+   * Convert the UnicodeString into a codepage string using an existing UConverter.
+   * The output string is NUL-terminated if possible.
+   *
+   * This function avoids the overhead of opening and closing a converter if
+   * multiple strings are extracted.
+   *
+   * @param dest destination string buffer, can be NULL if destCapacity==0
+   * @param destCapacity the number of chars available at dest
+   * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called),
+   *        or NULL for the default converter
+   * @param errorCode normal ICU error code
+   * @return the length of the output string, not counting the terminating NUL;
+   *         if the length is greater than destCapacity, then the string will not fit
+   *         and a buffer of the indicated length would need to be passed in
+   * @stable ICU 2.0
+   */
+  int32_t extract(char *dest, int32_t destCapacity,
+                  UConverter *cnv,
+                  UErrorCode &errorCode) const;
+
+#endif
+
+  /**
+   * Create a temporary substring for the specified range.
+   * Unlike the substring constructor and setTo() functions,
+   * the object returned here will be a read-only alias (using getBuffer())
+   * rather than copying the text.
+   * As a result, this substring operation is much faster but requires
+   * that the original string not be modified or deleted during the lifetime
+   * of the returned substring object.
+   * @param start offset of the first character visible in the substring
+   * @param length length of the substring
+   * @return a read-only alias UnicodeString object for the substring
+   * @stable ICU 4.4
+   */
+  UnicodeString tempSubString(int32_t start=0, int32_t length=INT32_MAX) const;
+
+  /**
+   * Create a temporary substring for the specified range.
+   * Same as tempSubString(start, length) except that the substring range
+   * is specified as a (start, limit) pair (with an exclusive limit index)
+   * rather than a (start, length) pair.
+   * @param start offset of the first character visible in the substring
+   * @param limit offset immediately following the last character visible in the substring
+   * @return a read-only alias UnicodeString object for the substring
+   * @stable ICU 4.4
+   */
+  inline UnicodeString tempSubStringBetween(int32_t start, int32_t limit=INT32_MAX) const;
+
+  /**
+   * Convert the UnicodeString to UTF-8 and write the result
+   * to a ByteSink. This is called by toUTF8String().
+   * Unpaired surrogates are replaced with U+FFFD.
+   * Calls u_strToUTF8WithSub().
+   *
+   * @param sink A ByteSink to which the UTF-8 version of the string is written.
+   *             sink.Flush() is called at the end.
+   * @stable ICU 4.2
+   * @see toUTF8String
+   */
+  void toUTF8(ByteSink &sink) const;
+
+#if U_HAVE_STD_STRING
+
+  /**
+   * Convert the UnicodeString to UTF-8 and append the result
+   * to a standard string.
+   * Unpaired surrogates are replaced with U+FFFD.
+   * Calls toUTF8().
+   *
+   * @param result A standard string (or a compatible object)
+   *        to which the UTF-8 version of the string is appended.
+   * @return The string object.
+   * @stable ICU 4.2
+   * @see toUTF8
+   */
+  template<typename StringClass>
+  StringClass &toUTF8String(StringClass &result) const {
+    StringByteSink<StringClass> sbs(&result);
+    toUTF8(sbs);
+    return result;
+  }
+
+#endif
+
+  /**
+   * Convert the UnicodeString to UTF-32.
+   * Unpaired surrogates are replaced with U+FFFD.
+   * Calls u_strToUTF32WithSub().
+   *
+   * @param utf32 destination string buffer, can be NULL if capacity==0
+   * @param capacity the number of UChar32s available at utf32
+   * @param errorCode Standard ICU error code. Its input value must
+   *                  pass the U_SUCCESS() test, or else the function returns
+   *                  immediately. Check for U_FAILURE() on output or use with
+   *                  function chaining. (See User Guide for details.)
+   * @return The length of the UTF-32 string.
+   * @see fromUTF32
+   * @stable ICU 4.2
+   */
+  int32_t toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode) const;
+
+  /* Length operations */
+
+  /**
+   * Return the length of the UnicodeString object.
+   * The length is the number of UChar code units are in the UnicodeString.
+   * If you want the number of code points, please use countChar32().
+   * @return the length of the UnicodeString object
+   * @see countChar32
+   * @stable ICU 2.0
+   */
+  inline int32_t length(void) const;
+
+  /**
+   * Count Unicode code points in the length UChar code units of the string.
+   * A code point may occupy either one or two UChar code units.
+   * Counting code points involves reading all code units.
+   *
+   * This functions is basically the inverse of moveIndex32().
+   *
+   * @param start the index of the first code unit to check
+   * @param length the number of UChar code units to check
+   * @return the number of code points in the specified code units
+   * @see length
+   * @stable ICU 2.0
+   */
+  int32_t
+  countChar32(int32_t start=0, int32_t length=INT32_MAX) const;
+
+  /**
+   * Check if the length UChar code units of the string
+   * contain more Unicode code points than a certain number.
+   * This is more efficient than counting all code points in this part of the string
+   * and comparing that number with a threshold.
+   * This function may not need to scan the string at all if the length
+   * falls within a certain range, and
+   * never needs to count more than 'number+1' code points.
+   * Logically equivalent to (countChar32(start, length)>number).
+   * A Unicode code point may occupy either one or two UChar code units.
+   *
+   * @param start the index of the first code unit to check (0 for the entire string)
+   * @param length the number of UChar code units to check
+   *               (use INT32_MAX for the entire string; remember that start/length
+   *                values are pinned)
+   * @param number The number of code points in the (sub)string is compared against
+   *               the 'number' parameter.
+   * @return Boolean value for whether the string contains more Unicode code points
+   *         than 'number'. Same as (u_countChar32(s, length)>number).
+   * @see countChar32
+   * @see u_strHasMoreChar32Than
+   * @stable ICU 2.4
+   */
+  UBool
+  hasMoreChar32Than(int32_t start, int32_t length, int32_t number) const;
+
+  /**
+   * Determine if this string is empty.
+   * @return TRUE if this string contains 0 characters, FALSE otherwise.
+   * @stable ICU 2.0
+   */
+  inline UBool isEmpty(void) const;
+
+  /**
+   * Return the capacity of the internal buffer of the UnicodeString object.
+   * This is useful together with the getBuffer functions.
+   * See there for details.
+   *
+   * @return the number of UChars available in the internal buffer
+   * @see getBuffer
+   * @stable ICU 2.0
+   */
+  inline int32_t getCapacity(void) const;
+
+  /* Other operations */
+
+  /**
+   * Generate a hash code for this object.
+   * @return The hash code of this UnicodeString.
+   * @stable ICU 2.0
+   */
+  inline int32_t hashCode(void) const;
+
+  /**
+   * Determine if this object contains a valid string.
+   * A bogus string has no value. It is different from an empty string,
+   * although in both cases isEmpty() returns TRUE and length() returns 0.
+   * setToBogus() and isBogus() can be used to indicate that no string value is available.
+   * For a bogus string, getBuffer() and getTerminatedBuffer() return NULL, and
+   * length() returns 0.
+   *
+   * @return TRUE if the string is valid, FALSE otherwise
+   * @see setToBogus()
+   * @stable ICU 2.0
+   */
+  inline UBool isBogus(void) const;
+
+
+  //========================================
+  // Write operations
+  //========================================
+
+  /* Assignment operations */
+
+  /**
+   * Assignment operator.  Replace the characters in this UnicodeString
+   * with the characters from <TT>srcText</TT>.
+   * @param srcText The text containing the characters to replace
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  UnicodeString &operator=(const UnicodeString &srcText);
+
+  /**
+   * Almost the same as the assignment operator.
+   * Replace the characters in this UnicodeString
+   * with the characters from <code>srcText</code>.
+   *
+   * This function works the same for all strings except for ones that
+   * are readonly aliases.
+   * Starting with ICU 2.4, the assignment operator and the copy constructor
+   * allocate a new buffer and copy the buffer contents even for readonly aliases.
+   * This function implements the old, more efficient but less safe behavior
+   * of making this string also a readonly alias to the same buffer.
+   * The fastCopyFrom function must be used only if it is known that the lifetime of
+   * this UnicodeString is at least as long as the lifetime of the aliased buffer
+   * including its contents, for example for strings from resource bundles
+   * or aliases to string contents.
+   *
+   * @param src The text containing the characters to replace.
+   * @return a reference to this
+   * @stable ICU 2.4
+   */
+  UnicodeString &fastCopyFrom(const UnicodeString &src);
+
+  /**
+   * Assignment operator.  Replace the characters in this UnicodeString
+   * with the code unit <TT>ch</TT>.
+   * @param ch the code unit to replace
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& operator= (UChar ch);
+
+  /**
+   * Assignment operator.  Replace the characters in this UnicodeString
+   * with the code point <TT>ch</TT>.
+   * @param ch the code point to replace
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& operator= (UChar32 ch);
+
+  /**
+   * Set the text in the UnicodeString object to the characters
+   * in <TT>srcText</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcText.length()</TT>).
+   * <TT>srcText</TT> is not modified.
+   * @param srcText the source for the new characters
+   * @param srcStart the offset into <TT>srcText</TT> where new characters
+   * will be obtained
+   * @return a reference to this
+   * @stable ICU 2.2
+   */
+  inline UnicodeString& setTo(const UnicodeString& srcText,
+               int32_t srcStart);
+
+  /**
+   * Set the text in the UnicodeString object to the characters
+   * in <TT>srcText</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
+   * <TT>srcText</TT> is not modified.
+   * @param srcText the source for the new characters
+   * @param srcStart the offset into <TT>srcText</TT> where new characters
+   * will be obtained
+   * @param srcLength the number of characters in <TT>srcText</TT> in the
+   * replace string.
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& setTo(const UnicodeString& srcText,
+               int32_t srcStart,
+               int32_t srcLength);
+
+  /**
+   * Set the text in the UnicodeString object to the characters in
+   * <TT>srcText</TT>.
+   * <TT>srcText</TT> is not modified.
+   * @param srcText the source for the new characters
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& setTo(const UnicodeString& srcText);
+
+  /**
+   * Set the characters in the UnicodeString object to the characters
+   * in <TT>srcChars</TT>. <TT>srcChars</TT> is not modified.
+   * @param srcChars the source for the new characters
+   * @param srcLength the number of Unicode characters in srcChars.
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& setTo(const UChar *srcChars,
+               int32_t srcLength);
+
+  /**
+   * Set the characters in the UnicodeString object to the code unit
+   * <TT>srcChar</TT>.
+   * @param srcChar the code unit which becomes the UnicodeString's character
+   * content
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  UnicodeString& setTo(UChar srcChar);
+
+  /**
+   * Set the characters in the UnicodeString object to the code point
+   * <TT>srcChar</TT>.
+   * @param srcChar the code point which becomes the UnicodeString's character
+   * content
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  UnicodeString& setTo(UChar32 srcChar);
+
+  /**
+   * Aliasing setTo() function, analogous to the readonly-aliasing UChar* constructor.
+   * The text will be used for the UnicodeString object, but
+   * it will not be released when the UnicodeString is destroyed.
+   * This has copy-on-write semantics:
+   * When the string is modified, then the buffer is first copied into
+   * newly allocated memory.
+   * The aliased buffer is never modified.
+   * In an assignment to another UnicodeString, the text will be aliased again,
+   * so that both strings then alias the same readonly-text.
+   *
+   * @param isTerminated specifies if <code>text</code> is <code>NUL</code>-terminated.
+   *                     This must be true if <code>textLength==-1</code>.
+   * @param text The characters to alias for the UnicodeString.
+   * @param textLength The number of Unicode characters in <code>text</code> to alias.
+   *                   If -1, then this constructor will determine the length
+   *                   by calling <code>u_strlen()</code>.
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  UnicodeString &setTo(UBool isTerminated,
+                       const UChar *text,
+                       int32_t textLength);
+
+  /**
+   * Aliasing setTo() function, analogous to the writable-aliasing UChar* constructor.
+   * The text will be used for the UnicodeString object, but
+   * it will not be released when the UnicodeString is destroyed.
+   * This has write-through semantics:
+   * For as long as the capacity of the buffer is sufficient, write operations
+   * will directly affect the buffer. When more capacity is necessary, then
+   * a new buffer will be allocated and the contents copied as with regularly
+   * constructed strings.
+   * In an assignment to another UnicodeString, the buffer will be copied.
+   * The extract(UChar *dst) function detects whether the dst pointer is the same
+   * as the string buffer itself and will in this case not copy the contents.
+   *
+   * @param buffer The characters to alias for the UnicodeString.
+   * @param buffLength The number of Unicode characters in <code>buffer</code> to alias.
+   * @param buffCapacity The size of <code>buffer</code> in UChars.
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  UnicodeString &setTo(UChar *buffer,
+                       int32_t buffLength,
+                       int32_t buffCapacity);
+
+  /**
+   * Make this UnicodeString object invalid.
+   * The string will test TRUE with isBogus().
+   *
+   * A bogus string has no value. It is different from an empty string.
+   * It can be used to indicate that no string value is available.
+   * getBuffer() and getTerminatedBuffer() return NULL, and
+   * length() returns 0.
+   *
+   * This utility function is used throughout the UnicodeString
+   * implementation to indicate that a UnicodeString operation failed,
+   * and may be used in other functions,
+   * especially but not exclusively when such functions do not
+   * take a UErrorCode for simplicity.
+   *
+   * The following methods, and no others, will clear a string object's bogus flag:
+   * - remove()
+   * - remove(0, INT32_MAX)
+   * - truncate(0)
+   * - operator=() (assignment operator)
+   * - setTo(...)
+   *
+   * The simplest ways to turn a bogus string into an empty one
+   * is to use the remove() function.
+   * Examples for other functions that are equivalent to "set to empty string":
+   * \code
+   * if(s.isBogus()) {
+   *   s.remove();           // set to an empty string (remove all), or
+   *   s.remove(0, INT32_MAX); // set to an empty string (remove all), or
+   *   s.truncate(0);        // set to an empty string (complete truncation), or
+   *   s=UnicodeString();    // assign an empty string, or
+   *   s.setTo((UChar32)-1); // set to a pseudo code point that is out of range, or
+   *   static const UChar nul=0;
+   *   s.setTo(&nul, 0);     // set to an empty C Unicode string
+   * }
+   * \endcode
+   *
+   * @see isBogus()
+   * @stable ICU 2.0
+   */
+  void setToBogus();
+
+  /**
+   * Set the character at the specified offset to the specified character.
+   * @param offset A valid offset into the text of the character to set
+   * @param ch The new character
+   * @return A reference to this
+   * @stable ICU 2.0
+   */
+  UnicodeString& setCharAt(int32_t offset,
+               UChar ch);
+
+
+  /* Append operations */
+
+  /**
+   * Append operator. Append the code unit <TT>ch</TT> to the UnicodeString
+   * object.
+   * @param ch the code unit to be appended
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+ inline  UnicodeString& operator+= (UChar ch);
+
+  /**
+   * Append operator. Append the code point <TT>ch</TT> to the UnicodeString
+   * object.
+   * @param ch the code point to be appended
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+ inline  UnicodeString& operator+= (UChar32 ch);
+
+  /**
+   * Append operator. Append the characters in <TT>srcText</TT> to the
+   * UnicodeString object at offset <TT>start</TT>. <TT>srcText</TT> is
+   * not modified.
+   * @param srcText the source for the new characters
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& operator+= (const UnicodeString& srcText);
+
+  /**
+   * Append the characters
+   * in <TT>srcText</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) to the
+   * UnicodeString object at offset <TT>start</TT>. <TT>srcText</TT>
+   * is not modified.
+   * @param srcText the source for the new characters
+   * @param srcStart the offset into <TT>srcText</TT> where new characters
+   * will be obtained
+   * @param srcLength the number of characters in <TT>srcText</TT> in
+   * the append string
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& append(const UnicodeString& srcText,
+            int32_t srcStart,
+            int32_t srcLength);
+
+  /**
+   * Append the characters in <TT>srcText</TT> to the UnicodeString object at
+   * offset <TT>start</TT>. <TT>srcText</TT> is not modified.
+   * @param srcText the source for the new characters
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& append(const UnicodeString& srcText);
+
+  /**
+   * Append the characters in <TT>srcChars</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) to the UnicodeString
+   * object at offset
+   * <TT>start</TT>. <TT>srcChars</TT> is not modified.
+   * @param srcChars the source for the new characters
+   * @param srcStart the offset into <TT>srcChars</TT> where new characters
+   * will be obtained
+   * @param srcLength the number of characters in <TT>srcChars</TT> in
+   * the append string
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& append(const UChar *srcChars,
+            int32_t srcStart,
+            int32_t srcLength);
+
+  /**
+   * Append the characters in <TT>srcChars</TT> to the UnicodeString object
+   * at offset <TT>start</TT>. <TT>srcChars</TT> is not modified.
+   * @param srcChars the source for the new characters
+   * @param srcLength the number of Unicode characters in <TT>srcChars</TT>
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& append(const UChar *srcChars,
+            int32_t srcLength);
+
+  /**
+   * Append the code unit <TT>srcChar</TT> to the UnicodeString object.
+   * @param srcChar the code unit to append
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& append(UChar srcChar);
+
+  /**
+   * Append the code point <TT>srcChar</TT> to the UnicodeString object.
+   * @param srcChar the code point to append
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& append(UChar32 srcChar);
+
+
+  /* Insert operations */
+
+  /**
+   * Insert the characters in <TT>srcText</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) into the UnicodeString
+   * object at offset <TT>start</TT>. <TT>srcText</TT> is not modified.
+   * @param start the offset where the insertion begins
+   * @param srcText the source for the new characters
+   * @param srcStart the offset into <TT>srcText</TT> where new characters
+   * will be obtained
+   * @param srcLength the number of characters in <TT>srcText</TT> in
+   * the insert string
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& insert(int32_t start,
+            const UnicodeString& srcText,
+            int32_t srcStart,
+            int32_t srcLength);
+
+  /**
+   * Insert the characters in <TT>srcText</TT> into the UnicodeString object
+   * at offset <TT>start</TT>. <TT>srcText</TT> is not modified.
+   * @param start the offset where the insertion begins
+   * @param srcText the source for the new characters
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& insert(int32_t start,
+            const UnicodeString& srcText);
+
+  /**
+   * Insert the characters in <TT>srcChars</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) into the UnicodeString
+   *  object at offset <TT>start</TT>. <TT>srcChars</TT> is not modified.
+   * @param start the offset at which the insertion begins
+   * @param srcChars the source for the new characters
+   * @param srcStart the offset into <TT>srcChars</TT> where new characters
+   * will be obtained
+   * @param srcLength the number of characters in <TT>srcChars</TT>
+   * in the insert string
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& insert(int32_t start,
+            const UChar *srcChars,
+            int32_t srcStart,
+            int32_t srcLength);
+
+  /**
+   * Insert the characters in <TT>srcChars</TT> into the UnicodeString object
+   * at offset <TT>start</TT>. <TT>srcChars</TT> is not modified.
+   * @param start the offset where the insertion begins
+   * @param srcChars the source for the new characters
+   * @param srcLength the number of Unicode characters in srcChars.
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& insert(int32_t start,
+            const UChar *srcChars,
+            int32_t srcLength);
+
+  /**
+   * Insert the code unit <TT>srcChar</TT> into the UnicodeString object at
+   * offset <TT>start</TT>.
+   * @param start the offset at which the insertion occurs
+   * @param srcChar the code unit to insert
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& insert(int32_t start,
+            UChar srcChar);
+
+  /**
+   * Insert the code point <TT>srcChar</TT> into the UnicodeString object at
+   * offset <TT>start</TT>.
+   * @param start the offset at which the insertion occurs
+   * @param srcChar the code point to insert
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& insert(int32_t start,
+            UChar32 srcChar);
+
+
+  /* Replace operations */
+
+  /**
+   * Replace the characters in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) with the characters in
+   * <TT>srcText</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>).
+   * <TT>srcText</TT> is not modified.
+   * @param start the offset at which the replace operation begins
+   * @param length the number of characters to replace. The character at
+   * <TT>start + length</TT> is not modified.
+   * @param srcText the source for the new characters
+   * @param srcStart the offset into <TT>srcText</TT> where new characters
+   * will be obtained
+   * @param srcLength the number of characters in <TT>srcText</TT> in
+   * the replace string
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  UnicodeString& replace(int32_t start,
+             int32_t length,
+             const UnicodeString& srcText,
+             int32_t srcStart,
+             int32_t srcLength);
+
+  /**
+   * Replace the characters in the range
+   * [<TT>start</TT>, <TT>start + length</TT>)
+   * with the characters in <TT>srcText</TT>.  <TT>srcText</TT> is
+   *  not modified.
+   * @param start the offset at which the replace operation begins
+   * @param length the number of characters to replace. The character at
+   * <TT>start + length</TT> is not modified.
+   * @param srcText the source for the new characters
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  UnicodeString& replace(int32_t start,
+             int32_t length,
+             const UnicodeString& srcText);
+
+  /**
+   * Replace the characters in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) with the characters in
+   * <TT>srcChars</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>). <TT>srcChars</TT>
+   * is not modified.
+   * @param start the offset at which the replace operation begins
+   * @param length the number of characters to replace.  The character at
+   * <TT>start + length</TT> is not modified.
+   * @param srcChars the source for the new characters
+   * @param srcStart the offset into <TT>srcChars</TT> where new characters
+   * will be obtained
+   * @param srcLength the number of characters in <TT>srcChars</TT>
+   * in the replace string
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  UnicodeString& replace(int32_t start,
+             int32_t length,
+             const UChar *srcChars,
+             int32_t srcStart,
+             int32_t srcLength);
+
+  /**
+   * Replace the characters in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) with the characters in
+   * <TT>srcChars</TT>.  <TT>srcChars</TT> is not modified.
+   * @param start the offset at which the replace operation begins
+   * @param length number of characters to replace.  The character at
+   * <TT>start + length</TT> is not modified.
+   * @param srcChars the source for the new characters
+   * @param srcLength the number of Unicode characters in srcChars
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& replace(int32_t start,
+             int32_t length,
+             const UChar *srcChars,
+             int32_t srcLength);
+
+  /**
+   * Replace the characters in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) with the code unit
+   * <TT>srcChar</TT>.
+   * @param start the offset at which the replace operation begins
+   * @param length the number of characters to replace.  The character at
+   * <TT>start + length</TT> is not modified.
+   * @param srcChar the new code unit
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& replace(int32_t start,
+             int32_t length,
+             UChar srcChar);
+
+  /**
+   * Replace the characters in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) with the code point
+   * <TT>srcChar</TT>.
+   * @param start the offset at which the replace operation begins
+   * @param length the number of characters to replace.  The character at
+   * <TT>start + length</TT> is not modified.
+   * @param srcChar the new code point
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& replace(int32_t start,
+             int32_t length,
+             UChar32 srcChar);
+
+  /**
+   * Replace the characters in the range [<TT>start</TT>, <TT>limit</TT>)
+   * with the characters in <TT>srcText</TT>. <TT>srcText</TT> is not modified.
+   * @param start the offset at which the replace operation begins
+   * @param limit the offset immediately following the replace range
+   * @param srcText the source for the new characters
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& replaceBetween(int32_t start,
+                int32_t limit,
+                const UnicodeString& srcText);
+
+  /**
+   * Replace the characters in the range [<TT>start</TT>, <TT>limit</TT>)
+   * with the characters in <TT>srcText</TT> in the range
+   * [<TT>srcStart</TT>, <TT>srcLimit</TT>). <TT>srcText</TT> is not modified.
+   * @param start the offset at which the replace operation begins
+   * @param limit the offset immediately following the replace range
+   * @param srcText the source for the new characters
+   * @param srcStart the offset into <TT>srcChars</TT> where new characters
+   * will be obtained
+   * @param srcLimit the offset immediately following the range to copy
+   * in <TT>srcText</TT>
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& replaceBetween(int32_t start,
+                int32_t limit,
+                const UnicodeString& srcText,
+                int32_t srcStart,
+                int32_t srcLimit);
+
+  /**
+   * Replace a substring of this object with the given text.
+   * @param start the beginning index, inclusive; <code>0 <= start
+   * <= limit</code>.
+   * @param limit the ending index, exclusive; <code>start <= limit
+   * <= length()</code>.
+   * @param text the text to replace characters <code>start</code>
+   * to <code>limit - 1</code>
+   * @stable ICU 2.0
+   */
+  virtual void handleReplaceBetween(int32_t start,
+                                    int32_t limit,
+                                    const UnicodeString& text);
+
+  /**
+   * Replaceable API
+   * @return TRUE if it has MetaData
+   * @stable ICU 2.4
+   */
+  virtual UBool hasMetaData() const;
+
+  /**
+   * Copy a substring of this object, retaining attribute (out-of-band)
+   * information.  This method is used to duplicate or reorder substrings.
+   * The destination index must not overlap the source range.
+   *
+   * @param start the beginning index, inclusive; <code>0 <= start <=
+   * limit</code>.
+   * @param limit the ending index, exclusive; <code>start <= limit <=
+   * length()</code>.
+   * @param dest the destination index.  The characters from
+   * <code>start..limit-1</code> will be copied to <code>dest</code>.
+   * Implementations of this method may assume that <code>dest <= start ||
+   * dest >= limit</code>.
+   * @stable ICU 2.0
+   */
+  virtual void copy(int32_t start, int32_t limit, int32_t dest);
+
+  /* Search and replace operations */
+
+  /**
+   * Replace all occurrences of characters in oldText with the characters
+   * in newText
+   * @param oldText the text containing the search text
+   * @param newText the text containing the replacement text
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& findAndReplace(const UnicodeString& oldText,
+                const UnicodeString& newText);
+
+  /**
+   * Replace all occurrences of characters in oldText with characters
+   * in newText
+   * in the range [<TT>start</TT>, <TT>start + length</TT>).
+   * @param start the start of the range in which replace will performed
+   * @param length the length of the range in which replace will be performed
+   * @param oldText the text containing the search text
+   * @param newText the text containing the replacement text
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& findAndReplace(int32_t start,
+                int32_t length,
+                const UnicodeString& oldText,
+                const UnicodeString& newText);
+
+  /**
+   * Replace all occurrences of characters in oldText in the range
+   * [<TT>oldStart</TT>, <TT>oldStart + oldLength</TT>) with the characters
+   * in newText in the range
+   * [<TT>newStart</TT>, <TT>newStart + newLength</TT>)
+   * in the range [<TT>start</TT>, <TT>start + length</TT>).
+   * @param start the start of the range in which replace will performed
+   * @param length the length of the range in which replace will be performed
+   * @param oldText the text containing the search text
+   * @param oldStart the start of the search range in <TT>oldText</TT>
+   * @param oldLength the length of the search range in <TT>oldText</TT>
+   * @param newText the text containing the replacement text
+   * @param newStart the start of the replacement range in <TT>newText</TT>
+   * @param newLength the length of the replacement range in <TT>newText</TT>
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  UnicodeString& findAndReplace(int32_t start,
+                int32_t length,
+                const UnicodeString& oldText,
+                int32_t oldStart,
+                int32_t oldLength,
+                const UnicodeString& newText,
+                int32_t newStart,
+                int32_t newLength);
+
+
+  /* Remove operations */
+
+  /**
+   * Remove all characters from the UnicodeString object.
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& remove(void);
+
+  /**
+   * Remove the characters in the range
+   * [<TT>start</TT>, <TT>start + length</TT>) from the UnicodeString object.
+   * @param start the offset of the first character to remove
+   * @param length the number of characters to remove
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& remove(int32_t start,
+                               int32_t length = (int32_t)INT32_MAX);
+
+  /**
+   * Remove the characters in the range
+   * [<TT>start</TT>, <TT>limit</TT>) from the UnicodeString object.
+   * @param start the offset of the first character to remove
+   * @param limit the offset immediately following the range to remove
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& removeBetween(int32_t start,
+                                      int32_t limit = (int32_t)INT32_MAX);
+
+  /**
+   * Retain only the characters in the range
+   * [<code>start</code>, <code>limit</code>) from the UnicodeString object.
+   * Removes characters before <code>start</code> and at and after <code>limit</code>.
+   * @param start the offset of the first character to retain
+   * @param limit the offset immediately following the range to retain
+   * @return a reference to this
+   * @stable ICU 4.4
+   */
+  inline UnicodeString &retainBetween(int32_t start, int32_t limit = INT32_MAX);
+
+  /* Length operations */
+
+  /**
+   * Pad the start of this UnicodeString with the character <TT>padChar</TT>.
+   * If the length of this UnicodeString is less than targetLength,
+   * length() - targetLength copies of padChar will be added to the
+   * beginning of this UnicodeString.
+   * @param targetLength the desired length of the string
+   * @param padChar the character to use for padding. Defaults to
+   * space (U+0020)
+   * @return TRUE if the text was padded, FALSE otherwise.
+   * @stable ICU 2.0
+   */
+  UBool padLeading(int32_t targetLength,
+                    UChar padChar = 0x0020);
+
+  /**
+   * Pad the end of this UnicodeString with the character <TT>padChar</TT>.
+   * If the length of this UnicodeString is less than targetLength,
+   * length() - targetLength copies of padChar will be added to the
+   * end of this UnicodeString.
+   * @param targetLength the desired length of the string
+   * @param padChar the character to use for padding. Defaults to
+   * space (U+0020)
+   * @return TRUE if the text was padded, FALSE otherwise.
+   * @stable ICU 2.0
+   */
+  UBool padTrailing(int32_t targetLength,
+                     UChar padChar = 0x0020);
+
+  /**
+   * Truncate this UnicodeString to the <TT>targetLength</TT>.
+   * @param targetLength the desired length of this UnicodeString.
+   * @return TRUE if the text was truncated, FALSE otherwise
+   * @stable ICU 2.0
+   */
+  inline UBool truncate(int32_t targetLength);
+
+  /**
+   * Trims leading and trailing whitespace from this UnicodeString.
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  UnicodeString& trim(void);
+
+
+  /* Miscellaneous operations */
+
+  /**
+   * Reverse this UnicodeString in place.
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& reverse(void);
+
+  /**
+   * Reverse the range [<TT>start</TT>, <TT>start + length</TT>) in
+   * this UnicodeString.
+   * @param start the start of the range to reverse
+   * @param length the number of characters to to reverse
+   * @return a reference to this
+   * @stable ICU 2.0
+   */
+  inline UnicodeString& reverse(int32_t start,
+             int32_t length);
+
+  /**
+   * Convert the characters in this to UPPER CASE following the conventions of
+   * the default locale.
+   * @return A reference to this.
+   * @stable ICU 2.0
+   */
+  UnicodeString& toUpper(void);
+
+  /**
+   * Convert the characters in this to UPPER CASE following the conventions of
+   * a specific locale.
+   * @param locale The locale containing the conventions to use.
+   * @return A reference to this.
+   * @stable ICU 2.0
+   */
+  UnicodeString& toUpper(const Locale& locale);
+
+  /**
+   * Convert the characters in this to lower case following the conventions of
+   * the default locale.
+   * @return A reference to this.
+   * @stable ICU 2.0
+   */
+  UnicodeString& toLower(void);
+
+  /**
+   * Convert the characters in this to lower case following the conventions of
+   * a specific locale.
+   * @param locale The locale containing the conventions to use.
+   * @return A reference to this.
+   * @stable ICU 2.0
+   */
+  UnicodeString& toLower(const Locale& locale);
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+  /**
+   * Titlecase this string, convenience function using the default locale.
+   *
+   * Casing is locale-dependent and context-sensitive.
+   * Titlecasing uses a break iterator to find the first characters of words
+   * that are to be titlecased. It titlecases those characters and lowercases
+   * all others.
+   *
+   * The titlecase break iterator can be provided to customize for arbitrary
+   * styles, using rules and dictionaries beyond the standard iterators.
+   * It may be more efficient to always provide an iterator to avoid
+   * opening and closing one for each string.
+   * The standard titlecase iterator for the root locale implements the
+   * algorithm of Unicode TR 21.
+   *
+   * This function uses only the setText(), first() and next() methods of the
+   * provided break iterator.
+   *
+   * @param titleIter A break iterator to find the first characters of words
+   *                  that are to be titlecased.
+   *                  If none is provided (0), then a standard titlecase
+   *                  break iterator is opened.
+   *                  Otherwise the provided iterator is set to the string's text.
+   * @return A reference to this.
+   * @stable ICU 2.1
+   */
+  UnicodeString &toTitle(BreakIterator *titleIter);
+
+  /**
+   * Titlecase this string.
+   *
+   * Casing is locale-dependent and context-sensitive.
+   * Titlecasing uses a break iterator to find the first characters of words
+   * that are to be titlecased. It titlecases those characters and lowercases
+   * all others.
+   *
+   * The titlecase break iterator can be provided to customize for arbitrary
+   * styles, using rules and dictionaries beyond the standard iterators.
+   * It may be more efficient to always provide an iterator to avoid
+   * opening and closing one for each string.
+   * The standard titlecase iterator for the root locale implements the
+   * algorithm of Unicode TR 21.
+   *
+   * This function uses only the setText(), first() and next() methods of the
+   * provided break iterator.
+   *
+   * @param titleIter A break iterator to find the first characters of words
+   *                  that are to be titlecased.
+   *                  If none is provided (0), then a standard titlecase
+   *                  break iterator is opened.
+   *                  Otherwise the provided iterator is set to the string's text.
+   * @param locale    The locale to consider.
+   * @return A reference to this.
+   * @stable ICU 2.1
+   */
+  UnicodeString &toTitle(BreakIterator *titleIter, const Locale &locale);
+
+  /**
+   * Titlecase this string, with options.
+   *
+   * Casing is locale-dependent and context-sensitive.
+   * Titlecasing uses a break iterator to find the first characters of words
+   * that are to be titlecased. It titlecases those characters and lowercases
+   * all others. (This can be modified with options.)
+   *
+   * The titlecase break iterator can be provided to customize for arbitrary
+   * styles, using rules and dictionaries beyond the standard iterators.
+   * It may be more efficient to always provide an iterator to avoid
+   * opening and closing one for each string.
+   * The standard titlecase iterator for the root locale implements the
+   * algorithm of Unicode TR 21.
+   *
+   * This function uses only the setText(), first() and next() methods of the
+   * provided break iterator.
+   *
+   * @param titleIter A break iterator to find the first characters of words
+   *                  that are to be titlecased.
+   *                  If none is provided (0), then a standard titlecase
+   *                  break iterator is opened.
+   *                  Otherwise the provided iterator is set to the string's text.
+   * @param locale    The locale to consider.
+   * @param options Options bit set, see ucasemap_open().
+   * @return A reference to this.
+   * @see U_TITLECASE_NO_LOWERCASE
+   * @see U_TITLECASE_NO_BREAK_ADJUSTMENT
+   * @see ucasemap_open
+   * @stable ICU 3.8
+   */
+  UnicodeString &toTitle(BreakIterator *titleIter, const Locale &locale, uint32_t options);
+
+#endif
+
+  /**
+   * Case-fold the characters in this string.
+   * Case-folding is locale-independent and not context-sensitive,
+   * but there is an option for whether to include or exclude mappings for dotted I
+   * and dotless i that are marked with 'I' in CaseFolding.txt.
+   * The result may be longer or shorter than the original.
+   *
+   * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I
+   * @return A reference to this.
+   * @stable ICU 2.0
+   */
+  UnicodeString &foldCase(uint32_t options=0 /*U_FOLD_CASE_DEFAULT*/);
+
+  //========================================
+  // Access to the internal buffer
+  //========================================
+
+  /**
+   * Get a read/write pointer to the internal buffer.
+   * The buffer is guaranteed to be large enough for at least minCapacity UChars,
+   * writable, and is still owned by the UnicodeString object.
+   * Calls to getBuffer(minCapacity) must not be nested, and
+   * must be matched with calls to releaseBuffer(newLength).
+   * If the string buffer was read-only or shared,
+   * then it will be reallocated and copied.
+   *
+   * An attempted nested call will return 0, and will not further modify the
+   * state of the UnicodeString object.
+   * It also returns 0 if the string is bogus.
+   *
+   * The actual capacity of the string buffer may be larger than minCapacity.
+   * getCapacity() returns the actual capacity.
+   * For many operations, the full capacity should be used to avoid reallocations.
+   *
+   * While the buffer is "open" between getBuffer(minCapacity)
+   * and releaseBuffer(newLength), the following applies:
+   * - The string length is set to 0.
+   * - Any read API call on the UnicodeString object will behave like on a 0-length string.
+   * - Any write API call on the UnicodeString object is disallowed and will have no effect.
+   * - You can read from and write to the returned buffer.
+   * - The previous string contents will still be in the buffer;
+   *   if you want to use it, then you need to call length() before getBuffer(minCapacity).
+   *   If the length() was greater than minCapacity, then any contents after minCapacity
+   *   may be lost.
+   *   The buffer contents is not NUL-terminated by getBuffer().
+   *   If length()<getCapacity() then you can terminate it by writing a NUL
+   *   at index length().
+   * - You must call releaseBuffer(newLength) before and in order to
+   *   return to normal UnicodeString operation.
+   *
+   * @param minCapacity the minimum number of UChars that are to be available
+   *        in the buffer, starting at the returned pointer;
+   *        default to the current string capacity if minCapacity==-1
+   * @return a writable pointer to the internal string buffer,
+   *         or 0 if an error occurs (nested calls, out of memory)
+   *
+   * @see releaseBuffer
+   * @see getTerminatedBuffer()
+   * @stable ICU 2.0
+   */
+  UChar *getBuffer(int32_t minCapacity);
+
+  /**
+   * Release a read/write buffer on a UnicodeString object with an
+   * "open" getBuffer(minCapacity).
+   * This function must be called in a matched pair with getBuffer(minCapacity).
+   * releaseBuffer(newLength) must be called if and only if a getBuffer(minCapacity) is "open".
+   *
+   * It will set the string length to newLength, at most to the current capacity.
+   * If newLength==-1 then it will set the length according to the
+   * first NUL in the buffer, or to the capacity if there is no NUL.
+   *
+   * After calling releaseBuffer(newLength) the UnicodeString is back to normal operation.
+   *
+   * @param newLength the new length of the UnicodeString object;
+   *        defaults to the current capacity if newLength is greater than that;
+   *        if newLength==-1, it defaults to u_strlen(buffer) but not more than
+   *        the current capacity of the string
+   *
+   * @see getBuffer(int32_t minCapacity)
+   * @stable ICU 2.0
+   */
+  void releaseBuffer(int32_t newLength=-1);
+
+  /**
+   * Get a read-only pointer to the internal buffer.
+   * This can be called at any time on a valid UnicodeString.
+   *
+   * It returns 0 if the string is bogus, or
+   * during an "open" getBuffer(minCapacity).
+   *
+   * It can be called as many times as desired.
+   * The pointer that it returns will remain valid until the UnicodeString object is modified,
+   * at which time the pointer is semantically invalidated and must not be used any more.
+   *
+   * The capacity of the buffer can be determined with getCapacity().
+   * The part after length() may or may not be initialized and valid,
+   * depending on the history of the UnicodeString object.
+   *
+   * The buffer contents is (probably) not NUL-terminated.
+   * You can check if it is with
+   * <code>(s.length()<s.getCapacity() && buffer[s.length()]==0)</code>.
+   * (See getTerminatedBuffer().)
+   *
+   * The buffer may reside in read-only memory. Its contents must not
+   * be modified.
+   *
+   * @return a read-only pointer to the internal string buffer,
+   *         or 0 if the string is empty or bogus
+   *
+   * @see getBuffer(int32_t minCapacity)
+   * @see getTerminatedBuffer()
+   * @stable ICU 2.0
+   */
+  inline const UChar *getBuffer() const;
+
+  /**
+   * Get a read-only pointer to the internal buffer,
+   * making sure that it is NUL-terminated.
+   * This can be called at any time on a valid UnicodeString.
+   *
+   * It returns 0 if the string is bogus, or
+   * during an "open" getBuffer(minCapacity), or if the buffer cannot
+   * be NUL-terminated (because memory allocation failed).
+   *
+   * It can be called as many times as desired.
+   * The pointer that it returns will remain valid until the UnicodeString object is modified,
+   * at which time the pointer is semantically invalidated and must not be used any more.
+   *
+   * The capacity of the buffer can be determined with getCapacity().
+   * The part after length()+1 may or may not be initialized and valid,
+   * depending on the history of the UnicodeString object.
+   *
+   * The buffer contents is guaranteed to be NUL-terminated.
+   * getTerminatedBuffer() may reallocate the buffer if a terminating NUL
+   * is written.
+   * For this reason, this function is not const, unlike getBuffer().
+   * Note that a UnicodeString may also contain NUL characters as part of its contents.
+   *
+   * The buffer may reside in read-only memory. Its contents must not
+   * be modified.
+   *
+   * @return a read-only pointer to the internal string buffer,
+   *         or 0 if the string is empty or bogus
+   *
+   * @see getBuffer(int32_t minCapacity)
+   * @see getBuffer()
+   * @stable ICU 2.2
+   */
+  inline const UChar *getTerminatedBuffer();
+
+  //========================================
+  // Constructors
+  //========================================
+
+  /** Construct an empty UnicodeString.
+   * @stable ICU 2.0
+   */
+  UnicodeString();
+
+  /**
+   * Construct a UnicodeString with capacity to hold <TT>capacity</TT> UChars
+   * @param capacity the number of UChars this UnicodeString should hold
+   * before a resize is necessary; if count is greater than 0 and count
+   * code points c take up more space than capacity, then capacity is adjusted
+   * accordingly.
+   * @param c is used to initially fill the string
+   * @param count specifies how many code points c are to be written in the
+   *              string
+   * @stable ICU 2.0
+   */
+  UnicodeString(int32_t capacity, UChar32 c, int32_t count);
+
+  /**
+   * Single UChar (code unit) constructor.
+   * @param ch the character to place in the UnicodeString
+   * @stable ICU 2.0
+   */
+  UnicodeString(UChar ch);
+
+  /**
+   * Single UChar32 (code point) constructor.
+   * @param ch the character to place in the UnicodeString
+   * @stable ICU 2.0
+   */
+  UnicodeString(UChar32 ch);
+
+  /**
+   * UChar* constructor.
+   * @param text The characters to place in the UnicodeString.  <TT>text</TT>
+   * must be NULL (U+0000) terminated.
+   * @stable ICU 2.0
+   */
+  UnicodeString(const UChar *text);
+
+  /**
+   * UChar* constructor.
+   * @param text The characters to place in the UnicodeString.
+   * @param textLength The number of Unicode characters in <TT>text</TT>
+   * to copy.
+   * @stable ICU 2.0
+   */
+  UnicodeString(const UChar *text,
+        int32_t textLength);
+
+  /**
+   * Readonly-aliasing UChar* constructor.
+   * The text will be used for the UnicodeString object, but
+   * it will not be released when the UnicodeString is destroyed.
+   * This has copy-on-write semantics:
+   * When the string is modified, then the buffer is first copied into
+   * newly allocated memory.
+   * The aliased buffer is never modified.
+   * In an assignment to another UnicodeString, the text will be aliased again,
+   * so that both strings then alias the same readonly-text.
+   *
+   * @param isTerminated specifies if <code>text</code> is <code>NUL</code>-terminated.
+   *                     This must be true if <code>textLength==-1</code>.
+   * @param text The characters to alias for the UnicodeString.
+   * @param textLength The number of Unicode characters in <code>text</code> to alias.
+   *                   If -1, then this constructor will determine the length
+   *                   by calling <code>u_strlen()</code>.
+   * @stable ICU 2.0
+   */
+  UnicodeString(UBool isTerminated,
+                const UChar *text,
+                int32_t textLength);
+
+  /**
+   * Writable-aliasing UChar* constructor.
+   * The text will be used for the UnicodeString object, but
+   * it will not be released when the UnicodeString is destroyed.
+   * This has write-through semantics:
+   * For as long as the capacity of the buffer is sufficient, write operations
+   * will directly affect the buffer. When more capacity is necessary, then
+   * a new buffer will be allocated and the contents copied as with regularly
+   * constructed strings.
+   * In an assignment to another UnicodeString, the buffer will be copied.
+   * The extract(UChar *dst) function detects whether the dst pointer is the same
+   * as the string buffer itself and will in this case not copy the contents.
+   *
+   * @param buffer The characters to alias for the UnicodeString.
+   * @param buffLength The number of Unicode characters in <code>buffer</code> to alias.
+   * @param buffCapacity The size of <code>buffer</code> in UChars.
+   * @stable ICU 2.0
+   */
+  UnicodeString(UChar *buffer, int32_t buffLength, int32_t buffCapacity);
+
+#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
+
+  /**
+   * char* constructor.
+   * @param codepageData an array of bytes, null-terminated,
+   *                     in the platform's default codepage.
+   * @stable ICU 2.0
+   */
+  UnicodeString(const char *codepageData);
+
+  /**
+   * char* constructor.
+   * @param codepageData an array of bytes in the platform's default codepage.
+   * @param dataLength The number of bytes in <TT>codepageData</TT>.
+   * @stable ICU 2.0
+   */
+  UnicodeString(const char *codepageData, int32_t dataLength);
+
+#endif
+
+#if !UCONFIG_NO_CONVERSION
+
+  /**
+   * char* constructor.
+   * @param codepageData an array of bytes, null-terminated
+   * @param codepage the encoding of <TT>codepageData</TT>.  The special
+   * value 0 for <TT>codepage</TT> indicates that the text is in the
+   * platform's default codepage.
+   *
+   * If <code>codepage</code> is an empty string (<code>""</code>),
+   * then a simple conversion is performed on the codepage-invariant
+   * subset ("invariant characters") of the platform encoding. See utypes.h.
+   * Recommendation: For invariant-character strings use the constructor
+   * UnicodeString(const char *src, int32_t length, enum EInvariant inv)
+   * because it avoids object code dependencies of UnicodeString on
+   * the conversion code.
+   *
+   * @stable ICU 2.0
+   */
+  UnicodeString(const char *codepageData, const char *codepage);
+
+  /**
+   * char* constructor.
+   * @param codepageData an array of bytes.
+   * @param dataLength The number of bytes in <TT>codepageData</TT>.
+   * @param codepage the encoding of <TT>codepageData</TT>.  The special
+   * value 0 for <TT>codepage</TT> indicates that the text is in the
+   * platform's default codepage.
+   * If <code>codepage</code> is an empty string (<code>""</code>),
+   * then a simple conversion is performed on the codepage-invariant
+   * subset ("invariant characters") of the platform encoding. See utypes.h.
+   * Recommendation: For invariant-character strings use the constructor
+   * UnicodeString(const char *src, int32_t length, enum EInvariant inv)
+   * because it avoids object code dependencies of UnicodeString on
+   * the conversion code.
+   *
+   * @stable ICU 2.0
+   */
+  UnicodeString(const char *codepageData, int32_t dataLength, const char *codepage);
+
+  /**
+   * char * / UConverter constructor.
+   * This constructor uses an existing UConverter object to
+   * convert the codepage string to Unicode and construct a UnicodeString
+   * from that.
+   *
+   * The converter is reset at first.
+   * If the error code indicates a failure before this constructor is called,
+   * or if an error occurs during conversion or construction,
+   * then the string will be bogus.
+   *
+   * This function avoids the overhead of opening and closing a converter if
+   * multiple strings are constructed.
+   *
+   * @param src input codepage string
+   * @param srcLength length of the input string, can be -1 for NUL-terminated strings
+   * @param cnv converter object (ucnv_resetToUnicode() will be called),
+   *        can be NULL for the default converter
+   * @param errorCode normal ICU error code
+   * @stable ICU 2.0
+   */
+  UnicodeString(
+        const char *src, int32_t srcLength,
+        UConverter *cnv,
+        UErrorCode &errorCode);
+
+#endif
+
+  /**
+   * Constructs a Unicode string from an invariant-character char * string.
+   * About invariant characters see utypes.h.
+   * This constructor has no runtime dependency on conversion code and is
+   * therefore recommended over ones taking a charset name string
+   * (where the empty string "" indicates invariant-character conversion).
+   *
+   * Use the macro US_INV as the third, signature-distinguishing parameter.
+   *
+   * For example:
+   * \code
+   * void fn(const char *s) {
+   *   UnicodeString ustr(s, -1, US_INV);
+   *   // use ustr ...
+   * }
+   * \endcode
+   *
+   * @param src String using only invariant characters.
+   * @param length Length of src, or -1 if NUL-terminated.
+   * @param inv Signature-distinguishing paramater, use US_INV.
+   *
+   * @see US_INV
+   * @stable ICU 3.2
+   */
+  UnicodeString(const char *src, int32_t length, enum EInvariant inv);
+
+
+  /**
+   * Copy constructor.
+   * @param that The UnicodeString object to copy.
+   * @stable ICU 2.0
+   */
+  UnicodeString(const UnicodeString& that);
+
+  /**
+   * 'Substring' constructor from tail of source string.
+   * @param src The UnicodeString object to copy.
+   * @param srcStart The offset into <tt>src</tt> at which to start copying.
+   * @stable ICU 2.2
+   */
+  UnicodeString(const UnicodeString& src, int32_t srcStart);
+
+  /**
+   * 'Substring' constructor from subrange of source string.
+   * @param src The UnicodeString object to copy.
+   * @param srcStart The offset into <tt>src</tt> at which to start copying.
+   * @param srcLength The number of characters from <tt>src</tt> to copy.
+   * @stable ICU 2.2
+   */
+  UnicodeString(const UnicodeString& src, int32_t srcStart, int32_t srcLength);
+
+  /**
+   * Clone this object, an instance of a subclass of Replaceable.
+   * Clones can be used concurrently in multiple threads.
+   * If a subclass does not implement clone(), or if an error occurs,
+   * then NULL is returned.
+   * The clone functions in all subclasses return a pointer to a Replaceable
+   * because some compilers do not support covariant (same-as-this)
+   * return types; cast to the appropriate subclass if necessary.
+   * The caller must delete the clone.
+   *
+   * @return a clone of this object
+   *
+   * @see Replaceable::clone
+   * @see getDynamicClassID
+   * @stable ICU 2.6
+   */
+  virtual Replaceable *clone() const;
+
+  /** Destructor.
+   * @stable ICU 2.0
+   */
+  virtual ~UnicodeString();
+
+  /**
+   * Create a UnicodeString from a UTF-8 string.
+   * Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string.
+   * Calls u_strFromUTF8WithSub().
+   *
+   * @param utf8 UTF-8 input string.
+   *             Note that a StringPiece can be implicitly constructed
+   *             from a std::string or a NUL-terminated const char * string.
+   * @return A UnicodeString with equivalent UTF-16 contents.
+   * @see toUTF8
+   * @see toUTF8String
+   * @stable ICU 4.2
+   */
+  static UnicodeString fromUTF8(const StringPiece &utf8);
+
+  /**
+   * Create a UnicodeString from a UTF-32 string.
+   * Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string.
+   * Calls u_strFromUTF32WithSub().
+   *
+   * @param utf32 UTF-32 input string. Must not be NULL.
+   * @param length Length of the input string, or -1 if NUL-terminated.
+   * @return A UnicodeString with equivalent UTF-16 contents.
+   * @see toUTF32
+   * @stable ICU 4.2
+   */
+  static UnicodeString fromUTF32(const UChar32 *utf32, int32_t length);
+
+  /* Miscellaneous operations */
+
+  /**
+   * Unescape a string of characters and return a string containing
+   * the result.  The following escape sequences are recognized:
+   *
+   * \\uhhhh       4 hex digits; h in [0-9A-Fa-f]
+   * \\Uhhhhhhhh   8 hex digits
+   * \\xhh         1-2 hex digits
+   * \\ooo         1-3 octal digits; o in [0-7]
+   * \\cX          control-X; X is masked with 0x1F
+   *
+   * as well as the standard ANSI C escapes:
+   *
+   * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A,
+   * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B,
+   * \\&quot; => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C
+   *
+   * Anything else following a backslash is generically escaped.  For
+   * example, "[a\\-z]" returns "[a-z]".
+   *
+   * If an escape sequence is ill-formed, this method returns an empty
+   * string.  An example of an ill-formed sequence is "\\u" followed by
+   * fewer than 4 hex digits.
+   *
+   * This function is similar to u_unescape() but not identical to it.
+   * The latter takes a source char*, so it does escape recognition
+   * and also invariant conversion.
+   *
+   * @return a string with backslash escapes interpreted, or an
+   * empty string on error.
+   * @see UnicodeString#unescapeAt()
+   * @see u_unescape()
+   * @see u_unescapeAt()
+   * @stable ICU 2.0
+   */
+  UnicodeString unescape() const;
+
+  /**
+   * Unescape a single escape sequence and return the represented
+   * character.  See unescape() for a listing of the recognized escape
+   * sequences.  The character at offset-1 is assumed (without
+   * checking) to be a backslash.  If the escape sequence is
+   * ill-formed, or the offset is out of range, (UChar32)0xFFFFFFFF is
+   * returned.
+   *
+   * @param offset an input output parameter.  On input, it is the
+   * offset into this string where the escape sequence is located,
+   * after the initial backslash.  On output, it is advanced after the
+   * last character parsed.  On error, it is not advanced at all.
+   * @return the character represented by the escape sequence at
+   * offset, or (UChar32)0xFFFFFFFF on error.
+   * @see UnicodeString#unescape()
+   * @see u_unescape()
+   * @see u_unescapeAt()
+   * @stable ICU 2.0
+   */
+  UChar32 unescapeAt(int32_t &offset) const;
+
+  /**
+   * ICU "poor man's RTTI", returns a UClassID for this class.
+   *
+   * @stable ICU 2.2
+   */
+  static UClassID U_EXPORT2 getStaticClassID();
+
+  /**
+   * ICU "poor man's RTTI", returns a UClassID for the actual class.
+   *
+   * @stable ICU 2.2
+   */
+  virtual UClassID getDynamicClassID() const;
+
+  //========================================
+  // Implementation methods
+  //========================================
+
+protected:
+  /**
+   * Implement Replaceable::getLength() (see jitterbug 1027).
+   * @stable ICU 2.4
+   */
+  virtual int32_t getLength() const;
+
+  /**
+   * The change in Replaceable to use virtual getCharAt() allows
+   * UnicodeString::charAt() to be inline again (see jitterbug 709).
+   * @stable ICU 2.4
+   */
+  virtual UChar getCharAt(int32_t offset) const;
+
+  /**
+   * The change in Replaceable to use virtual getChar32At() allows
+   * UnicodeString::char32At() to be inline again (see jitterbug 709).
+   * @stable ICU 2.4
+   */
+  virtual UChar32 getChar32At(int32_t offset) const;
+
+private:
+  // For char* constructors. Could be made public.
+  UnicodeString &setToUTF8(const StringPiece &utf8);
+  // For extract(char*).
+  // We could make a toUTF8(target, capacity, errorCode) public but not
+  // this version: New API will be cleaner if we make callers create substrings
+  // rather than having start+length on every method,
+  // and it should take a UErrorCode&.
+  int32_t
+  toUTF8(int32_t start, int32_t len,
+         char *target, int32_t capacity) const;
+
+
+  inline int8_t
+  doCompare(int32_t start,
+           int32_t length,
+           const UnicodeString& srcText,
+           int32_t srcStart,
+           int32_t srcLength) const;
+
+  int8_t doCompare(int32_t start,
+           int32_t length,
+           const UChar *srcChars,
+           int32_t srcStart,
+           int32_t srcLength) const;
+
+  inline int8_t
+  doCompareCodePointOrder(int32_t start,
+                          int32_t length,
+                          const UnicodeString& srcText,
+                          int32_t srcStart,
+                          int32_t srcLength) const;
+
+  int8_t doCompareCodePointOrder(int32_t start,
+                                 int32_t length,
+                                 const UChar *srcChars,
+                                 int32_t srcStart,
+                                 int32_t srcLength) const;
+
+  inline int8_t
+  doCaseCompare(int32_t start,
+                int32_t length,
+                const UnicodeString &srcText,
+                int32_t srcStart,
+                int32_t srcLength,
+                uint32_t options) const;
+
+  int8_t
+  doCaseCompare(int32_t start,
+                int32_t length,
+                const UChar *srcChars,
+                int32_t srcStart,
+                int32_t srcLength,
+                uint32_t options) const;
+
+  int32_t doIndexOf(UChar c,
+            int32_t start,
+            int32_t length) const;
+
+  int32_t doIndexOf(UChar32 c,
+                        int32_t start,
+                        int32_t length) const;
+
+  int32_t doLastIndexOf(UChar c,
+                int32_t start,
+                int32_t length) const;
+
+  int32_t doLastIndexOf(UChar32 c,
+                            int32_t start,
+                            int32_t length) const;
+
+  void doExtract(int32_t start,
+         int32_t length,
+         UChar *dst,
+         int32_t dstStart) const;
+
+  inline void doExtract(int32_t start,
+         int32_t length,
+         UnicodeString& target) const;
+
+  inline UChar doCharAt(int32_t offset)  const;
+
+  UnicodeString& doReplace(int32_t start,
+               int32_t length,
+               const UnicodeString& srcText,
+               int32_t srcStart,
+               int32_t srcLength);
+
+  UnicodeString& doReplace(int32_t start,
+               int32_t length,
+               const UChar *srcChars,
+               int32_t srcStart,
+               int32_t srcLength);
+
+  UnicodeString& doReverse(int32_t start,
+               int32_t length);
+
+  // calculate hash code
+  int32_t doHashCode(void) const;
+
+  // get pointer to start of array
+  // these do not check for kOpenGetBuffer, unlike the public getBuffer() function
+  inline UChar* getArrayStart(void);
+  inline const UChar* getArrayStart(void) const;
+
+  // A UnicodeString object (not necessarily its current buffer)
+  // is writable unless it isBogus() or it has an "open" getBuffer(minCapacity).
+  inline UBool isWritable() const;
+
+  // Is the current buffer writable?
+  inline UBool isBufferWritable() const;
+
+  // None of the following does releaseArray().
+  inline void setLength(int32_t len);        // sets only fShortLength and fLength
+  inline void setToEmpty();                  // sets fFlags=kShortString
+  inline void setArray(UChar *array, int32_t len, int32_t capacity); // does not set fFlags
+
+  // allocate the array; result may be fStackBuffer
+  // sets refCount to 1 if appropriate
+  // sets fArray, fCapacity, and fFlags
+  // returns boolean for success or failure
+  UBool allocate(int32_t capacity);
+
+  // release the array if owned
+  void releaseArray(void);
+
+  // turn a bogus string into an empty one
+  void unBogus();
+
+  // implements assigment operator, copy constructor, and fastCopyFrom()
+  UnicodeString &copyFrom(const UnicodeString &src, UBool fastCopy=FALSE);
+
+  // Pin start and limit to acceptable values.
+  inline void pinIndex(int32_t& start) const;
+  inline void pinIndices(int32_t& start,
+                         int32_t& length) const;
+
+#if !UCONFIG_NO_CONVERSION
+
+  /* Internal extract() using UConverter. */
+  int32_t doExtract(int32_t start, int32_t length,
+                    char *dest, int32_t destCapacity,
+                    UConverter *cnv,
+                    UErrorCode &errorCode) const;
+
+  /*
+   * Real constructor for converting from codepage data.
+   * It assumes that it is called with !fRefCounted.
+   *
+   * If <code>codepage==0</code>, then the default converter
+   * is used for the platform encoding.
+   * If <code>codepage</code> is an empty string (<code>""</code>),
+   * then a simple conversion is performed on the codepage-invariant
+   * subset ("invariant characters") of the platform encoding. See utypes.h.
+   */
+  void doCodepageCreate(const char *codepageData,
+                        int32_t dataLength,
+                        const char *codepage);
+
+  /*
+   * Worker function for creating a UnicodeString from
+   * a codepage string using a UConverter.
+   */
+  void
+  doCodepageCreate(const char *codepageData,
+                   int32_t dataLength,
+                   UConverter *converter,
+                   UErrorCode &status);
+
+#endif
+
+  /*
+   * This function is called when write access to the array
+   * is necessary.
+   *
+   * We need to make a copy of the array if
+   * the buffer is read-only, or
+   * the buffer is refCounted (shared), and refCount>1, or
+   * the buffer is too small.
+   *
+   * Return FALSE if memory could not be allocated.
+   */
+  UBool cloneArrayIfNeeded(int32_t newCapacity = -1,
+                            int32_t growCapacity = -1,
+                            UBool doCopyArray = TRUE,
+                            int32_t **pBufferToDelete = 0,
+                            UBool forceClone = FALSE);
+
+  // common function for case mappings
+  UnicodeString &
+  caseMap(BreakIterator *titleIter,
+          const char *locale,
+          uint32_t options,
+          int32_t toWhichCase);
+
+  // ref counting
+  void addRef(void);
+  int32_t removeRef(void);
+  int32_t refCount(void) const;
+
+  // constants
+  enum {
+    // Set the stack buffer size so that sizeof(UnicodeString) is a multiple of sizeof(pointer):
+    // 32-bit pointers: 4+1+1+13*2 = 32 bytes
+    // 64-bit pointers: 8+1+1+15*2 = 40 bytes
+    US_STACKBUF_SIZE= sizeof(void *)==4 ? 13 : 15, // Size of stack buffer for small strings
+    kInvalidUChar=0xffff, // invalid UChar index
+    kGrowSize=128, // grow size for this buffer
+    kInvalidHashCode=0, // invalid hash code
+    kEmptyHashCode=1, // hash code for empty string
+
+    // bit flag values for fFlags
+    kIsBogus=1,         // this string is bogus, i.e., not valid or NULL
+    kUsingStackBuffer=2,// fArray==fStackBuffer
+    kRefCounted=4,      // there is a refCount field before the characters in fArray
+    kBufferIsReadonly=8,// do not write to this buffer
+    kOpenGetBuffer=16,  // getBuffer(minCapacity) was called (is "open"),
+                        // and releaseBuffer(newLength) must be called
+
+    // combined values for convenience
+    kShortString=kUsingStackBuffer,
+    kLongString=kRefCounted,
+    kReadonlyAlias=kBufferIsReadonly,
+    kWritableAlias=0
+  };
+
+  friend class StringThreadTest;
+
+  union StackBufferOrFields;        // forward declaration necessary before friend declaration
+  friend union StackBufferOrFields; // make US_STACKBUF_SIZE visible inside fUnion
+
+  /*
+   * The following are all the class fields that are stored
+   * in each UnicodeString object.
+   * Note that UnicodeString has virtual functions,
+   * therefore there is an implicit vtable pointer
+   * as the first real field.
+   * The fields should be aligned such that no padding is
+   * necessary, mostly by having larger types first.
+   * On 32-bit machines, the size should be 32 bytes,
+   * on 64-bit machines (8-byte pointers), it should be 40 bytes.
+   */
+  // (implicit) *vtable;
+  int8_t    fShortLength;   // 0..127: length  <0: real length is in fUnion.fFields.fLength
+  uint8_t   fFlags;         // bit flags: see constants above
+  union StackBufferOrFields {
+    // fStackBuffer is used iff (fFlags&kUsingStackBuffer)
+    // else fFields is used
+    UChar     fStackBuffer [US_STACKBUF_SIZE]; // buffer for small strings
+    struct {
+      uint16_t  fPadding;   // align the following field at 8B (32b pointers) or 12B (64b)
+      int32_t   fLength;    // number of characters in fArray if >127; else undefined
+      UChar     *fArray;    // the Unicode data (aligned at 12B (32b pointers) or 16B (64b))
+      int32_t   fCapacity;  // sizeof fArray
+    } fFields;
+  } fUnion;
+};
+
+/**
+ * Create a new UnicodeString with the concatenation of two others.
+ *
+ * @param s1 The first string to be copied to the new one.
+ * @param s2 The second string to be copied to the new one, after s1.
+ * @return UnicodeString(s1).append(s2)
+ * @stable ICU 2.8
+ */
+U_COMMON_API UnicodeString U_EXPORT2
+operator+ (const UnicodeString &s1, const UnicodeString &s2);
+
+//========================================
+// Inline members
+//========================================
+
+//========================================
+// Privates
+//========================================
+
+inline void
+UnicodeString::pinIndex(int32_t& start) const
+{
+  // pin index
+  if(start < 0) {
+    start = 0;
+  } else if(start > length()) {
+    start = length();
+  }
+}
+
+inline void
+UnicodeString::pinIndices(int32_t& start,
+                          int32_t& _length) const
+{
+  // pin indices
+  int32_t len = length();
+  if(start < 0) {
+    start = 0;
+  } else if(start > len) {
+    start = len;
+  }
+  if(_length < 0) {
+    _length = 0;
+  } else if(_length > (len - start)) {
+    _length = (len - start);
+  }
+}
+
+inline UChar*
+UnicodeString::getArrayStart()
+{ return (fFlags&kUsingStackBuffer) ? fUnion.fStackBuffer : fUnion.fFields.fArray; }
+
+inline const UChar*
+UnicodeString::getArrayStart() const
+{ return (fFlags&kUsingStackBuffer) ? fUnion.fStackBuffer : fUnion.fFields.fArray; }
+
+//========================================
+// Read-only implementation methods
+//========================================
+inline int32_t
+UnicodeString::length() const
+{ return fShortLength>=0 ? fShortLength : fUnion.fFields.fLength; }
+
+inline int32_t
+UnicodeString::getCapacity() const
+{ return (fFlags&kUsingStackBuffer) ? US_STACKBUF_SIZE : fUnion.fFields.fCapacity; }
+
+inline int32_t
+UnicodeString::hashCode() const
+{ return doHashCode(); }
+
+inline UBool
+UnicodeString::isBogus() const
+{ return (UBool)(fFlags & kIsBogus); }
+
+inline UBool
+UnicodeString::isWritable() const
+{ return (UBool)!(fFlags&(kOpenGetBuffer|kIsBogus)); }
+
+inline UBool
+UnicodeString::isBufferWritable() const
+{
+  return (UBool)(
+      !(fFlags&(kOpenGetBuffer|kIsBogus|kBufferIsReadonly)) &&
+      (!(fFlags&kRefCounted) || refCount()==1));
+}
+
+inline const UChar *
+UnicodeString::getBuffer() const {
+  if(fFlags&(kIsBogus|kOpenGetBuffer)) {
+    return 0;
+  } else if(fFlags&kUsingStackBuffer) {
+    return fUnion.fStackBuffer;
+  } else {
+    return fUnion.fFields.fArray;
+  }
+}
+
+//========================================
+// Read-only alias methods
+//========================================
+inline int8_t
+UnicodeString::doCompare(int32_t start,
+              int32_t thisLength,
+              const UnicodeString& srcText,
+              int32_t srcStart,
+              int32_t srcLength) const
+{
+  if(srcText.isBogus()) {
+    return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise
+  } else {
+    srcText.pinIndices(srcStart, srcLength);
+    return doCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength);
+  }
+}
+
+inline UBool
+UnicodeString::operator== (const UnicodeString& text) const
+{
+  if(isBogus()) {
+    return text.isBogus();
+  } else {
+    int32_t len = length(), textLength = text.length();
+    return
+      !text.isBogus() &&
+      len == textLength &&
+      doCompare(0, len, text, 0, textLength) == 0;
+  }
+}
+
+inline UBool
+UnicodeString::operator!= (const UnicodeString& text) const
+{ return (! operator==(text)); }
+
+inline UBool
+UnicodeString::operator> (const UnicodeString& text) const
+{ return doCompare(0, length(), text, 0, text.length()) == 1; }
+
+inline UBool
+UnicodeString::operator< (const UnicodeString& text) const
+{ return doCompare(0, length(), text, 0, text.length()) == -1; }
+
+inline UBool
+UnicodeString::operator>= (const UnicodeString& text) const
+{ return doCompare(0, length(), text, 0, text.length()) != -1; }
+
+inline UBool
+UnicodeString::operator<= (const UnicodeString& text) const
+{ return doCompare(0, length(), text, 0, text.length()) != 1; }
+
+inline int8_t
+UnicodeString::compare(const UnicodeString& text) const
+{ return doCompare(0, length(), text, 0, text.length()); }
+
+inline int8_t
+UnicodeString::compare(int32_t start,
+               int32_t _length,
+               const UnicodeString& srcText) const
+{ return doCompare(start, _length, srcText, 0, srcText.length()); }
+
+inline int8_t
+UnicodeString::compare(const UChar *srcChars,
+               int32_t srcLength) const
+{ return doCompare(0, length(), srcChars, 0, srcLength); }
+
+inline int8_t
+UnicodeString::compare(int32_t start,
+               int32_t _length,
+               const UnicodeString& srcText,
+               int32_t srcStart,
+               int32_t srcLength) const
+{ return doCompare(start, _length, srcText, srcStart, srcLength); }
+
+inline int8_t
+UnicodeString::compare(int32_t start,
+               int32_t _length,
+               const UChar *srcChars) const
+{ return doCompare(start, _length, srcChars, 0, _length); }
+
+inline int8_t
+UnicodeString::compare(int32_t start,
+               int32_t _length,
+               const UChar *srcChars,
+               int32_t srcStart,
+               int32_t srcLength) const
+{ return doCompare(start, _length, srcChars, srcStart, srcLength); }
+
+inline int8_t
+UnicodeString::compareBetween(int32_t start,
+                  int32_t limit,
+                  const UnicodeString& srcText,
+                  int32_t srcStart,
+                  int32_t srcLimit) const
+{ return doCompare(start, limit - start,
+           srcText, srcStart, srcLimit - srcStart); }
+
+inline int8_t
+UnicodeString::doCompareCodePointOrder(int32_t start,
+                                       int32_t thisLength,
+                                       const UnicodeString& srcText,
+                                       int32_t srcStart,
+                                       int32_t srcLength) const
+{
+  if(srcText.isBogus()) {
+    return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise
+  } else {
+    srcText.pinIndices(srcStart, srcLength);
+    return doCompareCodePointOrder(start, thisLength, srcText.getArrayStart(), srcStart, srcLength);
+  }
+}
+
+inline int8_t
+UnicodeString::compareCodePointOrder(const UnicodeString& text) const
+{ return doCompareCodePointOrder(0, length(), text, 0, text.length()); }
+
+inline int8_t
+UnicodeString::compareCodePointOrder(int32_t start,
+                                     int32_t _length,
+                                     const UnicodeString& srcText) const
+{ return doCompareCodePointOrder(start, _length, srcText, 0, srcText.length()); }
+
+inline int8_t
+UnicodeString::compareCodePointOrder(const UChar *srcChars,
+                                     int32_t srcLength) const
+{ return doCompareCodePointOrder(0, length(), srcChars, 0, srcLength); }
+
+inline int8_t
+UnicodeString::compareCodePointOrder(int32_t start,
+                                     int32_t _length,
+                                     const UnicodeString& srcText,
+                                     int32_t srcStart,
+                                     int32_t srcLength) const
+{ return doCompareCodePointOrder(start, _length, srcText, srcStart, srcLength); }
+
+inline int8_t
+UnicodeString::compareCodePointOrder(int32_t start,
+                                     int32_t _length,
+                                     const UChar *srcChars) const
+{ return doCompareCodePointOrder(start, _length, srcChars, 0, _length); }
+
+inline int8_t
+UnicodeString::compareCodePointOrder(int32_t start,
+                                     int32_t _length,
+                                     const UChar *srcChars,
+                                     int32_t srcStart,
+                                     int32_t srcLength) const
+{ return doCompareCodePointOrder(start, _length, srcChars, srcStart, srcLength); }
+
+inline int8_t
+UnicodeString::compareCodePointOrderBetween(int32_t start,
+                                            int32_t limit,
+                                            const UnicodeString& srcText,
+                                            int32_t srcStart,
+                                            int32_t srcLimit) const
+{ return doCompareCodePointOrder(start, limit - start,
+           srcText, srcStart, srcLimit - srcStart); }
+
+inline int8_t
+UnicodeString::doCaseCompare(int32_t start,
+                             int32_t thisLength,
+                             const UnicodeString &srcText,
+                             int32_t srcStart,
+                             int32_t srcLength,
+                             uint32_t options) const
+{
+  if(srcText.isBogus()) {
+    return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise
+  } else {
+    srcText.pinIndices(srcStart, srcLength);
+    return doCaseCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength, options);
+  }
+}
+
+inline int8_t
+UnicodeString::caseCompare(const UnicodeString &text, uint32_t options) const {
+  return doCaseCompare(0, length(), text, 0, text.length(), options);
+}
+
+inline int8_t
+UnicodeString::caseCompare(int32_t start,
+                           int32_t _length,
+                           const UnicodeString &srcText,
+                           uint32_t options) const {
+  return doCaseCompare(start, _length, srcText, 0, srcText.length(), options);
+}
+
+inline int8_t
+UnicodeString::caseCompare(const UChar *srcChars,
+                           int32_t srcLength,
+                           uint32_t options) const {
+  return doCaseCompare(0, length(), srcChars, 0, srcLength, options);
+}
+
+inline int8_t
+UnicodeString::caseCompare(int32_t start,
+                           int32_t _length,
+                           const UnicodeString &srcText,
+                           int32_t srcStart,
+                           int32_t srcLength,
+                           uint32_t options) const {
+  return doCaseCompare(start, _length, srcText, srcStart, srcLength, options);
+}
+
+inline int8_t
+UnicodeString::caseCompare(int32_t start,
+                           int32_t _length,
+                           const UChar *srcChars,
+                           uint32_t options) const {
+  return doCaseCompare(start, _length, srcChars, 0, _length, options);
+}
+
+inline int8_t
+UnicodeString::caseCompare(int32_t start,
+                           int32_t _length,
+                           const UChar *srcChars,
+                           int32_t srcStart,
+                           int32_t srcLength,
+                           uint32_t options) const {
+  return doCaseCompare(start, _length, srcChars, srcStart, srcLength, options);
+}
+
+inline int8_t
+UnicodeString::caseCompareBetween(int32_t start,
+                                  int32_t limit,
+                                  const UnicodeString &srcText,
+                                  int32_t srcStart,
+                                  int32_t srcLimit,
+                                  uint32_t options) const {
+  return doCaseCompare(start, limit - start, srcText, srcStart, srcLimit - srcStart, options);
+}
+
+inline int32_t
+UnicodeString::indexOf(const UnicodeString& srcText,
+               int32_t srcStart,
+               int32_t srcLength,
+               int32_t start,
+               int32_t _length) const
+{
+  if(!srcText.isBogus()) {
+    srcText.pinIndices(srcStart, srcLength);
+    if(srcLength > 0) {
+      return indexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length);
+    }
+  }
+  return -1;
+}
+
+inline int32_t
+UnicodeString::indexOf(const UnicodeString& text) const
+{ return indexOf(text, 0, text.length(), 0, length()); }
+
+inline int32_t
+UnicodeString::indexOf(const UnicodeString& text,
+               int32_t start) const {
+  pinIndex(start);
+  return indexOf(text, 0, text.length(), start, length() - start);
+}
+
+inline int32_t
+UnicodeString::indexOf(const UnicodeString& text,
+               int32_t start,
+               int32_t _length) const
+{ return indexOf(text, 0, text.length(), start, _length); }
+
+inline int32_t
+UnicodeString::indexOf(const UChar *srcChars,
+               int32_t srcLength,
+               int32_t start) const {
+  pinIndex(start);
+  return indexOf(srcChars, 0, srcLength, start, length() - start);
+}
+
+inline int32_t
+UnicodeString::indexOf(const UChar *srcChars,
+               int32_t srcLength,
+               int32_t start,
+               int32_t _length) const
+{ return indexOf(srcChars, 0, srcLength, start, _length); }
+
+inline int32_t
+UnicodeString::indexOf(UChar c,
+               int32_t start,
+               int32_t _length) const
+{ return doIndexOf(c, start, _length); }
+
+inline int32_t
+UnicodeString::indexOf(UChar32 c,
+               int32_t start,
+               int32_t _length) const
+{ return doIndexOf(c, start, _length); }
+
+inline int32_t
+UnicodeString::indexOf(UChar c) const
+{ return doIndexOf(c, 0, length()); }
+
+inline int32_t
+UnicodeString::indexOf(UChar32 c) const
+{ return indexOf(c, 0, length()); }
+
+inline int32_t
+UnicodeString::indexOf(UChar c,
+               int32_t start) const {
+  pinIndex(start);
+  return doIndexOf(c, start, length() - start);
+}
+
+inline int32_t
+UnicodeString::indexOf(UChar32 c,
+               int32_t start) const {
+  pinIndex(start);
+  return indexOf(c, start, length() - start);
+}
+
+inline int32_t
+UnicodeString::lastIndexOf(const UChar *srcChars,
+               int32_t srcLength,
+               int32_t start,
+               int32_t _length) const
+{ return lastIndexOf(srcChars, 0, srcLength, start, _length); }
+
+inline int32_t
+UnicodeString::lastIndexOf(const UChar *srcChars,
+               int32_t srcLength,
+               int32_t start) const {
+  pinIndex(start);
+  return lastIndexOf(srcChars, 0, srcLength, start, length() - start);
+}
+
+inline int32_t
+UnicodeString::lastIndexOf(const UnicodeString& srcText,
+               int32_t srcStart,
+               int32_t srcLength,
+               int32_t start,
+               int32_t _length) const
+{
+  if(!srcText.isBogus()) {
+    srcText.pinIndices(srcStart, srcLength);
+    if(srcLength > 0) {
+      return lastIndexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length);
+    }
+  }
+  return -1;
+}
+
+inline int32_t
+UnicodeString::lastIndexOf(const UnicodeString& text,
+               int32_t start,
+               int32_t _length) const
+{ return lastIndexOf(text, 0, text.length(), start, _length); }
+
+inline int32_t
+UnicodeString::lastIndexOf(const UnicodeString& text,
+               int32_t start) const {
+  pinIndex(start);
+  return lastIndexOf(text, 0, text.length(), start, length() - start);
+}
+
+inline int32_t
+UnicodeString::lastIndexOf(const UnicodeString& text) const
+{ return lastIndexOf(text, 0, text.length(), 0, length()); }
+
+inline int32_t
+UnicodeString::lastIndexOf(UChar c,
+               int32_t start,
+               int32_t _length) const
+{ return doLastIndexOf(c, start, _length); }
+
+inline int32_t
+UnicodeString::lastIndexOf(UChar32 c,
+               int32_t start,
+               int32_t _length) const {
+  return doLastIndexOf(c, start, _length);
+}
+
+inline int32_t
+UnicodeString::lastIndexOf(UChar c) const
+{ return doLastIndexOf(c, 0, length()); }
+
+inline int32_t
+UnicodeString::lastIndexOf(UChar32 c) const {
+  return lastIndexOf(c, 0, length());
+}
+
+inline int32_t
+UnicodeString::lastIndexOf(UChar c,
+               int32_t start) const {
+  pinIndex(start);
+  return doLastIndexOf(c, start, length() - start);
+}
+
+inline int32_t
+UnicodeString::lastIndexOf(UChar32 c,
+               int32_t start) const {
+  pinIndex(start);
+  return lastIndexOf(c, start, length() - start);
+}
+
+inline UBool
+UnicodeString::startsWith(const UnicodeString& text) const
+{ return compare(0, text.length(), text, 0, text.length()) == 0; }
+
+inline UBool
+UnicodeString::startsWith(const UnicodeString& srcText,
+              int32_t srcStart,
+              int32_t srcLength) const
+{ return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; }
+
+inline UBool
+UnicodeString::startsWith(const UChar *srcChars,
+              int32_t srcLength) const
+{ return doCompare(0, srcLength, srcChars, 0, srcLength) == 0; }
+
+inline UBool
+UnicodeString::startsWith(const UChar *srcChars,
+              int32_t srcStart,
+              int32_t srcLength) const
+{ return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0;}
+
+inline UBool
+UnicodeString::endsWith(const UnicodeString& text) const
+{ return doCompare(length() - text.length(), text.length(),
+           text, 0, text.length()) == 0; }
+
+inline UBool
+UnicodeString::endsWith(const UnicodeString& srcText,
+            int32_t srcStart,
+            int32_t srcLength) const {
+  srcText.pinIndices(srcStart, srcLength);
+  return doCompare(length() - srcLength, srcLength,
+                   srcText, srcStart, srcLength) == 0;
+}
+
+inline UBool
+UnicodeString::endsWith(const UChar *srcChars,
+            int32_t srcLength) const {
+  if(srcLength < 0) {
+    srcLength = u_strlen(srcChars);
+  }
+  return doCompare(length() - srcLength, srcLength,
+                   srcChars, 0, srcLength) == 0;
+}
+
+inline UBool
+UnicodeString::endsWith(const UChar *srcChars,
+            int32_t srcStart,
+            int32_t srcLength) const {
+  if(srcLength < 0) {
+    srcLength = u_strlen(srcChars + srcStart);
+  }
+  return doCompare(length() - srcLength, srcLength,
+                   srcChars, srcStart, srcLength) == 0;
+}
+
+//========================================
+// replace
+//========================================
+inline UnicodeString&
+UnicodeString::replace(int32_t start,
+               int32_t _length,
+               const UnicodeString& srcText)
+{ return doReplace(start, _length, srcText, 0, srcText.length()); }
+
+inline UnicodeString&
+UnicodeString::replace(int32_t start,
+               int32_t _length,
+               const UnicodeString& srcText,
+               int32_t srcStart,
+               int32_t srcLength)
+{ return doReplace(start, _length, srcText, srcStart, srcLength); }
+
+inline UnicodeString&
+UnicodeString::replace(int32_t start,
+               int32_t _length,
+               const UChar *srcChars,
+               int32_t srcLength)
+{ return doReplace(start, _length, srcChars, 0, srcLength); }
+
+inline UnicodeString&
+UnicodeString::replace(int32_t start,
+               int32_t _length,
+               const UChar *srcChars,
+               int32_t srcStart,
+               int32_t srcLength)
+{ return doReplace(start, _length, srcChars, srcStart, srcLength); }
+
+inline UnicodeString&
+UnicodeString::replace(int32_t start,
+               int32_t _length,
+               UChar srcChar)
+{ return doReplace(start, _length, &srcChar, 0, 1); }
+
+inline UnicodeString&
+UnicodeString::replace(int32_t start,
+               int32_t _length,
+               UChar32 srcChar) {
+  UChar buffer[U16_MAX_LENGTH];
+  int32_t count = 0;
+  UBool isError = FALSE;
+  U16_APPEND(buffer, count, U16_MAX_LENGTH, srcChar, isError);
+  return doReplace(start, _length, buffer, 0, count);
+}
+
+inline UnicodeString&
+UnicodeString::replaceBetween(int32_t start,
+                  int32_t limit,
+                  const UnicodeString& srcText)
+{ return doReplace(start, limit - start, srcText, 0, srcText.length()); }
+
+inline UnicodeString&
+UnicodeString::replaceBetween(int32_t start,
+                  int32_t limit,
+                  const UnicodeString& srcText,
+                  int32_t srcStart,
+                  int32_t srcLimit)
+{ return doReplace(start, limit - start, srcText, srcStart, srcLimit - srcStart); }
+
+inline UnicodeString&
+UnicodeString::findAndReplace(const UnicodeString& oldText,
+                  const UnicodeString& newText)
+{ return findAndReplace(0, length(), oldText, 0, oldText.length(),
+            newText, 0, newText.length()); }
+
+inline UnicodeString&
+UnicodeString::findAndReplace(int32_t start,
+                  int32_t _length,
+                  const UnicodeString& oldText,
+                  const UnicodeString& newText)
+{ return findAndReplace(start, _length, oldText, 0, oldText.length(),
+            newText, 0, newText.length()); }
+
+// ============================
+// extract
+// ============================
+inline void
+UnicodeString::doExtract(int32_t start,
+             int32_t _length,
+             UnicodeString& target) const
+{ target.replace(0, target.length(), *this, start, _length); }
+
+inline void
+UnicodeString::extract(int32_t start,
+               int32_t _length,
+               UChar *target,
+               int32_t targetStart) const
+{ doExtract(start, _length, target, targetStart); }
+
+inline void
+UnicodeString::extract(int32_t start,
+               int32_t _length,
+               UnicodeString& target) const
+{ doExtract(start, _length, target); }
+
+#if !UCONFIG_NO_CONVERSION
+
+inline int32_t
+UnicodeString::extract(int32_t start,
+               int32_t _length,
+               char *dst,
+               const char *codepage) const
+
+{
+  // This dstSize value will be checked explicitly
+  // Removed #if defined(__GNUC__) per ICU defect http://bugs.icu-project.org/trac/ticket/8197
+  return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage);
+}
+#endif
+
+inline void
+UnicodeString::extractBetween(int32_t start,
+                  int32_t limit,
+                  UChar *dst,
+                  int32_t dstStart) const {
+  pinIndex(start);
+  pinIndex(limit);
+  doExtract(start, limit - start, dst, dstStart);
+}
+
+inline UnicodeString
+UnicodeString::tempSubStringBetween(int32_t start, int32_t limit) const {
+    return tempSubString(start, limit - start);
+}
+
+inline UChar
+UnicodeString::doCharAt(int32_t offset) const
+{
+  if((uint32_t)offset < (uint32_t)length()) {
+    return getArrayStart()[offset];
+  } else {
+    return kInvalidUChar;
+  }
+}
+
+inline UChar
+UnicodeString::charAt(int32_t offset) const
+{ return doCharAt(offset); }
+
+inline UChar
+UnicodeString::operator[] (int32_t offset) const
+{ return doCharAt(offset); }
+
+inline UChar32
+UnicodeString::char32At(int32_t offset) const
+{
+  int32_t len = length();
+  if((uint32_t)offset < (uint32_t)len) {
+    const UChar *array = getArrayStart();
+    UChar32 c;
+    U16_GET(array, 0, offset, len, c);
+    return c;
+  } else {
+    return kInvalidUChar;
+  }
+}
+
+inline int32_t
+UnicodeString::getChar32Start(int32_t offset) const {
+  if((uint32_t)offset < (uint32_t)length()) {
+    const UChar *array = getArrayStart();
+    U16_SET_CP_START(array, 0, offset);
+    return offset;
+  } else {
+    return 0;
+  }
+}
+
+inline int32_t
+UnicodeString::getChar32Limit(int32_t offset) const {
+  int32_t len = length();
+  if((uint32_t)offset < (uint32_t)len) {
+    const UChar *array = getArrayStart();
+    U16_SET_CP_LIMIT(array, 0, offset, len);
+    return offset;
+  } else {
+    return len;
+  }
+}
+
+inline UBool
+UnicodeString::isEmpty() const {
+  return fShortLength == 0;
+}
+
+//========================================
+// Write implementation methods
+//========================================
+inline void
+UnicodeString::setLength(int32_t len) {
+  if(len <= 127) {
+    fShortLength = (int8_t)len;
+  } else {
+    fShortLength = (int8_t)-1;
+    fUnion.fFields.fLength = len;
+  }
+}
+
+inline void
+UnicodeString::setToEmpty() {
+  fShortLength = 0;
+  fFlags = kShortString;
+}
+
+inline void
+UnicodeString::setArray(UChar *array, int32_t len, int32_t capacity) {
+  setLength(len);
+  fUnion.fFields.fArray = array;
+  fUnion.fFields.fCapacity = capacity;
+}
+
+inline const UChar *
+UnicodeString::getTerminatedBuffer() {
+  if(!isWritable()) {
+    return 0;
+  } else {
+    UChar *array = getArrayStart();
+    int32_t len = length();
+    if(len < getCapacity() && ((fFlags&kRefCounted) == 0 || refCount() == 1)) {
+      /*
+       * kRefCounted: Do not write the NUL if the buffer is shared.
+       * That is mostly safe, except when the length of one copy was modified
+       * without copy-on-write, e.g., via truncate(newLength) or remove(void).
+       * Then the NUL would be written into the middle of another copy's string.
+       */
+      if(!(fFlags&kBufferIsReadonly)) {
+        /*
+         * We must not write to a readonly buffer, but it is known to be
+         * NUL-terminated if len<capacity.
+         * A shared, allocated buffer (refCount()>1) must not have its contents
+         * modified, but the NUL at [len] is beyond the string contents,
+         * and multiple string objects and threads writing the same NUL into the
+         * same location is harmless.
+         * In all other cases, the buffer is fully writable and it is anyway safe
+         * to write the NUL.
+         *
+         * Note: An earlier version of this code tested whether there is a NUL
+         * at [len] already, but, while safe, it generated lots of warnings from
+         * tools like valgrind and Purify.
+         */
+        array[len] = 0;
+      }
+      return array;
+    } else if(cloneArrayIfNeeded(len+1)) {
+      array = getArrayStart();
+      array[len] = 0;
+      return array;
+    } else {
+      return 0;
+    }
+  }
+}
+
+inline UnicodeString&
+UnicodeString::operator= (UChar ch)
+{ return doReplace(0, length(), &ch, 0, 1); }
+
+inline UnicodeString&
+UnicodeString::operator= (UChar32 ch)
+{ return replace(0, length(), ch); }
+
+inline UnicodeString&
+UnicodeString::setTo(const UnicodeString& srcText,
+             int32_t srcStart,
+             int32_t srcLength)
+{
+  unBogus();
+  return doReplace(0, length(), srcText, srcStart, srcLength);
+}
+
+inline UnicodeString&
+UnicodeString::setTo(const UnicodeString& srcText,
+             int32_t srcStart)
+{
+  unBogus();
+  srcText.pinIndex(srcStart);
+  return doReplace(0, length(), srcText, srcStart, srcText.length() - srcStart);
+}
+
+inline UnicodeString&
+UnicodeString::setTo(const UnicodeString& srcText)
+{
+  unBogus();
+  return doReplace(0, length(), srcText, 0, srcText.length());
+}
+
+inline UnicodeString&
+UnicodeString::setTo(const UChar *srcChars,
+             int32_t srcLength)
+{
+  unBogus();
+  return doReplace(0, length(), srcChars, 0, srcLength);
+}
+
+inline UnicodeString&
+UnicodeString::setTo(UChar srcChar)
+{
+  unBogus();
+  return doReplace(0, length(), &srcChar, 0, 1);
+}
+
+inline UnicodeString&
+UnicodeString::setTo(UChar32 srcChar)
+{
+  unBogus();
+  return replace(0, length(), srcChar);
+}
+
+inline UnicodeString&
+UnicodeString::append(const UnicodeString& srcText,
+              int32_t srcStart,
+              int32_t srcLength)
+{ return doReplace(length(), 0, srcText, srcStart, srcLength); }
+
+inline UnicodeString&
+UnicodeString::append(const UnicodeString& srcText)
+{ return doReplace(length(), 0, srcText, 0, srcText.length()); }
+
+inline UnicodeString&
+UnicodeString::append(const UChar *srcChars,
+              int32_t srcStart,
+              int32_t srcLength)
+{ return doReplace(length(), 0, srcChars, srcStart, srcLength); }
+
+inline UnicodeString&
+UnicodeString::append(const UChar *srcChars,
+              int32_t srcLength)
+{ return doReplace(length(), 0, srcChars, 0, srcLength); }
+
+inline UnicodeString&
+UnicodeString::append(UChar srcChar)
+{ return doReplace(length(), 0, &srcChar, 0, 1); }
+
+inline UnicodeString&
+UnicodeString::append(UChar32 srcChar) {
+  UChar buffer[U16_MAX_LENGTH];
+  int32_t _length = 0;
+  UBool isError = FALSE;
+  U16_APPEND(buffer, _length, U16_MAX_LENGTH, srcChar, isError);
+  return doReplace(length(), 0, buffer, 0, _length);
+}
+
+inline UnicodeString&
+UnicodeString::operator+= (UChar ch)
+{ return doReplace(length(), 0, &ch, 0, 1); }
+
+inline UnicodeString&
+UnicodeString::operator+= (UChar32 ch) {
+  return append(ch);
+}
+
+inline UnicodeString&
+UnicodeString::operator+= (const UnicodeString& srcText)
+{ return doReplace(length(), 0, srcText, 0, srcText.length()); }
+
+inline UnicodeString&
+UnicodeString::insert(int32_t start,
+              const UnicodeString& srcText,
+              int32_t srcStart,
+              int32_t srcLength)
+{ return doReplace(start, 0, srcText, srcStart, srcLength); }
+
+inline UnicodeString&
+UnicodeString::insert(int32_t start,
+              const UnicodeString& srcText)
+{ return doReplace(start, 0, srcText, 0, srcText.length()); }
+
+inline UnicodeString&
+UnicodeString::insert(int32_t start,
+              const UChar *srcChars,
+              int32_t srcStart,
+              int32_t srcLength)
+{ return doReplace(start, 0, srcChars, srcStart, srcLength); }
+
+inline UnicodeString&
+UnicodeString::insert(int32_t start,
+              const UChar *srcChars,
+              int32_t srcLength)
+{ return doReplace(start, 0, srcChars, 0, srcLength); }
+
+inline UnicodeString&
+UnicodeString::insert(int32_t start,
+              UChar srcChar)
+{ return doReplace(start, 0, &srcChar, 0, 1); }
+
+inline UnicodeString&
+UnicodeString::insert(int32_t start,
+              UChar32 srcChar)
+{ return replace(start, 0, srcChar); }
+
+
+inline UnicodeString&
+UnicodeString::remove()
+{
+  // remove() of a bogus string makes the string empty and non-bogus
+  // we also un-alias a read-only alias to deal with NUL-termination
+  // issues with getTerminatedBuffer()
+  if(fFlags & (kIsBogus|kBufferIsReadonly)) {
+    setToEmpty();
+  } else {
+    fShortLength = 0;
+  }
+  return *this;
+}
+
+inline UnicodeString&
+UnicodeString::remove(int32_t start,
+             int32_t _length)
+{
+    if(start <= 0 && _length == INT32_MAX) {
+        // remove(guaranteed everything) of a bogus string makes the string empty and non-bogus
+        return remove();
+    }
+    return doReplace(start, _length, NULL, 0, 0);
+}
+
+inline UnicodeString&
+UnicodeString::removeBetween(int32_t start,
+                int32_t limit)
+{ return doReplace(start, limit - start, NULL, 0, 0); }
+
+inline UnicodeString &
+UnicodeString::retainBetween(int32_t start, int32_t limit) {
+  truncate(limit);
+  return doReplace(0, start, NULL, 0, 0);
+}
+
+inline UBool
+UnicodeString::truncate(int32_t targetLength)
+{
+  if(isBogus() && targetLength == 0) {
+    // truncate(0) of a bogus string makes the string empty and non-bogus
+    unBogus();
+    return FALSE;
+  } else if((uint32_t)targetLength < (uint32_t)length()) {
+    setLength(targetLength);
+    if(fFlags&kBufferIsReadonly) {
+      fUnion.fFields.fCapacity = targetLength;  // not NUL-terminated any more
+    }
+    return TRUE;
+  } else {
+    return FALSE;
+  }
+}
+
+inline UnicodeString&
+UnicodeString::reverse()
+{ return doReverse(0, length()); }
+
+inline UnicodeString&
+UnicodeString::reverse(int32_t start,
+               int32_t _length)
+{ return doReverse(start, _length); }
+
+U_NAMESPACE_END
+
+#endif
diff --git a/Source/WTF/icu/unicode/unorm.h b/Source/WTF/icu/unicode/unorm.h
new file mode 100644
index 0000000..fbb7b49
--- /dev/null
+++ b/Source/WTF/icu/unicode/unorm.h
@@ -0,0 +1,561 @@
+/*
+*******************************************************************************
+* Copyright (c) 1996-2010, International Business Machines Corporation
+*               and others. All Rights Reserved.
+*******************************************************************************
+* File unorm.h
+*
+* Created by: Vladimir Weinstein 12052000
+*
+* Modification history :
+*
+* Date        Name        Description
+* 02/01/01    synwee      Added normalization quickcheck enum and method.
+*/
+#ifndef UNORM_H
+#define UNORM_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_NORMALIZATION
+
+#include "unicode/uiter.h"
+#include "unicode/unorm2.h"
+
+/**
+ * \file
+ * \brief C API: Unicode Normalization 
+ *
+ * <h2>Unicode normalization API</h2>
+ *
+ * Note: This API has been replaced by the unorm2.h API and is only available
+ * for backward compatibility. The functions here simply delegate to the
+ * unorm2.h functions, for example unorm2_getInstance() and unorm2_normalize().
+ * There is one exception: The new API does not provide a replacement for unorm_compare().
+ *
+ * <code>unorm_normalize</code> transforms Unicode text into an equivalent composed or
+ * decomposed form, allowing for easier sorting and searching of text.
+ * <code>unorm_normalize</code> supports the standard normalization forms described in
+ * <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode">
+ * Unicode Standard Annex #15: Unicode Normalization Forms</a>.
+ *
+ * Characters with accents or other adornments can be encoded in
+ * several different ways in Unicode.  For example, take the character A-acute.
+ * In Unicode, this can be encoded as a single character (the
+ * "composed" form):
+ *
+ * \code
+ *      00C1    LATIN CAPITAL LETTER A WITH ACUTE
+ * \endcode
+ *
+ * or as two separate characters (the "decomposed" form):
+ *
+ * \code
+ *      0041    LATIN CAPITAL LETTER A
+ *      0301    COMBINING ACUTE ACCENT
+ * \endcode
+ *
+ * To a user of your program, however, both of these sequences should be
+ * treated as the same "user-level" character "A with acute accent".  When you are searching or
+ * comparing text, you must ensure that these two sequences are treated 
+ * equivalently.  In addition, you must handle characters with more than one
+ * accent.  Sometimes the order of a character's combining accents is
+ * significant, while in other cases accent sequences in different orders are
+ * really equivalent.
+ *
+ * Similarly, the string "ffi" can be encoded as three separate letters:
+ *
+ * \code
+ *      0066    LATIN SMALL LETTER F
+ *      0066    LATIN SMALL LETTER F
+ *      0069    LATIN SMALL LETTER I
+ * \endcode
+ *
+ * or as the single character
+ *
+ * \code
+ *      FB03    LATIN SMALL LIGATURE FFI
+ * \endcode
+ *
+ * The ffi ligature is not a distinct semantic character, and strictly speaking
+ * it shouldn't be in Unicode at all, but it was included for compatibility
+ * with existing character sets that already provided it.  The Unicode standard
+ * identifies such characters by giving them "compatibility" decompositions
+ * into the corresponding semantic characters.  When sorting and searching, you
+ * will often want to use these mappings.
+ *
+ * <code>unorm_normalize</code> helps solve these problems by transforming text into the
+ * canonical composed and decomposed forms as shown in the first example above.  
+ * In addition, you can have it perform compatibility decompositions so that 
+ * you can treat compatibility characters the same as their equivalents.
+ * Finally, <code>unorm_normalize</code> rearranges accents into the proper canonical
+ * order, so that you do not have to worry about accent rearrangement on your
+ * own.
+ *
+ * Form FCD, "Fast C or D", is also designed for collation.
+ * It allows to work on strings that are not necessarily normalized
+ * with an algorithm (like in collation) that works under "canonical closure", i.e., it treats precomposed
+ * characters and their decomposed equivalents the same.
+ *
+ * It is not a normalization form because it does not provide for uniqueness of representation. Multiple strings
+ * may be canonically equivalent (their NFDs are identical) and may all conform to FCD without being identical
+ * themselves.
+ *
+ * The form is defined such that the "raw decomposition", the recursive canonical decomposition of each character,
+ * results in a string that is canonically ordered. This means that precomposed characters are allowed for as long
+ * as their decompositions do not need canonical reordering.
+ *
+ * Its advantage for a process like collation is that all NFD and most NFC texts - and many unnormalized texts -
+ * already conform to FCD and do not need to be normalized (NFD) for such a process. The FCD quick check will
+ * return UNORM_YES for most strings in practice.
+ *
+ * unorm_normalize(UNORM_FCD) may be implemented with UNORM_NFD.
+ *
+ * For more details on FCD see the collation design document:
+ * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm
+ *
+ * ICU collation performs either NFD or FCD normalization automatically if normalization
+ * is turned on for the collator object.
+ * Beyond collation and string search, normalized strings may be useful for string equivalence comparisons,
+ * transliteration/transcription, unique representations, etc.
+ *
+ * The W3C generally recommends to exchange texts in NFC.
+ * Note also that most legacy character encodings use only precomposed forms and often do not
+ * encode any combining marks by themselves. For conversion to such character encodings the
+ * Unicode text needs to be normalized to NFC.
+ * For more usage examples, see the Unicode Standard Annex.
+ */
+
+/**
+ * Constants for normalization modes.
+ * @stable ICU 2.0
+ */
+typedef enum {
+  /** No decomposition/composition. @stable ICU 2.0 */
+  UNORM_NONE = 1, 
+  /** Canonical decomposition. @stable ICU 2.0 */
+  UNORM_NFD = 2,
+  /** Compatibility decomposition. @stable ICU 2.0 */
+  UNORM_NFKD = 3,
+  /** Canonical decomposition followed by canonical composition. @stable ICU 2.0 */
+  UNORM_NFC = 4,
+  /** Default normalization. @stable ICU 2.0 */
+  UNORM_DEFAULT = UNORM_NFC, 
+  /** Compatibility decomposition followed by canonical composition. @stable ICU 2.0 */
+  UNORM_NFKC =5,
+  /** "Fast C or D" form. @stable ICU 2.0 */
+  UNORM_FCD = 6,
+
+  /** One more than the highest normalization mode constant. @stable ICU 2.0 */
+  UNORM_MODE_COUNT
+} UNormalizationMode;
+
+/**
+ * Constants for options flags for normalization.
+ * Use 0 for default options,
+ * including normalization according to the Unicode version
+ * that is currently supported by ICU (see u_getUnicodeVersion).
+ * @stable ICU 2.6
+ */
+enum {
+    /**
+     * Options bit set value to select Unicode 3.2 normalization
+     * (except NormalizationCorrections).
+     * At most one Unicode version can be selected at a time.
+     * @stable ICU 2.6
+     */
+    UNORM_UNICODE_3_2=0x20
+};
+
+/**
+ * Lowest-order bit number of unorm_compare() options bits corresponding to
+ * normalization options bits.
+ *
+ * The options parameter for unorm_compare() uses most bits for
+ * itself and for various comparison and folding flags.
+ * The most significant bits, however, are shifted down and passed on
+ * to the normalization implementation.
+ * (That is, from unorm_compare(..., options, ...),
+ * options>>UNORM_COMPARE_NORM_OPTIONS_SHIFT will be passed on to the
+ * internal normalization functions.)
+ *
+ * @see unorm_compare
+ * @stable ICU 2.6
+ */
+#define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20
+
+/**
+ * Normalize a string.
+ * The string will be normalized according the specified normalization mode
+ * and options.
+ * The source and result buffers must not be the same, nor overlap.
+ *
+ * @param source The string to normalize.
+ * @param sourceLength The length of source, or -1 if NUL-terminated.
+ * @param mode The normalization mode; one of UNORM_NONE, 
+ *             UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT.
+ * @param options The normalization options, ORed together (0 for no options).
+ * @param result A pointer to a buffer to receive the result string.
+ *               The result string is NUL-terminated if possible.
+ * @param resultLength The maximum size of result.
+ * @param status A pointer to a UErrorCode to receive any errors.
+ * @return The total buffer size needed; if greater than resultLength,
+ *         the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2 
+unorm_normalize(const UChar *source, int32_t sourceLength,
+                UNormalizationMode mode, int32_t options,
+                UChar *result, int32_t resultLength,
+                UErrorCode *status);
+
+/**
+ * Performing quick check on a string, to quickly determine if the string is 
+ * in a particular normalization format.
+ * Three types of result can be returned UNORM_YES, UNORM_NO or
+ * UNORM_MAYBE. Result UNORM_YES indicates that the argument
+ * string is in the desired normalized format, UNORM_NO determines that
+ * argument string is not in the desired normalized format. A 
+ * UNORM_MAYBE result indicates that a more thorough check is required, 
+ * the user may have to put the string in its normalized form and compare the 
+ * results.
+ *
+ * @param source       string for determining if it is in a normalized format
+ * @param sourcelength length of source to test, or -1 if NUL-terminated
+ * @param mode         which normalization form to test for
+ * @param status       a pointer to a UErrorCode to receive any errors
+ * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
+ *
+ * @see unorm_isNormalized
+ * @stable ICU 2.0
+ */
+U_STABLE UNormalizationCheckResult U_EXPORT2
+unorm_quickCheck(const UChar *source, int32_t sourcelength,
+                 UNormalizationMode mode,
+                 UErrorCode *status);
+
+/**
+ * Performing quick check on a string; same as unorm_quickCheck but
+ * takes an extra options parameter like most normalization functions.
+ *
+ * @param src        String that is to be tested if it is in a normalization format.
+ * @param srcLength  Length of source to test, or -1 if NUL-terminated.
+ * @param mode       Which normalization form to test for.
+ * @param options    The normalization options, ORed together (0 for no options).
+ * @param pErrorCode ICU error code in/out parameter.
+ *                   Must fulfill U_SUCCESS before the function call.
+ * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
+ *
+ * @see unorm_quickCheck
+ * @see unorm_isNormalized
+ * @stable ICU 2.6
+ */
+U_STABLE UNormalizationCheckResult U_EXPORT2
+unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, 
+                            UNormalizationMode mode, int32_t options,
+                            UErrorCode *pErrorCode);
+
+/**
+ * Test if a string is in a given normalization form.
+ * This is semantically equivalent to source.equals(normalize(source, mode)) .
+ *
+ * Unlike unorm_quickCheck(), this function returns a definitive result,
+ * never a "maybe".
+ * For NFD, NFKD, and FCD, both functions work exactly the same.
+ * For NFC and NFKC where quickCheck may return "maybe", this function will
+ * perform further tests to arrive at a TRUE/FALSE result.
+ *
+ * @param src        String that is to be tested if it is in a normalization format.
+ * @param srcLength  Length of source to test, or -1 if NUL-terminated.
+ * @param mode       Which normalization form to test for.
+ * @param pErrorCode ICU error code in/out parameter.
+ *                   Must fulfill U_SUCCESS before the function call.
+ * @return Boolean value indicating whether the source string is in the
+ *         "mode" normalization form.
+ *
+ * @see unorm_quickCheck
+ * @stable ICU 2.2
+ */
+U_STABLE UBool U_EXPORT2
+unorm_isNormalized(const UChar *src, int32_t srcLength,
+                   UNormalizationMode mode,
+                   UErrorCode *pErrorCode);
+
+/**
+ * Test if a string is in a given normalization form; same as unorm_isNormalized but
+ * takes an extra options parameter like most normalization functions.
+ *
+ * @param src        String that is to be tested if it is in a normalization format.
+ * @param srcLength  Length of source to test, or -1 if NUL-terminated.
+ * @param mode       Which normalization form to test for.
+ * @param options    The normalization options, ORed together (0 for no options).
+ * @param pErrorCode ICU error code in/out parameter.
+ *                   Must fulfill U_SUCCESS before the function call.
+ * @return Boolean value indicating whether the source string is in the
+ *         "mode/options" normalization form.
+ *
+ * @see unorm_quickCheck
+ * @see unorm_isNormalized
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength,
+                              UNormalizationMode mode, int32_t options,
+                              UErrorCode *pErrorCode);
+
+/**
+ * Iterative normalization forward.
+ * This function (together with unorm_previous) is somewhat
+ * similar to the C++ Normalizer class (see its non-static functions).
+ *
+ * Iterative normalization is useful when only a small portion of a longer
+ * string/text needs to be processed.
+ *
+ * For example, the likelihood may be high that processing the first 10% of some
+ * text will be sufficient to find certain data.
+ * Another example: When one wants to concatenate two normalized strings and get a
+ * normalized result, it is much more efficient to normalize just a small part of
+ * the result around the concatenation place instead of re-normalizing everything.
+ *
+ * The input text is an instance of the C character iteration API UCharIterator.
+ * It may wrap around a simple string, a CharacterIterator, a Replaceable, or any
+ * other kind of text object.
+ *
+ * If a buffer overflow occurs, then the caller needs to reset the iterator to the
+ * old index and call the function again with a larger buffer - if the caller cares
+ * for the actual output.
+ * Regardless of the output buffer, the iterator will always be moved to the next
+ * normalization boundary.
+ *
+ * This function (like unorm_previous) serves two purposes:
+ *
+ * 1) To find the next boundary so that the normalization of the part of the text
+ * from the current position to that boundary does not affect and is not affected
+ * by the part of the text beyond that boundary.
+ *
+ * 2) To normalize the text up to the boundary.
+ *
+ * The second step is optional, per the doNormalize parameter.
+ * It is omitted for operations like string concatenation, where the two adjacent
+ * string ends need to be normalized together.
+ * In such a case, the output buffer will just contain a copy of the text up to the
+ * boundary.
+ *
+ * pNeededToNormalize is an output-only parameter. Its output value is only defined
+ * if normalization was requested (doNormalize) and successful (especially, no
+ * buffer overflow).
+ * It is useful for operations like a normalizing transliterator, where one would
+ * not want to replace a piece of text if it is not modified.
+ *
+ * If doNormalize==TRUE and pNeededToNormalize!=NULL then *pNeeded... is set TRUE
+ * if the normalization was necessary.
+ *
+ * If doNormalize==FALSE then *pNeededToNormalize will be set to FALSE.
+ *
+ * If the buffer overflows, then *pNeededToNormalize will be undefined;
+ * essentially, whenever U_FAILURE is true (like in buffer overflows), this result
+ * will be undefined.
+ *
+ * @param src The input text in the form of a C character iterator.
+ * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
+ * @param destCapacity The number of UChars that fit into dest.
+ * @param mode The normalization mode.
+ * @param options The normalization options, ORed together (0 for no options).
+ * @param doNormalize Indicates if the source text up to the next boundary
+ *                    is to be normalized (TRUE) or just copied (FALSE).
+ * @param pNeededToNormalize Output flag indicating if the normalization resulted in
+ *                           different text from the input.
+ *                           Not defined if an error occurs including buffer overflow.
+ *                           Always FALSE if !doNormalize.
+ * @param pErrorCode ICU error code in/out parameter.
+ *                   Must fulfill U_SUCCESS before the function call.
+ * @return Length of output (number of UChars) when successful or buffer overflow.
+ *
+ * @see unorm_previous
+ * @see unorm_normalize
+ *
+ * @stable ICU 2.1
+ */
+U_STABLE int32_t U_EXPORT2
+unorm_next(UCharIterator *src,
+           UChar *dest, int32_t destCapacity,
+           UNormalizationMode mode, int32_t options,
+           UBool doNormalize, UBool *pNeededToNormalize,
+           UErrorCode *pErrorCode);
+
+/**
+ * Iterative normalization backward.
+ * This function (together with unorm_next) is somewhat
+ * similar to the C++ Normalizer class (see its non-static functions).
+ * For all details see unorm_next.
+ *
+ * @param src The input text in the form of a C character iterator.
+ * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
+ * @param destCapacity The number of UChars that fit into dest.
+ * @param mode The normalization mode.
+ * @param options The normalization options, ORed together (0 for no options).
+ * @param doNormalize Indicates if the source text up to the next boundary
+ *                    is to be normalized (TRUE) or just copied (FALSE).
+ * @param pNeededToNormalize Output flag indicating if the normalization resulted in
+ *                           different text from the input.
+ *                           Not defined if an error occurs including buffer overflow.
+ *                           Always FALSE if !doNormalize.
+ * @param pErrorCode ICU error code in/out parameter.
+ *                   Must fulfill U_SUCCESS before the function call.
+ * @return Length of output (number of UChars) when successful or buffer overflow.
+ *
+ * @see unorm_next
+ * @see unorm_normalize
+ *
+ * @stable ICU 2.1
+ */
+U_STABLE int32_t U_EXPORT2
+unorm_previous(UCharIterator *src,
+               UChar *dest, int32_t destCapacity,
+               UNormalizationMode mode, int32_t options,
+               UBool doNormalize, UBool *pNeededToNormalize,
+               UErrorCode *pErrorCode);
+
+/**
+ * Concatenate normalized strings, making sure that the result is normalized as well.
+ *
+ * If both the left and the right strings are in
+ * the normalization form according to "mode/options",
+ * then the result will be
+ *
+ * \code
+ *     dest=normalize(left+right, mode, options)
+ * \endcode
+ *
+ * With the input strings already being normalized,
+ * this function will use unorm_next() and unorm_previous()
+ * to find the adjacent end pieces of the input strings.
+ * Only the concatenation of these end pieces will be normalized and
+ * then concatenated with the remaining parts of the input strings.
+ *
+ * It is allowed to have dest==left to avoid copying the entire left string.
+ *
+ * @param left Left source string, may be same as dest.
+ * @param leftLength Length of left source string, or -1 if NUL-terminated.
+ * @param right Right source string. Must not be the same as dest, nor overlap.
+ * @param rightLength Length of right source string, or -1 if NUL-terminated.
+ * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting.
+ * @param destCapacity The number of UChars that fit into dest.
+ * @param mode The normalization mode.
+ * @param options The normalization options, ORed together (0 for no options).
+ * @param pErrorCode ICU error code in/out parameter.
+ *                   Must fulfill U_SUCCESS before the function call.
+ * @return Length of output (number of UChars) when successful or buffer overflow.
+ *
+ * @see unorm_normalize
+ * @see unorm_next
+ * @see unorm_previous
+ *
+ * @stable ICU 2.1
+ */
+U_STABLE int32_t U_EXPORT2
+unorm_concatenate(const UChar *left, int32_t leftLength,
+                  const UChar *right, int32_t rightLength,
+                  UChar *dest, int32_t destCapacity,
+                  UNormalizationMode mode, int32_t options,
+                  UErrorCode *pErrorCode);
+
+/**
+ * Option bit for unorm_compare:
+ * Both input strings are assumed to fulfill FCD conditions.
+ * @stable ICU 2.2
+ */
+#define UNORM_INPUT_IS_FCD          0x20000
+
+/**
+ * Option bit for unorm_compare:
+ * Perform case-insensitive comparison.
+ * @stable ICU 2.2
+ */
+#define U_COMPARE_IGNORE_CASE       0x10000
+
+#ifndef U_COMPARE_CODE_POINT_ORDER
+/* see also unistr.h and ustring.h */
+/**
+ * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
+ * Compare strings in code point order instead of code unit order.
+ * @stable ICU 2.2
+ */
+#define U_COMPARE_CODE_POINT_ORDER  0x8000
+#endif
+
+/**
+ * Compare two strings for canonical equivalence.
+ * Further options include case-insensitive comparison and
+ * code point order (as opposed to code unit order).
+ *
+ * Canonical equivalence between two strings is defined as their normalized
+ * forms (NFD or NFC) being identical.
+ * This function compares strings incrementally instead of normalizing
+ * (and optionally case-folding) both strings entirely,
+ * improving performance significantly.
+ *
+ * Bulk normalization is only necessary if the strings do not fulfill the FCD
+ * conditions. Only in this case, and only if the strings are relatively long,
+ * is memory allocated temporarily.
+ * For FCD strings and short non-FCD strings there is no memory allocation.
+ *
+ * Semantically, this is equivalent to
+ *   strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2))))
+ * where code point order and foldCase are all optional.
+ *
+ * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match
+ * the case folding must be performed first, then the normalization.
+ *
+ * @param s1 First source string.
+ * @param length1 Length of first source string, or -1 if NUL-terminated.
+ *
+ * @param s2 Second source string.
+ * @param length2 Length of second source string, or -1 if NUL-terminated.
+ *
+ * @param options A bit set of options:
+ *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+ *     Case-sensitive comparison in code unit order, and the input strings
+ *     are quick-checked for FCD.
+ *
+ *   - UNORM_INPUT_IS_FCD
+ *     Set if the caller knows that both s1 and s2 fulfill the FCD conditions.
+ *     If not set, the function will quickCheck for FCD
+ *     and normalize if necessary.
+ *
+ *   - U_COMPARE_CODE_POINT_ORDER
+ *     Set to choose code point order instead of code unit order
+ *     (see u_strCompare for details).
+ *
+ *   - U_COMPARE_IGNORE_CASE
+ *     Set to compare strings case-insensitively using case folding,
+ *     instead of case-sensitively.
+ *     If set, then the following case folding options are used.
+ *
+ *   - Options as used with case-insensitive comparisons, currently:
+ *
+ *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ *    (see u_strCaseCompare for details)
+ *
+ *   - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT
+ *
+ * @param pErrorCode ICU error code in/out parameter.
+ *                   Must fulfill U_SUCCESS before the function call.
+ * @return <0 or 0 or >0 as usual for string comparisons
+ *
+ * @see unorm_normalize
+ * @see UNORM_FCD
+ * @see u_strCompare
+ * @see u_strCaseCompare
+ *
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+unorm_compare(const UChar *s1, int32_t length1,
+              const UChar *s2, int32_t length2,
+              uint32_t options,
+              UErrorCode *pErrorCode);
+
+#endif /* #if !UCONFIG_NO_NORMALIZATION */
+
+#endif
diff --git a/Source/WTF/icu/unicode/unorm2.h b/Source/WTF/icu/unicode/unorm2.h
new file mode 100644
index 0000000..a522b47
--- /dev/null
+++ b/Source/WTF/icu/unicode/unorm2.h
@@ -0,0 +1,391 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2009-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  unorm2.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 2009dec15
+*   created by: Markus W. Scherer
+*/
+
+#ifndef __UNORM2_H__
+#define __UNORM2_H__
+
+/**
+ * \file
+ * \brief C API: New API for Unicode Normalization.
+ *
+ * Unicode normalization functionality for standard Unicode normalization or
+ * for using custom mapping tables.
+ * All instances of UNormalizer2 are unmodifiable/immutable.
+ * Instances returned by unorm2_getInstance() are singletons that must not be deleted by the caller.
+ * For more details see the Normalizer2 C++ class.
+ */
+
+#include "unicode/utypes.h"
+#include "unicode/localpointer.h"
+#include "unicode/uset.h"
+
+/**
+ * Constants for normalization modes.
+ * For details about standard Unicode normalization forms
+ * and about the algorithms which are also used with custom mapping tables
+ * see http://www.unicode.org/unicode/reports/tr15/
+ * @stable ICU 4.4
+ */
+typedef enum {
+    /**
+     * Decomposition followed by composition.
+     * Same as standard NFC when using an "nfc" instance.
+     * Same as standard NFKC when using an "nfkc" instance.
+     * For details about standard Unicode normalization forms
+     * see http://www.unicode.org/unicode/reports/tr15/
+     * @stable ICU 4.4
+     */
+    UNORM2_COMPOSE,
+    /**
+     * Map, and reorder canonically.
+     * Same as standard NFD when using an "nfc" instance.
+     * Same as standard NFKD when using an "nfkc" instance.
+     * For details about standard Unicode normalization forms
+     * see http://www.unicode.org/unicode/reports/tr15/
+     * @stable ICU 4.4
+     */
+    UNORM2_DECOMPOSE,
+    /**
+     * "Fast C or D" form.
+     * If a string is in this form, then further decomposition <i>without reordering</i>
+     * would yield the same form as DECOMPOSE.
+     * Text in "Fast C or D" form can be processed efficiently with data tables
+     * that are "canonically closed", that is, that provide equivalent data for
+     * equivalent text, without having to be fully normalized.
+     * Not a standard Unicode normalization form.
+     * Not a unique form: Different FCD strings can be canonically equivalent.
+     * For details see http://www.unicode.org/notes/tn5/#FCD
+     * @stable ICU 4.4
+     */
+    UNORM2_FCD,
+    /**
+     * Compose only contiguously.
+     * Also known as "FCC" or "Fast C Contiguous".
+     * The result will often but not always be in NFC.
+     * The result will conform to FCD which is useful for processing.
+     * Not a standard Unicode normalization form.
+     * For details see http://www.unicode.org/notes/tn5/#FCC
+     * @stable ICU 4.4
+     */
+    UNORM2_COMPOSE_CONTIGUOUS
+} UNormalization2Mode;
+
+/**
+ * Result values for normalization quick check functions.
+ * For details see http://www.unicode.org/reports/tr15/#Detecting_Normalization_Forms
+ * @stable ICU 2.0
+ */
+typedef enum UNormalizationCheckResult {
+  /**
+   * The input string is not in the normalization form.
+   * @stable ICU 2.0
+   */
+  UNORM_NO,
+  /**
+   * The input string is in the normalization form.
+   * @stable ICU 2.0
+   */
+  UNORM_YES,
+  /**
+   * The input string may or may not be in the normalization form.
+   * This value is only returned for composition forms like NFC and FCC,
+   * when a backward-combining character is found for which the surrounding text
+   * would have to be analyzed further.
+   * @stable ICU 2.0
+   */
+  UNORM_MAYBE
+} UNormalizationCheckResult;
+
+/**
+ * Opaque C service object type for the new normalization API.
+ * @stable ICU 4.4
+ */
+struct UNormalizer2;
+typedef struct UNormalizer2 UNormalizer2;  /**< C typedef for struct UNormalizer2. @stable ICU 4.4 */
+
+#if !UCONFIG_NO_NORMALIZATION
+
+/**
+ * Returns a UNormalizer2 instance which uses the specified data file
+ * (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle)
+ * and which composes or decomposes text according to the specified mode.
+ * Returns an unmodifiable singleton instance. Do not delete it.
+ *
+ * Use packageName=NULL for data files that are part of ICU's own data.
+ * Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD.
+ * Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD.
+ * Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold.
+ *
+ * @param packageName NULL for ICU built-in data, otherwise application data package name
+ * @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file
+ * @param mode normalization mode (compose or decompose etc.)
+ * @param pErrorCode Standard ICU error code. Its input value must
+ *                  pass the U_SUCCESS() test, or else the function returns
+ *                  immediately. Check for U_FAILURE() on output or use with
+ *                  function chaining. (See User Guide for details.)
+ * @return the requested UNormalizer2, if successful
+ * @stable ICU 4.4
+ */
+U_STABLE const UNormalizer2 * U_EXPORT2
+unorm2_getInstance(const char *packageName,
+                   const char *name,
+                   UNormalization2Mode mode,
+                   UErrorCode *pErrorCode);
+
+/**
+ * Constructs a filtered normalizer wrapping any UNormalizer2 instance
+ * and a filter set.
+ * Both are aliased and must not be modified or deleted while this object
+ * is used.
+ * The filter set should be frozen; otherwise the performance will suffer greatly.
+ * @param norm2 wrapped UNormalizer2 instance
+ * @param filterSet USet which determines the characters to be normalized
+ * @param pErrorCode Standard ICU error code. Its input value must
+ *                   pass the U_SUCCESS() test, or else the function returns
+ *                   immediately. Check for U_FAILURE() on output or use with
+ *                   function chaining. (See User Guide for details.)
+ * @return the requested UNormalizer2, if successful
+ * @stable ICU 4.4
+ */
+U_STABLE UNormalizer2 * U_EXPORT2
+unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode);
+
+/**
+ * Closes a UNormalizer2 instance from unorm2_openFiltered().
+ * Do not close instances from unorm2_getInstance()!
+ * @param norm2 UNormalizer2 instance to be closed
+ * @stable ICU 4.4
+ */
+U_STABLE void U_EXPORT2
+unorm2_close(UNormalizer2 *norm2);
+
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUNormalizer2Pointer
+ * "Smart pointer" class, closes a UNormalizer2 via unorm2_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 4.4
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close);
+
+U_NAMESPACE_END
+
+#endif
+
+/**
+ * Writes the normalized form of the source string to the destination string
+ * (replacing its contents) and returns the length of the destination string.
+ * The source and destination strings must be different buffers.
+ * @param norm2 UNormalizer2 instance
+ * @param src source string
+ * @param length length of the source string, or -1 if NUL-terminated
+ * @param dest destination string; its contents is replaced with normalized src
+ * @param capacity number of UChars that can be written to dest
+ * @param pErrorCode Standard ICU error code. Its input value must
+ *                   pass the U_SUCCESS() test, or else the function returns
+ *                   immediately. Check for U_FAILURE() on output or use with
+ *                   function chaining. (See User Guide for details.)
+ * @return dest
+ * @stable ICU 4.4
+ */
+U_STABLE int32_t U_EXPORT2
+unorm2_normalize(const UNormalizer2 *norm2,
+                 const UChar *src, int32_t length,
+                 UChar *dest, int32_t capacity,
+                 UErrorCode *pErrorCode);
+/**
+ * Appends the normalized form of the second string to the first string
+ * (merging them at the boundary) and returns the length of the first string.
+ * The result is normalized if the first string was normalized.
+ * The first and second strings must be different buffers.
+ * @param norm2 UNormalizer2 instance
+ * @param first string, should be normalized
+ * @param firstLength length of the first string, or -1 if NUL-terminated
+ * @param firstCapacity number of UChars that can be written to first
+ * @param second string, will be normalized
+ * @param secondLength length of the source string, or -1 if NUL-terminated
+ * @param pErrorCode Standard ICU error code. Its input value must
+ *                   pass the U_SUCCESS() test, or else the function returns
+ *                   immediately. Check for U_FAILURE() on output or use with
+ *                   function chaining. (See User Guide for details.)
+ * @return first
+ * @stable ICU 4.4
+ */
+U_STABLE int32_t U_EXPORT2
+unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2,
+                                UChar *first, int32_t firstLength, int32_t firstCapacity,
+                                const UChar *second, int32_t secondLength,
+                                UErrorCode *pErrorCode);
+/**
+ * Appends the second string to the first string
+ * (merging them at the boundary) and returns the length of the first string.
+ * The result is normalized if both the strings were normalized.
+ * The first and second strings must be different buffers.
+ * @param norm2 UNormalizer2 instance
+ * @param first string, should be normalized
+ * @param firstLength length of the first string, or -1 if NUL-terminated
+ * @param firstCapacity number of UChars that can be written to first
+ * @param second string, should be normalized
+ * @param secondLength length of the source string, or -1 if NUL-terminated
+ * @param pErrorCode Standard ICU error code. Its input value must
+ *                   pass the U_SUCCESS() test, or else the function returns
+ *                   immediately. Check for U_FAILURE() on output or use with
+ *                   function chaining. (See User Guide for details.)
+ * @return first
+ * @stable ICU 4.4
+ */
+U_STABLE int32_t U_EXPORT2
+unorm2_append(const UNormalizer2 *norm2,
+              UChar *first, int32_t firstLength, int32_t firstCapacity,
+              const UChar *second, int32_t secondLength,
+              UErrorCode *pErrorCode);
+
+/**
+ * Gets the decomposition mapping of c. Equivalent to unorm2_normalize(string(c))
+ * on a UNORM2_DECOMPOSE UNormalizer2 instance, but much faster.
+ * This function is independent of the mode of the UNormalizer2.
+ * @param norm2 UNormalizer2 instance
+ * @param c code point
+ * @param decomposition String buffer which will be set to c's
+ *                      decomposition mapping, if there is one.
+ * @param capacity number of UChars that can be written to decomposition
+ * @param pErrorCode Standard ICU error code. Its input value must
+ *                   pass the U_SUCCESS() test, or else the function returns
+ *                   immediately. Check for U_FAILURE() on output or use with
+ *                   function chaining. (See User Guide for details.)
+ * @return the non-negative length of c's decomposition, if there is one; otherwise a negative value
+ * @draft ICU 4.6
+ */
+U_DRAFT int32_t U_EXPORT2
+unorm2_getDecomposition(const UNormalizer2 *norm2,
+                        UChar32 c, UChar *decomposition, int32_t capacity,
+                        UErrorCode *pErrorCode);
+
+/**
+ * Tests if the string is normalized.
+ * Internally, in cases where the quickCheck() method would return "maybe"
+ * (which is only possible for the two COMPOSE modes) this method
+ * resolves to "yes" or "no" to provide a definitive result,
+ * at the cost of doing more work in those cases.
+ * @param norm2 UNormalizer2 instance
+ * @param s input string
+ * @param length length of the string, or -1 if NUL-terminated
+ * @param pErrorCode Standard ICU error code. Its input value must
+ *                   pass the U_SUCCESS() test, or else the function returns
+ *                   immediately. Check for U_FAILURE() on output or use with
+ *                   function chaining. (See User Guide for details.)
+ * @return TRUE if s is normalized
+ * @stable ICU 4.4
+ */
+U_STABLE UBool U_EXPORT2
+unorm2_isNormalized(const UNormalizer2 *norm2,
+                    const UChar *s, int32_t length,
+                    UErrorCode *pErrorCode);
+
+/**
+ * Tests if the string is normalized.
+ * For the two COMPOSE modes, the result could be "maybe" in cases that
+ * would take a little more work to resolve definitively.
+ * Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster
+ * combination of quick check + normalization, to avoid
+ * re-checking the "yes" prefix.
+ * @param norm2 UNormalizer2 instance
+ * @param s input string
+ * @param length length of the string, or -1 if NUL-terminated
+ * @param pErrorCode Standard ICU error code. Its input value must
+ *                   pass the U_SUCCESS() test, or else the function returns
+ *                   immediately. Check for U_FAILURE() on output or use with
+ *                   function chaining. (See User Guide for details.)
+ * @return UNormalizationCheckResult
+ * @stable ICU 4.4
+ */
+U_STABLE UNormalizationCheckResult U_EXPORT2
+unorm2_quickCheck(const UNormalizer2 *norm2,
+                  const UChar *s, int32_t length,
+                  UErrorCode *pErrorCode);
+
+/**
+ * Returns the end of the normalized substring of the input string.
+ * In other words, with <code>end=spanQuickCheckYes(s, ec);</code>
+ * the substring <code>UnicodeString(s, 0, end)</code>
+ * will pass the quick check with a "yes" result.
+ *
+ * The returned end index is usually one or more characters before the
+ * "no" or "maybe" character: The end index is at a normalization boundary.
+ * (See the class documentation for more about normalization boundaries.)
+ *
+ * When the goal is a normalized string and most input strings are expected
+ * to be normalized already, then call this method,
+ * and if it returns a prefix shorter than the input string,
+ * copy that prefix and use normalizeSecondAndAppend() for the remainder.
+ * @param norm2 UNormalizer2 instance
+ * @param s input string
+ * @param length length of the string, or -1 if NUL-terminated
+ * @param pErrorCode Standard ICU error code. Its input value must
+ *                   pass the U_SUCCESS() test, or else the function returns
+ *                   immediately. Check for U_FAILURE() on output or use with
+ *                   function chaining. (See User Guide for details.)
+ * @return "yes" span end index
+ * @stable ICU 4.4
+ */
+U_STABLE int32_t U_EXPORT2
+unorm2_spanQuickCheckYes(const UNormalizer2 *norm2,
+                         const UChar *s, int32_t length,
+                         UErrorCode *pErrorCode);
+
+/**
+ * Tests if the character always has a normalization boundary before it,
+ * regardless of context.
+ * For details see the Normalizer2 base class documentation.
+ * @param norm2 UNormalizer2 instance
+ * @param c character to test
+ * @return TRUE if c has a normalization boundary before it
+ * @stable ICU 4.4
+ */
+U_STABLE UBool U_EXPORT2
+unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c);
+
+/**
+ * Tests if the character always has a normalization boundary after it,
+ * regardless of context.
+ * For details see the Normalizer2 base class documentation.
+ * @param norm2 UNormalizer2 instance
+ * @param c character to test
+ * @return TRUE if c has a normalization boundary after it
+ * @stable ICU 4.4
+ */
+U_STABLE UBool U_EXPORT2
+unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c);
+
+/**
+ * Tests if the character is normalization-inert.
+ * For details see the Normalizer2 base class documentation.
+ * @param norm2 UNormalizer2 instance
+ * @param c character to test
+ * @return TRUE if c is normalization-inert
+ * @stable ICU 4.4
+ */
+U_STABLE UBool U_EXPORT2
+unorm2_isInert(const UNormalizer2 *norm2, UChar32 c);
+
+#endif  /* !UCONFIG_NO_NORMALIZATION */
+#endif  /* __UNORM2_H__ */
diff --git a/Source/WTF/icu/unicode/uobject.h b/Source/WTF/icu/unicode/uobject.h
new file mode 100644
index 0000000..27d4c84
--- /dev/null
+++ b/Source/WTF/icu/unicode/uobject.h
@@ -0,0 +1,352 @@
+/*
+******************************************************************************
+*
+*   Copyright (C) 2002-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+******************************************************************************
+*   file name:  uobject.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 2002jun26
+*   created by: Markus W. Scherer
+*/
+
+#ifndef __UOBJECT_H__
+#define __UOBJECT_H__
+
+#include "unicode/utypes.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \file
+ * \brief C++ API: Common ICU base class UObject.
+ */
+
+/**  U_OVERRIDE_CXX_ALLOCATION - Define this to override operator new and
+ *                               delete in UMemory. Enabled by default for ICU.
+ *
+ *         Enabling forces all allocation of ICU object types to use ICU's
+ *         memory allocation. On Windows, this allows the ICU DLL to be used by
+ *         applications that statically link the C Runtime library, meaning that
+ *         the app and ICU will be using different heaps.
+ *
+ * @stable ICU 2.2
+ */                              
+#ifndef U_OVERRIDE_CXX_ALLOCATION
+#define U_OVERRIDE_CXX_ALLOCATION 1
+#endif
+
+/** 
+ * \def U_HAVE_PLACEMENT_NEW
+ *  Define this to define the placement new and
+ *                          delete in UMemory for STL.
+ *
+ * @stable ICU 2.6
+ */                              
+#ifndef U_HAVE_PLACEMENT_NEW
+#define U_HAVE_PLACEMENT_NEW 1
+#endif
+
+
+/** 
+ * \def U_HAVE_DEBUG_LOCATION_NEW 
+ * Define this to define the MFC debug
+ * version of the operator new.
+ *
+ * @stable ICU 3.4
+ */                              
+#ifndef U_HAVE_DEBUG_LOCATION_NEW
+#define U_HAVE_DEBUG_LOCATION_NEW 0
+#endif
+
+/**
+ * @{
+ * \def U_NO_THROW
+ *         Define this to define the throw() specification so
+ *                 certain functions do not throw any exceptions
+ *
+ *         UMemory operator new methods should have the throw() specification 
+ *         appended to them, so that the compiler adds the additional NULL check 
+ *         before calling constructors. Without, if <code>operator new</code> returns NULL the 
+ *         constructor is still called, and if the constructor references member 
+ *         data, (which it typically does), the result is a segmentation violation.
+ *
+ * @draft ICU 4.2
+ */                              
+#ifndef U_NO_THROW
+#define U_NO_THROW throw()
+#endif
+
+/** @} */
+
+/**
+ * UMemory is the common ICU base class.
+ * All other ICU C++ classes are derived from UMemory (starting with ICU 2.4).
+ *
+ * This is primarily to make it possible and simple to override the
+ * C++ memory management by adding new/delete operators to this base class.
+ *
+ * To override ALL ICU memory management, including that from plain C code,
+ * replace the allocation functions declared in cmemory.h
+ *
+ * UMemory does not contain any virtual functions.
+ * Common "boilerplate" functions are defined in UObject.
+ *
+ * @stable ICU 2.4
+ */
+class U_COMMON_API UMemory {
+public:
+
+/* test versions for debugging shaper heap memory problems */
+#ifdef SHAPER_MEMORY_DEBUG  
+    static void * NewArray(int size, int count);
+    static void * GrowArray(void * array, int newSize );
+    static void   FreeArray(void * array );
+#endif
+
+#if U_OVERRIDE_CXX_ALLOCATION
+    /**
+     * Override for ICU4C C++ memory management.
+     * simple, non-class types are allocated using the macros in common/cmemory.h
+     * (uprv_malloc(), uprv_free(), uprv_realloc());
+     * they or something else could be used here to implement C++ new/delete
+     * for ICU4C C++ classes
+     * @stable ICU 2.4
+     */
+    static void * U_EXPORT2 operator new(size_t size) U_NO_THROW;
+
+    /**
+     * Override for ICU4C C++ memory management.
+     * See new().
+     * @stable ICU 2.4
+     */
+    static void * U_EXPORT2 operator new[](size_t size) U_NO_THROW;
+
+    /**
+     * Override for ICU4C C++ memory management.
+     * simple, non-class types are allocated using the macros in common/cmemory.h
+     * (uprv_malloc(), uprv_free(), uprv_realloc());
+     * they or something else could be used here to implement C++ new/delete
+     * for ICU4C C++ classes
+     * @stable ICU 2.4
+     */
+    static void U_EXPORT2 operator delete(void *p) U_NO_THROW;
+
+    /**
+     * Override for ICU4C C++ memory management.
+     * See delete().
+     * @stable ICU 2.4
+     */
+    static void U_EXPORT2 operator delete[](void *p) U_NO_THROW;
+
+#if U_HAVE_PLACEMENT_NEW
+    /**
+     * Override for ICU4C C++ memory management for STL.
+     * See new().
+     * @stable ICU 2.6
+     */
+    static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NO_THROW { return ptr; }
+
+    /**
+     * Override for ICU4C C++ memory management for STL.
+     * See delete().
+     * @stable ICU 2.6
+     */
+    static inline void U_EXPORT2 operator delete(void *, void *) U_NO_THROW {}
+#endif /* U_HAVE_PLACEMENT_NEW */
+#if U_HAVE_DEBUG_LOCATION_NEW
+    /**
+      * This method overrides the MFC debug version of the operator new
+      * 
+      * @param size   The requested memory size
+      * @param file   The file where the allocation was requested
+      * @param line   The line where the allocation was requested 
+      */ 
+    static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NO_THROW;
+    /**
+      * This method provides a matching delete for the MFC debug new
+      * 
+      * @param p      The pointer to the allocated memory
+      * @param file   The file where the allocation was requested
+      * @param line   The line where the allocation was requested 
+      */ 
+    static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NO_THROW;
+#endif /* U_HAVE_DEBUG_LOCATION_NEW */
+#endif /* U_OVERRIDE_CXX_ALLOCATION */
+
+    /*
+     * Assignment operator not declared. The compiler will provide one
+     * which does nothing since this class does not contain any data members.
+     * API/code coverage may show the assignment operator as present and
+     * untested - ignore.
+     * Subclasses need this assignment operator if they use compiler-provided
+     * assignment operators of their own. An alternative to not declaring one
+     * here would be to declare and empty-implement a protected or public one.
+    UMemory &UMemory::operator=(const UMemory &);
+     */
+};
+
+/**
+ * UObject is the common ICU "boilerplate" class.
+ * UObject inherits UMemory (starting with ICU 2.4),
+ * and all other public ICU C++ classes
+ * are derived from UObject (starting with ICU 2.2).
+ *
+ * UObject contains common virtual functions like for ICU's "poor man's RTTI".
+ * It does not contain default implementations of virtual methods
+ * like getDynamicClassID to allow derived classes such as Format
+ * to declare these as pure virtual.
+ *
+ * The clone() function is not available in UObject because it is not
+ * implemented by all ICU classes.
+ * Many ICU services provide a clone() function for their class trees,
+ * defined on the service's C++ base class, and all subclasses within that
+ * service class tree return a pointer to the service base class
+ * (which itself is a subclass of UObject).
+ * This is because some compilers do not support covariant (same-as-this)
+ * return types; cast to the appropriate subclass if necessary.
+ *
+ * @stable ICU 2.2
+ */
+class U_COMMON_API UObject : public UMemory {
+public:
+    /**
+     * Destructor.
+     *
+     * @stable ICU 2.2
+     */
+    virtual ~UObject();
+
+    /**
+     * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
+     *
+     * @stable ICU 2.2
+     */
+    virtual UClassID getDynamicClassID() const = 0;
+
+protected:
+    // the following functions are protected to prevent instantiation and
+    // direct use of UObject itself
+
+    // default constructor
+    // commented out because UObject is abstract (see getDynamicClassID)
+    // inline UObject() {}
+
+    // copy constructor
+    // commented out because UObject is abstract (see getDynamicClassID)
+    // inline UObject(const UObject &other) {}
+
+#if 0
+    // TODO Sometime in the future. Implement operator==().
+    // (This comment inserted in 2.2)
+    // some or all of the following "boilerplate" functions may be made public
+    // in a future ICU4C release when all subclasses implement them
+
+    // assignment operator
+    // (not virtual, see "Taligent's Guide to Designing Programs" pp.73..74)
+    // commented out because the implementation is the same as a compiler's default
+    // UObject &operator=(const UObject &other) { return *this; }
+
+    // comparison operators
+    virtual inline UBool operator==(const UObject &other) const { return this==&other; }
+    inline UBool operator!=(const UObject &other) const { return !operator==(other); }
+
+    // clone() commented out from the base class:
+    // some compilers do not support co-variant return types
+    // (i.e., subclasses would have to return UObject * as well, instead of SubClass *)
+    // see also UObject class documentation.
+    // virtual UObject *clone() const;
+#endif
+
+    /*
+     * Assignment operator not declared. The compiler will provide one
+     * which does nothing since this class does not contain any data members.
+     * API/code coverage may show the assignment operator as present and
+     * untested - ignore.
+     * Subclasses need this assignment operator if they use compiler-provided
+     * assignment operators of their own. An alternative to not declaring one
+     * here would be to declare and empty-implement a protected or public one.
+    UObject &UObject::operator=(const UObject &);
+     */
+
+// Future implementation for RTTI that support subtyping. [alan]
+// 
+//  public:
+//     /**
+//      * @internal
+//      */
+//     static UClassID getStaticClassID();
+// 
+//     /**
+//      * @internal
+//      */
+//     UBool instanceOf(UClassID type) const;
+};
+
+/**
+ * This is a simple macro to add ICU RTTI to an ICU object implementation.
+ * This does not go into the header. This should only be used in *.cpp files.
+ *
+ * @param myClass The name of the class that needs RTTI defined.
+ * @internal
+ */
+#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(myClass) \
+    UClassID U_EXPORT2 myClass::getStaticClassID() { \
+        static char classID = 0; \
+        return (UClassID)&classID; \
+    } \
+    UClassID myClass::getDynamicClassID() const \
+    { return myClass::getStaticClassID(); }
+
+
+/**
+ * This macro adds ICU RTTI to an ICU abstract class implementation.
+ * This macro should be invoked in *.cpp files.  The corresponding
+ * header should declare getStaticClassID.
+ *
+ * @param myClass The name of the class that needs RTTI defined.
+ * @internal
+ */
+#define UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(myClass) \
+    UClassID U_EXPORT2 myClass::getStaticClassID() { \
+        static char classID = 0; \
+        return (UClassID)&classID; \
+    }
+
+/**
+ * This is a simple macro to express that a class and its subclasses do not offer
+ * ICU's "poor man's RTTI".
+ * Beginning with ICU 4.6, ICU requires C++ compiler RTTI.
+ * This does not go into the header. This should only be used in *.cpp files.
+ * Use this with a private getDynamicClassID() in an immediate subclass of UObject.
+ *
+ * @param myClass The name of the class that needs RTTI defined.
+ * @internal
+ */
+#define UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(myClass) \
+    UClassID myClass::getDynamicClassID() const { return NULL; }
+
+// /**
+//  * This macro adds ICU RTTI to an ICU concrete class implementation.
+//  * This macro should be invoked in *.cpp files.  The corresponding
+//  * header should declare getDynamicClassID and getStaticClassID.
+//  *
+//  * @param myClass The name of the class that needs RTTI defined.
+//  * @param myParent The name of the myClass's parent.
+//  * @internal
+//  */
+/*#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(myClass, myParent) \
+    UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(myClass, myParent) \
+    UClassID myClass::getDynamicClassID() const { \
+        return myClass::getStaticClassID(); \
+    }
+*/
+
+
+U_NAMESPACE_END
+
+#endif
diff --git a/Source/WTF/icu/unicode/urename.h b/Source/WTF/icu/unicode/urename.h
new file mode 100644
index 0000000..468bdbd
--- /dev/null
+++ b/Source/WTF/icu/unicode/urename.h
@@ -0,0 +1,2241 @@
+/*
+*******************************************************************************
+*   Copyright (C) 2002-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*******************************************************************************
+*
+*   file name:  urename.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   Created by: Perl script written by Vladimir Weinstein
+*
+*  Contains data for renaming ICU exports.
+*  Gets included by umachine.h
+*
+*  THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT
+*  YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN!
+*/
+
+#ifndef URENAME_H
+#define URENAME_H
+
+/* Uncomment the following line to disable renaming on platforms
+   that do not use Autoconf. */
+/* #define U_DISABLE_RENAMING 1 */
+
+#if !U_DISABLE_RENAMING
+
+/* We need the U_ICU_ENTRY_POINT_RENAME definition. There's a default one in unicode/uvernum.h we can use, but we will give
+   the platform a chance to define it first.
+   Normally (if utypes.h or umachine.h was included first) this will not be necessary as it will already be defined.
+ */
+#ifndef U_ICU_ENTRY_POINT_RENAME
+#include "unicode/umachine.h"
+#endif
+
+/* If we still don't have U_ICU_ENTRY_POINT_RENAME use the default. */
+#ifndef U_ICU_ENTRY_POINT_RENAME
+#include "unicode/uvernum.h"
+#endif
+
+/* Error out before the following defines cause very strange and unexpected code breakage */
+#ifndef U_ICU_ENTRY_POINT_RENAME
+#error U_ICU_ENTRY_POINT_RENAME is not defined - cannot continue. Consider defining U_DISABLE_RENAMING if renaming should not be used.
+#endif
+
+
+/* C exports renaming data */
+
+#define DECPOWERS U_ICU_ENTRY_POINT_RENAME(DECPOWERS)
+#define DECSTICKYTAB U_ICU_ENTRY_POINT_RENAME(DECSTICKYTAB)
+#define LNnn U_ICU_ENTRY_POINT_RENAME(LNnn)
+#define T_CString_int64ToString U_ICU_ENTRY_POINT_RENAME(T_CString_int64ToString)
+#define T_CString_integerToString U_ICU_ENTRY_POINT_RENAME(T_CString_integerToString)
+#define T_CString_stricmp U_ICU_ENTRY_POINT_RENAME(T_CString_stricmp)
+#define T_CString_stringToInteger U_ICU_ENTRY_POINT_RENAME(T_CString_stringToInteger)
+#define T_CString_strnicmp U_ICU_ENTRY_POINT_RENAME(T_CString_strnicmp)
+#define T_CString_toLowerCase U_ICU_ENTRY_POINT_RENAME(T_CString_toLowerCase)
+#define T_CString_toUpperCase U_ICU_ENTRY_POINT_RENAME(T_CString_toUpperCase)
+#define UCNV_FROM_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_ESCAPE)
+#define UCNV_FROM_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SKIP)
+#define UCNV_FROM_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_STOP)
+#define UCNV_FROM_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SUBSTITUTE)
+#define UCNV_TO_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_ESCAPE)
+#define UCNV_TO_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SKIP)
+#define UCNV_TO_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_STOP)
+#define UCNV_TO_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SUBSTITUTE)
+#define UDataMemory_createNewInstance U_ICU_ENTRY_POINT_RENAME(UDataMemory_createNewInstance)
+#define UDataMemory_init U_ICU_ENTRY_POINT_RENAME(UDataMemory_init)
+#define UDataMemory_isLoaded U_ICU_ENTRY_POINT_RENAME(UDataMemory_isLoaded)
+#define UDataMemory_normalizeDataPointer U_ICU_ENTRY_POINT_RENAME(UDataMemory_normalizeDataPointer)
+#define UDataMemory_setData U_ICU_ENTRY_POINT_RENAME(UDataMemory_setData)
+#define UDatamemory_assign U_ICU_ENTRY_POINT_RENAME(UDatamemory_assign)
+#define _ASCIIData U_ICU_ENTRY_POINT_RENAME(_ASCIIData)
+#define _Bocu1Data U_ICU_ENTRY_POINT_RENAME(_Bocu1Data)
+#define _CESU8Data U_ICU_ENTRY_POINT_RENAME(_CESU8Data)
+#define _HZData U_ICU_ENTRY_POINT_RENAME(_HZData)
+#define _IMAPData U_ICU_ENTRY_POINT_RENAME(_IMAPData)
+#define _ISCIIData U_ICU_ENTRY_POINT_RENAME(_ISCIIData)
+#define _ISO2022Data U_ICU_ENTRY_POINT_RENAME(_ISO2022Data)
+#define _LMBCSData1 U_ICU_ENTRY_POINT_RENAME(_LMBCSData1)
+#define _LMBCSData11 U_ICU_ENTRY_POINT_RENAME(_LMBCSData11)
+#define _LMBCSData16 U_ICU_ENTRY_POINT_RENAME(_LMBCSData16)
+#define _LMBCSData17 U_ICU_ENTRY_POINT_RENAME(_LMBCSData17)
+#define _LMBCSData18 U_ICU_ENTRY_POINT_RENAME(_LMBCSData18)
+#define _LMBCSData19 U_ICU_ENTRY_POINT_RENAME(_LMBCSData19)
+#define _LMBCSData2 U_ICU_ENTRY_POINT_RENAME(_LMBCSData2)
+#define _LMBCSData3 U_ICU_ENTRY_POINT_RENAME(_LMBCSData3)
+#define _LMBCSData4 U_ICU_ENTRY_POINT_RENAME(_LMBCSData4)
+#define _LMBCSData5 U_ICU_ENTRY_POINT_RENAME(_LMBCSData5)
+#define _LMBCSData6 U_ICU_ENTRY_POINT_RENAME(_LMBCSData6)
+#define _LMBCSData8 U_ICU_ENTRY_POINT_RENAME(_LMBCSData8)
+#define _Latin1Data U_ICU_ENTRY_POINT_RENAME(_Latin1Data)
+#define _MBCSData U_ICU_ENTRY_POINT_RENAME(_MBCSData)
+#define _SCSUData U_ICU_ENTRY_POINT_RENAME(_SCSUData)
+#define _UTF16BEData U_ICU_ENTRY_POINT_RENAME(_UTF16BEData)
+#define _UTF16Data U_ICU_ENTRY_POINT_RENAME(_UTF16Data)
+#define _UTF16LEData U_ICU_ENTRY_POINT_RENAME(_UTF16LEData)
+#define _UTF32BEData U_ICU_ENTRY_POINT_RENAME(_UTF32BEData)
+#define _UTF32Data U_ICU_ENTRY_POINT_RENAME(_UTF32Data)
+#define _UTF32LEData U_ICU_ENTRY_POINT_RENAME(_UTF32LEData)
+#define _UTF7Data U_ICU_ENTRY_POINT_RENAME(_UTF7Data)
+#define _UTF8Data U_ICU_ENTRY_POINT_RENAME(_UTF8Data)
+#define bms_close U_ICU_ENTRY_POINT_RENAME(bms_close)
+#define bms_empty U_ICU_ENTRY_POINT_RENAME(bms_empty)
+#define bms_getData U_ICU_ENTRY_POINT_RENAME(bms_getData)
+#define bms_open U_ICU_ENTRY_POINT_RENAME(bms_open)
+#define bms_search U_ICU_ENTRY_POINT_RENAME(bms_search)
+#define bms_setTargetString U_ICU_ENTRY_POINT_RENAME(bms_setTargetString)
+#define buildWSConfusableData U_ICU_ENTRY_POINT_RENAME(buildWSConfusableData)
+#define cmemory_cleanup U_ICU_ENTRY_POINT_RENAME(cmemory_cleanup)
+#define cmemory_inUse U_ICU_ENTRY_POINT_RENAME(cmemory_inUse)
+#define d2utable U_ICU_ENTRY_POINT_RENAME(d2utable)
+#define deleteCEList U_ICU_ENTRY_POINT_RENAME(deleteCEList)
+#define deleteChars U_ICU_ENTRY_POINT_RENAME(deleteChars)
+#define deleteCollDataCacheEntry U_ICU_ENTRY_POINT_RENAME(deleteCollDataCacheEntry)
+#define deleteStringList U_ICU_ENTRY_POINT_RENAME(deleteStringList)
+#define deleteUnicodeStringKey U_ICU_ENTRY_POINT_RENAME(deleteUnicodeStringKey)
+#define izrule_clone U_ICU_ENTRY_POINT_RENAME(izrule_clone)
+#define izrule_close U_ICU_ENTRY_POINT_RENAME(izrule_close)
+#define izrule_equals U_ICU_ENTRY_POINT_RENAME(izrule_equals)
+#define izrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(izrule_getDSTSavings)
+#define izrule_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(izrule_getDynamicClassID)
+#define izrule_getFinalStart U_ICU_ENTRY_POINT_RENAME(izrule_getFinalStart)
+#define izrule_getFirstStart U_ICU_ENTRY_POINT_RENAME(izrule_getFirstStart)
+#define izrule_getName U_ICU_ENTRY_POINT_RENAME(izrule_getName)
+#define izrule_getNextStart U_ICU_ENTRY_POINT_RENAME(izrule_getNextStart)
+#define izrule_getPreviousStart U_ICU_ENTRY_POINT_RENAME(izrule_getPreviousStart)
+#define izrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(izrule_getRawOffset)
+#define izrule_getStaticClassID U_ICU_ENTRY_POINT_RENAME(izrule_getStaticClassID)
+#define izrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(izrule_isEquivalentTo)
+#define izrule_open U_ICU_ENTRY_POINT_RENAME(izrule_open)
+#define le_close U_ICU_ENTRY_POINT_RENAME(le_close)
+#define le_create U_ICU_ENTRY_POINT_RENAME(le_create)
+#define le_getCharIndices U_ICU_ENTRY_POINT_RENAME(le_getCharIndices)
+#define le_getCharIndicesWithBase U_ICU_ENTRY_POINT_RENAME(le_getCharIndicesWithBase)
+#define le_getGlyphCount U_ICU_ENTRY_POINT_RENAME(le_getGlyphCount)
+#define le_getGlyphPosition U_ICU_ENTRY_POINT_RENAME(le_getGlyphPosition)
+#define le_getGlyphPositions U_ICU_ENTRY_POINT_RENAME(le_getGlyphPositions)
+#define le_getGlyphs U_ICU_ENTRY_POINT_RENAME(le_getGlyphs)
+#define le_layoutChars U_ICU_ENTRY_POINT_RENAME(le_layoutChars)
+#define le_reset U_ICU_ENTRY_POINT_RENAME(le_reset)
+#define locale_getKeywords U_ICU_ENTRY_POINT_RENAME(locale_getKeywords)
+#define locale_getKeywordsStart U_ICU_ENTRY_POINT_RENAME(locale_getKeywordsStart)
+#define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default)
+#define locale_set_default U_ICU_ENTRY_POINT_RENAME(locale_set_default)
+#define pl_addFontRun U_ICU_ENTRY_POINT_RENAME(pl_addFontRun)
+#define pl_addLocaleRun U_ICU_ENTRY_POINT_RENAME(pl_addLocaleRun)
+#define pl_addValueRun U_ICU_ENTRY_POINT_RENAME(pl_addValueRun)
+#define pl_close U_ICU_ENTRY_POINT_RENAME(pl_close)
+#define pl_closeFontRuns U_ICU_ENTRY_POINT_RENAME(pl_closeFontRuns)
+#define pl_closeLine U_ICU_ENTRY_POINT_RENAME(pl_closeLine)
+#define pl_closeLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_closeLocaleRuns)
+#define pl_closeValueRuns U_ICU_ENTRY_POINT_RENAME(pl_closeValueRuns)
+#define pl_countLineRuns U_ICU_ENTRY_POINT_RENAME(pl_countLineRuns)
+#define pl_create U_ICU_ENTRY_POINT_RENAME(pl_create)
+#define pl_getAscent U_ICU_ENTRY_POINT_RENAME(pl_getAscent)
+#define pl_getDescent U_ICU_ENTRY_POINT_RENAME(pl_getDescent)
+#define pl_getFontRunCount U_ICU_ENTRY_POINT_RENAME(pl_getFontRunCount)
+#define pl_getFontRunFont U_ICU_ENTRY_POINT_RENAME(pl_getFontRunFont)
+#define pl_getFontRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLastLimit)
+#define pl_getFontRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLimit)
+#define pl_getLeading U_ICU_ENTRY_POINT_RENAME(pl_getLeading)
+#define pl_getLineAscent U_ICU_ENTRY_POINT_RENAME(pl_getLineAscent)
+#define pl_getLineDescent U_ICU_ENTRY_POINT_RENAME(pl_getLineDescent)
+#define pl_getLineLeading U_ICU_ENTRY_POINT_RENAME(pl_getLineLeading)
+#define pl_getLineVisualRun U_ICU_ENTRY_POINT_RENAME(pl_getLineVisualRun)
+#define pl_getLineWidth U_ICU_ENTRY_POINT_RENAME(pl_getLineWidth)
+#define pl_getLocaleRunCount U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunCount)
+#define pl_getLocaleRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLastLimit)
+#define pl_getLocaleRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLimit)
+#define pl_getLocaleRunLocale U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLocale)
+#define pl_getParagraphLevel U_ICU_ENTRY_POINT_RENAME(pl_getParagraphLevel)
+#define pl_getTextDirection U_ICU_ENTRY_POINT_RENAME(pl_getTextDirection)
+#define pl_getValueRunCount U_ICU_ENTRY_POINT_RENAME(pl_getValueRunCount)
+#define pl_getValueRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLastLimit)
+#define pl_getValueRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLimit)
+#define pl_getValueRunValue U_ICU_ENTRY_POINT_RENAME(pl_getValueRunValue)
+#define pl_getVisualRunAscent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunAscent)
+#define pl_getVisualRunDescent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDescent)
+#define pl_getVisualRunDirection U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDirection)
+#define pl_getVisualRunFont U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunFont)
+#define pl_getVisualRunGlyphCount U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphCount)
+#define pl_getVisualRunGlyphToCharMap U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphToCharMap)
+#define pl_getVisualRunGlyphs U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphs)
+#define pl_getVisualRunLeading U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunLeading)
+#define pl_getVisualRunPositions U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunPositions)
+#define pl_isComplex U_ICU_ENTRY_POINT_RENAME(pl_isComplex)
+#define pl_nextLine U_ICU_ENTRY_POINT_RENAME(pl_nextLine)
+#define pl_openEmptyFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyFontRuns)
+#define pl_openEmptyLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyLocaleRuns)
+#define pl_openEmptyValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyValueRuns)
+#define pl_openFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openFontRuns)
+#define pl_openLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openLocaleRuns)
+#define pl_openValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openValueRuns)
+#define pl_reflow U_ICU_ENTRY_POINT_RENAME(pl_reflow)
+#define pl_resetFontRuns U_ICU_ENTRY_POINT_RENAME(pl_resetFontRuns)
+#define pl_resetLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_resetLocaleRuns)
+#define pl_resetValueRuns U_ICU_ENTRY_POINT_RENAME(pl_resetValueRuns)
+#define res_countArrayItems U_ICU_ENTRY_POINT_RENAME(res_countArrayItems)
+#define res_findResource U_ICU_ENTRY_POINT_RENAME(res_findResource)
+#define res_getAlias U_ICU_ENTRY_POINT_RENAME(res_getAlias)
+#define res_getArrayItem U_ICU_ENTRY_POINT_RENAME(res_getArrayItem)
+#define res_getBinary U_ICU_ENTRY_POINT_RENAME(res_getBinary)
+#define res_getIntVector U_ICU_ENTRY_POINT_RENAME(res_getIntVector)
+#define res_getPublicType U_ICU_ENTRY_POINT_RENAME(res_getPublicType)
+#define res_getResource U_ICU_ENTRY_POINT_RENAME(res_getResource)
+#define res_getString U_ICU_ENTRY_POINT_RENAME(res_getString)
+#define res_getTableItemByIndex U_ICU_ENTRY_POINT_RENAME(res_getTableItemByIndex)
+#define res_getTableItemByKey U_ICU_ENTRY_POINT_RENAME(res_getTableItemByKey)
+#define res_load U_ICU_ENTRY_POINT_RENAME(res_load)
+#define res_read U_ICU_ENTRY_POINT_RENAME(res_read)
+#define res_unload U_ICU_ENTRY_POINT_RENAME(res_unload)
+#define tmutfmtHashTableValueComparator U_ICU_ENTRY_POINT_RENAME(tmutfmtHashTableValueComparator)
+#define triedict_swap U_ICU_ENTRY_POINT_RENAME(triedict_swap)
+#define u_UCharsToChars U_ICU_ENTRY_POINT_RENAME(u_UCharsToChars)
+#define u_austrcpy U_ICU_ENTRY_POINT_RENAME(u_austrcpy)
+#define u_austrncpy U_ICU_ENTRY_POINT_RENAME(u_austrncpy)
+#define u_catclose U_ICU_ENTRY_POINT_RENAME(u_catclose)
+#define u_catgets U_ICU_ENTRY_POINT_RENAME(u_catgets)
+#define u_catopen U_ICU_ENTRY_POINT_RENAME(u_catopen)
+#define u_charAge U_ICU_ENTRY_POINT_RENAME(u_charAge)
+#define u_charDigitValue U_ICU_ENTRY_POINT_RENAME(u_charDigitValue)
+#define u_charDirection U_ICU_ENTRY_POINT_RENAME(u_charDirection)
+#define u_charFromName U_ICU_ENTRY_POINT_RENAME(u_charFromName)
+#define u_charMirror U_ICU_ENTRY_POINT_RENAME(u_charMirror)
+#define u_charName U_ICU_ENTRY_POINT_RENAME(u_charName)
+#define u_charType U_ICU_ENTRY_POINT_RENAME(u_charType)
+#define u_charsToUChars U_ICU_ENTRY_POINT_RENAME(u_charsToUChars)
+#define u_cleanup U_ICU_ENTRY_POINT_RENAME(u_cleanup)
+#define u_countChar32 U_ICU_ENTRY_POINT_RENAME(u_countChar32)
+#define u_digit U_ICU_ENTRY_POINT_RENAME(u_digit)
+#define u_enumCharNames U_ICU_ENTRY_POINT_RENAME(u_enumCharNames)
+#define u_enumCharTypes U_ICU_ENTRY_POINT_RENAME(u_enumCharTypes)
+#define u_errorName U_ICU_ENTRY_POINT_RENAME(u_errorName)
+#define u_fadopt U_ICU_ENTRY_POINT_RENAME(u_fadopt)
+#define u_fclose U_ICU_ENTRY_POINT_RENAME(u_fclose)
+#define u_feof U_ICU_ENTRY_POINT_RENAME(u_feof)
+#define u_fflush U_ICU_ENTRY_POINT_RENAME(u_fflush)
+#define u_fgetConverter U_ICU_ENTRY_POINT_RENAME(u_fgetConverter)
+#define u_fgetc U_ICU_ENTRY_POINT_RENAME(u_fgetc)
+#define u_fgetcodepage U_ICU_ENTRY_POINT_RENAME(u_fgetcodepage)
+#define u_fgetcx U_ICU_ENTRY_POINT_RENAME(u_fgetcx)
+#define u_fgetfile U_ICU_ENTRY_POINT_RENAME(u_fgetfile)
+#define u_fgetlocale U_ICU_ENTRY_POINT_RENAME(u_fgetlocale)
+#define u_fgets U_ICU_ENTRY_POINT_RENAME(u_fgets)
+#define u_file_read U_ICU_ENTRY_POINT_RENAME(u_file_read)
+#define u_file_write U_ICU_ENTRY_POINT_RENAME(u_file_write)
+#define u_file_write_flush U_ICU_ENTRY_POINT_RENAME(u_file_write_flush)
+#define u_finit U_ICU_ENTRY_POINT_RENAME(u_finit)
+#define u_flushDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_flushDefaultConverter)
+#define u_foldCase U_ICU_ENTRY_POINT_RENAME(u_foldCase)
+#define u_fopen U_ICU_ENTRY_POINT_RENAME(u_fopen)
+#define u_forDigit U_ICU_ENTRY_POINT_RENAME(u_forDigit)
+#define u_formatMessage U_ICU_ENTRY_POINT_RENAME(u_formatMessage)
+#define u_formatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_formatMessageWithError)
+#define u_fprintf U_ICU_ENTRY_POINT_RENAME(u_fprintf)
+#define u_fprintf_u U_ICU_ENTRY_POINT_RENAME(u_fprintf_u)
+#define u_fputc U_ICU_ENTRY_POINT_RENAME(u_fputc)
+#define u_fputs U_ICU_ENTRY_POINT_RENAME(u_fputs)
+#define u_frewind U_ICU_ENTRY_POINT_RENAME(u_frewind)
+#define u_fscanf U_ICU_ENTRY_POINT_RENAME(u_fscanf)
+#define u_fscanf_u U_ICU_ENTRY_POINT_RENAME(u_fscanf_u)
+#define u_fsetcodepage U_ICU_ENTRY_POINT_RENAME(u_fsetcodepage)
+#define u_fsetlocale U_ICU_ENTRY_POINT_RENAME(u_fsetlocale)
+#define u_fsettransliterator U_ICU_ENTRY_POINT_RENAME(u_fsettransliterator)
+#define u_fstropen U_ICU_ENTRY_POINT_RENAME(u_fstropen)
+#define u_fungetc U_ICU_ENTRY_POINT_RENAME(u_fungetc)
+#define u_getCombiningClass U_ICU_ENTRY_POINT_RENAME(u_getCombiningClass)
+#define u_getDataDirectory U_ICU_ENTRY_POINT_RENAME(u_getDataDirectory)
+#define u_getDataVersion U_ICU_ENTRY_POINT_RENAME(u_getDataVersion)
+#define u_getDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_getDefaultConverter)
+#define u_getFC_NFKC_Closure U_ICU_ENTRY_POINT_RENAME(u_getFC_NFKC_Closure)
+#define u_getISOComment U_ICU_ENTRY_POINT_RENAME(u_getISOComment)
+#define u_getIntPropertyMaxValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMaxValue)
+#define u_getIntPropertyMinValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMinValue)
+#define u_getIntPropertyValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyValue)
+#define u_getNumericValue U_ICU_ENTRY_POINT_RENAME(u_getNumericValue)
+#define u_getPropertyEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyEnum)
+#define u_getPropertyName U_ICU_ENTRY_POINT_RENAME(u_getPropertyName)
+#define u_getPropertyValueEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueEnum)
+#define u_getPropertyValueName U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueName)
+#define u_getUnicodeProperties U_ICU_ENTRY_POINT_RENAME(u_getUnicodeProperties)
+#define u_getUnicodeVersion U_ICU_ENTRY_POINT_RENAME(u_getUnicodeVersion)
+#define u_getVersion U_ICU_ENTRY_POINT_RENAME(u_getVersion)
+#define u_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(u_hasBinaryProperty)
+#define u_init U_ICU_ENTRY_POINT_RENAME(u_init)
+#define u_isDataOlder U_ICU_ENTRY_POINT_RENAME(u_isDataOlder)
+#define u_isIDIgnorable U_ICU_ENTRY_POINT_RENAME(u_isIDIgnorable)
+#define u_isIDPart U_ICU_ENTRY_POINT_RENAME(u_isIDPart)
+#define u_isIDStart U_ICU_ENTRY_POINT_RENAME(u_isIDStart)
+#define u_isISOControl U_ICU_ENTRY_POINT_RENAME(u_isISOControl)
+#define u_isJavaIDPart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDPart)
+#define u_isJavaIDStart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDStart)
+#define u_isJavaSpaceChar U_ICU_ENTRY_POINT_RENAME(u_isJavaSpaceChar)
+#define u_isMirrored U_ICU_ENTRY_POINT_RENAME(u_isMirrored)
+#define u_isUAlphabetic U_ICU_ENTRY_POINT_RENAME(u_isUAlphabetic)
+#define u_isULowercase U_ICU_ENTRY_POINT_RENAME(u_isULowercase)
+#define u_isUUppercase U_ICU_ENTRY_POINT_RENAME(u_isUUppercase)
+#define u_isUWhiteSpace U_ICU_ENTRY_POINT_RENAME(u_isUWhiteSpace)
+#define u_isWhitespace U_ICU_ENTRY_POINT_RENAME(u_isWhitespace)
+#define u_isalnum U_ICU_ENTRY_POINT_RENAME(u_isalnum)
+#define u_isalnumPOSIX U_ICU_ENTRY_POINT_RENAME(u_isalnumPOSIX)
+#define u_isalpha U_ICU_ENTRY_POINT_RENAME(u_isalpha)
+#define u_isbase U_ICU_ENTRY_POINT_RENAME(u_isbase)
+#define u_isblank U_ICU_ENTRY_POINT_RENAME(u_isblank)
+#define u_iscntrl U_ICU_ENTRY_POINT_RENAME(u_iscntrl)
+#define u_isdefined U_ICU_ENTRY_POINT_RENAME(u_isdefined)
+#define u_isdigit U_ICU_ENTRY_POINT_RENAME(u_isdigit)
+#define u_isgraph U_ICU_ENTRY_POINT_RENAME(u_isgraph)
+#define u_isgraphPOSIX U_ICU_ENTRY_POINT_RENAME(u_isgraphPOSIX)
+#define u_islower U_ICU_ENTRY_POINT_RENAME(u_islower)
+#define u_isprint U_ICU_ENTRY_POINT_RENAME(u_isprint)
+#define u_isprintPOSIX U_ICU_ENTRY_POINT_RENAME(u_isprintPOSIX)
+#define u_ispunct U_ICU_ENTRY_POINT_RENAME(u_ispunct)
+#define u_isspace U_ICU_ENTRY_POINT_RENAME(u_isspace)
+#define u_istitle U_ICU_ENTRY_POINT_RENAME(u_istitle)
+#define u_isupper U_ICU_ENTRY_POINT_RENAME(u_isupper)
+#define u_isxdigit U_ICU_ENTRY_POINT_RENAME(u_isxdigit)
+#define u_lengthOfIdenticalLevelRun U_ICU_ENTRY_POINT_RENAME(u_lengthOfIdenticalLevelRun)
+#define u_locbund_close U_ICU_ENTRY_POINT_RENAME(u_locbund_close)
+#define u_locbund_getNumberFormat U_ICU_ENTRY_POINT_RENAME(u_locbund_getNumberFormat)
+#define u_locbund_init U_ICU_ENTRY_POINT_RENAME(u_locbund_init)
+#define u_memcasecmp U_ICU_ENTRY_POINT_RENAME(u_memcasecmp)
+#define u_memchr U_ICU_ENTRY_POINT_RENAME(u_memchr)
+#define u_memchr32 U_ICU_ENTRY_POINT_RENAME(u_memchr32)
+#define u_memcmp U_ICU_ENTRY_POINT_RENAME(u_memcmp)
+#define u_memcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_memcmpCodePointOrder)
+#define u_memcpy U_ICU_ENTRY_POINT_RENAME(u_memcpy)
+#define u_memmove U_ICU_ENTRY_POINT_RENAME(u_memmove)
+#define u_memrchr U_ICU_ENTRY_POINT_RENAME(u_memrchr)
+#define u_memrchr32 U_ICU_ENTRY_POINT_RENAME(u_memrchr32)
+#define u_memset U_ICU_ENTRY_POINT_RENAME(u_memset)
+#define u_parseMessage U_ICU_ENTRY_POINT_RENAME(u_parseMessage)
+#define u_parseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_parseMessageWithError)
+#define u_printf_parse U_ICU_ENTRY_POINT_RENAME(u_printf_parse)
+#define u_releaseDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_releaseDefaultConverter)
+#define u_scanf_parse U_ICU_ENTRY_POINT_RENAME(u_scanf_parse)
+#define u_setAtomicIncDecFunctions U_ICU_ENTRY_POINT_RENAME(u_setAtomicIncDecFunctions)
+#define u_setDataDirectory U_ICU_ENTRY_POINT_RENAME(u_setDataDirectory)
+#define u_setMemoryFunctions U_ICU_ENTRY_POINT_RENAME(u_setMemoryFunctions)
+#define u_setMutexFunctions U_ICU_ENTRY_POINT_RENAME(u_setMutexFunctions)
+#define u_shapeArabic U_ICU_ENTRY_POINT_RENAME(u_shapeArabic)
+#define u_snprintf U_ICU_ENTRY_POINT_RENAME(u_snprintf)
+#define u_snprintf_u U_ICU_ENTRY_POINT_RENAME(u_snprintf_u)
+#define u_sprintf U_ICU_ENTRY_POINT_RENAME(u_sprintf)
+#define u_sprintf_u U_ICU_ENTRY_POINT_RENAME(u_sprintf_u)
+#define u_sscanf U_ICU_ENTRY_POINT_RENAME(u_sscanf)
+#define u_sscanf_u U_ICU_ENTRY_POINT_RENAME(u_sscanf_u)
+#define u_strCaseCompare U_ICU_ENTRY_POINT_RENAME(u_strCaseCompare)
+#define u_strCompare U_ICU_ENTRY_POINT_RENAME(u_strCompare)
+#define u_strCompareIter U_ICU_ENTRY_POINT_RENAME(u_strCompareIter)
+#define u_strFindFirst U_ICU_ENTRY_POINT_RENAME(u_strFindFirst)
+#define u_strFindLast U_ICU_ENTRY_POINT_RENAME(u_strFindLast)
+#define u_strFoldCase U_ICU_ENTRY_POINT_RENAME(u_strFoldCase)
+#define u_strFromJavaModifiedUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromJavaModifiedUTF8WithSub)
+#define u_strFromPunycode U_ICU_ENTRY_POINT_RENAME(u_strFromPunycode)
+#define u_strFromUTF32 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32)
+#define u_strFromUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32WithSub)
+#define u_strFromUTF8 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8)
+#define u_strFromUTF8Lenient U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8Lenient)
+#define u_strFromUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8WithSub)
+#define u_strFromWCS U_ICU_ENTRY_POINT_RENAME(u_strFromWCS)
+#define u_strHasMoreChar32Than U_ICU_ENTRY_POINT_RENAME(u_strHasMoreChar32Than)
+#define u_strToJavaModifiedUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToJavaModifiedUTF8)
+#define u_strToLower U_ICU_ENTRY_POINT_RENAME(u_strToLower)
+#define u_strToPunycode U_ICU_ENTRY_POINT_RENAME(u_strToPunycode)
+#define u_strToTitle U_ICU_ENTRY_POINT_RENAME(u_strToTitle)
+#define u_strToUTF32 U_ICU_ENTRY_POINT_RENAME(u_strToUTF32)
+#define u_strToUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF32WithSub)
+#define u_strToUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToUTF8)
+#define u_strToUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF8WithSub)
+#define u_strToUpper U_ICU_ENTRY_POINT_RENAME(u_strToUpper)
+#define u_strToWCS U_ICU_ENTRY_POINT_RENAME(u_strToWCS)
+#define u_strcasecmp U_ICU_ENTRY_POINT_RENAME(u_strcasecmp)
+#define u_strcat U_ICU_ENTRY_POINT_RENAME(u_strcat)
+#define u_strchr U_ICU_ENTRY_POINT_RENAME(u_strchr)
+#define u_strchr32 U_ICU_ENTRY_POINT_RENAME(u_strchr32)
+#define u_strcmp U_ICU_ENTRY_POINT_RENAME(u_strcmp)
+#define u_strcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strcmpCodePointOrder)
+#define u_strcmpFold U_ICU_ENTRY_POINT_RENAME(u_strcmpFold)
+#define u_strcpy U_ICU_ENTRY_POINT_RENAME(u_strcpy)
+#define u_strcspn U_ICU_ENTRY_POINT_RENAME(u_strcspn)
+#define u_strlen U_ICU_ENTRY_POINT_RENAME(u_strlen)
+#define u_strncasecmp U_ICU_ENTRY_POINT_RENAME(u_strncasecmp)
+#define u_strncat U_ICU_ENTRY_POINT_RENAME(u_strncat)
+#define u_strncmp U_ICU_ENTRY_POINT_RENAME(u_strncmp)
+#define u_strncmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strncmpCodePointOrder)
+#define u_strncpy U_ICU_ENTRY_POINT_RENAME(u_strncpy)
+#define u_strpbrk U_ICU_ENTRY_POINT_RENAME(u_strpbrk)
+#define u_strrchr U_ICU_ENTRY_POINT_RENAME(u_strrchr)
+#define u_strrchr32 U_ICU_ENTRY_POINT_RENAME(u_strrchr32)
+#define u_strrstr U_ICU_ENTRY_POINT_RENAME(u_strrstr)
+#define u_strspn U_ICU_ENTRY_POINT_RENAME(u_strspn)
+#define u_strstr U_ICU_ENTRY_POINT_RENAME(u_strstr)
+#define u_strtok_r U_ICU_ENTRY_POINT_RENAME(u_strtok_r)
+#define u_terminateChars U_ICU_ENTRY_POINT_RENAME(u_terminateChars)
+#define u_terminateUChar32s U_ICU_ENTRY_POINT_RENAME(u_terminateUChar32s)
+#define u_terminateUChars U_ICU_ENTRY_POINT_RENAME(u_terminateUChars)
+#define u_terminateWChars U_ICU_ENTRY_POINT_RENAME(u_terminateWChars)
+#define u_tolower U_ICU_ENTRY_POINT_RENAME(u_tolower)
+#define u_totitle U_ICU_ENTRY_POINT_RENAME(u_totitle)
+#define u_toupper U_ICU_ENTRY_POINT_RENAME(u_toupper)
+#define u_uastrcpy U_ICU_ENTRY_POINT_RENAME(u_uastrcpy)
+#define u_uastrncpy U_ICU_ENTRY_POINT_RENAME(u_uastrncpy)
+#define u_unescape U_ICU_ENTRY_POINT_RENAME(u_unescape)
+#define u_unescapeAt U_ICU_ENTRY_POINT_RENAME(u_unescapeAt)
+#define u_versionFromString U_ICU_ENTRY_POINT_RENAME(u_versionFromString)
+#define u_versionFromUString U_ICU_ENTRY_POINT_RENAME(u_versionFromUString)
+#define u_versionToString U_ICU_ENTRY_POINT_RENAME(u_versionToString)
+#define u_vformatMessage U_ICU_ENTRY_POINT_RENAME(u_vformatMessage)
+#define u_vformatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vformatMessageWithError)
+#define u_vfprintf U_ICU_ENTRY_POINT_RENAME(u_vfprintf)
+#define u_vfprintf_u U_ICU_ENTRY_POINT_RENAME(u_vfprintf_u)
+#define u_vfscanf U_ICU_ENTRY_POINT_RENAME(u_vfscanf)
+#define u_vfscanf_u U_ICU_ENTRY_POINT_RENAME(u_vfscanf_u)
+#define u_vparseMessage U_ICU_ENTRY_POINT_RENAME(u_vparseMessage)
+#define u_vparseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vparseMessageWithError)
+#define u_vsnprintf U_ICU_ENTRY_POINT_RENAME(u_vsnprintf)
+#define u_vsnprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsnprintf_u)
+#define u_vsprintf U_ICU_ENTRY_POINT_RENAME(u_vsprintf)
+#define u_vsprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsprintf_u)
+#define u_vsscanf U_ICU_ENTRY_POINT_RENAME(u_vsscanf)
+#define u_vsscanf_u U_ICU_ENTRY_POINT_RENAME(u_vsscanf_u)
+#define u_writeDiff U_ICU_ENTRY_POINT_RENAME(u_writeDiff)
+#define u_writeIdenticalLevelRun U_ICU_ENTRY_POINT_RENAME(u_writeIdenticalLevelRun)
+#define u_writeIdenticalLevelRunTwoChars U_ICU_ENTRY_POINT_RENAME(u_writeIdenticalLevelRunTwoChars)
+#define ubidi_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ubidi_addPropertyStarts)
+#define ubidi_close U_ICU_ENTRY_POINT_RENAME(ubidi_close)
+#define ubidi_countParagraphs U_ICU_ENTRY_POINT_RENAME(ubidi_countParagraphs)
+#define ubidi_countRuns U_ICU_ENTRY_POINT_RENAME(ubidi_countRuns)
+#define ubidi_getBaseDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getBaseDirection)
+#define ubidi_getClass U_ICU_ENTRY_POINT_RENAME(ubidi_getClass)
+#define ubidi_getClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_getClassCallback)
+#define ubidi_getCustomizedClass U_ICU_ENTRY_POINT_RENAME(ubidi_getCustomizedClass)
+#define ubidi_getDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getDirection)
+#define ubidi_getJoiningGroup U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningGroup)
+#define ubidi_getJoiningType U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningType)
+#define ubidi_getLength U_ICU_ENTRY_POINT_RENAME(ubidi_getLength)
+#define ubidi_getLevelAt U_ICU_ENTRY_POINT_RENAME(ubidi_getLevelAt)
+#define ubidi_getLevels U_ICU_ENTRY_POINT_RENAME(ubidi_getLevels)
+#define ubidi_getLogicalIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalIndex)
+#define ubidi_getLogicalMap U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalMap)
+#define ubidi_getLogicalRun U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalRun)
+#define ubidi_getMaxValue U_ICU_ENTRY_POINT_RENAME(ubidi_getMaxValue)
+#define ubidi_getMemory U_ICU_ENTRY_POINT_RENAME(ubidi_getMemory)
+#define ubidi_getMirror U_ICU_ENTRY_POINT_RENAME(ubidi_getMirror)
+#define ubidi_getParaLevel U_ICU_ENTRY_POINT_RENAME(ubidi_getParaLevel)
+#define ubidi_getParagraph U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraph)
+#define ubidi_getParagraphByIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraphByIndex)
+#define ubidi_getProcessedLength U_ICU_ENTRY_POINT_RENAME(ubidi_getProcessedLength)
+#define ubidi_getReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingMode)
+#define ubidi_getReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingOptions)
+#define ubidi_getResultLength U_ICU_ENTRY_POINT_RENAME(ubidi_getResultLength)
+#define ubidi_getRuns U_ICU_ENTRY_POINT_RENAME(ubidi_getRuns)
+#define ubidi_getSingleton U_ICU_ENTRY_POINT_RENAME(ubidi_getSingleton)
+#define ubidi_getText U_ICU_ENTRY_POINT_RENAME(ubidi_getText)
+#define ubidi_getVisualIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualIndex)
+#define ubidi_getVisualMap U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualMap)
+#define ubidi_getVisualRun U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualRun)
+#define ubidi_invertMap U_ICU_ENTRY_POINT_RENAME(ubidi_invertMap)
+#define ubidi_isBidiControl U_ICU_ENTRY_POINT_RENAME(ubidi_isBidiControl)
+#define ubidi_isInverse U_ICU_ENTRY_POINT_RENAME(ubidi_isInverse)
+#define ubidi_isJoinControl U_ICU_ENTRY_POINT_RENAME(ubidi_isJoinControl)
+#define ubidi_isMirrored U_ICU_ENTRY_POINT_RENAME(ubidi_isMirrored)
+#define ubidi_isOrderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_isOrderParagraphsLTR)
+#define ubidi_open U_ICU_ENTRY_POINT_RENAME(ubidi_open)
+#define ubidi_openSized U_ICU_ENTRY_POINT_RENAME(ubidi_openSized)
+#define ubidi_orderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_orderParagraphsLTR)
+#define ubidi_reorderLogical U_ICU_ENTRY_POINT_RENAME(ubidi_reorderLogical)
+#define ubidi_reorderVisual U_ICU_ENTRY_POINT_RENAME(ubidi_reorderVisual)
+#define ubidi_setClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_setClassCallback)
+#define ubidi_setInverse U_ICU_ENTRY_POINT_RENAME(ubidi_setInverse)
+#define ubidi_setLine U_ICU_ENTRY_POINT_RENAME(ubidi_setLine)
+#define ubidi_setPara U_ICU_ENTRY_POINT_RENAME(ubidi_setPara)
+#define ubidi_setReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingMode)
+#define ubidi_setReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingOptions)
+#define ubidi_writeReordered U_ICU_ENTRY_POINT_RENAME(ubidi_writeReordered)
+#define ubidi_writeReverse U_ICU_ENTRY_POINT_RENAME(ubidi_writeReverse)
+#define ublock_getCode U_ICU_ENTRY_POINT_RENAME(ublock_getCode)
+#define ubrk_close U_ICU_ENTRY_POINT_RENAME(ubrk_close)
+#define ubrk_countAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_countAvailable)
+#define ubrk_current U_ICU_ENTRY_POINT_RENAME(ubrk_current)
+#define ubrk_first U_ICU_ENTRY_POINT_RENAME(ubrk_first)
+#define ubrk_following U_ICU_ENTRY_POINT_RENAME(ubrk_following)
+#define ubrk_getAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_getAvailable)
+#define ubrk_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ubrk_getLocaleByType)
+#define ubrk_getRuleStatus U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatus)
+#define ubrk_getRuleStatusVec U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatusVec)
+#define ubrk_isBoundary U_ICU_ENTRY_POINT_RENAME(ubrk_isBoundary)
+#define ubrk_last U_ICU_ENTRY_POINT_RENAME(ubrk_last)
+#define ubrk_next U_ICU_ENTRY_POINT_RENAME(ubrk_next)
+#define ubrk_open U_ICU_ENTRY_POINT_RENAME(ubrk_open)
+#define ubrk_openRules U_ICU_ENTRY_POINT_RENAME(ubrk_openRules)
+#define ubrk_preceding U_ICU_ENTRY_POINT_RENAME(ubrk_preceding)
+#define ubrk_previous U_ICU_ENTRY_POINT_RENAME(ubrk_previous)
+#define ubrk_safeClone U_ICU_ENTRY_POINT_RENAME(ubrk_safeClone)
+#define ubrk_setText U_ICU_ENTRY_POINT_RENAME(ubrk_setText)
+#define ubrk_setUText U_ICU_ENTRY_POINT_RENAME(ubrk_setUText)
+#define ubrk_swap U_ICU_ENTRY_POINT_RENAME(ubrk_swap)
+#define ucal_add U_ICU_ENTRY_POINT_RENAME(ucal_add)
+#define ucal_clear U_ICU_ENTRY_POINT_RENAME(ucal_clear)
+#define ucal_clearField U_ICU_ENTRY_POINT_RENAME(ucal_clearField)
+#define ucal_clone U_ICU_ENTRY_POINT_RENAME(ucal_clone)
+#define ucal_close U_ICU_ENTRY_POINT_RENAME(ucal_close)
+#define ucal_countAvailable U_ICU_ENTRY_POINT_RENAME(ucal_countAvailable)
+#define ucal_equivalentTo U_ICU_ENTRY_POINT_RENAME(ucal_equivalentTo)
+#define ucal_get U_ICU_ENTRY_POINT_RENAME(ucal_get)
+#define ucal_getAttribute U_ICU_ENTRY_POINT_RENAME(ucal_getAttribute)
+#define ucal_getAvailable U_ICU_ENTRY_POINT_RENAME(ucal_getAvailable)
+#define ucal_getCanonicalTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getCanonicalTimeZoneID)
+#define ucal_getDSTSavings U_ICU_ENTRY_POINT_RENAME(ucal_getDSTSavings)
+#define ucal_getDayOfWeekType U_ICU_ENTRY_POINT_RENAME(ucal_getDayOfWeekType)
+#define ucal_getDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getDefaultTimeZone)
+#define ucal_getGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_getGregorianChange)
+#define ucal_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucal_getKeywordValuesForLocale)
+#define ucal_getLimit U_ICU_ENTRY_POINT_RENAME(ucal_getLimit)
+#define ucal_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucal_getLocaleByType)
+#define ucal_getMillis U_ICU_ENTRY_POINT_RENAME(ucal_getMillis)
+#define ucal_getNow U_ICU_ENTRY_POINT_RENAME(ucal_getNow)
+#define ucal_getTZDataVersion U_ICU_ENTRY_POINT_RENAME(ucal_getTZDataVersion)
+#define ucal_getTimeZoneDisplayName U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneDisplayName)
+#define ucal_getType U_ICU_ENTRY_POINT_RENAME(ucal_getType)
+#define ucal_getWeekendTransition U_ICU_ENTRY_POINT_RENAME(ucal_getWeekendTransition)
+#define ucal_inDaylightTime U_ICU_ENTRY_POINT_RENAME(ucal_inDaylightTime)
+#define ucal_isSet U_ICU_ENTRY_POINT_RENAME(ucal_isSet)
+#define ucal_isWeekend U_ICU_ENTRY_POINT_RENAME(ucal_isWeekend)
+#define ucal_open U_ICU_ENTRY_POINT_RENAME(ucal_open)
+#define ucal_openCountryTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openCountryTimeZones)
+#define ucal_openTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openTimeZones)
+#define ucal_roll U_ICU_ENTRY_POINT_RENAME(ucal_roll)
+#define ucal_set U_ICU_ENTRY_POINT_RENAME(ucal_set)
+#define ucal_setAttribute U_ICU_ENTRY_POINT_RENAME(ucal_setAttribute)
+#define ucal_setDate U_ICU_ENTRY_POINT_RENAME(ucal_setDate)
+#define ucal_setDateTime U_ICU_ENTRY_POINT_RENAME(ucal_setDateTime)
+#define ucal_setDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setDefaultTimeZone)
+#define ucal_setGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_setGregorianChange)
+#define ucal_setMillis U_ICU_ENTRY_POINT_RENAME(ucal_setMillis)
+#define ucal_setTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setTimeZone)
+#define ucase_addCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addCaseClosure)
+#define ucase_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ucase_addPropertyStarts)
+#define ucase_addStringCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addStringCaseClosure)
+#define ucase_fold U_ICU_ENTRY_POINT_RENAME(ucase_fold)
+#define ucase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ucase_getCaseLocale)
+#define ucase_getSingleton U_ICU_ENTRY_POINT_RENAME(ucase_getSingleton)
+#define ucase_getType U_ICU_ENTRY_POINT_RENAME(ucase_getType)
+#define ucase_getTypeOrIgnorable U_ICU_ENTRY_POINT_RENAME(ucase_getTypeOrIgnorable)
+#define ucase_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(ucase_hasBinaryProperty)
+#define ucase_isCaseSensitive U_ICU_ENTRY_POINT_RENAME(ucase_isCaseSensitive)
+#define ucase_isSoftDotted U_ICU_ENTRY_POINT_RENAME(ucase_isSoftDotted)
+#define ucase_toFullFolding U_ICU_ENTRY_POINT_RENAME(ucase_toFullFolding)
+#define ucase_toFullLower U_ICU_ENTRY_POINT_RENAME(ucase_toFullLower)
+#define ucase_toFullTitle U_ICU_ENTRY_POINT_RENAME(ucase_toFullTitle)
+#define ucase_toFullUpper U_ICU_ENTRY_POINT_RENAME(ucase_toFullUpper)
+#define ucase_tolower U_ICU_ENTRY_POINT_RENAME(ucase_tolower)
+#define ucase_totitle U_ICU_ENTRY_POINT_RENAME(ucase_totitle)
+#define ucase_toupper U_ICU_ENTRY_POINT_RENAME(ucase_toupper)
+#define ucasemap_close U_ICU_ENTRY_POINT_RENAME(ucasemap_close)
+#define ucasemap_getBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_getBreakIterator)
+#define ucasemap_getLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_getLocale)
+#define ucasemap_getOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_getOptions)
+#define ucasemap_open U_ICU_ENTRY_POINT_RENAME(ucasemap_open)
+#define ucasemap_setBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_setBreakIterator)
+#define ucasemap_setLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_setLocale)
+#define ucasemap_setOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_setOptions)
+#define ucasemap_toTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_toTitle)
+#define ucasemap_utf8FoldCase U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8FoldCase)
+#define ucasemap_utf8ToLower U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToLower)
+#define ucasemap_utf8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToTitle)
+#define ucasemap_utf8ToUpper U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToUpper)
+#define ucd_close U_ICU_ENTRY_POINT_RENAME(ucd_close)
+#define ucd_flushCache U_ICU_ENTRY_POINT_RENAME(ucd_flushCache)
+#define ucd_freeCache U_ICU_ENTRY_POINT_RENAME(ucd_freeCache)
+#define ucd_getCollator U_ICU_ENTRY_POINT_RENAME(ucd_getCollator)
+#define ucd_open U_ICU_ENTRY_POINT_RENAME(ucd_open)
+#define uchar_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uchar_addPropertyStarts)
+#define uchar_swapNames U_ICU_ENTRY_POINT_RENAME(uchar_swapNames)
+#define ucln_cleanupOne U_ICU_ENTRY_POINT_RENAME(ucln_cleanupOne)
+#define ucln_common_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_common_registerCleanup)
+#define ucln_i18n_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_i18n_registerCleanup)
+#define ucln_io_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_io_registerCleanup)
+#define ucln_lib_cleanup U_ICU_ENTRY_POINT_RENAME(ucln_lib_cleanup)
+#define ucln_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_registerCleanup)
+#define ucnv_MBCSFromUChar32 U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUChar32)
+#define ucnv_MBCSFromUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUnicodeWithOffsets)
+#define ucnv_MBCSGetFilteredUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetFilteredUnicodeSetForUnicode)
+#define ucnv_MBCSGetType U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetType)
+#define ucnv_MBCSGetUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetUnicodeSetForUnicode)
+#define ucnv_MBCSIsLeadByte U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSIsLeadByte)
+#define ucnv_MBCSSimpleGetNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSSimpleGetNextUChar)
+#define ucnv_MBCSToUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSToUnicodeWithOffsets)
+#define ucnv_bld_countAvailableConverters U_ICU_ENTRY_POINT_RENAME(ucnv_bld_countAvailableConverters)
+#define ucnv_bld_getAvailableConverter U_ICU_ENTRY_POINT_RENAME(ucnv_bld_getAvailableConverter)
+#define ucnv_canCreateConverter U_ICU_ENTRY_POINT_RENAME(ucnv_canCreateConverter)
+#define ucnv_cbFromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteBytes)
+#define ucnv_cbFromUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteSub)
+#define ucnv_cbFromUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteUChars)
+#define ucnv_cbToUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteSub)
+#define ucnv_cbToUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteUChars)
+#define ucnv_close U_ICU_ENTRY_POINT_RENAME(ucnv_close)
+#define ucnv_compareNames U_ICU_ENTRY_POINT_RENAME(ucnv_compareNames)
+#define ucnv_convert U_ICU_ENTRY_POINT_RENAME(ucnv_convert)
+#define ucnv_convertEx U_ICU_ENTRY_POINT_RENAME(ucnv_convertEx)
+#define ucnv_countAliases U_ICU_ENTRY_POINT_RENAME(ucnv_countAliases)
+#define ucnv_countAvailable U_ICU_ENTRY_POINT_RENAME(ucnv_countAvailable)
+#define ucnv_countStandards U_ICU_ENTRY_POINT_RENAME(ucnv_countStandards)
+#define ucnv_createAlgorithmicConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createAlgorithmicConverter)
+#define ucnv_createConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createConverter)
+#define ucnv_createConverterFromPackage U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromPackage)
+#define ucnv_createConverterFromSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromSharedData)
+#define ucnv_detectUnicodeSignature U_ICU_ENTRY_POINT_RENAME(ucnv_detectUnicodeSignature)
+#define ucnv_extContinueMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchFromU)
+#define ucnv_extContinueMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchToU)
+#define ucnv_extGetUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_extGetUnicodeSet)
+#define ucnv_extInitialMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchFromU)
+#define ucnv_extInitialMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchToU)
+#define ucnv_extSimpleMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchFromU)
+#define ucnv_extSimpleMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchToU)
+#define ucnv_fixFileSeparator U_ICU_ENTRY_POINT_RENAME(ucnv_fixFileSeparator)
+#define ucnv_flushCache U_ICU_ENTRY_POINT_RENAME(ucnv_flushCache)
+#define ucnv_fromAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_fromAlgorithmic)
+#define ucnv_fromUChars U_ICU_ENTRY_POINT_RENAME(ucnv_fromUChars)
+#define ucnv_fromUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_fromUCountPending)
+#define ucnv_fromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_fromUWriteBytes)
+#define ucnv_fromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode)
+#define ucnv_fromUnicode_UTF8 U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8)
+#define ucnv_fromUnicode_UTF8_OFFSETS_LOGIC U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8_OFFSETS_LOGIC)
+#define ucnv_getAlias U_ICU_ENTRY_POINT_RENAME(ucnv_getAlias)
+#define ucnv_getAliases U_ICU_ENTRY_POINT_RENAME(ucnv_getAliases)
+#define ucnv_getAvailableName U_ICU_ENTRY_POINT_RENAME(ucnv_getAvailableName)
+#define ucnv_getCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_getCCSID)
+#define ucnv_getCanonicalName U_ICU_ENTRY_POINT_RENAME(ucnv_getCanonicalName)
+#define ucnv_getCompleteUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getCompleteUnicodeSet)
+#define ucnv_getDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_getDefaultName)
+#define ucnv_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucnv_getDisplayName)
+#define ucnv_getFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getFromUCallBack)
+#define ucnv_getInvalidChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidChars)
+#define ucnv_getInvalidUChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidUChars)
+#define ucnv_getMaxCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMaxCharSize)
+#define ucnv_getMinCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMinCharSize)
+#define ucnv_getName U_ICU_ENTRY_POINT_RENAME(ucnv_getName)
+#define ucnv_getNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_getNextUChar)
+#define ucnv_getNonSurrogateUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getNonSurrogateUnicodeSet)
+#define ucnv_getPlatform U_ICU_ENTRY_POINT_RENAME(ucnv_getPlatform)
+#define ucnv_getStandard U_ICU_ENTRY_POINT_RENAME(ucnv_getStandard)
+#define ucnv_getStandardName U_ICU_ENTRY_POINT_RENAME(ucnv_getStandardName)
+#define ucnv_getStarters U_ICU_ENTRY_POINT_RENAME(ucnv_getStarters)
+#define ucnv_getSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_getSubstChars)
+#define ucnv_getToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getToUCallBack)
+#define ucnv_getType U_ICU_ENTRY_POINT_RENAME(ucnv_getType)
+#define ucnv_getUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getUnicodeSet)
+#define ucnv_incrementRefCount U_ICU_ENTRY_POINT_RENAME(ucnv_incrementRefCount)
+#define ucnv_io_countKnownConverters U_ICU_ENTRY_POINT_RENAME(ucnv_io_countKnownConverters)
+#define ucnv_io_getConverterName U_ICU_ENTRY_POINT_RENAME(ucnv_io_getConverterName)
+#define ucnv_io_stripASCIIForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripASCIIForCompare)
+#define ucnv_io_stripEBCDICForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripEBCDICForCompare)
+#define ucnv_isAmbiguous U_ICU_ENTRY_POINT_RENAME(ucnv_isAmbiguous)
+#define ucnv_load U_ICU_ENTRY_POINT_RENAME(ucnv_load)
+#define ucnv_loadSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_loadSharedData)
+#define ucnv_open U_ICU_ENTRY_POINT_RENAME(ucnv_open)
+#define ucnv_openAllNames U_ICU_ENTRY_POINT_RENAME(ucnv_openAllNames)
+#define ucnv_openCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_openCCSID)
+#define ucnv_openPackage U_ICU_ENTRY_POINT_RENAME(ucnv_openPackage)
+#define ucnv_openStandardNames U_ICU_ENTRY_POINT_RENAME(ucnv_openStandardNames)
+#define ucnv_openU U_ICU_ENTRY_POINT_RENAME(ucnv_openU)
+#define ucnv_reset U_ICU_ENTRY_POINT_RENAME(ucnv_reset)
+#define ucnv_resetFromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetFromUnicode)
+#define ucnv_resetToUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetToUnicode)
+#define ucnv_safeClone U_ICU_ENTRY_POINT_RENAME(ucnv_safeClone)
+#define ucnv_setDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_setDefaultName)
+#define ucnv_setFallback U_ICU_ENTRY_POINT_RENAME(ucnv_setFallback)
+#define ucnv_setFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setFromUCallBack)
+#define ucnv_setSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstChars)
+#define ucnv_setSubstString U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstString)
+#define ucnv_setToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setToUCallBack)
+#define ucnv_swap U_ICU_ENTRY_POINT_RENAME(ucnv_swap)
+#define ucnv_swapAliases U_ICU_ENTRY_POINT_RENAME(ucnv_swapAliases)
+#define ucnv_toAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_toAlgorithmic)
+#define ucnv_toUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUChars)
+#define ucnv_toUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_toUCountPending)
+#define ucnv_toUWriteCodePoint U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteCodePoint)
+#define ucnv_toUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteUChars)
+#define ucnv_toUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_toUnicode)
+#define ucnv_unload U_ICU_ENTRY_POINT_RENAME(ucnv_unload)
+#define ucnv_unloadSharedDataIfReady U_ICU_ENTRY_POINT_RENAME(ucnv_unloadSharedDataIfReady)
+#define ucnv_usesFallback U_ICU_ENTRY_POINT_RENAME(ucnv_usesFallback)
+#define ucnvsel_close U_ICU_ENTRY_POINT_RENAME(ucnvsel_close)
+#define ucnvsel_open U_ICU_ENTRY_POINT_RENAME(ucnvsel_open)
+#define ucnvsel_openFromSerialized U_ICU_ENTRY_POINT_RENAME(ucnvsel_openFromSerialized)
+#define ucnvsel_selectForString U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForString)
+#define ucnvsel_selectForUTF8 U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForUTF8)
+#define ucnvsel_serialize U_ICU_ENTRY_POINT_RENAME(ucnvsel_serialize)
+#define ucol_allocWeights U_ICU_ENTRY_POINT_RENAME(ucol_allocWeights)
+#define ucol_assembleTailoringTable U_ICU_ENTRY_POINT_RENAME(ucol_assembleTailoringTable)
+#define ucol_buildPermutationTable U_ICU_ENTRY_POINT_RENAME(ucol_buildPermutationTable)
+#define ucol_calcSortKey U_ICU_ENTRY_POINT_RENAME(ucol_calcSortKey)
+#define ucol_calcSortKeySimpleTertiary U_ICU_ENTRY_POINT_RENAME(ucol_calcSortKeySimpleTertiary)
+#define ucol_cloneBinary U_ICU_ENTRY_POINT_RENAME(ucol_cloneBinary)
+#define ucol_cloneRuleData U_ICU_ENTRY_POINT_RENAME(ucol_cloneRuleData)
+#define ucol_close U_ICU_ENTRY_POINT_RENAME(ucol_close)
+#define ucol_closeElements U_ICU_ENTRY_POINT_RENAME(ucol_closeElements)
+#define ucol_countAvailable U_ICU_ENTRY_POINT_RENAME(ucol_countAvailable)
+#define ucol_createElements U_ICU_ENTRY_POINT_RENAME(ucol_createElements)
+#define ucol_doCE U_ICU_ENTRY_POINT_RENAME(ucol_doCE)
+#define ucol_equal U_ICU_ENTRY_POINT_RENAME(ucol_equal)
+#define ucol_equals U_ICU_ENTRY_POINT_RENAME(ucol_equals)
+#define ucol_findReorderingEntry U_ICU_ENTRY_POINT_RENAME(ucol_findReorderingEntry)
+#define ucol_forceHanImplicit U_ICU_ENTRY_POINT_RENAME(ucol_forceHanImplicit)
+#define ucol_forgetUCA U_ICU_ENTRY_POINT_RENAME(ucol_forgetUCA)
+#define ucol_freeOffsetBuffer U_ICU_ENTRY_POINT_RENAME(ucol_freeOffsetBuffer)
+#define ucol_getAttribute U_ICU_ENTRY_POINT_RENAME(ucol_getAttribute)
+#define ucol_getAttributeOrDefault U_ICU_ENTRY_POINT_RENAME(ucol_getAttributeOrDefault)
+#define ucol_getAvailable U_ICU_ENTRY_POINT_RENAME(ucol_getAvailable)
+#define ucol_getBound U_ICU_ENTRY_POINT_RENAME(ucol_getBound)
+#define ucol_getCEStrengthDifference U_ICU_ENTRY_POINT_RENAME(ucol_getCEStrengthDifference)
+#define ucol_getContractions U_ICU_ENTRY_POINT_RENAME(ucol_getContractions)
+#define ucol_getContractionsAndExpansions U_ICU_ENTRY_POINT_RENAME(ucol_getContractionsAndExpansions)
+#define ucol_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucol_getDisplayName)
+#define ucol_getFirstCE U_ICU_ENTRY_POINT_RENAME(ucol_getFirstCE)
+#define ucol_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ucol_getFunctionalEquivalent)
+#define ucol_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValues)
+#define ucol_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValuesForLocale)
+#define ucol_getKeywords U_ICU_ENTRY_POINT_RENAME(ucol_getKeywords)
+#define ucol_getLeadBytesForReorderCode U_ICU_ENTRY_POINT_RENAME(ucol_getLeadBytesForReorderCode)
+#define ucol_getLocale U_ICU_ENTRY_POINT_RENAME(ucol_getLocale)
+#define ucol_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucol_getLocaleByType)
+#define ucol_getMaxExpansion U_ICU_ENTRY_POINT_RENAME(ucol_getMaxExpansion)
+#define ucol_getNextCE U_ICU_ENTRY_POINT_RENAME(ucol_getNextCE)
+#define ucol_getOffset U_ICU_ENTRY_POINT_RENAME(ucol_getOffset)
+#define ucol_getPrevCE U_ICU_ENTRY_POINT_RENAME(ucol_getPrevCE)
+#define ucol_getReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_getReorderCodes)
+#define ucol_getReorderCodesForLeadByte U_ICU_ENTRY_POINT_RENAME(ucol_getReorderCodesForLeadByte)
+#define ucol_getRules U_ICU_ENTRY_POINT_RENAME(ucol_getRules)
+#define ucol_getRulesEx U_ICU_ENTRY_POINT_RENAME(ucol_getRulesEx)
+#define ucol_getShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_getShortDefinitionString)
+#define ucol_getSortKey U_ICU_ENTRY_POINT_RENAME(ucol_getSortKey)
+#define ucol_getSortKeySize U_ICU_ENTRY_POINT_RENAME(ucol_getSortKeySize)
+#define ucol_getSortKeyWithAllocation U_ICU_ENTRY_POINT_RENAME(ucol_getSortKeyWithAllocation)
+#define ucol_getStrength U_ICU_ENTRY_POINT_RENAME(ucol_getStrength)
+#define ucol_getTailoredSet U_ICU_ENTRY_POINT_RENAME(ucol_getTailoredSet)
+#define ucol_getUCAVersion U_ICU_ENTRY_POINT_RENAME(ucol_getUCAVersion)
+#define ucol_getUnsafeSet U_ICU_ENTRY_POINT_RENAME(ucol_getUnsafeSet)
+#define ucol_getVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_getVariableTop)
+#define ucol_getVersion U_ICU_ENTRY_POINT_RENAME(ucol_getVersion)
+#define ucol_greater U_ICU_ENTRY_POINT_RENAME(ucol_greater)
+#define ucol_greaterOrEqual U_ICU_ENTRY_POINT_RENAME(ucol_greaterOrEqual)
+#define ucol_initBuffers U_ICU_ENTRY_POINT_RENAME(ucol_initBuffers)
+#define ucol_initCollator U_ICU_ENTRY_POINT_RENAME(ucol_initCollator)
+#define ucol_initInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_initInverseUCA)
+#define ucol_initUCA U_ICU_ENTRY_POINT_RENAME(ucol_initUCA)
+#define ucol_inv_getNextCE U_ICU_ENTRY_POINT_RENAME(ucol_inv_getNextCE)
+#define ucol_inv_getPrevCE U_ICU_ENTRY_POINT_RENAME(ucol_inv_getPrevCE)
+#define ucol_isTailored U_ICU_ENTRY_POINT_RENAME(ucol_isTailored)
+#define ucol_keyHashCode U_ICU_ENTRY_POINT_RENAME(ucol_keyHashCode)
+#define ucol_looksLikeCollationBinary U_ICU_ENTRY_POINT_RENAME(ucol_looksLikeCollationBinary)
+#define ucol_mergeSortkeys U_ICU_ENTRY_POINT_RENAME(ucol_mergeSortkeys)
+#define ucol_next U_ICU_ENTRY_POINT_RENAME(ucol_next)
+#define ucol_nextProcessed U_ICU_ENTRY_POINT_RENAME(ucol_nextProcessed)
+#define ucol_nextSortKeyPart U_ICU_ENTRY_POINT_RENAME(ucol_nextSortKeyPart)
+#define ucol_nextWeight U_ICU_ENTRY_POINT_RENAME(ucol_nextWeight)
+#define ucol_normalizeShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_normalizeShortDefinitionString)
+#define ucol_open U_ICU_ENTRY_POINT_RENAME(ucol_open)
+#define ucol_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ucol_openAvailableLocales)
+#define ucol_openBinary U_ICU_ENTRY_POINT_RENAME(ucol_openBinary)
+#define ucol_openElements U_ICU_ENTRY_POINT_RENAME(ucol_openElements)
+#define ucol_openFromShortString U_ICU_ENTRY_POINT_RENAME(ucol_openFromShortString)
+#define ucol_openRules U_ICU_ENTRY_POINT_RENAME(ucol_openRules)
+#define ucol_openRulesForImport U_ICU_ENTRY_POINT_RENAME(ucol_openRulesForImport)
+#define ucol_open_internal U_ICU_ENTRY_POINT_RENAME(ucol_open_internal)
+#define ucol_prepareShortStringOpen U_ICU_ENTRY_POINT_RENAME(ucol_prepareShortStringOpen)
+#define ucol_previous U_ICU_ENTRY_POINT_RENAME(ucol_previous)
+#define ucol_previousProcessed U_ICU_ENTRY_POINT_RENAME(ucol_previousProcessed)
+#define ucol_primaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_primaryOrder)
+#define ucol_prv_getSpecialCE U_ICU_ENTRY_POINT_RENAME(ucol_prv_getSpecialCE)
+#define ucol_prv_getSpecialPrevCE U_ICU_ENTRY_POINT_RENAME(ucol_prv_getSpecialPrevCE)
+#define ucol_reset U_ICU_ENTRY_POINT_RENAME(ucol_reset)
+#define ucol_restoreVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_restoreVariableTop)
+#define ucol_safeClone U_ICU_ENTRY_POINT_RENAME(ucol_safeClone)
+#define ucol_secondaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_secondaryOrder)
+#define ucol_setAttribute U_ICU_ENTRY_POINT_RENAME(ucol_setAttribute)
+#define ucol_setOffset U_ICU_ENTRY_POINT_RENAME(ucol_setOffset)
+#define ucol_setOptionsFromHeader U_ICU_ENTRY_POINT_RENAME(ucol_setOptionsFromHeader)
+#define ucol_setReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_setReorderCodes)
+#define ucol_setReqValidLocales U_ICU_ENTRY_POINT_RENAME(ucol_setReqValidLocales)
+#define ucol_setStrength U_ICU_ENTRY_POINT_RENAME(ucol_setStrength)
+#define ucol_setText U_ICU_ENTRY_POINT_RENAME(ucol_setText)
+#define ucol_setVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_setVariableTop)
+#define ucol_strcoll U_ICU_ENTRY_POINT_RENAME(ucol_strcoll)
+#define ucol_strcollIter U_ICU_ENTRY_POINT_RENAME(ucol_strcollIter)
+#define ucol_swap U_ICU_ENTRY_POINT_RENAME(ucol_swap)
+#define ucol_swapBinary U_ICU_ENTRY_POINT_RENAME(ucol_swapBinary)
+#define ucol_swapInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_swapInverseUCA)
+#define ucol_tertiaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_tertiaryOrder)
+#define ucol_tok_assembleTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_assembleTokenList)
+#define ucol_tok_closeTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_closeTokenList)
+#define ucol_tok_getNextArgument U_ICU_ENTRY_POINT_RENAME(ucol_tok_getNextArgument)
+#define ucol_tok_getRulesFromBundle U_ICU_ENTRY_POINT_RENAME(ucol_tok_getRulesFromBundle)
+#define ucol_tok_initTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_initTokenList)
+#define ucol_tok_parseNextToken U_ICU_ENTRY_POINT_RENAME(ucol_tok_parseNextToken)
+#define ucol_updateInternalState U_ICU_ENTRY_POINT_RENAME(ucol_updateInternalState)
+#define ucsdet_close U_ICU_ENTRY_POINT_RENAME(ucsdet_close)
+#define ucsdet_detect U_ICU_ENTRY_POINT_RENAME(ucsdet_detect)
+#define ucsdet_detectAll U_ICU_ENTRY_POINT_RENAME(ucsdet_detectAll)
+#define ucsdet_enableInputFilter U_ICU_ENTRY_POINT_RENAME(ucsdet_enableInputFilter)
+#define ucsdet_getAllDetectableCharsets U_ICU_ENTRY_POINT_RENAME(ucsdet_getAllDetectableCharsets)
+#define ucsdet_getConfidence U_ICU_ENTRY_POINT_RENAME(ucsdet_getConfidence)
+#define ucsdet_getLanguage U_ICU_ENTRY_POINT_RENAME(ucsdet_getLanguage)
+#define ucsdet_getName U_ICU_ENTRY_POINT_RENAME(ucsdet_getName)
+#define ucsdet_getUChars U_ICU_ENTRY_POINT_RENAME(ucsdet_getUChars)
+#define ucsdet_isInputFilterEnabled U_ICU_ENTRY_POINT_RENAME(ucsdet_isInputFilterEnabled)
+#define ucsdet_open U_ICU_ENTRY_POINT_RENAME(ucsdet_open)
+#define ucsdet_setDeclaredEncoding U_ICU_ENTRY_POINT_RENAME(ucsdet_setDeclaredEncoding)
+#define ucsdet_setText U_ICU_ENTRY_POINT_RENAME(ucsdet_setText)
+#define ucurr_countCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_countCurrencies)
+#define ucurr_forLocale U_ICU_ENTRY_POINT_RENAME(ucurr_forLocale)
+#define ucurr_forLocaleAndDate U_ICU_ENTRY_POINT_RENAME(ucurr_forLocaleAndDate)
+#define ucurr_getDefaultFractionDigits U_ICU_ENTRY_POINT_RENAME(ucurr_getDefaultFractionDigits)
+#define ucurr_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucurr_getKeywordValuesForLocale)
+#define ucurr_getName U_ICU_ENTRY_POINT_RENAME(ucurr_getName)
+#define ucurr_getPluralName U_ICU_ENTRY_POINT_RENAME(ucurr_getPluralName)
+#define ucurr_getRoundingIncrement U_ICU_ENTRY_POINT_RENAME(ucurr_getRoundingIncrement)
+#define ucurr_openISOCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_openISOCurrencies)
+#define ucurr_register U_ICU_ENTRY_POINT_RENAME(ucurr_register)
+#define ucurr_unregister U_ICU_ENTRY_POINT_RENAME(ucurr_unregister)
+#define udat_applyPattern U_ICU_ENTRY_POINT_RENAME(udat_applyPattern)
+#define udat_applyPatternRelative U_ICU_ENTRY_POINT_RENAME(udat_applyPatternRelative)
+#define udat_clone U_ICU_ENTRY_POINT_RENAME(udat_clone)
+#define udat_close U_ICU_ENTRY_POINT_RENAME(udat_close)
+#define udat_countAvailable U_ICU_ENTRY_POINT_RENAME(udat_countAvailable)
+#define udat_countSymbols U_ICU_ENTRY_POINT_RENAME(udat_countSymbols)
+#define udat_format U_ICU_ENTRY_POINT_RENAME(udat_format)
+#define udat_get2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_get2DigitYearStart)
+#define udat_getAvailable U_ICU_ENTRY_POINT_RENAME(udat_getAvailable)
+#define udat_getCalendar U_ICU_ENTRY_POINT_RENAME(udat_getCalendar)
+#define udat_getLocaleByType U_ICU_ENTRY_POINT_RENAME(udat_getLocaleByType)
+#define udat_getNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_getNumberFormat)
+#define udat_getSymbols U_ICU_ENTRY_POINT_RENAME(udat_getSymbols)
+#define udat_isLenient U_ICU_ENTRY_POINT_RENAME(udat_isLenient)
+#define udat_open U_ICU_ENTRY_POINT_RENAME(udat_open)
+#define udat_parse U_ICU_ENTRY_POINT_RENAME(udat_parse)
+#define udat_parseCalendar U_ICU_ENTRY_POINT_RENAME(udat_parseCalendar)
+#define udat_set2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_set2DigitYearStart)
+#define udat_setCalendar U_ICU_ENTRY_POINT_RENAME(udat_setCalendar)
+#define udat_setLenient U_ICU_ENTRY_POINT_RENAME(udat_setLenient)
+#define udat_setNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_setNumberFormat)
+#define udat_setSymbols U_ICU_ENTRY_POINT_RENAME(udat_setSymbols)
+#define udat_toCalendarDateField U_ICU_ENTRY_POINT_RENAME(udat_toCalendarDateField)
+#define udat_toPattern U_ICU_ENTRY_POINT_RENAME(udat_toPattern)
+#define udat_toPatternRelativeDate U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeDate)
+#define udat_toPatternRelativeTime U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeTime)
+#define udata_checkCommonData U_ICU_ENTRY_POINT_RENAME(udata_checkCommonData)
+#define udata_close U_ICU_ENTRY_POINT_RENAME(udata_close)
+#define udata_closeSwapper U_ICU_ENTRY_POINT_RENAME(udata_closeSwapper)
+#define udata_getHeaderSize U_ICU_ENTRY_POINT_RENAME(udata_getHeaderSize)
+#define udata_getInfo U_ICU_ENTRY_POINT_RENAME(udata_getInfo)
+#define udata_getInfoSize U_ICU_ENTRY_POINT_RENAME(udata_getInfoSize)
+#define udata_getLength U_ICU_ENTRY_POINT_RENAME(udata_getLength)
+#define udata_getMemory U_ICU_ENTRY_POINT_RENAME(udata_getMemory)
+#define udata_getRawMemory U_ICU_ENTRY_POINT_RENAME(udata_getRawMemory)
+#define udata_open U_ICU_ENTRY_POINT_RENAME(udata_open)
+#define udata_openChoice U_ICU_ENTRY_POINT_RENAME(udata_openChoice)
+#define udata_openSwapper U_ICU_ENTRY_POINT_RENAME(udata_openSwapper)
+#define udata_openSwapperForInputData U_ICU_ENTRY_POINT_RENAME(udata_openSwapperForInputData)
+#define udata_printError U_ICU_ENTRY_POINT_RENAME(udata_printError)
+#define udata_readInt16 U_ICU_ENTRY_POINT_RENAME(udata_readInt16)
+#define udata_readInt32 U_ICU_ENTRY_POINT_RENAME(udata_readInt32)
+#define udata_setAppData U_ICU_ENTRY_POINT_RENAME(udata_setAppData)
+#define udata_setCommonData U_ICU_ENTRY_POINT_RENAME(udata_setCommonData)
+#define udata_setFileAccess U_ICU_ENTRY_POINT_RENAME(udata_setFileAccess)
+#define udata_swapDataHeader U_ICU_ENTRY_POINT_RENAME(udata_swapDataHeader)
+#define udata_swapInvStringBlock U_ICU_ENTRY_POINT_RENAME(udata_swapInvStringBlock)
+#define udatpg_addPattern U_ICU_ENTRY_POINT_RENAME(udatpg_addPattern)
+#define udatpg_clone U_ICU_ENTRY_POINT_RENAME(udatpg_clone)
+#define udatpg_close U_ICU_ENTRY_POINT_RENAME(udatpg_close)
+#define udatpg_getAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemFormat)
+#define udatpg_getAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemName)
+#define udatpg_getBaseSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getBaseSkeleton)
+#define udatpg_getBestPattern U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPattern)
+#define udatpg_getBestPatternWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPatternWithOptions)
+#define udatpg_getDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getDateTimeFormat)
+#define udatpg_getDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_getDecimal)
+#define udatpg_getPatternForSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getPatternForSkeleton)
+#define udatpg_getSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getSkeleton)
+#define udatpg_open U_ICU_ENTRY_POINT_RENAME(udatpg_open)
+#define udatpg_openBaseSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openBaseSkeletons)
+#define udatpg_openEmpty U_ICU_ENTRY_POINT_RENAME(udatpg_openEmpty)
+#define udatpg_openSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openSkeletons)
+#define udatpg_replaceFieldTypes U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypes)
+#define udatpg_replaceFieldTypesWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypesWithOptions)
+#define udatpg_setAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemFormat)
+#define udatpg_setAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemName)
+#define udatpg_setDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setDateTimeFormat)
+#define udatpg_setDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_setDecimal)
+#define uenum_close U_ICU_ENTRY_POINT_RENAME(uenum_close)
+#define uenum_count U_ICU_ENTRY_POINT_RENAME(uenum_count)
+#define uenum_next U_ICU_ENTRY_POINT_RENAME(uenum_next)
+#define uenum_nextDefault U_ICU_ENTRY_POINT_RENAME(uenum_nextDefault)
+#define uenum_openCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openCharStringsEnumeration)
+#define uenum_openFromStringEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openFromStringEnumeration)
+#define uenum_reset U_ICU_ENTRY_POINT_RENAME(uenum_reset)
+#define uenum_unext U_ICU_ENTRY_POINT_RENAME(uenum_unext)
+#define uenum_unextDefault U_ICU_ENTRY_POINT_RENAME(uenum_unextDefault)
+#define ufile_close_translit U_ICU_ENTRY_POINT_RENAME(ufile_close_translit)
+#define ufile_fill_uchar_buffer U_ICU_ENTRY_POINT_RENAME(ufile_fill_uchar_buffer)
+#define ufile_flush_io U_ICU_ENTRY_POINT_RENAME(ufile_flush_io)
+#define ufile_flush_translit U_ICU_ENTRY_POINT_RENAME(ufile_flush_translit)
+#define ufile_getch U_ICU_ENTRY_POINT_RENAME(ufile_getch)
+#define ufile_getch32 U_ICU_ENTRY_POINT_RENAME(ufile_getch32)
+#define ufmt_64tou U_ICU_ENTRY_POINT_RENAME(ufmt_64tou)
+#define ufmt_defaultCPToUnicode U_ICU_ENTRY_POINT_RENAME(ufmt_defaultCPToUnicode)
+#define ufmt_digitvalue U_ICU_ENTRY_POINT_RENAME(ufmt_digitvalue)
+#define ufmt_isdigit U_ICU_ENTRY_POINT_RENAME(ufmt_isdigit)
+#define ufmt_ptou U_ICU_ENTRY_POINT_RENAME(ufmt_ptou)
+#define ufmt_uto64 U_ICU_ENTRY_POINT_RENAME(ufmt_uto64)
+#define ufmt_utop U_ICU_ENTRY_POINT_RENAME(ufmt_utop)
+#define uhash_close U_ICU_ENTRY_POINT_RENAME(uhash_close)
+#define uhash_compareCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareCaselessUnicodeString)
+#define uhash_compareChars U_ICU_ENTRY_POINT_RENAME(uhash_compareChars)
+#define uhash_compareIChars U_ICU_ENTRY_POINT_RENAME(uhash_compareIChars)
+#define uhash_compareLong U_ICU_ENTRY_POINT_RENAME(uhash_compareLong)
+#define uhash_compareUChars U_ICU_ENTRY_POINT_RENAME(uhash_compareUChars)
+#define uhash_compareUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareUnicodeString)
+#define uhash_count U_ICU_ENTRY_POINT_RENAME(uhash_count)
+#define uhash_deleteHashtable U_ICU_ENTRY_POINT_RENAME(uhash_deleteHashtable)
+#define uhash_deleteUObject U_ICU_ENTRY_POINT_RENAME(uhash_deleteUObject)
+#define uhash_deleteUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_deleteUnicodeString)
+#define uhash_equals U_ICU_ENTRY_POINT_RENAME(uhash_equals)
+#define uhash_find U_ICU_ENTRY_POINT_RENAME(uhash_find)
+#define uhash_freeBlock U_ICU_ENTRY_POINT_RENAME(uhash_freeBlock)
+#define uhash_get U_ICU_ENTRY_POINT_RENAME(uhash_get)
+#define uhash_geti U_ICU_ENTRY_POINT_RENAME(uhash_geti)
+#define uhash_hashCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashCaselessUnicodeString)
+#define uhash_hashChars U_ICU_ENTRY_POINT_RENAME(uhash_hashChars)
+#define uhash_hashIChars U_ICU_ENTRY_POINT_RENAME(uhash_hashIChars)
+#define uhash_hashLong U_ICU_ENTRY_POINT_RENAME(uhash_hashLong)
+#define uhash_hashUChars U_ICU_ENTRY_POINT_RENAME(uhash_hashUChars)
+#define uhash_hashUCharsN U_ICU_ENTRY_POINT_RENAME(uhash_hashUCharsN)
+#define uhash_hashUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashUnicodeString)
+#define uhash_iget U_ICU_ENTRY_POINT_RENAME(uhash_iget)
+#define uhash_igeti U_ICU_ENTRY_POINT_RENAME(uhash_igeti)
+#define uhash_init U_ICU_ENTRY_POINT_RENAME(uhash_init)
+#define uhash_iput U_ICU_ENTRY_POINT_RENAME(uhash_iput)
+#define uhash_iputi U_ICU_ENTRY_POINT_RENAME(uhash_iputi)
+#define uhash_iremove U_ICU_ENTRY_POINT_RENAME(uhash_iremove)
+#define uhash_iremovei U_ICU_ENTRY_POINT_RENAME(uhash_iremovei)
+#define uhash_nextElement U_ICU_ENTRY_POINT_RENAME(uhash_nextElement)
+#define uhash_open U_ICU_ENTRY_POINT_RENAME(uhash_open)
+#define uhash_openSize U_ICU_ENTRY_POINT_RENAME(uhash_openSize)
+#define uhash_put U_ICU_ENTRY_POINT_RENAME(uhash_put)
+#define uhash_puti U_ICU_ENTRY_POINT_RENAME(uhash_puti)
+#define uhash_remove U_ICU_ENTRY_POINT_RENAME(uhash_remove)
+#define uhash_removeAll U_ICU_ENTRY_POINT_RENAME(uhash_removeAll)
+#define uhash_removeElement U_ICU_ENTRY_POINT_RENAME(uhash_removeElement)
+#define uhash_removei U_ICU_ENTRY_POINT_RENAME(uhash_removei)
+#define uhash_setKeyComparator U_ICU_ENTRY_POINT_RENAME(uhash_setKeyComparator)
+#define uhash_setKeyDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setKeyDeleter)
+#define uhash_setKeyHasher U_ICU_ENTRY_POINT_RENAME(uhash_setKeyHasher)
+#define uhash_setResizePolicy U_ICU_ENTRY_POINT_RENAME(uhash_setResizePolicy)
+#define uhash_setValueComparator U_ICU_ENTRY_POINT_RENAME(uhash_setValueComparator)
+#define uhash_setValueDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setValueDeleter)
+#define uidna_IDNToASCII U_ICU_ENTRY_POINT_RENAME(uidna_IDNToASCII)
+#define uidna_IDNToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_IDNToUnicode)
+#define uidna_close U_ICU_ENTRY_POINT_RENAME(uidna_close)
+#define uidna_compare U_ICU_ENTRY_POINT_RENAME(uidna_compare)
+#define uidna_labelToASCII U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII)
+#define uidna_labelToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII_UTF8)
+#define uidna_labelToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicode)
+#define uidna_labelToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicodeUTF8)
+#define uidna_nameToASCII U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII)
+#define uidna_nameToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII_UTF8)
+#define uidna_nameToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicode)
+#define uidna_nameToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicodeUTF8)
+#define uidna_openUTS46 U_ICU_ENTRY_POINT_RENAME(uidna_openUTS46)
+#define uidna_toASCII U_ICU_ENTRY_POINT_RENAME(uidna_toASCII)
+#define uidna_toUnicode U_ICU_ENTRY_POINT_RENAME(uidna_toUnicode)
+#define uiter_current32 U_ICU_ENTRY_POINT_RENAME(uiter_current32)
+#define uiter_getState U_ICU_ENTRY_POINT_RENAME(uiter_getState)
+#define uiter_next32 U_ICU_ENTRY_POINT_RENAME(uiter_next32)
+#define uiter_previous32 U_ICU_ENTRY_POINT_RENAME(uiter_previous32)
+#define uiter_setCharacterIterator U_ICU_ENTRY_POINT_RENAME(uiter_setCharacterIterator)
+#define uiter_setReplaceable U_ICU_ENTRY_POINT_RENAME(uiter_setReplaceable)
+#define uiter_setState U_ICU_ENTRY_POINT_RENAME(uiter_setState)
+#define uiter_setString U_ICU_ENTRY_POINT_RENAME(uiter_setString)
+#define uiter_setUTF16BE U_ICU_ENTRY_POINT_RENAME(uiter_setUTF16BE)
+#define uiter_setUTF8 U_ICU_ENTRY_POINT_RENAME(uiter_setUTF8)
+#define uldn_close U_ICU_ENTRY_POINT_RENAME(uldn_close)
+#define uldn_getDialectHandling U_ICU_ENTRY_POINT_RENAME(uldn_getDialectHandling)
+#define uldn_getLocale U_ICU_ENTRY_POINT_RENAME(uldn_getLocale)
+#define uldn_keyDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyDisplayName)
+#define uldn_keyValueDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyValueDisplayName)
+#define uldn_languageDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_languageDisplayName)
+#define uldn_localeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_localeDisplayName)
+#define uldn_open U_ICU_ENTRY_POINT_RENAME(uldn_open)
+#define uldn_regionDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_regionDisplayName)
+#define uldn_scriptCodeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptCodeDisplayName)
+#define uldn_scriptDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptDisplayName)
+#define uldn_variantDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_variantDisplayName)
+#define ulist_addItemBeginList U_ICU_ENTRY_POINT_RENAME(ulist_addItemBeginList)
+#define ulist_addItemEndList U_ICU_ENTRY_POINT_RENAME(ulist_addItemEndList)
+#define ulist_close_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_close_keyword_values_iterator)
+#define ulist_containsString U_ICU_ENTRY_POINT_RENAME(ulist_containsString)
+#define ulist_count_keyword_values U_ICU_ENTRY_POINT_RENAME(ulist_count_keyword_values)
+#define ulist_createEmptyList U_ICU_ENTRY_POINT_RENAME(ulist_createEmptyList)
+#define ulist_deleteList U_ICU_ENTRY_POINT_RENAME(ulist_deleteList)
+#define ulist_getListFromEnum U_ICU_ENTRY_POINT_RENAME(ulist_getListFromEnum)
+#define ulist_getListSize U_ICU_ENTRY_POINT_RENAME(ulist_getListSize)
+#define ulist_getNext U_ICU_ENTRY_POINT_RENAME(ulist_getNext)
+#define ulist_next_keyword_value U_ICU_ENTRY_POINT_RENAME(ulist_next_keyword_value)
+#define ulist_resetList U_ICU_ENTRY_POINT_RENAME(ulist_resetList)
+#define ulist_reset_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_reset_keyword_values_iterator)
+#define uloc_acceptLanguage U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguage)
+#define uloc_acceptLanguageFromHTTP U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguageFromHTTP)
+#define uloc_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(uloc_addLikelySubtags)
+#define uloc_canonicalize U_ICU_ENTRY_POINT_RENAME(uloc_canonicalize)
+#define uloc_countAvailable U_ICU_ENTRY_POINT_RENAME(uloc_countAvailable)
+#define uloc_forLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_forLanguageTag)
+#define uloc_getAvailable U_ICU_ENTRY_POINT_RENAME(uloc_getAvailable)
+#define uloc_getBaseName U_ICU_ENTRY_POINT_RENAME(uloc_getBaseName)
+#define uloc_getCharacterOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getCharacterOrientation)
+#define uloc_getCountry U_ICU_ENTRY_POINT_RENAME(uloc_getCountry)
+#define uloc_getCurrentCountryID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentCountryID)
+#define uloc_getCurrentLanguageID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentLanguageID)
+#define uloc_getDefault U_ICU_ENTRY_POINT_RENAME(uloc_getDefault)
+#define uloc_getDisplayCountry U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayCountry)
+#define uloc_getDisplayKeyword U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeyword)
+#define uloc_getDisplayKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeywordValue)
+#define uloc_getDisplayLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayLanguage)
+#define uloc_getDisplayName U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayName)
+#define uloc_getDisplayScript U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayScript)
+#define uloc_getDisplayVariant U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayVariant)
+#define uloc_getISO3Country U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Country)
+#define uloc_getISO3Language U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Language)
+#define uloc_getISOCountries U_ICU_ENTRY_POINT_RENAME(uloc_getISOCountries)
+#define uloc_getISOLanguages U_ICU_ENTRY_POINT_RENAME(uloc_getISOLanguages)
+#define uloc_getKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getKeywordValue)
+#define uloc_getLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLCID)
+#define uloc_getLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getLanguage)
+#define uloc_getLineOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getLineOrientation)
+#define uloc_getLocaleForLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLocaleForLCID)
+#define uloc_getName U_ICU_ENTRY_POINT_RENAME(uloc_getName)
+#define uloc_getParent U_ICU_ENTRY_POINT_RENAME(uloc_getParent)
+#define uloc_getScript U_ICU_ENTRY_POINT_RENAME(uloc_getScript)
+#define uloc_getTableStringWithFallback U_ICU_ENTRY_POINT_RENAME(uloc_getTableStringWithFallback)
+#define uloc_getVariant U_ICU_ENTRY_POINT_RENAME(uloc_getVariant)
+#define uloc_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(uloc_minimizeSubtags)
+#define uloc_openKeywordList U_ICU_ENTRY_POINT_RENAME(uloc_openKeywordList)
+#define uloc_openKeywords U_ICU_ENTRY_POINT_RENAME(uloc_openKeywords)
+#define uloc_setDefault U_ICU_ENTRY_POINT_RENAME(uloc_setDefault)
+#define uloc_setKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_setKeywordValue)
+#define uloc_toLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_toLanguageTag)
+#define ulocdata_close U_ICU_ENTRY_POINT_RENAME(ulocdata_close)
+#define ulocdata_getCLDRVersion U_ICU_ENTRY_POINT_RENAME(ulocdata_getCLDRVersion)
+#define ulocdata_getDelimiter U_ICU_ENTRY_POINT_RENAME(ulocdata_getDelimiter)
+#define ulocdata_getExemplarSet U_ICU_ENTRY_POINT_RENAME(ulocdata_getExemplarSet)
+#define ulocdata_getLocaleDisplayPattern U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleDisplayPattern)
+#define ulocdata_getLocaleSeparator U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleSeparator)
+#define ulocdata_getMeasurementSystem U_ICU_ENTRY_POINT_RENAME(ulocdata_getMeasurementSystem)
+#define ulocdata_getNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_getNoSubstitute)
+#define ulocdata_getPaperSize U_ICU_ENTRY_POINT_RENAME(ulocdata_getPaperSize)
+#define ulocdata_open U_ICU_ENTRY_POINT_RENAME(ulocdata_open)
+#define ulocdata_setNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_setNoSubstitute)
+#define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry)
+#define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage)
+#define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript)
+#define umsg_applyPattern U_ICU_ENTRY_POINT_RENAME(umsg_applyPattern)
+#define umsg_autoQuoteApostrophe U_ICU_ENTRY_POINT_RENAME(umsg_autoQuoteApostrophe)
+#define umsg_clone U_ICU_ENTRY_POINT_RENAME(umsg_clone)
+#define umsg_close U_ICU_ENTRY_POINT_RENAME(umsg_close)
+#define umsg_format U_ICU_ENTRY_POINT_RENAME(umsg_format)
+#define umsg_getLocale U_ICU_ENTRY_POINT_RENAME(umsg_getLocale)
+#define umsg_open U_ICU_ENTRY_POINT_RENAME(umsg_open)
+#define umsg_parse U_ICU_ENTRY_POINT_RENAME(umsg_parse)
+#define umsg_setLocale U_ICU_ENTRY_POINT_RENAME(umsg_setLocale)
+#define umsg_toPattern U_ICU_ENTRY_POINT_RENAME(umsg_toPattern)
+#define umsg_vformat U_ICU_ENTRY_POINT_RENAME(umsg_vformat)
+#define umsg_vparse U_ICU_ENTRY_POINT_RENAME(umsg_vparse)
+#define umtx_atomic_dec U_ICU_ENTRY_POINT_RENAME(umtx_atomic_dec)
+#define umtx_atomic_inc U_ICU_ENTRY_POINT_RENAME(umtx_atomic_inc)
+#define umtx_cleanup U_ICU_ENTRY_POINT_RENAME(umtx_cleanup)
+#define umtx_destroy U_ICU_ENTRY_POINT_RENAME(umtx_destroy)
+#define umtx_init U_ICU_ENTRY_POINT_RENAME(umtx_init)
+#define umtx_lock U_ICU_ENTRY_POINT_RENAME(umtx_lock)
+#define umtx_unlock U_ICU_ENTRY_POINT_RENAME(umtx_unlock)
+#define uniset_getUnicode32Instance U_ICU_ENTRY_POINT_RENAME(uniset_getUnicode32Instance)
+#define unorm2_append U_ICU_ENTRY_POINT_RENAME(unorm2_append)
+#define unorm2_close U_ICU_ENTRY_POINT_RENAME(unorm2_close)
+#define unorm2_getDecomposition U_ICU_ENTRY_POINT_RENAME(unorm2_getDecomposition)
+#define unorm2_getInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getInstance)
+#define unorm2_hasBoundaryAfter U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryAfter)
+#define unorm2_hasBoundaryBefore U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryBefore)
+#define unorm2_isInert U_ICU_ENTRY_POINT_RENAME(unorm2_isInert)
+#define unorm2_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm2_isNormalized)
+#define unorm2_normalize U_ICU_ENTRY_POINT_RENAME(unorm2_normalize)
+#define unorm2_normalizeSecondAndAppend U_ICU_ENTRY_POINT_RENAME(unorm2_normalizeSecondAndAppend)
+#define unorm2_openFiltered U_ICU_ENTRY_POINT_RENAME(unorm2_openFiltered)
+#define unorm2_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm2_quickCheck)
+#define unorm2_spanQuickCheckYes U_ICU_ENTRY_POINT_RENAME(unorm2_spanQuickCheckYes)
+#define unorm2_swap U_ICU_ENTRY_POINT_RENAME(unorm2_swap)
+#define unorm_closeIter U_ICU_ENTRY_POINT_RENAME(unorm_closeIter)
+#define unorm_compare U_ICU_ENTRY_POINT_RENAME(unorm_compare)
+#define unorm_concatenate U_ICU_ENTRY_POINT_RENAME(unorm_concatenate)
+#define unorm_getFCDTrieIndex U_ICU_ENTRY_POINT_RENAME(unorm_getFCDTrieIndex)
+#define unorm_getQuickCheck U_ICU_ENTRY_POINT_RENAME(unorm_getQuickCheck)
+#define unorm_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm_isNormalized)
+#define unorm_isNormalizedWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_isNormalizedWithOptions)
+#define unorm_next U_ICU_ENTRY_POINT_RENAME(unorm_next)
+#define unorm_normalize U_ICU_ENTRY_POINT_RENAME(unorm_normalize)
+#define unorm_openIter U_ICU_ENTRY_POINT_RENAME(unorm_openIter)
+#define unorm_previous U_ICU_ENTRY_POINT_RENAME(unorm_previous)
+#define unorm_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm_quickCheck)
+#define unorm_quickCheckWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_quickCheckWithOptions)
+#define unorm_setIter U_ICU_ENTRY_POINT_RENAME(unorm_setIter)
+#define unum_applyPattern U_ICU_ENTRY_POINT_RENAME(unum_applyPattern)
+#define unum_clone U_ICU_ENTRY_POINT_RENAME(unum_clone)
+#define unum_close U_ICU_ENTRY_POINT_RENAME(unum_close)
+#define unum_countAvailable U_ICU_ENTRY_POINT_RENAME(unum_countAvailable)
+#define unum_format U_ICU_ENTRY_POINT_RENAME(unum_format)
+#define unum_formatDecimal U_ICU_ENTRY_POINT_RENAME(unum_formatDecimal)
+#define unum_formatDouble U_ICU_ENTRY_POINT_RENAME(unum_formatDouble)
+#define unum_formatDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleCurrency)
+#define unum_formatInt64 U_ICU_ENTRY_POINT_RENAME(unum_formatInt64)
+#define unum_getAttribute U_ICU_ENTRY_POINT_RENAME(unum_getAttribute)
+#define unum_getAvailable U_ICU_ENTRY_POINT_RENAME(unum_getAvailable)
+#define unum_getDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_getDoubleAttribute)
+#define unum_getLocaleByType U_ICU_ENTRY_POINT_RENAME(unum_getLocaleByType)
+#define unum_getSymbol U_ICU_ENTRY_POINT_RENAME(unum_getSymbol)
+#define unum_getTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_getTextAttribute)
+#define unum_open U_ICU_ENTRY_POINT_RENAME(unum_open)
+#define unum_parse U_ICU_ENTRY_POINT_RENAME(unum_parse)
+#define unum_parseDecimal U_ICU_ENTRY_POINT_RENAME(unum_parseDecimal)
+#define unum_parseDouble U_ICU_ENTRY_POINT_RENAME(unum_parseDouble)
+#define unum_parseDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_parseDoubleCurrency)
+#define unum_parseInt64 U_ICU_ENTRY_POINT_RENAME(unum_parseInt64)
+#define unum_setAttribute U_ICU_ENTRY_POINT_RENAME(unum_setAttribute)
+#define unum_setDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_setDoubleAttribute)
+#define unum_setSymbol U_ICU_ENTRY_POINT_RENAME(unum_setSymbol)
+#define unum_setTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_setTextAttribute)
+#define unum_toPattern U_ICU_ENTRY_POINT_RENAME(unum_toPattern)
+#define uplug_closeLibrary U_ICU_ENTRY_POINT_RENAME(uplug_closeLibrary)
+#define uplug_findLibrary U_ICU_ENTRY_POINT_RENAME(uplug_findLibrary)
+#define uplug_getConfiguration U_ICU_ENTRY_POINT_RENAME(uplug_getConfiguration)
+#define uplug_getContext U_ICU_ENTRY_POINT_RENAME(uplug_getContext)
+#define uplug_getCurrentLevel U_ICU_ENTRY_POINT_RENAME(uplug_getCurrentLevel)
+#define uplug_getLibrary U_ICU_ENTRY_POINT_RENAME(uplug_getLibrary)
+#define uplug_getLibraryName U_ICU_ENTRY_POINT_RENAME(uplug_getLibraryName)
+#define uplug_getPlugInternal U_ICU_ENTRY_POINT_RENAME(uplug_getPlugInternal)
+#define uplug_getPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLevel)
+#define uplug_getPlugLoadStatus U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLoadStatus)
+#define uplug_getPlugName U_ICU_ENTRY_POINT_RENAME(uplug_getPlugName)
+#define uplug_getPluginFile U_ICU_ENTRY_POINT_RENAME(uplug_getPluginFile)
+#define uplug_getSymbolName U_ICU_ENTRY_POINT_RENAME(uplug_getSymbolName)
+#define uplug_init U_ICU_ENTRY_POINT_RENAME(uplug_init)
+#define uplug_loadPlugFromEntrypoint U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromEntrypoint)
+#define uplug_loadPlugFromLibrary U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromLibrary)
+#define uplug_nextPlug U_ICU_ENTRY_POINT_RENAME(uplug_nextPlug)
+#define uplug_openLibrary U_ICU_ENTRY_POINT_RENAME(uplug_openLibrary)
+#define uplug_removePlug U_ICU_ENTRY_POINT_RENAME(uplug_removePlug)
+#define uplug_setContext U_ICU_ENTRY_POINT_RENAME(uplug_setContext)
+#define uplug_setPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_setPlugLevel)
+#define uplug_setPlugName U_ICU_ENTRY_POINT_RENAME(uplug_setPlugName)
+#define uplug_setPlugNoUnload U_ICU_ENTRY_POINT_RENAME(uplug_setPlugNoUnload)
+#define upname_swap U_ICU_ENTRY_POINT_RENAME(upname_swap)
+#define uprops_getSource U_ICU_ENTRY_POINT_RENAME(uprops_getSource)
+#define upropsvec_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(upropsvec_addPropertyStarts)
+#define uprv_aestrncpy U_ICU_ENTRY_POINT_RENAME(uprv_aestrncpy)
+#define uprv_asciiFromEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_asciiFromEbcdic)
+#define uprv_asciitolower U_ICU_ENTRY_POINT_RENAME(uprv_asciitolower)
+#define uprv_ceil U_ICU_ENTRY_POINT_RENAME(uprv_ceil)
+#define uprv_cnttab_addContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_addContraction)
+#define uprv_cnttab_changeContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_changeContraction)
+#define uprv_cnttab_changeLastCE U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_changeLastCE)
+#define uprv_cnttab_clone U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_clone)
+#define uprv_cnttab_close U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_close)
+#define uprv_cnttab_constructTable U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_constructTable)
+#define uprv_cnttab_findCE U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_findCE)
+#define uprv_cnttab_findCP U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_findCP)
+#define uprv_cnttab_getCE U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_getCE)
+#define uprv_cnttab_insertContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_insertContraction)
+#define uprv_cnttab_isTailored U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_isTailored)
+#define uprv_cnttab_open U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_open)
+#define uprv_cnttab_setContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_setContraction)
+#define uprv_collIterateAtEnd U_ICU_ENTRY_POINT_RENAME(uprv_collIterateAtEnd)
+#define uprv_compareASCIIPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareASCIIPropertyNames)
+#define uprv_compareEBCDICPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareEBCDICPropertyNames)
+#define uprv_compareInvAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvAscii)
+#define uprv_compareInvEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdic)
+#define uprv_compareInvEbcdicAsAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdicAsAscii)
+#define uprv_convertToLCID U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCID)
+#define uprv_convertToPosix U_ICU_ENTRY_POINT_RENAME(uprv_convertToPosix)
+#define uprv_copyAscii U_ICU_ENTRY_POINT_RENAME(uprv_copyAscii)
+#define uprv_copyEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_copyEbcdic)
+#define uprv_decContextClearStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextClearStatus)
+#define uprv_decContextDefault U_ICU_ENTRY_POINT_RENAME(uprv_decContextDefault)
+#define uprv_decContextGetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetRounding)
+#define uprv_decContextGetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetStatus)
+#define uprv_decContextRestoreStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextRestoreStatus)
+#define uprv_decContextSaveStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSaveStatus)
+#define uprv_decContextSetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetRounding)
+#define uprv_decContextSetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatus)
+#define uprv_decContextSetStatusFromString U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromString)
+#define uprv_decContextSetStatusFromStringQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromStringQuiet)
+#define uprv_decContextSetStatusQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusQuiet)
+#define uprv_decContextStatusToString U_ICU_ENTRY_POINT_RENAME(uprv_decContextStatusToString)
+#define uprv_decContextTestEndian U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestEndian)
+#define uprv_decContextTestSavedStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestSavedStatus)
+#define uprv_decContextTestStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestStatus)
+#define uprv_decContextZeroStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextZeroStatus)
+#define uprv_decNumberAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAbs)
+#define uprv_decNumberAdd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAdd)
+#define uprv_decNumberAnd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAnd)
+#define uprv_decNumberClass U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClass)
+#define uprv_decNumberClassToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClassToString)
+#define uprv_decNumberCompare U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompare)
+#define uprv_decNumberCompareSignal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareSignal)
+#define uprv_decNumberCompareTotal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotal)
+#define uprv_decNumberCompareTotalMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotalMag)
+#define uprv_decNumberCopy U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopy)
+#define uprv_decNumberCopyAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyAbs)
+#define uprv_decNumberCopyNegate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyNegate)
+#define uprv_decNumberCopySign U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopySign)
+#define uprv_decNumberDivide U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivide)
+#define uprv_decNumberDivideInteger U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivideInteger)
+#define uprv_decNumberExp U_ICU_ENTRY_POINT_RENAME(uprv_decNumberExp)
+#define uprv_decNumberFMA U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFMA)
+#define uprv_decNumberFromInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromInt32)
+#define uprv_decNumberFromString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromString)
+#define uprv_decNumberFromUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromUInt32)
+#define uprv_decNumberGetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberGetBCD)
+#define uprv_decNumberInvert U_ICU_ENTRY_POINT_RENAME(uprv_decNumberInvert)
+#define uprv_decNumberIsNormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsNormal)
+#define uprv_decNumberIsSubnormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsSubnormal)
+#define uprv_decNumberLn U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLn)
+#define uprv_decNumberLog10 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLog10)
+#define uprv_decNumberLogB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLogB)
+#define uprv_decNumberMax U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMax)
+#define uprv_decNumberMaxMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMaxMag)
+#define uprv_decNumberMin U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMin)
+#define uprv_decNumberMinMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinMag)
+#define uprv_decNumberMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinus)
+#define uprv_decNumberMultiply U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMultiply)
+#define uprv_decNumberNextMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextMinus)
+#define uprv_decNumberNextPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextPlus)
+#define uprv_decNumberNextToward U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextToward)
+#define uprv_decNumberNormalize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNormalize)
+#define uprv_decNumberOr U_ICU_ENTRY_POINT_RENAME(uprv_decNumberOr)
+#define uprv_decNumberPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPlus)
+#define uprv_decNumberPower U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPower)
+#define uprv_decNumberQuantize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberQuantize)
+#define uprv_decNumberReduce U_ICU_ENTRY_POINT_RENAME(uprv_decNumberReduce)
+#define uprv_decNumberRemainder U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainder)
+#define uprv_decNumberRemainderNear U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainderNear)
+#define uprv_decNumberRescale U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRescale)
+#define uprv_decNumberRotate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRotate)
+#define uprv_decNumberSameQuantum U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSameQuantum)
+#define uprv_decNumberScaleB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberScaleB)
+#define uprv_decNumberSetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSetBCD)
+#define uprv_decNumberShift U_ICU_ENTRY_POINT_RENAME(uprv_decNumberShift)
+#define uprv_decNumberSquareRoot U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSquareRoot)
+#define uprv_decNumberSubtract U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSubtract)
+#define uprv_decNumberToEngString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToEngString)
+#define uprv_decNumberToInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToInt32)
+#define uprv_decNumberToIntegralExact U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralExact)
+#define uprv_decNumberToIntegralValue U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralValue)
+#define uprv_decNumberToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToString)
+#define uprv_decNumberToUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToUInt32)
+#define uprv_decNumberTrim U_ICU_ENTRY_POINT_RENAME(uprv_decNumberTrim)
+#define uprv_decNumberVersion U_ICU_ENTRY_POINT_RENAME(uprv_decNumberVersion)
+#define uprv_decNumberXor U_ICU_ENTRY_POINT_RENAME(uprv_decNumberXor)
+#define uprv_decNumberZero U_ICU_ENTRY_POINT_RENAME(uprv_decNumberZero)
+#define uprv_delete_collIterate U_ICU_ENTRY_POINT_RENAME(uprv_delete_collIterate)
+#define uprv_dl_close U_ICU_ENTRY_POINT_RENAME(uprv_dl_close)
+#define uprv_dl_open U_ICU_ENTRY_POINT_RENAME(uprv_dl_open)
+#define uprv_dl_sym U_ICU_ENTRY_POINT_RENAME(uprv_dl_sym)
+#define uprv_eastrncpy U_ICU_ENTRY_POINT_RENAME(uprv_eastrncpy)
+#define uprv_ebcdicFromAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicFromAscii)
+#define uprv_ebcdictolower U_ICU_ENTRY_POINT_RENAME(uprv_ebcdictolower)
+#define uprv_fabs U_ICU_ENTRY_POINT_RENAME(uprv_fabs)
+#define uprv_floor U_ICU_ENTRY_POINT_RENAME(uprv_floor)
+#define uprv_fmax U_ICU_ENTRY_POINT_RENAME(uprv_fmax)
+#define uprv_fmin U_ICU_ENTRY_POINT_RENAME(uprv_fmin)
+#define uprv_fmod U_ICU_ENTRY_POINT_RENAME(uprv_fmod)
+#define uprv_free U_ICU_ENTRY_POINT_RENAME(uprv_free)
+#define uprv_getCharNameCharacters U_ICU_ENTRY_POINT_RENAME(uprv_getCharNameCharacters)
+#define uprv_getDefaultCodepage U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultCodepage)
+#define uprv_getDefaultLocaleID U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultLocaleID)
+#define uprv_getInfinity U_ICU_ENTRY_POINT_RENAME(uprv_getInfinity)
+#define uprv_getMaxCharNameLength U_ICU_ENTRY_POINT_RENAME(uprv_getMaxCharNameLength)
+#define uprv_getMaxValues U_ICU_ENTRY_POINT_RENAME(uprv_getMaxValues)
+#define uprv_getNaN U_ICU_ENTRY_POINT_RENAME(uprv_getNaN)
+#define uprv_getRawUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getRawUTCtime)
+#define uprv_getStaticCurrencyName U_ICU_ENTRY_POINT_RENAME(uprv_getStaticCurrencyName)
+#define uprv_getUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getUTCtime)
+#define uprv_haveProperties U_ICU_ENTRY_POINT_RENAME(uprv_haveProperties)
+#define uprv_init_collIterate U_ICU_ENTRY_POINT_RENAME(uprv_init_collIterate)
+#define uprv_init_pce U_ICU_ENTRY_POINT_RENAME(uprv_init_pce)
+#define uprv_int32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_int32Comparator)
+#define uprv_isInfinite U_ICU_ENTRY_POINT_RENAME(uprv_isInfinite)
+#define uprv_isInvariantString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantString)
+#define uprv_isInvariantUString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantUString)
+#define uprv_isNaN U_ICU_ENTRY_POINT_RENAME(uprv_isNaN)
+#define uprv_isNegativeInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isNegativeInfinity)
+#define uprv_isPositiveInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isPositiveInfinity)
+#define uprv_isRuleWhiteSpace U_ICU_ENTRY_POINT_RENAME(uprv_isRuleWhiteSpace)
+#define uprv_itou U_ICU_ENTRY_POINT_RENAME(uprv_itou)
+#define uprv_log U_ICU_ENTRY_POINT_RENAME(uprv_log)
+#define uprv_malloc U_ICU_ENTRY_POINT_RENAME(uprv_malloc)
+#define uprv_mapFile U_ICU_ENTRY_POINT_RENAME(uprv_mapFile)
+#define uprv_max U_ICU_ENTRY_POINT_RENAME(uprv_max)
+#define uprv_maxMantissa U_ICU_ENTRY_POINT_RENAME(uprv_maxMantissa)
+#define uprv_maximumPtr U_ICU_ENTRY_POINT_RENAME(uprv_maximumPtr)
+#define uprv_min U_ICU_ENTRY_POINT_RENAME(uprv_min)
+#define uprv_modf U_ICU_ENTRY_POINT_RENAME(uprv_modf)
+#define uprv_new_collIterate U_ICU_ENTRY_POINT_RENAME(uprv_new_collIterate)
+#define uprv_openRuleWhiteSpaceSet U_ICU_ENTRY_POINT_RENAME(uprv_openRuleWhiteSpaceSet)
+#define uprv_parseCurrency U_ICU_ENTRY_POINT_RENAME(uprv_parseCurrency)
+#define uprv_pathIsAbsolute U_ICU_ENTRY_POINT_RENAME(uprv_pathIsAbsolute)
+#define uprv_pow U_ICU_ENTRY_POINT_RENAME(uprv_pow)
+#define uprv_pow10 U_ICU_ENTRY_POINT_RENAME(uprv_pow10)
+#define uprv_realloc U_ICU_ENTRY_POINT_RENAME(uprv_realloc)
+#define uprv_round U_ICU_ENTRY_POINT_RENAME(uprv_round)
+#define uprv_sortArray U_ICU_ENTRY_POINT_RENAME(uprv_sortArray)
+#define uprv_strCompare U_ICU_ENTRY_POINT_RENAME(uprv_strCompare)
+#define uprv_strdup U_ICU_ENTRY_POINT_RENAME(uprv_strdup)
+#define uprv_strndup U_ICU_ENTRY_POINT_RENAME(uprv_strndup)
+#define uprv_syntaxError U_ICU_ENTRY_POINT_RENAME(uprv_syntaxError)
+#define uprv_timezone U_ICU_ENTRY_POINT_RENAME(uprv_timezone)
+#define uprv_toupper U_ICU_ENTRY_POINT_RENAME(uprv_toupper)
+#define uprv_trunc U_ICU_ENTRY_POINT_RENAME(uprv_trunc)
+#define uprv_tzname U_ICU_ENTRY_POINT_RENAME(uprv_tzname)
+#define uprv_tzset U_ICU_ENTRY_POINT_RENAME(uprv_tzset)
+#define uprv_uca_addAnElement U_ICU_ENTRY_POINT_RENAME(uprv_uca_addAnElement)
+#define uprv_uca_assembleTable U_ICU_ENTRY_POINT_RENAME(uprv_uca_assembleTable)
+#define uprv_uca_canonicalClosure U_ICU_ENTRY_POINT_RENAME(uprv_uca_canonicalClosure)
+#define uprv_uca_closeTempTable U_ICU_ENTRY_POINT_RENAME(uprv_uca_closeTempTable)
+#define uprv_uca_getCodePointFromRaw U_ICU_ENTRY_POINT_RENAME(uprv_uca_getCodePointFromRaw)
+#define uprv_uca_getImplicitFromRaw U_ICU_ENTRY_POINT_RENAME(uprv_uca_getImplicitFromRaw)
+#define uprv_uca_getRawFromCodePoint U_ICU_ENTRY_POINT_RENAME(uprv_uca_getRawFromCodePoint)
+#define uprv_uca_getRawFromImplicit U_ICU_ENTRY_POINT_RENAME(uprv_uca_getRawFromImplicit)
+#define uprv_uca_initImplicitConstants U_ICU_ENTRY_POINT_RENAME(uprv_uca_initImplicitConstants)
+#define uprv_uca_initTempTable U_ICU_ENTRY_POINT_RENAME(uprv_uca_initTempTable)
+#define uprv_uint16Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint16Comparator)
+#define uprv_uint32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint32Comparator)
+#define uprv_unmapFile U_ICU_ENTRY_POINT_RENAME(uprv_unmapFile)
+#define upvec_cloneArray U_ICU_ENTRY_POINT_RENAME(upvec_cloneArray)
+#define upvec_close U_ICU_ENTRY_POINT_RENAME(upvec_close)
+#define upvec_compact U_ICU_ENTRY_POINT_RENAME(upvec_compact)
+#define upvec_compactToUTrie2Handler U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2Handler)
+#define upvec_compactToUTrie2WithRowIndexes U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2WithRowIndexes)
+#define upvec_getArray U_ICU_ENTRY_POINT_RENAME(upvec_getArray)
+#define upvec_getRow U_ICU_ENTRY_POINT_RENAME(upvec_getRow)
+#define upvec_getValue U_ICU_ENTRY_POINT_RENAME(upvec_getValue)
+#define upvec_open U_ICU_ENTRY_POINT_RENAME(upvec_open)
+#define upvec_setValue U_ICU_ENTRY_POINT_RENAME(upvec_setValue)
+#define uregex_appendReplacement U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacement)
+#define uregex_appendReplacementUText U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacementUText)
+#define uregex_appendTail U_ICU_ENTRY_POINT_RENAME(uregex_appendTail)
+#define uregex_appendTailUText U_ICU_ENTRY_POINT_RENAME(uregex_appendTailUText)
+#define uregex_clone U_ICU_ENTRY_POINT_RENAME(uregex_clone)
+#define uregex_close U_ICU_ENTRY_POINT_RENAME(uregex_close)
+#define uregex_end U_ICU_ENTRY_POINT_RENAME(uregex_end)
+#define uregex_end64 U_ICU_ENTRY_POINT_RENAME(uregex_end64)
+#define uregex_find U_ICU_ENTRY_POINT_RENAME(uregex_find)
+#define uregex_find64 U_ICU_ENTRY_POINT_RENAME(uregex_find64)
+#define uregex_findNext U_ICU_ENTRY_POINT_RENAME(uregex_findNext)
+#define uregex_flags U_ICU_ENTRY_POINT_RENAME(uregex_flags)
+#define uregex_getFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_getFindProgressCallback)
+#define uregex_getMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_getMatchCallback)
+#define uregex_getStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_getStackLimit)
+#define uregex_getText U_ICU_ENTRY_POINT_RENAME(uregex_getText)
+#define uregex_getTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_getTimeLimit)
+#define uregex_getUText U_ICU_ENTRY_POINT_RENAME(uregex_getUText)
+#define uregex_group U_ICU_ENTRY_POINT_RENAME(uregex_group)
+#define uregex_groupCount U_ICU_ENTRY_POINT_RENAME(uregex_groupCount)
+#define uregex_groupUText U_ICU_ENTRY_POINT_RENAME(uregex_groupUText)
+#define uregex_groupUTextDeep U_ICU_ENTRY_POINT_RENAME(uregex_groupUTextDeep)
+#define uregex_hasAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasAnchoringBounds)
+#define uregex_hasTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasTransparentBounds)
+#define uregex_hitEnd U_ICU_ENTRY_POINT_RENAME(uregex_hitEnd)
+#define uregex_lookingAt U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt)
+#define uregex_lookingAt64 U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt64)
+#define uregex_matches U_ICU_ENTRY_POINT_RENAME(uregex_matches)
+#define uregex_matches64 U_ICU_ENTRY_POINT_RENAME(uregex_matches64)
+#define uregex_open U_ICU_ENTRY_POINT_RENAME(uregex_open)
+#define uregex_openC U_ICU_ENTRY_POINT_RENAME(uregex_openC)
+#define uregex_openUText U_ICU_ENTRY_POINT_RENAME(uregex_openUText)
+#define uregex_pattern U_ICU_ENTRY_POINT_RENAME(uregex_pattern)
+#define uregex_patternUText U_ICU_ENTRY_POINT_RENAME(uregex_patternUText)
+#define uregex_regionEnd U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd)
+#define uregex_regionEnd64 U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd64)
+#define uregex_regionStart U_ICU_ENTRY_POINT_RENAME(uregex_regionStart)
+#define uregex_regionStart64 U_ICU_ENTRY_POINT_RENAME(uregex_regionStart64)
+#define uregex_replaceAll U_ICU_ENTRY_POINT_RENAME(uregex_replaceAll)
+#define uregex_replaceAllUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceAllUText)
+#define uregex_replaceFirst U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirst)
+#define uregex_replaceFirstUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirstUText)
+#define uregex_requireEnd U_ICU_ENTRY_POINT_RENAME(uregex_requireEnd)
+#define uregex_reset U_ICU_ENTRY_POINT_RENAME(uregex_reset)
+#define uregex_reset64 U_ICU_ENTRY_POINT_RENAME(uregex_reset64)
+#define uregex_setFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_setFindProgressCallback)
+#define uregex_setMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_setMatchCallback)
+#define uregex_setRegion U_ICU_ENTRY_POINT_RENAME(uregex_setRegion)
+#define uregex_setRegion64 U_ICU_ENTRY_POINT_RENAME(uregex_setRegion64)
+#define uregex_setRegionAndStart U_ICU_ENTRY_POINT_RENAME(uregex_setRegionAndStart)
+#define uregex_setStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_setStackLimit)
+#define uregex_setText U_ICU_ENTRY_POINT_RENAME(uregex_setText)
+#define uregex_setTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_setTimeLimit)
+#define uregex_setUText U_ICU_ENTRY_POINT_RENAME(uregex_setUText)
+#define uregex_split U_ICU_ENTRY_POINT_RENAME(uregex_split)
+#define uregex_splitUText U_ICU_ENTRY_POINT_RENAME(uregex_splitUText)
+#define uregex_start U_ICU_ENTRY_POINT_RENAME(uregex_start)
+#define uregex_start64 U_ICU_ENTRY_POINT_RENAME(uregex_start64)
+#define uregex_ucstr_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_ucstr_unescape_charAt)
+#define uregex_useAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_useAnchoringBounds)
+#define uregex_useTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_useTransparentBounds)
+#define uregex_utext_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_utext_unescape_charAt)
+#define ures_close U_ICU_ENTRY_POINT_RENAME(ures_close)
+#define ures_copyResb U_ICU_ENTRY_POINT_RENAME(ures_copyResb)
+#define ures_countArrayItems U_ICU_ENTRY_POINT_RENAME(ures_countArrayItems)
+#define ures_findResource U_ICU_ENTRY_POINT_RENAME(ures_findResource)
+#define ures_findSubResource U_ICU_ENTRY_POINT_RENAME(ures_findSubResource)
+#define ures_getBinary U_ICU_ENTRY_POINT_RENAME(ures_getBinary)
+#define ures_getByIndex U_ICU_ENTRY_POINT_RENAME(ures_getByIndex)
+#define ures_getByKey U_ICU_ENTRY_POINT_RENAME(ures_getByKey)
+#define ures_getByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getByKeyWithFallback)
+#define ures_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ures_getFunctionalEquivalent)
+#define ures_getInt U_ICU_ENTRY_POINT_RENAME(ures_getInt)
+#define ures_getIntVector U_ICU_ENTRY_POINT_RENAME(ures_getIntVector)
+#define ures_getKey U_ICU_ENTRY_POINT_RENAME(ures_getKey)
+#define ures_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ures_getKeywordValues)
+#define ures_getLocale U_ICU_ENTRY_POINT_RENAME(ures_getLocale)
+#define ures_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ures_getLocaleByType)
+#define ures_getLocaleInternal U_ICU_ENTRY_POINT_RENAME(ures_getLocaleInternal)
+#define ures_getName U_ICU_ENTRY_POINT_RENAME(ures_getName)
+#define ures_getNextResource U_ICU_ENTRY_POINT_RENAME(ures_getNextResource)
+#define ures_getNextString U_ICU_ENTRY_POINT_RENAME(ures_getNextString)
+#define ures_getSize U_ICU_ENTRY_POINT_RENAME(ures_getSize)
+#define ures_getString U_ICU_ENTRY_POINT_RENAME(ures_getString)
+#define ures_getStringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getStringByIndex)
+#define ures_getStringByKey U_ICU_ENTRY_POINT_RENAME(ures_getStringByKey)
+#define ures_getStringByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getStringByKeyWithFallback)
+#define ures_getType U_ICU_ENTRY_POINT_RENAME(ures_getType)
+#define ures_getUInt U_ICU_ENTRY_POINT_RENAME(ures_getUInt)
+#define ures_getUTF8String U_ICU_ENTRY_POINT_RENAME(ures_getUTF8String)
+#define ures_getUTF8StringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByIndex)
+#define ures_getUTF8StringByKey U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByKey)
+#define ures_getVersion U_ICU_ENTRY_POINT_RENAME(ures_getVersion)
+#define ures_getVersionByKey U_ICU_ENTRY_POINT_RENAME(ures_getVersionByKey)
+#define ures_getVersionNumber U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumber)
+#define ures_getVersionNumberInternal U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumberInternal)
+#define ures_hasNext U_ICU_ENTRY_POINT_RENAME(ures_hasNext)
+#define ures_initStackObject U_ICU_ENTRY_POINT_RENAME(ures_initStackObject)
+#define ures_open U_ICU_ENTRY_POINT_RENAME(ures_open)
+#define ures_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ures_openAvailableLocales)
+#define ures_openDirect U_ICU_ENTRY_POINT_RENAME(ures_openDirect)
+#define ures_openFillIn U_ICU_ENTRY_POINT_RENAME(ures_openFillIn)
+#define ures_openU U_ICU_ENTRY_POINT_RENAME(ures_openU)
+#define ures_resetIterator U_ICU_ENTRY_POINT_RENAME(ures_resetIterator)
+#define ures_swap U_ICU_ENTRY_POINT_RENAME(ures_swap)
+#define uscript_closeRun U_ICU_ENTRY_POINT_RENAME(uscript_closeRun)
+#define uscript_getCode U_ICU_ENTRY_POINT_RENAME(uscript_getCode)
+#define uscript_getName U_ICU_ENTRY_POINT_RENAME(uscript_getName)
+#define uscript_getScript U_ICU_ENTRY_POINT_RENAME(uscript_getScript)
+#define uscript_getScriptExtensions U_ICU_ENTRY_POINT_RENAME(uscript_getScriptExtensions)
+#define uscript_getShortName U_ICU_ENTRY_POINT_RENAME(uscript_getShortName)
+#define uscript_hasScript U_ICU_ENTRY_POINT_RENAME(uscript_hasScript)
+#define uscript_nextRun U_ICU_ENTRY_POINT_RENAME(uscript_nextRun)
+#define uscript_openRun U_ICU_ENTRY_POINT_RENAME(uscript_openRun)
+#define uscript_resetRun U_ICU_ENTRY_POINT_RENAME(uscript_resetRun)
+#define uscript_setRunText U_ICU_ENTRY_POINT_RENAME(uscript_setRunText)
+#define usearch_close U_ICU_ENTRY_POINT_RENAME(usearch_close)
+#define usearch_first U_ICU_ENTRY_POINT_RENAME(usearch_first)
+#define usearch_following U_ICU_ENTRY_POINT_RENAME(usearch_following)
+#define usearch_getAttribute U_ICU_ENTRY_POINT_RENAME(usearch_getAttribute)
+#define usearch_getBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_getBreakIterator)
+#define usearch_getCollator U_ICU_ENTRY_POINT_RENAME(usearch_getCollator)
+#define usearch_getMatchedLength U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedLength)
+#define usearch_getMatchedStart U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedStart)
+#define usearch_getMatchedText U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedText)
+#define usearch_getOffset U_ICU_ENTRY_POINT_RENAME(usearch_getOffset)
+#define usearch_getPattern U_ICU_ENTRY_POINT_RENAME(usearch_getPattern)
+#define usearch_getText U_ICU_ENTRY_POINT_RENAME(usearch_getText)
+#define usearch_handleNextCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handleNextCanonical)
+#define usearch_handleNextExact U_ICU_ENTRY_POINT_RENAME(usearch_handleNextExact)
+#define usearch_handlePreviousCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousCanonical)
+#define usearch_handlePreviousExact U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousExact)
+#define usearch_last U_ICU_ENTRY_POINT_RENAME(usearch_last)
+#define usearch_next U_ICU_ENTRY_POINT_RENAME(usearch_next)
+#define usearch_open U_ICU_ENTRY_POINT_RENAME(usearch_open)
+#define usearch_openFromCollator U_ICU_ENTRY_POINT_RENAME(usearch_openFromCollator)
+#define usearch_preceding U_ICU_ENTRY_POINT_RENAME(usearch_preceding)
+#define usearch_previous U_ICU_ENTRY_POINT_RENAME(usearch_previous)
+#define usearch_reset U_ICU_ENTRY_POINT_RENAME(usearch_reset)
+#define usearch_search U_ICU_ENTRY_POINT_RENAME(usearch_search)
+#define usearch_searchBackwards U_ICU_ENTRY_POINT_RENAME(usearch_searchBackwards)
+#define usearch_setAttribute U_ICU_ENTRY_POINT_RENAME(usearch_setAttribute)
+#define usearch_setBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_setBreakIterator)
+#define usearch_setCollator U_ICU_ENTRY_POINT_RENAME(usearch_setCollator)
+#define usearch_setOffset U_ICU_ENTRY_POINT_RENAME(usearch_setOffset)
+#define usearch_setPattern U_ICU_ENTRY_POINT_RENAME(usearch_setPattern)
+#define usearch_setText U_ICU_ENTRY_POINT_RENAME(usearch_setText)
+#define uset_add U_ICU_ENTRY_POINT_RENAME(uset_add)
+#define uset_addAll U_ICU_ENTRY_POINT_RENAME(uset_addAll)
+#define uset_addAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_addAllCodePoints)
+#define uset_addRange U_ICU_ENTRY_POINT_RENAME(uset_addRange)
+#define uset_addString U_ICU_ENTRY_POINT_RENAME(uset_addString)
+#define uset_applyIntPropertyValue U_ICU_ENTRY_POINT_RENAME(uset_applyIntPropertyValue)
+#define uset_applyPattern U_ICU_ENTRY_POINT_RENAME(uset_applyPattern)
+#define uset_applyPropertyAlias U_ICU_ENTRY_POINT_RENAME(uset_applyPropertyAlias)
+#define uset_charAt U_ICU_ENTRY_POINT_RENAME(uset_charAt)
+#define uset_clear U_ICU_ENTRY_POINT_RENAME(uset_clear)
+#define uset_clone U_ICU_ENTRY_POINT_RENAME(uset_clone)
+#define uset_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(uset_cloneAsThawed)
+#define uset_close U_ICU_ENTRY_POINT_RENAME(uset_close)
+#define uset_closeOver U_ICU_ENTRY_POINT_RENAME(uset_closeOver)
+#define uset_compact U_ICU_ENTRY_POINT_RENAME(uset_compact)
+#define uset_complement U_ICU_ENTRY_POINT_RENAME(uset_complement)
+#define uset_complementAll U_ICU_ENTRY_POINT_RENAME(uset_complementAll)
+#define uset_contains U_ICU_ENTRY_POINT_RENAME(uset_contains)
+#define uset_containsAll U_ICU_ENTRY_POINT_RENAME(uset_containsAll)
+#define uset_containsAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_containsAllCodePoints)
+#define uset_containsNone U_ICU_ENTRY_POINT_RENAME(uset_containsNone)
+#define uset_containsRange U_ICU_ENTRY_POINT_RENAME(uset_containsRange)
+#define uset_containsSome U_ICU_ENTRY_POINT_RENAME(uset_containsSome)
+#define uset_containsString U_ICU_ENTRY_POINT_RENAME(uset_containsString)
+#define uset_equals U_ICU_ENTRY_POINT_RENAME(uset_equals)
+#define uset_freeze U_ICU_ENTRY_POINT_RENAME(uset_freeze)
+#define uset_getItem U_ICU_ENTRY_POINT_RENAME(uset_getItem)
+#define uset_getItemCount U_ICU_ENTRY_POINT_RENAME(uset_getItemCount)
+#define uset_getSerializedRange U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRange)
+#define uset_getSerializedRangeCount U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRangeCount)
+#define uset_getSerializedSet U_ICU_ENTRY_POINT_RENAME(uset_getSerializedSet)
+#define uset_indexOf U_ICU_ENTRY_POINT_RENAME(uset_indexOf)
+#define uset_isEmpty U_ICU_ENTRY_POINT_RENAME(uset_isEmpty)
+#define uset_isFrozen U_ICU_ENTRY_POINT_RENAME(uset_isFrozen)
+#define uset_open U_ICU_ENTRY_POINT_RENAME(uset_open)
+#define uset_openEmpty U_ICU_ENTRY_POINT_RENAME(uset_openEmpty)
+#define uset_openPattern U_ICU_ENTRY_POINT_RENAME(uset_openPattern)
+#define uset_openPatternOptions U_ICU_ENTRY_POINT_RENAME(uset_openPatternOptions)
+#define uset_remove U_ICU_ENTRY_POINT_RENAME(uset_remove)
+#define uset_removeAll U_ICU_ENTRY_POINT_RENAME(uset_removeAll)
+#define uset_removeAllStrings U_ICU_ENTRY_POINT_RENAME(uset_removeAllStrings)
+#define uset_removeRange U_ICU_ENTRY_POINT_RENAME(uset_removeRange)
+#define uset_removeString U_ICU_ENTRY_POINT_RENAME(uset_removeString)
+#define uset_resemblesPattern U_ICU_ENTRY_POINT_RENAME(uset_resemblesPattern)
+#define uset_retain U_ICU_ENTRY_POINT_RENAME(uset_retain)
+#define uset_retainAll U_ICU_ENTRY_POINT_RENAME(uset_retainAll)
+#define uset_serialize U_ICU_ENTRY_POINT_RENAME(uset_serialize)
+#define uset_serializedContains U_ICU_ENTRY_POINT_RENAME(uset_serializedContains)
+#define uset_set U_ICU_ENTRY_POINT_RENAME(uset_set)
+#define uset_setSerializedToOne U_ICU_ENTRY_POINT_RENAME(uset_setSerializedToOne)
+#define uset_size U_ICU_ENTRY_POINT_RENAME(uset_size)
+#define uset_span U_ICU_ENTRY_POINT_RENAME(uset_span)
+#define uset_spanBack U_ICU_ENTRY_POINT_RENAME(uset_spanBack)
+#define uset_spanBackUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanBackUTF8)
+#define uset_spanUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanUTF8)
+#define uset_toPattern U_ICU_ENTRY_POINT_RENAME(uset_toPattern)
+#define uspoof_areConfusable U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusable)
+#define uspoof_areConfusableUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUTF8)
+#define uspoof_areConfusableUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUnicodeString)
+#define uspoof_check U_ICU_ENTRY_POINT_RENAME(uspoof_check)
+#define uspoof_checkUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_checkUTF8)
+#define uspoof_checkUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_checkUnicodeString)
+#define uspoof_clone U_ICU_ENTRY_POINT_RENAME(uspoof_clone)
+#define uspoof_close U_ICU_ENTRY_POINT_RENAME(uspoof_close)
+#define uspoof_getAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedChars)
+#define uspoof_getAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedLocales)
+#define uspoof_getAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedUnicodeSet)
+#define uspoof_getChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getChecks)
+#define uspoof_getSkeleton U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeleton)
+#define uspoof_getSkeletonUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUTF8)
+#define uspoof_getSkeletonUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUnicodeString)
+#define uspoof_open U_ICU_ENTRY_POINT_RENAME(uspoof_open)
+#define uspoof_openFromSerialized U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSerialized)
+#define uspoof_openFromSource U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSource)
+#define uspoof_serialize U_ICU_ENTRY_POINT_RENAME(uspoof_serialize)
+#define uspoof_setAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedChars)
+#define uspoof_setAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedLocales)
+#define uspoof_setAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedUnicodeSet)
+#define uspoof_setChecks U_ICU_ENTRY_POINT_RENAME(uspoof_setChecks)
+#define uspoof_swap U_ICU_ENTRY_POINT_RENAME(uspoof_swap)
+#define usprep_close U_ICU_ENTRY_POINT_RENAME(usprep_close)
+#define usprep_open U_ICU_ENTRY_POINT_RENAME(usprep_open)
+#define usprep_openByType U_ICU_ENTRY_POINT_RENAME(usprep_openByType)
+#define usprep_prepare U_ICU_ENTRY_POINT_RENAME(usprep_prepare)
+#define usprep_swap U_ICU_ENTRY_POINT_RENAME(usprep_swap)
+#define ustr_foldCase U_ICU_ENTRY_POINT_RENAME(ustr_foldCase)
+#define ustr_toLower U_ICU_ENTRY_POINT_RENAME(ustr_toLower)
+#define ustr_toTitle U_ICU_ENTRY_POINT_RENAME(ustr_toTitle)
+#define ustr_toUpper U_ICU_ENTRY_POINT_RENAME(ustr_toUpper)
+#define utext_caseCompare U_ICU_ENTRY_POINT_RENAME(utext_caseCompare)
+#define utext_caseCompareNativeLimit U_ICU_ENTRY_POINT_RENAME(utext_caseCompareNativeLimit)
+#define utext_char32At U_ICU_ENTRY_POINT_RENAME(utext_char32At)
+#define utext_clone U_ICU_ENTRY_POINT_RENAME(utext_clone)
+#define utext_close U_ICU_ENTRY_POINT_RENAME(utext_close)
+#define utext_compare U_ICU_ENTRY_POINT_RENAME(utext_compare)
+#define utext_compareNativeLimit U_ICU_ENTRY_POINT_RENAME(utext_compareNativeLimit)
+#define utext_copy U_ICU_ENTRY_POINT_RENAME(utext_copy)
+#define utext_current32 U_ICU_ENTRY_POINT_RENAME(utext_current32)
+#define utext_equals U_ICU_ENTRY_POINT_RENAME(utext_equals)
+#define utext_extract U_ICU_ENTRY_POINT_RENAME(utext_extract)
+#define utext_freeze U_ICU_ENTRY_POINT_RENAME(utext_freeze)
+#define utext_getNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getNativeIndex)
+#define utext_getPreviousNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getPreviousNativeIndex)
+#define utext_hasMetaData U_ICU_ENTRY_POINT_RENAME(utext_hasMetaData)
+#define utext_isLengthExpensive U_ICU_ENTRY_POINT_RENAME(utext_isLengthExpensive)
+#define utext_isWritable U_ICU_ENTRY_POINT_RENAME(utext_isWritable)
+#define utext_moveIndex32 U_ICU_ENTRY_POINT_RENAME(utext_moveIndex32)
+#define utext_nativeLength U_ICU_ENTRY_POINT_RENAME(utext_nativeLength)
+#define utext_next32 U_ICU_ENTRY_POINT_RENAME(utext_next32)
+#define utext_next32From U_ICU_ENTRY_POINT_RENAME(utext_next32From)
+#define utext_openCharacterIterator U_ICU_ENTRY_POINT_RENAME(utext_openCharacterIterator)
+#define utext_openConstUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openConstUnicodeString)
+#define utext_openReplaceable U_ICU_ENTRY_POINT_RENAME(utext_openReplaceable)
+#define utext_openUChars U_ICU_ENTRY_POINT_RENAME(utext_openUChars)
+#define utext_openUTF8 U_ICU_ENTRY_POINT_RENAME(utext_openUTF8)
+#define utext_openUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openUnicodeString)
+#define utext_previous32 U_ICU_ENTRY_POINT_RENAME(utext_previous32)
+#define utext_previous32From U_ICU_ENTRY_POINT_RENAME(utext_previous32From)
+#define utext_replace U_ICU_ENTRY_POINT_RENAME(utext_replace)
+#define utext_setNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_setNativeIndex)
+#define utext_setup U_ICU_ENTRY_POINT_RENAME(utext_setup)
+#define utf8_appendCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_appendCharSafeBody)
+#define utf8_back1SafeBody U_ICU_ENTRY_POINT_RENAME(utf8_back1SafeBody)
+#define utf8_countTrailBytes U_ICU_ENTRY_POINT_RENAME(utf8_countTrailBytes)
+#define utf8_nextCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_nextCharSafeBody)
+#define utf8_prevCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_prevCharSafeBody)
+#define utmscale_fromInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_fromInt64)
+#define utmscale_getTimeScaleValue U_ICU_ENTRY_POINT_RENAME(utmscale_getTimeScaleValue)
+#define utmscale_toInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_toInt64)
+#define utrace_cleanup U_ICU_ENTRY_POINT_RENAME(utrace_cleanup)
+#define utrace_data U_ICU_ENTRY_POINT_RENAME(utrace_data)
+#define utrace_entry U_ICU_ENTRY_POINT_RENAME(utrace_entry)
+#define utrace_exit U_ICU_ENTRY_POINT_RENAME(utrace_exit)
+#define utrace_format U_ICU_ENTRY_POINT_RENAME(utrace_format)
+#define utrace_functionName U_ICU_ENTRY_POINT_RENAME(utrace_functionName)
+#define utrace_getFunctions U_ICU_ENTRY_POINT_RENAME(utrace_getFunctions)
+#define utrace_getLevel U_ICU_ENTRY_POINT_RENAME(utrace_getLevel)
+#define utrace_level U_ICU_ENTRY_POINT_RENAME(utrace_level)
+#define utrace_setFunctions U_ICU_ENTRY_POINT_RENAME(utrace_setFunctions)
+#define utrace_setLevel U_ICU_ENTRY_POINT_RENAME(utrace_setLevel)
+#define utrace_vformat U_ICU_ENTRY_POINT_RENAME(utrace_vformat)
+#define utrans_clone U_ICU_ENTRY_POINT_RENAME(utrans_clone)
+#define utrans_close U_ICU_ENTRY_POINT_RENAME(utrans_close)
+#define utrans_countAvailableIDs U_ICU_ENTRY_POINT_RENAME(utrans_countAvailableIDs)
+#define utrans_getAvailableID U_ICU_ENTRY_POINT_RENAME(utrans_getAvailableID)
+#define utrans_getID U_ICU_ENTRY_POINT_RENAME(utrans_getID)
+#define utrans_getUnicodeID U_ICU_ENTRY_POINT_RENAME(utrans_getUnicodeID)
+#define utrans_open U_ICU_ENTRY_POINT_RENAME(utrans_open)
+#define utrans_openIDs U_ICU_ENTRY_POINT_RENAME(utrans_openIDs)
+#define utrans_openInverse U_ICU_ENTRY_POINT_RENAME(utrans_openInverse)
+#define utrans_openU U_ICU_ENTRY_POINT_RENAME(utrans_openU)
+#define utrans_register U_ICU_ENTRY_POINT_RENAME(utrans_register)
+#define utrans_rep_caseContextIterator U_ICU_ENTRY_POINT_RENAME(utrans_rep_caseContextIterator)
+#define utrans_setFilter U_ICU_ENTRY_POINT_RENAME(utrans_setFilter)
+#define utrans_stripRules U_ICU_ENTRY_POINT_RENAME(utrans_stripRules)
+#define utrans_trans U_ICU_ENTRY_POINT_RENAME(utrans_trans)
+#define utrans_transIncremental U_ICU_ENTRY_POINT_RENAME(utrans_transIncremental)
+#define utrans_transIncrementalUChars U_ICU_ENTRY_POINT_RENAME(utrans_transIncrementalUChars)
+#define utrans_transUChars U_ICU_ENTRY_POINT_RENAME(utrans_transUChars)
+#define utrans_transliterator_cleanup U_ICU_ENTRY_POINT_RENAME(utrans_transliterator_cleanup)
+#define utrans_unregister U_ICU_ENTRY_POINT_RENAME(utrans_unregister)
+#define utrans_unregisterID U_ICU_ENTRY_POINT_RENAME(utrans_unregisterID)
+#define utrie2_clone U_ICU_ENTRY_POINT_RENAME(utrie2_clone)
+#define utrie2_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(utrie2_cloneAsThawed)
+#define utrie2_close U_ICU_ENTRY_POINT_RENAME(utrie2_close)
+#define utrie2_enum U_ICU_ENTRY_POINT_RENAME(utrie2_enum)
+#define utrie2_enumForLeadSurrogate U_ICU_ENTRY_POINT_RENAME(utrie2_enumForLeadSurrogate)
+#define utrie2_freeze U_ICU_ENTRY_POINT_RENAME(utrie2_freeze)
+#define utrie2_fromUTrie U_ICU_ENTRY_POINT_RENAME(utrie2_fromUTrie)
+#define utrie2_get32 U_ICU_ENTRY_POINT_RENAME(utrie2_get32)
+#define utrie2_get32FromLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_get32FromLeadSurrogateCodeUnit)
+#define utrie2_getVersion U_ICU_ENTRY_POINT_RENAME(utrie2_getVersion)
+#define utrie2_internalU8NextIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8NextIndex)
+#define utrie2_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8PrevIndex)
+#define utrie2_isFrozen U_ICU_ENTRY_POINT_RENAME(utrie2_isFrozen)
+#define utrie2_open U_ICU_ENTRY_POINT_RENAME(utrie2_open)
+#define utrie2_openDummy U_ICU_ENTRY_POINT_RENAME(utrie2_openDummy)
+#define utrie2_openFromSerialized U_ICU_ENTRY_POINT_RENAME(utrie2_openFromSerialized)
+#define utrie2_serialize U_ICU_ENTRY_POINT_RENAME(utrie2_serialize)
+#define utrie2_set32 U_ICU_ENTRY_POINT_RENAME(utrie2_set32)
+#define utrie2_set32ForLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_set32ForLeadSurrogateCodeUnit)
+#define utrie2_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie2_setRange32)
+#define utrie2_swap U_ICU_ENTRY_POINT_RENAME(utrie2_swap)
+#define utrie2_swapAnyVersion U_ICU_ENTRY_POINT_RENAME(utrie2_swapAnyVersion)
+#define utrie_clone U_ICU_ENTRY_POINT_RENAME(utrie_clone)
+#define utrie_close U_ICU_ENTRY_POINT_RENAME(utrie_close)
+#define utrie_defaultGetFoldingOffset U_ICU_ENTRY_POINT_RENAME(utrie_defaultGetFoldingOffset)
+#define utrie_enum U_ICU_ENTRY_POINT_RENAME(utrie_enum)
+#define utrie_get32 U_ICU_ENTRY_POINT_RENAME(utrie_get32)
+#define utrie_getData U_ICU_ENTRY_POINT_RENAME(utrie_getData)
+#define utrie_open U_ICU_ENTRY_POINT_RENAME(utrie_open)
+#define utrie_serialize U_ICU_ENTRY_POINT_RENAME(utrie_serialize)
+#define utrie_set32 U_ICU_ENTRY_POINT_RENAME(utrie_set32)
+#define utrie_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie_setRange32)
+#define utrie_swap U_ICU_ENTRY_POINT_RENAME(utrie_swap)
+#define utrie_unserialize U_ICU_ENTRY_POINT_RENAME(utrie_unserialize)
+#define utrie_unserializeDummy U_ICU_ENTRY_POINT_RENAME(utrie_unserializeDummy)
+#define vzone_clone U_ICU_ENTRY_POINT_RENAME(vzone_clone)
+#define vzone_close U_ICU_ENTRY_POINT_RENAME(vzone_close)
+#define vzone_countTransitionRules U_ICU_ENTRY_POINT_RENAME(vzone_countTransitionRules)
+#define vzone_equals U_ICU_ENTRY_POINT_RENAME(vzone_equals)
+#define vzone_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(vzone_getDynamicClassID)
+#define vzone_getLastModified U_ICU_ENTRY_POINT_RENAME(vzone_getLastModified)
+#define vzone_getNextTransition U_ICU_ENTRY_POINT_RENAME(vzone_getNextTransition)
+#define vzone_getOffset U_ICU_ENTRY_POINT_RENAME(vzone_getOffset)
+#define vzone_getOffset2 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset2)
+#define vzone_getOffset3 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset3)
+#define vzone_getPreviousTransition U_ICU_ENTRY_POINT_RENAME(vzone_getPreviousTransition)
+#define vzone_getRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_getRawOffset)
+#define vzone_getStaticClassID U_ICU_ENTRY_POINT_RENAME(vzone_getStaticClassID)
+#define vzone_getTZURL U_ICU_ENTRY_POINT_RENAME(vzone_getTZURL)
+#define vzone_hasSameRules U_ICU_ENTRY_POINT_RENAME(vzone_hasSameRules)
+#define vzone_inDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_inDaylightTime)
+#define vzone_openData U_ICU_ENTRY_POINT_RENAME(vzone_openData)
+#define vzone_openID U_ICU_ENTRY_POINT_RENAME(vzone_openID)
+#define vzone_setLastModified U_ICU_ENTRY_POINT_RENAME(vzone_setLastModified)
+#define vzone_setRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_setRawOffset)
+#define vzone_setTZURL U_ICU_ENTRY_POINT_RENAME(vzone_setTZURL)
+#define vzone_useDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_useDaylightTime)
+#define vzone_write U_ICU_ENTRY_POINT_RENAME(vzone_write)
+#define vzone_writeFromStart U_ICU_ENTRY_POINT_RENAME(vzone_writeFromStart)
+#define vzone_writeSimple U_ICU_ENTRY_POINT_RENAME(vzone_writeSimple)
+#define zrule_close U_ICU_ENTRY_POINT_RENAME(zrule_close)
+#define zrule_equals U_ICU_ENTRY_POINT_RENAME(zrule_equals)
+#define zrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(zrule_getDSTSavings)
+#define zrule_getName U_ICU_ENTRY_POINT_RENAME(zrule_getName)
+#define zrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(zrule_getRawOffset)
+#define zrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(zrule_isEquivalentTo)
+#define ztrans_adoptFrom U_ICU_ENTRY_POINT_RENAME(ztrans_adoptFrom)
+#define ztrans_adoptTo U_ICU_ENTRY_POINT_RENAME(ztrans_adoptTo)
+#define ztrans_clone U_ICU_ENTRY_POINT_RENAME(ztrans_clone)
+#define ztrans_close U_ICU_ENTRY_POINT_RENAME(ztrans_close)
+#define ztrans_equals U_ICU_ENTRY_POINT_RENAME(ztrans_equals)
+#define ztrans_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getDynamicClassID)
+#define ztrans_getFrom U_ICU_ENTRY_POINT_RENAME(ztrans_getFrom)
+#define ztrans_getStaticClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getStaticClassID)
+#define ztrans_getTime U_ICU_ENTRY_POINT_RENAME(ztrans_getTime)
+#define ztrans_getTo U_ICU_ENTRY_POINT_RENAME(ztrans_getTo)
+#define ztrans_open U_ICU_ENTRY_POINT_RENAME(ztrans_open)
+#define ztrans_openEmpty U_ICU_ENTRY_POINT_RENAME(ztrans_openEmpty)
+#define ztrans_setFrom U_ICU_ENTRY_POINT_RENAME(ztrans_setFrom)
+#define ztrans_setTime U_ICU_ENTRY_POINT_RENAME(ztrans_setTime)
+#define ztrans_setTo U_ICU_ENTRY_POINT_RENAME(ztrans_setTo)
+
+
+/* C++ class names renaming defines */
+
+#ifdef XP_CPLUSPLUS
+#if !U_HAVE_NAMESPACE
+
+#define AbsoluteValueSubstitution U_ICU_ENTRY_POINT_RENAME(AbsoluteValueSubstitution)
+#define AlternateSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(AlternateSubstitutionSubtable)
+#define AnchorTable U_ICU_ENTRY_POINT_RENAME(AnchorTable)
+#define AndConstraint U_ICU_ENTRY_POINT_RENAME(AndConstraint)
+#define AnnualTimeZoneRule U_ICU_ENTRY_POINT_RENAME(AnnualTimeZoneRule)
+#define AnyTransliterator U_ICU_ENTRY_POINT_RENAME(AnyTransliterator)
+#define ArabicOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(ArabicOpenTypeLayoutEngine)
+#define ArabicShaping U_ICU_ENTRY_POINT_RENAME(ArabicShaping)
+#define ArgExtractor U_ICU_ENTRY_POINT_RENAME(ArgExtractor)
+#define BMPSet U_ICU_ENTRY_POINT_RENAME(BMPSet)
+#define BackwardUTrie2StringIterator U_ICU_ENTRY_POINT_RENAME(BackwardUTrie2StringIterator)
+#define BadCharacterTable U_ICU_ENTRY_POINT_RENAME(BadCharacterTable)
+#define BasicCalendarFactory U_ICU_ENTRY_POINT_RENAME(BasicCalendarFactory)
+#define BasicTimeZone U_ICU_ENTRY_POINT_RENAME(BasicTimeZone)
+#define BinarySearchLookupTable U_ICU_ENTRY_POINT_RENAME(BinarySearchLookupTable)
+#define BoyerMooreSearch U_ICU_ENTRY_POINT_RENAME(BoyerMooreSearch)
+#define BreakIterator U_ICU_ENTRY_POINT_RENAME(BreakIterator)
+#define BreakTransliterator U_ICU_ENTRY_POINT_RENAME(BreakTransliterator)
+#define BuddhistCalendar U_ICU_ENTRY_POINT_RENAME(BuddhistCalendar)
+#define BuildCompactTrieHorizontalNode U_ICU_ENTRY_POINT_RENAME(BuildCompactTrieHorizontalNode)
+#define BuildCompactTrieNode U_ICU_ENTRY_POINT_RENAME(BuildCompactTrieNode)
+#define BuildCompactTrieVerticalNode U_ICU_ENTRY_POINT_RENAME(BuildCompactTrieVerticalNode)
+#define BuilderScriptSet U_ICU_ENTRY_POINT_RENAME(BuilderScriptSet)
+#define ByteSink U_ICU_ENTRY_POINT_RENAME(ByteSink)
+#define CEBuffer U_ICU_ENTRY_POINT_RENAME(CEBuffer)
+#define CECalendar U_ICU_ENTRY_POINT_RENAME(CECalendar)
+#define CEList U_ICU_ENTRY_POINT_RENAME(CEList)
+#define CEToStringsMap U_ICU_ENTRY_POINT_RENAME(CEToStringsMap)
+#define CFactory U_ICU_ENTRY_POINT_RENAME(CFactory)
+#define Calendar U_ICU_ENTRY_POINT_RENAME(Calendar)
+#define CalendarAstronomer U_ICU_ENTRY_POINT_RENAME(CalendarAstronomer)
+#define CalendarCache U_ICU_ENTRY_POINT_RENAME(CalendarCache)
+#define CalendarData U_ICU_ENTRY_POINT_RENAME(CalendarData)
+#define CalendarService U_ICU_ENTRY_POINT_RENAME(CalendarService)
+#define CanonIterData U_ICU_ENTRY_POINT_RENAME(CanonIterData)
+#define CanonIterDataSingleton U_ICU_ENTRY_POINT_RENAME(CanonIterDataSingleton)
+#define CanonMarkFilter U_ICU_ENTRY_POINT_RENAME(CanonMarkFilter)
+#define CanonShaping U_ICU_ENTRY_POINT_RENAME(CanonShaping)
+#define CanonicalIterator U_ICU_ENTRY_POINT_RENAME(CanonicalIterator)
+#define CaseMapTransliterator U_ICU_ENTRY_POINT_RENAME(CaseMapTransliterator)
+#define ChainingContextualSubstitutionFormat1Subtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionFormat1Subtable)
+#define ChainingContextualSubstitutionFormat2Subtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionFormat2Subtable)
+#define ChainingContextualSubstitutionFormat3Subtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionFormat3Subtable)
+#define ChainingContextualSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionSubtable)
+#define CharString U_ICU_ENTRY_POINT_RENAME(CharString)
+#define CharSubstitutionFilter U_ICU_ENTRY_POINT_RENAME(CharSubstitutionFilter)
+#define CharacterIterator U_ICU_ENTRY_POINT_RENAME(CharacterIterator)
+#define CharacterNode U_ICU_ENTRY_POINT_RENAME(CharacterNode)
+#define CharsetDetector U_ICU_ENTRY_POINT_RENAME(CharsetDetector)
+#define CharsetMatch U_ICU_ENTRY_POINT_RENAME(CharsetMatch)
+#define CharsetRecog_2022 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022)
+#define CharsetRecog_2022CN U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022CN)
+#define CharsetRecog_2022JP U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022JP)
+#define CharsetRecog_2022KR U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022KR)
+#define CharsetRecog_8859_1 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1)
+#define CharsetRecog_8859_1_da U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_da)
+#define CharsetRecog_8859_1_de U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_de)
+#define CharsetRecog_8859_1_en U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_en)
+#define CharsetRecog_8859_1_es U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_es)
+#define CharsetRecog_8859_1_fr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_fr)
+#define CharsetRecog_8859_1_it U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_it)
+#define CharsetRecog_8859_1_nl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_nl)
+#define CharsetRecog_8859_1_no U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_no)
+#define CharsetRecog_8859_1_pt U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_pt)
+#define CharsetRecog_8859_1_sv U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_sv)
+#define CharsetRecog_8859_2 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2)
+#define CharsetRecog_8859_2_cs U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_cs)
+#define CharsetRecog_8859_2_hu U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_hu)
+#define CharsetRecog_8859_2_pl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_pl)
+#define CharsetRecog_8859_2_ro U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_ro)
+#define CharsetRecog_8859_5 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_5)
+#define CharsetRecog_8859_5_ru U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_5_ru)
+#define CharsetRecog_8859_6 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_6)
+#define CharsetRecog_8859_6_ar U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_6_ar)
+#define CharsetRecog_8859_7 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_7)
+#define CharsetRecog_8859_7_el U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_7_el)
+#define CharsetRecog_8859_8 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_8)
+#define CharsetRecog_8859_8_I_he U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_8_I_he)
+#define CharsetRecog_8859_8_he U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_8_he)
+#define CharsetRecog_8859_9 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_9)
+#define CharsetRecog_8859_9_tr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_9_tr)
+#define CharsetRecog_IBM420_ar U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM420_ar)
+#define CharsetRecog_IBM420_ar_ltr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM420_ar_ltr)
+#define CharsetRecog_IBM420_ar_rtl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM420_ar_rtl)
+#define CharsetRecog_IBM424_he U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM424_he)
+#define CharsetRecog_IBM424_he_ltr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM424_he_ltr)
+#define CharsetRecog_IBM424_he_rtl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM424_he_rtl)
+#define CharsetRecog_KOI8_R U_ICU_ENTRY_POINT_RENAME(CharsetRecog_KOI8_R)
+#define CharsetRecog_UTF8 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF8)
+#define CharsetRecog_UTF_16_BE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_16_BE)
+#define CharsetRecog_UTF_16_LE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_16_LE)
+#define CharsetRecog_UTF_32 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_32)
+#define CharsetRecog_UTF_32_BE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_32_BE)
+#define CharsetRecog_UTF_32_LE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_32_LE)
+#define CharsetRecog_Unicode U_ICU_ENTRY_POINT_RENAME(CharsetRecog_Unicode)
+#define CharsetRecog_big5 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_big5)
+#define CharsetRecog_euc U_ICU_ENTRY_POINT_RENAME(CharsetRecog_euc)
+#define CharsetRecog_euc_jp U_ICU_ENTRY_POINT_RENAME(CharsetRecog_euc_jp)
+#define CharsetRecog_euc_kr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_euc_kr)
+#define CharsetRecog_gb_18030 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_gb_18030)
+#define CharsetRecog_mbcs U_ICU_ENTRY_POINT_RENAME(CharsetRecog_mbcs)
+#define CharsetRecog_sbcs U_ICU_ENTRY_POINT_RENAME(CharsetRecog_sbcs)
+#define CharsetRecog_sjis U_ICU_ENTRY_POINT_RENAME(CharsetRecog_sjis)
+#define CharsetRecog_windows_1251 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_windows_1251)
+#define CharsetRecog_windows_1256 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_windows_1256)
+#define CharsetRecognizer U_ICU_ENTRY_POINT_RENAME(CharsetRecognizer)
+#define CheckedArrayByteSink U_ICU_ENTRY_POINT_RENAME(CheckedArrayByteSink)
+#define ChineseCalendar U_ICU_ENTRY_POINT_RENAME(ChineseCalendar)
+#define ChoiceFormat U_ICU_ENTRY_POINT_RENAME(ChoiceFormat)
+#define ClassDefFormat1Table U_ICU_ENTRY_POINT_RENAME(ClassDefFormat1Table)
+#define ClassDefFormat2Table U_ICU_ENTRY_POINT_RENAME(ClassDefFormat2Table)
+#define ClassDefinitionTable U_ICU_ENTRY_POINT_RENAME(ClassDefinitionTable)
+#define ClockMath U_ICU_ENTRY_POINT_RENAME(ClockMath)
+#define CollData U_ICU_ENTRY_POINT_RENAME(CollData)
+#define CollDataCache U_ICU_ENTRY_POINT_RENAME(CollDataCache)
+#define CollDataCacheEntry U_ICU_ENTRY_POINT_RENAME(CollDataCacheEntry)
+#define CollationElementIterator U_ICU_ENTRY_POINT_RENAME(CollationElementIterator)
+#define CollationKey U_ICU_ENTRY_POINT_RENAME(CollationKey)
+#define CollationLocaleListEnumeration U_ICU_ENTRY_POINT_RENAME(CollationLocaleListEnumeration)
+#define Collator U_ICU_ENTRY_POINT_RENAME(Collator)
+#define CollatorFactory U_ICU_ENTRY_POINT_RENAME(CollatorFactory)
+#define CompactTrieDictionary U_ICU_ENTRY_POINT_RENAME(CompactTrieDictionary)
+#define CompactTrieEnumeration U_ICU_ENTRY_POINT_RENAME(CompactTrieEnumeration)
+#define ComposeNormalizer2 U_ICU_ENTRY_POINT_RENAME(ComposeNormalizer2)
+#define CompoundTransliterator U_ICU_ENTRY_POINT_RENAME(CompoundTransliterator)
+#define ConfusabledataBuilder U_ICU_ENTRY_POINT_RENAME(ConfusabledataBuilder)
+#define ContextualGlyphSubstitutionProcessor U_ICU_ENTRY_POINT_RENAME(ContextualGlyphSubstitutionProcessor)
+#define ContextualSubstitutionBase U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionBase)
+#define ContextualSubstitutionFormat1Subtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionFormat1Subtable)
+#define ContextualSubstitutionFormat2Subtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionFormat2Subtable)
+#define ContextualSubstitutionFormat3Subtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionFormat3Subtable)
+#define ContextualSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionSubtable)
+#define CopticCalendar U_ICU_ENTRY_POINT_RENAME(CopticCalendar)
+#define CoverageFormat1Table U_ICU_ENTRY_POINT_RENAME(CoverageFormat1Table)
+#define CoverageFormat2Table U_ICU_ENTRY_POINT_RENAME(CoverageFormat2Table)
+#define CoverageTable U_ICU_ENTRY_POINT_RENAME(CoverageTable)
+#define CurrencyAmount U_ICU_ENTRY_POINT_RENAME(CurrencyAmount)
+#define CurrencyFormat U_ICU_ENTRY_POINT_RENAME(CurrencyFormat)
+#define CurrencyPluralInfo U_ICU_ENTRY_POINT_RENAME(CurrencyPluralInfo)
+#define CurrencyUnit U_ICU_ENTRY_POINT_RENAME(CurrencyUnit)
+#define CursiveAttachmentSubtable U_ICU_ENTRY_POINT_RENAME(CursiveAttachmentSubtable)
+#define DTRedundantEnumeration U_ICU_ENTRY_POINT_RENAME(DTRedundantEnumeration)
+#define DTSkeletonEnumeration U_ICU_ENTRY_POINT_RENAME(DTSkeletonEnumeration)
+#define DateFormat U_ICU_ENTRY_POINT_RENAME(DateFormat)
+#define DateFormatSymbols U_ICU_ENTRY_POINT_RENAME(DateFormatSymbols)
+#define DateInterval U_ICU_ENTRY_POINT_RENAME(DateInterval)
+#define DateIntervalFormat U_ICU_ENTRY_POINT_RENAME(DateIntervalFormat)
+#define DateIntervalInfo U_ICU_ENTRY_POINT_RENAME(DateIntervalInfo)
+#define DateTimeMatcher U_ICU_ENTRY_POINT_RENAME(DateTimeMatcher)
+#define DateTimePatternGenerator U_ICU_ENTRY_POINT_RENAME(DateTimePatternGenerator)
+#define DateTimeRule U_ICU_ENTRY_POINT_RENAME(DateTimeRule)
+#define DecimalFormat U_ICU_ENTRY_POINT_RENAME(DecimalFormat)
+#define DecimalFormatSymbols U_ICU_ENTRY_POINT_RENAME(DecimalFormatSymbols)
+#define DecomposeNormalizer2 U_ICU_ENTRY_POINT_RENAME(DecomposeNormalizer2)
+#define DefaultCalendarFactory U_ICU_ENTRY_POINT_RENAME(DefaultCalendarFactory)
+#define DefaultCharMapper U_ICU_ENTRY_POINT_RENAME(DefaultCharMapper)
+#define DeviceTable U_ICU_ENTRY_POINT_RENAME(DeviceTable)
+#define DictionaryBreakEngine U_ICU_ENTRY_POINT_RENAME(DictionaryBreakEngine)
+#define DigitList U_ICU_ENTRY_POINT_RENAME(DigitList)
+#define DistanceInfo U_ICU_ENTRY_POINT_RENAME(DistanceInfo)
+#define EnumToOffset U_ICU_ENTRY_POINT_RENAME(EnumToOffset)
+#define ErrorCode U_ICU_ENTRY_POINT_RENAME(ErrorCode)
+#define EscapeTransliterator U_ICU_ENTRY_POINT_RENAME(EscapeTransliterator)
+#define EthiopicCalendar U_ICU_ENTRY_POINT_RENAME(EthiopicCalendar)
+#define EventListener U_ICU_ENTRY_POINT_RENAME(EventListener)
+#define ExtensionSubtable U_ICU_ENTRY_POINT_RENAME(ExtensionSubtable)
+#define FCDNormalizer2 U_ICU_ENTRY_POINT_RENAME(FCDNormalizer2)
+#define FCDTrieSingleton U_ICU_ENTRY_POINT_RENAME(FCDTrieSingleton)
+#define FeatureListTable U_ICU_ENTRY_POINT_RENAME(FeatureListTable)
+#define FieldPosition U_ICU_ENTRY_POINT_RENAME(FieldPosition)
+#define FieldPositionHandler U_ICU_ENTRY_POINT_RENAME(FieldPositionHandler)
+#define FieldPositionIterator U_ICU_ENTRY_POINT_RENAME(FieldPositionIterator)
+#define FieldPositionIteratorHandler U_ICU_ENTRY_POINT_RENAME(FieldPositionIteratorHandler)
+#define FieldPositionOnlyHandler U_ICU_ENTRY_POINT_RENAME(FieldPositionOnlyHandler)
+#define FilteredNormalizer2 U_ICU_ENTRY_POINT_RENAME(FilteredNormalizer2)
+#define FontRuns U_ICU_ENTRY_POINT_RENAME(FontRuns)
+#define Format U_ICU_ENTRY_POINT_RENAME(Format)
+#define Format1AnchorTable U_ICU_ENTRY_POINT_RENAME(Format1AnchorTable)
+#define Format2AnchorTable U_ICU_ENTRY_POINT_RENAME(Format2AnchorTable)
+#define Format3AnchorTable U_ICU_ENTRY_POINT_RENAME(Format3AnchorTable)
+#define FormatNameEnumeration U_ICU_ENTRY_POINT_RENAME(FormatNameEnumeration)
+#define FormatParser U_ICU_ENTRY_POINT_RENAME(FormatParser)
+#define Formattable U_ICU_ENTRY_POINT_RENAME(Formattable)
+#define ForwardCharacterIterator U_ICU_ENTRY_POINT_RENAME(ForwardCharacterIterator)
+#define ForwardUTrie2StringIterator U_ICU_ENTRY_POINT_RENAME(ForwardUTrie2StringIterator)
+#define FractionalPartSubstitution U_ICU_ENTRY_POINT_RENAME(FractionalPartSubstitution)
+#define FunctionReplacer U_ICU_ENTRY_POINT_RENAME(FunctionReplacer)
+#define GDEFMarkFilter U_ICU_ENTRY_POINT_RENAME(GDEFMarkFilter)
+#define GXLayoutEngine U_ICU_ENTRY_POINT_RENAME(GXLayoutEngine)
+#define GlyphDefinitionTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphDefinitionTableHeader)
+#define GlyphIterator U_ICU_ENTRY_POINT_RENAME(GlyphIterator)
+#define GlyphLookupTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphLookupTableHeader)
+#define GlyphPositionAdjustments U_ICU_ENTRY_POINT_RENAME(GlyphPositionAdjustments)
+#define GlyphPositioningLookupProcessor U_ICU_ENTRY_POINT_RENAME(GlyphPositioningLookupProcessor)
+#define GlyphPositioningTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphPositioningTableHeader)
+#define GlyphSubstitutionLookupProcessor U_ICU_ENTRY_POINT_RENAME(GlyphSubstitutionLookupProcessor)
+#define GlyphSubstitutionTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphSubstitutionTableHeader)
+#define GoodSuffixTable U_ICU_ENTRY_POINT_RENAME(GoodSuffixTable)
+#define Grego U_ICU_ENTRY_POINT_RENAME(Grego)
+#define GregorianCalendar U_ICU_ENTRY_POINT_RENAME(GregorianCalendar)
+#define HanOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(HanOpenTypeLayoutEngine)
+#define HangulOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(HangulOpenTypeLayoutEngine)
+#define HebrewCalendar U_ICU_ENTRY_POINT_RENAME(HebrewCalendar)
+#define ICUBreakIteratorFactory U_ICU_ENTRY_POINT_RENAME(ICUBreakIteratorFactory)
+#define ICUBreakIteratorService U_ICU_ENTRY_POINT_RENAME(ICUBreakIteratorService)
+#define ICUCollatorFactory U_ICU_ENTRY_POINT_RENAME(ICUCollatorFactory)
+#define ICUCollatorService U_ICU_ENTRY_POINT_RENAME(ICUCollatorService)
+#define ICUDataTable U_ICU_ENTRY_POINT_RENAME(ICUDataTable)
+#define ICULanguageBreakFactory U_ICU_ENTRY_POINT_RENAME(ICULanguageBreakFactory)
+#define ICULocaleService U_ICU_ENTRY_POINT_RENAME(ICULocaleService)
+#define ICUNotifier U_ICU_ENTRY_POINT_RENAME(ICUNotifier)
+#define ICUNumberFormatFactory U_ICU_ENTRY_POINT_RENAME(ICUNumberFormatFactory)
+#define ICUNumberFormatService U_ICU_ENTRY_POINT_RENAME(ICUNumberFormatService)
+#define ICUResourceBundleFactory U_ICU_ENTRY_POINT_RENAME(ICUResourceBundleFactory)
+#define ICUService U_ICU_ENTRY_POINT_RENAME(ICUService)
+#define ICUServiceFactory U_ICU_ENTRY_POINT_RENAME(ICUServiceFactory)
+#define ICUServiceKey U_ICU_ENTRY_POINT_RENAME(ICUServiceKey)
+#define ICU_Utility U_ICU_ENTRY_POINT_RENAME(ICU_Utility)
+#define IDNA U_ICU_ENTRY_POINT_RENAME(IDNA)
+#define IndianCalendar U_ICU_ENTRY_POINT_RENAME(IndianCalendar)
+#define IndicClassTable U_ICU_ENTRY_POINT_RENAME(IndicClassTable)
+#define IndicOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(IndicOpenTypeLayoutEngine)
+#define IndicRearrangementProcessor U_ICU_ENTRY_POINT_RENAME(IndicRearrangementProcessor)
+#define IndicReordering U_ICU_ENTRY_POINT_RENAME(IndicReordering)
+#define InitialTimeZoneRule U_ICU_ENTRY_POINT_RENAME(InitialTimeZoneRule)
+#define InputText U_ICU_ENTRY_POINT_RENAME(InputText)
+#define IntegralPartSubstitution U_ICU_ENTRY_POINT_RENAME(IntegralPartSubstitution)
+#define IslamicCalendar U_ICU_ENTRY_POINT_RENAME(IslamicCalendar)
+#define IteratedChar U_ICU_ENTRY_POINT_RENAME(IteratedChar)
+#define JapaneseCalendar U_ICU_ENTRY_POINT_RENAME(JapaneseCalendar)
+#define KernTable U_ICU_ENTRY_POINT_RENAME(KernTable)
+#define KeywordEnumeration U_ICU_ENTRY_POINT_RENAME(KeywordEnumeration)
+#define KhmerClassTable U_ICU_ENTRY_POINT_RENAME(KhmerClassTable)
+#define KhmerOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(KhmerOpenTypeLayoutEngine)
+#define KhmerReordering U_ICU_ENTRY_POINT_RENAME(KhmerReordering)
+#define LECharMapper U_ICU_ENTRY_POINT_RENAME(LECharMapper)
+#define LEFontInstance U_ICU_ENTRY_POINT_RENAME(LEFontInstance)
+#define LEGlyphFilter U_ICU_ENTRY_POINT_RENAME(LEGlyphFilter)
+#define LEGlyphStorage U_ICU_ENTRY_POINT_RENAME(LEGlyphStorage)
+#define LEInsertionCallback U_ICU_ENTRY_POINT_RENAME(LEInsertionCallback)
+#define LEInsertionList U_ICU_ENTRY_POINT_RENAME(LEInsertionList)
+#define LXUtilities U_ICU_ENTRY_POINT_RENAME(LXUtilities)
+#define LanguageBreakEngine U_ICU_ENTRY_POINT_RENAME(LanguageBreakEngine)
+#define LanguageBreakFactory U_ICU_ENTRY_POINT_RENAME(LanguageBreakFactory)
+#define LayoutEngine U_ICU_ENTRY_POINT_RENAME(LayoutEngine)
+#define LigatureSubstitutionProcessor U_ICU_ENTRY_POINT_RENAME(LigatureSubstitutionProcessor)
+#define LigatureSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(LigatureSubstitutionSubtable)
+#define LocDataParser U_ICU_ENTRY_POINT_RENAME(LocDataParser)
+#define Locale U_ICU_ENTRY_POINT_RENAME(Locale)
+#define LocaleBased U_ICU_ENTRY_POINT_RENAME(LocaleBased)
+#define LocaleDisplayNames U_ICU_ENTRY_POINT_RENAME(LocaleDisplayNames)
+#define LocaleDisplayNamesImpl U_ICU_ENTRY_POINT_RENAME(LocaleDisplayNamesImpl)
+#define LocaleKey U_ICU_ENTRY_POINT_RENAME(LocaleKey)
+#define LocaleKeyFactory U_ICU_ENTRY_POINT_RENAME(LocaleKeyFactory)
+#define LocaleRuns U_ICU_ENTRY_POINT_RENAME(LocaleRuns)
+#define LocaleUtility U_ICU_ENTRY_POINT_RENAME(LocaleUtility)
+#define LocalizationInfo U_ICU_ENTRY_POINT_RENAME(LocalizationInfo)
+#define LookupListTable U_ICU_ENTRY_POINT_RENAME(LookupListTable)
+#define LookupProcessor U_ICU_ENTRY_POINT_RENAME(LookupProcessor)
+#define LookupSubtable U_ICU_ENTRY_POINT_RENAME(LookupSubtable)
+#define LookupTable U_ICU_ENTRY_POINT_RENAME(LookupTable)
+#define LowercaseTransliterator U_ICU_ENTRY_POINT_RENAME(LowercaseTransliterator)
+#define MPreFixups U_ICU_ENTRY_POINT_RENAME(MPreFixups)
+#define MarkArray U_ICU_ENTRY_POINT_RENAME(MarkArray)
+#define MarkToBasePositioningSubtable U_ICU_ENTRY_POINT_RENAME(MarkToBasePositioningSubtable)
+#define MarkToLigaturePositioningSubtable U_ICU_ENTRY_POINT_RENAME(MarkToLigaturePositioningSubtable)
+#define MarkToMarkPositioningSubtable U_ICU_ENTRY_POINT_RENAME(MarkToMarkPositioningSubtable)
+#define Measure U_ICU_ENTRY_POINT_RENAME(Measure)
+#define MeasureFormat U_ICU_ENTRY_POINT_RENAME(MeasureFormat)
+#define MeasureUnit U_ICU_ENTRY_POINT_RENAME(MeasureUnit)
+#define MessageFormat U_ICU_ENTRY_POINT_RENAME(MessageFormat)
+#define MessageFormatAdapter U_ICU_ENTRY_POINT_RENAME(MessageFormatAdapter)
+#define ModulusSubstitution U_ICU_ENTRY_POINT_RENAME(ModulusSubstitution)
+#define MoonRiseSetCoordFunc U_ICU_ENTRY_POINT_RENAME(MoonRiseSetCoordFunc)
+#define MoonTimeAngleFunc U_ICU_ENTRY_POINT_RENAME(MoonTimeAngleFunc)
+#define MorphSubtableHeader U_ICU_ENTRY_POINT_RENAME(MorphSubtableHeader)
+#define MorphTableHeader U_ICU_ENTRY_POINT_RENAME(MorphTableHeader)
+#define MultipleSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(MultipleSubstitutionSubtable)
+#define MultiplierSubstitution U_ICU_ENTRY_POINT_RENAME(MultiplierSubstitution)
+#define MutableTrieDictionary U_ICU_ENTRY_POINT_RENAME(MutableTrieDictionary)
+#define MutableTrieEnumeration U_ICU_ENTRY_POINT_RENAME(MutableTrieEnumeration)
+#define NFFactory U_ICU_ENTRY_POINT_RENAME(NFFactory)
+#define NFKDBuffer U_ICU_ENTRY_POINT_RENAME(NFKDBuffer)
+#define NFRule U_ICU_ENTRY_POINT_RENAME(NFRule)
+#define NFRuleSet U_ICU_ENTRY_POINT_RENAME(NFRuleSet)
+#define NFSubstitution U_ICU_ENTRY_POINT_RENAME(NFSubstitution)
+#define NGramParser U_ICU_ENTRY_POINT_RENAME(NGramParser)
+#define NameToEnum U_ICU_ENTRY_POINT_RENAME(NameToEnum)
+#define NameUnicodeTransliterator U_ICU_ENTRY_POINT_RENAME(NameUnicodeTransliterator)
+#define NonContextualGlyphSubstitutionProcessor U_ICU_ENTRY_POINT_RENAME(NonContextualGlyphSubstitutionProcessor)
+#define NonContiguousEnumToOffset U_ICU_ENTRY_POINT_RENAME(NonContiguousEnumToOffset)
+#define NoopNormalizer2 U_ICU_ENTRY_POINT_RENAME(NoopNormalizer2)
+#define Norm2AllModes U_ICU_ENTRY_POINT_RENAME(Norm2AllModes)
+#define NormalizationTransliterator U_ICU_ENTRY_POINT_RENAME(NormalizationTransliterator)
+#define Normalizer U_ICU_ENTRY_POINT_RENAME(Normalizer)
+#define Normalizer2 U_ICU_ENTRY_POINT_RENAME(Normalizer2)
+#define Normalizer2Factory U_ICU_ENTRY_POINT_RENAME(Normalizer2Factory)
+#define Normalizer2Impl U_ICU_ENTRY_POINT_RENAME(Normalizer2Impl)
+#define Normalizer2WithImpl U_ICU_ENTRY_POINT_RENAME(Normalizer2WithImpl)
+#define NullSubstitution U_ICU_ENTRY_POINT_RENAME(NullSubstitution)
+#define NullTransliterator U_ICU_ENTRY_POINT_RENAME(NullTransliterator)
+#define NumberFormat U_ICU_ENTRY_POINT_RENAME(NumberFormat)
+#define NumberFormatFactory U_ICU_ENTRY_POINT_RENAME(NumberFormatFactory)
+#define NumberingSystem U_ICU_ENTRY_POINT_RENAME(NumberingSystem)
+#define NumeratorSubstitution U_ICU_ENTRY_POINT_RENAME(NumeratorSubstitution)
+#define OlsonTimeZone U_ICU_ENTRY_POINT_RENAME(OlsonTimeZone)
+#define OpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(OpenTypeLayoutEngine)
+#define OpenTypeUtilities U_ICU_ENTRY_POINT_RENAME(OpenTypeUtilities)
+#define OrConstraint U_ICU_ENTRY_POINT_RENAME(OrConstraint)
+#define PCEBuffer U_ICU_ENTRY_POINT_RENAME(PCEBuffer)
+#define PairPositioningFormat1Subtable U_ICU_ENTRY_POINT_RENAME(PairPositioningFormat1Subtable)
+#define PairPositioningFormat2Subtable U_ICU_ENTRY_POINT_RENAME(PairPositioningFormat2Subtable)
+#define PairPositioningSubtable U_ICU_ENTRY_POINT_RENAME(PairPositioningSubtable)
+#define ParagraphLayout U_ICU_ENTRY_POINT_RENAME(ParagraphLayout)
+#define ParseData U_ICU_ENTRY_POINT_RENAME(ParseData)
+#define ParsePosition U_ICU_ENTRY_POINT_RENAME(ParsePosition)
+#define PatternMap U_ICU_ENTRY_POINT_RENAME(PatternMap)
+#define PatternMapIterator U_ICU_ENTRY_POINT_RENAME(PatternMapIterator)
+#define PersianCalendar U_ICU_ENTRY_POINT_RENAME(PersianCalendar)
+#define PluralFormat U_ICU_ENTRY_POINT_RENAME(PluralFormat)
+#define PluralKeywordEnumeration U_ICU_ENTRY_POINT_RENAME(PluralKeywordEnumeration)
+#define PluralRules U_ICU_ENTRY_POINT_RENAME(PluralRules)
+#define PropertyAliases U_ICU_ENTRY_POINT_RENAME(PropertyAliases)
+#define PtnElem U_ICU_ENTRY_POINT_RENAME(PtnElem)
+#define PtnSkeleton U_ICU_ENTRY_POINT_RENAME(PtnSkeleton)
+#define Quantifier U_ICU_ENTRY_POINT_RENAME(Quantifier)
+#define RBBIDataWrapper U_ICU_ENTRY_POINT_RENAME(RBBIDataWrapper)
+#define RBBINode U_ICU_ENTRY_POINT_RENAME(RBBINode)
+#define RBBIRuleBuilder U_ICU_ENTRY_POINT_RENAME(RBBIRuleBuilder)
+#define RBBIRuleScanner U_ICU_ENTRY_POINT_RENAME(RBBIRuleScanner)
+#define RBBISetBuilder U_ICU_ENTRY_POINT_RENAME(RBBISetBuilder)
+#define RBBIStateDescriptor U_ICU_ENTRY_POINT_RENAME(RBBIStateDescriptor)
+#define RBBISymbolTable U_ICU_ENTRY_POINT_RENAME(RBBISymbolTable)
+#define RBBISymbolTableEntry U_ICU_ENTRY_POINT_RENAME(RBBISymbolTableEntry)
+#define RBBITableBuilder U_ICU_ENTRY_POINT_RENAME(RBBITableBuilder)
+#define RCEBuffer U_ICU_ENTRY_POINT_RENAME(RCEBuffer)
+#define RangeDescriptor U_ICU_ENTRY_POINT_RENAME(RangeDescriptor)
+#define RegexCompile U_ICU_ENTRY_POINT_RENAME(RegexCompile)
+#define RegexMatcher U_ICU_ENTRY_POINT_RENAME(RegexMatcher)
+#define RegexPattern U_ICU_ENTRY_POINT_RENAME(RegexPattern)
+#define RegexStaticSets U_ICU_ENTRY_POINT_RENAME(RegexStaticSets)
+#define RegularExpression U_ICU_ENTRY_POINT_RENAME(RegularExpression)
+#define RelativeDateFormat U_ICU_ENTRY_POINT_RENAME(RelativeDateFormat)
+#define RemoveTransliterator U_ICU_ENTRY_POINT_RENAME(RemoveTransliterator)
+#define ReorderingBuffer U_ICU_ENTRY_POINT_RENAME(ReorderingBuffer)
+#define Replaceable U_ICU_ENTRY_POINT_RENAME(Replaceable)
+#define ReplaceableGlue U_ICU_ENTRY_POINT_RENAME(ReplaceableGlue)
+#define ResourceBundle U_ICU_ENTRY_POINT_RENAME(ResourceBundle)
+#define RiseSetCoordFunc U_ICU_ENTRY_POINT_RENAME(RiseSetCoordFunc)
+#define RuleBasedBreakIterator U_ICU_ENTRY_POINT_RENAME(RuleBasedBreakIterator)
+#define RuleBasedCollator U_ICU_ENTRY_POINT_RENAME(RuleBasedCollator)
+#define RuleBasedNumberFormat U_ICU_ENTRY_POINT_RENAME(RuleBasedNumberFormat)
+#define RuleBasedTimeZone U_ICU_ENTRY_POINT_RENAME(RuleBasedTimeZone)
+#define RuleBasedTransliterator U_ICU_ENTRY_POINT_RENAME(RuleBasedTransliterator)
+#define RuleChain U_ICU_ENTRY_POINT_RENAME(RuleChain)
+#define RuleCharacterIterator U_ICU_ENTRY_POINT_RENAME(RuleCharacterIterator)
+#define RuleHalf U_ICU_ENTRY_POINT_RENAME(RuleHalf)
+#define RuleParser U_ICU_ENTRY_POINT_RENAME(RuleParser)
+#define RunArray U_ICU_ENTRY_POINT_RENAME(RunArray)
+#define SPUString U_ICU_ENTRY_POINT_RENAME(SPUString)
+#define SPUStringPool U_ICU_ENTRY_POINT_RENAME(SPUStringPool)
+#define SafeZoneStringFormatPtr U_ICU_ENTRY_POINT_RENAME(SafeZoneStringFormatPtr)
+#define SameValueSubstitution U_ICU_ENTRY_POINT_RENAME(SameValueSubstitution)
+#define ScriptListTable U_ICU_ENTRY_POINT_RENAME(ScriptListTable)
+#define ScriptRunIterator U_ICU_ENTRY_POINT_RENAME(ScriptRunIterator)
+#define ScriptSet U_ICU_ENTRY_POINT_RENAME(ScriptSet)
+#define ScriptTable U_ICU_ENTRY_POINT_RENAME(ScriptTable)
+#define SearchIterator U_ICU_ENTRY_POINT_RENAME(SearchIterator)
+#define SegmentArrayProcessor U_ICU_ENTRY_POINT_RENAME(SegmentArrayProcessor)
+#define SegmentSingleProcessor U_ICU_ENTRY_POINT_RENAME(SegmentSingleProcessor)
+#define SelectFormat U_ICU_ENTRY_POINT_RENAME(SelectFormat)
+#define ServiceEnumeration U_ICU_ENTRY_POINT_RENAME(ServiceEnumeration)
+#define ServiceListener U_ICU_ENTRY_POINT_RENAME(ServiceListener)
+#define SimpleArrayProcessor U_ICU_ENTRY_POINT_RENAME(SimpleArrayProcessor)
+#define SimpleDateFormat U_ICU_ENTRY_POINT_RENAME(SimpleDateFormat)
+#define SimpleFactory U_ICU_ENTRY_POINT_RENAME(SimpleFactory)
+#define SimpleLocaleKeyFactory U_ICU_ENTRY_POINT_RENAME(SimpleLocaleKeyFactory)
+#define SimpleNumberFormatFactory U_ICU_ENTRY_POINT_RENAME(SimpleNumberFormatFactory)
+#define SimpleSingleton U_ICU_ENTRY_POINT_RENAME(SimpleSingleton)
+#define SimpleTimeZone U_ICU_ENTRY_POINT_RENAME(SimpleTimeZone)
+#define SinglePositioningFormat1Subtable U_ICU_ENTRY_POINT_RENAME(SinglePositioningFormat1Subtable)
+#define SinglePositioningFormat2Subtable U_ICU_ENTRY_POINT_RENAME(SinglePositioningFormat2Subtable)
+#define SinglePositioningSubtable U_ICU_ENTRY_POINT_RENAME(SinglePositioningSubtable)
+#define SingleSubstitutionFormat1Subtable U_ICU_ENTRY_POINT_RENAME(SingleSubstitutionFormat1Subtable)
+#define SingleSubstitutionFormat2Subtable U_ICU_ENTRY_POINT_RENAME(SingleSubstitutionFormat2Subtable)
+#define SingleSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(SingleSubstitutionSubtable)
+#define SingleTableProcessor U_ICU_ENTRY_POINT_RENAME(SingleTableProcessor)
+#define SpoofData U_ICU_ENTRY_POINT_RENAME(SpoofData)
+#define SpoofImpl U_ICU_ENTRY_POINT_RENAME(SpoofImpl)
+#define StateTableProcessor U_ICU_ENTRY_POINT_RENAME(StateTableProcessor)
+#define StringCharacterIterator U_ICU_ENTRY_POINT_RENAME(StringCharacterIterator)
+#define StringEnumeration U_ICU_ENTRY_POINT_RENAME(StringEnumeration)
+#define StringList U_ICU_ENTRY_POINT_RENAME(StringList)
+#define StringLocalizationInfo U_ICU_ENTRY_POINT_RENAME(StringLocalizationInfo)
+#define StringMatcher U_ICU_ENTRY_POINT_RENAME(StringMatcher)
+#define StringPair U_ICU_ENTRY_POINT_RENAME(StringPair)
+#define StringPiece U_ICU_ENTRY_POINT_RENAME(StringPiece)
+#define StringReplacer U_ICU_ENTRY_POINT_RENAME(StringReplacer)
+#define StringSearch U_ICU_ENTRY_POINT_RENAME(StringSearch)
+#define StringToCEsMap U_ICU_ENTRY_POINT_RENAME(StringToCEsMap)
+#define StyleRuns U_ICU_ENTRY_POINT_RENAME(StyleRuns)
+#define SubstitutionLookup U_ICU_ENTRY_POINT_RENAME(SubstitutionLookup)
+#define SubtableProcessor U_ICU_ENTRY_POINT_RENAME(SubtableProcessor)
+#define SunTimeAngleFunc U_ICU_ENTRY_POINT_RENAME(SunTimeAngleFunc)
+#define SymbolTable U_ICU_ENTRY_POINT_RENAME(SymbolTable)
+#define TZEnumeration U_ICU_ENTRY_POINT_RENAME(TZEnumeration)
+#define TaiwanCalendar U_ICU_ENTRY_POINT_RENAME(TaiwanCalendar)
+#define Target U_ICU_ENTRY_POINT_RENAME(Target)
+#define TernaryNode U_ICU_ENTRY_POINT_RENAME(TernaryNode)
+#define TextTrieMap U_ICU_ENTRY_POINT_RENAME(TextTrieMap)
+#define TextTrieMapSearchResultHandler U_ICU_ENTRY_POINT_RENAME(TextTrieMapSearchResultHandler)
+#define ThaiBreakEngine U_ICU_ENTRY_POINT_RENAME(ThaiBreakEngine)
+#define ThaiLayoutEngine U_ICU_ENTRY_POINT_RENAME(ThaiLayoutEngine)
+#define ThaiShaping U_ICU_ENTRY_POINT_RENAME(ThaiShaping)
+#define TibetanClassTable U_ICU_ENTRY_POINT_RENAME(TibetanClassTable)
+#define TibetanOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(TibetanOpenTypeLayoutEngine)
+#define TibetanReordering U_ICU_ENTRY_POINT_RENAME(TibetanReordering)
+#define TimeArrayTimeZoneRule U_ICU_ENTRY_POINT_RENAME(TimeArrayTimeZoneRule)
+#define TimeUnit U_ICU_ENTRY_POINT_RENAME(TimeUnit)
+#define TimeUnitAmount U_ICU_ENTRY_POINT_RENAME(TimeUnitAmount)
+#define TimeUnitFormat U_ICU_ENTRY_POINT_RENAME(TimeUnitFormat)
+#define TimeZone U_ICU_ENTRY_POINT_RENAME(TimeZone)
+#define TimeZoneRule U_ICU_ENTRY_POINT_RENAME(TimeZoneRule)
+#define TimeZoneTransition U_ICU_ENTRY_POINT_RENAME(TimeZoneTransition)
+#define TitlecaseTransliterator U_ICU_ENTRY_POINT_RENAME(TitlecaseTransliterator)
+#define TransliterationRule U_ICU_ENTRY_POINT_RENAME(TransliterationRule)
+#define TransliterationRuleData U_ICU_ENTRY_POINT_RENAME(TransliterationRuleData)
+#define TransliterationRuleSet U_ICU_ENTRY_POINT_RENAME(TransliterationRuleSet)
+#define Transliterator U_ICU_ENTRY_POINT_RENAME(Transliterator)
+#define TransliteratorAlias U_ICU_ENTRY_POINT_RENAME(TransliteratorAlias)
+#define TransliteratorEntry U_ICU_ENTRY_POINT_RENAME(TransliteratorEntry)
+#define TransliteratorIDParser U_ICU_ENTRY_POINT_RENAME(TransliteratorIDParser)
+#define TransliteratorParser U_ICU_ENTRY_POINT_RENAME(TransliteratorParser)
+#define TransliteratorRegistry U_ICU_ENTRY_POINT_RENAME(TransliteratorRegistry)
+#define TransliteratorSpec U_ICU_ENTRY_POINT_RENAME(TransliteratorSpec)
+#define TriStateSingleton U_ICU_ENTRY_POINT_RENAME(TriStateSingleton)
+#define TrieWordDictionary U_ICU_ENTRY_POINT_RENAME(TrieWordDictionary)
+#define TrimmedArrayProcessor U_ICU_ENTRY_POINT_RENAME(TrimmedArrayProcessor)
+#define UCharCharacterIterator U_ICU_ENTRY_POINT_RENAME(UCharCharacterIterator)
+#define UCollationPCE U_ICU_ENTRY_POINT_RENAME(UCollationPCE)
+#define UDataPathIterator U_ICU_ENTRY_POINT_RENAME(UDataPathIterator)
+#define ULocRuns U_ICU_ENTRY_POINT_RENAME(ULocRuns)
+#define UMemory U_ICU_ENTRY_POINT_RENAME(UMemory)
+#define UObject U_ICU_ENTRY_POINT_RENAME(UObject)
+#define UStack U_ICU_ENTRY_POINT_RENAME(UStack)
+#define UStringEnumeration U_ICU_ENTRY_POINT_RENAME(UStringEnumeration)
+#define UTS46 U_ICU_ENTRY_POINT_RENAME(UTS46)
+#define UTrie2Singleton U_ICU_ENTRY_POINT_RENAME(UTrie2Singleton)
+#define UVector U_ICU_ENTRY_POINT_RENAME(UVector)
+#define UVector32 U_ICU_ENTRY_POINT_RENAME(UVector32)
+#define UVector64 U_ICU_ENTRY_POINT_RENAME(UVector64)
+#define UnescapeTransliterator U_ICU_ENTRY_POINT_RENAME(UnescapeTransliterator)
+#define UnhandledEngine U_ICU_ENTRY_POINT_RENAME(UnhandledEngine)
+#define UnicodeArabicOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(UnicodeArabicOpenTypeLayoutEngine)
+#define UnicodeFilter U_ICU_ENTRY_POINT_RENAME(UnicodeFilter)
+#define UnicodeFunctor U_ICU_ENTRY_POINT_RENAME(UnicodeFunctor)
+#define UnicodeMatcher U_ICU_ENTRY_POINT_RENAME(UnicodeMatcher)
+#define UnicodeNameTransliterator U_ICU_ENTRY_POINT_RENAME(UnicodeNameTransliterator)
+#define UnicodeReplacer U_ICU_ENTRY_POINT_RENAME(UnicodeReplacer)
+#define UnicodeSet U_ICU_ENTRY_POINT_RENAME(UnicodeSet)
+#define UnicodeSetIterator U_ICU_ENTRY_POINT_RENAME(UnicodeSetIterator)
+#define UnicodeSetStringSpan U_ICU_ENTRY_POINT_RENAME(UnicodeSetStringSpan)
+#define UnicodeString U_ICU_ENTRY_POINT_RENAME(UnicodeString)
+#define UppercaseTransliterator U_ICU_ENTRY_POINT_RENAME(UppercaseTransliterator)
+#define VTZReader U_ICU_ENTRY_POINT_RENAME(VTZReader)
+#define VTZWriter U_ICU_ENTRY_POINT_RENAME(VTZWriter)
+#define VTimeZone U_ICU_ENTRY_POINT_RENAME(VTimeZone)
+#define ValueRecord U_ICU_ENTRY_POINT_RENAME(ValueRecord)
+#define ValueRuns U_ICU_ENTRY_POINT_RENAME(ValueRuns)
+#define ZSFCache U_ICU_ENTRY_POINT_RENAME(ZSFCache)
+#define ZSFCacheEntry U_ICU_ENTRY_POINT_RENAME(ZSFCacheEntry)
+#define ZSFStringPool U_ICU_ENTRY_POINT_RENAME(ZSFStringPool)
+#define ZSFStringPoolChunk U_ICU_ENTRY_POINT_RENAME(ZSFStringPoolChunk)
+#define ZoneMeta U_ICU_ENTRY_POINT_RENAME(ZoneMeta)
+#define ZoneStringFormat U_ICU_ENTRY_POINT_RENAME(ZoneStringFormat)
+#define ZoneStringInfo U_ICU_ENTRY_POINT_RENAME(ZoneStringInfo)
+#define ZoneStringSearchResultHandler U_ICU_ENTRY_POINT_RENAME(ZoneStringSearchResultHandler)
+#define ZoneStrings U_ICU_ENTRY_POINT_RENAME(ZoneStrings)
+#define collIterate U_ICU_ENTRY_POINT_RENAME(collIterate)
+#define locale_set_default_internal U_ICU_ENTRY_POINT_RENAME(locale_set_default_internal)
+#define util64_fromDouble U_ICU_ENTRY_POINT_RENAME(util64_fromDouble)
+#define util64_pow U_ICU_ENTRY_POINT_RENAME(util64_pow)
+#define util64_tou U_ICU_ENTRY_POINT_RENAME(util64_tou)
+
+#endif
+#endif
+
+#endif
+
+#endif
diff --git a/Source/WTF/icu/unicode/uscript.h b/Source/WTF/icu/unicode/uscript.h
new file mode 100644
index 0000000..ee21c74
--- /dev/null
+++ b/Source/WTF/icu/unicode/uscript.h
@@ -0,0 +1,326 @@
+/*
+ **********************************************************************
+ *   Copyright (C) 1997-2010, International Business Machines
+ *   Corporation and others.  All Rights Reserved.
+ **********************************************************************
+ *
+ * File USCRIPT.H
+ *
+ * Modification History:
+ *
+ *   Date        Name        Description
+ *   07/06/2001    Ram         Creation.
+ ******************************************************************************
+ */
+
+#ifndef USCRIPT_H
+#define USCRIPT_H
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C API: Unicode Script Information
+ */
+ 
+/**
+ * Constants for ISO 15924 script codes.
+ *
+ * Many of these script codes - those from Unicode's ScriptNames.txt -
+ * are character property values for Unicode's Script property.
+ * See UAX #24 Script Names (http://www.unicode.org/reports/tr24/).
+ *
+ * Starting with ICU 3.6, constants for most ISO 15924 script codes
+ * are included (currently excluding private-use codes Qaaa..Qabx).
+ * For scripts for which there are codes in ISO 15924 but which are not
+ * used in the Unicode Character Database (UCD), there are no Unicode characters
+ * associated with those scripts.
+ *
+ * For example, there are no characters that have a UCD script code of
+ * Hans or Hant. All Han ideographs have the Hani script code.
+ * The Hans and Hant script codes are used with CLDR data.
+ *
+ * ISO 15924 script codes are included for use with CLDR and similar.
+ *
+ * @stable ICU 2.2
+ */
+typedef enum UScriptCode {
+      USCRIPT_INVALID_CODE = -1,
+      USCRIPT_COMMON       =  0,  /* Zyyy */
+      USCRIPT_INHERITED    =  1,  /* Zinh */ /* "Code for inherited script", for non-spacing combining marks; also Qaai */
+      USCRIPT_ARABIC       =  2,  /* Arab */
+      USCRIPT_ARMENIAN     =  3,  /* Armn */
+      USCRIPT_BENGALI      =  4,  /* Beng */
+      USCRIPT_BOPOMOFO     =  5,  /* Bopo */
+      USCRIPT_CHEROKEE     =  6,  /* Cher */
+      USCRIPT_COPTIC       =  7,  /* Copt */
+      USCRIPT_CYRILLIC     =  8,  /* Cyrl */
+      USCRIPT_DESERET      =  9,  /* Dsrt */
+      USCRIPT_DEVANAGARI   = 10,  /* Deva */
+      USCRIPT_ETHIOPIC     = 11,  /* Ethi */
+      USCRIPT_GEORGIAN     = 12,  /* Geor */
+      USCRIPT_GOTHIC       = 13,  /* Goth */
+      USCRIPT_GREEK        = 14,  /* Grek */
+      USCRIPT_GUJARATI     = 15,  /* Gujr */
+      USCRIPT_GURMUKHI     = 16,  /* Guru */
+      USCRIPT_HAN          = 17,  /* Hani */
+      USCRIPT_HANGUL       = 18,  /* Hang */
+      USCRIPT_HEBREW       = 19,  /* Hebr */
+      USCRIPT_HIRAGANA     = 20,  /* Hira */
+      USCRIPT_KANNADA      = 21,  /* Knda */
+      USCRIPT_KATAKANA     = 22,  /* Kana */
+      USCRIPT_KHMER        = 23,  /* Khmr */
+      USCRIPT_LAO          = 24,  /* Laoo */
+      USCRIPT_LATIN        = 25,  /* Latn */
+      USCRIPT_MALAYALAM    = 26,  /* Mlym */
+      USCRIPT_MONGOLIAN    = 27,  /* Mong */
+      USCRIPT_MYANMAR      = 28,  /* Mymr */
+      USCRIPT_OGHAM        = 29,  /* Ogam */
+      USCRIPT_OLD_ITALIC   = 30,  /* Ital */
+      USCRIPT_ORIYA        = 31,  /* Orya */
+      USCRIPT_RUNIC        = 32,  /* Runr */
+      USCRIPT_SINHALA      = 33,  /* Sinh */
+      USCRIPT_SYRIAC       = 34,  /* Syrc */
+      USCRIPT_TAMIL        = 35,  /* Taml */
+      USCRIPT_TELUGU       = 36,  /* Telu */
+      USCRIPT_THAANA       = 37,  /* Thaa */
+      USCRIPT_THAI         = 38,  /* Thai */
+      USCRIPT_TIBETAN      = 39,  /* Tibt */
+      /** Canadian_Aboriginal script. @stable ICU 2.6 */
+      USCRIPT_CANADIAN_ABORIGINAL = 40,  /* Cans */
+      /** Canadian_Aboriginal script (alias). @stable ICU 2.2 */
+      USCRIPT_UCAS         = USCRIPT_CANADIAN_ABORIGINAL,
+      USCRIPT_YI           = 41,  /* Yiii */
+      USCRIPT_TAGALOG      = 42,  /* Tglg */
+      USCRIPT_HANUNOO      = 43,  /* Hano */
+      USCRIPT_BUHID        = 44,  /* Buhd */
+      USCRIPT_TAGBANWA     = 45,  /* Tagb */
+
+      /* New scripts in Unicode 4 @stable ICU 2.6 */
+      USCRIPT_BRAILLE      = 46,  /* Brai */
+      USCRIPT_CYPRIOT      = 47,  /* Cprt */
+      USCRIPT_LIMBU        = 48,  /* Limb */
+      USCRIPT_LINEAR_B     = 49,  /* Linb */
+      USCRIPT_OSMANYA      = 50,  /* Osma */
+      USCRIPT_SHAVIAN      = 51,  /* Shaw */
+      USCRIPT_TAI_LE       = 52,  /* Tale */
+      USCRIPT_UGARITIC     = 53,  /* Ugar */
+
+      /** New script code in Unicode 4.0.1 @stable ICU 3.0 */
+      USCRIPT_KATAKANA_OR_HIRAGANA = 54,/*Hrkt */
+
+      /* New scripts in Unicode 4.1 @stable ICU 3.4 */
+      USCRIPT_BUGINESE      = 55, /* Bugi */
+      USCRIPT_GLAGOLITIC    = 56, /* Glag */
+      USCRIPT_KHAROSHTHI    = 57, /* Khar */
+      USCRIPT_SYLOTI_NAGRI  = 58, /* Sylo */
+      USCRIPT_NEW_TAI_LUE   = 59, /* Talu */
+      USCRIPT_TIFINAGH      = 60, /* Tfng */
+      USCRIPT_OLD_PERSIAN   = 61, /* Xpeo */
+
+      /* New script codes from ISO 15924 @stable ICU 3.6 */
+      USCRIPT_BALINESE                      = 62, /* Bali */
+      USCRIPT_BATAK                         = 63, /* Batk */
+      USCRIPT_BLISSYMBOLS                   = 64, /* Blis */
+      USCRIPT_BRAHMI                        = 65, /* Brah */
+      USCRIPT_CHAM                          = 66, /* Cham */
+      USCRIPT_CIRTH                         = 67, /* Cirt */
+      USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC  = 68, /* Cyrs */
+      USCRIPT_DEMOTIC_EGYPTIAN              = 69, /* Egyd */
+      USCRIPT_HIERATIC_EGYPTIAN             = 70, /* Egyh */
+      USCRIPT_EGYPTIAN_HIEROGLYPHS          = 71, /* Egyp */
+      USCRIPT_KHUTSURI                      = 72, /* Geok */
+      USCRIPT_SIMPLIFIED_HAN                = 73, /* Hans */
+      USCRIPT_TRADITIONAL_HAN               = 74, /* Hant */
+      USCRIPT_PAHAWH_HMONG                  = 75, /* Hmng */
+      USCRIPT_OLD_HUNGARIAN                 = 76, /* Hung */
+      USCRIPT_HARAPPAN_INDUS                = 77, /* Inds */
+      USCRIPT_JAVANESE                      = 78, /* Java */
+      USCRIPT_KAYAH_LI                      = 79, /* Kali */
+      USCRIPT_LATIN_FRAKTUR                 = 80, /* Latf */
+      USCRIPT_LATIN_GAELIC                  = 81, /* Latg */
+      USCRIPT_LEPCHA                        = 82, /* Lepc */
+      USCRIPT_LINEAR_A                      = 83, /* Lina */
+      /** @stable ICU 4.6 */
+      USCRIPT_MANDAIC                       = 84, /* Mand */
+      /** @stable ICU 3.6 */
+      USCRIPT_MANDAEAN                      = USCRIPT_MANDAIC,
+      USCRIPT_MAYAN_HIEROGLYPHS             = 85, /* Maya */
+      /** @stable ICU 4.6 */
+      USCRIPT_MEROITIC_HIEROGLYPHS          = 86, /* Mero */
+      /** @stable ICU 3.6 */
+      USCRIPT_MEROITIC                      = USCRIPT_MEROITIC_HIEROGLYPHS,
+      USCRIPT_NKO                           = 87, /* Nkoo */
+      USCRIPT_ORKHON                        = 88, /* Orkh */
+      USCRIPT_OLD_PERMIC                    = 89, /* Perm */
+      USCRIPT_PHAGS_PA                      = 90, /* Phag */
+      USCRIPT_PHOENICIAN                    = 91, /* Phnx */
+      USCRIPT_PHONETIC_POLLARD              = 92, /* Plrd */
+      USCRIPT_RONGORONGO                    = 93, /* Roro */
+      USCRIPT_SARATI                        = 94, /* Sara */
+      USCRIPT_ESTRANGELO_SYRIAC             = 95, /* Syre */
+      USCRIPT_WESTERN_SYRIAC                = 96, /* Syrj */
+      USCRIPT_EASTERN_SYRIAC                = 97, /* Syrn */
+      USCRIPT_TENGWAR                       = 98, /* Teng */
+      USCRIPT_VAI                           = 99, /* Vaii */
+      USCRIPT_VISIBLE_SPEECH                = 100,/* Visp */
+      USCRIPT_CUNEIFORM                     = 101,/* Xsux */
+      USCRIPT_UNWRITTEN_LANGUAGES           = 102,/* Zxxx */
+      USCRIPT_UNKNOWN                       = 103,/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */
+
+      /* New script codes from ISO 15924 @stable ICU 3.8 */
+      USCRIPT_CARIAN                        = 104,/* Cari */
+      USCRIPT_JAPANESE                      = 105,/* Jpan */
+      USCRIPT_LANNA                         = 106,/* Lana */
+      USCRIPT_LYCIAN                        = 107,/* Lyci */
+      USCRIPT_LYDIAN                        = 108,/* Lydi */
+      USCRIPT_OL_CHIKI                      = 109,/* Olck */
+      USCRIPT_REJANG                        = 110,/* Rjng */
+      USCRIPT_SAURASHTRA                    = 111,/* Saur */
+      USCRIPT_SIGN_WRITING                  = 112,/* Sgnw */
+      USCRIPT_SUNDANESE                     = 113,/* Sund */
+      USCRIPT_MOON                          = 114,/* Moon */
+      USCRIPT_MEITEI_MAYEK                  = 115,/* Mtei */
+
+      /* New script codes from ISO 15924 @stable ICU 4.0 */
+      USCRIPT_IMPERIAL_ARAMAIC              = 116,/* Armi */
+      USCRIPT_AVESTAN                       = 117,/* Avst */
+      USCRIPT_CHAKMA                        = 118,/* Cakm */
+      USCRIPT_KOREAN                        = 119,/* Kore */
+      USCRIPT_KAITHI                        = 120,/* Kthi */
+      USCRIPT_MANICHAEAN                    = 121,/* Mani */
+      USCRIPT_INSCRIPTIONAL_PAHLAVI         = 122,/* Phli */
+      USCRIPT_PSALTER_PAHLAVI               = 123,/* Phlp */
+      USCRIPT_BOOK_PAHLAVI                  = 124,/* Phlv */
+      USCRIPT_INSCRIPTIONAL_PARTHIAN        = 125,/* Prti */
+      USCRIPT_SAMARITAN                     = 126,/* Samr */
+      USCRIPT_TAI_VIET                      = 127,/* Tavt */
+      USCRIPT_MATHEMATICAL_NOTATION         = 128,/* Zmth */
+      USCRIPT_SYMBOLS                       = 129,/* Zsym */
+
+      /* New script codes from ISO 15924 @stable ICU 4.4 */
+      USCRIPT_BAMUM                         = 130,/* Bamu */
+      USCRIPT_LISU                          = 131,/* Lisu */
+      USCRIPT_NAKHI_GEBA                    = 132,/* Nkgb */
+      USCRIPT_OLD_SOUTH_ARABIAN             = 133,/* Sarb */
+
+      /* New script codes from ISO 15924 @stable ICU 4.6 */
+      USCRIPT_BASSA_VAH                     = 134,/* Bass */
+      USCRIPT_DUPLOYAN_SHORTAND             = 135,/* Dupl */
+      USCRIPT_ELBASAN                       = 136,/* Elba */
+      USCRIPT_GRANTHA                       = 137,/* Gran */
+      USCRIPT_KPELLE                        = 138,/* Kpel */
+      USCRIPT_LOMA                          = 139,/* Loma */
+      USCRIPT_MENDE                         = 140,/* Mend */
+      USCRIPT_MEROITIC_CURSIVE              = 141,/* Merc */
+      USCRIPT_OLD_NORTH_ARABIAN             = 142,/* Narb */
+      USCRIPT_NABATAEAN                     = 143,/* Nbat */
+      USCRIPT_PALMYRENE                     = 144,/* Palm */
+      USCRIPT_SINDHI                        = 145,/* Sind */
+      USCRIPT_WARANG_CITI                   = 146,/* Wara */
+
+      /* Private use codes from Qaaa - Qabx are not supported */
+      USCRIPT_CODE_LIMIT    = 147
+} UScriptCode;
+
+/**
+ * Gets script codes associated with the given locale or ISO 15924 abbreviation or name. 
+ * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym".
+ * Fills in USCRIPT_LATIN given "en" OR "en_US" 
+ * If required capacity is greater than capacity of the destination buffer then the error code
+ * is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned
+ *
+ * <p>Note: To search by short or long script alias only, use
+ * u_getPropertyValueEnum(UCHAR_SCRIPT, alias) instead.  This does
+ * a fast lookup with no access of the locale data.
+ * @param nameOrAbbrOrLocale name of the script, as given in
+ * PropertyValueAliases.txt, or ISO 15924 code or locale
+ * @param fillIn the UScriptCode buffer to fill in the script code
+ * @param capacity the capacity (size) fo UScriptCode buffer passed in.
+ * @param err the error status code.
+ * @return The number of script codes filled in the buffer passed in 
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t  U_EXPORT2 
+uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err);
+
+/**
+ * Gets a script name associated with the given script code. 
+ * Returns  "Malayam" given USCRIPT_MALAYALAM
+ * @param scriptCode UScriptCode enum
+ * @return script long name as given in
+ * PropertyValueAliases.txt, or NULL if scriptCode is invalid
+ * @stable ICU 2.4
+ */
+U_STABLE const char*  U_EXPORT2 
+uscript_getName(UScriptCode scriptCode);
+
+/**
+ * Gets a script name associated with the given script code. 
+ * Returns  "Mlym" given USCRIPT_MALAYALAM
+ * @param scriptCode UScriptCode enum
+ * @return script abbreviated name as given in
+ * PropertyValueAliases.txt, or NULL if scriptCode is invalid
+ * @stable ICU 2.4
+ */
+U_STABLE const char*  U_EXPORT2 
+uscript_getShortName(UScriptCode scriptCode);
+
+/**
+ * Gets the script code associated with the given codepoint.
+ * Returns USCRIPT_MALAYALAM given 0x0D02 
+ * @param codepoint UChar32 codepoint
+ * @param err the error status code.
+ * @return The UScriptCode, or 0 if codepoint is invalid 
+ * @stable ICU 2.4
+ */
+U_STABLE UScriptCode  U_EXPORT2 
+uscript_getScript(UChar32 codepoint, UErrorCode *err);
+
+/**
+ * Is code point c used in script sc?
+ * That is, does code point c have the Script property value sc,
+ * or do code point c's Script_Extensions include script code sc?
+ *
+ * Some characters are commonly used in multiple scripts.
+ * For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
+ *
+ * The Script_Extensions property is provisional. It may be modified or removed
+ * in future versions of the Unicode Standard, and thus in ICU.
+ * @param c code point
+ * @param sc script code
+ * @return TRUE if Script(c)==sc or sc is in Script_Extensions(c)
+ * @draft ICU 4.6
+ */
+U_DRAFT UBool U_EXPORT2
+uscript_hasScript(UChar32 c, UScriptCode sc);
+
+/**
+ * Writes code point c's Script_Extensions as a list of UScriptCode values
+ * to the output scripts array.
+ *
+ * Some characters are commonly used in multiple scripts.
+ * For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
+ *
+ * If there are more than capacity script codes to be written, then
+ * U_BUFFER_OVERFLOW_ERROR is set and the number of Script_Extensions is returned.
+ * (Usual ICU buffer handling behavior.)
+ *
+ * The Script_Extensions property is provisional. It may be modified or removed
+ * in future versions of the Unicode Standard, and thus in ICU.
+ * @param c code point
+ * @param scripts output script code array
+ * @param capacity capacity of the scripts array
+ * @param errorCode Standard ICU error code. Its input value must
+ *                  pass the U_SUCCESS() test, or else the function returns
+ *                  immediately. Check for U_FAILURE() on output or use with
+ *                  function chaining. (See User Guide for details.)
+ * @return number of script codes in c's Script_Extensions,
+ *         written to scripts unless U_BUFFER_OVERFLOW_ERROR indicates insufficient capacity
+ * @draft ICU 4.6
+ */
+U_DRAFT int32_t U_EXPORT2
+uscript_getScriptExtensions(UChar32 c,
+                            UScriptCode *scripts, int32_t capacity,
+                            UErrorCode *pErrorCode);
+
+#endif
diff --git a/Source/WTF/icu/unicode/uset.h b/Source/WTF/icu/unicode/uset.h
new file mode 100644
index 0000000..77ab063
--- /dev/null
+++ b/Source/WTF/icu/unicode/uset.h
@@ -0,0 +1,1120 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2002-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  uset.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 2002mar07
+*   created by: Markus W. Scherer
+*
+*   C version of UnicodeSet.
+*/
+
+
+/**
+ * \file
+ * \brief C API: Unicode Set
+ *
+ * <p>This is a C wrapper around the C++ UnicodeSet class.</p>
+ */
+
+#ifndef __USET_H__
+#define __USET_H__
+
+#include "unicode/utypes.h"
+#include "unicode/uchar.h"
+#include "unicode/localpointer.h"
+
+#ifndef UCNV_H
+struct USet;
+/**
+ * A UnicodeSet.  Use the uset_* API to manipulate.  Create with
+ * uset_open*, and destroy with uset_close.
+ * @stable ICU 2.4
+ */
+typedef struct USet USet;
+#endif
+
+/**
+ * Bitmask values to be passed to uset_openPatternOptions() or
+ * uset_applyPattern() taking an option parameter.
+ * @stable ICU 2.4
+ */
+enum {
+    /**
+     * Ignore white space within patterns unless quoted or escaped.
+     * @stable ICU 2.4
+     */
+    USET_IGNORE_SPACE = 1,  
+
+    /**
+     * Enable case insensitive matching.  E.g., "[ab]" with this flag
+     * will match 'a', 'A', 'b', and 'B'.  "[^ab]" with this flag will
+     * match all except 'a', 'A', 'b', and 'B'. This performs a full
+     * closure over case mappings, e.g. U+017F for s.
+     *
+     * The resulting set is a superset of the input for the code points but
+     * not for the strings.
+     * It performs a case mapping closure of the code points and adds
+     * full case folding strings for the code points, and reduces strings of
+     * the original set to their full case folding equivalents.
+     *
+     * This is designed for case-insensitive matches, for example
+     * in regular expressions. The full code point case closure allows checking of
+     * an input character directly against the closure set.
+     * Strings are matched by comparing the case-folded form from the closure
+     * set with an incremental case folding of the string in question.
+     *
+     * The closure set will also contain single code points if the original
+     * set contained case-equivalent strings (like U+00DF for "ss" or "Ss" etc.).
+     * This is not necessary (that is, redundant) for the above matching method
+     * but results in the same closure sets regardless of whether the original
+     * set contained the code point or a string.
+     *
+     * @stable ICU 2.4
+     */
+    USET_CASE_INSENSITIVE = 2,  
+
+    /**
+     * Enable case insensitive matching.  E.g., "[ab]" with this flag
+     * will match 'a', 'A', 'b', and 'B'.  "[^ab]" with this flag will
+     * match all except 'a', 'A', 'b', and 'B'. This adds the lower-,
+     * title-, and uppercase mappings as well as the case folding
+     * of each existing element in the set.
+     * @stable ICU 3.2
+     */
+    USET_ADD_CASE_MAPPINGS = 4,
+    
+    /**
+     * Enough for any single-code point set
+     * @internal
+     */
+    USET_SERIALIZED_STATIC_ARRAY_CAPACITY=8
+};
+
+/**
+ * Argument values for whether span() and similar functions continue while
+ * the current character is contained vs. not contained in the set.
+ *
+ * The functionality is straightforward for sets with only single code points,
+ * without strings (which is the common case):
+ * - USET_SPAN_CONTAINED and USET_SPAN_SIMPLE
+ *   work the same.
+ * - span() and spanBack() partition any string the same way when
+ *   alternating between span(USET_SPAN_NOT_CONTAINED) and
+ *   span(either "contained" condition).
+ * - Using a complemented (inverted) set and the opposite span conditions
+ *   yields the same results.
+ *
+ * When a set contains multi-code point strings, then these statements may not
+ * be true, depending on the strings in the set (for example, whether they
+ * overlap with each other) and the string that is processed.
+ * For a set with strings:
+ * - The complement of the set contains the opposite set of code points,
+ *   but the same set of strings.
+ *   Therefore, complementing both the set and the span conditions
+ *   may yield different results.
+ * - When starting spans at different positions in a string
+ *   (span(s, ...) vs. span(s+1, ...)) the ends of the spans may be different
+ *   because a set string may start before the later position.
+ * - span(USET_SPAN_SIMPLE) may be shorter than
+ *   span(USET_SPAN_CONTAINED) because it will not recursively try
+ *   all possible paths.
+ *   For example, with a set which contains the three strings "xy", "xya" and "ax",
+ *   span("xyax", USET_SPAN_CONTAINED) will return 4 but
+ *   span("xyax", USET_SPAN_SIMPLE) will return 3.
+ *   span(USET_SPAN_SIMPLE) will never be longer than
+ *   span(USET_SPAN_CONTAINED).
+ * - With either "contained" condition, span() and spanBack() may partition
+ *   a string in different ways.
+ *   For example, with a set which contains the two strings "ab" and "ba",
+ *   and when processing the string "aba",
+ *   span() will yield contained/not-contained boundaries of { 0, 2, 3 }
+ *   while spanBack() will yield boundaries of { 0, 1, 3 }.
+ *
+ * Note: If it is important to get the same boundaries whether iterating forward
+ * or backward through a string, then either only span() should be used and
+ * the boundaries cached for backward operation, or an ICU BreakIterator
+ * could be used.
+ *
+ * Note: Unpaired surrogates are treated like surrogate code points.
+ * Similarly, set strings match only on code point boundaries,
+ * never in the middle of a surrogate pair.
+ * Illegal UTF-8 sequences are treated like U+FFFD.
+ * When processing UTF-8 strings, malformed set strings
+ * (strings with unpaired surrogates which cannot be converted to UTF-8)
+ * are ignored.
+ *
+ * @stable ICU 3.8
+ */
+typedef enum USetSpanCondition {
+    /**
+     * Continue a span() while there is no set element at the current position.
+     * Stops before the first set element (character or string).
+     * (For code points only, this is like while contains(current)==FALSE).
+     *
+     * When span() returns, the substring between where it started and the position
+     * it returned consists only of characters that are not in the set,
+     * and none of its strings overlap with the span.
+     *
+     * @stable ICU 3.8
+     */
+    USET_SPAN_NOT_CONTAINED = 0,
+    /**
+     * Continue a span() while there is a set element at the current position.
+     * (For characters only, this is like while contains(current)==TRUE).
+     *
+     * When span() returns, the substring between where it started and the position
+     * it returned consists only of set elements (characters or strings) that are in the set.
+     *
+     * If a set contains strings, then the span will be the longest substring
+     * matching any of the possible concatenations of set elements (characters or strings).
+     * (There must be a single, non-overlapping concatenation of characters or strings.)
+     * This is equivalent to a POSIX regular expression for (OR of each set element)*.
+     *
+     * @stable ICU 3.8
+     */
+    USET_SPAN_CONTAINED = 1,
+    /**
+     * Continue a span() while there is a set element at the current position.
+     * (For characters only, this is like while contains(current)==TRUE).
+     *
+     * When span() returns, the substring between where it started and the position
+     * it returned consists only of set elements (characters or strings) that are in the set.
+     *
+     * If a set only contains single characters, then this is the same
+     * as USET_SPAN_CONTAINED.
+     *
+     * If a set contains strings, then the span will be the longest substring
+     * with a match at each position with the longest single set element (character or string).
+     *
+     * Use this span condition together with other longest-match algorithms,
+     * such as ICU converters (ucnv_getUnicodeSet()).
+     *
+     * @stable ICU 3.8
+     */
+    USET_SPAN_SIMPLE = 2,
+    /**
+     * One more than the last span condition.
+     * @stable ICU 3.8
+     */
+    USET_SPAN_CONDITION_COUNT
+} USetSpanCondition;
+
+/**
+ * A serialized form of a Unicode set.  Limited manipulations are
+ * possible directly on a serialized set.  See below.
+ * @stable ICU 2.4
+ */
+typedef struct USerializedSet {
+    /**
+     * The serialized Unicode Set.
+     * @stable ICU 2.4
+     */
+    const uint16_t *array;
+    /**
+     * The length of the array that contains BMP characters.
+     * @stable ICU 2.4
+     */
+    int32_t bmpLength;
+    /**
+     * The total length of the array.
+     * @stable ICU 2.4
+     */
+    int32_t length;
+    /**
+     * A small buffer for the array to reduce memory allocations.
+     * @stable ICU 2.4
+     */
+    uint16_t staticArray[USET_SERIALIZED_STATIC_ARRAY_CAPACITY];
+} USerializedSet;
+
+/*********************************************************************
+ * USet API
+ *********************************************************************/
+
+/**
+ * Create an empty USet object.
+ * Equivalent to uset_open(1, 0).
+ * @return a newly created USet.  The caller must call uset_close() on
+ * it when done.
+ * @stable ICU 4.2
+ */
+U_STABLE USet* U_EXPORT2
+uset_openEmpty();
+
+/**
+ * Creates a USet object that contains the range of characters
+ * start..end, inclusive.  If <code>start > end</code> 
+ * then an empty set is created (same as using uset_openEmpty()).
+ * @param start first character of the range, inclusive
+ * @param end last character of the range, inclusive
+ * @return a newly created USet.  The caller must call uset_close() on
+ * it when done.
+ * @stable ICU 2.4
+ */
+U_STABLE USet* U_EXPORT2
+uset_open(UChar32 start, UChar32 end);
+
+/**
+ * Creates a set from the given pattern.  See the UnicodeSet class
+ * description for the syntax of the pattern language.
+ * @param pattern a string specifying what characters are in the set
+ * @param patternLength the length of the pattern, or -1 if null
+ * terminated
+ * @param ec the error code
+ * @stable ICU 2.4
+ */
+U_STABLE USet* U_EXPORT2
+uset_openPattern(const UChar* pattern, int32_t patternLength,
+                 UErrorCode* ec);
+
+/**
+ * Creates a set from the given pattern.  See the UnicodeSet class
+ * description for the syntax of the pattern language.
+ * @param pattern a string specifying what characters are in the set
+ * @param patternLength the length of the pattern, or -1 if null
+ * terminated
+ * @param options bitmask for options to apply to the pattern.
+ * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
+ * @param ec the error code
+ * @stable ICU 2.4
+ */
+U_STABLE USet* U_EXPORT2
+uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
+                 uint32_t options,
+                 UErrorCode* ec);
+
+/**
+ * Disposes of the storage used by a USet object.  This function should
+ * be called exactly once for objects returned by uset_open().
+ * @param set the object to dispose of
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_close(USet* set);
+
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUSetPointer
+ * "Smart pointer" class, closes a USet via uset_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 4.4
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close);
+
+U_NAMESPACE_END
+
+#endif
+
+/**
+ * Returns a copy of this object.
+ * If this set is frozen, then the clone will be frozen as well.
+ * Use uset_cloneAsThawed() for a mutable clone of a frozen set.
+ * @param set the original set
+ * @return the newly allocated copy of the set
+ * @see uset_cloneAsThawed
+ * @stable ICU 3.8
+ */
+U_STABLE USet * U_EXPORT2
+uset_clone(const USet *set);
+
+/**
+ * Determines whether the set has been frozen (made immutable) or not.
+ * See the ICU4J Freezable interface for details.
+ * @param set the set
+ * @return TRUE/FALSE for whether the set has been frozen
+ * @see uset_freeze
+ * @see uset_cloneAsThawed
+ * @stable ICU 3.8
+ */
+U_STABLE UBool U_EXPORT2
+uset_isFrozen(const USet *set);
+
+/**
+ * Freeze the set (make it immutable).
+ * Once frozen, it cannot be unfrozen and is therefore thread-safe
+ * until it is deleted.
+ * See the ICU4J Freezable interface for details.
+ * Freezing the set may also make some operations faster, for example
+ * uset_contains() and uset_span().
+ * A frozen set will not be modified. (It remains frozen.)
+ * @param set the set
+ * @return the same set, now frozen
+ * @see uset_isFrozen
+ * @see uset_cloneAsThawed
+ * @stable ICU 3.8
+ */
+U_STABLE void U_EXPORT2
+uset_freeze(USet *set);
+
+/**
+ * Clone the set and make the clone mutable.
+ * See the ICU4J Freezable interface for details.
+ * @param set the set
+ * @return the mutable clone
+ * @see uset_freeze
+ * @see uset_isFrozen
+ * @see uset_clone
+ * @stable ICU 3.8
+ */
+U_STABLE USet * U_EXPORT2
+uset_cloneAsThawed(const USet *set);
+
+/**
+ * Causes the USet object to represent the range <code>start - end</code>.
+ * If <code>start > end</code> then this USet is set to an empty range.
+ * A frozen set will not be modified.
+ * @param set the object to set to the given range
+ * @param start first character in the set, inclusive
+ * @param end last character in the set, inclusive
+ * @stable ICU 3.2
+ */
+U_STABLE void U_EXPORT2
+uset_set(USet* set,
+         UChar32 start, UChar32 end);
+
+/**
+ * Modifies the set to represent the set specified by the given
+ * pattern. See the UnicodeSet class description for the syntax of 
+ * the pattern language. See also the User Guide chapter about UnicodeSet.
+ * <em>Empties the set passed before applying the pattern.</em>
+ * A frozen set will not be modified.
+ * @param set               The set to which the pattern is to be applied. 
+ * @param pattern           A pointer to UChar string specifying what characters are in the set.
+ *                          The character at pattern[0] must be a '['.
+ * @param patternLength     The length of the UChar string. -1 if NUL terminated.
+ * @param options           A bitmask for options to apply to the pattern.
+ *                          Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
+ * @param status            Returns an error if the pattern cannot be parsed.
+ * @return                  Upon successful parse, the value is either
+ *                          the index of the character after the closing ']' 
+ *                          of the parsed pattern.
+ *                          If the status code indicates failure, then the return value 
+ *                          is the index of the error in the source.
+ *
+ * @stable ICU 2.8
+ */
+U_STABLE int32_t U_EXPORT2 
+uset_applyPattern(USet *set,
+                  const UChar *pattern, int32_t patternLength,
+                  uint32_t options,
+                  UErrorCode *status);
+
+/**
+ * Modifies the set to contain those code points which have the given value
+ * for the given binary or enumerated property, as returned by
+ * u_getIntPropertyValue.  Prior contents of this set are lost.
+ * A frozen set will not be modified.
+ *
+ * @param set the object to contain the code points defined by the property
+ *
+ * @param prop a property in the range UCHAR_BIN_START..UCHAR_BIN_LIMIT-1
+ * or UCHAR_INT_START..UCHAR_INT_LIMIT-1
+ * or UCHAR_MASK_START..UCHAR_MASK_LIMIT-1.
+ *
+ * @param value a value in the range u_getIntPropertyMinValue(prop)..
+ * u_getIntPropertyMaxValue(prop), with one exception.  If prop is
+ * UCHAR_GENERAL_CATEGORY_MASK, then value should not be a UCharCategory, but
+ * rather a mask value produced by U_GET_GC_MASK().  This allows grouped
+ * categories such as [:L:] to be represented.
+ *
+ * @param ec error code input/output parameter
+ *
+ * @stable ICU 3.2
+ */
+U_STABLE void U_EXPORT2
+uset_applyIntPropertyValue(USet* set,
+                           UProperty prop, int32_t value, UErrorCode* ec);
+
+/**
+ * Modifies the set to contain those code points which have the
+ * given value for the given property.  Prior contents of this
+ * set are lost.
+ * A frozen set will not be modified.
+ *
+ * @param set the object to contain the code points defined by the given
+ * property and value alias
+ *
+ * @param prop a string specifying a property alias, either short or long.
+ * The name is matched loosely.  See PropertyAliases.txt for names and a
+ * description of loose matching.  If the value string is empty, then this
+ * string is interpreted as either a General_Category value alias, a Script
+ * value alias, a binary property alias, or a special ID.  Special IDs are
+ * matched loosely and correspond to the following sets:
+ *
+ * "ANY" = [\\u0000-\\U0010FFFF],
+ * "ASCII" = [\\u0000-\\u007F],
+ * "Assigned" = [:^Cn:].
+ *
+ * @param propLength the length of the prop, or -1 if NULL
+ *
+ * @param value a string specifying a value alias, either short or long.
+ * The name is matched loosely.  See PropertyValueAliases.txt for names
+ * and a description of loose matching.  In addition to aliases listed,
+ * numeric values and canonical combining classes may be expressed
+ * numerically, e.g., ("nv", "0.5") or ("ccc", "220").  The value string
+ * may also be empty.
+ *
+ * @param valueLength the length of the value, or -1 if NULL
+ *
+ * @param ec error code input/output parameter
+ *
+ * @stable ICU 3.2
+ */
+U_STABLE void U_EXPORT2
+uset_applyPropertyAlias(USet* set,
+                        const UChar *prop, int32_t propLength,
+                        const UChar *value, int32_t valueLength,
+                        UErrorCode* ec);
+
+/**
+ * Return true if the given position, in the given pattern, appears
+ * to be the start of a UnicodeSet pattern.
+ *
+ * @param pattern a string specifying the pattern
+ * @param patternLength the length of the pattern, or -1 if NULL
+ * @param pos the given position
+ * @stable ICU 3.2
+ */
+U_STABLE UBool U_EXPORT2
+uset_resemblesPattern(const UChar *pattern, int32_t patternLength,
+                      int32_t pos);
+
+/**
+ * Returns a string representation of this set.  If the result of
+ * calling this function is passed to a uset_openPattern(), it
+ * will produce another set that is equal to this one.
+ * @param set the set
+ * @param result the string to receive the rules, may be NULL
+ * @param resultCapacity the capacity of result, may be 0 if result is NULL
+ * @param escapeUnprintable if TRUE then convert unprintable
+ * character to their hex escape representations, \\uxxxx or
+ * \\Uxxxxxxxx.  Unprintable characters are those other than
+ * U+000A, U+0020..U+007E.
+ * @param ec error code.
+ * @return length of string, possibly larger than resultCapacity
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_toPattern(const USet* set,
+               UChar* result, int32_t resultCapacity,
+               UBool escapeUnprintable,
+               UErrorCode* ec);
+
+/**
+ * Adds the given character to the given USet.  After this call,
+ * uset_contains(set, c) will return TRUE.
+ * A frozen set will not be modified.
+ * @param set the object to which to add the character
+ * @param c the character to add
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_add(USet* set, UChar32 c);
+
+/**
+ * Adds all of the elements in the specified set to this set if
+ * they're not already present.  This operation effectively
+ * modifies this set so that its value is the <i>union</i> of the two
+ * sets.  The behavior of this operation is unspecified if the specified
+ * collection is modified while the operation is in progress.
+ * A frozen set will not be modified.
+ *
+ * @param set the object to which to add the set
+ * @param additionalSet the source set whose elements are to be added to this set.
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+uset_addAll(USet* set, const USet *additionalSet);
+
+/**
+ * Adds the given range of characters to the given USet.  After this call,
+ * uset_contains(set, start, end) will return TRUE.
+ * A frozen set will not be modified.
+ * @param set the object to which to add the character
+ * @param start the first character of the range to add, inclusive
+ * @param end the last character of the range to add, inclusive
+ * @stable ICU 2.2
+ */
+U_STABLE void U_EXPORT2
+uset_addRange(USet* set, UChar32 start, UChar32 end);
+
+/**
+ * Adds the given string to the given USet.  After this call,
+ * uset_containsString(set, str, strLen) will return TRUE.
+ * A frozen set will not be modified.
+ * @param set the object to which to add the character
+ * @param str the string to add
+ * @param strLen the length of the string or -1 if null terminated.
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_addString(USet* set, const UChar* str, int32_t strLen);
+
+/**
+ * Adds each of the characters in this string to the set. Thus "ch" => {"c", "h"}
+ * If this set already any particular character, it has no effect on that character.
+ * A frozen set will not be modified.
+ * @param set the object to which to add the character
+ * @param str the source string
+ * @param strLen the length of the string or -1 if null terminated.
+ * @stable ICU 3.4
+ */
+U_STABLE void U_EXPORT2
+uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen);
+
+/**
+ * Removes the given character from the given USet.  After this call,
+ * uset_contains(set, c) will return FALSE.
+ * A frozen set will not be modified.
+ * @param set the object from which to remove the character
+ * @param c the character to remove
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_remove(USet* set, UChar32 c);
+
+/**
+ * Removes the given range of characters from the given USet.  After this call,
+ * uset_contains(set, start, end) will return FALSE.
+ * A frozen set will not be modified.
+ * @param set the object to which to add the character
+ * @param start the first character of the range to remove, inclusive
+ * @param end the last character of the range to remove, inclusive
+ * @stable ICU 2.2
+ */
+U_STABLE void U_EXPORT2
+uset_removeRange(USet* set, UChar32 start, UChar32 end);
+
+/**
+ * Removes the given string to the given USet.  After this call,
+ * uset_containsString(set, str, strLen) will return FALSE.
+ * A frozen set will not be modified.
+ * @param set the object to which to add the character
+ * @param str the string to remove
+ * @param strLen the length of the string or -1 if null terminated.
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_removeString(USet* set, const UChar* str, int32_t strLen);
+
+/**
+ * Removes from this set all of its elements that are contained in the
+ * specified set.  This operation effectively modifies this
+ * set so that its value is the <i>asymmetric set difference</i> of
+ * the two sets.
+ * A frozen set will not be modified.
+ * @param set the object from which the elements are to be removed
+ * @param removeSet the object that defines which elements will be
+ * removed from this set
+ * @stable ICU 3.2
+ */
+U_STABLE void U_EXPORT2
+uset_removeAll(USet* set, const USet* removeSet);
+
+/**
+ * Retain only the elements in this set that are contained in the
+ * specified range.  If <code>start > end</code> then an empty range is
+ * retained, leaving the set empty.  This is equivalent to
+ * a boolean logic AND, or a set INTERSECTION.
+ * A frozen set will not be modified.
+ *
+ * @param set the object for which to retain only the specified range
+ * @param start first character, inclusive, of range to be retained
+ * to this set.
+ * @param end last character, inclusive, of range to be retained
+ * to this set.
+ * @stable ICU 3.2
+ */
+U_STABLE void U_EXPORT2
+uset_retain(USet* set, UChar32 start, UChar32 end);
+
+/**
+ * Retains only the elements in this set that are contained in the
+ * specified set.  In other words, removes from this set all of
+ * its elements that are not contained in the specified set.  This
+ * operation effectively modifies this set so that its value is
+ * the <i>intersection</i> of the two sets.
+ * A frozen set will not be modified.
+ *
+ * @param set the object on which to perform the retain
+ * @param retain set that defines which elements this set will retain
+ * @stable ICU 3.2
+ */
+U_STABLE void U_EXPORT2
+uset_retainAll(USet* set, const USet* retain);
+
+/**
+ * Reallocate this objects internal structures to take up the least
+ * possible space, without changing this object's value.
+ * A frozen set will not be modified.
+ *
+ * @param set the object on which to perfrom the compact
+ * @stable ICU 3.2
+ */
+U_STABLE void U_EXPORT2
+uset_compact(USet* set);
+
+/**
+ * Inverts this set.  This operation modifies this set so that
+ * its value is its complement.  This operation does not affect
+ * the multicharacter strings, if any.
+ * A frozen set will not be modified.
+ * @param set the set
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_complement(USet* set);
+
+/**
+ * Complements in this set all elements contained in the specified
+ * set.  Any character in the other set will be removed if it is
+ * in this set, or will be added if it is not in this set.
+ * A frozen set will not be modified.
+ *
+ * @param set the set with which to complement
+ * @param complement set that defines which elements will be xor'ed
+ * from this set.
+ * @stable ICU 3.2
+ */
+U_STABLE void U_EXPORT2
+uset_complementAll(USet* set, const USet* complement);
+
+/**
+ * Removes all of the elements from this set.  This set will be
+ * empty after this call returns.
+ * A frozen set will not be modified.
+ * @param set the set
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_clear(USet* set);
+
+/**
+ * Close this set over the given attribute.  For the attribute
+ * USET_CASE, the result is to modify this set so that:
+ *
+ * 1. For each character or string 'a' in this set, all strings or
+ * characters 'b' such that foldCase(a) == foldCase(b) are added
+ * to this set.
+ *
+ * 2. For each string 'e' in the resulting set, if e !=
+ * foldCase(e), 'e' will be removed.
+ *
+ * Example: [aq\\u00DF{Bc}{bC}{Fi}] => [aAqQ\\u00DF\\uFB01{ss}{bc}{fi}]
+ *
+ * (Here foldCase(x) refers to the operation u_strFoldCase, and a
+ * == b denotes that the contents are the same, not pointer
+ * comparison.)
+ *
+ * A frozen set will not be modified.
+ *
+ * @param set the set
+ *
+ * @param attributes bitmask for attributes to close over.
+ * Currently only the USET_CASE bit is supported.  Any undefined bits
+ * are ignored.
+ * @stable ICU 4.2
+ */
+U_STABLE void U_EXPORT2
+uset_closeOver(USet* set, int32_t attributes);
+
+/**
+ * Remove all strings from this set.
+ *
+ * @param set the set
+ * @stable ICU 4.2
+ */
+U_STABLE void U_EXPORT2
+uset_removeAllStrings(USet* set);
+
+/**
+ * Returns TRUE if the given USet contains no characters and no
+ * strings.
+ * @param set the set
+ * @return true if set is empty
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_isEmpty(const USet* set);
+
+/**
+ * Returns TRUE if the given USet contains the given character.
+ * This function works faster with a frozen set.
+ * @param set the set
+ * @param c The codepoint to check for within the set
+ * @return true if set contains c
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_contains(const USet* set, UChar32 c);
+
+/**
+ * Returns TRUE if the given USet contains all characters c
+ * where start <= c && c <= end.
+ * @param set the set
+ * @param start the first character of the range to test, inclusive
+ * @param end the last character of the range to test, inclusive
+ * @return TRUE if set contains the range
+ * @stable ICU 2.2
+ */
+U_STABLE UBool U_EXPORT2
+uset_containsRange(const USet* set, UChar32 start, UChar32 end);
+
+/**
+ * Returns TRUE if the given USet contains the given string.
+ * @param set the set
+ * @param str the string
+ * @param strLen the length of the string or -1 if null terminated.
+ * @return true if set contains str
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_containsString(const USet* set, const UChar* str, int32_t strLen);
+
+/**
+ * Returns the index of the given character within this set, where
+ * the set is ordered by ascending code point.  If the character
+ * is not in this set, return -1.  The inverse of this method is
+ * <code>charAt()</code>.
+ * @param set the set
+ * @param c the character to obtain the index for
+ * @return an index from 0..size()-1, or -1
+ * @stable ICU 3.2
+ */
+U_STABLE int32_t U_EXPORT2
+uset_indexOf(const USet* set, UChar32 c);
+
+/**
+ * Returns the character at the given index within this set, where
+ * the set is ordered by ascending code point.  If the index is
+ * out of range, return (UChar32)-1.  The inverse of this method is
+ * <code>indexOf()</code>.
+ * @param set the set
+ * @param charIndex an index from 0..size()-1 to obtain the char for
+ * @return the character at the given index, or (UChar32)-1.
+ * @stable ICU 3.2
+ */
+U_STABLE UChar32 U_EXPORT2
+uset_charAt(const USet* set, int32_t charIndex);
+
+/**
+ * Returns the number of characters and strings contained in the given
+ * USet.
+ * @param set the set
+ * @return a non-negative integer counting the characters and strings
+ * contained in set
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_size(const USet* set);
+
+/**
+ * Returns the number of items in this set.  An item is either a range
+ * of characters or a single multicharacter string.
+ * @param set the set
+ * @return a non-negative integer counting the character ranges
+ * and/or strings contained in set
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_getItemCount(const USet* set);
+
+/**
+ * Returns an item of this set.  An item is either a range of
+ * characters or a single multicharacter string.
+ * @param set the set
+ * @param itemIndex a non-negative integer in the range 0..
+ * uset_getItemCount(set)-1
+ * @param start pointer to variable to receive first character
+ * in range, inclusive
+ * @param end pointer to variable to receive last character in range,
+ * inclusive
+ * @param str buffer to receive the string, may be NULL
+ * @param strCapacity capacity of str, or 0 if str is NULL
+ * @param ec error code
+ * @return the length of the string (>= 2), or 0 if the item is a
+ * range, in which case it is the range *start..*end, or -1 if
+ * itemIndex is out of range
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_getItem(const USet* set, int32_t itemIndex,
+             UChar32* start, UChar32* end,
+             UChar* str, int32_t strCapacity,
+             UErrorCode* ec);
+
+/**
+ * Returns true if set1 contains all the characters and strings
+ * of set2. It answers the question, 'Is set1 a superset of set2?'
+ * @param set1 set to be checked for containment
+ * @param set2 set to be checked for containment
+ * @return true if the test condition is met
+ * @stable ICU 3.2
+ */
+U_STABLE UBool U_EXPORT2
+uset_containsAll(const USet* set1, const USet* set2);
+
+/**
+ * Returns true if this set contains all the characters
+ * of the given string. This is does not check containment of grapheme
+ * clusters, like uset_containsString.
+ * @param set set of characters to be checked for containment
+ * @param str string containing codepoints to be checked for containment
+ * @param strLen the length of the string or -1 if null terminated.
+ * @return true if the test condition is met
+ * @stable ICU 3.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen);
+
+/**
+ * Returns true if set1 contains none of the characters and strings
+ * of set2. It answers the question, 'Is set1 a disjoint set of set2?'
+ * @param set1 set to be checked for containment
+ * @param set2 set to be checked for containment
+ * @return true if the test condition is met
+ * @stable ICU 3.2
+ */
+U_STABLE UBool U_EXPORT2
+uset_containsNone(const USet* set1, const USet* set2);
+
+/**
+ * Returns true if set1 contains some of the characters and strings
+ * of set2. It answers the question, 'Does set1 and set2 have an intersection?'
+ * @param set1 set to be checked for containment
+ * @param set2 set to be checked for containment
+ * @return true if the test condition is met
+ * @stable ICU 3.2
+ */
+U_STABLE UBool U_EXPORT2
+uset_containsSome(const USet* set1, const USet* set2);
+
+/**
+ * Returns the length of the initial substring of the input string which
+ * consists only of characters and strings that are contained in this set
+ * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE),
+ * or only of characters and strings that are not contained
+ * in this set (USET_SPAN_NOT_CONTAINED).
+ * See USetSpanCondition for details.
+ * Similar to the strspn() C library function.
+ * Unpaired surrogates are treated according to contains() of their surrogate code points.
+ * This function works faster with a frozen set and with a non-negative string length argument.
+ * @param set the set
+ * @param s start of the string
+ * @param length of the string; can be -1 for NUL-terminated
+ * @param spanCondition specifies the containment condition
+ * @return the length of the initial substring according to the spanCondition;
+ *         0 if the start of the string does not fit the spanCondition
+ * @stable ICU 3.8
+ * @see USetSpanCondition
+ */
+U_STABLE int32_t U_EXPORT2
+uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition);
+
+/**
+ * Returns the start of the trailing substring of the input string which
+ * consists only of characters and strings that are contained in this set
+ * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE),
+ * or only of characters and strings that are not contained
+ * in this set (USET_SPAN_NOT_CONTAINED).
+ * See USetSpanCondition for details.
+ * Unpaired surrogates are treated according to contains() of their surrogate code points.
+ * This function works faster with a frozen set and with a non-negative string length argument.
+ * @param set the set
+ * @param s start of the string
+ * @param length of the string; can be -1 for NUL-terminated
+ * @param spanCondition specifies the containment condition
+ * @return the start of the trailing substring according to the spanCondition;
+ *         the string length if the end of the string does not fit the spanCondition
+ * @stable ICU 3.8
+ * @see USetSpanCondition
+ */
+U_STABLE int32_t U_EXPORT2
+uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition);
+
+/**
+ * Returns the length of the initial substring of the input string which
+ * consists only of characters and strings that are contained in this set
+ * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE),
+ * or only of characters and strings that are not contained
+ * in this set (USET_SPAN_NOT_CONTAINED).
+ * See USetSpanCondition for details.
+ * Similar to the strspn() C library function.
+ * Malformed byte sequences are treated according to contains(0xfffd).
+ * This function works faster with a frozen set and with a non-negative string length argument.
+ * @param set the set
+ * @param s start of the string (UTF-8)
+ * @param length of the string; can be -1 for NUL-terminated
+ * @param spanCondition specifies the containment condition
+ * @return the length of the initial substring according to the spanCondition;
+ *         0 if the start of the string does not fit the spanCondition
+ * @stable ICU 3.8
+ * @see USetSpanCondition
+ */
+U_STABLE int32_t U_EXPORT2
+uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition);
+
+/**
+ * Returns the start of the trailing substring of the input string which
+ * consists only of characters and strings that are contained in this set
+ * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE),
+ * or only of characters and strings that are not contained
+ * in this set (USET_SPAN_NOT_CONTAINED).
+ * See USetSpanCondition for details.
+ * Malformed byte sequences are treated according to contains(0xfffd).
+ * This function works faster with a frozen set and with a non-negative string length argument.
+ * @param set the set
+ * @param s start of the string (UTF-8)
+ * @param length of the string; can be -1 for NUL-terminated
+ * @param spanCondition specifies the containment condition
+ * @return the start of the trailing substring according to the spanCondition;
+ *         the string length if the end of the string does not fit the spanCondition
+ * @stable ICU 3.8
+ * @see USetSpanCondition
+ */
+U_STABLE int32_t U_EXPORT2
+uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition);
+
+/**
+ * Returns true if set1 contains all of the characters and strings
+ * of set2, and vis versa. It answers the question, 'Is set1 equal to set2?'
+ * @param set1 set to be checked for containment
+ * @param set2 set to be checked for containment
+ * @return true if the test condition is met
+ * @stable ICU 3.2
+ */
+U_STABLE UBool U_EXPORT2
+uset_equals(const USet* set1, const USet* set2);
+
+/*********************************************************************
+ * Serialized set API
+ *********************************************************************/
+
+/**
+ * Serializes this set into an array of 16-bit integers.  Serialization
+ * (currently) only records the characters in the set; multicharacter
+ * strings are ignored.
+ *
+ * The array
+ * has following format (each line is one 16-bit integer):
+ *
+ *  length     = (n+2*m) | (m!=0?0x8000:0)
+ *  bmpLength  = n; present if m!=0
+ *  bmp[0]
+ *  bmp[1]
+ *  ...
+ *  bmp[n-1]
+ *  supp-high[0]
+ *  supp-low[0]
+ *  supp-high[1]
+ *  supp-low[1]
+ *  ...
+ *  supp-high[m-1]
+ *  supp-low[m-1]
+ *
+ * The array starts with a header.  After the header are n bmp
+ * code points, then m supplementary code points.  Either n or m
+ * or both may be zero.  n+2*m is always <= 0x7FFF.
+ *
+ * If there are no supplementary characters (if m==0) then the
+ * header is one 16-bit integer, 'length', with value n.
+ *
+ * If there are supplementary characters (if m!=0) then the header
+ * is two 16-bit integers.  The first, 'length', has value
+ * (n+2*m)|0x8000.  The second, 'bmpLength', has value n.
+ *
+ * After the header the code points are stored in ascending order.
+ * Supplementary code points are stored as most significant 16
+ * bits followed by least significant 16 bits.
+ *
+ * @param set the set
+ * @param dest pointer to buffer of destCapacity 16-bit integers.
+ * May be NULL only if destCapacity is zero.
+ * @param destCapacity size of dest, or zero.  Must not be negative.
+ * @param pErrorCode pointer to the error code.  Will be set to
+ * U_INDEX_OUTOFBOUNDS_ERROR if n+2*m > 0x7FFF.  Will be set to
+ * U_BUFFER_OVERFLOW_ERROR if n+2*m+(m!=0?2:1) > destCapacity.
+ * @return the total length of the serialized format, including
+ * the header, that is, n+2*m+(m!=0?2:1), or 0 on error other
+ * than U_BUFFER_OVERFLOW_ERROR.
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode);
+
+/**
+ * Given a serialized array, fill in the given serialized set object.
+ * @param fillSet pointer to result
+ * @param src pointer to start of array
+ * @param srcLength length of array
+ * @return true if the given array is valid, otherwise false
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength);
+
+/**
+ * Set the USerializedSet to contain the given character (and nothing
+ * else).
+ * @param fillSet pointer to result
+ * @param c The codepoint to set
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c);
+
+/**
+ * Returns TRUE if the given USerializedSet contains the given
+ * character.
+ * @param set the serialized set
+ * @param c The codepoint to check for within the set
+ * @return true if set contains c
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_serializedContains(const USerializedSet* set, UChar32 c);
+
+/**
+ * Returns the number of disjoint ranges of characters contained in
+ * the given serialized set.  Ignores any strings contained in the
+ * set.
+ * @param set the serialized set
+ * @return a non-negative integer counting the character ranges
+ * contained in set
+ * @stable ICU 2.4
+ */
+U_STABLE int32_t U_EXPORT2
+uset_getSerializedRangeCount(const USerializedSet* set);
+
+/**
+ * Returns a range of characters contained in the given serialized
+ * set.
+ * @param set the serialized set
+ * @param rangeIndex a non-negative integer in the range 0..
+ * uset_getSerializedRangeCount(set)-1
+ * @param pStart pointer to variable to receive first character
+ * in range, inclusive
+ * @param pEnd pointer to variable to receive last character in range,
+ * inclusive
+ * @return true if rangeIndex is valid, otherwise false
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
+                        UChar32* pStart, UChar32* pEnd);
+
+#endif
diff --git a/Source/WTF/icu/unicode/ustring.h b/Source/WTF/icu/unicode/ustring.h
new file mode 100644
index 0000000..2ee16e9
--- /dev/null
+++ b/Source/WTF/icu/unicode/ustring.h
@@ -0,0 +1,1696 @@
+/*
+**********************************************************************
+*   Copyright (C) 1998-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+**********************************************************************
+*
+* File ustring.h
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   12/07/98    bertrand    Creation.
+******************************************************************************
+*/
+
+#ifndef USTRING_H
+#define USTRING_H
+
+#include "unicode/utypes.h"
+#include "unicode/putil.h"
+#include "unicode/uiter.h"
+
+/** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. @stable ICU 2.1*/
+#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
+#   define UBRK_TYPEDEF_UBREAK_ITERATOR
+    typedef struct UBreakIterator UBreakIterator;
+#endif
+
+/**
+ * \file
+ * \brief C API: Unicode string handling functions
+ *
+ * These C API functions provide general Unicode string handling.
+ *
+ * Some functions are equivalent in name, signature, and behavior to the ANSI C <string.h>
+ * functions. (For example, they do not check for bad arguments like NULL string pointers.)
+ * In some cases, only the thread-safe variant of such a function is implemented here
+ * (see u_strtok_r()).
+ *
+ * Other functions provide more Unicode-specific functionality like locale-specific
+ * upper/lower-casing and string comparison in code point order.
+ *
+ * ICU uses 16-bit Unicode (UTF-16) in the form of arrays of UChar code units.
+ * UTF-16 encodes each Unicode code point with either one or two UChar code units.
+ * (This is the default form of Unicode, and a forward-compatible extension of the original,
+ * fixed-width form that was known as UCS-2. UTF-16 superseded UCS-2 with Unicode 2.0
+ * in 1996.)
+ *
+ * Some APIs accept a 32-bit UChar32 value for a single code point.
+ *
+ * ICU also handles 16-bit Unicode text with unpaired surrogates.
+ * Such text is not well-formed UTF-16.
+ * Code-point-related functions treat unpaired surrogates as surrogate code points,
+ * i.e., as separate units.
+ *
+ * Although UTF-16 is a variable-width encoding form (like some legacy multi-byte encodings),
+ * it is much more efficient even for random access because the code unit values
+ * for single-unit characters vs. lead units vs. trail units are completely disjoint.
+ * This means that it is easy to determine character (code point) boundaries from
+ * random offsets in the string.
+ *
+ * Unicode (UTF-16) string processing is optimized for the single-unit case.
+ * Although it is important to support supplementary characters
+ * (which use pairs of lead/trail code units called "surrogates"),
+ * their occurrence is rare. Almost all characters in modern use require only
+ * a single UChar code unit (i.e., their code point values are <=0xffff).
+ *
+ * For more details see the User Guide Strings chapter (http://icu-project.org/userguide/strings.html).
+ * For a discussion of the handling of unpaired surrogates see also
+ * Jitterbug 2145 and its icu mailing list proposal on 2002-sep-18.
+ */
+
+/**
+ * \defgroup ustring_ustrlen String Length
+ * \ingroup ustring_strlen
+ */
+/*@{*/
+/**
+ * Determine the length of an array of UChar.
+ *
+ * @param s The array of UChars, NULL (U+0000) terminated.
+ * @return The number of UChars in <code>chars</code>, minus the terminator.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strlen(const UChar *s);
+/*@}*/
+
+/**
+ * Count Unicode code points in the length UChar code units of the string.
+ * A code point may occupy either one or two UChar code units.
+ * Counting code points involves reading all code units.
+ *
+ * This functions is basically the inverse of the U16_FWD_N() macro (see utf.h).
+ *
+ * @param s The input string.
+ * @param length The number of UChar code units to be checked, or -1 to count all
+ *               code points before the first NUL (U+0000).
+ * @return The number of code points in the specified code units.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_countChar32(const UChar *s, int32_t length);
+
+/**
+ * Check if the string contains more Unicode code points than a certain number.
+ * This is more efficient than counting all code points in the entire string
+ * and comparing that number with a threshold.
+ * This function may not need to scan the string at all if the length is known
+ * (not -1 for NUL-termination) and falls within a certain range, and
+ * never needs to count more than 'number+1' code points.
+ * Logically equivalent to (u_countChar32(s, length)>number).
+ * A Unicode code point may occupy either one or two UChar code units.
+ *
+ * @param s The input string.
+ * @param length The length of the string, or -1 if it is NUL-terminated.
+ * @param number The number of code points in the string is compared against
+ *               the 'number' parameter.
+ * @return Boolean value for whether the string contains more Unicode code points
+ *         than 'number'. Same as (u_countChar32(s, length)>number).
+ * @stable ICU 2.4
+ */
+U_STABLE UBool U_EXPORT2
+u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number);
+
+/**
+ * Concatenate two ustrings.  Appends a copy of <code>src</code>,
+ * including the null terminator, to <code>dst</code>. The initial copied
+ * character from <code>src</code> overwrites the null terminator in <code>dst</code>.
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strcat(UChar     *dst, 
+    const UChar     *src);
+
+/**
+ * Concatenate two ustrings.  
+ * Appends at most <code>n</code> characters from <code>src</code> to <code>dst</code>.
+ * Adds a terminating NUL.
+ * If src is too long, then only <code>n-1</code> characters will be copied
+ * before the terminating NUL.
+ * If <code>n&lt;=0</code> then dst is not modified.
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @param n The maximum number of characters to append.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strncat(UChar     *dst, 
+     const UChar     *src, 
+     int32_t     n);
+
+/**
+ * Find the first occurrence of a substring in a string.
+ * The substring is found at code point boundaries.
+ * That means that if the substring begins with
+ * a trail surrogate or ends with a lead surrogate,
+ * then it is found only if these surrogates stand alone in the text.
+ * Otherwise, the substring edge units would be matched against
+ * halves of surrogate pairs.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param substring The substring to find (NUL-terminated).
+ * @return A pointer to the first occurrence of <code>substring</code> in <code>s</code>,
+ *         or <code>s</code> itself if the <code>substring</code> is empty,
+ *         or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
+ * @stable ICU 2.0
+ *
+ * @see u_strrstr
+ * @see u_strFindFirst
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strstr(const UChar *s, const UChar *substring);
+
+/**
+ * Find the first occurrence of a substring in a string.
+ * The substring is found at code point boundaries.
+ * That means that if the substring begins with
+ * a trail surrogate or ends with a lead surrogate,
+ * then it is found only if these surrogates stand alone in the text.
+ * Otherwise, the substring edge units would be matched against
+ * halves of surrogate pairs.
+ *
+ * @param s The string to search.
+ * @param length The length of s (number of UChars), or -1 if it is NUL-terminated.
+ * @param substring The substring to find (NUL-terminated).
+ * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated.
+ * @return A pointer to the first occurrence of <code>substring</code> in <code>s</code>,
+ *         or <code>s</code> itself if the <code>substring</code> is empty,
+ *         or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strstr
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
+
+/**
+ * Find the first occurrence of a BMP code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param c The BMP code point to find.
+ * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
+ *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.0
+ *
+ * @see u_strchr32
+ * @see u_memchr
+ * @see u_strstr
+ * @see u_strFindFirst
+ */
+U_STABLE UChar * U_EXPORT2
+u_strchr(const UChar *s, UChar c);
+
+/**
+ * Find the first occurrence of a code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param c The code point to find.
+ * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
+ *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.0
+ *
+ * @see u_strchr
+ * @see u_memchr32
+ * @see u_strstr
+ * @see u_strFindFirst
+ */
+U_STABLE UChar * U_EXPORT2
+u_strchr32(const UChar *s, UChar32 c);
+
+/**
+ * Find the last occurrence of a substring in a string.
+ * The substring is found at code point boundaries.
+ * That means that if the substring begins with
+ * a trail surrogate or ends with a lead surrogate,
+ * then it is found only if these surrogates stand alone in the text.
+ * Otherwise, the substring edge units would be matched against
+ * halves of surrogate pairs.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param substring The substring to find (NUL-terminated).
+ * @return A pointer to the last occurrence of <code>substring</code> in <code>s</code>,
+ *         or <code>s</code> itself if the <code>substring</code> is empty,
+ *         or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strstr
+ * @see u_strFindFirst
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strrstr(const UChar *s, const UChar *substring);
+
+/**
+ * Find the last occurrence of a substring in a string.
+ * The substring is found at code point boundaries.
+ * That means that if the substring begins with
+ * a trail surrogate or ends with a lead surrogate,
+ * then it is found only if these surrogates stand alone in the text.
+ * Otherwise, the substring edge units would be matched against
+ * halves of surrogate pairs.
+ *
+ * @param s The string to search.
+ * @param length The length of s (number of UChars), or -1 if it is NUL-terminated.
+ * @param substring The substring to find (NUL-terminated).
+ * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated.
+ * @return A pointer to the last occurrence of <code>substring</code> in <code>s</code>,
+ *         or <code>s</code> itself if the <code>substring</code> is empty,
+ *         or <code>NULL</code> if <code>substring</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strstr
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
+
+/**
+ * Find the last occurrence of a BMP code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param c The BMP code point to find.
+ * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
+ *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strrchr32
+ * @see u_memrchr
+ * @see u_strrstr
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strrchr(const UChar *s, UChar c);
+
+/**
+ * Find the last occurrence of a code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (NUL-terminated).
+ * @param c The code point to find.
+ * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
+ *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strrchr
+ * @see u_memchr32
+ * @see u_strrstr
+ * @see u_strFindLast
+ */
+U_STABLE UChar * U_EXPORT2
+u_strrchr32(const UChar *s, UChar32 c);
+
+/**
+ * Locates the first occurrence in the string <code>string</code> of any of the characters
+ * in the string <code>matchSet</code>.
+ * Works just like C's strpbrk but with Unicode.
+ *
+ * @param string The string in which to search, NUL-terminated.
+ * @param matchSet A NUL-terminated string defining a set of code points
+ *                 for which to search in the text string.
+ * @return A pointer to the  character in <code>string</code> that matches one of the
+ *         characters in <code>matchSet</code>, or NULL if no such character is found.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar * U_EXPORT2
+u_strpbrk(const UChar *string, const UChar *matchSet);
+
+/**
+ * Returns the number of consecutive characters in <code>string</code>,
+ * beginning with the first, that do not occur somewhere in <code>matchSet</code>.
+ * Works just like C's strcspn but with Unicode.
+ *
+ * @param string The string in which to search, NUL-terminated.
+ * @param matchSet A NUL-terminated string defining a set of code points
+ *                 for which to search in the text string.
+ * @return The number of initial characters in <code>string</code> that do not
+ *         occur in <code>matchSet</code>.
+ * @see u_strspn
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strcspn(const UChar *string, const UChar *matchSet);
+
+/**
+ * Returns the number of consecutive characters in <code>string</code>,
+ * beginning with the first, that occur somewhere in <code>matchSet</code>.
+ * Works just like C's strspn but with Unicode.
+ *
+ * @param string The string in which to search, NUL-terminated.
+ * @param matchSet A NUL-terminated string defining a set of code points
+ *                 for which to search in the text string.
+ * @return The number of initial characters in <code>string</code> that do
+ *         occur in <code>matchSet</code>.
+ * @see u_strcspn
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strspn(const UChar *string, const UChar *matchSet);
+
+/**
+ * The string tokenizer API allows an application to break a string into
+ * tokens. Unlike strtok(), the saveState (the current pointer within the
+ * original string) is maintained in saveState. In the first call, the
+ * argument src is a pointer to the string. In subsequent calls to
+ * return successive tokens of that string, src must be specified as
+ * NULL. The value saveState is set by this function to maintain the
+ * function's position within the string, and on each subsequent call
+ * you must give this argument the same variable. This function does
+ * handle surrogate pairs. This function is similar to the strtok_r()
+ * the POSIX Threads Extension (1003.1c-1995) version.
+ *
+ * @param src String containing token(s). This string will be modified.
+ *            After the first call to u_strtok_r(), this argument must
+ *            be NULL to get to the next token.
+ * @param delim Set of delimiter characters (Unicode code points).
+ * @param saveState The current pointer within the original string,
+ *              which is set by this function. The saveState
+ *              parameter should the address of a local variable of type
+ *              UChar *. (i.e. defined "Uhar *myLocalSaveState" and use
+ *              &myLocalSaveState for this parameter).
+ * @return A pointer to the next token found in src, or NULL
+ *         when there are no more tokens.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar * U_EXPORT2
+u_strtok_r(UChar    *src, 
+     const UChar    *delim,
+           UChar   **saveState);
+
+/**
+ * Compare two Unicode strings for bitwise equality (code unit order).
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @return 0 if <code>s1</code> and <code>s2</code> are bitwise equal; a negative
+ * value if <code>s1</code> is bitwise less than <code>s2,</code>; a positive
+ * value if <code>s1</code> is bitwise greater than <code>s2</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t  U_EXPORT2
+u_strcmp(const UChar     *s1, 
+         const UChar     *s2);
+
+/**
+ * Compare two Unicode strings in code point order.
+ * See u_strCompare for details.
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @return a negative/zero/positive integer corresponding to whether
+ * the first string is less than/equal to/greater than the second one
+ * in code point order
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strcmpCodePointOrder(const UChar *s1, const UChar *s2);
+
+/**
+ * Compare two Unicode strings (binary order).
+ *
+ * The comparison can be done in code unit order or in code point order.
+ * They differ only in UTF-16 when
+ * comparing supplementary code points (U+10000..U+10ffff)
+ * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff).
+ * In code unit order, high BMP code points sort after supplementary code points
+ * because they are stored as pairs of surrogates which are at U+d800..U+dfff.
+ *
+ * This functions works with strings of different explicitly specified lengths
+ * unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
+ * NUL-terminated strings are possible with length arguments of -1.
+ *
+ * @param s1 First source string.
+ * @param length1 Length of first source string, or -1 if NUL-terminated.
+ *
+ * @param s2 Second source string.
+ * @param length2 Length of second source string, or -1 if NUL-terminated.
+ *
+ * @param codePointOrder Choose between code unit order (FALSE)
+ *                       and code point order (TRUE).
+ *
+ * @return <0 or 0 or >0 as usual for string comparisons
+ *
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_strCompare(const UChar *s1, int32_t length1,
+             const UChar *s2, int32_t length2,
+             UBool codePointOrder);
+
+/**
+ * Compare two Unicode strings (binary order)
+ * as presented by UCharIterator objects.
+ * Works otherwise just like u_strCompare().
+ *
+ * Both iterators are reset to their start positions.
+ * When the function returns, it is undefined where the iterators
+ * have stopped.
+ *
+ * @param iter1 First source string iterator.
+ * @param iter2 Second source string iterator.
+ * @param codePointOrder Choose between code unit order (FALSE)
+ *                       and code point order (TRUE).
+ *
+ * @return <0 or 0 or >0 as usual for string comparisons
+ *
+ * @see u_strCompare
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE int32_t U_EXPORT2
+u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder);
+
+#ifndef U_COMPARE_CODE_POINT_ORDER
+/* see also unistr.h and unorm.h */
+/**
+ * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
+ * Compare strings in code point order instead of code unit order.
+ * @stable ICU 2.2
+ */
+#define U_COMPARE_CODE_POINT_ORDER  0x8000
+#endif
+
+/**
+ * Compare two strings case-insensitively using full case folding.
+ * This is equivalent to
+ *   u_strCompare(u_strFoldCase(s1, options),
+ *                u_strFoldCase(s2, options),
+ *                (options&U_COMPARE_CODE_POINT_ORDER)!=0).
+ *
+ * The comparison can be done in UTF-16 code unit order or in code point order.
+ * They differ only when comparing supplementary code points (U+10000..U+10ffff)
+ * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff).
+ * In code unit order, high BMP code points sort after supplementary code points
+ * because they are stored as pairs of surrogates which are at U+d800..U+dfff.
+ *
+ * This functions works with strings of different explicitly specified lengths
+ * unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
+ * NUL-terminated strings are possible with length arguments of -1.
+ *
+ * @param s1 First source string.
+ * @param length1 Length of first source string, or -1 if NUL-terminated.
+ *
+ * @param s2 Second source string.
+ * @param length2 Length of second source string, or -1 if NUL-terminated.
+ *
+ * @param options A bit set of options:
+ *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+ *     Comparison in code unit order with default case folding.
+ *
+ *   - U_COMPARE_CODE_POINT_ORDER
+ *     Set to choose code point order instead of code unit order
+ *     (see u_strCompare for details).
+ *
+ *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ *
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ *                  which must not indicate a failure before the function call.
+ *
+ * @return <0 or 0 or >0 as usual for string comparisons
+ *
+ * @stable ICU 2.2
+ */
+U_STABLE int32_t U_EXPORT2
+u_strCaseCompare(const UChar *s1, int32_t length1,
+                 const UChar *s2, int32_t length2,
+                 uint32_t options,
+                 UErrorCode *pErrorCode);
+
+/**
+ * Compare two ustrings for bitwise equality. 
+ * Compares at most <code>n</code> characters.
+ *
+ * @param ucs1 A string to compare.
+ * @param ucs2 A string to compare.
+ * @param n The maximum number of characters to compare.
+ * @return 0 if <code>s1</code> and <code>s2</code> are bitwise equal; a negative
+ * value if <code>s1</code> is bitwise less than <code>s2</code>; a positive
+ * value if <code>s1</code> is bitwise greater than <code>s2</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strncmp(const UChar     *ucs1, 
+     const UChar     *ucs2, 
+     int32_t     n);
+
+/**
+ * Compare two Unicode strings in code point order.
+ * This is different in UTF-16 from u_strncmp() if supplementary characters are present.
+ * For details, see u_strCompare().
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @param n The maximum number of characters to compare.
+ * @return a negative/zero/positive integer corresponding to whether
+ * the first string is less than/equal to/greater than the second one
+ * in code point order
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n);
+
+/**
+ * Compare two strings case-insensitively using full case folding.
+ * This is equivalent to u_strcmp(u_strFoldCase(s1, options), u_strFoldCase(s2, options)).
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @param options A bit set of options:
+ *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+ *     Comparison in code unit order with default case folding.
+ *
+ *   - U_COMPARE_CODE_POINT_ORDER
+ *     Set to choose code point order instead of code unit order
+ *     (see u_strCompare for details).
+ *
+ *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ *
+ * @return A negative, zero, or positive integer indicating the comparison result.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options);
+
+/**
+ * Compare two strings case-insensitively using full case folding.
+ * This is equivalent to u_strcmp(u_strFoldCase(s1, at most n, options),
+ * u_strFoldCase(s2, at most n, options)).
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @param n The maximum number of characters each string to case-fold and then compare.
+ * @param options A bit set of options:
+ *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+ *     Comparison in code unit order with default case folding.
+ *
+ *   - U_COMPARE_CODE_POINT_ORDER
+ *     Set to choose code point order instead of code unit order
+ *     (see u_strCompare for details).
+ *
+ *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ *
+ * @return A negative, zero, or positive integer indicating the comparison result.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options);
+
+/**
+ * Compare two strings case-insensitively using full case folding.
+ * This is equivalent to u_strcmp(u_strFoldCase(s1, n, options),
+ * u_strFoldCase(s2, n, options)).
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @param length The number of characters in each string to case-fold and then compare.
+ * @param options A bit set of options:
+ *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
+ *     Comparison in code unit order with default case folding.
+ *
+ *   - U_COMPARE_CODE_POINT_ORDER
+ *     Set to choose code point order instead of code unit order
+ *     (see u_strCompare for details).
+ *
+ *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ *
+ * @return A negative, zero, or positive integer indicating the comparison result.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options);
+
+/**
+ * Copy a ustring. Adds a null terminator.
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strcpy(UChar     *dst, 
+    const UChar     *src);
+
+/**
+ * Copy a ustring.
+ * Copies at most <code>n</code> characters.  The result will be null terminated
+ * if the length of <code>src</code> is less than <code>n</code>.
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @param n The maximum number of characters to copy.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strncpy(UChar     *dst, 
+     const UChar     *src, 
+     int32_t     n);
+
+#if !UCONFIG_NO_CONVERSION
+
+/**
+ * Copy a byte string encoded in the default codepage to a ustring.
+ * Adds a null terminator.
+ * Performs a host byte to UChar conversion
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst,
+               const char *src );
+
+/**
+ * Copy a byte string encoded in the default codepage to a ustring.
+ * Copies at most <code>n</code> characters.  The result will be null terminated
+ * if the length of <code>src</code> is less than <code>n</code>.
+ * Performs a host byte to UChar conversion
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @param n The maximum number of characters to copy.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst,
+            const char *src,
+            int32_t n);
+
+/**
+ * Copy ustring to a byte string encoded in the default codepage.
+ * Adds a null terminator.
+ * Performs a UChar to host byte conversion
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE char* U_EXPORT2 u_austrcpy(char *dst,
+            const UChar *src );
+
+/**
+ * Copy ustring to a byte string encoded in the default codepage.
+ * Copies at most <code>n</code> characters.  The result will be null terminated
+ * if the length of <code>src</code> is less than <code>n</code>.
+ * Performs a UChar to host byte conversion
+ *
+ * @param dst The destination string.
+ * @param src The source string.
+ * @param n The maximum number of characters to copy.
+ * @return A pointer to <code>dst</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE char* U_EXPORT2 u_austrncpy(char *dst,
+            const UChar *src,
+            int32_t n );
+
+#endif
+
+/**
+ * Synonym for memcpy(), but with UChars only.
+ * @param dest The destination string
+ * @param src The source string
+ * @param count The number of characters to copy
+ * @return A pointer to <code>dest</code>
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_memcpy(UChar *dest, const UChar *src, int32_t count);
+
+/**
+ * Synonym for memmove(), but with UChars only.
+ * @param dest The destination string
+ * @param src The source string
+ * @param count The number of characters to move
+ * @return A pointer to <code>dest</code>
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_memmove(UChar *dest, const UChar *src, int32_t count);
+
+/**
+ * Initialize <code>count</code> characters of <code>dest</code> to <code>c</code>.
+ *
+ * @param dest The destination string.
+ * @param c The character to initialize the string.
+ * @param count The maximum number of characters to set.
+ * @return A pointer to <code>dest</code>.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_memset(UChar *dest, UChar c, int32_t count);
+
+/**
+ * Compare the first <code>count</code> UChars of each buffer.
+ *
+ * @param buf1 The first string to compare.
+ * @param buf2 The second string to compare.
+ * @param count The maximum number of UChars to compare.
+ * @return When buf1 < buf2, a negative number is returned.
+ *      When buf1 == buf2, 0 is returned.
+ *      When buf1 > buf2, a positive number is returned.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count);
+
+/**
+ * Compare two Unicode strings in code point order.
+ * This is different in UTF-16 from u_memcmp() if supplementary characters are present.
+ * For details, see u_strCompare().
+ *
+ * @param s1 A string to compare.
+ * @param s2 A string to compare.
+ * @param count The maximum number of characters to compare.
+ * @return a negative/zero/positive integer corresponding to whether
+ * the first string is less than/equal to/greater than the second one
+ * in code point order
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count);
+
+/**
+ * Find the first occurrence of a BMP code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (contains <code>count</code> UChars).
+ * @param c The BMP code point to find.
+ * @param count The length of the string.
+ * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
+ *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.0
+ *
+ * @see u_strchr
+ * @see u_memchr32
+ * @see u_strFindFirst
+ */
+U_STABLE UChar* U_EXPORT2
+u_memchr(const UChar *s, UChar c, int32_t count);
+
+/**
+ * Find the first occurrence of a code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (contains <code>count</code> UChars).
+ * @param c The code point to find.
+ * @param count The length of the string.
+ * @return A pointer to the first occurrence of <code>c</code> in <code>s</code>
+ *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.0
+ *
+ * @see u_strchr32
+ * @see u_memchr
+ * @see u_strFindFirst
+ */
+U_STABLE UChar* U_EXPORT2
+u_memchr32(const UChar *s, UChar32 c, int32_t count);
+
+/**
+ * Find the last occurrence of a BMP code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (contains <code>count</code> UChars).
+ * @param c The BMP code point to find.
+ * @param count The length of the string.
+ * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
+ *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strrchr
+ * @see u_memrchr32
+ * @see u_strFindLast
+ */
+U_STABLE UChar* U_EXPORT2
+u_memrchr(const UChar *s, UChar c, int32_t count);
+
+/**
+ * Find the last occurrence of a code point in a string.
+ * A surrogate code point is found only if its match in the text is not
+ * part of a surrogate pair.
+ * A NUL character is found at the string terminator.
+ *
+ * @param s The string to search (contains <code>count</code> UChars).
+ * @param c The code point to find.
+ * @param count The length of the string.
+ * @return A pointer to the last occurrence of <code>c</code> in <code>s</code>
+ *         or <code>NULL</code> if <code>c</code> is not in <code>s</code>.
+ * @stable ICU 2.4
+ *
+ * @see u_strrchr32
+ * @see u_memrchr
+ * @see u_strFindLast
+ */
+U_STABLE UChar* U_EXPORT2
+u_memrchr32(const UChar *s, UChar32 c, int32_t count);
+
+/**
+ * Unicode String literals in C.
+ * We need one macro to declare a variable for the string
+ * and to statically preinitialize it if possible,
+ * and a second macro to dynamically intialize such a string variable if necessary.
+ *
+ * The macros are defined for maximum performance.
+ * They work only for strings that contain "invariant characters", i.e.,
+ * only latin letters, digits, and some punctuation.
+ * See utypes.h for details.
+ *
+ * A pair of macros for a single string must be used with the same
+ * parameters.
+ * The string parameter must be a C string literal.
+ * The length of the string, not including the terminating
+ * <code>NUL</code>, must be specified as a constant.
+ * The U_STRING_DECL macro should be invoked exactly once for one
+ * such string variable before it is used.
+ *
+ * Usage:
+ * <pre>
+ *    U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11);
+ *    U_STRING_DECL(ustringVar2, "jumps 5%", 8);
+ *    static UBool didInit=FALSE;
+ * 
+ *    int32_t function() {
+ *        if(!didInit) {
+ *            U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11);
+ *            U_STRING_INIT(ustringVar2, "jumps 5%", 8);
+ *            didInit=TRUE;
+ *        }
+ *        return u_strcmp(ustringVar1, ustringVar2);
+ *    }
+ * </pre>
+ * 
+ * Note that the macros will NOT consistently work if their argument is another #define. 
+ *  The following will not work on all platforms, don't use it.
+ * 
+ * <pre>
+ *     #define GLUCK "Mr. Gluck"
+ *     U_STRING_DECL(var, GLUCK, 9)
+ *     U_STRING_INIT(var, GLUCK, 9)
+ * </pre>
+ * 
+ * Instead, use the string literal "Mr. Gluck"  as the argument to both macro
+ * calls.
+ *
+ *
+ * @stable ICU 2.0
+ */
+#if defined(U_DECLARE_UTF16)
+#   define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=U_DECLARE_UTF16(cs)
+    /**@stable ICU 2.0 */
+#   define U_STRING_INIT(var, cs, length)
+#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
+#   define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs
+    /**@stable ICU 2.0 */
+#   define U_STRING_INIT(var, cs, length)
+#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
+#   define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]={ (const UChar *)cs }
+    /**@stable ICU 2.0 */
+#   define U_STRING_INIT(var, cs, length)
+#else
+#   define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
+    /**@stable ICU 2.0 */
+#   define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
+#endif
+
+/**
+ * Unescape a string of characters and write the resulting
+ * Unicode characters to the destination buffer.  The following escape
+ * sequences are recognized:
+ *
+ * \\uhhhh       4 hex digits; h in [0-9A-Fa-f]
+ * \\Uhhhhhhhh   8 hex digits
+ * \\xhh         1-2 hex digits
+ * \\x{h...}     1-8 hex digits
+ * \\ooo         1-3 octal digits; o in [0-7]
+ * \\cX          control-X; X is masked with 0x1F
+ *
+ * as well as the standard ANSI C escapes:
+ *
+ * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A,
+ * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B,
+ * \\&quot; => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C
+ *
+ * Anything else following a backslash is generically escaped.  For
+ * example, "[a\\-z]" returns "[a-z]".
+ *
+ * If an escape sequence is ill-formed, this method returns an empty
+ * string.  An example of an ill-formed sequence is "\\u" followed by
+ * fewer than 4 hex digits.
+ *
+ * The above characters are recognized in the compiler's codepage,
+ * that is, they are coded as 'u', '\\', etc.  Characters that are
+ * not parts of escape sequences are converted using u_charsToUChars().
+ *
+ * This function is similar to UnicodeString::unescape() but not
+ * identical to it.  The latter takes a source UnicodeString, so it
+ * does escape recognition but no conversion.
+ *
+ * @param src a zero-terminated string of invariant characters
+ * @param dest pointer to buffer to receive converted and unescaped
+ * text and, if there is room, a zero terminator.  May be NULL for
+ * preflighting, in which case no UChars will be written, but the
+ * return value will still be valid.  On error, an empty string is
+ * stored here (if possible).
+ * @param destCapacity the number of UChars that may be written at
+ * dest.  Ignored if dest == NULL.
+ * @return the length of unescaped string.
+ * @see u_unescapeAt
+ * @see UnicodeString#unescape()
+ * @see UnicodeString#unescapeAt()
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_unescape(const char *src,
+           UChar *dest, int32_t destCapacity);
+
+U_CDECL_BEGIN
+/**
+ * Callback function for u_unescapeAt() that returns a character of
+ * the source text given an offset and a context pointer.  The context
+ * pointer will be whatever is passed into u_unescapeAt().
+ *
+ * @param offset pointer to the offset that will be passed to u_unescapeAt().
+ * @param context an opaque pointer passed directly into u_unescapeAt()
+ * @return the character represented by the escape sequence at
+ * offset
+ * @see u_unescapeAt
+ * @stable ICU 2.0
+ */
+typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context);
+U_CDECL_END
+
+/**
+ * Unescape a single sequence. The character at offset-1 is assumed
+ * (without checking) to be a backslash.  This method takes a callback
+ * pointer to a function that returns the UChar at a given offset.  By
+ * varying this callback, ICU functions are able to unescape char*
+ * strings, UnicodeString objects, and UFILE pointers.
+ *
+ * If offset is out of range, or if the escape sequence is ill-formed,
+ * (UChar32)0xFFFFFFFF is returned.  See documentation of u_unescape()
+ * for a list of recognized sequences.
+ *
+ * @param charAt callback function that returns a UChar of the source
+ * text given an offset and a context pointer.
+ * @param offset pointer to the offset that will be passed to charAt.
+ * The offset value will be updated upon return to point after the
+ * last parsed character of the escape sequence.  On error the offset
+ * is unchanged.
+ * @param length the number of characters in the source text.  The
+ * last character of the source text is considered to be at offset
+ * length-1.
+ * @param context an opaque pointer passed directly into charAt.
+ * @return the character represented by the escape sequence at
+ * offset, or (UChar32)0xFFFFFFFF on error.
+ * @see u_unescape()
+ * @see UnicodeString#unescape()
+ * @see UnicodeString#unescapeAt()
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32 U_EXPORT2
+u_unescapeAt(UNESCAPE_CHAR_AT charAt,
+             int32_t *offset,
+             int32_t length,
+             void *context);
+
+/**
+ * Uppercase the characters in a string.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer are allowed to overlap.
+ *
+ * @param dest      A buffer for the result string. The result will be zero-terminated if
+ *                  the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ *                  dest may be NULL and the function will only return the length of the result
+ *                  without writing any of the result string.
+ * @param src       The original string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param locale    The locale to consider, or "" for the root locale or NULL for the default locale.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ *                  which must not indicate a failure before the function call.
+ * @return The length of the result string. It may be greater than destCapacity. In that case,
+ *         only some of the result was written to the destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strToUpper(UChar *dest, int32_t destCapacity,
+             const UChar *src, int32_t srcLength,
+             const char *locale,
+             UErrorCode *pErrorCode);
+
+/**
+ * Lowercase the characters in a string.
+ * Casing is locale-dependent and context-sensitive.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer are allowed to overlap.
+ *
+ * @param dest      A buffer for the result string. The result will be zero-terminated if
+ *                  the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ *                  dest may be NULL and the function will only return the length of the result
+ *                  without writing any of the result string.
+ * @param src       The original string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param locale    The locale to consider, or "" for the root locale or NULL for the default locale.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ *                  which must not indicate a failure before the function call.
+ * @return The length of the result string. It may be greater than destCapacity. In that case,
+ *         only some of the result was written to the destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strToLower(UChar *dest, int32_t destCapacity,
+             const UChar *src, int32_t srcLength,
+             const char *locale,
+             UErrorCode *pErrorCode);
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+/**
+ * Titlecase a string.
+ * Casing is locale-dependent and context-sensitive.
+ * Titlecasing uses a break iterator to find the first characters of words
+ * that are to be titlecased. It titlecases those characters and lowercases
+ * all others.
+ *
+ * The titlecase break iterator can be provided to customize for arbitrary
+ * styles, using rules and dictionaries beyond the standard iterators.
+ * It may be more efficient to always provide an iterator to avoid
+ * opening and closing one for each string.
+ * The standard titlecase iterator for the root locale implements the
+ * algorithm of Unicode TR 21.
+ *
+ * This function uses only the setText(), first() and next() methods of the
+ * provided break iterator.
+ *
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer are allowed to overlap.
+ *
+ * @param dest      A buffer for the result string. The result will be zero-terminated if
+ *                  the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ *                  dest may be NULL and the function will only return the length of the result
+ *                  without writing any of the result string.
+ * @param src       The original string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param titleIter A break iterator to find the first characters of words
+ *                  that are to be titlecased.
+ *                  If none is provided (NULL), then a standard titlecase
+ *                  break iterator is opened.
+ * @param locale    The locale to consider, or "" for the root locale or NULL for the default locale.
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ *                  which must not indicate a failure before the function call.
+ * @return The length of the result string. It may be greater than destCapacity. In that case,
+ *         only some of the result was written to the destination buffer.
+ * @stable ICU 2.1
+ */
+U_STABLE int32_t U_EXPORT2
+u_strToTitle(UChar *dest, int32_t destCapacity,
+             const UChar *src, int32_t srcLength,
+             UBreakIterator *titleIter,
+             const char *locale,
+             UErrorCode *pErrorCode);
+
+#endif
+
+/**
+ * Case-fold the characters in a string.
+ * Case-folding is locale-independent and not context-sensitive,
+ * but there is an option for whether to include or exclude mappings for dotted I
+ * and dotless i that are marked with 'I' in CaseFolding.txt.
+ * The result may be longer or shorter than the original.
+ * The source string and the destination buffer are allowed to overlap.
+ *
+ * @param dest      A buffer for the result string. The result will be zero-terminated if
+ *                  the buffer is large enough.
+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then
+ *                  dest may be NULL and the function will only return the length of the result
+ *                  without writing any of the result string.
+ * @param src       The original string
+ * @param srcLength The length of the original string. If -1, then src must be zero-terminated.
+ * @param options   Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I
+ * @param pErrorCode Must be a valid pointer to an error code value,
+ *                  which must not indicate a failure before the function call.
+ * @return The length of the result string. It may be greater than destCapacity. In that case,
+ *         only some of the result was written to the destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_strFoldCase(UChar *dest, int32_t destCapacity,
+              const UChar *src, int32_t srcLength,
+              uint32_t options,
+              UErrorCode *pErrorCode);
+
+#if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION
+/**
+ * Convert a UTF-16 string to a wchar_t string.
+ * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then
+ * this function simply calls the fast, dedicated function for that.
+ * Otherwise, two conversions UTF-16 -> default charset -> wchar_t* are performed.
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of wchar_t's). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the 
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If 
+ *                      pDestLength!=NULL then *pDestLength is always set to the 
+ *                      number of output units corresponding to the transformation of 
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode    Must be a valid pointer to an error code value,
+ *                      which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE wchar_t* U_EXPORT2
+u_strToWCS(wchar_t *dest, 
+           int32_t destCapacity,
+           int32_t *pDestLength,
+           const UChar *src, 
+           int32_t srcLength,
+           UErrorCode *pErrorCode);
+/**
+ * Convert a wchar_t string to UTF-16.
+ * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then
+ * this function simply calls the fast, dedicated function for that.
+ * Otherwise, two conversions wchar_t* -> default charset -> UTF-16 are performed.
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the 
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If 
+ *                      pDestLength!=NULL then *pDestLength is always set to the 
+ *                      number of output units corresponding to the transformation of 
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode    Must be a valid pointer to an error code value,
+ *                      which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2
+u_strFromWCS(UChar   *dest,
+             int32_t destCapacity, 
+             int32_t *pDestLength,
+             const wchar_t *src,
+             int32_t srcLength,
+             UErrorCode *pErrorCode);
+#endif /* defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION */
+
+/**
+ * Convert a UTF-16 string to UTF-8.
+ * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of chars). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the 
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If 
+ *                      pDestLength!=NULL then *pDestLength is always set to the 
+ *                      number of output units corresponding to the transformation of 
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode    Must be a valid pointer to an error code value,
+ *                      which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @stable ICU 2.0
+ * @see u_strToUTF8WithSub
+ * @see u_strFromUTF8
+ */
+U_STABLE char* U_EXPORT2 
+u_strToUTF8(char *dest,           
+            int32_t destCapacity,
+            int32_t *pDestLength,
+            const UChar *src, 
+            int32_t srcLength,
+            UErrorCode *pErrorCode);
+
+/**
+ * Convert a UTF-8 string to UTF-16.
+ * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the 
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If 
+ *                      pDestLength!=NULL then *pDestLength is always set to the 
+ *                      number of output units corresponding to the transformation of 
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode    Must be a valid pointer to an error code value,
+ *                      which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @stable ICU 2.0
+ * @see u_strFromUTF8WithSub
+ * @see u_strFromUTF8Lenient
+ */
+U_STABLE UChar* U_EXPORT2
+u_strFromUTF8(UChar *dest,             
+              int32_t destCapacity,
+              int32_t *pDestLength,
+              const char *src, 
+              int32_t srcLength,
+              UErrorCode *pErrorCode);
+
+/**
+ * Convert a UTF-16 string to UTF-8.
+ * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
+ *
+ * Same as u_strToUTF8() except for the additional subchar which is output for
+ * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code.
+ * With subchar==U_SENTINEL, this function behaves exactly like u_strToUTF8().
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of chars). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the 
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If 
+ *                      pDestLength!=NULL then *pDestLength is always set to the 
+ *                      number of output units corresponding to the transformation of 
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param subchar       The substitution character to use in place of an illegal input sequence,
+ *                      or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead.
+ *                      A substitution character can be any valid Unicode code point (up to U+10FFFF)
+ *                      except for surrogate code points (U+D800..U+DFFF).
+ *                      The recommended value is U+FFFD "REPLACEMENT CHARACTER".
+ * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0.
+ *                      Set to 0 if no substitutions occur or subchar<0.
+ *                      pNumSubstitutions can be NULL.
+ * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
+ *                      pass the U_SUCCESS() test, or else the function returns
+ *                      immediately. Check for U_FAILURE() on output or use with
+ *                      function chaining. (See User Guide for details.)
+ * @return The pointer to destination buffer.
+ * @see u_strToUTF8
+ * @see u_strFromUTF8WithSub
+ * @stable ICU 3.6
+ */
+U_STABLE char* U_EXPORT2
+u_strToUTF8WithSub(char *dest,
+            int32_t destCapacity,
+            int32_t *pDestLength,
+            const UChar *src,
+            int32_t srcLength,
+            UChar32 subchar, int32_t *pNumSubstitutions,
+            UErrorCode *pErrorCode);
+
+/**
+ * Convert a UTF-8 string to UTF-16.
+ * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
+ *
+ * Same as u_strFromUTF8() except for the additional subchar which is output for
+ * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code.
+ * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF8().
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the 
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If 
+ *                      pDestLength!=NULL then *pDestLength is always set to the 
+ *                      number of output units corresponding to the transformation of 
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param subchar       The substitution character to use in place of an illegal input sequence,
+ *                      or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead.
+ *                      A substitution character can be any valid Unicode code point (up to U+10FFFF)
+ *                      except for surrogate code points (U+D800..U+DFFF).
+ *                      The recommended value is U+FFFD "REPLACEMENT CHARACTER".
+ * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0.
+ *                      Set to 0 if no substitutions occur or subchar<0.
+ *                      pNumSubstitutions can be NULL.
+ * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
+ *                      pass the U_SUCCESS() test, or else the function returns
+ *                      immediately. Check for U_FAILURE() on output or use with
+ *                      function chaining. (See User Guide for details.)
+ * @return The pointer to destination buffer.
+ * @see u_strFromUTF8
+ * @see u_strFromUTF8Lenient
+ * @see u_strToUTF8WithSub
+ * @stable ICU 3.6
+ */
+U_STABLE UChar* U_EXPORT2
+u_strFromUTF8WithSub(UChar *dest,
+              int32_t destCapacity,
+              int32_t *pDestLength,
+              const char *src,
+              int32_t srcLength,
+              UChar32 subchar, int32_t *pNumSubstitutions,
+              UErrorCode *pErrorCode);
+
+/**
+ * Convert a UTF-8 string to UTF-16.
+ *
+ * Same as u_strFromUTF8() except that this function is designed to be very fast,
+ * which it achieves by being lenient about malformed UTF-8 sequences.
+ * This function is intended for use in environments where UTF-8 text is
+ * expected to be well-formed.
+ *
+ * Its semantics are:
+ * - Well-formed UTF-8 text is correctly converted to well-formed UTF-16 text.
+ * - The function will not read beyond the input string, nor write beyond
+ *   the destCapacity.
+ * - Malformed UTF-8 results in "garbage" 16-bit Unicode strings which may not
+ *   be well-formed UTF-16.
+ *   The function will resynchronize to valid code point boundaries
+ *   within a small number of code points after an illegal sequence.
+ * - Non-shortest forms are not detected and will result in "spoofing" output.
+ *
+ * For further performance improvement, if srcLength is given (>=0),
+ * then it must be destCapacity>=srcLength.
+ *
+ * There is no inverse u_strToUTF8Lenient() function because there is practically
+ * no performance gain from not checking that a UTF-16 string is well-formed.
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the 
+ *                      result without writing any of the result string (pre-flighting).
+ *                      Unlike for other ICU functions, if srcLength>=0 then it
+ *                      must be destCapacity>=srcLength.
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If 
+ *                      pDestLength!=NULL then *pDestLength is always set to the 
+ *                      number of output units corresponding to the transformation of 
+ *                      all the input units, even in case of a buffer overflow.
+ *                      Unlike for other ICU functions, if srcLength>=0 but
+ *                      destCapacity<srcLength, then *pDestLength will be set to srcLength
+ *                      (and U_BUFFER_OVERFLOW_ERROR will be set)
+ *                      regardless of the actual result length.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
+ *                      pass the U_SUCCESS() test, or else the function returns
+ *                      immediately. Check for U_FAILURE() on output or use with
+ *                      function chaining. (See User Guide for details.)
+ * @return The pointer to destination buffer.
+ * @see u_strFromUTF8
+ * @see u_strFromUTF8WithSub
+ * @see u_strToUTF8WithSub
+ * @stable ICU 3.6
+ */
+U_STABLE UChar * U_EXPORT2
+u_strFromUTF8Lenient(UChar *dest,
+                     int32_t destCapacity,
+                     int32_t *pDestLength,
+                     const char *src,
+                     int32_t srcLength,
+                     UErrorCode *pErrorCode);
+
+/**
+ * Convert a UTF-16 string to UTF-32.
+ * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of UChar32s). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the 
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If 
+ *                      pDestLength!=NULL then *pDestLength is always set to the 
+ *                      number of output units corresponding to the transformation of 
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode    Must be a valid pointer to an error code value,
+ *                      which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @see u_strToUTF32WithSub
+ * @see u_strFromUTF32
+ * @stable ICU 2.0
+ */
+U_STABLE UChar32* U_EXPORT2 
+u_strToUTF32(UChar32 *dest, 
+             int32_t  destCapacity,
+             int32_t  *pDestLength,
+             const UChar *src, 
+             int32_t  srcLength,
+             UErrorCode *pErrorCode);
+
+/**
+ * Convert a UTF-32 string to UTF-16.
+ * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the 
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If 
+ *                      pDestLength!=NULL then *pDestLength is always set to the 
+ *                      number of output units corresponding to the transformation of 
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode    Must be a valid pointer to an error code value,
+ *                      which must not indicate a failure before the function call.
+ * @return The pointer to destination buffer.
+ * @see u_strFromUTF32WithSub
+ * @see u_strToUTF32
+ * @stable ICU 2.0
+ */
+U_STABLE UChar* U_EXPORT2 
+u_strFromUTF32(UChar   *dest,
+               int32_t destCapacity, 
+               int32_t *pDestLength,
+               const UChar32 *src,
+               int32_t srcLength,
+               UErrorCode *pErrorCode);
+
+/**
+ * Convert a UTF-16 string to UTF-32.
+ * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
+ *
+ * Same as u_strToUTF32() except for the additional subchar which is output for
+ * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code.
+ * With subchar==U_SENTINEL, this function behaves exactly like u_strToUTF32().
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of UChar32s). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If
+ *                      pDestLength!=NULL then *pDestLength is always set to the
+ *                      number of output units corresponding to the transformation of
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param subchar       The substitution character to use in place of an illegal input sequence,
+ *                      or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead.
+ *                      A substitution character can be any valid Unicode code point (up to U+10FFFF)
+ *                      except for surrogate code points (U+D800..U+DFFF).
+ *                      The recommended value is U+FFFD "REPLACEMENT CHARACTER".
+ * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0.
+ *                      Set to 0 if no substitutions occur or subchar<0.
+ *                      pNumSubstitutions can be NULL.
+ * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
+ *                      pass the U_SUCCESS() test, or else the function returns
+ *                      immediately. Check for U_FAILURE() on output or use with
+ *                      function chaining. (See User Guide for details.)
+ * @return The pointer to destination buffer.
+ * @see u_strToUTF32
+ * @see u_strFromUTF32WithSub
+ * @stable ICU 4.2
+ */
+U_STABLE UChar32* U_EXPORT2
+u_strToUTF32WithSub(UChar32 *dest,
+             int32_t destCapacity,
+             int32_t *pDestLength,
+             const UChar *src,
+             int32_t srcLength,
+             UChar32 subchar, int32_t *pNumSubstitutions,
+             UErrorCode *pErrorCode);
+
+/**
+ * Convert a UTF-32 string to UTF-16.
+ * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
+ *
+ * Same as u_strFromUTF32() except for the additional subchar which is output for
+ * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code.
+ * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF32().
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If
+ *                      pDestLength!=NULL then *pDestLength is always set to the
+ *                      number of output units corresponding to the transformation of
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param subchar       The substitution character to use in place of an illegal input sequence,
+ *                      or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead.
+ *                      A substitution character can be any valid Unicode code point (up to U+10FFFF)
+ *                      except for surrogate code points (U+D800..U+DFFF).
+ *                      The recommended value is U+FFFD "REPLACEMENT CHARACTER".
+ * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0.
+ *                      Set to 0 if no substitutions occur or subchar<0.
+ *                      pNumSubstitutions can be NULL.
+ * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
+ *                      pass the U_SUCCESS() test, or else the function returns
+ *                      immediately. Check for U_FAILURE() on output or use with
+ *                      function chaining. (See User Guide for details.)
+ * @return The pointer to destination buffer.
+ * @see u_strFromUTF32
+ * @see u_strToUTF32WithSub
+ * @stable ICU 4.2
+ */
+U_STABLE UChar* U_EXPORT2
+u_strFromUTF32WithSub(UChar *dest,
+               int32_t destCapacity,
+               int32_t *pDestLength,
+               const UChar32 *src,
+               int32_t srcLength,
+               UChar32 subchar, int32_t *pNumSubstitutions,
+               UErrorCode *pErrorCode);
+
+/**
+ * Convert a 16-bit Unicode string to Java Modified UTF-8.
+ * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8
+ *
+ * This function behaves according to the documentation for Java DataOutput.writeUTF()
+ * except that it does not encode the output length in the destination buffer
+ * and does not have an output length restriction.
+ * See http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html#writeUTF(java.lang.String)
+ *
+ * The input string need not be well-formed UTF-16.
+ * (Therefore there is no subchar parameter.)
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of chars). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the 
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If 
+ *                      pDestLength!=NULL then *pDestLength is always set to the 
+ *                      number of output units corresponding to the transformation of 
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
+ *                      pass the U_SUCCESS() test, or else the function returns
+ *                      immediately. Check for U_FAILURE() on output or use with
+ *                      function chaining. (See User Guide for details.)
+ * @return The pointer to destination buffer.
+ * @stable ICU 4.4
+ * @see u_strToUTF8WithSub
+ * @see u_strFromJavaModifiedUTF8WithSub
+ */
+U_STABLE char* U_EXPORT2 
+u_strToJavaModifiedUTF8(
+        char *dest,
+        int32_t destCapacity,
+        int32_t *pDestLength,
+        const UChar *src, 
+        int32_t srcLength,
+        UErrorCode *pErrorCode);
+
+/**
+ * Convert a Java Modified UTF-8 string to a 16-bit Unicode string.
+ * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
+ *
+ * This function behaves according to the documentation for Java DataInput.readUTF()
+ * except that it takes a length parameter rather than
+ * interpreting the first two input bytes as the length.
+ * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#readUTF()
+ *
+ * The output string may not be well-formed UTF-16.
+ *
+ * @param dest          A buffer for the result string. The result will be zero-terminated if
+ *                      the buffer is large enough.
+ * @param destCapacity  The size of the buffer (number of UChars). If it is 0, then
+ *                      dest may be NULL and the function will only return the length of the 
+ *                      result without writing any of the result string (pre-flighting).
+ * @param pDestLength   A pointer to receive the number of units written to the destination. If 
+ *                      pDestLength!=NULL then *pDestLength is always set to the 
+ *                      number of output units corresponding to the transformation of 
+ *                      all the input units, even in case of a buffer overflow.
+ * @param src           The original source string
+ * @param srcLength     The length of the original string. If -1, then src must be zero-terminated.
+ * @param subchar       The substitution character to use in place of an illegal input sequence,
+ *                      or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead.
+ *                      A substitution character can be any valid Unicode code point (up to U+10FFFF)
+ *                      except for surrogate code points (U+D800..U+DFFF).
+ *                      The recommended value is U+FFFD "REPLACEMENT CHARACTER".
+ * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0.
+ *                      Set to 0 if no substitutions occur or subchar<0.
+ *                      pNumSubstitutions can be NULL.
+ * @param pErrorCode    Pointer to a standard ICU error code. Its input value must
+ *                      pass the U_SUCCESS() test, or else the function returns
+ *                      immediately. Check for U_FAILURE() on output or use with
+ *                      function chaining. (See User Guide for details.)
+ * @return The pointer to destination buffer.
+ * @see u_strFromUTF8WithSub
+ * @see u_strFromUTF8Lenient
+ * @see u_strToJavaModifiedUTF8
+ * @stable ICU 4.4
+ */
+U_STABLE UChar* U_EXPORT2
+u_strFromJavaModifiedUTF8WithSub(
+        UChar *dest,
+        int32_t destCapacity,
+        int32_t *pDestLength,
+        const char *src,
+        int32_t srcLength,
+        UChar32 subchar, int32_t *pNumSubstitutions,
+        UErrorCode *pErrorCode);
+
+#endif
diff --git a/Source/WTF/icu/unicode/utf.h b/Source/WTF/icu/unicode/utf.h
new file mode 100644
index 0000000..f794799
--- /dev/null
+++ b/Source/WTF/icu/unicode/utf.h
@@ -0,0 +1,236 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 1999-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  utf.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 1999sep09
+*   created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: Code point macros
+ *
+ * This file defines macros for checking whether a code point is
+ * a surrogate or a non-character etc.
+ *
+ * The UChar and UChar32 data types for Unicode code units and code points
+ * are defined in umachines.h because they can be machine-dependent.
+ *
+ * utf.h is included by utypes.h and itself includes utf8.h and utf16.h after some
+ * common definitions. Those files define macros for efficiently getting code points
+ * in and out of UTF-8/16 strings.
+ * utf16.h macros have "U16_" prefixes.
+ * utf8.h defines similar macros with "U8_" prefixes for UTF-8 string handling.
+ *
+ * ICU processes 16-bit Unicode strings.
+ * Most of the time, such strings are well-formed UTF-16.
+ * Single, unpaired surrogates must be handled as well, and are treated in ICU
+ * like regular code points where possible.
+ * (Pairs of surrogate code points are indistinguishable from supplementary
+ * code points encoded as pairs of supplementary code units.)
+ *
+ * In fact, almost all Unicode code points in normal text (>99%)
+ * are on the BMP (<=U+ffff) and even <=U+d7ff.
+ * ICU functions handle supplementary code points (U+10000..U+10ffff)
+ * but are optimized for the much more frequently occurring BMP code points.
+ *
+ * utf.h defines UChar to be an unsigned 16-bit integer. If this matches wchar_t, then
+ * UChar is defined to be exactly wchar_t, otherwise uint16_t.
+ *
+ * UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit
+ * Unicode code point (Unicode scalar value, 0..0x10ffff).
+ * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as
+ * the definition of UChar. For details see the documentation for UChar32 itself.
+ *
+ * utf.h also defines a small number of C macros for single Unicode code points.
+ * These are simple checks for surrogates and non-characters.
+ * For actual Unicode character properties see uchar.h.
+ *
+ * By default, string operations must be done with error checking in case
+ * a string is not well-formed UTF-16.
+ * The macros will detect if a surrogate code unit is unpaired
+ * (lead unit without trail unit or vice versa) and just return the unit itself
+ * as the code point.
+ * (It is an accidental property of Unicode and UTF-16 that all
+ * malformed sequences can be expressed unambiguously with a distinct subrange
+ * of Unicode code points.)
+ *
+ * The regular "safe" macros require that the initial, passed-in string index
+ * is within bounds. They only check the index when they read more than one
+ * code unit. This is usually done with code similar to the following loop:
+ * <pre>while(i<length) {
+ *   U16_NEXT(s, i, length, c);
+ *   // use c
+ * }</pre>
+ *
+ * When it is safe to assume that text is well-formed UTF-16
+ * (does not contain single, unpaired surrogates), then one can use
+ * U16_..._UNSAFE macros.
+ * These do not check for proper code unit sequences or truncated text and may
+ * yield wrong results or even cause a crash if they are used with "malformed"
+ * text.
+ * In practice, U16_..._UNSAFE macros will produce slightly less code but
+ * should not be faster because the processing is only different when a
+ * surrogate code unit is detected, which will be rare.
+ *
+ * Similarly for UTF-8, there are "safe" macros without a suffix,
+ * and U8_..._UNSAFE versions.
+ * The performance differences are much larger here because UTF-8 provides so
+ * many opportunities for malformed sequences.
+ * The unsafe UTF-8 macros are entirely implemented inside the macro definitions
+ * and are fast, while the safe UTF-8 macros call functions for all but the
+ * trivial (ASCII) cases.
+ * (ICU 3.6 optimizes U8_NEXT() and U8_APPEND() to handle most other common
+ * characters inline as well.)
+ *
+ * Unlike with UTF-16, malformed sequences cannot be expressed with distinct
+ * code point values (0..U+10ffff). They are indicated with negative values instead.
+ *
+ * For more information see the ICU User Guide Strings chapter
+ * (http://icu-project.org/userguide/strings.html).
+ *
+ * <em>Usage:</em>
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used  for if-else-while... 
+ * bodies and all macro statements should be terminated with semicolon.
+ *
+ * @stable ICU 2.4
+ */
+
+#ifndef __UTF_H__
+#define __UTF_H__
+
+#include "unicode/utypes.h"
+/* include the utfXX.h after the following definitions */
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * This value is intended for sentinel values for APIs that
+ * (take or) return single code points (UChar32).
+ * It is outside of the Unicode code point range 0..0x10ffff.
+ * 
+ * For example, a "done" or "error" value in a new API
+ * could be indicated with U_SENTINEL.
+ *
+ * ICU APIs designed before ICU 2.4 usually define service-specific "done"
+ * values, mostly 0xffff.
+ * Those may need to be distinguished from
+ * actual U+ffff text contents by calling functions like
+ * CharacterIterator::hasNext() or UnicodeString::length().
+ *
+ * @return -1
+ * @see UChar32
+ * @stable ICU 2.4
+ */
+#define U_SENTINEL (-1)
+
+/**
+ * Is this code point a Unicode noncharacter?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_UNICODE_NONCHAR(c) \
+    ((c)>=0xfdd0 && \
+     ((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \
+     (uint32_t)(c)<=0x10ffff)
+
+/**
+ * Is c a Unicode code point value (0..U+10ffff)
+ * that can be assigned a character?
+ *
+ * Code points that are not characters include:
+ * - single surrogate code points (U+d800..U+dfff, 2048 code points)
+ * - the last two code points on each plane (U+__fffe and U+__ffff, 34 code points)
+ * - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points)
+ * - the highest Unicode code point value is U+10ffff
+ *
+ * This means that all code points below U+d800 are character code points,
+ * and that boundary is tested first for performance.
+ *
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_UNICODE_CHAR(c) \
+    ((uint32_t)(c)<0xd800 || \
+        ((uint32_t)(c)>0xdfff && \
+         (uint32_t)(c)<=0x10ffff && \
+         !U_IS_UNICODE_NONCHAR(c)))
+
+/**
+ * Is this code point a BMP code point (U+0000..U+ffff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.8
+ */
+#define U_IS_BMP(c) ((uint32_t)(c)<=0xffff)
+
+/**
+ * Is this code point a supplementary code point (U+10000..U+10ffff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.8
+ */
+#define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff)
+ 
+/**
+ * Is this code point a lead surrogate (U+d800..U+dbff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
+
+/**
+ * Is this code point a trail surrogate (U+dc00..U+dfff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
+
+/**
+ * Is this code point a surrogate (U+d800..U+dfff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
+
+/**
+ * Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
+ * is it a lead surrogate?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
+
+/**
+ * Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
+ * is it a trail surrogate?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 4.2
+ */
+#define U_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
+
+/* include the utfXX.h ------------------------------------------------------ */
+
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
+
+/* utf_old.h contains deprecated, pre-ICU 2.4 definitions */
+#include "unicode/utf_old.h"
+
+#endif
diff --git a/Source/WTF/icu/unicode/utf16.h b/Source/WTF/icu/unicode/utf16.h
new file mode 100644
index 0000000..5079c11
--- /dev/null
+++ b/Source/WTF/icu/unicode/utf16.h
@@ -0,0 +1,614 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 1999-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  utf16.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 1999sep09
+*   created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: 16-bit Unicode handling macros
+ * 
+ * This file defines macros to deal with 16-bit Unicode (UTF-16) code units and strings.
+ * utf16.h is included by utf.h after unicode/umachine.h
+ * and some common definitions.
+ *
+ * For more information see utf.h and the ICU User Guide Strings chapter
+ * (http://icu-project.org/userguide/strings.html).
+ *
+ * <em>Usage:</em>
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used  for if-else-while... 
+ * bodies and all macro statements should be terminated with semicolon.
+ */
+
+#ifndef __UTF16_H__
+#define __UTF16_H__
+
+/* utf.h must be included first. */
+#ifndef __UTF_H__
+#   include "unicode/utf.h"
+#endif
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * Does this code unit alone encode a code point (BMP, not a surrogate)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c)
+
+/**
+ * Is this code unit a lead surrogate (U+d800..U+dbff)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
+
+/**
+ * Is this code unit a trail surrogate (U+dc00..U+dfff)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
+
+/**
+ * Is this code unit a surrogate (U+d800..U+dfff)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)
+
+/**
+ * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)),
+ * is it a lead surrogate?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
+
+/**
+ * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)),
+ * is it a trail surrogate?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 4.2
+ */
+#define U16_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
+
+/**
+ * Helper constant for U16_GET_SUPPLEMENTARY.
+ * @internal
+ */
+#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
+
+/**
+ * Get a supplementary code point value (U+10000..U+10ffff)
+ * from its lead and trail surrogates.
+ * The result is undefined if the input values are not
+ * lead and trail surrogates.
+ *
+ * @param lead lead surrogate (U+d800..U+dbff)
+ * @param trail trail surrogate (U+dc00..U+dfff)
+ * @return supplementary code point (U+10000..U+10ffff)
+ * @stable ICU 2.4
+ */
+#define U16_GET_SUPPLEMENTARY(lead, trail) \
+    (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET)
+
+
+/**
+ * Get the lead surrogate (0xd800..0xdbff) for a
+ * supplementary code point (0x10000..0x10ffff).
+ * @param supplementary 32-bit code point (U+10000..U+10ffff)
+ * @return lead surrogate (U+d800..U+dbff) for supplementary
+ * @stable ICU 2.4
+ */
+#define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0)
+
+/**
+ * Get the trail surrogate (0xdc00..0xdfff) for a
+ * supplementary code point (0x10000..0x10ffff).
+ * @param supplementary 32-bit code point (U+10000..U+10ffff)
+ * @return trail surrogate (U+dc00..U+dfff) for supplementary
+ * @stable ICU 2.4
+ */
+#define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00)
+
+/**
+ * How many 16-bit code units are used to encode this Unicode code point? (1 or 2)
+ * The result is not defined if c is not a Unicode code point (U+0000..U+10ffff).
+ * @param c 32-bit code point
+ * @return 1 or 2
+ * @stable ICU 2.4
+ */
+#define U16_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2)
+
+/**
+ * The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff).
+ * @return 2
+ * @stable ICU 2.4
+ */
+#define U16_MAX_LENGTH 2
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The offset may point to either the lead or trail surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the adjacent matching surrogate as well.
+ * The result is undefined if the offset points to a single, unpaired surrogate.
+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_GET
+ * @stable ICU 2.4
+ */
+#define U16_GET_UNSAFE(s, i, c) { \
+    (c)=(s)[i]; \
+    if(U16_IS_SURROGATE(c)) { \
+        if(U16_IS_SURROGATE_LEAD(c)) { \
+            (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)+1]); \
+        } else { \
+            (c)=U16_GET_SUPPLEMENTARY((s)[(i)-1], (c)); \
+        } \
+    } \
+}
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The offset may point to either the lead or trail surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the adjacent matching surrogate as well.
+ * If the offset points to a single, unpaired surrogate, then that itself
+ * will be returned as the code point.
+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<=i<length
+ * @param length string length
+ * @param c output UChar32 variable
+ * @see U16_GET_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_GET(s, start, i, length, c) { \
+    (c)=(s)[i]; \
+    if(U16_IS_SURROGATE(c)) { \
+        uint16_t __c2; \
+        if(U16_IS_SURROGATE_LEAD(c)) { \
+            if((i)+1<(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \
+                (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
+            } \
+        } else { \
+            if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+                (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+            } \
+        } \
+    } \
+}
+
+/* definitions with forward iteration --------------------------------------- */
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The offset may point to the lead surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the following trail surrogate as well.
+ * If the offset points to a trail surrogate, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset points to a single, unpaired lead surrogate.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_NEXT
+ * @stable ICU 2.4
+ */
+#define U16_NEXT_UNSAFE(s, i, c) { \
+    (c)=(s)[(i)++]; \
+    if(U16_IS_LEAD(c)) { \
+        (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)++]); \
+    } \
+}
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The offset may point to the lead surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the following trail surrogate as well.
+ * If the offset points to a trail surrogate or
+ * to a single, unpaired lead surrogate, then that itself
+ * will be returned as the code point.
+ *
+ * @param s const UChar * string
+ * @param i string offset, must be i<length
+ * @param length string length
+ * @param c output UChar32 variable
+ * @see U16_NEXT_UNSAFE
+ * @stable ICU 2.4
+ */
+#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); \
+        } \
+    } \
+}
+
+/**
+ * Append a code point to a string, overwriting 1 or 2 code units.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Unsafe" macro, assumes a valid code point and sufficient space in the string.
+ * Otherwise, the result is undefined.
+ *
+ * @param s const UChar * string buffer
+ * @param i string offset
+ * @param c code point to append
+ * @see U16_APPEND
+ * @stable ICU 2.4
+ */
+#define U16_APPEND_UNSAFE(s, i, c) { \
+    if((uint32_t)(c)<=0xffff) { \
+        (s)[(i)++]=(uint16_t)(c); \
+    } else { \
+        (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
+        (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
+    } \
+}
+
+/**
+ * Append a code point to a string, overwriting 1 or 2 code units.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Safe" macro, checks for a valid code point.
+ * If a surrogate pair is written, checks for sufficient space in the string.
+ * If the code point is not valid or a trail surrogate does not fit,
+ * then isError is set to TRUE.
+ *
+ * @param s const UChar * string buffer
+ * @param i string offset, must be i<capacity
+ * @param capacity size of the string buffer
+ * @param c code point to append
+ * @param isError output UBool set to TRUE if an error occurs, otherwise not modified
+ * @see U16_APPEND_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_APPEND(s, i, capacity, c, isError) { \
+    if((uint32_t)(c)<=0xffff) { \
+        (s)[(i)++]=(uint16_t)(c); \
+    } else if((uint32_t)(c)<=0x10ffff && (i)+1<(capacity)) { \
+        (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
+        (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
+    } else /* c>0x10ffff or not enough space */ { \
+        (isError)=TRUE; \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_FWD_1
+ * @stable ICU 2.4
+ */
+#define U16_FWD_1_UNSAFE(s, i) { \
+    if(U16_IS_LEAD((s)[(i)++])) { \
+        ++(i); \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param i string offset, must be i<length
+ * @param length string length
+ * @see U16_FWD_1_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_FWD_1(s, i, length) { \
+    if(U16_IS_LEAD((s)[(i)++]) && (i)<(length) && U16_IS_TRAIL((s)[i])) { \
+        ++(i); \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U16_FWD_N
+ * @stable ICU 2.4
+ */
+#define U16_FWD_N_UNSAFE(s, i, n) { \
+    int32_t __N=(n); \
+    while(__N>0) { \
+        U16_FWD_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param i string offset, must be i<length
+ * @param length string length
+ * @param n number of code points to skip
+ * @see U16_FWD_N_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_FWD_N(s, i, length, n) { \
+    int32_t __N=(n); \
+    while(__N>0 && (i)<(length)) { \
+        U16_FWD_1(s, i, length); \
+        --__N; \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to the trail surrogate of a surrogate pair,
+ * then the offset is decremented.
+ * Otherwise, it is not modified.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_SET_CP_START
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_START_UNSAFE(s, i) { \
+    if(U16_IS_TRAIL((s)[i])) { \
+        --(i); \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to the trail surrogate of a surrogate pair,
+ * then the offset is decremented.
+ * Otherwise, it is not modified.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<=i
+ * @see U16_SET_CP_START_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_START(s, start, i) { \
+    if(U16_IS_TRAIL((s)[i]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
+        --(i); \
+    } \
+}
+
+/* definitions with backward iteration -------------------------------------- */
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a trail surrogate unit
+ * for a supplementary code point, then the macro will read
+ * the preceding lead surrogate as well.
+ * If the offset is behind a lead surrogate, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset is behind a single, unpaired trail surrogate.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_PREV
+ * @stable ICU 2.4
+ */
+#define U16_PREV_UNSAFE(s, i, c) { \
+    (c)=(s)[--(i)]; \
+    if(U16_IS_TRAIL(c)) { \
+        (c)=U16_GET_SUPPLEMENTARY((s)[--(i)], (c)); \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a trail surrogate unit
+ * for a supplementary code point, then the macro will read
+ * the preceding lead surrogate as well.
+ * If the offset is behind a lead surrogate or behind a single, unpaired
+ * trail surrogate, then that itself
+ * will be returned as the code point.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<i
+ * @param c output UChar32 variable
+ * @see U16_PREV_UNSAFE
+ * @stable ICU 2.4
+ */
+#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)); \
+        } \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_BACK_1
+ * @stable ICU 2.4
+ */
+#define U16_BACK_1_UNSAFE(s, i) { \
+    if(U16_IS_TRAIL((s)[--(i)])) { \
+        --(i); \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<i
+ * @see U16_BACK_1_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_BACK_1(s, start, i) { \
+    if(U16_IS_TRAIL((s)[--(i)]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
+        --(i); \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U16_BACK_N
+ * @stable ICU 2.4
+ */
+#define U16_BACK_N_UNSAFE(s, i, n) { \
+    int32_t __N=(n); \
+    while(__N>0) { \
+        U16_BACK_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start start of string
+ * @param i string offset, must be start<i
+ * @param n number of code points to skip
+ * @see U16_BACK_N_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_BACK_N(s, start, i, n) { \
+    int32_t __N=(n); \
+    while(__N>0 && (i)>(start)) { \
+        U16_BACK_1(s, start, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind the lead surrogate of a surrogate pair,
+ * then the offset is incremented.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_SET_CP_LIMIT
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_LIMIT_UNSAFE(s, i) { \
+    if(U16_IS_LEAD((s)[(i)-1])) { \
+        ++(i); \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind the lead surrogate of a surrogate pair,
+ * then the offset is incremented.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, start<=i<=length
+ * @param length string length
+ * @see U16_SET_CP_LIMIT_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_LIMIT(s, start, i, length) { \
+    if((start)<(i) && (i)<(length) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \
+        ++(i); \
+    } \
+}
+
+#endif
diff --git a/Source/WTF/icu/unicode/utf8.h b/Source/WTF/icu/unicode/utf8.h
new file mode 100644
index 0000000..6405795
--- /dev/null
+++ b/Source/WTF/icu/unicode/utf8.h
@@ -0,0 +1,683 @@
+/*
+*******************************************************************************
+*
+*   Copyright (C) 1999-2009, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  utf8.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 1999sep13
+*   created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: 8-bit Unicode handling macros
+ * 
+ * This file defines macros to deal with 8-bit Unicode (UTF-8) code units (bytes) and strings.
+ * utf8.h is included by utf.h after unicode/umachine.h
+ * and some common definitions.
+ *
+ * For more information see utf.h and the ICU User Guide Strings chapter
+ * (http://icu-project.org/userguide/strings.html).
+ *
+ * <em>Usage:</em>
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used  for if-else-while... 
+ * bodies and all macro statements should be terminated with semicolon.
+ */
+
+#ifndef __UTF8_H__
+#define __UTF8_H__
+
+/* utf.h must be included first. */
+#ifndef __UTF_H__
+#   include "unicode/utf.h"
+#endif
+
+/* internal definitions ----------------------------------------------------- */
+
+/**
+ * \var utf8_countTrailBytes
+ * Internal array with numbers of trail bytes for any given byte used in
+ * lead byte position.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this file and thus must remain stable,
+ * and should not be hidden when other internal functions are hidden (otherwise
+ * public macros would fail to compile).
+ * @internal
+ */
+#ifdef U_UTF8_IMPL
+U_EXPORT const uint8_t 
+#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION)
+U_CFUNC const uint8_t
+#else
+U_CFUNC U_IMPORT const uint8_t /* U_IMPORT2? */ /*U_IMPORT*/ 
+#endif
+utf8_countTrailBytes[256];
+
+/**
+ * Count the trail bytes for a UTF-8 lead byte.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this file and thus must remain stable.
+ * @internal
+ */
+#define U8_COUNT_TRAIL_BYTES(leadByte) (utf8_countTrailBytes[(uint8_t)leadByte])
+
+/**
+ * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this file and thus must remain stable.
+ * @internal
+ */
+#define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1)
+
+/**
+ * Function for handling "next code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_STABLE UChar32 U_EXPORT2
+utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict);
+
+/**
+ * Function for handling "append code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_STABLE int32_t U_EXPORT2
+utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError);
+
+/**
+ * Function for handling "previous code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_STABLE UChar32 U_EXPORT2
+utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict);
+
+/**
+ * Function for handling "skip backward one code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_STABLE int32_t U_EXPORT2
+utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * Does this code unit (byte) encode a code point by itself (US-ASCII 0..0x7f)?
+ * @param c 8-bit code unit (byte)
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U8_IS_SINGLE(c) (((c)&0x80)==0)
+
+/**
+ * Is this code unit (byte) a UTF-8 lead byte?
+ * @param c 8-bit code unit (byte)
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc0)<0x3e)
+
+/**
+ * Is this code unit (byte) a UTF-8 trail byte?
+ * @param c 8-bit code unit (byte)
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U8_IS_TRAIL(c) (((c)&0xc0)==0x80)
+
+/**
+ * How many code units (bytes) are used for the UTF-8 encoding
+ * of this Unicode code point?
+ * @param c 32-bit code point
+ * @return 1..4, or 0 if c is a surrogate or not a Unicode code point
+ * @stable ICU 2.4
+ */
+#define U8_LENGTH(c) \
+    ((uint32_t)(c)<=0x7f ? 1 : \
+        ((uint32_t)(c)<=0x7ff ? 2 : \
+            ((uint32_t)(c)<=0xd7ff ? 3 : \
+                ((uint32_t)(c)<=0xdfff || (uint32_t)(c)>0x10ffff ? 0 : \
+                    ((uint32_t)(c)<=0xffff ? 3 : 4)\
+                ) \
+            ) \
+        ) \
+    )
+
+/**
+ * The maximum number of UTF-8 code units (bytes) per Unicode code point (U+0000..U+10ffff).
+ * @return 4
+ * @stable ICU 2.4
+ */
+#define U8_MAX_LENGTH 4
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * The offset may point to either the lead byte or one of the trail bytes
+ * for a code point, in which case the macro will read all of the bytes
+ * for the code point.
+ * The result is undefined if the offset points to an illegal UTF-8
+ * byte sequence.
+ * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U8_GET
+ * @stable ICU 2.4
+ */
+#define U8_GET_UNSAFE(s, i, c) { \
+    int32_t _u8_get_unsafe_index=(int32_t)(i); \
+    U8_SET_CP_START_UNSAFE(s, _u8_get_unsafe_index); \
+    U8_NEXT_UNSAFE(s, _u8_get_unsafe_index, c); \
+}
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * The offset may point to either the lead byte or one of the trail bytes
+ * for a code point, in which case the macro will read all of the bytes
+ * for the code point.
+ * If the offset points to an illegal UTF-8 byte sequence, then
+ * c is set to a negative value.
+ * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
+ *
+ * @param s const uint8_t * string
+ * @param start starting string offset
+ * @param i string offset, must be start<=i<length
+ * @param length string length
+ * @param c output UChar32 variable, set to <0 in case of an error
+ * @see U8_GET_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_GET(s, start, i, length, c) { \
+    int32_t _u8_get_index=(int32_t)(i); \
+    U8_SET_CP_START(s, start, _u8_get_index); \
+    U8_NEXT(s, _u8_get_index, length, c); \
+}
+
+/* definitions with forward iteration --------------------------------------- */
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * The offset may point to the lead byte of a multi-byte sequence,
+ * in which case the macro will read the whole sequence.
+ * The result is undefined if the offset points to a trail byte
+ * or an illegal UTF-8 sequence.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U8_NEXT
+ * @stable ICU 2.4
+ */
+#define U8_NEXT_UNSAFE(s, i, c) { \
+    (c)=(uint8_t)(s)[(i)++]; \
+    if((uint8_t)((c)-0xc0)<0x35) { \
+        uint8_t __count=U8_COUNT_TRAIL_BYTES(c); \
+        U8_MASK_LEAD_BYTE(c, __count); \
+        switch(__count) { \
+        /* each following branch falls through to the next one */ \
+        case 3: \
+            (c)=((c)<<6)|((s)[(i)++]&0x3f); \
+        case 2: \
+            (c)=((c)<<6)|((s)[(i)++]&0x3f); \
+        case 1: \
+            (c)=((c)<<6)|((s)[(i)++]&0x3f); \
+        /* no other branches to optimize switch() */ \
+            break; \
+        } \
+    } \
+}
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The offset may point to the lead byte of a multi-byte sequence,
+ * in which case the macro will read the whole sequence.
+ * If the offset points to a trail byte or an illegal UTF-8 sequence, then
+ * c is set to a negative value.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset, must be i<length
+ * @param length string length
+ * @param c output UChar32 variable, set to <0 in case of an error
+ * @see U8_NEXT_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_NEXT(s, i, length, c) { \
+    (c)=(uint8_t)(s)[(i)++]; \
+    if((c)>=0x80) { \
+        uint8_t __t1, __t2; \
+        if( /* handle U+1000..U+CFFF inline */ \
+            (0xe0<(c) && (c)<=0xec) && \
+            (((i)+1)<(length)) && \
+            (__t1=(uint8_t)((s)[i]-0x80))<=0x3f && \
+            (__t2=(uint8_t)((s)[(i)+1]-0x80))<= 0x3f \
+        ) { \
+            /* no need for (c&0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */ \
+            (c)=(UChar)(((c)<<12)|(__t1<<6)|__t2); \
+            (i)+=2; \
+        } else if( /* handle U+0080..U+07FF inline */ \
+            ((c)<0xe0 && (c)>=0xc2) && \
+            ((i)<(length)) && \
+            (__t1=(uint8_t)((s)[i]-0x80))<=0x3f \
+        ) { \
+            (c)=(UChar)((((c)&0x1f)<<6)|__t1); \
+            ++(i); \
+        } else if(U8_IS_LEAD(c)) { \
+            /* function call for "complicated" and error cases */ \
+            (c)=utf8_nextCharSafeBody((const uint8_t *)s, &(i), (int32_t)(length), c, -1); \
+        } else { \
+            (c)=U_SENTINEL; \
+        } \
+    } \
+}
+
+/**
+ * Append a code point to a string, overwriting 1 to 4 bytes.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Unsafe" macro, assumes a valid code point and sufficient space in the string.
+ * Otherwise, the result is undefined.
+ *
+ * @param s const uint8_t * string buffer
+ * @param i string offset
+ * @param c code point to append
+ * @see U8_APPEND
+ * @stable ICU 2.4
+ */
+#define U8_APPEND_UNSAFE(s, i, c) { \
+    if((uint32_t)(c)<=0x7f) { \
+        (s)[(i)++]=(uint8_t)(c); \
+    } else { \
+        if((uint32_t)(c)<=0x7ff) { \
+            (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \
+        } else { \
+            if((uint32_t)(c)<=0xffff) { \
+                (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \
+            } else { \
+                (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \
+                (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80); \
+            } \
+            (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \
+        } \
+        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
+    } \
+}
+
+/**
+ * Append a code point to a string, overwriting 1 to 4 bytes.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Safe" macro, checks for a valid code point.
+ * If a non-ASCII code point is written, checks for sufficient space in the string.
+ * If the code point is not valid or trail bytes do not fit,
+ * then isError is set to TRUE.
+ *
+ * @param s const uint8_t * string buffer
+ * @param i string offset, must be i<capacity
+ * @param capacity size of the string buffer
+ * @param c code point to append
+ * @param isError output UBool set to TRUE if an error occurs, otherwise not modified
+ * @see U8_APPEND_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_APPEND(s, i, capacity, c, isError) { \
+    if((uint32_t)(c)<=0x7f) { \
+        (s)[(i)++]=(uint8_t)(c); \
+    } else if((uint32_t)(c)<=0x7ff && (i)+1<(capacity)) { \
+        (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \
+        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
+    } else if((uint32_t)(c)<=0xd7ff && (i)+2<(capacity)) { \
+        (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \
+        (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \
+        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
+    } else { \
+        (i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(capacity), c, &(isError)); \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_FWD_1
+ * @stable ICU 2.4
+ */
+#define U8_FWD_1_UNSAFE(s, i) { \
+    (i)+=1+U8_COUNT_TRAIL_BYTES((s)[i]); \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset, must be i<length
+ * @param length string length
+ * @see U8_FWD_1_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_FWD_1(s, i, length) { \
+    uint8_t __b=(uint8_t)(s)[(i)++]; \
+    if(U8_IS_LEAD(__b)) { \
+        uint8_t __count=U8_COUNT_TRAIL_BYTES(__b); \
+        if((i)+__count>(length)) { \
+            __count=(uint8_t)((length)-(i)); \
+        } \
+        while(__count>0 && U8_IS_TRAIL((s)[i])) { \
+            ++(i); \
+            --__count; \
+        } \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U8_FWD_N
+ * @stable ICU 2.4
+ */
+#define U8_FWD_N_UNSAFE(s, i, n) { \
+    int32_t __N=(n); \
+    while(__N>0) { \
+        U8_FWD_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset, must be i<length
+ * @param length string length
+ * @param n number of code points to skip
+ * @see U8_FWD_N_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_FWD_N(s, i, length, n) { \
+    int32_t __N=(n); \
+    while(__N>0 && (i)<(length)) { \
+        U8_FWD_1(s, i, length); \
+        --__N; \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to a UTF-8 trail byte,
+ * then the offset is moved backward to the corresponding lead byte.
+ * Otherwise, it is not modified.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_SET_CP_START
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_START_UNSAFE(s, i) { \
+    while(U8_IS_TRAIL((s)[i])) { --(i); } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to a UTF-8 trail byte,
+ * then the offset is moved backward to the corresponding lead byte.
+ * Otherwise, it is not modified.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<=i
+ * @see U8_SET_CP_START_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_START(s, start, i) { \
+    if(U8_IS_TRAIL((s)[(i)])) { \
+        (i)=utf8_back1SafeBody(s, start, (int32_t)(i)); \
+    } \
+}
+
+/* definitions with backward iteration -------------------------------------- */
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a multi-byte sequence, then the macro will read
+ * the whole sequence.
+ * If the offset is behind a lead byte, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset is behind an illegal UTF-8 sequence.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U8_PREV
+ * @stable ICU 2.4
+ */
+#define U8_PREV_UNSAFE(s, i, c) { \
+    (c)=(uint8_t)(s)[--(i)]; \
+    if(U8_IS_TRAIL(c)) { \
+        uint8_t __b, __count=1, __shift=6; \
+\
+        /* c is a trail byte */ \
+        (c)&=0x3f; \
+        for(;;) { \
+            __b=(uint8_t)(s)[--(i)]; \
+            if(__b>=0xc0) { \
+                U8_MASK_LEAD_BYTE(__b, __count); \
+                (c)|=(UChar32)__b<<__shift; \
+                break; \
+            } else { \
+                (c)|=(UChar32)(__b&0x3f)<<__shift; \
+                ++__count; \
+                __shift+=6; \
+            } \
+        } \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a multi-byte sequence, then the macro will read
+ * the whole sequence.
+ * If the offset is behind a lead byte, then that itself
+ * will be returned as the code point.
+ * If the offset is behind an illegal UTF-8 sequence, then c is set to a negative value.
+ *
+ * @param s const uint8_t * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<i
+ * @param c output UChar32 variable, set to <0 in case of an error
+ * @see U8_PREV_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_PREV(s, start, i, c) { \
+    (c)=(uint8_t)(s)[--(i)]; \
+    if((c)>=0x80) { \
+        if((c)<=0xbf) { \
+            (c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -1); \
+        } else { \
+            (c)=U_SENTINEL; \
+        } \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_BACK_1
+ * @stable ICU 2.4
+ */
+#define U8_BACK_1_UNSAFE(s, i) { \
+    while(U8_IS_TRAIL((s)[--(i)])) {} \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<i
+ * @see U8_BACK_1_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_BACK_1(s, start, i) { \
+    if(U8_IS_TRAIL((s)[--(i)])) { \
+        (i)=utf8_back1SafeBody(s, start, (int32_t)(i)); \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U8_BACK_N
+ * @stable ICU 2.4
+ */
+#define U8_BACK_N_UNSAFE(s, i, n) { \
+    int32_t __N=(n); \
+    while(__N>0) { \
+        U8_BACK_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param start index of the start of the string
+ * @param i string offset, must be start<i
+ * @param n number of code points to skip
+ * @see U8_BACK_N_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_BACK_N(s, start, i, n) { \
+    int32_t __N=(n); \
+    while(__N>0 && (i)>(start)) { \
+        U8_BACK_1(s, start, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind a partial multi-byte sequence,
+ * then the offset is incremented to behind the whole sequence.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_SET_CP_LIMIT
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_LIMIT_UNSAFE(s, i) { \
+    U8_BACK_1_UNSAFE(s, i); \
+    U8_FWD_1_UNSAFE(s, i); \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind a partial multi-byte sequence,
+ * then the offset is incremented to behind the whole sequence.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<=i<=length
+ * @param length string length
+ * @see U8_SET_CP_LIMIT_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_LIMIT(s, start, i, length) { \
+    if((start)<(i) && (i)<(length)) { \
+        U8_BACK_1(s, start, i); \
+        U8_FWD_1(s, i, length); \
+    } \
+}
+
+#endif
diff --git a/Source/WTF/icu/unicode/utf_old.h b/Source/WTF/icu/unicode/utf_old.h
new file mode 100644
index 0000000..8504a03
--- /dev/null
+++ b/Source/WTF/icu/unicode/utf_old.h
@@ -0,0 +1 @@
+/* This file is intentionally left blank. */
diff --git a/Source/WTF/icu/unicode/utypes.h b/Source/WTF/icu/unicode/utypes.h
new file mode 100644
index 0000000..00bf14c
--- /dev/null
+++ b/Source/WTF/icu/unicode/utypes.h
@@ -0,0 +1,865 @@
+/*
+**********************************************************************
+*   Copyright (C) 1996-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+**********************************************************************
+*
+*  FILE NAME : UTYPES.H (formerly ptypes.h)
+*
+*   Date        Name        Description
+*   12/11/96    helena      Creation.
+*   02/27/97    aliu        Added typedefs for UClassID, int8, int16, int32,
+*                           uint8, uint16, and uint32.
+*   04/01/97    aliu        Added XP_CPLUSPLUS and modified to work under C as
+*                            well as C++.
+*                           Modified to use memcpy() for uprv_arrayCopy() fns.
+*   04/14/97    aliu        Added TPlatformUtilities.
+*   05/07/97    aliu        Added import/export specifiers (replacing the old
+*                           broken EXT_CLASS).  Added version number for our
+*                           code.  Cleaned up header.
+*    6/20/97    helena      Java class name change.
+*   08/11/98    stephen     UErrorCode changed from typedef to enum
+*   08/12/98    erm         Changed T_ANALYTIC_PACKAGE_VERSION to 3
+*   08/14/98    stephen     Added uprv_arrayCopy() for int8_t, int16_t, int32_t
+*   12/09/98    jfitz       Added BUFFER_OVERFLOW_ERROR (bug 1100066)
+*   04/20/99    stephen     Cleaned up & reworked for autoconf.
+*                           Renamed to utypes.h.
+*   05/05/99    stephen     Changed to use <inttypes.h>
+*   12/07/99    helena      Moved copyright notice string from ucnv_bld.h here.
+*******************************************************************************
+*/
+
+#ifndef UTYPES_H
+#define UTYPES_H
+
+
+#include "unicode/umachine.h"
+#include "unicode/utf.h"
+#include "unicode/uversion.h"
+#include "unicode/uconfig.h"
+
+/*!
+ * \file
+ * \brief Basic definitions for ICU, for both C and C++ APIs
+ *
+ * This file defines basic types, constants, and enumerations directly or
+ * indirectly by including other header files, especially utf.h for the
+ * basic character and string definitions and umachine.h for consistent
+ * integer and other types.
+ */
+
+
+/**
+ * \def U_SHOW_CPLUSPLUS_API
+ * @internal
+ */
+#ifdef XP_CPLUSPLUS
+#   ifndef U_SHOW_CPLUSPLUS_API
+#       define U_SHOW_CPLUSPLUS_API 1
+#   endif
+#else
+#   undef U_SHOW_CPLUSPLUS_API
+#   define U_SHOW_CPLUSPLUS_API 0
+#endif
+
+/** @{ API visibility control */
+
+/**
+ * \def U_HIDE_DRAFT_API
+ * Define this to 1 to request that draft API be "hidden"
+ */
+#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_DRAFT_API)
+#define U_HIDE_DRAFT_API 1
+#endif
+#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_INTERNAL_API)
+#define U_HIDE_INTERNAL_API 1
+#endif
+
+#ifdef U_HIDE_DRAFT_API
+#include "unicode/udraft.h"
+#endif
+
+#ifdef U_HIDE_DEPRECATED_API
+#include "unicode/udeprctd.h"
+#endif
+
+#ifdef U_HIDE_DEPRECATED_API
+#include "unicode/uobslete.h"
+#endif
+
+#ifdef U_HIDE_INTERNAL_API
+#include "unicode/uintrnal.h"
+#endif
+
+#ifdef U_HIDE_SYSTEM_API
+#include "unicode/usystem.h"
+#endif
+
+/** @} */
+
+
+/*===========================================================================*/
+/* char Character set family                                                 */
+/*===========================================================================*/
+
+/**
+ * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform.
+ * @stable ICU 2.0
+ */
+#define U_ASCII_FAMILY 0
+
+/**
+ * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform.
+ * @stable ICU 2.0
+ */
+#define U_EBCDIC_FAMILY 1
+
+/**
+ * \def U_CHARSET_FAMILY
+ *
+ * <p>These definitions allow to specify the encoding of text
+ * in the char data type as defined by the platform and the compiler.
+ * It is enough to determine the code point values of "invariant characters",
+ * which are the ones shared by all encodings that are in use
+ * on a given platform.</p>
+ *
+ * <p>Those "invariant characters" should be all the uppercase and lowercase
+ * latin letters, the digits, the space, and "basic punctuation".
+ * Also, '\\n', '\\r', '\\t' should be available.</p>
+ *
+ * <p>The list of "invariant characters" is:<br>
+ * \code
+ *    A-Z  a-z  0-9  SPACE  "  %  &amp;  '  (  )  *  +  ,  -  .  /  :  ;  <  =  >  ?  _
+ * \endcode
+ * <br>
+ * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)</p>
+ *
+ * <p>This matches the IBM Syntactic Character Set (CS 640).</p>
+ *
+ * <p>In other words, all the graphic characters in 7-bit ASCII should
+ * be safely accessible except the following:</p>
+ *
+ * \code
+ *    '\' <backslash>
+ *    '[' <left bracket>
+ *    ']' <right bracket>
+ *    '{' <left brace>
+ *    '}' <right brace>
+ *    '^' <circumflex>
+ *    '~' <tilde>
+ *    '!' <exclamation mark>
+ *    '#' <number sign>
+ *    '|' <vertical line>
+ *    '$' <dollar sign>
+ *    '@' <commercial at>
+ *    '`' <grave accent>
+ * \endcode
+ * @stable ICU 2.0
+ */
+
+#ifndef U_CHARSET_FAMILY
+#   define U_CHARSET_FAMILY 0
+#endif
+
+/**
+ * \def U_CHARSET_IS_UTF8
+ *
+ * Hardcode the default charset to UTF-8.
+ *
+ * If this is set to 1, then
+ * - ICU will assume that all non-invariant char*, StringPiece, std::string etc.
+ *   contain UTF-8 text, regardless of what the system API uses
+ * - some ICU code will use fast functions like u_strFromUTF8()
+ *   rather than the more general and more heavy-weight conversion API (ucnv.h)
+ * - ucnv_getDefaultName() always returns "UTF-8"
+ * - ucnv_setDefaultName() is disabled and will not change the default charset
+ * - static builds of ICU are smaller
+ * - more functionality is available with the UCONFIG_NO_CONVERSION build-time
+ *   configuration option (see unicode/uconfig.h)
+ * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable
+ *
+ * @stable ICU 4.2
+ * @see UCONFIG_NO_CONVERSION
+ */
+#ifndef U_CHARSET_IS_UTF8
+#   define U_CHARSET_IS_UTF8 0
+#endif
+
+/*===========================================================================*/
+/* ICUDATA naming scheme                                                     */
+/*===========================================================================*/
+
+/**
+ * \def U_ICUDATA_TYPE_LETTER
+ *
+ * This is a platform-dependent string containing one letter:
+ * - b for big-endian, ASCII-family platforms
+ * - l for little-endian, ASCII-family platforms
+ * - e for big-endian, EBCDIC-family platforms
+ * This letter is part of the common data file name.
+ * @stable ICU 2.0
+ */
+
+/**
+ * \def U_ICUDATA_TYPE_LITLETTER
+ * The non-string form of U_ICUDATA_TYPE_LETTER
+ * @stable ICU 2.0
+ */
+#if U_CHARSET_FAMILY
+#   if U_IS_BIG_ENDIAN
+   /* EBCDIC - should always be BE */
+#     define U_ICUDATA_TYPE_LETTER "e"
+#     define U_ICUDATA_TYPE_LITLETTER e
+#   else
+#     error "Don't know what to do with little endian EBCDIC!"
+#     define U_ICUDATA_TYPE_LETTER "x"
+#     define U_ICUDATA_TYPE_LITLETTER x
+#   endif
+#else
+#   if U_IS_BIG_ENDIAN
+      /* Big-endian ASCII */
+#     define U_ICUDATA_TYPE_LETTER "b"
+#     define U_ICUDATA_TYPE_LITLETTER b
+#   else
+      /* Little-endian ASCII */
+#     define U_ICUDATA_TYPE_LETTER "l"
+#     define U_ICUDATA_TYPE_LITLETTER l
+#   endif
+#endif
+
+/**
+ * A single string literal containing the icudata stub name. i.e. 'icudt18e' for
+ * ICU 1.8.x on EBCDIC, etc..
+ * @stable ICU 2.0
+ */
+#define U_ICUDATA_NAME    "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER  /**< @internal */
+#define U_USRDATA_NAME    "usrdt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER  /**< @internal */
+#define U_USE_USRDATA     0  /**< @internal */
+
+/**
+ *  U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data library.
+ *    Defined as a literal, not a string.
+ *    Tricky Preprocessor use - ## operator replaces macro paramters with the literal string
+ *                              from the corresponding macro invocation, _before_ other macro substitutions.
+ *                              Need a nested \#defines to get the actual version numbers rather than
+ *                              the literal text U_ICU_VERSION_MAJOR_NUM into the name.
+ *                              The net result will be something of the form
+ *                                  \#define U_ICU_ENTRY_POINT icudt19_dat
+ * @stable ICU 2.4
+ */
+#define U_ICUDATA_ENTRY_POINT  U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM)
+
+/**
+ * Do not use.
+ * @internal
+ */
+#define U_DEF2_ICUDATA_ENTRY_POINT(major, minor) U_DEF_ICUDATA_ENTRY_POINT(major, minor)
+/**
+ * Do not use.
+ * @internal
+ */
+#ifndef U_DEF_ICUDATA_ENTRY_POINT
+/* affected by symbol renaming. See platform.h */
+#define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt##major##minor##_dat
+#endif
+
+/**
+ * \def U_CALLCONV
+ * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary
+ * in callback function typedefs to make sure that the calling convention
+ * is compatible.
+ *
+ * This is only used for non-ICU-API functions.
+ * When a function is a public ICU API,
+ * you must use the U_CAPI and U_EXPORT2 qualifiers.
+ * @stable ICU 2.0
+ */
+#if defined(OS390) && defined(XP_CPLUSPLUS)
+#    define U_CALLCONV __cdecl
+#else
+#    define U_CALLCONV U_EXPORT2
+#endif
+
+/**
+ * \def NULL
+ * Define NULL if necessary, to 0 for C++ and to ((void *)0) for C.
+ * @stable ICU 2.0
+ */
+#ifndef NULL
+#ifdef XP_CPLUSPLUS
+#define NULL    0
+#else
+#define NULL    ((void *)0)
+#endif
+#endif
+
+/*===========================================================================*/
+/* Calendar/TimeZone data types                                              */
+/*===========================================================================*/
+
+/**
+ * Date and Time data type.
+ * This is a primitive data type that holds the date and time
+ * as the number of milliseconds since 1970-jan-01, 00:00 UTC.
+ * UTC leap seconds are ignored.
+ * @stable ICU 2.0
+ */
+typedef double UDate;
+
+/** The number of milliseconds per second @stable ICU 2.0 */
+#define U_MILLIS_PER_SECOND        (1000)
+/** The number of milliseconds per minute @stable ICU 2.0 */
+#define U_MILLIS_PER_MINUTE       (60000)
+/** The number of milliseconds per hour @stable ICU 2.0 */
+#define U_MILLIS_PER_HOUR       (3600000)
+/** The number of milliseconds per day @stable ICU 2.0 */
+#define U_MILLIS_PER_DAY       (86400000)
+
+
+/*===========================================================================*/
+/* UClassID-based RTTI */
+/*===========================================================================*/
+
+/**
+ * UClassID is used to identify classes without using RTTI, since RTTI
+ * is not yet supported by all C++ compilers.  Each class hierarchy which needs
+ * to implement polymorphic clone() or operator==() defines two methods,
+ * described in detail below.  UClassID values can be compared using
+ * operator==(). Nothing else should be done with them.
+ *
+ * \par
+ * getDynamicClassID() is declared in the base class of the hierarchy as
+ * a pure virtual.  Each concrete subclass implements it in the same way:
+ *
+ * \code
+ *      class Base {
+ *      public:
+ *          virtual UClassID getDynamicClassID() const = 0;
+ *      }
+ *
+ *      class Derived {
+ *      public:
+ *          virtual UClassID getDynamicClassID() const
+ *            { return Derived::getStaticClassID(); }
+ *      }
+ * \endcode
+ *
+ * Each concrete class implements getStaticClassID() as well, which allows
+ * clients to test for a specific type.
+ *
+ * \code
+ *      class Derived {
+ *      public:
+ *          static UClassID U_EXPORT2 getStaticClassID();
+ *      private:
+ *          static char fgClassID;
+ *      }
+ *
+ *      // In Derived.cpp:
+ *      UClassID Derived::getStaticClassID()
+ *        { return (UClassID)&Derived::fgClassID; }
+ *      char Derived::fgClassID = 0; // Value is irrelevant
+ * \endcode
+ * @stable ICU 2.0
+ */
+typedef void* UClassID;
+
+/*===========================================================================*/
+/* Shared library/DLL import-export API control                              */
+/*===========================================================================*/
+
+/*
+ * Control of symbol import/export.
+ * ICU is separated into three libraries.
+ */
+
+/*
+ * \def U_COMBINED_IMPLEMENTATION
+ * Set to export library symbols from inside the ICU library
+ * when all of ICU is in a single library.
+ * This can be set as a compiler option while building ICU, and it
+ * needs to be the first one tested to override U_COMMON_API, U_I18N_API, etc.
+ * @stable ICU 2.0
+ */
+
+/**
+ * \def U_DATA_API
+ * Set to export library symbols from inside the stubdata library,
+ * and to import them from outside.
+ * @stable ICU 3.0
+ */
+
+/**
+ * \def U_COMMON_API
+ * Set to export library symbols from inside the common library,
+ * and to import them from outside.
+ * @stable ICU 2.0
+ */
+
+/**
+ * \def U_I18N_API
+ * Set to export library symbols from inside the i18n library,
+ * and to import them from outside.
+ * @stable ICU 2.0
+ */
+
+/**
+ * \def U_LAYOUT_API
+ * Set to export library symbols from inside the layout engine library,
+ * and to import them from outside.
+ * @stable ICU 2.0
+ */
+
+/**
+ * \def U_LAYOUTEX_API
+ * Set to export library symbols from inside the layout extensions library,
+ * and to import them from outside.
+ * @stable ICU 2.6
+ */
+
+/**
+ * \def U_IO_API
+ * Set to export library symbols from inside the ustdio library,
+ * and to import them from outside.
+ * @stable ICU 2.0
+ */
+
+/**
+ * \def U_TOOLUTIL_API
+ * Set to export library symbols from inside the toolutil library,
+ * and to import them from outside.
+ * @stable ICU 3.4
+ */
+
+#if defined(U_COMBINED_IMPLEMENTATION)
+#define U_DATA_API     U_EXPORT
+#define U_COMMON_API   U_EXPORT
+#define U_I18N_API     U_EXPORT
+#define U_LAYOUT_API   U_EXPORT
+#define U_LAYOUTEX_API U_EXPORT
+#define U_IO_API       U_EXPORT
+#define U_TOOLUTIL_API U_EXPORT
+#elif defined(U_STATIC_IMPLEMENTATION)
+#define U_DATA_API
+#define U_COMMON_API
+#define U_I18N_API
+#define U_LAYOUT_API
+#define U_LAYOUTEX_API
+#define U_IO_API
+#define U_TOOLUTIL_API
+#elif defined(U_COMMON_IMPLEMENTATION)
+#define U_DATA_API     U_IMPORT
+#define U_COMMON_API   U_EXPORT
+#define U_I18N_API     U_IMPORT
+#define U_LAYOUT_API   U_IMPORT
+#define U_LAYOUTEX_API U_IMPORT
+#define U_IO_API       U_IMPORT
+#define U_TOOLUTIL_API U_IMPORT
+#elif defined(U_I18N_IMPLEMENTATION)
+#define U_DATA_API     U_IMPORT
+#define U_COMMON_API   U_IMPORT
+#define U_I18N_API     U_EXPORT
+#define U_LAYOUT_API   U_IMPORT
+#define U_LAYOUTEX_API U_IMPORT
+#define U_IO_API       U_IMPORT
+#define U_TOOLUTIL_API U_IMPORT
+#elif defined(U_LAYOUT_IMPLEMENTATION)
+#define U_DATA_API     U_IMPORT
+#define U_COMMON_API   U_IMPORT
+#define U_I18N_API     U_IMPORT
+#define U_LAYOUT_API   U_EXPORT
+#define U_LAYOUTEX_API U_IMPORT
+#define U_IO_API       U_IMPORT
+#define U_TOOLUTIL_API U_IMPORT
+#elif defined(U_LAYOUTEX_IMPLEMENTATION)
+#define U_DATA_API     U_IMPORT
+#define U_COMMON_API   U_IMPORT
+#define U_I18N_API     U_IMPORT
+#define U_LAYOUT_API   U_IMPORT
+#define U_LAYOUTEX_API U_EXPORT
+#define U_IO_API       U_IMPORT
+#define U_TOOLUTIL_API U_IMPORT
+#elif defined(U_IO_IMPLEMENTATION)
+#define U_DATA_API     U_IMPORT
+#define U_COMMON_API   U_IMPORT
+#define U_I18N_API     U_IMPORT
+#define U_LAYOUT_API   U_IMPORT
+#define U_LAYOUTEX_API U_IMPORT
+#define U_IO_API       U_EXPORT
+#define U_TOOLUTIL_API U_IMPORT
+#elif defined(U_TOOLUTIL_IMPLEMENTATION)
+#define U_DATA_API     U_IMPORT
+#define U_COMMON_API   U_IMPORT
+#define U_I18N_API     U_IMPORT
+#define U_LAYOUT_API   U_IMPORT
+#define U_LAYOUTEX_API U_IMPORT
+#define U_IO_API       U_IMPORT
+#define U_TOOLUTIL_API U_EXPORT
+#else
+#define U_DATA_API     U_IMPORT
+#define U_COMMON_API   U_IMPORT
+#define U_I18N_API     U_IMPORT
+#define U_LAYOUT_API   U_IMPORT
+#define U_LAYOUTEX_API U_IMPORT
+#define U_IO_API       U_IMPORT
+#define U_TOOLUTIL_API U_IMPORT
+#endif
+
+/**
+ * \def U_STANDARD_CPP_NAMESPACE
+ * Control of C++ Namespace
+ * @stable ICU 2.0
+ */
+#ifdef __cplusplus
+#define U_STANDARD_CPP_NAMESPACE        ::
+#else
+#define U_STANDARD_CPP_NAMESPACE
+#endif
+
+
+/*===========================================================================*/
+/* Global delete operator                                                    */
+/*===========================================================================*/
+
+/*
+ * The ICU4C library must not use the global new and delete operators.
+ * These operators here are defined to enable testing for this.
+ * See Jitterbug 2581 for details of why this is necessary.
+ *
+ * Verification that ICU4C's memory usage is correct, i.e.,
+ * that global new/delete are not used:
+ *
+ * a) Check for imports of global new/delete (see uobject.cpp for details)
+ * b) Verify that new is never imported.
+ * c) Verify that delete is only imported from object code for interface/mixin classes.
+ * d) Add global delete and delete[] only for the ICU4C library itself
+ *    and define them in a way that crashes or otherwise easily shows a problem.
+ *
+ * The following implements d).
+ * The operator implementations crash; this is intentional and used for library debugging.
+ *
+ * Note: This is currently only done on Windows because
+ * some Linux/Unix compilers have problems with defining global new/delete.
+ * On Windows, U_WINDOWS is defined, and it is _MSC_VER>=1200 for MSVC 6.0 and higher.
+ */
+#if defined(XP_CPLUSPLUS) && defined(WIN32) && U_DEBUG && U_OVERRIDE_CXX_ALLOCATION && (_MSC_VER>=1200) && !defined(U_STATIC_IMPLEMENTATION) && (defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION))
+
+#ifndef U_HIDE_INTERNAL_API
+/**
+ * Global operator new, defined only inside ICU4C, must not be used.
+ * Crashes intentionally.
+ * @internal
+ */
+inline void *
+operator new(size_t /*size*/) {
+    char *q=NULL;
+    *q=5; /* break it */
+    return q;
+}
+
+#ifdef _Ret_bytecap_
+/* This is only needed to suppress a Visual C++ 2008 warning for operator new[]. */
+_Ret_bytecap_(_Size)
+#endif
+/**
+ * Global operator new[], defined only inside ICU4C, must not be used.
+ * Crashes intentionally.
+ * @internal
+ */
+inline void *
+operator new[](size_t /*size*/) {
+    char *q=NULL;
+    *q=5; /* break it */
+    return q;
+}
+
+/**
+ * Global operator delete, defined only inside ICU4C, must not be used.
+ * Crashes intentionally.
+ * @internal
+ */
+inline void
+operator delete(void * /*p*/) {
+    char *q=NULL;
+    *q=5; /* break it */
+}
+
+/**
+ * Global operator delete[], defined only inside ICU4C, must not be used.
+ * Crashes intentionally.
+ * @internal
+ */
+inline void
+operator delete[](void * /*p*/) {
+    char *q=NULL;
+    *q=5; /* break it */
+}
+
+#endif /* U_HIDE_INTERNAL_API */
+#endif
+
+/*===========================================================================*/
+/* UErrorCode */
+/*===========================================================================*/
+
+/**
+ * Error code to replace exception handling, so that the code is compatible with all C++ compilers,
+ * and to use the same mechanism for C and C++.
+ *
+ * \par
+ * ICU functions that take a reference (C++) or a pointer (C) to a UErrorCode
+ * first test if(U_FAILURE(errorCode)) { return immediately; }
+ * so that in a chain of such functions the first one that sets an error code
+ * causes the following ones to not perform any operations.
+ *
+ * \par
+ * Error codes should be tested using U_FAILURE() and U_SUCCESS().
+ * @stable ICU 2.0
+ */
+typedef enum UErrorCode {
+    /* The ordering of U_ERROR_INFO_START Vs U_USING_FALLBACK_WARNING looks weird
+     * and is that way because VC++ debugger displays first encountered constant,
+     * which is not the what the code is used for
+     */
+
+    U_USING_FALLBACK_WARNING  = -128,   /**< A resource bundle lookup returned a fallback result (not an error) */
+
+    U_ERROR_WARNING_START     = -128,   /**< Start of information results (semantically successful) */
+
+    U_USING_DEFAULT_WARNING   = -127,   /**< A resource bundle lookup returned a result from the root locale (not an error) */
+
+    U_SAFECLONE_ALLOCATED_WARNING = -126, /**< A SafeClone operation required allocating memory (informational only) */
+
+    U_STATE_OLD_WARNING       = -125,   /**< ICU has to use compatibility layer to construct the service. Expect performance/memory usage degradation. Consider upgrading */
+
+    U_STRING_NOT_TERMINATED_WARNING = -124,/**< An output string could not be NUL-terminated because output length==destCapacity. */
+
+    U_SORT_KEY_TOO_SHORT_WARNING = -123, /**< Number of levels requested in getBound is higher than the number of levels in the sort key */
+
+    U_AMBIGUOUS_ALIAS_WARNING = -122,   /**< This converter alias can go to different converter implementations */
+
+    U_DIFFERENT_UCA_VERSION = -121,     /**< ucol_open encountered a mismatch between UCA version and collator image version, so the collator was constructed from rules. No impact to further function */
+    
+    U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */
+
+    U_ERROR_WARNING_LIMIT,              /**< This must always be the last warning value to indicate the limit for UErrorCode warnings (last warning code +1) */
+
+
+    U_ZERO_ERROR              =  0,     /**< No error, no warning. */
+
+    U_ILLEGAL_ARGUMENT_ERROR  =  1,     /**< Start of codes indicating failure */
+    U_MISSING_RESOURCE_ERROR  =  2,     /**< The requested resource cannot be found */
+    U_INVALID_FORMAT_ERROR    =  3,     /**< Data format is not what is expected */
+    U_FILE_ACCESS_ERROR       =  4,     /**< The requested file cannot be found */
+    U_INTERNAL_PROGRAM_ERROR  =  5,     /**< Indicates a bug in the library code */
+    U_MESSAGE_PARSE_ERROR     =  6,     /**< Unable to parse a message (message format) */
+    U_MEMORY_ALLOCATION_ERROR =  7,     /**< Memory allocation error */
+    U_INDEX_OUTOFBOUNDS_ERROR =  8,     /**< Trying to access the index that is out of bounds */
+    U_PARSE_ERROR             =  9,     /**< Equivalent to Java ParseException */
+    U_INVALID_CHAR_FOUND      = 10,     /**< Character conversion: Unmappable input sequence. In other APIs: Invalid character. */
+    U_TRUNCATED_CHAR_FOUND    = 11,     /**< Character conversion: Incomplete input sequence. */
+    U_ILLEGAL_CHAR_FOUND      = 12,     /**< Character conversion: Illegal input sequence/combination of input units. */
+    U_INVALID_TABLE_FORMAT    = 13,     /**< Conversion table file found, but corrupted */
+    U_INVALID_TABLE_FILE      = 14,     /**< Conversion table file not found */
+    U_BUFFER_OVERFLOW_ERROR   = 15,     /**< A result would not fit in the supplied buffer */
+    U_UNSUPPORTED_ERROR       = 16,     /**< Requested operation not supported in current context */
+    U_RESOURCE_TYPE_MISMATCH  = 17,     /**< an operation is requested over a resource that does not support it */
+    U_ILLEGAL_ESCAPE_SEQUENCE = 18,     /**< ISO-2022 illlegal escape sequence */
+    U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, /**< ISO-2022 unsupported escape sequence */
+    U_NO_SPACE_AVAILABLE      = 20,     /**< No space available for in-buffer expansion for Arabic shaping */
+    U_CE_NOT_FOUND_ERROR      = 21,     /**< Currently used only while setting variable top, but can be used generally */
+    U_PRIMARY_TOO_LONG_ERROR  = 22,     /**< User tried to set variable top to a primary that is longer than two bytes */
+    U_STATE_TOO_OLD_ERROR     = 23,     /**< ICU cannot construct a service from this state, as it is no longer supported */
+    U_TOO_MANY_ALIASES_ERROR  = 24,     /**< There are too many aliases in the path to the requested resource.
+                                             It is very possible that a circular alias definition has occured */
+    U_ENUM_OUT_OF_SYNC_ERROR  = 25,     /**< UEnumeration out of sync with underlying collection */
+    U_INVARIANT_CONVERSION_ERROR = 26,  /**< Unable to convert a UChar* string to char* with the invariant converter. */
+    U_INVALID_STATE_ERROR     = 27,     /**< Requested operation can not be completed with ICU in its current state */
+    U_COLLATOR_VERSION_MISMATCH = 28,   /**< Collator version is not compatible with the base version */
+    U_USELESS_COLLATOR_ERROR  = 29,     /**< Collator is options only and no base is specified */
+    U_NO_WRITE_PERMISSION     = 30,     /**< Attempt to modify read-only or constant data. */
+
+    U_STANDARD_ERROR_LIMIT,             /**< This must always be the last value to indicate the limit for standard errors */
+    /*
+     * the error code range 0x10000 0x10100 are reserved for Transliterator
+     */
+    U_BAD_VARIABLE_DEFINITION=0x10000,/**< Missing '$' or duplicate variable name */
+    U_PARSE_ERROR_START = 0x10000,    /**< Start of Transliterator errors */
+    U_MALFORMED_RULE,                 /**< Elements of a rule are misplaced */
+    U_MALFORMED_SET,                  /**< A UnicodeSet pattern is invalid*/
+    U_MALFORMED_SYMBOL_REFERENCE,     /**< UNUSED as of ICU 2.4 */
+    U_MALFORMED_UNICODE_ESCAPE,       /**< A Unicode escape pattern is invalid*/
+    U_MALFORMED_VARIABLE_DEFINITION,  /**< A variable definition is invalid */
+    U_MALFORMED_VARIABLE_REFERENCE,   /**< A variable reference is invalid */
+    U_MISMATCHED_SEGMENT_DELIMITERS,  /**< UNUSED as of ICU 2.4 */
+    U_MISPLACED_ANCHOR_START,         /**< A start anchor appears at an illegal position */
+    U_MISPLACED_CURSOR_OFFSET,        /**< A cursor offset occurs at an illegal position */
+    U_MISPLACED_QUANTIFIER,           /**< A quantifier appears after a segment close delimiter */
+    U_MISSING_OPERATOR,               /**< A rule contains no operator */
+    U_MISSING_SEGMENT_CLOSE,          /**< UNUSED as of ICU 2.4 */
+    U_MULTIPLE_ANTE_CONTEXTS,         /**< More than one ante context */
+    U_MULTIPLE_CURSORS,               /**< More than one cursor */
+    U_MULTIPLE_POST_CONTEXTS,         /**< More than one post context */
+    U_TRAILING_BACKSLASH,             /**< A dangling backslash */
+    U_UNDEFINED_SEGMENT_REFERENCE,    /**< A segment reference does not correspond to a defined segment */
+    U_UNDEFINED_VARIABLE,             /**< A variable reference does not correspond to a defined variable */
+    U_UNQUOTED_SPECIAL,               /**< A special character was not quoted or escaped */
+    U_UNTERMINATED_QUOTE,             /**< A closing single quote is missing */
+    U_RULE_MASK_ERROR,                /**< A rule is hidden by an earlier more general rule */
+    U_MISPLACED_COMPOUND_FILTER,      /**< A compound filter is in an invalid location */
+    U_MULTIPLE_COMPOUND_FILTERS,      /**< More than one compound filter */
+    U_INVALID_RBT_SYNTAX,             /**< A "::id" rule was passed to the RuleBasedTransliterator parser */
+    U_INVALID_PROPERTY_PATTERN,       /**< UNUSED as of ICU 2.4 */
+    U_MALFORMED_PRAGMA,               /**< A 'use' pragma is invlalid */
+    U_UNCLOSED_SEGMENT,               /**< A closing ')' is missing */
+    U_ILLEGAL_CHAR_IN_SEGMENT,        /**< UNUSED as of ICU 2.4 */
+    U_VARIABLE_RANGE_EXHAUSTED,       /**< Too many stand-ins generated for the given variable range */
+    U_VARIABLE_RANGE_OVERLAP,         /**< The variable range overlaps characters used in rules */
+    U_ILLEGAL_CHARACTER,              /**< A special character is outside its allowed context */
+    U_INTERNAL_TRANSLITERATOR_ERROR,  /**< Internal transliterator system error */
+    U_INVALID_ID,                     /**< A "::id" rule specifies an unknown transliterator */
+    U_INVALID_FUNCTION,               /**< A "&fn()" rule specifies an unknown transliterator */
+    U_PARSE_ERROR_LIMIT,              /**< The limit for Transliterator errors */
+
+    /*
+     * the error code range 0x10100 0x10200 are reserved for formatting API parsing error
+     */
+    U_UNEXPECTED_TOKEN=0x10100,       /**< Syntax error in format pattern */
+    U_FMT_PARSE_ERROR_START=0x10100,  /**< Start of format library errors */
+    U_MULTIPLE_DECIMAL_SEPARATORS,    /**< More than one decimal separator in number pattern */
+    U_MULTIPLE_DECIMAL_SEPERATORS = U_MULTIPLE_DECIMAL_SEPARATORS, /**< Typo: kept for backward compatibility. Use U_MULTIPLE_DECIMAL_SEPARATORS */
+    U_MULTIPLE_EXPONENTIAL_SYMBOLS,   /**< More than one exponent symbol in number pattern */
+    U_MALFORMED_EXPONENTIAL_PATTERN,  /**< Grouping symbol in exponent pattern */
+    U_MULTIPLE_PERCENT_SYMBOLS,       /**< More than one percent symbol in number pattern */
+    U_MULTIPLE_PERMILL_SYMBOLS,       /**< More than one permill symbol in number pattern */
+    U_MULTIPLE_PAD_SPECIFIERS,        /**< More than one pad symbol in number pattern */
+    U_PATTERN_SYNTAX_ERROR,           /**< Syntax error in format pattern */
+    U_ILLEGAL_PAD_POSITION,           /**< Pad symbol misplaced in number pattern */
+    U_UNMATCHED_BRACES,               /**< Braces do not match in message pattern */
+    U_UNSUPPORTED_PROPERTY,           /**< UNUSED as of ICU 2.4 */
+    U_UNSUPPORTED_ATTRIBUTE,          /**< UNUSED as of ICU 2.4 */
+    U_ARGUMENT_TYPE_MISMATCH,         /**< Argument name and argument index mismatch in MessageFormat functions */
+    U_DUPLICATE_KEYWORD,              /**< Duplicate keyword in PluralFormat */
+    U_UNDEFINED_KEYWORD,              /**< Undefined Plural keyword */
+    U_DEFAULT_KEYWORD_MISSING,        /**< Missing DEFAULT rule in plural rules */
+    U_DECIMAL_NUMBER_SYNTAX_ERROR,    /**< Decimal number syntax error */
+    U_FMT_PARSE_ERROR_LIMIT,          /**< The limit for format library errors */
+
+    /*
+     * the error code range 0x10200 0x102ff are reserved for Break Iterator related error
+     */
+    U_BRK_INTERNAL_ERROR=0x10200,          /**< An internal error (bug) was detected.             */
+    U_BRK_ERROR_START=0x10200,             /**< Start of codes indicating Break Iterator failures */
+    U_BRK_HEX_DIGITS_EXPECTED,             /**< Hex digits expected as part of a escaped char in a rule. */
+    U_BRK_SEMICOLON_EXPECTED,              /**< Missing ';' at the end of a RBBI rule.            */
+    U_BRK_RULE_SYNTAX,                     /**< Syntax error in RBBI rule.                        */
+    U_BRK_UNCLOSED_SET,                    /**< UnicodeSet witing an RBBI rule missing a closing ']'.  */
+    U_BRK_ASSIGN_ERROR,                    /**< Syntax error in RBBI rule assignment statement.   */
+    U_BRK_VARIABLE_REDFINITION,            /**< RBBI rule $Variable redefined.                    */
+    U_BRK_MISMATCHED_PAREN,                /**< Mis-matched parentheses in an RBBI rule.          */
+    U_BRK_NEW_LINE_IN_QUOTED_STRING,       /**< Missing closing quote in an RBBI rule.            */
+    U_BRK_UNDEFINED_VARIABLE,              /**< Use of an undefined $Variable in an RBBI rule.    */
+    U_BRK_INIT_ERROR,                      /**< Initialization failure.  Probable missing ICU Data. */
+    U_BRK_RULE_EMPTY_SET,                  /**< Rule contains an empty Unicode Set.               */
+    U_BRK_UNRECOGNIZED_OPTION,             /**< !!option in RBBI rules not recognized.            */
+    U_BRK_MALFORMED_RULE_TAG,              /**< The {nnn} tag on a rule is mal formed             */
+    U_BRK_ERROR_LIMIT,                     /**< This must always be the last value to indicate the limit for Break Iterator failures */
+
+    /*
+     * The error codes in the range 0x10300-0x103ff are reserved for regular expression related errrs
+     */
+    U_REGEX_INTERNAL_ERROR=0x10300,       /**< An internal error (bug) was detected.              */
+    U_REGEX_ERROR_START=0x10300,          /**< Start of codes indicating Regexp failures          */
+    U_REGEX_RULE_SYNTAX,                  /**< Syntax error in regexp pattern.                    */
+    U_REGEX_INVALID_STATE,                /**< RegexMatcher in invalid state for requested operation */
+    U_REGEX_BAD_ESCAPE_SEQUENCE,          /**< Unrecognized backslash escape sequence in pattern  */
+    U_REGEX_PROPERTY_SYNTAX,              /**< Incorrect Unicode property                         */
+    U_REGEX_UNIMPLEMENTED,                /**< Use of regexp feature that is not yet implemented. */
+    U_REGEX_MISMATCHED_PAREN,             /**< Incorrectly nested parentheses in regexp pattern.  */
+    U_REGEX_NUMBER_TOO_BIG,               /**< Decimal number is too large.                       */
+    U_REGEX_BAD_INTERVAL,                 /**< Error in {min,max} interval                        */
+    U_REGEX_MAX_LT_MIN,                   /**< In {min,max}, max is less than min.                */
+    U_REGEX_INVALID_BACK_REF,             /**< Back-reference to a non-existent capture group.    */
+    U_REGEX_INVALID_FLAG,                 /**< Invalid value for match mode flags.                */
+    U_REGEX_LOOK_BEHIND_LIMIT,            /**< Look-Behind pattern matches must have a bounded maximum length.    */
+    U_REGEX_SET_CONTAINS_STRING,          /**< Regexps cannot have UnicodeSets containing strings.*/
+    U_REGEX_OCTAL_TOO_BIG,                /**< Octal character constants must be <= 0377.         */
+    U_REGEX_MISSING_CLOSE_BRACKET,        /**< Missing closing bracket on a bracket expression.   */
+    U_REGEX_INVALID_RANGE,                /**< In a character range [x-y], x is greater than y.   */
+    U_REGEX_STACK_OVERFLOW,               /**< Regular expression backtrack stack overflow.       */
+    U_REGEX_TIME_OUT,                     /**< Maximum allowed match time exceeded                */
+    U_REGEX_STOPPED_BY_CALLER,            /**< Matching operation aborted by user callback fn.    */
+    U_REGEX_ERROR_LIMIT,                  /**< This must always be the last value to indicate the limit for regexp errors */
+
+    /*
+     * The error code in the range 0x10400-0x104ff are reserved for IDNA related error codes
+     */
+    U_IDNA_PROHIBITED_ERROR=0x10400,
+    U_IDNA_ERROR_START=0x10400,
+    U_IDNA_UNASSIGNED_ERROR,
+    U_IDNA_CHECK_BIDI_ERROR,
+    U_IDNA_STD3_ASCII_RULES_ERROR,
+    U_IDNA_ACE_PREFIX_ERROR,
+    U_IDNA_VERIFICATION_ERROR,
+    U_IDNA_LABEL_TOO_LONG_ERROR,
+    U_IDNA_ZERO_LENGTH_LABEL_ERROR,
+    U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR,
+    U_IDNA_ERROR_LIMIT,
+    /*
+     * Aliases for StringPrep
+     */
+    U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR,
+    U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR,
+    U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR,
+    
+    /*
+     * The error code in the range 0x10500-0x105ff are reserved for Plugin related error codes
+     */
+    U_PLUGIN_ERROR_START=0x10500,         /**< Start of codes indicating plugin failures */
+    U_PLUGIN_TOO_HIGH=0x10500,            /**< The plugin's level is too high to be loaded right now. */
+    U_PLUGIN_DIDNT_SET_LEVEL,             /**< The plugin didn't call uplug_setPlugLevel in response to a QUERY */
+    U_PLUGIN_ERROR_LIMIT,                 /**< This must always be the last value to indicate the limit for plugin errors */
+
+    U_ERROR_LIMIT=U_PLUGIN_ERROR_LIMIT      /**< This must always be the last value to indicate the limit for UErrorCode (last error code +1) */
+} UErrorCode;
+
+/* Use the following to determine if an UErrorCode represents */
+/* operational success or failure. */
+
+#ifdef XP_CPLUSPLUS
+    /**
+     * Does the error code indicate success?
+     * @stable ICU 2.0
+     */
+    static
+    inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); }
+    /**
+     * Does the error code indicate a failure?
+     * @stable ICU 2.0
+     */
+    static
+    inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); }
+#else
+    /**
+     * Does the error code indicate success?
+     * @stable ICU 2.0
+     */
+#   define U_SUCCESS(x) ((x)<=U_ZERO_ERROR)
+    /**
+     * Does the error code indicate a failure?
+     * @stable ICU 2.0
+     */
+#   define U_FAILURE(x) ((x)>U_ZERO_ERROR)
+#endif
+
+/**
+ * Return a string for a UErrorCode value.
+ * The string will be the same as the name of the error code constant
+ * in the UErrorCode enum above.
+ * @stable ICU 2.0
+ */
+U_STABLE const char * U_EXPORT2
+u_errorName(UErrorCode code);
+
+
+#endif /* _UTYPES */
diff --git a/Source/WTF/icu/unicode/uvernum.h b/Source/WTF/icu/unicode/uvernum.h
new file mode 100644
index 0000000..7221612
--- /dev/null
+++ b/Source/WTF/icu/unicode/uvernum.h
@@ -0,0 +1,138 @@
+/*
+*******************************************************************************
+*   Copyright (C) 2000-2011, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*******************************************************************************
+*
+*   file name:  uvernum.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   Created by: Vladimir Weinstein
+*   Updated by: Steven R. Loomis
+*
+*  Gets included by uversion.h and other files.
+*
+* IMPORTANT: When updating version, the following things need to be done:
+* source/common/unicode/uvernum.h - this file: update major, minor,
+*        patchlevel, suffix, version, short version constants, namespace,
+*                    renaming macro, and copyright
+*
+* The following files need to be updated as well, which can be done
+*  by running the UNIX makefile target 'update-windows-makefiles' in icu/source.
+*
+*
+* source/common/common.vcproj - update 'Output file name' on the link tab so
+*                   that it contains the new major/minor combination
+* source/i18n/i18n.vcproj - same as for the common.vcproj
+* source/layout/layout.vcproj - same as for the common.vcproj
+* source/layoutex/layoutex.vcproj - same
+* source/stubdata/stubdata.vcproj - same as for the common.vcproj
+* source/io/io.vcproj - same as for the common.vcproj
+* source/data/makedata.mak - change U_ICUDATA_NAME so that it contains
+*                            the new major/minor combination and the Unicode version.
+*/
+
+#ifndef UVERNUM_H
+#define UVERNUM_H
+
+/** The standard copyright notice that gets compiled into each library. 
+ *  This value will change in the subsequent releases of ICU
+ *  @stable ICU 2.4
+ */
+#define U_COPYRIGHT_STRING \
+  " Copyright (C) 2011, International Business Machines Corporation and others. All Rights Reserved. "
+
+/** The current ICU major version as an integer. 
+ *  This value will change in the subsequent releases of ICU
+ *  @stable ICU 2.4
+ */
+#define U_ICU_VERSION_MAJOR_NUM 4
+
+/** The current ICU minor version as an integer. 
+ *  This value will change in the subsequent releases of ICU
+ *  @stable ICU 2.6
+ */
+#define U_ICU_VERSION_MINOR_NUM 6
+
+/** The current ICU patchlevel version as an integer.  
+ *  This value will change in the subsequent releases of ICU
+ *  @stable ICU 2.4
+ */
+#define U_ICU_VERSION_PATCHLEVEL_NUM 1
+
+/** The current ICU build level version as an integer.  
+ *  This value is for use by ICU clients. It defaults to 0.
+ *  @stable ICU 4.0
+ */
+#ifndef U_ICU_VERSION_BUILDLEVEL_NUM
+#define U_ICU_VERSION_BUILDLEVEL_NUM 0
+#endif
+
+/** Glued version suffix for renamers 
+ *  This value will change in the subsequent releases of ICU
+ *  @stable ICU 2.6
+ */
+#define U_ICU_VERSION_SUFFIX _46
+
+/** Glued version suffix function for renamers 
+ *  This value will change in the subsequent releases of ICU.
+ *  If a custom suffix (such as matching library suffixes) is desired, this can be modified.
+ *  Note that if present, platform.h may contain an earlier definition of this macro.
+ *  @stable ICU 4.2
+ */
+#ifndef U_ICU_ENTRY_POINT_RENAME
+#define U_ICU_ENTRY_POINT_RENAME(x)    x ## _46
+#endif
+
+/** The current ICU library version as a dotted-decimal string. The patchlevel
+ *  only appears in this string if it non-zero. 
+ *  This value will change in the subsequent releases of ICU
+ *  @stable ICU 2.4
+ */
+#define U_ICU_VERSION "4.6.1"
+
+/** The current ICU library major/minor version as a string without dots, for library name suffixes. 
+ *  This value will change in the subsequent releases of ICU
+ *  @stable ICU 2.6
+ */
+#define U_ICU_VERSION_SHORT "46"
+
+/** Data version in ICU4C.
+ * @internal ICU 4.4 Internal Use Only
+ **/
+#define U_ICU_DATA_VERSION "4.6"
+
+/*===========================================================================
+ * ICU collation framework version information
+ * Version info that can be obtained from a collator is affected by these
+ * numbers in a secret and magic way. Please use collator version as whole
+ *===========================================================================
+ */
+
+/**
+ * Collation runtime version (sort key generator, strcoll).
+ * If the version is different, sort keys for the same string could be different.
+ * This value may change in subsequent releases of ICU.
+ * @stable ICU 2.4
+ */
+#define UCOL_RUNTIME_VERSION 7
+
+/**
+ * Collation builder code version.
+ * When this is different, the same tailoring might result
+ * in assigning different collation elements to code points.
+ * This value may change in subsequent releases of ICU.
+ * @stable ICU 2.4
+ */
+#define UCOL_BUILDER_VERSION 8
+
+/**
+ * This is the version of collation tailorings.
+ * This value may change in subsequent releases of ICU.
+ * @stable ICU 2.4
+ */
+#define UCOL_TAILORINGS_VERSION 1
+
+#endif
diff --git a/Source/WTF/icu/unicode/uversion.h b/Source/WTF/icu/unicode/uversion.h
new file mode 100644
index 0000000..e54cd55
--- /dev/null
+++ b/Source/WTF/icu/unicode/uversion.h
@@ -0,0 +1,195 @@
+/*
+*******************************************************************************
+*   Copyright (C) 2000-2010, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*******************************************************************************
+*
+*   file name:  uversion.h
+*   encoding:   US-ASCII
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   Created by: Vladimir Weinstein
+*
+*  Gets included by utypes.h and Windows .rc files
+*/
+
+/**
+ * \file
+ * \brief C API: API for accessing ICU version numbers. 
+ */
+/*===========================================================================*/
+/* Main ICU version information                                              */
+/*===========================================================================*/
+
+#ifndef UVERSION_H
+#define UVERSION_H
+
+#include "unicode/umachine.h"
+
+/* Actual version info lives in uvernum.h */
+#include "unicode/uvernum.h"
+
+/** Maximum length of the copyright string.
+ *  @stable ICU 2.4
+ */
+#define U_COPYRIGHT_STRING_LENGTH  128
+
+/** An ICU version consists of up to 4 numbers from 0..255.
+ *  @stable ICU 2.4
+ */
+#define U_MAX_VERSION_LENGTH 4
+
+/** In a string, ICU version fields are delimited by dots.
+ *  @stable ICU 2.4
+ */
+#define U_VERSION_DELIMITER '.'
+
+/** The maximum length of an ICU version string.
+ *  @stable ICU 2.4
+ */
+#define U_MAX_VERSION_STRING_LENGTH 20
+
+/** The binary form of a version on ICU APIs is an array of 4 uint8_t.
+ *  To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)).
+ *  @stable ICU 2.4
+ */
+typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
+
+/*===========================================================================*/
+/* C++ namespace if supported. Versioned unless versioning is disabled.      */
+/*===========================================================================*/
+
+/**
+ * \def U_NAMESPACE_BEGIN
+ * This is used to begin a declaration of a public ICU C++ API.
+ * When not compiling for C++, it does nothing.
+ * When compiling for C++, it begins an extern "C++" linkage block (to protect
+ * against cases in which an external client includes ICU header files inside
+ * an extern "C" linkage block).
+ * If the C++ compiler supports namespaces, it also begins a namespace block.
+ * @stable ICU 2.4
+ */
+
+/**
+ * \def U_NAMESPACE_END
+ * This is used to end a declaration of a public ICU C++ API.
+ * When not compiling for C++, it does nothing.
+ * When compiling for C++, it ends the extern "C++" block begun by
+ * U_NAMESPACE_BEGIN.
+ * If the C++ compiler supports namespaces, it also ends the namespace block
+ * begun by U_NAMESPACE_BEGIN.
+ * @stable ICU 2.4
+ */
+
+/**
+ * \def U_NAMESPACE_USE
+ * This is used to specify that the rest of the code uses the
+ * public ICU C++ API namespace.
+ * If the compiler doesn't support namespaces, this does nothing.
+ * @stable ICU 2.4
+ */
+
+/**
+ * \def U_NAMESPACE_QUALIFIER
+ * This is used to qualify that a function or class is part of
+ * the public ICU C++ API namespace.
+ * If the compiler doesn't support namespaces, this does nothing.
+ * @stable ICU 2.4
+ */
+
+/* Define namespace symbols if the compiler supports it. */
+#ifdef XP_CPLUSPLUS
+#if U_HAVE_NAMESPACE
+#   if U_DISABLE_RENAMING
+#       define U_ICU_NAMESPACE icu
+        namespace U_ICU_NAMESPACE { }
+#   else
+#       define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu)
+        namespace U_ICU_NAMESPACE { }
+        namespace icu = U_ICU_NAMESPACE;
+#   endif
+
+#   define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE {
+#   define U_NAMESPACE_END } }
+#   define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
+#   define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
+
+#   ifndef U_USING_ICU_NAMESPACE
+#       define U_USING_ICU_NAMESPACE 1
+#   endif
+#   if U_USING_ICU_NAMESPACE
+        U_NAMESPACE_USE
+#   endif
+#else
+#   define U_NAMESPACE_BEGIN extern "C++" {
+#   define U_NAMESPACE_END }
+#   define U_NAMESPACE_USE
+#   define U_NAMESPACE_QUALIFIER
+#endif
+#else
+#   define U_NAMESPACE_BEGIN
+#   define U_NAMESPACE_END
+#   define U_NAMESPACE_USE
+#   define U_NAMESPACE_QUALIFIER
+#endif
+
+/*===========================================================================*/
+/* General version helper functions. Definitions in putil.c                  */
+/*===========================================================================*/
+
+/**
+ * Parse a string with dotted-decimal version information and
+ * fill in a UVersionInfo structure with the result.
+ * Definition of this function lives in putil.c
+ *
+ * @param versionArray The destination structure for the version information.
+ * @param versionString A string with dotted-decimal version information,
+ *                      with up to four non-negative number fields with
+ *                      values of up to 255 each.
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+u_versionFromString(UVersionInfo versionArray, const char *versionString);
+
+/**
+ * Parse a Unicode string with dotted-decimal version information and
+ * fill in a UVersionInfo structure with the result.
+ * Definition of this function lives in putil.c
+ *
+ * @param versionArray The destination structure for the version information.
+ * @param versionString A Unicode string with dotted-decimal version
+ *                      information, with up to four non-negative number
+ *                      fields with values of up to 255 each.
+ * @stable ICU 4.2
+ */
+U_STABLE void U_EXPORT2
+u_versionFromUString(UVersionInfo versionArray, const UChar *versionString);
+
+
+/**
+ * Write a string with dotted-decimal version information according
+ * to the input UVersionInfo.
+ * Definition of this function lives in putil.c
+ *
+ * @param versionArray The version information to be written as a string.
+ * @param versionString A string buffer that will be filled in with
+ *                      a string corresponding to the numeric version
+ *                      information in versionArray.
+ *                      The buffer size must be at least U_MAX_VERSION_STRING_LENGTH.
+ * @stable ICU 2.4
+ */
+U_STABLE void U_EXPORT2
+u_versionToString(UVersionInfo versionArray, char *versionString);
+
+/**
+ * Gets the ICU release version.  The version array stores the version information
+ * for ICU.  For example, release "1.3.31.2" is then represented as 0x01031F02.
+ * Definition of this function lives in putil.c
+ *
+ * @param versionArray the version # information, the result will be filled in
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_getVersion(UVersionInfo versionArray);
+#endif
diff --git a/Source/WTF/wscript b/Source/WTF/wscript
new file mode 100644
index 0000000..57dac80
--- /dev/null
+++ b/Source/WTF/wscript
@@ -0,0 +1,66 @@
+#! /usr/bin/env python
+
+# Copyright (C) 2012 Kevin Ollivier  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 COMPUTER, INC. ``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 COMPUTER, INC. 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. 
+#
+# WTF build script for the waf build system
+
+import commands
+
+from settings import *
+
+def build(bld):
+
+    import Options
+
+    wtf_excludes = []
+    wtf_exclude_patterns = get_port_excludes(Options.options.port)
+    wtf_exclude_patterns.append('*None.cpp')
+
+    if Options.options.port == "wx":
+        if building_on_win32:
+            wtf_excludes += ['OSAllocatorPosix.cpp', 'ThreadingPthreads.cpp']
+
+    bld.env.LIBDIR = output_dir
+    full_dirs = get_dirs_for_features(wtf_dir, features=[Options.options.port.lower()], dirs=wtf_dirs)
+    abs_dirs = []
+    for adir in full_dirs:
+        abs_dirs.append(os.path.join(wtf_dir, adir))
+
+    wtf_excludes.extend(get_excludes_in_dirs(abs_dirs, wtf_exclude_patterns))
+
+    includes = common_includes + full_dirs + [output_dir]
+
+    if sys.platform.startswith('darwin'):
+        includes.append(os.path.join(wtf_dir, 'icu'))
+
+    wtf = bld.new_task_gen(
+        features = 'cc cxx cstaticlib',
+        includes = '. .. assembler ../WTF ' + ' '.join(includes),
+        defines = ['BUILDING_WTF'],
+        target = 'wtf',
+        uselib = 'WX ICU ' + get_config(),
+        uselib_local = '',
+        install_path = output_dir)
+
+    wtf.find_sources_in_dirs(full_dirs, excludes = wtf_excludes)
diff --git a/Source/WTF/wtf/ASCIICType.h b/Source/WTF/wtf/ASCIICType.h
new file mode 100644
index 0000000..18e108e
--- /dev/null
+++ b/Source/WTF/wtf/ASCIICType.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2007, 2008, 2009, 2011 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef WTF_ASCIICType_h
+#define WTF_ASCIICType_h
+
+#include <wtf/Assertions.h>
+
+// The behavior of many of the functions in the <ctype.h> header is dependent
+// on the current locale. But in the WebKit project, all uses of those functions
+// are in code processing something that's not locale-specific. These equivalents
+// for some of the <ctype.h> functions are named more explicitly, not dependent
+// on the C library locale, and we should also optimize them as needed.
+
+// All functions return false or leave the character unchanged if passed a character
+// that is outside the range 0-7F. So they can be used on Unicode strings or
+// characters if the intent is to do processing only if the character is ASCII.
+
+namespace WTF {
+
+template<typename CharType> inline bool isASCII(CharType c)
+{
+    return !(c & ~0x7F);
+}
+
+template<typename CharType> inline bool isASCIIAlpha(CharType c)
+{
+    return (c | 0x20) >= 'a' && (c | 0x20) <= 'z';
+}
+
+template<typename CharType> inline bool isASCIIDigit(CharType c)
+{
+    return c >= '0' && c <= '9';
+}
+
+template<typename CharType> inline bool isASCIIAlphanumeric(CharType c)
+{
+    return isASCIIDigit(c) || isASCIIAlpha(c);
+}
+
+template<typename CharType> inline bool isASCIIHexDigit(CharType c)
+{
+    return isASCIIDigit(c) || ((c | 0x20) >= 'a' && (c | 0x20) <= 'f');
+}
+
+template<typename CharType> inline bool isASCIILower(CharType c)
+{
+    return c >= 'a' && c <= 'z';
+}
+
+template<typename CharType> inline bool isASCIIOctalDigit(CharType c)
+{
+    return (c >= '0') & (c <= '7');
+}
+
+template<typename CharType> inline bool isASCIIPrintable(CharType c)
+{
+    return c >= ' ' && c <= '~';
+}
+
+/*
+ Statistics from a run of Apple's page load test for callers of isASCIISpace:
+
+ character          count
+ ---------          -----
+ non-spaces         689383
+ 20  space          294720
+ 0A  \n             89059
+ 09  \t             28320
+ 0D  \r             0
+ 0C  \f             0
+ 0B  \v             0
+ */
+template<typename CharType> inline bool isASCIISpace(CharType c)
+{
+    return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9));
+}
+
+template<typename CharType> inline bool isASCIIUpper(CharType c)
+{
+    return c >= 'A' && c <= 'Z';
+}
+
+template<typename CharType> inline CharType toASCIILower(CharType c)
+{
+    return c | ((c >= 'A' && c <= 'Z') << 5);
+}
+
+template<typename CharType> inline CharType toASCIILowerUnchecked(CharType character)
+{
+    // This function can be used for comparing any input character
+    // to a lowercase English character. The isASCIIAlphaCaselessEqual
+    // below should be used for regular comparison of ASCII alpha
+    // characters, but switch statements in CSS tokenizer require
+    // direct use of this function.
+    return character | 0x20;
+}
+
+template<typename CharType> inline CharType toASCIIUpper(CharType c)
+{
+    return c & ~((c >= 'a' && c <= 'z') << 5);
+}
+
+template<typename CharType> inline int toASCIIHexValue(CharType c)
+{
+    ASSERT(isASCIIHexDigit(c));
+    return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF;
+}
+
+template<typename CharType> inline int toASCIIHexValue(CharType upperValue, CharType lowerValue)
+{
+    ASSERT(isASCIIHexDigit(upperValue) && isASCIIHexDigit(lowerValue));
+    return ((toASCIIHexValue(upperValue) << 4) & 0xF0) | toASCIIHexValue(lowerValue);
+}
+
+inline char lowerNibbleToASCIIHexDigit(char c)
+{
+    char nibble = c & 0xF;
+    return nibble < 10 ? '0' + nibble : 'A' + nibble - 10;
+}
+
+inline char upperNibbleToASCIIHexDigit(char c)
+{
+    char nibble = (c >> 4) & 0xF;
+    return nibble < 10 ? '0' + nibble : 'A' + nibble - 10;
+}
+
+template<typename CharType> inline bool isASCIIAlphaCaselessEqual(CharType cssCharacter, char character)
+{
+    // This function compares a (preferrably) constant ASCII
+    // lowercase letter to any input character.
+    ASSERT(character >= 'a' && character <= 'z');
+    return LIKELY(toASCIILowerUnchecked(cssCharacter) == character);
+}
+
+}
+
+using WTF::isASCII;
+using WTF::isASCIIAlpha;
+using WTF::isASCIIAlphanumeric;
+using WTF::isASCIIDigit;
+using WTF::isASCIIHexDigit;
+using WTF::isASCIILower;
+using WTF::isASCIIOctalDigit;
+using WTF::isASCIIPrintable;
+using WTF::isASCIISpace;
+using WTF::isASCIIUpper;
+using WTF::toASCIIHexValue;
+using WTF::toASCIILower;
+using WTF::toASCIILowerUnchecked;
+using WTF::toASCIIUpper;
+using WTF::lowerNibbleToASCIIHexDigit;
+using WTF::upperNibbleToASCIIHexDigit;
+using WTF::isASCIIAlphaCaselessEqual;
+
+#endif
diff --git a/Source/WTF/wtf/AVLTree.h b/Source/WTF/wtf/AVLTree.h
new file mode 100644
index 0000000..f2f82e1
--- /dev/null
+++ b/Source/WTF/wtf/AVLTree.h
@@ -0,0 +1,960 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Based on Abstract AVL Tree Template v1.5 by Walt Karas
+ * <http://geocities.com/wkaras/gen_cpp/avl_tree.html>.
+ *
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef AVL_TREE_H_
+#define AVL_TREE_H_
+
+#include <wtf/Assertions.h>
+#include <wtf/FixedArray.h>
+
+namespace WTF {
+
+// Here is the reference class for BSet.
+//
+// class BSet
+//   {
+//   public:
+//
+//     class ANY_bitref
+//       {
+//       public:
+//         operator bool ();
+//         void operator = (bool b);
+//       };
+//
+//     // Does not have to initialize bits.
+//     BSet();
+//
+//     // Must return a valid value for index when 0 <= index < maxDepth
+//     ANY_bitref operator [] (unsigned index);
+//
+//     // Set all bits to 1.
+//     void set();
+//
+//     // Set all bits to 0.
+//     void reset();
+//   };
+
+template<unsigned maxDepth>
+class AVLTreeDefaultBSet {
+public:
+    bool& operator[](unsigned i) { ASSERT(i < maxDepth); return m_data[i]; }
+    void set() { for (unsigned i = 0; i < maxDepth; ++i) m_data[i] = true; }
+    void reset() { for (unsigned i = 0; i < maxDepth; ++i) m_data[i] = false; }
+
+private:
+    FixedArray<bool, maxDepth> m_data;
+};
+
+// How to determine maxDepth:
+// d  Minimum number of nodes
+// 2  2
+// 3  4
+// 4  7
+// 5  12
+// 6  20
+// 7  33
+// 8  54
+// 9  88
+// 10 143
+// 11 232
+// 12 376
+// 13 609
+// 14 986
+// 15 1,596
+// 16 2,583
+// 17 4,180
+// 18 6,764
+// 19 10,945
+// 20 17,710
+// 21 28,656
+// 22 46,367
+// 23 75,024
+// 24 121,392
+// 25 196,417
+// 26 317,810
+// 27 514,228
+// 28 832,039
+// 29 1,346,268
+// 30 2,178,308
+// 31 3,524,577
+// 32 5,702,886
+// 33 9,227,464
+// 34 14,930,351
+// 35 24,157,816
+// 36 39,088,168
+// 37 63,245,985
+// 38 102,334,154
+// 39 165,580,140
+// 40 267,914,295
+// 41 433,494,436
+// 42 701,408,732
+// 43 1,134,903,169
+// 44 1,836,311,902
+// 45 2,971,215,072
+//
+// E.g., if, in a particular instantiation, the maximum number of nodes in a tree instance is 1,000,000, the maximum depth should be 28.
+// You pick 28 because MN(28) is 832,039, which is less than or equal to 1,000,000, and MN(29) is 1,346,268, which is strictly greater than 1,000,000.
+
+template <class Abstractor, unsigned maxDepth = 32, class BSet = AVLTreeDefaultBSet<maxDepth> >
+class AVLTree {
+public:
+
+    typedef typename Abstractor::key key;
+    typedef typename Abstractor::handle handle;
+    typedef typename Abstractor::size size;
+
+    enum SearchType {
+        EQUAL = 1,
+        LESS = 2,
+        GREATER = 4,
+        LESS_EQUAL = EQUAL | LESS,
+        GREATER_EQUAL = EQUAL | GREATER
+    };
+
+
+    Abstractor& abstractor() { return abs; }
+
+    inline handle insert(handle h);
+
+    inline handle search(key k, SearchType st = EQUAL);
+    inline handle search_least();
+    inline handle search_greatest();
+
+    inline handle remove(key k);
+
+    inline handle subst(handle new_node);
+
+    void purge() { abs.root = null(); }
+
+    bool is_empty() { return abs.root == null(); }
+
+    AVLTree() { abs.root = null(); }
+
+    class Iterator {
+    public:
+
+        // Initialize depth to invalid value, to indicate iterator is
+        // invalid.   (Depth is zero-base.)
+        Iterator() { depth = ~0U; }
+
+        void start_iter(AVLTree &tree, key k, SearchType st = EQUAL)
+        {
+            // Mask of high bit in an int.
+            const int MASK_HIGH_BIT = (int) ~ ((~ (unsigned) 0) >> 1);
+
+            // Save the tree that we're going to iterate through in a
+            // member variable.
+            tree_ = &tree;
+
+            int cmp, target_cmp;
+            handle h = tree_->abs.root;
+            unsigned d = 0;
+
+            depth = ~0U;
+
+            if (h == null())
+              // Tree is empty.
+              return;
+
+            if (st & LESS)
+              // Key can be greater than key of starting node.
+              target_cmp = 1;
+            else if (st & GREATER)
+              // Key can be less than key of starting node.
+              target_cmp = -1;
+            else
+              // Key must be same as key of starting node.
+              target_cmp = 0;
+
+            for (;;) {
+                cmp = cmp_k_n(k, h);
+                if (cmp == 0) {
+                    if (st & EQUAL) {
+                        // Equal node was sought and found as starting node.
+                        depth = d;
+                        break;
+                    }
+                    cmp = -target_cmp;
+                } else if (target_cmp != 0) {
+                    if (!((cmp ^ target_cmp) & MASK_HIGH_BIT)) {
+                        // cmp and target_cmp are both negative or both positive.
+                        depth = d;
+                    }
+                }
+                h = cmp < 0 ? get_lt(h) : get_gt(h);
+                if (h == null())
+                    break;
+                branch[d] = cmp > 0;
+                path_h[d++] = h;
+            }
+        }
+
+        void start_iter_least(AVLTree &tree)
+        {
+            tree_ = &tree;
+
+            handle h = tree_->abs.root;
+
+            depth = ~0U;
+
+            branch.reset();
+
+            while (h != null()) {
+                if (depth != ~0U)
+                    path_h[depth] = h;
+                depth++;
+                h = get_lt(h);
+            }
+        }
+
+        void start_iter_greatest(AVLTree &tree)
+        {
+            tree_ = &tree;
+
+            handle h = tree_->abs.root;
+
+            depth = ~0U;
+
+            branch.set();
+
+            while (h != null()) {
+                if (depth != ~0U)
+                    path_h[depth] = h;
+                depth++;
+                h = get_gt(h);
+            }
+        }
+
+        handle operator*()
+        {
+            if (depth == ~0U)
+                return null();
+
+            return depth == 0 ? tree_->abs.root : path_h[depth - 1];
+        }
+
+        void operator++()
+        {
+            if (depth != ~0U) {
+                handle h = get_gt(**this);
+                if (h == null()) {
+                    do {
+                        if (depth == 0) {
+                            depth = ~0U;
+                            break;
+                        }
+                        depth--;
+                    } while (branch[depth]);
+                } else {
+                    branch[depth] = true;
+                    path_h[depth++] = h;
+                    for (;;) {
+                        h = get_lt(h);
+                        if (h == null())
+                            break;
+                        branch[depth] = false;
+                        path_h[depth++] = h;
+                    }
+                }
+            }
+        }
+
+        void operator--()
+        {
+            if (depth != ~0U) {
+                handle h = get_lt(**this);
+                if (h == null())
+                    do {
+                        if (depth == 0) {
+                            depth = ~0U;
+                            break;
+                        }
+                        depth--;
+                    } while (!branch[depth]);
+                else {
+                    branch[depth] = false;
+                    path_h[depth++] = h;
+                    for (;;) {
+                        h = get_gt(h);
+                        if (h == null())
+                            break;
+                        branch[depth] = true;
+                        path_h[depth++] = h;
+                    }
+                }
+            }
+        }
+
+        void operator++(int) { ++(*this); }
+        void operator--(int) { --(*this); }
+
+    protected:
+
+        // Tree being iterated over.
+        AVLTree *tree_;
+
+        // Records a path into the tree.  If branch[n] is true, indicates
+        // take greater branch from the nth node in the path, otherwise
+        // take the less branch.  branch[0] gives branch from root, and
+        // so on.
+        BSet branch;
+
+        // Zero-based depth of path into tree.
+        unsigned depth;
+
+        // Handles of nodes in path from root to current node (returned by *).
+        handle path_h[maxDepth - 1];
+
+        int cmp_k_n(key k, handle h) { return tree_->abs.compare_key_node(k, h); }
+        int cmp_n_n(handle h1, handle h2) { return tree_->abs.compare_node_node(h1, h2); }
+        handle get_lt(handle h) { return tree_->abs.get_less(h); }
+        handle get_gt(handle h) { return tree_->abs.get_greater(h); }
+        handle null() { return tree_->abs.null(); }
+    };
+
+    template<typename fwd_iter>
+    bool build(fwd_iter p, size num_nodes)
+    {
+        if (num_nodes == 0) {
+            abs.root = null();
+            return true;
+        }
+
+        // Gives path to subtree being built.  If branch[N] is false, branch
+        // less from the node at depth N, if true branch greater.
+        BSet branch;
+
+        // If rem[N] is true, then for the current subtree at depth N, it's
+        // greater subtree has one more node than it's less subtree.
+        BSet rem;
+
+            // Depth of root node of current subtree.
+        unsigned depth = 0;
+
+            // Number of nodes in current subtree.
+        size num_sub = num_nodes;
+
+        // The algorithm relies on a stack of nodes whose less subtree has
+        // been built, but whose right subtree has not yet been built.  The
+        // stack is implemented as linked list.  The nodes are linked
+        // together by having the "greater" handle of a node set to the
+        // next node in the list.  "less_parent" is the handle of the first
+        // node in the list.
+        handle less_parent = null();
+
+        // h is root of current subtree, child is one of its children.
+        handle h, child;
+
+        for (;;) {
+            while (num_sub > 2) {
+                // Subtract one for root of subtree.
+                num_sub--;
+                rem[depth] = !!(num_sub & 1);
+                branch[depth++] = false;
+                num_sub >>= 1;
+            }
+
+            if (num_sub == 2) {
+                // Build a subtree with two nodes, slanting to greater.
+                // I arbitrarily chose to always have the extra node in the
+                // greater subtree when there is an odd number of nodes to
+                // split between the two subtrees.
+
+                h = *p;
+                p++;
+                child = *p;
+                p++;
+                set_lt(child, null());
+                set_gt(child, null());
+                set_bf(child, 0);
+                set_gt(h, child);
+                set_lt(h, null());
+                set_bf(h, 1);
+            } else { // num_sub == 1
+                // Build a subtree with one node.
+
+                h = *p;
+                p++;
+                set_lt(h, null());
+                set_gt(h, null());
+                set_bf(h, 0);
+            }
+
+            while (depth) {
+                depth--;
+                if (!branch[depth])
+                    // We've completed a less subtree.
+                    break;
+
+                // We've completed a greater subtree, so attach it to
+                // its parent (that is less than it).  We pop the parent
+                // off the stack of less parents.
+                child = h;
+                h = less_parent;
+                less_parent = get_gt(h);
+                set_gt(h, child);
+                // num_sub = 2 * (num_sub - rem[depth]) + rem[depth] + 1
+                num_sub <<= 1;
+                num_sub += 1 - rem[depth];
+                if (num_sub & (num_sub - 1))
+                    // num_sub is not a power of 2
+                    set_bf(h, 0);
+                else
+                    // num_sub is a power of 2
+                    set_bf(h, 1);
+            }
+
+            if (num_sub == num_nodes)
+                // We've completed the full tree.
+                break;
+
+            // The subtree we've completed is the less subtree of the
+            // next node in the sequence.
+
+            child = h;
+            h = *p;
+            p++;
+            set_lt(h, child);
+
+            // Put h into stack of less parents.
+            set_gt(h, less_parent);
+            less_parent = h;
+
+            // Proceed to creating greater than subtree of h.
+            branch[depth] = true;
+            num_sub += rem[depth++];
+
+        } // end for (;;)
+
+        abs.root = h;
+
+        return true;
+    }
+
+protected:
+
+    friend class Iterator;
+
+    // Create a class whose sole purpose is to take advantage of
+    // the "empty member" optimization.
+    struct abs_plus_root : public Abstractor {
+        // The handle of the root element in the AVL tree.
+        handle root;
+    };
+
+    abs_plus_root abs;
+
+
+    handle get_lt(handle h) { return abs.get_less(h); }
+    void set_lt(handle h, handle lh) { abs.set_less(h, lh); }
+
+    handle get_gt(handle h) { return abs.get_greater(h); }
+    void set_gt(handle h, handle gh) { abs.set_greater(h, gh); }
+
+    int get_bf(handle h) { return abs.get_balance_factor(h); }
+    void set_bf(handle h, int bf) { abs.set_balance_factor(h, bf); }
+
+    int cmp_k_n(key k, handle h) { return abs.compare_key_node(k, h); }
+    int cmp_n_n(handle h1, handle h2) { return abs.compare_node_node(h1, h2); }
+
+    handle null() { return abs.null(); }
+
+private:
+
+    // Balances subtree, returns handle of root node of subtree
+    // after balancing.
+    handle balance(handle bal_h)
+    {
+        handle deep_h;
+
+        // Either the "greater than" or the "less than" subtree of
+        // this node has to be 2 levels deeper (or else it wouldn't
+        // need balancing).
+
+        if (get_bf(bal_h) > 0) {
+            // "Greater than" subtree is deeper.
+
+            deep_h = get_gt(bal_h);
+
+            if (get_bf(deep_h) < 0) {
+                handle old_h = bal_h;
+                bal_h = get_lt(deep_h);
+
+                set_gt(old_h, get_lt(bal_h));
+                set_lt(deep_h, get_gt(bal_h));
+                set_lt(bal_h, old_h);
+                set_gt(bal_h, deep_h);
+
+                int bf = get_bf(bal_h);
+                if (bf != 0) {
+                    if (bf > 0) {
+                        set_bf(old_h, -1);
+                        set_bf(deep_h, 0);
+                    } else {
+                        set_bf(deep_h, 1);
+                        set_bf(old_h, 0);
+                    }
+                    set_bf(bal_h, 0);
+                } else {
+                    set_bf(old_h, 0);
+                    set_bf(deep_h, 0);
+                }
+            } else {
+                set_gt(bal_h, get_lt(deep_h));
+                set_lt(deep_h, bal_h);
+                if (get_bf(deep_h) == 0) {
+                    set_bf(deep_h, -1);
+                    set_bf(bal_h, 1);
+                } else {
+                    set_bf(deep_h, 0);
+                    set_bf(bal_h, 0);
+                }
+                bal_h = deep_h;
+            }
+        } else {
+            // "Less than" subtree is deeper.
+
+            deep_h = get_lt(bal_h);
+
+            if (get_bf(deep_h) > 0) {
+                handle old_h = bal_h;
+                bal_h = get_gt(deep_h);
+                set_lt(old_h, get_gt(bal_h));
+                set_gt(deep_h, get_lt(bal_h));
+                set_gt(bal_h, old_h);
+                set_lt(bal_h, deep_h);
+
+                int bf = get_bf(bal_h);
+                if (bf != 0) {
+                    if (bf < 0) {
+                        set_bf(old_h, 1);
+                        set_bf(deep_h, 0);
+                    } else {
+                        set_bf(deep_h, -1);
+                        set_bf(old_h, 0);
+                    }
+                    set_bf(bal_h, 0);
+                } else {
+                    set_bf(old_h, 0);
+                    set_bf(deep_h, 0);
+                }
+            } else {
+                set_lt(bal_h, get_gt(deep_h));
+                set_gt(deep_h, bal_h);
+                if (get_bf(deep_h) == 0) {
+                    set_bf(deep_h, 1);
+                    set_bf(bal_h, -1);
+                } else {
+                    set_bf(deep_h, 0);
+                    set_bf(bal_h, 0);
+                }
+                bal_h = deep_h;
+            }
+        }
+
+        return bal_h;
+    }
+
+};
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::insert(handle h)
+{
+    set_lt(h, null());
+    set_gt(h, null());
+    set_bf(h, 0);
+
+    if (abs.root == null())
+        abs.root = h;
+    else {
+        // Last unbalanced node encountered in search for insertion point.
+        handle unbal = null();
+        // Parent of last unbalanced node.
+        handle parent_unbal = null();
+        // Balance factor of last unbalanced node.
+        int unbal_bf;
+
+        // Zero-based depth in tree.
+        unsigned depth = 0, unbal_depth = 0;
+
+        // Records a path into the tree.  If branch[n] is true, indicates
+        // take greater branch from the nth node in the path, otherwise
+        // take the less branch.  branch[0] gives branch from root, and
+        // so on.
+        BSet branch;
+
+        handle hh = abs.root;
+        handle parent = null();
+        int cmp;
+
+        do {
+            if (get_bf(hh) != 0) {
+                unbal = hh;
+                parent_unbal = parent;
+                unbal_depth = depth;
+            }
+            cmp = cmp_n_n(h, hh);
+            if (cmp == 0)
+                // Duplicate key.
+                return hh;
+            parent = hh;
+            hh = cmp < 0 ? get_lt(hh) : get_gt(hh);
+            branch[depth++] = cmp > 0;
+        } while (hh != null());
+
+        //  Add node to insert as leaf of tree.
+        if (cmp < 0)
+            set_lt(parent, h);
+        else
+            set_gt(parent, h);
+
+        depth = unbal_depth;
+
+        if (unbal == null())
+            hh = abs.root;
+        else {
+            cmp = branch[depth++] ? 1 : -1;
+            unbal_bf = get_bf(unbal);
+            if (cmp < 0)
+                unbal_bf--;
+            else  // cmp > 0
+                unbal_bf++;
+            hh = cmp < 0 ? get_lt(unbal) : get_gt(unbal);
+            if ((unbal_bf != -2) && (unbal_bf != 2)) {
+                // No rebalancing of tree is necessary.
+                set_bf(unbal, unbal_bf);
+                unbal = null();
+            }
+        }
+
+        if (hh != null())
+            while (h != hh) {
+                cmp = branch[depth++] ? 1 : -1;
+                if (cmp < 0) {
+                    set_bf(hh, -1);
+                    hh = get_lt(hh);
+                } else { // cmp > 0
+                    set_bf(hh, 1);
+                    hh = get_gt(hh);
+                }
+            }
+
+        if (unbal != null()) {
+            unbal = balance(unbal);
+            if (parent_unbal == null())
+                abs.root = unbal;
+            else {
+                depth = unbal_depth - 1;
+                cmp = branch[depth] ? 1 : -1;
+                if (cmp < 0)
+                    set_lt(parent_unbal, unbal);
+                else  // cmp > 0
+                    set_gt(parent_unbal, unbal);
+            }
+        }
+    }
+
+    return h;
+}
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::search(key k, typename AVLTree<Abstractor, maxDepth, BSet>::SearchType st)
+{
+    const int MASK_HIGH_BIT = (int) ~ ((~ (unsigned) 0) >> 1);
+
+    int cmp, target_cmp;
+    handle match_h = null();
+    handle h = abs.root;
+
+    if (st & LESS)
+        target_cmp = 1;
+    else if (st & GREATER)
+        target_cmp = -1;
+    else
+        target_cmp = 0;
+
+    while (h != null()) {
+        cmp = cmp_k_n(k, h);
+        if (cmp == 0) {
+            if (st & EQUAL) {
+                match_h = h;
+                break;
+            }
+            cmp = -target_cmp;
+        } else if (target_cmp != 0)
+            if (!((cmp ^ target_cmp) & MASK_HIGH_BIT))
+                // cmp and target_cmp are both positive or both negative.
+                match_h = h;
+        h = cmp < 0 ? get_lt(h) : get_gt(h);
+    }
+
+    return match_h;
+}
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::search_least()
+{
+    handle h = abs.root, parent = null();
+
+    while (h != null()) {
+        parent = h;
+        h = get_lt(h);
+    }
+
+    return parent;
+}
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::search_greatest()
+{
+    handle h = abs.root, parent = null();
+
+    while (h != null()) {
+        parent = h;
+        h = get_gt(h);
+    }
+
+    return parent;
+}
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::remove(key k)
+{
+    // Zero-based depth in tree.
+    unsigned depth = 0, rm_depth;
+
+    // Records a path into the tree.  If branch[n] is true, indicates
+    // take greater branch from the nth node in the path, otherwise
+    // take the less branch.  branch[0] gives branch from root, and
+    // so on.
+    BSet branch;
+
+    handle h = abs.root;
+    handle parent = null(), child;
+    int cmp, cmp_shortened_sub_with_path = 0;
+
+    for (;;) {
+        if (h == null())
+            // No node in tree with given key.
+            return null();
+        cmp = cmp_k_n(k, h);
+        if (cmp == 0)
+            // Found node to remove.
+            break;
+        parent = h;
+        h = cmp < 0 ? get_lt(h) : get_gt(h);
+        branch[depth++] = cmp > 0;
+        cmp_shortened_sub_with_path = cmp;
+    }
+    handle rm = h;
+    handle parent_rm = parent;
+    rm_depth = depth;
+
+    // If the node to remove is not a leaf node, we need to get a
+    // leaf node, or a node with a single leaf as its child, to put
+    // in the place of the node to remove.  We will get the greatest
+    // node in the less subtree (of the node to remove), or the least
+    // node in the greater subtree.  We take the leaf node from the
+    // deeper subtree, if there is one.
+
+    if (get_bf(h) < 0) {
+        child = get_lt(h);
+        branch[depth] = false;
+        cmp = -1;
+    } else {
+        child = get_gt(h);
+        branch[depth] = true;
+        cmp = 1;
+    }
+    depth++;
+
+    if (child != null()) {
+        cmp = -cmp;
+        do {
+            parent = h;
+            h = child;
+            if (cmp < 0) {
+                child = get_lt(h);
+                branch[depth] = false;
+            } else {
+                child = get_gt(h);
+                branch[depth] = true;
+            }
+            depth++;
+        } while (child != null());
+
+        if (parent == rm)
+            // Only went through do loop once.  Deleted node will be replaced
+            // in the tree structure by one of its immediate children.
+            cmp_shortened_sub_with_path = -cmp;
+        else
+            cmp_shortened_sub_with_path = cmp;
+
+        // Get the handle of the opposite child, which may not be null.
+        child = cmp > 0 ? get_lt(h) : get_gt(h);
+    }
+
+    if (parent == null())
+        // There were only 1 or 2 nodes in this tree.
+        abs.root = child;
+    else if (cmp_shortened_sub_with_path < 0)
+        set_lt(parent, child);
+    else
+        set_gt(parent, child);
+
+    // "path" is the parent of the subtree being eliminated or reduced
+    // from a depth of 2 to 1.  If "path" is the node to be removed, we
+    // set path to the node we're about to poke into the position of the
+    // node to be removed.
+    handle path = parent == rm ? h : parent;
+
+    if (h != rm) {
+        // Poke in the replacement for the node to be removed.
+        set_lt(h, get_lt(rm));
+        set_gt(h, get_gt(rm));
+        set_bf(h, get_bf(rm));
+        if (parent_rm == null())
+            abs.root = h;
+        else {
+            depth = rm_depth - 1;
+            if (branch[depth])
+                set_gt(parent_rm, h);
+            else
+                set_lt(parent_rm, h);
+        }
+    }
+
+    if (path != null()) {
+        // Create a temporary linked list from the parent of the path node
+        // to the root node.
+        h = abs.root;
+        parent = null();
+        depth = 0;
+        while (h != path) {
+            if (branch[depth++]) {
+                child = get_gt(h);
+                set_gt(h, parent);
+            } else {
+                child = get_lt(h);
+                set_lt(h, parent);
+            }
+            parent = h;
+            h = child;
+        }
+
+        // Climb from the path node to the root node using the linked
+        // list, restoring the tree structure and rebalancing as necessary.
+        bool reduced_depth = true;
+        int bf;
+        cmp = cmp_shortened_sub_with_path;
+        for (;;) {
+            if (reduced_depth) {
+                bf = get_bf(h);
+                if (cmp < 0)
+                    bf++;
+                else  // cmp > 0
+                    bf--;
+                if ((bf == -2) || (bf == 2)) {
+                    h = balance(h);
+                    bf = get_bf(h);
+                } else
+                    set_bf(h, bf);
+                reduced_depth = (bf == 0);
+            }
+            if (parent == null())
+                break;
+            child = h;
+            h = parent;
+            cmp = branch[--depth] ? 1 : -1;
+            if (cmp < 0)    {
+                parent = get_lt(h);
+                set_lt(h, child);
+            } else {
+                parent = get_gt(h);
+                set_gt(h, child);
+            }
+        }
+        abs.root = h;
+    }
+
+    return rm;
+}
+
+template <class Abstractor, unsigned maxDepth, class BSet>
+inline typename AVLTree<Abstractor, maxDepth, BSet>::handle
+AVLTree<Abstractor, maxDepth, BSet>::subst(handle new_node)
+{
+    handle h = abs.root;
+    handle parent = null();
+    int cmp, last_cmp;
+
+    /* Search for node already in tree with same key. */
+    for (;;) {
+        if (h == null())
+            /* No node in tree with same key as new node. */
+            return null();
+        cmp = cmp_n_n(new_node, h);
+        if (cmp == 0)
+            /* Found the node to substitute new one for. */
+            break;
+        last_cmp = cmp;
+        parent = h;
+        h = cmp < 0 ? get_lt(h) : get_gt(h);
+    }
+
+    /* Copy tree housekeeping fields from node in tree to new node. */
+    set_lt(new_node, get_lt(h));
+    set_gt(new_node, get_gt(h));
+    set_bf(new_node, get_bf(h));
+
+    if (parent == null())
+        /* New node is also new root. */
+        abs.root = new_node;
+    else {
+        /* Make parent point to new node. */
+        if (last_cmp < 0)
+            set_lt(parent, new_node);
+        else
+            set_gt(parent, new_node);
+    }
+
+    return h;
+}
+
+}
+
+#endif
diff --git a/Source/WTF/wtf/Alignment.h b/Source/WTF/wtf/Alignment.h
new file mode 100644
index 0000000..7dfda20
--- /dev/null
+++ b/Source/WTF/wtf/Alignment.h
@@ -0,0 +1,70 @@
+/*
+ *  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>
+#include <algorithm>
+#include <stdint.h>
+
+
+namespace WTF {
+
+#if COMPILER(GCC) || COMPILER(MINGW) || COMPILER(RVCT) || COMPILER(GCCE) || (COMPILER(SUNCC) && __SUNPRO_CC > 0x590)
+    #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
+    typedef char AlignedBufferChar; 
+#endif
+
+    template<size_t size, size_t alignment> struct AlignedBuffer;
+    template<size_t size> struct AlignedBuffer<size, 1> { AlignedBufferChar buffer[size]; };
+    template<size_t size> struct AlignedBuffer<size, 2> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 2);  };
+    template<size_t size> struct AlignedBuffer<size, 4> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 4);  };
+    template<size_t size> struct AlignedBuffer<size, 8> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 8);  };
+    template<size_t size> struct AlignedBuffer<size, 16> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 16); };
+    template<size_t size> struct AlignedBuffer<size, 32> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 32); };
+    template<size_t size> struct AlignedBuffer<size, 64> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 64); };
+
+    template <size_t size, size_t alignment>
+    void swap(AlignedBuffer<size, alignment>& a, AlignedBuffer<size, alignment>& b)
+    {
+        for (size_t i = 0; i < size; ++i)
+            std::swap(a.buffer[i], b.buffer[i]);
+    }
+
+    template <uintptr_t mask>
+    inline bool isAlignedTo(const void* pointer)
+    {
+        return !(reinterpret_cast<uintptr_t>(pointer) & mask);
+    }
+}
+
+#endif // WTF_Alignment_h
diff --git a/Source/WTF/wtf/AlwaysInline.h b/Source/WTF/wtf/AlwaysInline.h
new file mode 100644
index 0000000..68b7ae1
--- /dev/null
+++ b/Source/WTF/wtf/AlwaysInline.h
@@ -0,0 +1,23 @@
+/*
+ *  Copyright (C) 2005, 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.
+ *
+ */
+
+/* This file is no longer necessary, since all the functionality has been moved to Compiler.h. */
+
+#include <wtf/Platform.h>
diff --git a/Source/WTF/wtf/ArrayBuffer.cpp b/Source/WTF/wtf/ArrayBuffer.cpp
new file mode 100644
index 0000000..45cfa1d
--- /dev/null
+++ b/Source/WTF/wtf/ArrayBuffer.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 "ArrayBuffer.h"
+
+#include "ArrayBufferView.h"
+
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+bool ArrayBuffer::transfer(ArrayBufferContents& result, Vector<RefPtr<ArrayBufferView> >& neuteredViews)
+{
+    RefPtr<ArrayBuffer> keepAlive(this);
+
+    if (!m_contents.m_data) {
+        result.m_data = 0;
+        return false;
+    }
+
+    m_contents.transfer(result);
+
+    while (m_firstView) {
+        ArrayBufferView* current = m_firstView;
+        removeView(current);
+        current->neuter();
+        neuteredViews.append(current);
+    }
+    return true;
+}
+
+void ArrayBuffer::addView(ArrayBufferView* view)
+{
+    view->m_buffer = this;
+    view->m_prevView = 0;
+    view->m_nextView = m_firstView;
+    if (m_firstView)
+        m_firstView->m_prevView = view;
+    m_firstView = view;
+}
+
+void ArrayBuffer::removeView(ArrayBufferView* view)
+{
+    ASSERT(this == view->m_buffer);
+    if (view->m_nextView)
+        view->m_nextView->m_prevView = view->m_prevView;
+    if (view->m_prevView)
+        view->m_prevView->m_nextView = view->m_nextView;
+    if (m_firstView == view)
+        m_firstView = view->m_nextView;
+    view->m_prevView = view->m_nextView = 0;
+}
+
+}
diff --git a/Source/WTF/wtf/ArrayBuffer.h b/Source/WTF/wtf/ArrayBuffer.h
new file mode 100644
index 0000000..aa59cf7
--- /dev/null
+++ b/Source/WTF/wtf/ArrayBuffer.h
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 ArrayBuffer_h
+#define ArrayBuffer_h
+
+#include <wtf/HashSet.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+class ArrayBuffer;
+class ArrayBufferView;
+
+#if defined(WTF_USE_V8)
+// The current implementation assumes that the instance of this class is a
+// singleton living for the entire process's lifetime.
+class ArrayBufferDeallocationObserver {
+public:
+    virtual void ArrayBufferDeallocated(unsigned sizeInBytes) = 0;
+};
+#endif
+
+
+class ArrayBufferContents {
+    WTF_MAKE_NONCOPYABLE(ArrayBufferContents);
+public:
+    ArrayBufferContents() 
+        : m_data(0)
+        , m_sizeInBytes(0)
+#if defined(WTF_USE_V8)
+        , m_deallocationObserver(0)
+#endif
+    { }
+
+    inline ~ArrayBufferContents();
+
+    void* data() { return m_data; }
+    unsigned sizeInBytes() { return m_sizeInBytes; }
+
+private:
+    ArrayBufferContents(void* data, unsigned sizeInBytes) 
+        : m_data(data)
+        , m_sizeInBytes(sizeInBytes)
+#if defined(WTF_USE_V8)
+        , m_deallocationObserver(0)
+#endif
+    { }
+
+    friend class ArrayBuffer;
+
+    enum InitializationPolicy {
+        ZeroInitialize,
+        DontInitialize
+    };
+
+    static inline void tryAllocate(unsigned numElements, unsigned elementByteSize, InitializationPolicy, ArrayBufferContents&);
+    void transfer(ArrayBufferContents& other)
+    {
+        ASSERT(!other.m_data);
+        other.m_data = m_data;
+        other.m_sizeInBytes = m_sizeInBytes;
+        m_data = 0;
+        m_sizeInBytes = 0;
+#if defined(WTF_USE_V8)
+        // Notify the current V8 isolate that the buffer is gone.
+        if (m_deallocationObserver)
+            m_deallocationObserver->ArrayBufferDeallocated(other.m_sizeInBytes);
+        ASSERT(!other.m_deallocationObserver);
+        m_deallocationObserver = 0;
+#endif
+    }
+
+    void* m_data;
+    unsigned m_sizeInBytes;
+
+#if defined(WTF_USE_V8)
+    ArrayBufferDeallocationObserver* m_deallocationObserver;
+#endif
+};
+
+class ArrayBuffer : public RefCounted<ArrayBuffer> {
+public:
+    static inline PassRefPtr<ArrayBuffer> create(unsigned numElements, unsigned elementByteSize);
+    static inline PassRefPtr<ArrayBuffer> create(ArrayBuffer*);
+    static inline PassRefPtr<ArrayBuffer> create(const void* source, unsigned byteLength);
+    static inline PassRefPtr<ArrayBuffer> create(ArrayBufferContents&);
+
+    // Only for use by Uint8ClampedArray::createUninitialized.
+    static inline PassRefPtr<ArrayBuffer> createUninitialized(unsigned numElements, unsigned elementByteSize);
+
+    inline void* data();
+    inline const void* data() const;
+    inline unsigned byteLength() const;
+
+    inline PassRefPtr<ArrayBuffer> slice(int begin, int end) const;
+    inline PassRefPtr<ArrayBuffer> slice(int begin) const;
+
+    void addView(ArrayBufferView*);
+    void removeView(ArrayBufferView*);
+
+    WTF_EXPORT_PRIVATE bool transfer(ArrayBufferContents&, Vector<RefPtr<ArrayBufferView> >& neuteredViews);
+    bool isNeutered() { return !m_contents.m_data; }
+
+#if defined(WTF_USE_V8)
+    void setDeallocationObserver(ArrayBufferDeallocationObserver* deallocationObserver)
+    {
+        m_contents.m_deallocationObserver = deallocationObserver;
+    }
+#endif
+
+    ~ArrayBuffer() { }
+
+private:
+    static inline PassRefPtr<ArrayBuffer> create(unsigned numElements, unsigned elementByteSize, ArrayBufferContents::InitializationPolicy);
+
+    inline ArrayBuffer(ArrayBufferContents&);
+    inline PassRefPtr<ArrayBuffer> sliceImpl(unsigned begin, unsigned end) const;
+    inline unsigned clampIndex(int index) const;
+    static inline int clampValue(int x, int left, int right);
+
+    ArrayBufferContents m_contents;
+    ArrayBufferView* m_firstView;
+};
+
+int ArrayBuffer::clampValue(int x, int left, int right)
+{
+    ASSERT(left <= right);
+    if (x < left)
+        x = left;
+    if (right < x)
+        x = right;
+    return x;
+}
+
+PassRefPtr<ArrayBuffer> ArrayBuffer::create(unsigned numElements, unsigned elementByteSize)
+{
+    return create(numElements, elementByteSize, ArrayBufferContents::ZeroInitialize);
+}
+
+PassRefPtr<ArrayBuffer> ArrayBuffer::create(ArrayBuffer* other)
+{
+    return ArrayBuffer::create(other->data(), other->byteLength());
+}
+
+PassRefPtr<ArrayBuffer> ArrayBuffer::create(const void* source, unsigned byteLength)
+{
+    ArrayBufferContents contents;
+    ArrayBufferContents::tryAllocate(byteLength, 1, ArrayBufferContents::ZeroInitialize, contents);
+    if (!contents.m_data)
+        return 0;
+    RefPtr<ArrayBuffer> buffer = adoptRef(new ArrayBuffer(contents));
+    memcpy(buffer->data(), source, byteLength);
+    return buffer.release();
+}
+
+PassRefPtr<ArrayBuffer> ArrayBuffer::create(ArrayBufferContents& contents)
+{
+    return adoptRef(new ArrayBuffer(contents));
+}
+
+PassRefPtr<ArrayBuffer> ArrayBuffer::createUninitialized(unsigned numElements, unsigned elementByteSize)
+{
+    return create(numElements, elementByteSize, ArrayBufferContents::DontInitialize);
+}
+
+PassRefPtr<ArrayBuffer> ArrayBuffer::create(unsigned numElements, unsigned elementByteSize, ArrayBufferContents::InitializationPolicy policy)
+{
+    ArrayBufferContents contents;
+    ArrayBufferContents::tryAllocate(numElements, elementByteSize, policy, contents);
+    if (!contents.m_data)
+        return 0;
+    return adoptRef(new ArrayBuffer(contents));
+}
+
+ArrayBuffer::ArrayBuffer(ArrayBufferContents& contents)
+    : m_firstView(0)
+{
+    contents.transfer(m_contents);
+}
+
+void* ArrayBuffer::data()
+{
+    return m_contents.m_data;
+}
+
+const void* ArrayBuffer::data() const
+{
+    return m_contents.m_data;
+}
+
+unsigned ArrayBuffer::byteLength() const
+{
+    return m_contents.m_sizeInBytes;
+}
+
+PassRefPtr<ArrayBuffer> ArrayBuffer::slice(int begin, int end) const
+{
+    return sliceImpl(clampIndex(begin), clampIndex(end));
+}
+
+PassRefPtr<ArrayBuffer> ArrayBuffer::slice(int begin) const
+{
+    return sliceImpl(clampIndex(begin), byteLength());
+}
+
+PassRefPtr<ArrayBuffer> ArrayBuffer::sliceImpl(unsigned begin, unsigned end) const
+{
+    unsigned size = begin <= end ? end - begin : 0;
+    return ArrayBuffer::create(static_cast<const char*>(data()) + begin, size);
+}
+
+unsigned ArrayBuffer::clampIndex(int index) const
+{
+    unsigned currentLength = byteLength();
+    if (index < 0)
+        index = currentLength + index;
+    return clampValue(index, 0, currentLength);
+}
+
+void ArrayBufferContents::tryAllocate(unsigned numElements, unsigned elementByteSize, ArrayBufferContents::InitializationPolicy policy, ArrayBufferContents& result)
+{
+    // Do not allow 32-bit overflow of the total size.
+    // FIXME: Why not? The tryFastCalloc function already checks its arguments,
+    // and will fail if there is any overflow, so why should we include a
+    // redudant unnecessarily restrictive check here?
+    if (numElements) {
+        unsigned totalSize = numElements * elementByteSize;
+        if (totalSize / numElements != elementByteSize) {
+            result.m_data = 0;
+            return;
+        }
+    }
+    bool allocationSucceeded = false;
+    if (policy == ZeroInitialize)
+        allocationSucceeded = WTF::tryFastCalloc(numElements, elementByteSize).getValue(result.m_data);
+    else {
+        ASSERT(policy == DontInitialize);
+        allocationSucceeded = WTF::tryFastMalloc(numElements * elementByteSize).getValue(result.m_data);
+    }
+
+    if (allocationSucceeded) {
+        result.m_sizeInBytes = numElements * elementByteSize;
+        return;
+    }
+    result.m_data = 0;
+}
+
+ArrayBufferContents::~ArrayBufferContents()
+{
+#if defined (WTF_USE_V8)
+    if (m_deallocationObserver)
+        m_deallocationObserver->ArrayBufferDeallocated(m_sizeInBytes);
+#endif
+    WTF::fastFree(m_data);
+}
+
+} // namespace WTF
+
+using WTF::ArrayBuffer;
+
+#endif // ArrayBuffer_h
diff --git a/Source/WTF/wtf/ArrayBufferView.cpp b/Source/WTF/wtf/ArrayBufferView.cpp
new file mode 100644
index 0000000..66759de
--- /dev/null
+++ b/Source/WTF/wtf/ArrayBufferView.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 "ArrayBufferView.h"
+
+#include "ArrayBuffer.h"
+
+namespace WTF {
+
+ArrayBufferView::ArrayBufferView(PassRefPtr<ArrayBuffer> buffer,
+                       unsigned byteOffset)
+        : m_byteOffset(byteOffset)
+        , m_buffer(buffer)
+        , m_prevView(0)
+        , m_nextView(0)
+{
+    m_baseAddress = m_buffer ? (static_cast<char*>(m_buffer->data()) + m_byteOffset) : 0;
+    if (m_buffer) 
+        m_buffer->addView(this);
+}
+
+ArrayBufferView::~ArrayBufferView()
+{
+    if (m_buffer)
+        m_buffer->removeView(this);
+}
+
+void ArrayBufferView::neuter()
+{
+    m_buffer = 0;
+    m_byteOffset = 0;
+}
+
+}
diff --git a/Source/WTF/wtf/ArrayBufferView.h b/Source/WTF/wtf/ArrayBufferView.h
new file mode 100644
index 0000000..451c1b6
--- /dev/null
+++ b/Source/WTF/wtf/ArrayBufferView.h
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 ArrayBufferView_h
+#define ArrayBufferView_h
+
+#include <wtf/ArrayBuffer.h>
+
+#include <algorithm>
+#include <limits.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WTF {
+
+class WTF_EXPORT_PRIVATE_RTTI ArrayBufferView : public RefCounted<ArrayBufferView> {
+  public:
+    enum ViewType {
+        TypeInt8,
+        TypeUint8,
+        TypeUint8Clamped,
+        TypeInt16,
+        TypeUint16,
+        TypeInt32,
+        TypeUint32,
+        TypeFloat32,
+        TypeFloat64,
+        TypeDataView
+    };
+    virtual ViewType getType() const = 0;
+
+    PassRefPtr<ArrayBuffer> buffer() const
+    {
+        return m_buffer;
+    }
+
+    void* baseAddress() const
+    {
+        return m_baseAddress;
+    }
+
+    unsigned byteOffset() const
+    {
+        return m_byteOffset;
+    }
+
+    virtual unsigned byteLength() const = 0;
+
+    WTF_EXPORT_PRIVATE_NO_RTTI virtual ~ArrayBufferView();
+
+  protected:
+    WTF_EXPORT_PRIVATE_NO_RTTI ArrayBufferView(PassRefPtr<ArrayBuffer>, unsigned byteOffset);
+
+    inline bool setImpl(ArrayBufferView*, unsigned byteOffset);
+
+    inline bool setRangeImpl(const char* data, size_t dataByteLength, unsigned byteOffset);
+
+    inline bool zeroRangeImpl(unsigned byteOffset, size_t rangeByteLength);
+
+    static inline void calculateOffsetAndLength(int start, int end, unsigned arraySize,
+                                         unsigned* offset, unsigned* length);
+
+    // Helper to verify that a given sub-range of an ArrayBuffer is
+    // within range.
+    template <typename T>
+    static bool verifySubRange(PassRefPtr<ArrayBuffer> buffer,
+                               unsigned byteOffset,
+                               unsigned numElements)
+    {
+        if (!buffer)
+            return false;
+        if (sizeof(T) > 1 && byteOffset % sizeof(T))
+            return false;
+        if (byteOffset > buffer->byteLength())
+            return false;
+        unsigned remainingElements = (buffer->byteLength() - byteOffset) / sizeof(T);
+        if (numElements > remainingElements)
+            return false;
+        return true;
+    }
+
+    // Input offset is in number of elements from this array's view;
+    // output offset is in number of bytes from the underlying buffer's view.
+    template <typename T>
+    static void clampOffsetAndNumElements(PassRefPtr<ArrayBuffer> buffer,
+                                          unsigned arrayByteOffset,
+                                          unsigned *offset,
+                                          unsigned *numElements)
+    {
+        unsigned maxOffset = (UINT_MAX - arrayByteOffset) / sizeof(T);
+        if (*offset > maxOffset) {
+            *offset = buffer->byteLength();
+            *numElements = 0;
+            return;
+        }
+        *offset = arrayByteOffset + *offset * sizeof(T);
+        *offset = std::min(buffer->byteLength(), *offset);
+        unsigned remainingElements = (buffer->byteLength() - *offset) / sizeof(T);
+        *numElements = std::min(remainingElements, *numElements);
+    }
+
+    WTF_EXPORT_PRIVATE_NO_RTTI virtual void neuter();
+
+    // This is the address of the ArrayBuffer's storage, plus the byte offset.
+    void* m_baseAddress;
+
+    unsigned m_byteOffset;
+
+  private:
+    friend class ArrayBuffer;
+    RefPtr<ArrayBuffer> m_buffer;
+    ArrayBufferView* m_prevView;
+    ArrayBufferView* m_nextView;
+};
+
+bool ArrayBufferView::setImpl(ArrayBufferView* array, unsigned byteOffset)
+{
+    if (byteOffset > byteLength()
+        || byteOffset + array->byteLength() > byteLength()
+        || byteOffset + array->byteLength() < byteOffset) {
+        // Out of range offset or overflow
+        return false;
+    }
+    
+    char* base = static_cast<char*>(baseAddress());
+    memmove(base + byteOffset, array->baseAddress(), array->byteLength());
+    return true;
+}
+
+bool ArrayBufferView::setRangeImpl(const char* data, size_t dataByteLength, unsigned byteOffset)
+{
+    if (byteOffset > byteLength()
+        || byteOffset + dataByteLength > byteLength()
+        || byteOffset + dataByteLength < byteOffset) {
+        // Out of range offset or overflow
+        return false;
+    }
+    
+    char* base = static_cast<char*>(baseAddress());
+    memmove(base + byteOffset, data, dataByteLength);
+    return true;
+}
+
+bool ArrayBufferView::zeroRangeImpl(unsigned byteOffset, size_t rangeByteLength)
+{
+    if (byteOffset > byteLength()
+        || byteOffset + rangeByteLength > byteLength()
+        || byteOffset + rangeByteLength < byteOffset) {
+        // Out of range offset or overflow
+        return false;
+    }
+    
+    char* base = static_cast<char*>(baseAddress());
+    memset(base + byteOffset, 0, rangeByteLength);
+    return true;
+}
+
+void ArrayBufferView::calculateOffsetAndLength(int start, int end, unsigned arraySize,
+                                               unsigned* offset, unsigned* length)
+{
+    if (start < 0)
+        start += arraySize;
+    if (start < 0)
+        start = 0;
+    if (end < 0)
+        end += arraySize;
+    if (end < 0)
+        end = 0;
+    if (static_cast<unsigned>(end) > arraySize)
+        end = arraySize;
+    if (end < start)
+        end = start;
+    *offset = static_cast<unsigned>(start);
+    *length = static_cast<unsigned>(end - start);
+}
+
+} // namespace WTF
+
+using WTF::ArrayBufferView;
+
+#endif // ArrayBufferView_h
diff --git a/Source/WTF/wtf/Assertions.cpp b/Source/WTF/wtf/Assertions.cpp
new file mode 100644
index 0000000..0640bc5
--- /dev/null
+++ b/Source/WTF/wtf/Assertions.cpp
@@ -0,0 +1,426 @@
+/*
+ * Copyright (C) 2003, 2006, 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ * Copyright (C) 2011 University of Szeged. 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 COMPUTER, INC. ``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 COMPUTER, INC. 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.
+ */
+
+// The vprintf_stderr_common function triggers this error in the Mac build.
+// Feel free to remove this pragma if this file builds on Mac.
+// According to http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
+// we need to place this directive before any data or functions are defined.
+#pragma GCC diagnostic ignored "-Wmissing-format-attribute"
+
+#include "config.h"
+#include "Assertions.h"
+
+#include "Compiler.h"
+#include "OwnArrayPtr.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+#if HAVE(SIGNAL_H)
+#include <signal.h>
+#endif
+
+#if PLATFORM(MAC)
+#include <CoreFoundation/CFString.h>
+#include <asl.h>
+#endif
+
+#if COMPILER(MSVC) && !OS(WINCE)
+#include <crtdbg.h>
+#endif
+
+#if OS(WINDOWS)
+#include <windows.h>
+#endif
+
+#if (OS(DARWIN) || OS(LINUX)) && !OS(ANDROID)
+#include <cxxabi.h>
+#include <dlfcn.h>
+#include <execinfo.h>
+#endif
+
+#if OS(ANDROID)
+#include "android/log.h"
+#endif
+
+#if PLATFORM(BLACKBERRY)
+#include <BlackBerryPlatformLog.h>
+#endif
+
+extern "C" {
+
+WTF_ATTRIBUTE_PRINTF(1, 0)
+static void vprintf_stderr_common(const char* format, va_list args)
+{
+#if PLATFORM(MAC)
+    if (strstr(format, "%@")) {
+        CFStringRef cfFormat = CFStringCreateWithCString(NULL, format, kCFStringEncodingUTF8);
+
+#if COMPILER(CLANG)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#endif
+        CFStringRef str = CFStringCreateWithFormatAndArguments(NULL, NULL, cfFormat, args);
+#if COMPILER(CLANG)
+#pragma clang diagnostic pop
+#endif
+        int length = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str), kCFStringEncodingUTF8);
+        char* buffer = (char*)malloc(length + 1);
+
+        CFStringGetCString(str, buffer, length, kCFStringEncodingUTF8);
+
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+        asl_log(0, 0, ASL_LEVEL_NOTICE, "%s", buffer);
+#endif
+        fputs(buffer, stderr);
+
+        free(buffer);
+        CFRelease(str);
+        CFRelease(cfFormat);
+        return;
+    }
+
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+    va_list copyOfArgs;
+    va_copy(copyOfArgs, args);
+    asl_vlog(0, 0, ASL_LEVEL_NOTICE, format, copyOfArgs);
+    va_end(copyOfArgs);
+#endif
+
+    // Fall through to write to stderr in the same manner as other platforms.
+
+#elif PLATFORM(BLACKBERRY)
+    BBLOGV(BlackBerry::Platform::LogLevelCritical, format, args);
+#elif OS(ANDROID)
+    __android_log_vprint(ANDROID_LOG_WARN, "WebKit", format, args);
+#elif HAVE(ISDEBUGGERPRESENT)
+    if (IsDebuggerPresent()) {
+        size_t size = 1024;
+
+        do {
+            char* buffer = (char*)malloc(size);
+
+            if (buffer == NULL)
+                break;
+
+            if (_vsnprintf(buffer, size, format, args) != -1) {
+#if OS(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;
+            }
+
+            free(buffer);
+            size *= 2;
+        } while (size > 1024);
+    }
+#endif
+#if !PLATFORM(BLACKBERRY)
+    vfprintf(stderr, format, args);
+#endif
+}
+
+#if COMPILER(CLANG) || (COMPILER(GCC) && GCC_VERSION_AT_LEAST(4, 6, 0))
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
+
+static void vprintf_stderr_with_prefix(const char* prefix, const char* format, va_list args)
+{
+    size_t prefixLength = strlen(prefix);
+    size_t formatLength = strlen(format);
+    OwnArrayPtr<char> formatWithPrefix = adoptArrayPtr(new char[prefixLength + formatLength + 1]);
+    memcpy(formatWithPrefix.get(), prefix, prefixLength);
+    memcpy(formatWithPrefix.get() + prefixLength, format, formatLength);
+    formatWithPrefix[prefixLength + formatLength] = 0;
+
+    vprintf_stderr_common(formatWithPrefix.get(), args);
+}
+
+static void vprintf_stderr_with_trailing_newline(const char* format, va_list args)
+{
+    size_t formatLength = strlen(format);
+    if (formatLength && format[formatLength - 1] == '\n') {
+        vprintf_stderr_common(format, args);
+        return;
+    }
+
+    OwnArrayPtr<char> formatWithNewline = adoptArrayPtr(new char[formatLength + 2]);
+    memcpy(formatWithNewline.get(), format, formatLength);
+    formatWithNewline[formatLength] = '\n';
+    formatWithNewline[formatLength + 1] = 0;
+
+    vprintf_stderr_common(formatWithNewline.get(), args);
+}
+
+#if COMPILER(CLANG) || (COMPILER(GCC) && GCC_VERSION_AT_LEAST(4, 6, 0))
+#pragma GCC diagnostic pop
+#endif
+
+WTF_ATTRIBUTE_PRINTF(1, 2)
+static void printf_stderr_common(const char* format, ...)
+{
+    va_list args;
+    va_start(args, format);
+    vprintf_stderr_common(format, args);
+    va_end(args);
+}
+
+static void printCallSite(const char* file, int line, const char* function)
+{
+#if OS(WINDOWS) && !OS(WINCE) && defined(_DEBUG)
+    _CrtDbgReport(_CRT_WARN, file, line, NULL, "%s\n", function);
+#else
+    // By using this format, which matches the format used by MSVC for compiler errors, developers
+    // using Visual Studio can double-click the file/line number in the Output Window to have the
+    // editor navigate to that line of code. It seems fine for other developers, too.
+    printf_stderr_common("%s(%d) : %s\n", file, line, function);
+#endif
+}
+
+void WTFReportAssertionFailure(const char* file, int line, const char* function, const char* assertion)
+{
+    if (assertion)
+        printf_stderr_common("ASSERTION FAILED: %s\n", assertion);
+    else
+        printf_stderr_common("SHOULD NEVER BE REACHED\n");
+    printCallSite(file, line, function);
+}
+
+void WTFReportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* assertion, const char* format, ...)
+{
+    va_list args;
+    va_start(args, format);
+    vprintf_stderr_with_prefix("ASSERTION FAILED: ", format, args);
+    va_end(args);
+    printf_stderr_common("\n%s\n", assertion);
+    printCallSite(file, line, function);
+}
+
+void WTFReportArgumentAssertionFailure(const char* file, int line, const char* function, const char* argName, const char* assertion)
+{
+    printf_stderr_common("ARGUMENT BAD: %s, %s\n", argName, assertion);
+    printCallSite(file, line, function);
+}
+
+void WTFGetBacktrace(void** stack, int* size)
+{
+#if (OS(DARWIN) || OS(LINUX)) && !OS(ANDROID)
+    *size = backtrace(stack, *size);
+#elif OS(WINDOWS) && !OS(WINCE)
+    // The CaptureStackBackTrace function is available in XP, but it is not defined
+    // in the Windows Server 2003 R2 Platform SDK. So, we'll grab the function
+    // through GetProcAddress.
+    typedef WORD (NTAPI* RtlCaptureStackBackTraceFunc)(DWORD, DWORD, PVOID*, PDWORD);
+    HMODULE kernel32 = ::GetModuleHandleW(L"Kernel32.dll");
+    if (!kernel32) {
+        *size = 0;
+        return;
+    }
+    RtlCaptureStackBackTraceFunc captureStackBackTraceFunc = reinterpret_cast<RtlCaptureStackBackTraceFunc>(
+        ::GetProcAddress(kernel32, "RtlCaptureStackBackTrace"));
+    if (captureStackBackTraceFunc)
+        *size = captureStackBackTraceFunc(0, *size, stack, 0);
+    else
+        *size = 0;
+#else
+    *size = 0;
+#endif
+}
+
+void WTFReportBacktrace()
+{
+    static const int framesToShow = 31;
+    static const int framesToSkip = 2;
+    void* samples[framesToShow + framesToSkip];
+    int frames = framesToShow + framesToSkip;
+
+    WTFGetBacktrace(samples, &frames);
+    WTFPrintBacktrace(samples + framesToSkip, frames - framesToSkip);
+}
+
+#if OS(DARWIN) || OS(LINUX)
+#  if PLATFORM(QT) || PLATFORM(GTK)
+#    if defined(__GLIBC__) && !defined(__UCLIBC__)
+#      define WTF_USE_BACKTRACE_SYMBOLS 1
+#    endif
+#  elif !OS(ANDROID)
+#    define WTF_USE_DLADDR 1
+#  endif
+#endif
+
+void WTFPrintBacktrace(void** stack, int size)
+{
+#if USE(BACKTRACE_SYMBOLS)
+    char** symbols = backtrace_symbols(stack, size);
+    if (!symbols)
+        return;
+#endif
+
+    for (int i = 0; i < size; ++i) {
+        const char* mangledName = 0;
+        char* cxaDemangled = 0;
+#if USE(BACKTRACE_SYMBOLS)
+        mangledName = symbols[i];
+#elif USE(DLADDR)
+        Dl_info info;
+        if (dladdr(stack[i], &info) && info.dli_sname)
+            mangledName = info.dli_sname;
+        if (mangledName)
+            cxaDemangled = abi::__cxa_demangle(mangledName, 0, 0, 0);
+#endif
+        const int frameNumber = i + 1;
+        if (mangledName || cxaDemangled)
+            printf_stderr_common("%-3d %p %s\n", frameNumber, stack[i], cxaDemangled ? cxaDemangled : mangledName);
+        else
+            printf_stderr_common("%-3d %p\n", frameNumber, stack[i]);
+        free(cxaDemangled);
+    }
+
+#if USE(BACKTRACE_SYMBOLS)
+    free(symbols);
+#endif
+}
+
+#undef WTF_USE_BACKTRACE_SYMBOLS
+#undef WTF_USE_DLADDR
+
+static WTFCrashHookFunction globalHook = 0;
+
+void WTFSetCrashHook(WTFCrashHookFunction function)
+{
+    globalHook = function;
+}
+
+void WTFInvokeCrashHook()
+{
+    if (globalHook)
+        globalHook();
+}
+
+#if HAVE(SIGNAL_H)
+static NO_RETURN void dumpBacktraceSignalHandler(int sig)
+{
+    WTFReportBacktrace();
+    exit(128 + sig);
+}
+
+static void installSignalHandlersForFatalErrors(void (*handler)(int))
+{
+    signal(SIGILL, handler); //    4: illegal instruction (not reset when caught).
+    signal(SIGTRAP, handler); //   5: trace trap (not reset when caught).
+    signal(SIGFPE, handler); //    8: floating point exception.
+    signal(SIGBUS, handler); //   10: bus error.
+    signal(SIGSEGV, handler); //  11: segmentation violation.
+    signal(SIGSYS, handler); //   12: bad argument to system call.
+    signal(SIGPIPE, handler); //  13: write on a pipe with no reader.
+    signal(SIGXCPU, handler); //  24: exceeded CPU time limit.
+    signal(SIGXFSZ, handler); //  25: exceeded file size limit.
+}
+
+static void resetSignalHandlersForFatalErrors()
+{
+    installSignalHandlersForFatalErrors(SIG_DFL);
+}
+#endif
+
+void WTFInstallReportBacktraceOnCrashHook()
+{
+#if HAVE(SIGNAL_H)
+    // Needed otherwise we are going to dump the stack trace twice
+    // in case we hit an assertion.
+    WTFSetCrashHook(&resetSignalHandlersForFatalErrors);
+    installSignalHandlersForFatalErrors(&dumpBacktraceSignalHandler);
+#endif
+}
+
+void WTFReportFatalError(const char* file, int line, const char* function, const char* format, ...)
+{
+    va_list args;
+    va_start(args, format);
+    vprintf_stderr_with_prefix("FATAL ERROR: ", format, args);
+    va_end(args);
+    printf_stderr_common("\n");
+    printCallSite(file, line, function);
+}
+
+void WTFReportError(const char* file, int line, const char* function, const char* format, ...)
+{
+    va_list args;
+    va_start(args, format);
+    vprintf_stderr_with_prefix("ERROR: ", format, args);
+    va_end(args);
+    printf_stderr_common("\n");
+    printCallSite(file, line, function);
+}
+
+void WTFLog(WTFLogChannel* channel, const char* format, ...)
+{
+    if (channel->state != WTFLogChannelOn)
+        return;
+
+    va_list args;
+    va_start(args, format);
+    vprintf_stderr_with_trailing_newline(format, args);
+    va_end(args);
+}
+
+void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel* channel, const char* format, ...)
+{
+    if (channel->state != WTFLogChannelOn)
+        return;
+
+    va_list args;
+    va_start(args, format);
+    vprintf_stderr_with_trailing_newline(format, args);
+    va_end(args);
+
+    printCallSite(file, line, function);
+}
+
+void WTFLogAlways(const char* format, ...)
+{
+    va_list args;
+    va_start(args, format);
+    vprintf_stderr_with_trailing_newline(format, args);
+    va_end(args);
+}
+
+} // extern "C"
diff --git a/Source/WTF/wtf/Assertions.h b/Source/WTF/wtf/Assertions.h
new file mode 100644
index 0000000..7e079ab
--- /dev/null
+++ b/Source/WTF/wtf/Assertions.h
@@ -0,0 +1,393 @@
+/*
+ * Copyright (C) 2003, 2006, 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. 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_Assertions_h
+#define WTF_Assertions_h
+
+/*
+   no namespaces because this file has to be includable from C and Objective-C
+
+   Note, this file uses many GCC extensions, but it should be compatible with
+   C, Objective C, C++, and Objective C++.
+
+   For non-debug builds, everything is disabled by default.
+   Defining any of the symbols explicitly prevents this from having any effect.
+   
+   MSVC7 note: variadic macro support was added in MSVC8, so for now we disable
+   those macros in MSVC7. For more info, see the MSDN document on variadic 
+   macros here:
+   
+   http://msdn2.microsoft.com/en-us/library/ms177415(VS.80).aspx
+*/
+
+#include <wtf/Platform.h>
+
+#include <stddef.h>
+
+#if !COMPILER(MSVC)
+#include <inttypes.h>
+#endif
+
+#ifdef NDEBUG
+/* Disable ASSERT* macros in release mode. */
+#define ASSERTIONS_DISABLED_DEFAULT 1
+#else
+#define ASSERTIONS_DISABLED_DEFAULT 0
+#endif
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define HAVE_VARIADIC_MACRO 0
+#else
+#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
+
+#ifndef ASSERT_MSG_DISABLED
+#if HAVE(VARIADIC_MACRO)
+#define ASSERT_MSG_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#else
+#define ASSERT_MSG_DISABLED 1
+#endif
+#endif
+
+#ifndef ASSERT_ARG_DISABLED
+#define ASSERT_ARG_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#endif
+
+#ifndef FATAL_DISABLED
+#if HAVE(VARIADIC_MACRO)
+#define FATAL_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#else
+#define FATAL_DISABLED 1
+#endif
+#endif
+
+#ifndef ERROR_DISABLED
+#if HAVE(VARIADIC_MACRO)
+#define ERROR_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#else
+#define ERROR_DISABLED 1
+#endif
+#endif
+
+#ifndef LOG_DISABLED
+#if HAVE(VARIADIC_MACRO)
+#define LOG_DISABLED ASSERTIONS_DISABLED_DEFAULT
+#else
+#define LOG_DISABLED 1
+#endif
+#endif
+
+#if COMPILER(GCC)
+#define WTF_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#else
+#define WTF_PRETTY_FUNCTION __FUNCTION__
+#endif
+
+/* WTF logging functions can process %@ in the format string to log a NSObject* but the printf format attribute
+   emits a warning when %@ is used in the format string.  Until <rdar://problem/5195437> is resolved we can't include
+   the attribute when being used from Objective-C code in case it decides to use %@. */
+#if COMPILER(GCC) && !defined(__OBJC__)
+#define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) __attribute__((__format__(printf, formatStringArgument, extraArguments)))
+#else
+#define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) 
+#endif
+
+/* These helper functions are always declared, but not necessarily always defined if the corresponding function is disabled. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum { WTFLogChannelOff, WTFLogChannelOn } WTFLogChannelState;
+
+typedef struct {
+    unsigned mask;
+    const char *defaultName;
+    WTFLogChannelState state;
+} WTFLogChannel;
+
+WTF_EXPORT_PRIVATE void WTFReportAssertionFailure(const char* file, int line, const char* function, const char* assertion);
+WTF_EXPORT_PRIVATE void WTFReportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* assertion, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6);
+WTF_EXPORT_PRIVATE void WTFReportArgumentAssertionFailure(const char* file, int line, const char* function, const char* argName, const char* assertion);
+WTF_EXPORT_PRIVATE void WTFReportFatalError(const char* file, int line, const char* function, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5);
+WTF_EXPORT_PRIVATE void WTFReportError(const char* file, int line, const char* function, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5);
+WTF_EXPORT_PRIVATE void WTFLog(WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(2, 3);
+WTF_EXPORT_PRIVATE void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6);
+WTF_EXPORT_PRIVATE void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
+
+WTF_EXPORT_PRIVATE void WTFGetBacktrace(void** stack, int* size);
+WTF_EXPORT_PRIVATE void WTFReportBacktrace();
+WTF_EXPORT_PRIVATE void WTFPrintBacktrace(void** stack, int size);
+
+typedef void (*WTFCrashHookFunction)();
+WTF_EXPORT_PRIVATE void WTFSetCrashHook(WTFCrashHookFunction);
+WTF_EXPORT_PRIVATE void WTFInvokeCrashHook();
+WTF_EXPORT_PRIVATE void WTFInstallReportBacktraceOnCrashHook();
+
+#ifdef __cplusplus
+}
+#endif
+
+/* CRASH() - Raises a fatal error resulting in program termination and triggering either the debugger or the crash reporter.
+
+   Use CRASH() in response to known, unrecoverable errors like out-of-memory.
+   Macro is enabled in both debug and release mode.
+   To test for unknown errors and verify assumptions, use ASSERT instead, to avoid impacting performance in release builds.
+
+   Signals are ignored by the crash reporter on OS X so we must do better.
+*/
+#ifndef CRASH
+#if COMPILER(CLANG)
+#define CRASH() \
+    (WTFReportBacktrace(), \
+     WTFInvokeCrashHook(), \
+     (*(int *)(uintptr_t)0xbbadbeef = 0), \
+     __builtin_trap())
+#else
+#define CRASH() \
+    (WTFReportBacktrace(), \
+     WTFInvokeCrashHook(), \
+     (*(int *)(uintptr_t)0xbbadbeef = 0), \
+     ((void(*)())0)() /* More reliable, but doesn't say BBADBEEF */ \
+    )
+#endif
+#endif
+
+#if COMPILER(CLANG)
+#define NO_RETURN_DUE_TO_CRASH NO_RETURN
+#else
+#define NO_RETURN_DUE_TO_CRASH
+#endif
+
+
+/* BACKTRACE
+
+  Print a backtrace to the same location as ASSERT messages.
+*/
+
+#if BACKTRACE_DISABLED
+
+#define BACKTRACE() ((void)0)
+
+#else
+
+#define BACKTRACE() do { \
+    WTFReportBacktrace(); \
+} while(false)
+
+#endif
+
+/* ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED
+
+  These macros are compiled out of release builds.
+  Expressions inside them are evaluated in debug builds only.
+*/
+
+#if OS(WINCE) && !PLATFORM(TORCHMOBILE)
+/* FIXME: We include this here only to avoid a conflict with the ASSERT macro. */
+#include <windows.h>
+#undef min
+#undef max
+#undef ERROR
+#endif
+
+#if OS(WINDOWS)
+/* FIXME: Change to use something other than ASSERT to avoid this conflict with the underlying platform */
+#undef ASSERT
+#endif
+
+#if ASSERT_DISABLED
+
+#define ASSERT(assertion) ((void)0)
+#define ASSERT_AT(assertion, file, line, function) ((void)0)
+#define ASSERT_NOT_REACHED() ((void)0)
+#define NO_RETURN_DUE_TO_ASSERT
+
+#if COMPILER(INTEL) && !OS(WINDOWS) || COMPILER(RVCT)
+template<typename T>
+inline void assertUnused(T& x) { (void)x; }
+#define ASSERT_UNUSED(variable, assertion) (assertUnused(variable))
+#else
+#define ASSERT_UNUSED(variable, assertion) ((void)variable)
+#endif
+
+#else
+
+#define ASSERT(assertion) \
+    (!(assertion) ? \
+        (WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion), \
+         CRASH()) : \
+        (void)0)
+
+#define ASSERT_AT(assertion, file, line, function) \
+    (!(assertion) ? \
+        (WTFReportAssertionFailure(file, line, function, #assertion), \
+         CRASH()) :                                                   \
+        (void)0)
+
+#define ASSERT_NOT_REACHED() do { \
+    WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, 0); \
+    CRASH(); \
+} while (0)
+
+#define ASSERT_UNUSED(variable, assertion) ASSERT(assertion)
+
+#define NO_RETURN_DUE_TO_ASSERT NO_RETURN_DUE_TO_CRASH
+
+#endif
+
+/* ASSERT_WITH_MESSAGE */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define ASSERT_WITH_MESSAGE(assertion) ((void)0)
+#elif ASSERT_MSG_DISABLED
+#define ASSERT_WITH_MESSAGE(assertion, ...) ((void)0)
+#else
+#define ASSERT_WITH_MESSAGE(assertion, ...) do \
+    if (!(assertion)) { \
+        WTFReportAssertionFailureWithMessage(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion, __VA_ARGS__); \
+        CRASH(); \
+    } \
+while (0)
+#endif
+
+/* ASSERT_WITH_MESSAGE_UNUSED */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion) ((void)0)
+#elif ASSERT_MSG_DISABLED
+#if COMPILER(INTEL) && !OS(WINDOWS) || COMPILER(RVCT)
+template<typename T>
+inline void assertWithMessageUnused(T& x) { (void)x; }
+#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) (assertWithMessageUnused(variable))
+#else
+#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) ((void)variable)
+#endif
+#else
+#define ASSERT_WITH_MESSAGE_UNUSED(variable, assertion, ...) do \
+    if (!(assertion)) { \
+        WTFReportAssertionFailureWithMessage(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion, __VA_ARGS__); \
+        CRASH(); \
+    } \
+while (0)
+#endif
+                        
+                        
+/* ASSERT_ARG */
+
+#if ASSERT_ARG_DISABLED
+
+#define ASSERT_ARG(argName, assertion) ((void)0)
+
+#else
+
+#define ASSERT_ARG(argName, assertion) do \
+    if (!(assertion)) { \
+        WTFReportArgumentAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #argName, #assertion); \
+        CRASH(); \
+    } \
+while (0)
+
+#endif
+
+/* COMPILE_ASSERT */
+#ifndef COMPILE_ASSERT
+#if COMPILER_SUPPORTS(C_STATIC_ASSERT)
+#define COMPILE_ASSERT(exp, name) _Static_assert((exp), #name)
+#else
+#define COMPILE_ASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1]
+#endif
+#endif
+
+/* FATAL */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define FATAL() ((void)0)
+#elif FATAL_DISABLED
+#define FATAL(...) ((void)0)
+#else
+#define FATAL(...) do { \
+    WTFReportFatalError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__); \
+    CRASH(); \
+} while (0)
+#endif
+
+/* LOG_ERROR */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define LOG_ERROR() ((void)0)
+#elif ERROR_DISABLED
+#define LOG_ERROR(...) ((void)0)
+#else
+#define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__)
+#endif
+
+/* LOG */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define LOG() ((void)0)
+#elif LOG_DISABLED
+#define LOG(channel, ...) ((void)0)
+#else
+#define LOG(channel, ...) WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__)
+#define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel)
+#define JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) prefix ## channel
+#endif
+
+/* LOG_VERBOSE */
+
+#if COMPILER(MSVC7_OR_LOWER)
+#define LOG_VERBOSE(channel) ((void)0)
+#elif LOG_DISABLED
+#define LOG_VERBOSE(channel, ...) ((void)0)
+#else
+#define LOG_VERBOSE(channel, ...) WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__)
+#endif
+
+/* UNREACHABLE_FOR_PLATFORM */
+
+#if COMPILER(CLANG)
+// This would be a macro except that its use of #pragma works best around
+// a function. Hence it uses macro naming convention.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wmissing-noreturn"
+static inline void UNREACHABLE_FOR_PLATFORM()
+{
+    ASSERT_NOT_REACHED();
+}
+#pragma clang diagnostic pop
+#else
+#define UNREACHABLE_FOR_PLATFORM() ASSERT_NOT_REACHED()
+#endif
+
+#endif /* WTF_Assertions_h */
diff --git a/Source/WTF/wtf/Atomics.h b/Source/WTF/wtf/Atomics.h
new file mode 100644
index 0000000..e2560ab
--- /dev/null
+++ b/Source/WTF/wtf/Atomics.h
@@ -0,0 +1,238 @@
+/*
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ *
+ *
+ * Note: The implementations of InterlockedIncrement and InterlockedDecrement are based
+ * on atomic_increment and atomic_exchange_and_add from the Boost C++ Library. The license
+ * is virtually identical to the Apple license above but is included here for completeness.
+ *
+ * Boost Software License - Version 1.0 - August 17th, 2003
+ * 
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation covered by
+ * this license (the "Software") to use, reproduce, display, distribute,
+ * execute, and transmit the Software, and to prepare derivative works of the
+ * Software, and to permit third-parties to whom the Software is furnished to
+ * do so, all subject to the following:
+ * 
+ * The copyright notices in the Software and this entire statement, including
+ * the above license grant, this restriction and the following disclaimer,
+ * must be included in all copies of the Software, in whole or in part, and
+ * all derivative works of the Software, unless such copies or derivative
+ * works are solely in the form of machine-executable object code generated by
+ * a source language processor.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef Atomics_h
+#define Atomics_h
+
+#include <wtf/Platform.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/UnusedParam.h>
+
+#if OS(WINDOWS)
+#include <windows.h>
+#elif OS(DARWIN)
+#include <libkern/OSAtomic.h>
+#elif OS(QNX)
+#include <atomic.h>
+#elif OS(ANDROID)
+#include <sys/atomics.h>
+#elif COMPILER(GCC)
+#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))) && !defined(__LSB_VERSION__)
+#include <ext/atomicity.h>
+#else
+#include <bits/atomicity.h>
+#endif
+#endif
+
+namespace WTF {
+
+#if OS(WINDOWS)
+#define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
+
+#if COMPILER(MINGW) || COMPILER(MSVC7_OR_LOWER) || OS(WINCE)
+inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpret_cast<long*>(addend)); }
+inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpret_cast<long*>(addend)); }
+#else
+inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(reinterpret_cast<long volatile*>(addend)); }
+inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast<long volatile*>(addend)); }
+#endif
+
+#elif OS(DARWIN)
+#define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
+
+inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast<int*>(addend)); }
+inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast<int*>(addend)); }
+
+#elif OS(QNX)
+#define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
+
+// Note, atomic_{add, sub}_value() return the previous value of addend's content.
+inline int atomicIncrement(int volatile* addend) { return static_cast<int>(atomic_add_value(reinterpret_cast<unsigned volatile*>(addend), 1)) + 1; }
+inline int atomicDecrement(int volatile* addend) { return static_cast<int>(atomic_sub_value(reinterpret_cast<unsigned volatile*>(addend), 1)) - 1; }
+
+#elif OS(ANDROID)
+#define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
+
+// Note, __atomic_{inc, dec}() return the previous value of addend's content.
+inline int atomicIncrement(int volatile* addend) { return __atomic_inc(addend) + 1; }
+inline int atomicDecrement(int volatile* addend) { return __atomic_dec(addend) - 1; }
+
+#elif COMPILER(GCC) && !CPU(SPARC64) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc
+#define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
+
+inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; }
+inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, -1) - 1; }
+
+#endif
+
+#if OS(WINDOWS)
+inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, unsigned newValue)
+{
+#if OS(WINCE)
+    return InterlockedCompareExchange(reinterpret_cast<LONG*>(const_cast<unsigned*>(location)), static_cast<LONG>(newValue), static_cast<LONG>(expected)) == static_cast<LONG>(expected);
+#else
+    return InterlockedCompareExchange(reinterpret_cast<LONG volatile*>(location), static_cast<LONG>(newValue), static_cast<LONG>(expected)) == static_cast<LONG>(expected);
+#endif
+}
+
+inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* newValue)
+{
+    return InterlockedCompareExchangePointer(location, newValue, expected) == expected;
+}
+#else // OS(WINDOWS) --> not windows
+#if COMPILER(GCC) && !COMPILER(CLANG) // Work around a gcc bug 
+inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, unsigned newValue) 
+#else
+inline bool weakCompareAndSwap(unsigned* location, unsigned expected, unsigned newValue)
+#endif
+{
+#if ENABLE(COMPARE_AND_SWAP)
+#if CPU(X86) || CPU(X86_64)
+    unsigned char result;
+    asm volatile(
+        "lock; cmpxchgl %3, %2\n\t"
+        "sete %1"
+        : "+a"(expected), "=q"(result), "+m"(*location)
+        : "r"(newValue)
+        : "memory"
+        );
+#elif CPU(ARM_THUMB2)
+    unsigned tmp;
+    unsigned result;
+    asm volatile(
+        "movw %1, #1\n\t"
+        "ldrex %2, %0\n\t"
+        "cmp %3, %2\n\t"
+        "bne.n 0f\n\t"
+        "strex %1, %4, %0\n\t"
+        "0:"
+        : "+Q"(*location), "=&r"(result), "=&r"(tmp)
+        : "r"(expected), "r"(newValue)
+        : "memory");
+    result = !result;
+#else
+#error "Bad architecture for compare and swap."
+#endif
+    return result;
+#else
+    UNUSED_PARAM(location);
+    UNUSED_PARAM(expected);
+    UNUSED_PARAM(newValue);
+    CRASH();
+    return false;
+#endif
+}
+
+inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* newValue)
+{
+#if ENABLE(COMPARE_AND_SWAP)
+#if CPU(X86_64)
+    bool result;
+    asm volatile(
+        "lock; cmpxchgq %3, %2\n\t"
+        "sete %1"
+        : "+a"(expected), "=q"(result), "+m"(*location)
+        : "r"(newValue)
+        : "memory"
+        );
+    return result;
+#else
+    return weakCompareAndSwap(bitwise_cast<unsigned*>(location), bitwise_cast<unsigned>(expected), bitwise_cast<unsigned>(newValue));
+#endif
+#else // ENABLE(COMPARE_AND_SWAP)
+    UNUSED_PARAM(location);
+    UNUSED_PARAM(expected);
+    UNUSED_PARAM(newValue);
+    CRASH();
+    return 0;
+#endif // ENABLE(COMPARE_AND_SWAP)
+}
+#endif // OS(WINDOWS) (end of the not-windows case)
+
+inline bool weakCompareAndSwapUIntPtr(volatile uintptr_t* location, uintptr_t expected, uintptr_t newValue)
+{
+    return weakCompareAndSwap(reinterpret_cast<void*volatile*>(location), reinterpret_cast<void*>(expected), reinterpret_cast<void*>(newValue));
+}
+
+#if CPU(ARM_THUMB2)
+
+inline void memoryBarrierAfterLock()
+{
+    asm volatile("dmb" ::: "memory");
+}
+
+inline void memoryBarrierBeforeUnlock()
+{
+    asm volatile("dmb" ::: "memory");
+}
+
+#else
+
+inline void memoryBarrierAfterLock() { }
+inline void memoryBarrierBeforeUnlock() { }
+
+#endif
+
+} // namespace WTF
+
+#if USE(LOCKFREE_THREADSAFEREFCOUNTED)
+using WTF::atomicDecrement;
+using WTF::atomicIncrement;
+#endif
+
+#endif // Atomics_h
diff --git a/Source/WTF/wtf/BitArray.h b/Source/WTF/wtf/BitArray.h
new file mode 100644
index 0000000..b1ef227
--- /dev/null
+++ b/Source/WTF/wtf/BitArray.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2012 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. ``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
+ * 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 BitArray_h
+#define BitArray_h
+
+#include <string.h>
+#include <wtf/Assertions.h>
+
+namespace WTF {
+
+template<unsigned arraySize>
+class BitArray {
+public:
+    BitArray()
+    {
+        memset(m_data, 0, sizeof(m_data));
+    }
+
+    void set(unsigned index)
+    {
+        ASSERT(index < arraySize);
+        m_data[index / 8] |= 1 << (index & 7);
+    }
+
+    bool get(unsigned index) const
+    {
+        ASSERT(index < arraySize);
+        return !!(m_data[index / 8] & (1 << (index & 7)));
+    }
+
+private:
+    unsigned char m_data[arraySize / 8 + 1];
+};
+
+} // namespace WTF
+
+using WTF::BitArray;
+
+#endif // BitArray_h
diff --git a/Source/WTF/wtf/BitVector.cpp b/Source/WTF/wtf/BitVector.cpp
new file mode 100644
index 0000000..d1a8de7
--- /dev/null
+++ b/Source/WTF/wtf/BitVector.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2011 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. ``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
+ * 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 "BitVector.h"
+
+#include <algorithm>
+#include <string.h>
+#include <wtf/Assertions.h>
+#include <wtf/FastMalloc.h>
+#include <wtf/StdLibExtras.h>
+
+namespace WTF {
+
+void BitVector::setSlow(const BitVector& other)
+{
+    uintptr_t newBitsOrPointer;
+    if (other.isInline())
+        newBitsOrPointer = other.m_bitsOrPointer;
+    else {
+        OutOfLineBits* newOutOfLineBits = OutOfLineBits::create(other.size());
+        memcpy(newOutOfLineBits->bits(), other.bits(), byteCount(other.size()));
+        newBitsOrPointer = bitwise_cast<uintptr_t>(newOutOfLineBits) >> 1;
+    }
+    if (!isInline())
+        OutOfLineBits::destroy(outOfLineBits());
+    m_bitsOrPointer = newBitsOrPointer;
+}
+
+void BitVector::resize(size_t numBits)
+{
+    if (numBits <= maxInlineBits()) {
+        if (isInline())
+            return;
+    
+        OutOfLineBits* myOutOfLineBits = outOfLineBits();
+        m_bitsOrPointer = makeInlineBits(*myOutOfLineBits->bits());
+        OutOfLineBits::destroy(myOutOfLineBits);
+        return;
+    }
+    
+    resizeOutOfLine(numBits);
+}
+
+void BitVector::clearAll()
+{
+    if (isInline())
+        m_bitsOrPointer = makeInlineBits(0);
+    else
+        memset(outOfLineBits()->bits(), 0, byteCount(size()));
+}
+
+BitVector::OutOfLineBits* BitVector::OutOfLineBits::create(size_t numBits)
+{
+    numBits = (numBits + bitsInPointer() - 1) & ~(bitsInPointer() - 1);
+    size_t size = sizeof(OutOfLineBits) + sizeof(uintptr_t) * (numBits / bitsInPointer());
+    OutOfLineBits* result = new (NotNull, fastMalloc(size)) OutOfLineBits(numBits);
+    return result;
+}
+
+void BitVector::OutOfLineBits::destroy(OutOfLineBits* outOfLineBits)
+{
+    fastFree(outOfLineBits);
+}
+
+void BitVector::resizeOutOfLine(size_t numBits)
+{
+    ASSERT(numBits > maxInlineBits());
+    OutOfLineBits* newOutOfLineBits = OutOfLineBits::create(numBits);
+    size_t newNumWords = newOutOfLineBits->numWords();
+    if (isInline()) {
+        // Make sure that all of the bits are zero in case we do a no-op resize.
+        *newOutOfLineBits->bits() = m_bitsOrPointer & ~(static_cast<uintptr_t>(1) << maxInlineBits());
+        memset(newOutOfLineBits->bits() + 1, 0, (newNumWords - 1) * sizeof(void*));
+    } else {
+        if (numBits > size()) {
+            size_t oldNumWords = outOfLineBits()->numWords();
+            memcpy(newOutOfLineBits->bits(), outOfLineBits()->bits(), oldNumWords * sizeof(void*));
+            memset(newOutOfLineBits->bits() + oldNumWords, 0, (newNumWords - oldNumWords) * sizeof(void*));
+        } else
+            memcpy(newOutOfLineBits->bits(), outOfLineBits()->bits(), newOutOfLineBits->numWords() * sizeof(void*));
+        OutOfLineBits::destroy(outOfLineBits());
+    }
+    m_bitsOrPointer = bitwise_cast<uintptr_t>(newOutOfLineBits) >> 1;
+}
+
+void BitVector::dump(FILE* out)
+{
+    for (size_t i = 0; i < size(); ++i) {
+        if (get(i))
+            fprintf(out, "1");
+        else
+            fprintf(out, "-");
+    }
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/BitVector.h b/Source/WTF/wtf/BitVector.h
new file mode 100644
index 0000000..2c3284c
--- /dev/null
+++ b/Source/WTF/wtf/BitVector.h
@@ -0,0 +1,244 @@
+/*
+ * Copyright (C) 2011 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. ``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
+ * 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 BitVector_h
+#define BitVector_h
+
+#include <stdio.h>
+#include <wtf/Assertions.h>
+#include <wtf/StdLibExtras.h>
+
+namespace WTF {
+
+// This is a space-efficient, resizeable bitvector class. In the common case it
+// occupies one word, but if necessary, it will inflate this one word to point
+// to a single chunk of out-of-line allocated storage to store an arbitrary number
+// of bits.
+//
+// - The bitvector remembers the bound of how many bits can be stored, but this
+//   may be slightly greater (by as much as some platform-specific constant)
+//   than the last argument passed to ensureSize().
+//
+// - The bitvector can resize itself automatically (set, clear, get) or can be used
+//   in a manual mode, which is faster (quickSet, quickClear, quickGet, ensureSize).
+//
+// - Accesses ASSERT that you are within bounds.
+//
+// - Bits are automatically initialized to zero.
+//
+// On the other hand, this BitVector class may not be the fastest around, since
+// it does conditionals on every get/set/clear. But it is great if you need to
+// juggle a lot of variable-length BitVectors and you're worried about wasting
+// space.
+
+class BitVector {
+public: 
+    BitVector()
+        : m_bitsOrPointer(makeInlineBits(0))
+    {
+    }
+    
+    explicit BitVector(size_t numBits)
+        : m_bitsOrPointer(makeInlineBits(0))
+    {
+        ensureSize(numBits);
+    }
+    
+    BitVector(const BitVector& other)
+        : m_bitsOrPointer(makeInlineBits(0))
+    {
+        (*this) = other;
+    }
+
+    
+    ~BitVector()
+    {
+        if (isInline())
+            return;
+        OutOfLineBits::destroy(outOfLineBits());
+    }
+    
+    BitVector& operator=(const BitVector& other)
+    {
+        if (isInline() && other.isInline())
+            m_bitsOrPointer = other.m_bitsOrPointer;
+        else
+            setSlow(other);
+        return *this;
+    }
+
+    size_t size() const
+    {
+        if (isInline())
+            return maxInlineBits();
+        return outOfLineBits()->numBits();
+    }
+
+    void ensureSize(size_t numBits)
+    {
+        if (numBits <= size())
+            return;
+        resizeOutOfLine(numBits);
+    }
+    
+    // Like ensureSize(), but supports reducing the size of the bitvector.
+    WTF_EXPORT_PRIVATE void resize(size_t numBits);
+    
+    WTF_EXPORT_PRIVATE void clearAll();
+
+    bool quickGet(size_t bit) const
+    {
+        ASSERT(bit < size());
+        return !!(bits()[bit / bitsInPointer()] & (static_cast<uintptr_t>(1) << (bit & (bitsInPointer() - 1))));
+    }
+    
+    void quickSet(size_t bit)
+    {
+        ASSERT(bit < size());
+        bits()[bit / bitsInPointer()] |= (static_cast<uintptr_t>(1) << (bit & (bitsInPointer() - 1)));
+    }
+    
+    void quickClear(size_t bit)
+    {
+        ASSERT(bit < size());
+        bits()[bit / bitsInPointer()] &= ~(static_cast<uintptr_t>(1) << (bit & (bitsInPointer() - 1)));
+    }
+    
+    void quickSet(size_t bit, bool value)
+    {
+        if (value)
+            quickSet(bit);
+        else
+            quickClear(bit);
+    }
+    
+    bool get(size_t bit) const
+    {
+        if (bit >= size())
+            return false;
+        return quickGet(bit);
+    }
+    
+    void set(size_t bit)
+    {
+        ensureSize(bit + 1);
+        quickSet(bit);
+    }
+
+    void ensureSizeAndSet(size_t bit, size_t size)
+    {
+        ensureSize(size);
+        quickSet(bit);
+    }
+
+    void clear(size_t bit)
+    {
+        if (bit >= size())
+            return;
+        quickClear(bit);
+    }
+    
+    void set(size_t bit, bool value)
+    {
+        if (value)
+            set(bit);
+        else
+            clear(bit);
+    }
+    
+    void dump(FILE* out);
+    
+private:
+    static unsigned bitsInPointer()
+    {
+        return sizeof(void*) << 3;
+    }
+
+    static unsigned maxInlineBits()
+    {
+        return bitsInPointer() - 1;
+    }
+
+    static size_t byteCount(size_t bitCount)
+    {
+        return (bitCount + 7) >> 3;
+    }
+
+    static uintptr_t makeInlineBits(uintptr_t bits)
+    {
+        ASSERT(!(bits & (static_cast<uintptr_t>(1) << maxInlineBits())));
+        return bits | (static_cast<uintptr_t>(1) << maxInlineBits());
+    }
+    
+    class OutOfLineBits {
+    public:
+        size_t numBits() const { return m_numBits; }
+        size_t numWords() const { return (m_numBits + bitsInPointer() - 1) / bitsInPointer(); }
+        uintptr_t* bits() { return bitwise_cast<uintptr_t*>(this + 1); }
+        const uintptr_t* bits() const { return bitwise_cast<const uintptr_t*>(this + 1); }
+        
+        static WTF_EXPORT_PRIVATE OutOfLineBits* create(size_t numBits);
+        
+        static WTF_EXPORT_PRIVATE void destroy(OutOfLineBits*);
+
+    private:
+        OutOfLineBits(size_t numBits)
+            : m_numBits(numBits)
+        {
+        }
+        
+        size_t m_numBits;
+    };
+    
+    bool isInline() const { return m_bitsOrPointer >> maxInlineBits(); }
+    
+    const OutOfLineBits* outOfLineBits() const { return bitwise_cast<const OutOfLineBits*>(m_bitsOrPointer << 1); }
+    OutOfLineBits* outOfLineBits() { return bitwise_cast<OutOfLineBits*>(m_bitsOrPointer << 1); }
+    
+    WTF_EXPORT_PRIVATE void resizeOutOfLine(size_t numBits);
+    WTF_EXPORT_PRIVATE void setSlow(const BitVector& other);
+    
+    uintptr_t* bits()
+    {
+        if (isInline())
+            return &m_bitsOrPointer;
+        return outOfLineBits()->bits();
+    }
+    
+    const uintptr_t* bits() const
+    {
+        if (isInline())
+            return &m_bitsOrPointer;
+        return outOfLineBits()->bits();
+    }
+    
+    uintptr_t m_bitsOrPointer;
+};
+
+} // namespace WTF
+
+using WTF::BitVector;
+
+#endif // BitVector_h
diff --git a/Source/WTF/wtf/Bitmap.h b/Source/WTF/wtf/Bitmap.h
new file mode 100644
index 0000000..76a2ca4
--- /dev/null
+++ b/Source/WTF/wtf/Bitmap.h
@@ -0,0 +1,225 @@
+/*
+ *  Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+#ifndef Bitmap_h
+#define Bitmap_h
+
+#include <wtf/Atomics.h>
+#include <wtf/FixedArray.h>
+#include <wtf/StdLibExtras.h>
+#include <stdint.h>
+#include <string.h>
+
+namespace WTF {
+
+enum BitmapAtomicMode {
+    // This makes concurrentTestAndSet behave just like testAndSet.
+    BitmapNotAtomic,
+
+    // This makes concurrentTestAndSet use compareAndSwap, so that it's
+    // atomic even when used concurrently.
+    BitmapAtomic
+};
+
+template<size_t size, BitmapAtomicMode atomicMode = BitmapNotAtomic>
+class Bitmap {
+private:
+    typedef uint32_t WordType;
+
+public:
+    Bitmap();
+
+    bool get(size_t) const;
+    void set(size_t);
+    bool testAndSet(size_t);
+    bool testAndClear(size_t);
+    bool concurrentTestAndSet(size_t);
+    bool concurrentTestAndClear(size_t);
+    size_t nextPossiblyUnset(size_t) const;
+    void clear(size_t);
+    void clearAll();
+    int64_t findRunOfZeros(size_t) const;
+    size_t count(size_t = 0) const;
+    size_t isEmpty() const;
+    size_t isFull() const;
+
+private:
+    static const WordType wordSize = sizeof(WordType) * 8;
+    static const WordType words = (size + wordSize - 1) / wordSize;
+
+    // the literal '1' is of type signed int.  We want to use an unsigned
+    // version of the correct size when doing the calculations because if
+    // WordType is larger than int, '1 << 31' will first be sign extended
+    // and then casted to unsigned, meaning that set(31) when WordType is
+    // a 64 bit unsigned int would give 0xffff8000
+    static const WordType one = 1;
+
+    FixedArray<WordType, words> bits;
+};
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline Bitmap<size, atomicMode>::Bitmap()
+{
+    clearAll();
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline bool Bitmap<size, atomicMode>::get(size_t n) const
+{
+    return !!(bits[n / wordSize] & (one << (n % wordSize)));
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline void Bitmap<size, atomicMode>::set(size_t n)
+{
+    bits[n / wordSize] |= (one << (n % wordSize));
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline bool Bitmap<size, atomicMode>::testAndSet(size_t n)
+{
+    WordType mask = one << (n % wordSize);
+    size_t index = n / wordSize;
+    bool result = bits[index] & mask;
+    bits[index] |= mask;
+    return result;
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline bool Bitmap<size, atomicMode>::testAndClear(size_t n)
+{
+    WordType mask = one << (n % wordSize);
+    size_t index = n / wordSize;
+    bool result = bits[index] & mask;
+    bits[index] &= ~mask;
+    return result;
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline bool Bitmap<size, atomicMode>::concurrentTestAndSet(size_t n)
+{
+    if (atomicMode == BitmapNotAtomic)
+        return testAndSet(n);
+
+    ASSERT(atomicMode == BitmapAtomic);
+    
+    WordType mask = one << (n % wordSize);
+    size_t index = n / wordSize;
+    WordType* wordPtr = bits.data() + index;
+    WordType oldValue;
+    do {
+        oldValue = *wordPtr;
+        if (oldValue & mask)
+            return true;
+    } while (!weakCompareAndSwap(wordPtr, oldValue, oldValue | mask));
+    return false;
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline bool Bitmap<size, atomicMode>::concurrentTestAndClear(size_t n)
+{
+    if (atomicMode == BitmapNotAtomic)
+        return testAndClear(n);
+
+    ASSERT(atomicMode == BitmapAtomic);
+    
+    WordType mask = one << (n % wordSize);
+    size_t index = n / wordSize;
+    WordType* wordPtr = bits.data() + index;
+    WordType oldValue;
+    do {
+        oldValue = *wordPtr;
+        if (!(oldValue & mask))
+            return false;
+    } while (!weakCompareAndSwap(wordPtr, oldValue, oldValue & ~mask));
+    return true;
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline void Bitmap<size, atomicMode>::clear(size_t n)
+{
+    bits[n / wordSize] &= ~(one << (n % wordSize));
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline void Bitmap<size, atomicMode>::clearAll()
+{
+    memset(bits.data(), 0, sizeof(bits));
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline size_t Bitmap<size, atomicMode>::nextPossiblyUnset(size_t start) const
+{
+    if (!~bits[start / wordSize])
+        return ((start / wordSize) + 1) * wordSize;
+    return start + 1;
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline int64_t Bitmap<size, atomicMode>::findRunOfZeros(size_t runLength) const
+{
+    if (!runLength) 
+        runLength = 1; 
+     
+    for (size_t i = 0; i <= (size - runLength) ; i++) {
+        bool found = true; 
+        for (size_t j = i; j <= (i + runLength - 1) ; j++) { 
+            if (get(j)) {
+                found = false; 
+                break;
+            }
+        }
+        if (found)  
+            return i; 
+    }
+    return -1;
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline size_t Bitmap<size, atomicMode>::count(size_t start) const
+{
+    size_t result = 0;
+    for ( ; (start % wordSize); ++start) {
+        if (get(start))
+            ++result;
+    }
+    for (size_t i = start / wordSize; i < words; ++i)
+        result += WTF::bitCount(bits[i]);
+    return result;
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline size_t Bitmap<size, atomicMode>::isEmpty() const
+{
+    for (size_t i = 0; i < words; ++i)
+        if (bits[i])
+            return false;
+    return true;
+}
+
+template<size_t size, BitmapAtomicMode atomicMode>
+inline size_t Bitmap<size, atomicMode>::isFull() const
+{
+    for (size_t i = 0; i < words; ++i)
+        if (~bits[i])
+            return false;
+    return true;
+}
+
+}
+#endif
diff --git a/Source/WTF/wtf/BlockStack.h b/Source/WTF/wtf/BlockStack.h
new file mode 100644
index 0000000..61e108d
--- /dev/null
+++ b/Source/WTF/wtf/BlockStack.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+#ifndef BlockStack_h
+#define BlockStack_h
+
+#include <wtf/Assertions.h>
+#include <wtf/FastMalloc.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+template <typename T> class BlockStack {
+public:
+    static const size_t blockSize = 4096;
+    static const size_t blockLength = blockSize / sizeof(T);
+
+    BlockStack();
+    ~BlockStack();
+
+    T* grow();
+    void shrink(T*);
+
+    const Vector<T*>& blocks();
+
+private:
+    Vector<T*> m_blocks;
+    T* m_spareBlock; // Used to avoid thrash at block boundaries.
+};
+
+template <typename T> BlockStack<T>::BlockStack()
+    : m_spareBlock(0)
+{
+}
+
+template <typename T> BlockStack<T>::~BlockStack()
+{
+    if (m_spareBlock)
+        fastFree(m_spareBlock);
+    for (size_t i = 0; i < m_blocks.size(); ++i)
+        fastFree(m_blocks[i]);
+}
+
+template <typename T> inline const Vector<T*>& BlockStack<T>::blocks()
+{
+    return m_blocks;
+}
+
+template <typename T> T* BlockStack<T>::grow()
+{
+    T* block = m_spareBlock ? m_spareBlock : static_cast<T*>(fastMalloc(blockSize));
+    m_spareBlock = 0;
+
+    m_blocks.append(block);
+    return block;
+}
+
+template <typename T> void BlockStack<T>::shrink(T* newEnd)
+{
+    ASSERT(newEnd != m_blocks.last() + blockLength);
+    m_spareBlock = m_blocks.last();
+    m_blocks.removeLast();
+
+    while (m_blocks.last() + blockLength != newEnd) {
+        fastFree(m_blocks.last());
+        m_blocks.removeLast();
+    }
+}
+
+}
+
+using WTF::BlockStack;
+
+#endif
diff --git a/Source/WTF/wtf/BloomFilter.h b/Source/WTF/wtf/BloomFilter.h
new file mode 100644
index 0000000..f81d83e
--- /dev/null
+++ b/Source/WTF/wtf/BloomFilter.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+#ifndef BloomFilter_h
+#define BloomFilter_h
+
+#include <wtf/AlwaysInline.h>
+#include <wtf/text/AtomicString.h>
+
+namespace WTF {
+
+// Counting bloom filter with k=2 and 8 bit counters. Uses 2^keyBits bytes of memory.
+// False positive rate is approximately (1-e^(-2n/m))^2, where n is the number of unique 
+// keys and m is the table size (==2^keyBits).
+template <unsigned keyBits>
+class BloomFilter {
+public:
+    COMPILE_ASSERT(keyBits <= 16, bloom_filter_key_size);
+
+    static const size_t tableSize = 1 << keyBits;
+    static const unsigned keyMask = (1 << keyBits) - 1;
+    static uint8_t maximumCount() { return std::numeric_limits<uint8_t>::max(); }
+    
+    BloomFilter() { clear(); }
+
+    void add(unsigned hash);
+    void remove(unsigned hash);
+
+    // The filter may give false positives (claim it may contain a key it doesn't)
+    // but never false negatives (claim it doesn't contain a key it does).
+    bool mayContain(unsigned hash) const { return firstSlot(hash) && secondSlot(hash); }
+    
+    // The filter must be cleared before reuse even if all keys are removed.
+    // Otherwise overflowed keys will stick around.
+    void clear();
+
+    void add(const AtomicString& string) { add(string.impl()->existingHash()); }
+    void add(const String& string) { add(string.impl()->hash()); }
+    void remove(const AtomicString& string) { remove(string.impl()->existingHash()); }
+    void remove(const String& string) { remove(string.impl()->hash()); }
+
+    bool mayContain(const AtomicString& string) const { return mayContain(string.impl()->existingHash()); }
+    bool mayContain(const String& string) const { return mayContain(string.impl()->hash()); }
+
+#if !ASSERT_DISABLED
+    // Slow.
+    bool likelyEmpty() const;
+    bool isClear() const;
+#endif
+
+private:
+    uint8_t& firstSlot(unsigned hash) { return m_table[hash & keyMask]; }
+    uint8_t& secondSlot(unsigned hash) { return m_table[(hash >> 16) & keyMask]; }
+    const uint8_t& firstSlot(unsigned hash) const { return m_table[hash & keyMask]; }
+    const uint8_t& secondSlot(unsigned hash) const { return m_table[(hash >> 16) & keyMask]; }
+
+    uint8_t m_table[tableSize];
+};
+    
+template <unsigned keyBits>
+inline void BloomFilter<keyBits>::add(unsigned hash)
+{
+    uint8_t& first = firstSlot(hash);
+    uint8_t& second = secondSlot(hash);
+    if (LIKELY(first < maximumCount()))
+        ++first;
+    if (LIKELY(second < maximumCount()))
+        ++second;
+}
+
+template <unsigned keyBits>
+inline void BloomFilter<keyBits>::remove(unsigned hash)
+{
+    uint8_t& first = firstSlot(hash);
+    uint8_t& second = secondSlot(hash);
+    ASSERT(first);
+    ASSERT(second);
+    // In case of an overflow, the slot sticks in the table until clear().
+    if (LIKELY(first < maximumCount()))
+        --first;
+    if (LIKELY(second < maximumCount()))
+        --second;
+}
+    
+template <unsigned keyBits>
+inline void BloomFilter<keyBits>::clear()
+{
+    memset(m_table, 0, tableSize);
+}
+
+#if !ASSERT_DISABLED
+template <unsigned keyBits>
+bool BloomFilter<keyBits>::likelyEmpty() const
+{
+    for (size_t n = 0; n < tableSize; ++n) {
+        if (m_table[n] && m_table[n] != maximumCount())
+            return false;
+    }
+    return true;
+}
+
+template <unsigned keyBits>
+bool BloomFilter<keyBits>::isClear() const
+{
+    for (size_t n = 0; n < tableSize; ++n) {
+        if (m_table[n])
+            return false;
+    }
+    return true;
+}
+#endif
+
+}
+
+using WTF::BloomFilter;
+
+#endif
diff --git a/Source/WTF/wtf/BoundsCheckedPointer.h b/Source/WTF/wtf/BoundsCheckedPointer.h
new file mode 100644
index 0000000..1f7caab
--- /dev/null
+++ b/Source/WTF/wtf/BoundsCheckedPointer.h
@@ -0,0 +1,287 @@
+/*
+ * Copyright (C) 2011 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef WTF_BoundsCheckedPointer_h
+#define WTF_BoundsCheckedPointer_h
+
+#include <wtf/Assertions.h>
+#include <wtf/UnusedParam.h>
+
+namespace WTF {
+
+// Useful for when you'd like to do pointer arithmetic on a buffer, but
+// you'd also like to get some ASSERT()'s that prevent you from overflowing.
+// This should be performance-neutral in release builds, while providing
+// you with strong assertions in debug builds. Note that all of the
+// asserting happens when you actually access the pointer. You are allowed
+// to overflow or underflow with arithmetic so long as no accesses are
+// performed.
+
+template<typename T>
+class BoundsCheckedPointer {
+public:
+    BoundsCheckedPointer()
+        : m_pointer(0)
+#if !ASSERT_DISABLED
+        , m_begin(0)
+        , m_end(0)
+#endif
+    {
+    }
+
+    BoundsCheckedPointer(T* pointer, size_t numElements)
+        : m_pointer(pointer)
+#if !ASSERT_DISABLED
+        , m_begin(pointer)
+        , m_end(pointer + numElements)
+#endif
+    {
+        UNUSED_PARAM(numElements);
+    }
+    
+    BoundsCheckedPointer(T* pointer, T* end)
+        : m_pointer(pointer)
+#if !ASSERT_DISABLED
+        , m_begin(pointer)
+        , m_end(end)
+#endif
+    {
+        UNUSED_PARAM(end);
+    }
+
+    BoundsCheckedPointer(T* pointer, T* begin, size_t numElements)
+        : m_pointer(pointer)
+#if !ASSERT_DISABLED
+        , m_begin(begin)
+        , m_end(begin + numElements)
+#endif
+    {
+        UNUSED_PARAM(begin);
+        UNUSED_PARAM(numElements);
+    }
+    
+    BoundsCheckedPointer(T* pointer, T* begin, T* end)
+        : m_pointer(pointer)
+#if !ASSERT_DISABLED
+        , m_begin(begin)
+        , m_end(end)
+#endif
+    {
+        UNUSED_PARAM(begin);
+        UNUSED_PARAM(end);
+    }
+    
+    BoundsCheckedPointer& operator=(T* value)
+    {
+        m_pointer = value;
+        return *this;
+    }
+    
+    BoundsCheckedPointer& operator+=(ptrdiff_t amount)
+    {
+        m_pointer += amount;
+        return *this;
+    }
+
+    BoundsCheckedPointer& operator-=(ptrdiff_t amount)
+    {
+        m_pointer -= amount;
+        return *this;
+    }
+    
+    BoundsCheckedPointer operator+(ptrdiff_t amount) const
+    {
+        BoundsCheckedPointer result = *this;
+        result.m_pointer += amount;
+        return result;
+    }
+
+    BoundsCheckedPointer operator-(ptrdiff_t amount) const
+    {
+        BoundsCheckedPointer result = *this;
+        result.m_pointer -= amount;
+        return result;
+    }
+    
+    BoundsCheckedPointer operator++() // prefix
+    {
+        m_pointer++;
+        return *this;
+    }
+
+    BoundsCheckedPointer operator--() // prefix
+    {
+        m_pointer--;
+        return *this;
+    }
+
+    BoundsCheckedPointer operator++(int) // postfix
+    {
+        BoundsCheckedPointer result = *this;
+        m_pointer++;
+        return result;
+    }
+
+    BoundsCheckedPointer operator--(int) // postfix
+    {
+        BoundsCheckedPointer result = *this;
+        m_pointer--;
+        return result;
+    }
+    
+    bool operator<(T* other) const
+    {
+        return m_pointer < other;
+    }
+
+    bool operator<=(T* other) const
+    {
+        return m_pointer <= other;
+    }
+
+    bool operator>(T* other) const
+    {
+        return m_pointer > other;
+    }
+
+    bool operator>=(T* other) const
+    {
+        return m_pointer >= other;
+    }
+
+    bool operator==(T* other) const
+    {
+        return m_pointer == other;
+    }
+
+    bool operator!=(T* other) const
+    {
+        return m_pointer != other;
+    }
+
+    bool operator<(BoundsCheckedPointer other) const
+    {
+        return m_pointer < other.m_pointer;
+    }
+
+    bool operator<=(BoundsCheckedPointer other) const
+    {
+        return m_pointer <= other.m_pointer;
+    }
+
+    bool operator>(BoundsCheckedPointer other) const
+    {
+        return m_pointer > other.m_pointer;
+    }
+
+    bool operator>=(BoundsCheckedPointer other) const
+    {
+        return m_pointer >= other.m_pointer;
+    }
+
+    bool operator==(BoundsCheckedPointer other) const
+    {
+        return m_pointer == other.m_pointer;
+    }
+
+    bool operator!=(BoundsCheckedPointer other) const
+    {
+        return m_pointer != other.m_pointer;
+    }
+
+    BoundsCheckedPointer operator!()
+    {
+        return !m_pointer;
+    }
+    
+    T* get()
+    {
+        return m_pointer;
+    }
+    
+    T& operator*()
+    {
+        validate();
+        return *m_pointer;
+    }
+
+    const T& operator*() const
+    {
+        validate();
+        return *m_pointer;
+    }
+
+    T& operator[](ptrdiff_t index)
+    {
+        validate(m_pointer + index);
+        return m_pointer[index];
+    }
+
+    const T& operator[](ptrdiff_t index) const
+    {
+        validate(m_pointer + index);
+        return m_pointer[index];
+    }
+    
+    // The only thing this has in common with strcat() is that it
+    // keeps appending from the given pointer until reaching 0.
+    BoundsCheckedPointer& strcat(const T* source)
+    {
+        while (*source)
+            *(*this)++ = *source++;
+        return *this;
+    }
+
+private:
+    void validate(T* pointer) const
+    {
+        ASSERT_UNUSED(pointer, pointer >= m_begin);
+        
+        // This guard is designed to protect against the misaligned case.
+        // A simple pointer < m_end would miss the case if, for example,
+        // T = int16_t and pointer is 1 byte less than m_end.
+        ASSERT_UNUSED(pointer, pointer + 1 <= m_end);
+    }
+    
+    void validate() const
+    {
+        validate(m_pointer);
+    }
+    
+    T* m_pointer;
+#if !ASSERT_DISABLED
+    T* m_begin;
+    T* m_end;
+#endif
+};
+
+} // namespace WTF
+
+using WTF::BoundsCheckedPointer;
+
+#endif // WTF_BoundsCheckedPointer_h
diff --git a/Source/WTF/wtf/BumpPointerAllocator.h b/Source/WTF/wtf/BumpPointerAllocator.h
new file mode 100644
index 0000000..3b2cfd9
--- /dev/null
+++ b/Source/WTF/wtf/BumpPointerAllocator.h
@@ -0,0 +1,252 @@
+/*
+ * 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. ``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
+ * 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 BumpPointerAllocator_h
+#define BumpPointerAllocator_h
+
+#include <algorithm>
+#include <wtf/PageAllocation.h>
+#include <wtf/PageBlock.h>
+
+namespace WTF {
+
+#define MINIMUM_BUMP_POOL_SIZE 0x1000
+
+class BumpPointerPool {
+public:
+    // ensureCapacity will check whether the current pool has capacity to
+    // allocate 'size' bytes of memory  If it does not, it will attempt to
+    // allocate a new pool (which will be added to this one in a chain).
+    //
+    // If allocation fails (out of memory) this method will return null.
+    // If the return value is non-null, then callers should update any
+    // references they have to this current (possibly full) BumpPointerPool
+    // to instead point to the newly returned BumpPointerPool.
+    BumpPointerPool* ensureCapacity(size_t size)
+    {
+        void* allocationEnd = static_cast<char*>(m_current) + size;
+        ASSERT(allocationEnd > m_current); // check for overflow
+        if (allocationEnd <= static_cast<void*>(this))
+            return this;
+        return ensureCapacityCrossPool(this, size);
+    }
+
+    // alloc should only be called after calling ensureCapacity; as such
+    // alloc will never fail.
+    void* alloc(size_t size)
+    {
+        void* current = m_current;
+        void* allocationEnd = static_cast<char*>(current) + size;
+        ASSERT(allocationEnd > current); // check for overflow
+        ASSERT(allocationEnd <= static_cast<void*>(this));
+        m_current = allocationEnd;
+        return current;
+    }
+
+    // The dealloc method releases memory allocated using alloc.  Memory
+    // must be released in a LIFO fashion, e.g. if the client calls alloc
+    // four times, returning pointer A, B, C, D, then the only valid order
+    // in which these may be deallocaed is D, C, B, A.
+    //
+    // The client may optionally skip some deallocations.  In the example
+    // above, it would be valid to only explicitly dealloc C, A (D being
+    // dealloced along with C, B along with A).
+    //
+    // If pointer was not allocated from this pool (or pools) then dealloc
+    // will CRASH().  Callers should update any references they have to
+    // this current BumpPointerPool to instead point to the returned
+    // BumpPointerPool.
+    BumpPointerPool* dealloc(void* position)
+    {
+        if ((position >= m_start) && (position <= static_cast<void*>(this))) {
+            ASSERT(position <= m_current);
+            m_current = position;
+            return this;
+        }
+        return deallocCrossPool(this, position);
+    }
+
+private:
+    // Placement operator new, returns the last 'size' bytes of allocation for use as this.
+    void* operator new(size_t size, const PageAllocation& allocation)
+    {
+        ASSERT(size < allocation.size());
+        return reinterpret_cast<char*>(reinterpret_cast<intptr_t>(allocation.base()) + allocation.size()) - size;
+    }
+
+    BumpPointerPool(const PageAllocation& allocation)
+        : m_current(allocation.base())
+        , m_start(allocation.base())
+        , m_next(0)
+        , m_previous(0)
+        , m_allocation(allocation)
+    {
+    }
+
+    static BumpPointerPool* create(size_t minimumCapacity = 0)
+    {
+        // Add size of BumpPointerPool object, check for overflow.
+        minimumCapacity += sizeof(BumpPointerPool);
+        if (minimumCapacity < sizeof(BumpPointerPool))
+            return 0;
+
+        size_t poolSize = std::max(static_cast<size_t>(MINIMUM_BUMP_POOL_SIZE), WTF::pageSize());
+        while (poolSize < minimumCapacity) {
+            poolSize <<= 1;
+            // The following if check relies on MINIMUM_BUMP_POOL_SIZE being a power of 2!
+            ASSERT(!(MINIMUM_BUMP_POOL_SIZE & (MINIMUM_BUMP_POOL_SIZE - 1)));
+            if (!poolSize)
+                return 0;
+        }
+
+        PageAllocation allocation = PageAllocation::allocate(poolSize);
+        if (!!allocation)
+            return new (allocation) BumpPointerPool(allocation);
+        return 0;
+    }
+
+    void shrink()
+    {
+        ASSERT(!m_previous);
+        m_current = m_start;
+        while (m_next) {
+            BumpPointerPool* nextNext = m_next->m_next;
+            m_next->destroy();
+            m_next = nextNext;
+        }
+    }
+
+    void destroy()
+    {
+        m_allocation.deallocate();
+    }
+
+    static BumpPointerPool* ensureCapacityCrossPool(BumpPointerPool* previousPool, size_t size)
+    {
+        // The pool passed should not have capacity, so we'll start with the next one.
+        ASSERT(previousPool);
+        ASSERT((static_cast<char*>(previousPool->m_current) + size) > previousPool->m_current); // check for overflow
+        ASSERT((static_cast<char*>(previousPool->m_current) + size) > static_cast<void*>(previousPool));
+        BumpPointerPool* pool = previousPool->m_next;
+
+        while (true) {
+            if (!pool) {
+                // We've run to the end; allocate a new pool.
+                pool = BumpPointerPool::create(size);
+                previousPool->m_next = pool;
+                pool->m_previous = previousPool;
+                return pool;
+            }
+
+            // 
+            void* current = pool->m_current;
+            void* allocationEnd = static_cast<char*>(current) + size;
+            ASSERT(allocationEnd > current); // check for overflow
+            if (allocationEnd <= static_cast<void*>(pool))
+                return pool;
+        }
+    }
+
+    static BumpPointerPool* deallocCrossPool(BumpPointerPool* pool, void* position)
+    {
+        // Should only be called if position is not in the current pool.
+        ASSERT((position < pool->m_start) || (position > static_cast<void*>(pool)));
+
+        while (true) {
+            // Unwind the current pool to the start, move back in the chain to the previous pool.
+            pool->m_current = pool->m_start;
+            pool = pool->m_previous;
+
+            // position was nowhere in the chain!
+            if (!pool)
+                CRASH();
+
+            if ((position >= pool->m_start) && (position <= static_cast<void*>(pool))) {
+                ASSERT(position <= pool->m_current);
+                pool->m_current = position;
+                return pool;
+            }
+        }
+    }
+
+    void* m_current;
+    void* m_start;
+    BumpPointerPool* m_next;
+    BumpPointerPool* m_previous;
+    PageAllocation m_allocation;
+
+    friend class BumpPointerAllocator;
+};
+
+// A BumpPointerAllocator manages a set of BumpPointerPool objects, which
+// can be used for LIFO (stack like) allocation.
+//
+// To begin allocating using this class call startAllocator().  The result
+// of this method will be null if the initial pool allocation fails, or a
+// pointer to a BumpPointerPool object that can be used to perform
+// allocations.  Whilst running no memory will be released until
+// stopAllocator() is called.  At this point all allocations made through
+// this allocator will be reaped, and underlying memory may be freed.
+//
+// (In practice we will still hold on to the initial pool to allow allocation
+// to be quickly restared, but aditional pools will be freed).
+//
+// This allocator is non-renetrant, it is encumbant on the clients to ensure
+// startAllocator() is not called again until stopAllocator() has been called.
+class BumpPointerAllocator {
+public:
+    BumpPointerAllocator()
+        : m_head(0)
+    {
+    }
+
+    ~BumpPointerAllocator()
+    {
+        if (m_head)
+            m_head->destroy();
+    }
+
+    BumpPointerPool* startAllocator()
+    {
+        if (!m_head)
+            m_head = BumpPointerPool::create();
+        return m_head;
+    }
+
+    void stopAllocator()
+    {
+        if (m_head)
+            m_head->shrink();
+    }
+
+private:
+    BumpPointerPool* m_head;
+};
+
+}
+
+using WTF::BumpPointerAllocator;
+
+#endif // BumpPointerAllocator_h
diff --git a/Source/WTF/wtf/ByteOrder.h b/Source/WTF/wtf/ByteOrder.h
new file mode 100644
index 0000000..08e3783
--- /dev/null
+++ b/Source/WTF/wtf/ByteOrder.h
@@ -0,0 +1,67 @@
+/*
+* Copyright (C) 2012 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.
+*     * 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.
+*     * 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_ByteOrder_h
+#define WTF_ByteOrder_h
+
+#include <wtf/Platform.h>
+
+#if OS(UNIX)
+#include <arpa/inet.h>
+#endif
+
+#if OS(WINDOWS)
+
+namespace WTF {
+inline uint32_t wswap32(uint32_t x) { return ((x & 0xffff0000) >> 16) | ((x & 0x0000ffff) << 16); }
+inline uint32_t bswap32(uint32_t x) { return ((x & 0xff000000) >> 24) | ((x & 0x00ff0000) >> 8) | ((x & 0x0000ff00) << 8) | ((x & 0x000000ff) << 24); }
+inline uint16_t bswap16(uint16_t x) { return ((x & 0xff00) >> 8) | ((x & 0x00ff) << 8); }
+} // namespace WTF
+
+#if CPU(BIG_ENDIAN)
+inline uint16_t ntohs(uint16_t x) { return x; }
+inline uint16_t htons(uint16_t x) { return x; }
+inline uint32_t ntohl(uint32_t x) { return x; }
+inline uint32_t htonl(uint32_t x) { return x; }
+#elif CPU(MIDDLE_ENDIAN)
+inline uint16_t ntohs(unit16_t x) { return x; }
+inline uint16_t htons(uint16_t x) { return x; }
+inline uint32_t ntohl(uint32_t x) { return WTF::wswap32(x); }
+inline uint32_t htonl(uint32_t x) { return WTF::wswap32(x); }
+#else
+inline uint16_t ntohs(uint16_t x) { return WTF::bswap16(x); }
+inline uint16_t htons(uint16_t x) { return WTF::bswap16(x); }
+inline uint32_t ntohl(uint32_t x) { return WTF::bswap32(x); }
+inline uint32_t htonl(uint32_t x) { return WTF::bswap32(x); }
+#endif
+
+#endif // OS(WINDOWS)
+
+#endif // WTF_ByteOrder_h
diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt
new file mode 100644
index 0000000..da8ded9
--- /dev/null
+++ b/Source/WTF/wtf/CMakeLists.txt
@@ -0,0 +1,220 @@
+SET(WTF_HEADERS
+    ASCIICType.h
+    AVLTree.h
+    Alignment.h
+    AlwaysInline.h
+    Assertions.h
+    Atomics.h
+    BitArray.h
+    BitVector.h
+    Bitmap.h
+    BoundsCheckedPointer.h
+    BumpPointerAllocator.h
+    ByteOrder.h
+    Compiler.h
+    Complex.h
+    CryptographicallyRandomNumber.h
+    CurrentTime.h
+    DateMath.h
+    DataLog.h
+    DecimalNumber.h
+    Decoder.h
+    Deque.h
+    DisallowCType.h
+    DoublyLinkedList.h
+    DynamicAnnotations.h
+    Encoder.h
+    FastAllocBase.h
+    FastMalloc.h
+    FixedArray.h
+    Forward.h
+    GetPtr.h
+    GregorianDateTime.h
+    HashCountedSet.h
+    HashFunctions.h
+    HashIterators.h
+    HashMap.h
+    HashSet.h
+    HashTable.h
+    HashTraits.h
+    HexNumber.h
+    ListHashSet.h
+    ListRefPtr.h
+    Locker.h
+    MD5.h
+    MainThread.h
+    MallocZoneSupport.h
+    MathExtras.h
+    MediaTime.h
+    MessageQueue.h
+    MetaAllocator.h
+    MetaAllocatorHandle.h
+    NonCopyingSort.h
+    ThreadRestrictionVerifier.h
+    Noncopyable.h
+    NotFound.h
+    NullPtr.h
+    NumberOfCores.h
+    RAMSize.h
+    OSAllocator.h
+    OSRandomSource.h
+    OwnArrayPtr.h
+    OwnPtr.h
+    OwnPtrCommon.h
+    PageAllocation.h
+    PageAllocationAligned.h
+    PageBlock.h
+    PageReservation.h
+    PassOwnArrayPtr.h
+    PassOwnPtr.h
+    PassRefPtr.h
+    PassTraits.h
+    ParallelJobs.h
+    ParallelJobsGeneric.h
+    ParallelJobsLibdispatch.h
+    ParallelJobsOpenMP.h
+    Platform.h
+    PossiblyNull.h
+    RandomNumber.h
+    RandomNumberSeed.h
+    RedBlackTree.h
+    RefCounted.h
+    RefCountedLeakCounter.h
+    RefPtr.h
+    RefPtrHashMap.h
+    RetainPtr.h
+    SaturatedArithmetic.h
+    SegmentedVector.h
+    SHA1.h
+    StackBounds.h
+    StaticConstructors.h
+    StdLibExtras.h
+    StringExtras.h
+    StringHasher.h
+    TCPackedCache.h
+    TCPageMap.h
+    TCSpinLock.h
+    TCSystemAlloc.h
+    ThreadIdentifierDataPthreads.h
+    ThreadSafeRefCounted.h
+    ThreadSpecific.h
+    Threading.h
+    ThreadingPrimitives.h
+    TypeTraits.h
+    UnusedParam.h
+    VMTags.h
+    ValueCheck.h
+    Vector.h
+    VectorTraits.h
+    WTFThreadData.h
+    dtoa.h
+
+    dtoa/bignum-dtoa.h
+    dtoa/bignum.h
+    dtoa/cached-powers.h
+    dtoa/diy-fp.h
+    dtoa/double-conversion.h
+    dtoa/double.h
+    dtoa/fast-dtoa.h
+    dtoa/fixed-dtoa.h
+    dtoa/strtod.h
+    dtoa/utils.h
+
+    text/AtomicString.h
+    text/AtomicStringImpl.h
+    text/Base64.h
+    text/CString.h
+    text/IntegerToStringConversion.h
+    text/StringBuffer.h
+    text/StringHash.h
+    text/StringImpl.h
+    text/WTFString.h
+
+    threads/BinarySemaphore.h
+
+    unicode/CharacterNames.h
+    unicode/Collator.h
+    unicode/UTF8.h
+    unicode/Unicode.h
+)
+
+SET(WTF_SOURCES
+    ArrayBuffer.cpp
+    ArrayBufferView.cpp
+    Assertions.cpp
+    BitVector.cpp
+    CryptographicallyRandomNumber.cpp
+    CurrentTime.cpp
+    DateMath.cpp
+    DataLog.cpp
+    DecimalNumber.cpp
+    DynamicAnnotations.cpp
+    FastMalloc.cpp
+    GregorianDateTime.cpp
+    HashTable.cpp
+    MD5.cpp
+    MainThread.cpp
+    MediaTime.cpp
+    MetaAllocator.cpp
+    OSRandomSource.cpp
+    NumberOfCores.cpp
+    RAMSize.cpp
+    PageAllocationAligned.cpp
+    PageBlock.cpp
+    ParallelJobsGeneric.cpp
+    RandomNumber.cpp
+    RefCountedLeakCounter.cpp
+    SHA1.cpp
+    StackBounds.cpp
+    StringExtras.cpp
+    Threading.cpp
+    TypeTraits.cpp
+    WTFThreadData.cpp
+    dtoa.cpp
+
+    dtoa/bignum-dtoa.cc
+    dtoa/bignum.cc
+    dtoa/cached-powers.cc
+    dtoa/diy-fp.cc
+    dtoa/double-conversion.cc
+    dtoa/fast-dtoa.cc
+    dtoa/fixed-dtoa.cc
+    dtoa/strtod.cc
+
+    text/AtomicString.cpp
+    text/Base64.cpp
+    text/CString.cpp
+    text/StringBuilder.cpp
+    text/StringImpl.cpp
+    text/StringStatics.cpp
+    text/WTFString.cpp
+
+    threads/BinarySemaphore.cpp
+
+    unicode/UTF8.cpp
+)
+
+SET(WTF_INCLUDE_DIRECTORIES
+    "${WTF_DIR}"
+    "${WTF_DIR}/wtf"
+    "${WTF_DIR}/wtf/dtoa"
+    "${WTF_DIR}/wtf/threads"
+    "${WTF_DIR}/wtf/unicode"
+    "${THIRDPARTY_DIR}"
+    "${CMAKE_BINARY_DIR}"
+)
+
+IF (NOT USE_SYSTEM_MALLOC)
+    LIST(APPEND WTF_SOURCES
+        TCSystemAlloc.cpp
+    )
+ENDIF()
+
+WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
+
+WEBKIT_WRAP_SOURCELIST(${WTF_SOURCES})
+INCLUDE_DIRECTORIES(${WTF_INCLUDE_DIRECTORIES})
+ADD_DEFINITIONS(-DBUILDING_WTF)
+ADD_LIBRARY(${WTF_LIBRARY_NAME} STATIC ${WTF_HEADERS} ${WTF_SOURCES})
+TARGET_LINK_LIBRARIES(${WTF_LIBRARY_NAME} ${WTF_LIBRARIES})
+SET_TARGET_PROPERTIES(${WTF_LIBRARY_NAME} PROPERTIES FOLDER "JavaScriptCore")
diff --git a/Source/WTF/wtf/CONTRIBUTORS.pthreads-win32 b/Source/WTF/wtf/CONTRIBUTORS.pthreads-win32
new file mode 100644
index 0000000..7de0f26
--- /dev/null
+++ b/Source/WTF/wtf/CONTRIBUTORS.pthreads-win32
@@ -0,0 +1,137 @@
+This is a copy of CONTRIBUTORS file for the Pthreads-win32 library, downloaded
+from http://sourceware.org/cgi-bin/cvsweb.cgi/~checkout~/pthreads/CONTRIBUTORS?rev=1.32&cvsroot=pthreads-win32
+
+Included here to compliment the Pthreads-win32 license header in wtf/ThreadingWin.cpp file.
+WebKit is using derived sources of ThreadCondition code from Pthreads-win32.
+
+-------------------------------------------------------------------------------
+
+Contributors (in approximate order of appearance)
+
+[See also the ChangeLog file where individuals are
+attributed in log entries. Likewise in the FAQ file.]
+
+Ben Elliston		bje at cygnus dot com
+					Initiated the project;
+					setup the project infrastructure (CVS, web page, etc.);
+					early prototype routines.
+Ross Johnson		rpj at callisto dot canberra dot edu dot au
+					early prototype routines;
+					ongoing project coordination/maintenance;
+					implementation of spin locks and barriers;
+					various enhancements;
+					bug fixes;
+					documentation;
+					testsuite.
+Robert Colquhoun	rjc at trump dot net dot au
+					Early bug fixes.
+John E. Bossom		John dot Bossom at cognos dot com
+					Contributed substantial original working implementation;
+					bug fixes;
+					ongoing guidance and standards interpretation.
+Anders Norlander	anorland at hem2 dot passagen dot se
+					Early enhancements and runtime checking for supported
+					Win32 routines.
+Tor Lillqvist		tml at iki dot fi
+					General enhancements;
+					early bug fixes to condition variables.
+Scott Lightner		scott at curriculum dot com
+					Bug fix.
+Kevin Ruland		Kevin dot Ruland at anheuser-busch dot com
+					Various bug fixes.
+Mike Russo		miker at eai dot com
+					Bug fix.
+Mark E. Armstrong	avail at pacbell dot net
+					Bug fixes.
+Lorin Hochstein 	lmh at xiphos dot ca
+					general bug fixes; bug fixes to condition variables.
+Peter Slacik		Peter dot Slacik at tatramed dot sk
+					Bug fixes.
+Mumit Khan		khan at xraylith dot wisc dot edu
+					Fixes to work with Mingw32.
+Milan Gardian		mg at tatramed dot sk
+					Bug fixes and reports/analyses of obscure problems.
+Aurelio Medina		aureliom at crt dot com
+					First implementation of read-write locks.
+Graham Dumpleton	Graham dot Dumpleton at ra dot pad dot otc dot telstra dot com dot au
+					Bug fix in condition variables.
+Tristan Savatier	tristan at mpegtv dot com
+					WinCE port.
+Erik Hensema		erik at hensema dot xs4all dot nl
+					Bug fixes.
+Rich Peters		rpeters at micro-magic dot com
+Todd Owen		towen at lucidcalm dot dropbear dot id dot au
+					Bug fixes to dll loading.
+Jason Nye		jnye at nbnet dot nb dot ca
+					Implementation of async cancelation.
+Fred Forester		fforest at eticomm dot net
+Kevin D. Clark		kclark at cabletron dot com
+David Baggett		dmb at itasoftware dot com
+					Bug fixes.
+Paul Redondo		paul at matchvision dot com
+Scott McCaskill 	scott at 3dfx dot com
+					Bug fixes.
+Jef Gearhart		jgearhart at tpssys dot com
+					Bug fix.
+Arthur Kantor		akantor at bexusa dot com
+					Mutex enhancements.
+Steven Reddie		smr at essemer dot com dot au
+					Bug fix.
+Alexander Terekhov	TEREKHOV at de dot ibm dot com
+					Re-implemented and improved read-write locks;
+					(with Louis Thomas) re-implemented and improved
+					condition variables;
+					enhancements to semaphores;
+					enhancements to mutexes;
+					new mutex implementation in 'futex' style;
+					suggested a robust implementation of pthread_once
+					similar to that implemented by V.Kliathcko;
+					system clock change handling re CV timeouts;
+					bug fixes.
+Thomas Pfaff		tpfaff at gmx dot net
+					Changes to make C version usable with C++ applications;
+					re-implemented mutex routines to avoid Win32 mutexes
+					and TryEnterCriticalSection;
+					procedure to fix Mingw32 thread-safety issues.
+Franco Bez		franco dot bez at gmx dot de
+					procedure to fix Mingw32 thread-safety issues.
+Louis Thomas		lthomas at arbitrade dot com
+					(with Alexander Terekhov) re-implemented and improved
+					condition variables.
+David Korn		dgk at research dot att dot com
+					Ported to UWIN.
+Phil Frisbie, Jr.	phil at hawksoft dot com
+					Bug fix.
+Ralf Brese		Ralf dot Brese at pdb4 dot siemens dot de
+					Bug fix.
+prionx at juno dot com 	prionx at juno dot com
+					Bug fixes.
+Max Woodbury		mtew at cds dot duke dot edu
+					POSIX versioning conditionals;
+					reduced namespace pollution;
+					idea to separate routines to reduce statically
+					linked image sizes.
+Rob Fanner		rfanner at stonethree dot com
+					Bug fix.
+Michael Johnson 	michaelj at maine dot rr dot com
+					Bug fix.
+Nicolas Barry		boozai at yahoo dot com
+					Bug fixes.
+Piet van Bruggen	pietvb at newbridges dot nl
+					Bug fix.
+Makoto Kato		raven at oldskool dot jp
+					AMD64 port.
+Panagiotis E. Hadjidoukas	peh at hpclab dot ceid dot upatras dot gr
+					Contributed the QueueUserAPCEx package which
+					makes preemptive async cancelation possible.
+Will Bryant		will dot bryant at ecosm dot com
+					Borland compiler patch and makefile.
+Anuj Goyal		anuj dot goyal at gmail dot com
+					Port to Digital Mars compiler.
+Gottlob Frege		gottlobfrege at  gmail dot com
+					re-implemented pthread_once (version 2)
+					(pthread_once cancellation added by rpj).
+Vladimir Kliatchko	vladimir at kliatchko dot com
+					reimplemented pthread_once with the same form
+					as described by A.Terekhov (later version 2);
+					implementation of MCS (Mellor-Crummey/Scott) locks.
\ No newline at end of file
diff --git a/Source/WTF/wtf/CheckedArithmetic.h b/Source/WTF/wtf/CheckedArithmetic.h
new file mode 100644
index 0000000..f5d3b75
--- /dev/null
+++ b/Source/WTF/wtf/CheckedArithmetic.h
@@ -0,0 +1,708 @@
+/*
+ * Copyright (C) 2011 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. ``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
+ * 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 CheckedArithmetic_h
+#define CheckedArithmetic_h
+
+#include <wtf/Assertions.h>
+#include <wtf/TypeTraits.h>
+
+#include <limits>
+#include <stdint.h>
+
+/* Checked<T>
+ *
+ * This class provides a mechanism to perform overflow-safe integer arithmetic
+ * without having to manually ensure that you have all the required bounds checks
+ * directly in your code.
+ *
+ * There are two modes of operation:
+ *  - The default is Checked<T, CrashOnOverflow>, and crashes at the point
+ *    and overflow has occurred.
+ *  - The alternative is Checked<T, RecordOverflow>, which uses an additional
+ *    byte of storage to track whether an overflow has occurred, subsequent
+ *    unchecked operations will crash if an overflow has occured
+ *
+ * It is possible to provide a custom overflow handler, in which case you need
+ * to support these functions:
+ *  - void overflowed();
+ *    This function is called when an operation has produced an overflow.
+ *  - bool hasOverflowed();
+ *    This function must return true if overflowed() has been called on an
+ *    instance and false if it has not.
+ *  - void clearOverflow();
+ *    Used to reset overflow tracking when a value is being overwritten with
+ *    a new value.
+ *
+ * Checked<T> works for all integer types, with the following caveats:
+ *  - Mixing signedness of operands is only supported for types narrower than
+ *    64bits.
+ *  - It does have a performance impact, so tight loops may want to be careful
+ *    when using it.
+ *
+ */
+
+namespace WTF {
+
+class CrashOnOverflow {
+protected:
+    NO_RETURN_DUE_TO_CRASH void overflowed()
+    {
+        CRASH();
+    }
+
+    void clearOverflow() { }
+
+public:
+    bool hasOverflowed() const { return false; }
+};
+
+class RecordOverflow {
+protected:
+    RecordOverflow()
+        : m_overflowed(false)
+    {
+    }
+
+    void overflowed()
+    {
+        m_overflowed = true;
+    }
+
+    void clearOverflow()
+    {
+        m_overflowed = false;
+    }
+
+public:
+    bool hasOverflowed() const { return m_overflowed; }
+
+private:
+    unsigned char m_overflowed;
+};
+
+template <typename T, class OverflowHandler = CrashOnOverflow> class Checked;
+template <typename T> struct RemoveChecked;
+template <typename T> struct RemoveChecked<Checked<T> >;
+
+template <typename Target, typename Source, bool targetSigned = std::numeric_limits<Target>::is_signed, bool sourceSigned = std::numeric_limits<Source>::is_signed> struct BoundsChecker;
+template <typename Target, typename Source> struct BoundsChecker<Target, Source, false, false> {
+    static bool inBounds(Source value)
+    {
+        // Same signedness so implicit type conversion will always increase precision
+        // to widest type
+        return value <= std::numeric_limits<Target>::max();
+    }
+};
+
+template <typename Target, typename Source> struct BoundsChecker<Target, Source, true, true> {
+    static bool inBounds(Source value)
+    {
+        // Same signedness so implicit type conversion will always increase precision
+        // to widest type
+        return std::numeric_limits<Target>::min() <= value && value <= std::numeric_limits<Target>::max();
+    }
+};
+
+template <typename Target, typename Source> struct BoundsChecker<Target, Source, false, true> {
+    static bool inBounds(Source value)
+    {
+        // Target is unsigned so any value less than zero is clearly unsafe
+        if (value < 0)
+            return false;
+        // If our (unsigned) Target is the same or greater width we can
+        // convert value to type Target without losing precision
+        if (sizeof(Target) >= sizeof(Source)) 
+            return static_cast<Target>(value) <= std::numeric_limits<Target>::max();
+        // The signed Source type has greater precision than the target so
+        // max(Target) -> Source will widen.
+        return value <= static_cast<Source>(std::numeric_limits<Target>::max());
+    }
+};
+
+template <typename Target, typename Source> struct BoundsChecker<Target, Source, true, false> {
+    static bool inBounds(Source value)
+    {
+        // Signed target with an unsigned source
+        if (sizeof(Target) <= sizeof(Source)) 
+            return value <= static_cast<Source>(std::numeric_limits<Target>::max());
+        // Target is Wider than Source so we're guaranteed to fit any value in
+        // unsigned Source
+        return true;
+    }
+};
+
+template <typename Target, typename Source, bool CanElide = IsSameType<Target, Source>::value || (sizeof(Target) > sizeof(Source)) > struct BoundsCheckElider;
+template <typename Target, typename Source> struct BoundsCheckElider<Target, Source, true> {
+    static bool inBounds(Source) { return true; }
+};
+template <typename Target, typename Source> struct BoundsCheckElider<Target, Source, false> : public BoundsChecker<Target, Source> {
+};
+
+template <typename Target, typename Source> static inline bool isInBounds(Source value)
+{
+    return BoundsCheckElider<Target, Source>::inBounds(value);
+}
+
+template <typename T> struct RemoveChecked {
+    typedef T CleanType;
+    static const CleanType DefaultValue = 0;    
+};
+
+template <typename T> struct RemoveChecked<Checked<T, CrashOnOverflow> > {
+    typedef typename RemoveChecked<T>::CleanType CleanType;
+    static const CleanType DefaultValue = 0;
+};
+
+template <typename T> struct RemoveChecked<Checked<T, RecordOverflow> > {
+    typedef typename RemoveChecked<T>::CleanType CleanType;
+    static const CleanType DefaultValue = 0;
+};
+
+// The ResultBase and SignednessSelector are used to workaround typeof not being
+// available in MSVC
+template <typename U, typename V, bool uIsBigger = (sizeof(U) > sizeof(V)), bool sameSize = (sizeof(U) == sizeof(V))> struct ResultBase;
+template <typename U, typename V> struct ResultBase<U, V, true, false> {
+    typedef U ResultType;
+};
+
+template <typename U, typename V> struct ResultBase<U, V, false, false> {
+    typedef V ResultType;
+};
+
+template <typename U> struct ResultBase<U, U, false, true> {
+    typedef U ResultType;
+};
+
+template <typename U, typename V, bool uIsSigned = std::numeric_limits<U>::is_signed, bool vIsSigned = std::numeric_limits<V>::is_signed> struct SignednessSelector;
+template <typename U, typename V> struct SignednessSelector<U, V, true, true> {
+    typedef U ResultType;
+};
+
+template <typename U, typename V> struct SignednessSelector<U, V, false, false> {
+    typedef U ResultType;
+};
+
+template <typename U, typename V> struct SignednessSelector<U, V, true, false> {
+    typedef V ResultType;
+};
+
+template <typename U, typename V> struct SignednessSelector<U, V, false, true> {
+    typedef U ResultType;
+};
+
+template <typename U, typename V> struct ResultBase<U, V, false, true> {
+    typedef typename SignednessSelector<U, V>::ResultType ResultType;
+};
+
+template <typename U, typename V> struct Result : ResultBase<typename RemoveChecked<U>::CleanType, typename RemoveChecked<V>::CleanType> {
+};
+
+template <typename LHS, typename RHS, typename ResultType = typename Result<LHS, RHS>::ResultType, 
+    bool lhsSigned = std::numeric_limits<LHS>::is_signed, bool rhsSigned = std::numeric_limits<RHS>::is_signed> struct ArithmeticOperations;
+
+template <typename LHS, typename RHS, typename ResultType> struct ArithmeticOperations<LHS, RHS, ResultType, true, true> {
+    // LHS and RHS are signed types
+
+    // Helper function
+    static inline bool signsMatch(LHS lhs, RHS rhs)
+    {
+        return (lhs ^ rhs) >= 0;
+    }
+
+    static inline bool add(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN
+    {
+        if (signsMatch(lhs, rhs)) {
+            if (lhs >= 0) {
+                if ((std::numeric_limits<ResultType>::max() - rhs) < lhs)
+                    return false;
+            } else {
+                ResultType temp = lhs - std::numeric_limits<ResultType>::min();
+                if (rhs < -temp)
+                    return false;
+            }
+        } // if the signs do not match this operation can't overflow
+        result = lhs + rhs;
+        return true;
+    }
+
+    static inline bool sub(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN
+    {
+        if (!signsMatch(lhs, rhs)) {
+            if (lhs >= 0) {
+                if (lhs > std::numeric_limits<ResultType>::max() + rhs)
+                    return false;
+            } else {
+                if (rhs > std::numeric_limits<ResultType>::max() + lhs)
+                    return false;
+            }
+        } // if the signs match this operation can't overflow
+        result = lhs - rhs;
+        return true;
+    }
+
+    static inline bool multiply(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN
+    {
+        if (signsMatch(lhs, rhs)) {
+            if (lhs >= 0) {
+                if (lhs && (std::numeric_limits<ResultType>::max() / lhs) < rhs)
+                    return false;
+            } else {
+                if (static_cast<ResultType>(lhs) == std::numeric_limits<ResultType>::min() || static_cast<ResultType>(rhs) == std::numeric_limits<ResultType>::min())
+                    return false;
+                if ((std::numeric_limits<ResultType>::max() / -lhs) < -rhs)
+                    return false;
+            }
+        } else {
+            if (lhs < 0) {
+                if (rhs && lhs < (std::numeric_limits<ResultType>::min() / rhs))
+                    return false;
+            } else {
+                if (lhs && rhs < (std::numeric_limits<ResultType>::min() / lhs))
+                    return false;
+            }
+        }
+        result = lhs * rhs;
+        return true;
+    }
+
+    static inline bool equals(LHS lhs, RHS rhs) { return lhs == rhs; }
+
+};
+
+template <typename LHS, typename RHS, typename ResultType> struct ArithmeticOperations<LHS, RHS, ResultType, false, false> {
+    // LHS and RHS are unsigned types so bounds checks are nice and easy
+    static inline bool add(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN
+    {
+        ResultType temp = lhs + rhs;
+        if (temp < lhs)
+            return false;
+        result = temp;
+        return true;
+    }
+
+    static inline bool sub(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN
+    {
+        ResultType temp = lhs - rhs;
+        if (temp > lhs)
+            return false;
+        result = temp;
+        return true;
+    }
+
+    static inline bool multiply(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN
+    {
+        ResultType temp = lhs * rhs;
+        if (temp < lhs)
+            return false;
+        result = temp;
+        return true;
+    }
+
+    static inline bool equals(LHS lhs, RHS rhs) { return lhs == rhs; }
+
+};
+
+template <typename ResultType> struct ArithmeticOperations<int, unsigned, ResultType, true, false> {
+    static inline bool add(int64_t lhs, int64_t rhs, ResultType& result)
+    {
+        int64_t temp = lhs + rhs;
+        if (temp < std::numeric_limits<ResultType>::min())
+            return false;
+        if (temp > std::numeric_limits<ResultType>::max())
+            return false;
+        result = static_cast<ResultType>(temp);
+        return true;
+    }
+    
+    static inline bool sub(int64_t lhs, int64_t rhs, ResultType& result)
+    {
+        int64_t temp = lhs - rhs;
+        if (temp < std::numeric_limits<ResultType>::min())
+            return false;
+        if (temp > std::numeric_limits<ResultType>::max())
+            return false;
+        result = static_cast<ResultType>(temp);
+        return true;
+    }
+
+    static inline bool multiply(int64_t lhs, int64_t rhs, ResultType& result)
+    {
+        int64_t temp = lhs * rhs;
+        if (temp < std::numeric_limits<ResultType>::min())
+            return false;
+        if (temp > std::numeric_limits<ResultType>::max())
+            return false;
+        result = static_cast<ResultType>(temp);
+        return true;
+    }
+
+    static inline bool equals(int lhs, unsigned rhs)
+    {
+        return static_cast<int64_t>(lhs) == static_cast<int64_t>(rhs);
+    }
+};
+
+template <typename ResultType> struct ArithmeticOperations<unsigned, int, ResultType, false, true> {
+    static inline bool add(int64_t lhs, int64_t rhs, ResultType& result)
+    {
+        return ArithmeticOperations<int, unsigned, ResultType>::add(rhs, lhs, result);
+    }
+    
+    static inline bool sub(int64_t lhs, int64_t rhs, ResultType& result)
+    {
+        return ArithmeticOperations<int, unsigned, ResultType>::sub(lhs, rhs, result);
+    }
+
+    static inline bool multiply(int64_t lhs, int64_t rhs, ResultType& result)
+    {
+        return ArithmeticOperations<int, unsigned, ResultType>::multiply(rhs, lhs, result);
+    }
+
+    static inline bool equals(unsigned lhs, int rhs)
+    {
+        return ArithmeticOperations<int, unsigned, ResultType>::equals(rhs, lhs);
+    }
+};
+
+template <typename U, typename V, typename R> static inline bool safeAdd(U lhs, V rhs, R& result)
+{
+    return ArithmeticOperations<U, V, R>::add(lhs, rhs, result);
+}
+
+template <typename U, typename V, typename R> static inline bool safeSub(U lhs, V rhs, R& result)
+{
+    return ArithmeticOperations<U, V, R>::sub(lhs, rhs, result);
+}
+
+template <typename U, typename V, typename R> static inline bool safeMultiply(U lhs, V rhs, R& result)
+{
+    return ArithmeticOperations<U, V, R>::multiply(lhs, rhs, result);
+}
+
+template <typename U, typename V> static inline bool safeEquals(U lhs, V rhs)
+{
+    return ArithmeticOperations<U, V>::equals(lhs, rhs);
+}
+
+enum ResultOverflowedTag { ResultOverflowed };
+    
+// FIXME: Needed to workaround http://llvm.org/bugs/show_bug.cgi?id=10801
+static inline bool workAroundClangBug() { return true; }
+
+template <typename T, class OverflowHandler> class Checked : public OverflowHandler {
+public:
+    template <typename _T, class _OverflowHandler> friend class Checked;
+    Checked()
+        : m_value(0)
+    {
+    }
+
+    Checked(ResultOverflowedTag)
+        : m_value(0)
+    {
+        // FIXME: Remove this when clang fixes http://llvm.org/bugs/show_bug.cgi?id=10801
+        if (workAroundClangBug())
+            this->overflowed();
+    }
+
+    template <typename U> Checked(U value)
+    {
+        if (!isInBounds<T>(value))
+            this->overflowed();
+        m_value = static_cast<T>(value);
+    }
+    
+    template <typename V> Checked(const Checked<T, V>& rhs)
+        : m_value(rhs.m_value)
+    {
+        if (rhs.hasOverflowed())
+            this->overflowed();
+    }
+    
+    template <typename U> Checked(const Checked<U, OverflowHandler>& rhs)
+        : OverflowHandler(rhs)
+    {
+        if (!isInBounds<T>(rhs.m_value))
+            this->overflowed();
+        m_value = static_cast<T>(rhs.m_value);
+    }
+    
+    template <typename U, typename V> Checked(const Checked<U, V>& rhs)
+    {
+        if (rhs.hasOverflowed())
+            this->overflowed();
+        if (!isInBounds<T>(rhs.m_value))
+            this->overflowed();
+        m_value = static_cast<T>(rhs.m_value);
+    }
+    
+    const Checked& operator=(Checked rhs)
+    {
+        this->clearOverflow();
+        if (rhs.hasOverflowed())
+            this->overflowed();
+        m_value = static_cast<T>(rhs.m_value);
+        return *this;
+    }
+    
+    template <typename U> const Checked& operator=(U value)
+    {
+        return *this = Checked(value);
+    }
+    
+    template <typename U, typename V> const Checked& operator=(const Checked<U, V>& rhs)
+    {
+        return *this = Checked(rhs);
+    }
+    
+    // prefix
+    const Checked& operator++()
+    {
+        if (m_value == std::numeric_limits<T>::max())
+            this->overflowed();
+        m_value++;
+        return *this;
+    }
+    
+    const Checked& operator--()
+    {
+        if (m_value == std::numeric_limits<T>::min())
+            this->overflowed();
+        m_value--;
+        return *this;
+    }
+    
+    // postfix operators
+    const Checked operator++(int)
+    {
+        if (m_value == std::numeric_limits<T>::max())
+            this->overflowed();
+        return Checked(m_value++);
+    }
+    
+    const Checked operator--(int)
+    {
+        if (m_value == std::numeric_limits<T>::min())
+            this->overflowed();
+        return Checked(m_value--);
+    }
+    
+    // Boolean operators
+    bool operator!() const
+    {
+        if (this->hasOverflowed())
+            CRASH();
+        return !m_value;
+    }
+
+    typedef void* (Checked::*UnspecifiedBoolType);
+    operator UnspecifiedBoolType*() const
+    {
+        if (this->hasOverflowed())
+            CRASH();
+        return (m_value) ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;
+    }
+
+    // Value accessors. unsafeGet() will crash if there's been an overflow.
+    T unsafeGet() const
+    {
+        if (this->hasOverflowed())
+            CRASH();
+        return m_value;
+    }
+    
+    bool safeGet(T& value) const WARN_UNUSED_RETURN
+    {
+        value = m_value;
+        return this->hasOverflowed();
+    }
+
+    // Mutating assignment
+    template <typename U> const Checked operator+=(U rhs)
+    {
+        if (!safeAdd(m_value, rhs, m_value))
+            this->overflowed();
+        return *this;
+    }
+
+    template <typename U> const Checked operator-=(U rhs)
+    {
+        if (!safeSub(m_value, rhs, m_value))
+            this->overflowed();
+        return *this;
+    }
+
+    template <typename U> const Checked operator*=(U rhs)
+    {
+        if (!safeMultiply(m_value, rhs, m_value))
+            this->overflowed();
+        return *this;
+    }
+
+    const Checked operator*=(double rhs)
+    {
+        double result = rhs * m_value;
+        // Handle +/- infinity and NaN
+        if (!(std::numeric_limits<T>::min() <= result && std::numeric_limits<T>::max() >= result))
+            this->overflowed();
+        m_value = (T)result;
+        return *this;
+    }
+
+    const Checked operator*=(float rhs)
+    {
+        return *this *= (double)rhs;
+    }
+    
+    template <typename U, typename V> const Checked operator+=(Checked<U, V> rhs)
+    {
+        if (rhs.hasOverflowed())
+            this->overflowed();
+        return *this += rhs.m_value;
+    }
+
+    template <typename U, typename V> const Checked operator-=(Checked<U, V> rhs)
+    {
+        if (rhs.hasOverflowed())
+            this->overflowed();
+        return *this -= rhs.m_value;
+    }
+
+    template <typename U, typename V> const Checked operator*=(Checked<U, V> rhs)
+    {
+        if (rhs.hasOverflowed())
+            this->overflowed();
+        return *this *= rhs.m_value;
+    }
+
+    // Equality comparisons
+    template <typename V> bool operator==(Checked<T, V> rhs)
+    {
+        return unsafeGet() == rhs.unsafeGet();
+    }
+
+    template <typename U> bool operator==(U rhs)
+    {
+        if (this->hasOverflowed())
+            this->overflowed();
+        return safeEquals(m_value, rhs);
+    }
+    
+    template <typename U, typename V> const Checked operator==(Checked<U, V> rhs)
+    {
+        return unsafeGet() == Checked(rhs.unsafeGet());
+    }
+
+    template <typename U> bool operator!=(U rhs)
+    {
+        return !(*this == rhs);
+    }
+
+private:
+    // Disallow implicit conversion of floating point to integer types
+    Checked(float);
+    Checked(double);
+    void operator=(float);
+    void operator=(double);
+    void operator+=(float);
+    void operator+=(double);
+    void operator-=(float);
+    void operator-=(double);
+    T m_value;
+};
+
+template <typename U, typename V, typename OverflowHandler> static inline Checked<typename Result<U, V>::ResultType, OverflowHandler> operator+(Checked<U, OverflowHandler> lhs, Checked<V, OverflowHandler> rhs)
+{
+    U x = 0;
+    V y = 0;
+    bool overflowed = lhs.safeGet(x) || rhs.safeGet(y);
+    typename Result<U, V>::ResultType result = 0;
+    overflowed |= !safeAdd(x, y, result);
+    if (overflowed)
+        return ResultOverflowed;
+    return result;
+}
+
+template <typename U, typename V, typename OverflowHandler> static inline Checked<typename Result<U, V>::ResultType, OverflowHandler> operator-(Checked<U, OverflowHandler> lhs, Checked<V, OverflowHandler> rhs)
+{
+    U x = 0;
+    V y = 0;
+    bool overflowed = lhs.safeGet(x) || rhs.safeGet(y);
+    typename Result<U, V>::ResultType result = 0;
+    overflowed |= !safeSub(x, y, result);
+    if (overflowed)
+        return ResultOverflowed;
+    return result;
+}
+
+template <typename U, typename V, typename OverflowHandler> static inline Checked<typename Result<U, V>::ResultType, OverflowHandler> operator*(Checked<U, OverflowHandler> lhs, Checked<V, OverflowHandler> rhs)
+{
+    U x = 0;
+    V y = 0;
+    bool overflowed = lhs.safeGet(x) || rhs.safeGet(y);
+    typename Result<U, V>::ResultType result = 0;
+    overflowed |= !safeMultiply(x, y, result);
+    if (overflowed)
+        return ResultOverflowed;
+    return result;
+}
+
+template <typename U, typename V, typename OverflowHandler> static inline Checked<typename Result<U, V>::ResultType, OverflowHandler> operator+(Checked<U, OverflowHandler> lhs, V rhs)
+{
+    return lhs + Checked<V, OverflowHandler>(rhs);
+}
+
+template <typename U, typename V, typename OverflowHandler> static inline Checked<typename Result<U, V>::ResultType, OverflowHandler> operator-(Checked<U, OverflowHandler> lhs, V rhs)
+{
+    return lhs - Checked<V, OverflowHandler>(rhs);
+}
+
+template <typename U, typename V, typename OverflowHandler> static inline Checked<typename Result<U, V>::ResultType, OverflowHandler> operator*(Checked<U, OverflowHandler> lhs, V rhs)
+{
+    return lhs * Checked<V, OverflowHandler>(rhs);
+}
+
+template <typename U, typename V, typename OverflowHandler> static inline Checked<typename Result<U, V>::ResultType, OverflowHandler> operator+(U lhs, Checked<V, OverflowHandler> rhs)
+{
+    return Checked<U, OverflowHandler>(lhs) + rhs;
+}
+
+template <typename U, typename V, typename OverflowHandler> static inline Checked<typename Result<U, V>::ResultType, OverflowHandler> operator-(U lhs, Checked<V, OverflowHandler> rhs)
+{
+    return Checked<U, OverflowHandler>(lhs) - rhs;
+}
+
+template <typename U, typename V, typename OverflowHandler> static inline Checked<typename Result<U, V>::ResultType, OverflowHandler> operator*(U lhs, Checked<V, OverflowHandler> rhs)
+{
+    return Checked<U, OverflowHandler>(lhs) * rhs;
+}
+
+}
+
+using WTF::Checked;
+using WTF::RecordOverflow;
+
+#endif
diff --git a/Source/WTF/wtf/CheckedBoolean.h b/Source/WTF/wtf/CheckedBoolean.h
new file mode 100644
index 0000000..c65c70e
--- /dev/null
+++ b/Source/WTF/wtf/CheckedBoolean.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 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. ``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
+ * 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 CheckedBoolean_h
+#define CheckedBoolean_h
+
+#include <wtf/Assertions.h>
+
+class CheckedBoolean {
+public:
+    CheckedBoolean(bool value)
+    : m_value(value)
+#if !ASSERT_DISABLED
+    , m_checked(false)
+#endif
+    {
+    }
+    
+    ~CheckedBoolean()
+    {
+        ASSERT(m_checked);
+    }
+    
+    operator bool()
+    {
+#if !ASSERT_DISABLED
+        m_checked = true;
+#endif
+        return m_value;
+    }
+    
+private:
+    bool m_value;
+#if !ASSERT_DISABLED
+    bool m_checked;
+#endif
+};
+
+#endif
diff --git a/Source/WTF/wtf/Compiler.h b/Source/WTF/wtf/Compiler.h
new file mode 100644
index 0000000..a9ef419
--- /dev/null
+++ b/Source/WTF/wtf/Compiler.h
@@ -0,0 +1,284 @@
+/*
+ * Copyright (C) 2011, 2012 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. ``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
+ * 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_Compiler_h
+#define WTF_Compiler_h
+
+/* COMPILER() - the compiler being used to build the project */
+#define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE  && WTF_COMPILER_##WTF_FEATURE)
+
+/* COMPILER_SUPPORTS() - whether the compiler being used to build the project supports the given feature. */
+#define COMPILER_SUPPORTS(WTF_COMPILER_FEATURE) (defined WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE  && WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE)
+
+/* COMPILER_QUIRK() - whether the compiler being used to build the project requires a given quirk. */
+#define COMPILER_QUIRK(WTF_COMPILER_QUIRK) (defined WTF_COMPILER_QUIRK_##WTF_COMPILER_QUIRK  && WTF_COMPILER_QUIRK_##WTF_COMPILER_QUIRK)
+
+/* ==== COMPILER() - the compiler being used to build the project ==== */
+
+/* COMPILER(CLANG) - Clang  */
+#if defined(__clang__)
+#define WTF_COMPILER_CLANG 1
+
+#ifndef __has_extension
+#define __has_extension __has_feature /* Compatibility with older versions of clang */
+#endif
+
+#define CLANG_PRAGMA(PRAGMA) _Pragma(PRAGMA)
+
+/* Specific compiler features */
+#define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES __has_extension(cxx_variadic_templates)
+
+/* There is a bug in clang that comes with Xcode 4.2 where AtomicStrings can't be implicitly converted to Strings
+   in the presence of move constructors and/or move assignment operators. This bug has been fixed in Xcode 4.3 clang, so we
+   check for both cxx_rvalue_references as well as the unrelated cxx_nonstatic_member_init feature which we know was added in 4.3 */
+#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES __has_extension(cxx_rvalue_references) && __has_extension(cxx_nonstatic_member_init)
+
+#define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS __has_extension(cxx_deleted_functions)
+#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr)
+#define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explicit_conversions)
+#define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks)
+#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert)
+#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL __has_extension(cxx_override_control)
+#define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_extension(has_trivial_destructor)
+
+#endif
+
+#ifndef CLANG_PRAGMA
+#define CLANG_PRAGMA(PRAGMA)
+#endif
+
+/* COMPILER(MSVC) - Microsoft Visual C++ */
+/* COMPILER(MSVC7_OR_LOWER) - Microsoft Visual C++ 2003 or lower*/
+/* COMPILER(MSVC9_OR_LOWER) - Microsoft Visual C++ 2008 or lower*/
+#if defined(_MSC_VER)
+#define WTF_COMPILER_MSVC 1
+#if _MSC_VER < 1400
+#define WTF_COMPILER_MSVC7_OR_LOWER 1
+#elif _MSC_VER < 1600
+#define WTF_COMPILER_MSVC9_OR_LOWER 1
+#endif
+
+/* Specific compiler features */
+#if !COMPILER(CLANG) && _MSC_VER >= 1600
+#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
+#endif
+
+#if !COMPILER(CLANG)
+#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
+#define WTF_COMPILER_QUIRK_FINAL_IS_CALLED_SEALED 1
+#endif
+
+#endif
+
+/* COMPILER(RVCT) - ARM RealView Compilation Tools */
+/* COMPILER(RVCT4_OR_GREATER) - ARM RealView Compilation Tools 4.0 or greater */
+#if defined(__CC_ARM) || defined(__ARMCC__)
+#define WTF_COMPILER_RVCT 1
+#define RVCT_VERSION_AT_LEAST(major, minor, patch, build) (__ARMCC_VERSION >= (major * 100000 + minor * 10000 + patch * 1000 + build))
+#else
+/* Define this for !RVCT compilers, just so we can write things like RVCT_VERSION_AT_LEAST(3, 0, 0, 0). */
+#define RVCT_VERSION_AT_LEAST(major, minor, patch, build) 0
+#endif
+
+/* COMPILER(GCCE) - GNU Compiler Collection for Embedded */
+#if defined(__GCCE__)
+#define WTF_COMPILER_GCCE 1
+#define GCCE_VERSION (__GCCE__ * 10000 + __GCCE_MINOR__ * 100 + __GCCE_PATCHLEVEL__)
+#define GCCE_VERSION_AT_LEAST(major, minor, patch) (GCCE_VERSION >= (major * 10000 + minor * 100 + patch))
+#endif
+
+/* COMPILER(GCC) - GNU Compiler Collection */
+/* --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__)
+#define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
+#else
+/* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */
+#define GCC_VERSION_AT_LEAST(major, minor, patch) 0
+#endif
+
+/* Specific compiler features */
+#if COMPILER(GCC) && !COMPILER(CLANG)
+#if GCC_VERSION_AT_LEAST(4, 7, 0) && defined(__cplusplus) && __cplusplus >= 201103L
+#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 1
+#define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS 1
+#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
+#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
+#define WTF_COMPILER_QUIRK_GCC11_GLOBAL_ISINF_ISNAN 1
+
+#elif GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1 
+#define WTF_COMPILER_QUIRK_GCC11_GLOBAL_ISINF_ISNAN 1
+#endif
+
+#endif
+
+/* COMPILER(MINGW) - MinGW GCC */
+/* COMPILER(MINGW64) - mingw-w64 GCC - only used as additional check to exclude mingw.org specific functions */
+#if defined(__MINGW32__)
+#define WTF_COMPILER_MINGW 1
+#include <_mingw.h> /* private MinGW header */
+    #if defined(__MINGW64_VERSION_MAJOR) /* best way to check for mingw-w64 vs mingw.org */
+        #define WTF_COMPILER_MINGW64 1
+    #endif /* __MINGW64_VERSION_MAJOR */
+#endif /* __MINGW32__ */
+
+/* COMPILER(INTEL) - Intel C++ Compiler */
+#if defined(__INTEL_COMPILER)
+#define WTF_COMPILER_INTEL 1
+#endif
+
+/* COMPILER(SUNCC) */
+#if defined(__SUNPRO_CC) || defined(__SUNPRO_C)
+#define WTF_COMPILER_SUNCC 1
+#endif
+
+/* ==== Compiler features ==== */
+
+
+/* ALWAYS_INLINE */
+
+#ifndef ALWAYS_INLINE
+#if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW)
+#define ALWAYS_INLINE inline __attribute__((__always_inline__))
+#elif (COMPILER(MSVC) || COMPILER(RVCT)) && defined(NDEBUG)
+#define ALWAYS_INLINE __forceinline
+#else
+#define ALWAYS_INLINE inline
+#endif
+#endif
+
+
+/* NEVER_INLINE */
+
+#ifndef NEVER_INLINE
+#if COMPILER(GCC)
+#define NEVER_INLINE __attribute__((__noinline__))
+#elif COMPILER(RVCT)
+#define NEVER_INLINE __declspec(noinline)
+#else
+#define NEVER_INLINE
+#endif
+#endif
+
+
+/* UNLIKELY */
+
+#ifndef UNLIKELY
+#if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && defined(__GNUC__))
+#define UNLIKELY(x) __builtin_expect((x), 0)
+#else
+#define UNLIKELY(x) (x)
+#endif
+#endif
+
+
+/* LIKELY */
+
+#ifndef LIKELY
+#if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && defined(__GNUC__))
+#define LIKELY(x) __builtin_expect((x), 1)
+#else
+#define LIKELY(x) (x)
+#endif
+#endif
+
+
+/* NO_RETURN */
+
+
+#ifndef NO_RETURN
+#if COMPILER(GCC)
+#define NO_RETURN __attribute((__noreturn__))
+#elif COMPILER(MSVC) || COMPILER(RVCT)
+#define NO_RETURN __declspec(noreturn)
+#else
+#define NO_RETURN
+#endif
+#endif
+
+
+/* NO_RETURN_WITH_VALUE */
+
+#ifndef NO_RETURN_WITH_VALUE
+#if !COMPILER(MSVC)
+#define NO_RETURN_WITH_VALUE NO_RETURN
+#else
+#define NO_RETURN_WITH_VALUE
+#endif
+#endif
+
+
+/* WARN_UNUSED_RETURN */
+
+#if COMPILER(GCC)
+#define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
+#else
+#define WARN_UNUSED_RETURN
+#endif
+
+/* OVERRIDE and FINAL */
+
+#if COMPILER_SUPPORTS(CXX_OVERRIDE_CONTROL)
+#define OVERRIDE override
+
+#if COMPILER_QUIRK(FINAL_IS_CALLED_SEALED)
+#define FINAL sealed
+#else
+#define FINAL final
+#endif
+
+#else
+#define OVERRIDE
+#define FINAL
+#endif
+
+/* REFERENCED_FROM_ASM */
+
+#ifndef REFERENCED_FROM_ASM
+#if COMPILER(GCC)
+#define REFERENCED_FROM_ASM __attribute__((used))
+#else
+#define REFERENCED_FROM_ASM
+#endif
+#endif
+
+/* OBJC_CLASS */
+
+#ifndef OBJC_CLASS
+#ifdef __OBJC__
+#define OBJC_CLASS @class
+#else
+#define OBJC_CLASS class
+#endif
+#endif
+
+/* ABI */
+#if defined(__ARM_EABI__) || defined(__EABI__)
+#define WTF_COMPILER_SUPPORTS_EABI 1
+#endif
+
+#endif /* WTF_Compiler_h */
diff --git a/Source/WTF/wtf/Complex.h b/Source/WTF/wtf/Complex.h
new file mode 100644
index 0000000..40fe56a
--- /dev/null
+++ b/Source/WTF/wtf/Complex.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 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:
+ *
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef WTF_Complex_h
+#define WTF_Complex_h
+
+#include <complex>
+#include <wtf/MathExtras.h>
+
+namespace WTF {
+
+typedef std::complex<double> Complex;
+
+inline Complex complexFromMagnitudePhase(double magnitude, double phase)
+{
+    return Complex(magnitude * cos(phase), magnitude * sin(phase));
+}
+
+} // namespace WTF
+
+using WTF::Complex;
+using WTF::complexFromMagnitudePhase;
+
+#endif // WTF_Complex_h
diff --git a/Source/WTF/wtf/CryptographicallyRandomNumber.cpp b/Source/WTF/wtf/CryptographicallyRandomNumber.cpp
new file mode 100644
index 0000000..e896d6f
--- /dev/null
+++ b/Source/WTF/wtf/CryptographicallyRandomNumber.cpp
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 1996, David Mazieres <dm@uun.org>
+ * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Arc4 random number generator for OpenBSD.
+ *
+ * This code is derived from section 17.1 of Applied Cryptography,
+ * second edition, which describes a stream cipher allegedly
+ * compatible with RSA Labs "RC4" cipher (the actual description of
+ * which is a trade secret).  The same algorithm is used as a stream
+ * cipher called "arcfour" in Tatu Ylonen's ssh package.
+ *
+ * RC4 is a registered trademark of RSA Laboratories.
+ */
+
+#include "config.h"
+#include "CryptographicallyRandomNumber.h"
+
+#include "OSRandomSource.h"
+#include "StdLibExtras.h"
+#include "ThreadingPrimitives.h"
+
+namespace WTF {
+
+#if USE(OS_RANDOMNESS)
+
+namespace {
+
+class ARC4Stream {
+public:
+    ARC4Stream();
+
+    uint8_t i;
+    uint8_t j;
+    uint8_t s[256];
+};
+
+class ARC4RandomNumberGenerator {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    ARC4RandomNumberGenerator();
+
+    uint32_t randomNumber();
+    void randomValues(void* buffer, size_t length);
+
+private:
+    inline void addRandomData(unsigned char *data, int length);
+    void stir();
+    void stirIfNeeded();
+    inline uint8_t getByte();
+    inline uint32_t getWord();
+
+    ARC4Stream m_stream;
+    int m_count;
+    Mutex m_mutex;
+};
+
+ARC4Stream::ARC4Stream()
+{
+    for (int n = 0; n < 256; n++)
+        s[n] = n;
+    i = 0;
+    j = 0;
+}
+
+ARC4RandomNumberGenerator::ARC4RandomNumberGenerator()
+    : m_count(0)
+{
+}
+
+void ARC4RandomNumberGenerator::addRandomData(unsigned char* data, int length)
+{
+    m_stream.i--;
+    for (int n = 0; n < 256; n++) {
+        m_stream.i++;
+        uint8_t si = m_stream.s[m_stream.i];
+        m_stream.j += si + data[n % length];
+        m_stream.s[m_stream.i] = m_stream.s[m_stream.j];
+        m_stream.s[m_stream.j] = si;
+    }
+    m_stream.j = m_stream.i;
+}
+
+void ARC4RandomNumberGenerator::stir()
+{
+    unsigned char randomness[128];
+    size_t length = sizeof(randomness);
+    cryptographicallyRandomValuesFromOS(randomness, length);
+    addRandomData(randomness, length);
+
+    // Discard early keystream, as per recommendations in:
+    // http://www.wisdom.weizmann.ac.il/~itsik/RC4/Papers/Rc4_ksa.ps
+    for (int i = 0; i < 256; i++)
+        getByte();
+    m_count = 1600000;
+}
+
+void ARC4RandomNumberGenerator::stirIfNeeded()
+{
+    if (m_count <= 0)
+        stir();
+}
+
+uint8_t ARC4RandomNumberGenerator::getByte()
+{
+    m_stream.i++;
+    uint8_t si = m_stream.s[m_stream.i];
+    m_stream.j += si;
+    uint8_t sj = m_stream.s[m_stream.j];
+    m_stream.s[m_stream.i] = sj;
+    m_stream.s[m_stream.j] = si;
+    return (m_stream.s[(si + sj) & 0xff]);
+}
+
+uint32_t ARC4RandomNumberGenerator::getWord()
+{
+    uint32_t val;
+    val = getByte() << 24;
+    val |= getByte() << 16;
+    val |= getByte() << 8;
+    val |= getByte();
+    return val;
+}
+
+uint32_t ARC4RandomNumberGenerator::randomNumber()
+{
+    MutexLocker locker(m_mutex);
+
+    m_count -= 4;
+    stirIfNeeded();
+    return getWord();
+}
+
+void ARC4RandomNumberGenerator::randomValues(void* buffer, size_t length)
+{
+    MutexLocker locker(m_mutex);
+
+    unsigned char* result = reinterpret_cast<unsigned char*>(buffer);
+    stirIfNeeded();
+    while (length--) {
+        m_count--;
+        stirIfNeeded();
+        result[length] = getByte();
+    }
+}
+
+ARC4RandomNumberGenerator& sharedRandomNumberGenerator()
+{
+    DEFINE_STATIC_LOCAL(ARC4RandomNumberGenerator, randomNumberGenerator, ());
+    return randomNumberGenerator;
+}
+
+}
+
+uint32_t cryptographicallyRandomNumber()
+{
+    return sharedRandomNumberGenerator().randomNumber();
+}
+
+void cryptographicallyRandomValues(void* buffer, size_t length)
+{
+    sharedRandomNumberGenerator().randomValues(buffer, length);
+}
+
+#endif
+
+}
diff --git a/Source/WTF/wtf/CryptographicallyRandomNumber.h b/Source/WTF/wtf/CryptographicallyRandomNumber.h
new file mode 100644
index 0000000..2262b6c
--- /dev/null
+++ b/Source/WTF/wtf/CryptographicallyRandomNumber.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2008 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
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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_CryptographicallyRandomNumber_h
+#define WTF_CryptographicallyRandomNumber_h
+
+#include <stdint.h>
+
+namespace WTF {
+
+#if USE(OS_RANDOMNESS)
+WTF_EXPORT_PRIVATE uint32_t cryptographicallyRandomNumber();
+WTF_EXPORT_PRIVATE void cryptographicallyRandomValues(void* buffer, size_t length);
+#endif
+
+}
+
+#if USE(OS_RANDOMNESS)
+using WTF::cryptographicallyRandomNumber;
+using WTF::cryptographicallyRandomValues;
+#endif
+
+#endif
diff --git a/Source/WTF/wtf/CurrentTime.cpp b/Source/WTF/wtf/CurrentTime.cpp
new file mode 100644
index 0000000..8d16a4e
--- /dev/null
+++ b/Source/WTF/wtf/CurrentTime.cpp
@@ -0,0 +1,338 @@
+/*
+ * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Google 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 are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 "CurrentTime.h"
+
+#if PLATFORM(MAC)
+#include <mach/mach_time.h>
+#include <sys/time.h>
+#elif OS(WINDOWS)
+
+// Windows is first since we want to use hires timers, despite USE(CF)
+// being defined.
+// If defined, WIN32_LEAN_AND_MEAN disables timeBeginPeriod/timeEndPeriod.
+#undef WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <math.h>
+#include <stdint.h>
+#include <time.h>
+
+#elif PLATFORM(WX)
+#include <wx/datetime.h>
+#elif PLATFORM(EFL)
+#include <Ecore.h>
+#else
+#include <sys/time.h>
+#endif
+
+#if PLATFORM(GTK)
+#include <glib.h>
+#endif
+
+#if PLATFORM(QT)
+#include <QElapsedTimer>
+#endif
+
+namespace WTF {
+
+#if !PLATFORM(CHROMIUM)
+
+#if OS(WINDOWS)
+
+// Number of 100 nanosecond between January 1, 1601 and January 1, 1970.
+static const ULONGLONG epochBias = 116444736000000000ULL;
+static const double hundredsOfNanosecondsPerMillisecond = 10000;
+
+static double lowResUTCTime()
+{
+    FILETIME fileTime;
+
+#if OS(WINCE)
+    GetCurrentFT(&fileTime);
+#else
+    GetSystemTimeAsFileTime(&fileTime);
+#endif
+
+    // As per Windows documentation for FILETIME, copy the resulting FILETIME structure to a
+    // ULARGE_INTEGER structure using memcpy (using memcpy instead of direct assignment can
+    // prevent alignment faults on 64-bit Windows).
+
+    ULARGE_INTEGER dateTime;
+    memcpy(&dateTime, &fileTime, sizeof(dateTime));
+
+    // Windows file times are in 100s of nanoseconds.
+    return (dateTime.QuadPart - epochBias) / hundredsOfNanosecondsPerMillisecond;
+}
+
+#if USE(QUERY_PERFORMANCE_COUNTER)
+
+static LARGE_INTEGER qpcFrequency;
+static bool syncedTime;
+
+static double highResUpTime()
+{
+    // We use QPC, but only after sanity checking its result, due to bugs:
+    // http://support.microsoft.com/kb/274323
+    // http://support.microsoft.com/kb/895980
+    // http://msdn.microsoft.com/en-us/library/ms644904.aspx ("...you can get different results on different processors due to bugs in the basic input/output system (BIOS) or the hardware abstraction layer (HAL)."
+
+    static LARGE_INTEGER qpcLast;
+    static DWORD tickCountLast;
+    static bool inited;
+
+    LARGE_INTEGER qpc;
+    QueryPerformanceCounter(&qpc);
+    DWORD tickCount = GetTickCount();
+
+    if (inited) {
+        __int64 qpcElapsed = ((qpc.QuadPart - qpcLast.QuadPart) * 1000) / qpcFrequency.QuadPart;
+        __int64 tickCountElapsed;
+        if (tickCount >= tickCountLast)
+            tickCountElapsed = (tickCount - tickCountLast);
+        else {
+#if COMPILER(MINGW)
+            __int64 tickCountLarge = tickCount + 0x100000000ULL;
+#else
+            __int64 tickCountLarge = tickCount + 0x100000000I64;
+#endif
+            tickCountElapsed = tickCountLarge - tickCountLast;
+        }
+
+        // force a re-sync if QueryPerformanceCounter differs from GetTickCount by more than 500ms.
+        // (500ms value is from http://support.microsoft.com/kb/274323)
+        __int64 diff = tickCountElapsed - qpcElapsed;
+        if (diff > 500 || diff < -500)
+            syncedTime = false;
+    } else
+        inited = true;
+
+    qpcLast = qpc;
+    tickCountLast = tickCount;
+
+    return (1000.0 * qpc.QuadPart) / static_cast<double>(qpcFrequency.QuadPart);
+}
+
+static bool qpcAvailable()
+{
+    static bool available;
+    static bool checked;
+
+    if (checked)
+        return available;
+
+    available = QueryPerformanceFrequency(&qpcFrequency);
+    checked = true;
+    return available;
+}
+
+double currentTime()
+{
+    // Use a combination of ftime and QueryPerformanceCounter.
+    // ftime returns the information we want, but doesn't have sufficient resolution.
+    // QueryPerformanceCounter has high resolution, but is only usable to measure time intervals.
+    // To combine them, we call ftime and QueryPerformanceCounter initially. Later calls will use QueryPerformanceCounter
+    // by itself, adding the delta to the saved ftime.  We periodically re-sync to correct for drift.
+    static double syncLowResUTCTime;
+    static double syncHighResUpTime;
+    static double lastUTCTime;
+
+    double lowResTime = lowResUTCTime();
+
+    if (!qpcAvailable())
+        return lowResTime / 1000.0;
+
+    double highResTime = highResUpTime();
+
+    if (!syncedTime) {
+        timeBeginPeriod(1); // increase time resolution around low-res time getter
+        syncLowResUTCTime = lowResTime = lowResUTCTime();
+        timeEndPeriod(1); // restore time resolution
+        syncHighResUpTime = highResTime;
+        syncedTime = true;
+    }
+
+    double highResElapsed = highResTime - syncHighResUpTime;
+    double utc = syncLowResUTCTime + highResElapsed;
+
+    // force a clock re-sync if we've drifted
+    double lowResElapsed = lowResTime - syncLowResUTCTime;
+    const double maximumAllowedDriftMsec = 15.625 * 2.0; // 2x the typical low-res accuracy
+    if (fabs(highResElapsed - lowResElapsed) > maximumAllowedDriftMsec)
+        syncedTime = false;
+
+    // make sure time doesn't run backwards (only correct if difference is < 2 seconds, since DST or clock changes could occur)
+    const double backwardTimeLimit = 2000.0;
+    if (utc < lastUTCTime && (lastUTCTime - utc) < backwardTimeLimit)
+        return lastUTCTime / 1000.0;
+    lastUTCTime = utc;
+    return utc / 1000.0;
+}
+
+#else
+
+double currentTime()
+{
+    static bool init = false;
+    static double lastTime;
+    static DWORD lastTickCount;
+    if (!init) {
+        lastTime = lowResUTCTime();
+        lastTickCount = GetTickCount();
+        init = true;
+        return lastTime;
+    }
+
+    DWORD tickCountNow = GetTickCount();
+    DWORD elapsed = tickCountNow - lastTickCount;
+    double timeNow = lastTime + (double)elapsed / 1000.;
+    if (elapsed >= 0x7FFFFFFF) {
+        lastTime = timeNow;
+        lastTickCount = tickCountNow;
+    }
+    return timeNow;
+}
+
+#endif // USE(QUERY_PERFORMANCE_COUNTER)
+
+#elif PLATFORM(GTK)
+
+// Note: GTK on Windows will pick up the PLATFORM(WIN) implementation above which provides
+// better accuracy compared with Windows implementation of g_get_current_time:
+// (http://www.google.com/codesearch/p?hl=en#HHnNRjks1t0/glib-2.5.2/glib/gmain.c&q=g_get_current_time).
+// Non-Windows GTK builds could use gettimeofday() directly but for the sake of consistency lets use GTK function.
+double currentTime()
+{
+    GTimeVal now;
+    g_get_current_time(&now);
+    return static_cast<double>(now.tv_sec) + static_cast<double>(now.tv_usec / 1000000.0);
+}
+
+#elif PLATFORM(WX)
+
+double currentTime()
+{
+    wxDateTime now = wxDateTime::UNow();
+    return (double)now.GetTicks() + (double)(now.GetMillisecond() / 1000.0);
+}
+
+#elif PLATFORM(EFL)
+
+double currentTime()
+{
+    return ecore_time_unix_get();
+}
+
+#elif OS(QNX)
+
+double currentTime()
+{
+    struct timespec time;
+    if (clock_gettime(CLOCK_REALTIME, &time))
+        CRASH();
+    return time.tv_sec + time.tv_nsec / 1.0e9;
+}
+
+#else
+
+double currentTime()
+{
+    struct timeval now;
+    gettimeofday(&now, 0);
+    return now.tv_sec + now.tv_usec / 1000000.0;
+}
+
+#endif
+
+#if PLATFORM(MAC)
+
+double monotonicallyIncreasingTime()
+{
+    // Based on listing #2 from Apple QA 1398.
+    static mach_timebase_info_data_t timebaseInfo;
+    if (!timebaseInfo.denom) {
+        kern_return_t kr = mach_timebase_info(&timebaseInfo);
+        ASSERT_UNUSED(kr, kr == KERN_SUCCESS);
+    }
+    return (mach_absolute_time() * timebaseInfo.numer) / (1.0e9 * timebaseInfo.denom);
+}
+
+#elif PLATFORM(EFL)
+
+double monotonicallyIncreasingTime()
+{
+    return ecore_time_get();
+}
+
+#elif PLATFORM(GTK)
+
+double monotonicallyIncreasingTime()
+{
+    return static_cast<double>(g_get_monotonic_time() / 1000000.0);
+}
+
+#elif PLATFORM(QT)
+
+double monotonicallyIncreasingTime()
+{
+    ASSERT(QElapsedTimer::isMonotonic());
+    static QElapsedTimer timer;
+    return timer.nsecsElapsed() / 1.0e9;
+}
+
+#elif OS(QNX)
+
+double monotonicallyIncreasingTime()
+{
+    struct timespec time;
+    if (clock_gettime(CLOCK_MONOTONIC, &time))
+        CRASH();
+    return time.tv_sec + time.tv_nsec / 1.0e9;
+}
+
+#else
+
+double monotonicallyIncreasingTime()
+{
+    static double lastTime = 0;
+    double currentTimeNow = currentTime();
+    if (currentTimeNow < lastTime)
+        return lastTime;
+    lastTime = currentTimeNow;
+    return currentTimeNow;
+}
+
+#endif
+
+#endif // !PLATFORM(CHROMIUM)
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/CurrentTime.h b/Source/WTF/wtf/CurrentTime.h
new file mode 100644
index 0000000..e938731
--- /dev/null
+++ b/Source/WTF/wtf/CurrentTime.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2008 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.
+ *     * 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.
+ *     * 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 CurrentTime_h
+#define CurrentTime_h
+
+#include <time.h>
+
+namespace WTF {
+
+// Returns the current UTC time in seconds, counted from January 1, 1970.
+// Precision varies depending on platform but is usually as good or better
+// than a millisecond.
+WTF_EXPORT_PRIVATE double currentTime();
+
+// Same thing, in milliseconds.
+inline double currentTimeMS()
+{
+    return currentTime() * 1000.0;
+}
+
+// Provides a monotonically increasing time in seconds since an arbitrary point in the past.
+// On unsupported platforms, this function only guarantees the result will be non-decreasing.
+WTF_EXPORT_PRIVATE double monotonicallyIncreasingTime();
+
+} // namespace WTF
+
+using WTF::currentTime;
+using WTF::currentTimeMS;
+using WTF::monotonicallyIncreasingTime;
+
+#endif // CurrentTime_h
diff --git a/Source/WTF/wtf/DataLog.cpp b/Source/WTF/wtf/DataLog.cpp
new file mode 100644
index 0000000..74b678d
--- /dev/null
+++ b/Source/WTF/wtf/DataLog.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2012 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. ``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
+ * 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 "DataLog.h"
+#include <stdarg.h>
+#include <wtf/Threading.h>
+
+#define DATA_LOG_TO_FILE 0
+
+// Uncomment to force logging to the given file regardless of what the environment variable says.
+// #define DATA_LOG_FILENAME "/tmp/WTFLog.txt"
+
+namespace WTF {
+
+#if DATA_LOG_TO_FILE
+static FILE* file;
+
+static void initializeLogFileOnce()
+{
+#ifdef DATA_LOG_FILENAME
+    const char* filename = DATA_LOG_FILENAME;
+#else
+    const char* filename = getenv("WTF_DATA_LOG_FILENAME");
+#endif
+    if (filename) {
+        file = fopen(filename, "w");
+        if (!file)
+            fprintf(stderr, "Warning: Could not open log file %s for writing.\n", filename);
+    }
+    if (!file)
+        file = stderr;
+    
+    setvbuf(file, 0, _IONBF, 0); // Prefer unbuffered output, so that we get a full log upon crash or deadlock.
+}
+
+#if OS(DARWIN)
+static pthread_once_t initializeLogFileOnceKey = PTHREAD_ONCE_INIT;
+#endif
+
+static void initializeLogFile()
+{
+#if OS(DARWIN)
+    pthread_once(&initializeLogFileOnceKey, initializeLogFileOnce);
+#else
+    if (!file)
+        initializeLogFileOnce();
+#endif
+}
+
+FILE* dataFile()
+{
+    initializeLogFile();
+    return file;
+}
+#else // DATA_LOG_TO_FILE
+FILE* dataFile()
+{
+    return stderr;
+}
+#endif // DATA_LOG_TO_FILE
+
+void dataLogV(const char* format, va_list argList)
+{
+    vfprintf(dataFile(), format, argList);
+}
+
+void dataLog(const char* format, ...)
+{
+    va_list argList;
+    va_start(argList, format);
+    dataLogV(format, argList);
+    va_end(argList);
+}
+
+void dataLogString(const char* str)
+{
+    fputs(str, dataFile());
+}
+
+} // namespace WTF
+
diff --git a/Source/WTF/wtf/DataLog.h b/Source/WTF/wtf/DataLog.h
new file mode 100644
index 0000000..11e1d3e
--- /dev/null
+++ b/Source/WTF/wtf/DataLog.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 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. ``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
+ * 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 DataLog_h
+#define DataLog_h
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <wtf/Platform.h>
+#include <wtf/StdLibExtras.h>
+
+namespace WTF {
+
+WTF_EXPORT_PRIVATE FILE* dataFile();
+
+WTF_EXPORT_PRIVATE void dataLogV(const char* format, va_list) WTF_ATTRIBUTE_PRINTF(1, 0);
+WTF_EXPORT_PRIVATE void dataLog(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
+WTF_EXPORT_PRIVATE void dataLogString(const char*);
+
+} // namespace WTF
+
+using WTF::dataLog;
+using WTF::dataLogString;
+
+#endif // DataLog_h
+
diff --git a/Source/WTF/wtf/DateMath.cpp b/Source/WTF/wtf/DateMath.cpp
new file mode 100644
index 0000000..6d0e5d7
--- /dev/null
+++ b/Source/WTF/wtf/DateMath.cpp
@@ -0,0 +1,1098 @@
+/*
+ * 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.
+ * Copyright (C) 2010 &yet, LLC. (nate@andyet.net)
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+
+ * Copyright 2006-2008 the V8 project authors. 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.
+ *     * 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.
+ *     * 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 "DateMath.h"
+
+#include "Assertions.h"
+#include "ASCIICType.h"
+#include "CurrentTime.h"
+#include "MathExtras.h"
+#include "StdLibExtras.h"
+#include "StringExtras.h"
+
+#include <algorithm>
+#include <limits.h>
+#include <limits>
+#include <stdint.h>
+#include <time.h>
+#include <wtf/text/StringBuilder.h>
+
+#if OS(WINDOWS)
+#include <windows.h>
+#endif
+
+#if HAVE(ERRNO_H)
+#include <errno.h>
+#endif
+
+#if HAVE(SYS_TIME_H)
+#include <sys/time.h>
+#endif
+
+#if HAVE(SYS_TIMEB_H)
+#include <sys/timeb.h>
+#endif
+
+#if OS(QNX)
+// qnx6 defines timegm in nbutil.h
+#include <nbutil.h>
+#endif
+
+using namespace WTF;
+
+namespace WTF {
+
+/* Constants */
+
+static const double minutesPerDay = 24.0 * 60.0;
+static const double secondsPerDay = 24.0 * 60.0 * 60.0;
+static const double secondsPerYear = 24.0 * 60.0 * 60.0 * 365.0;
+
+static const double usecPerSec = 1000000.0;
+
+static const double maxUnixTime = 2145859200.0; // 12/31/2037
+// ECMAScript asks not to support for a date of which total
+// millisecond value is larger than the following value.
+// See 15.9.1.14 of ECMA-262 5th edition.
+static const double maxECMAScriptTime = 8.64E15;
+
+// Day of year for the first day of each month, where index 0 is January, and day 0 is January 1.
+// First for non-leap years, then for leap years.
+static const int firstDayOfMonth[2][12] = {
+    {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
+    {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}
+};
+
+#if !OS(WINCE)
+static inline void getLocalTime(const time_t* localTime, struct tm* localTM)
+{
+#if COMPILER(MSVC7_OR_LOWER) || COMPILER(MINGW)
+    *localTM = *localtime(localTime);
+#elif COMPILER(MSVC)
+    localtime_s(localTM, localTime);
+#else
+    localtime_r(localTime, localTM);
+#endif
+}
+#endif
+
+bool isLeapYear(int year)
+{
+    if (year % 4 != 0)
+        return false;
+    if (year % 400 == 0)
+        return true;
+    if (year % 100 == 0)
+        return false;
+    return true;
+}
+
+static inline int daysInYear(int year)
+{
+    return 365 + isLeapYear(year);
+}
+
+static inline double daysFrom1970ToYear(int year)
+{
+    // The Gregorian Calendar rules for leap years:
+    // Every fourth year is a leap year.  2004, 2008, and 2012 are leap years.
+    // However, every hundredth year is not a leap year.  1900 and 2100 are not leap years.
+    // Every four hundred years, there's a leap year after all.  2000 and 2400 are leap years.
+
+    static const int leapDaysBefore1971By4Rule = 1970 / 4;
+    static const int excludedLeapDaysBefore1971By100Rule = 1970 / 100;
+    static const int leapDaysBefore1971By400Rule = 1970 / 400;
+
+    const double yearMinusOne = year - 1;
+    const double yearsToAddBy4Rule = floor(yearMinusOne / 4.0) - leapDaysBefore1971By4Rule;
+    const double yearsToExcludeBy100Rule = floor(yearMinusOne / 100.0) - excludedLeapDaysBefore1971By100Rule;
+    const double yearsToAddBy400Rule = floor(yearMinusOne / 400.0) - leapDaysBefore1971By400Rule;
+
+    return 365.0 * (year - 1970) + yearsToAddBy4Rule - yearsToExcludeBy100Rule + yearsToAddBy400Rule;
+}
+
+double msToDays(double ms)
+{
+    return floor(ms / msPerDay);
+}
+
+static String twoDigitStringFromNumber(int number)
+{
+    ASSERT(number >= 0 && number < 100);
+    if (number > 9)
+        return String::number(number);
+    return makeString("0", String::number(number));
+}
+
+int msToYear(double ms)
+{
+    int approxYear = static_cast<int>(floor(ms / (msPerDay * 365.2425)) + 1970);
+    double msFromApproxYearTo1970 = msPerDay * daysFrom1970ToYear(approxYear);
+    if (msFromApproxYearTo1970 > ms)
+        return approxYear - 1;
+    if (msFromApproxYearTo1970 + msPerDay * daysInYear(approxYear) <= ms)
+        return approxYear + 1;
+    return approxYear;
+}
+
+int dayInYear(double ms, int year)
+{
+    return static_cast<int>(msToDays(ms) - daysFrom1970ToYear(year));
+}
+
+static inline double msToMilliseconds(double ms)
+{
+    double result = fmod(ms, msPerDay);
+    if (result < 0)
+        result += msPerDay;
+    return result;
+}
+
+int msToMinutes(double ms)
+{
+    double result = fmod(floor(ms / msPerMinute), minutesPerHour);
+    if (result < 0)
+        result += minutesPerHour;
+    return static_cast<int>(result);
+}
+
+int msToHours(double ms)
+{
+    double result = fmod(floor(ms/msPerHour), hoursPerDay);
+    if (result < 0)
+        result += hoursPerDay;
+    return static_cast<int>(result);
+}
+
+int monthFromDayInYear(int dayInYear, bool leapYear)
+{
+    const int d = dayInYear;
+    int step;
+
+    if (d < (step = 31))
+        return 0;
+    step += (leapYear ? 29 : 28);
+    if (d < step)
+        return 1;
+    if (d < (step += 31))
+        return 2;
+    if (d < (step += 30))
+        return 3;
+    if (d < (step += 31))
+        return 4;
+    if (d < (step += 30))
+        return 5;
+    if (d < (step += 31))
+        return 6;
+    if (d < (step += 31))
+        return 7;
+    if (d < (step += 30))
+        return 8;
+    if (d < (step += 31))
+        return 9;
+    if (d < (step += 30))
+        return 10;
+    return 11;
+}
+
+static inline bool checkMonth(int dayInYear, int& startDayOfThisMonth, int& startDayOfNextMonth, int daysInThisMonth)
+{
+    startDayOfThisMonth = startDayOfNextMonth;
+    startDayOfNextMonth += daysInThisMonth;
+    return (dayInYear <= startDayOfNextMonth);
+}
+
+int dayInMonthFromDayInYear(int dayInYear, bool leapYear)
+{
+    const int d = dayInYear;
+    int step;
+    int next = 30;
+
+    if (d <= next)
+        return d + 1;
+    const int daysInFeb = (leapYear ? 29 : 28);
+    if (checkMonth(d, step, next, daysInFeb))
+        return d - step;
+    if (checkMonth(d, step, next, 31))
+        return d - step;
+    if (checkMonth(d, step, next, 30))
+        return d - step;
+    if (checkMonth(d, step, next, 31))
+        return d - step;
+    if (checkMonth(d, step, next, 30))
+        return d - step;
+    if (checkMonth(d, step, next, 31))
+        return d - step;
+    if (checkMonth(d, step, next, 31))
+        return d - step;
+    if (checkMonth(d, step, next, 30))
+        return d - step;
+    if (checkMonth(d, step, next, 31))
+        return d - step;
+    if (checkMonth(d, step, next, 30))
+        return d - step;
+    step = next;
+    return d - step;
+}
+
+int dayInYear(int year, int month, int day)
+{
+    return firstDayOfMonth[isLeapYear(year)][month] + day - 1;
+}
+
+double dateToDaysFrom1970(int year, int month, int day)
+{
+    year += month / 12;
+
+    month %= 12;
+    if (month < 0) {
+        month += 12;
+        --year;
+    }
+
+    double yearday = floor(daysFrom1970ToYear(year));
+    ASSERT((year >= 1970 && yearday >= 0) || (year < 1970 && yearday < 0));
+    return yearday + dayInYear(year, month, day);
+}
+
+// There is a hard limit at 2038 that we currently do not have a workaround
+// for (rdar://problem/5052975).
+static inline int maximumYearForDST()
+{
+    return 2037;
+}
+
+static inline int minimumYearForDST()
+{
+    // Because of the 2038 issue (see maximumYearForDST) if the current year is
+    // greater than the max year minus 27 (2010), we want to use the max year
+    // minus 27 instead, to ensure there is a range of 28 years that all years
+    // can map to.
+    return std::min(msToYear(jsCurrentTime()), maximumYearForDST() - 27) ;
+}
+
+/*
+ * Find an equivalent year for the one given, where equivalence is deterined by
+ * the two years having the same leapness and the first day of the year, falling
+ * on the same day of the week.
+ *
+ * This function returns a year between this current year and 2037, however this
+ * function will potentially return incorrect results if the current year is after
+ * 2010, (rdar://problem/5052975), if the year passed in is before 1900 or after
+ * 2100, (rdar://problem/5055038).
+ */
+int equivalentYearForDST(int year)
+{
+    // It is ok if the cached year is not the current year as long as the rules
+    // for DST did not change between the two years; if they did the app would need
+    // to be restarted.
+    static int minYear = minimumYearForDST();
+    int maxYear = maximumYearForDST();
+
+    int difference;
+    if (year > maxYear)
+        difference = minYear - year;
+    else if (year < minYear)
+        difference = maxYear - year;
+    else
+        return year;
+
+    int quotient = difference / 28;
+    int product = (quotient) * 28;
+
+    year += product;
+    ASSERT((year >= minYear && year <= maxYear) || (product - year == static_cast<int>(std::numeric_limits<double>::quiet_NaN())));
+    return year;
+}
+
+int32_t calculateUTCOffset()
+{
+#if OS(WINDOWS)
+    TIME_ZONE_INFORMATION timeZoneInformation;
+    GetTimeZoneInformation(&timeZoneInformation);
+    int32_t bias = timeZoneInformation.Bias + timeZoneInformation.StandardBias;
+    return -bias * 60 * 1000;
+#else
+    time_t localTime = time(0);
+    tm localt;
+    getLocalTime(&localTime, &localt);
+
+    // Get the difference between this time zone and UTC on the 1st of January of this year.
+    localt.tm_sec = 0;
+    localt.tm_min = 0;
+    localt.tm_hour = 0;
+    localt.tm_mday = 1;
+    localt.tm_mon = 0;
+    // Not setting localt.tm_year!
+    localt.tm_wday = 0;
+    localt.tm_yday = 0;
+    localt.tm_isdst = 0;
+#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);
+#endif
+
+    return static_cast<int32_t>(utcOffset * 1000);
+#endif
+}
+
+/*
+ * Get the DST offset for the time passed in.
+ */
+static double calculateDSTOffsetSimple(double localTimeSeconds, double utcOffset)
+{
+#if OS(WINCE)
+    UNUSED_PARAM(localTimeSeconds);
+    UNUSED_PARAM(utcOffset);
+    return 0;
+#else
+    if (localTimeSeconds > maxUnixTime)
+        localTimeSeconds = maxUnixTime;
+    else if (localTimeSeconds < 0) // Go ahead a day to make localtime work (does not work with 0)
+        localTimeSeconds += secondsPerDay;
+
+    //input is UTC so we have to shift back to local time to determine DST thus the + getUTCOffset()
+    double offsetTime = (localTimeSeconds * msPerSecond) + utcOffset;
+
+    // Offset from UTC but doesn't include DST obviously
+    int offsetHour =  msToHours(offsetTime);
+    int offsetMinute =  msToMinutes(offsetTime);
+
+    // FIXME: time_t has a potential problem in 2038
+    time_t localTime = static_cast<time_t>(localTimeSeconds);
+
+    tm localTM;
+    getLocalTime(&localTime, &localTM);
+
+    double diff = ((localTM.tm_hour - offsetHour) * secondsPerHour) + ((localTM.tm_min - offsetMinute) * 60);
+
+    if (diff < 0)
+        diff += secondsPerDay;
+
+    return (diff * msPerSecond);
+#endif
+}
+
+// Get the DST offset, given a time in UTC
+double calculateDSTOffset(double ms, double utcOffset)
+{
+    // On Mac OS X, the call to localtime (see calculateDSTOffsetSimple) will return historically accurate
+    // DST information (e.g. New Zealand did not have DST from 1946 to 1974) however the JavaScript
+    // standard explicitly dictates that historical information should not be considered when
+    // determining DST. For this reason we shift away from years that localtime can handle but would
+    // return historically accurate information.
+    int year = msToYear(ms);
+    int equivalentYear = equivalentYearForDST(year);
+    if (year != equivalentYear) {
+        bool leapYear = isLeapYear(year);
+        int dayInYearLocal = dayInYear(ms, year);
+        int dayInMonth = dayInMonthFromDayInYear(dayInYearLocal, leapYear);
+        int month = monthFromDayInYear(dayInYearLocal, leapYear);
+        double day = dateToDaysFrom1970(equivalentYear, month, dayInMonth);
+        ms = (day * msPerDay) + msToMilliseconds(ms);
+    }
+
+    return calculateDSTOffsetSimple(ms / msPerSecond, utcOffset);
+}
+
+void initializeDates()
+{
+#if !ASSERT_DISABLED
+    static bool alreadyInitialized;
+    ASSERT(!alreadyInitialized);
+    alreadyInitialized = true;
+#endif
+
+    equivalentYearForDST(2000); // Need to call once to initialize a static used in this function.
+}
+
+static inline double ymdhmsToSeconds(long year, int mon, int day, int hour, int minute, double second)
+{
+    double days = (day - 32075)
+        + floor(1461 * (year + 4800.0 + (mon - 14) / 12) / 4)
+        + 367 * (mon - 2 - (mon - 14) / 12 * 12) / 12
+        - floor(3 * ((year + 4900.0 + (mon - 14) / 12) / 100) / 4)
+        - 2440588;
+    return ((days * hoursPerDay + hour) * minutesPerHour + minute) * secondsPerMinute + second;
+}
+
+// We follow the recommendation of RFC 2822 to consider all
+// obsolete time zones not listed here equivalent to "-0000".
+static const struct KnownZone {
+#if !OS(WINDOWS)
+    const
+#endif
+        char tzName[4];
+    int tzOffset;
+} known_zones[] = {
+    { "UT", 0 },
+    { "GMT", 0 },
+    { "EST", -300 },
+    { "EDT", -240 },
+    { "CST", -360 },
+    { "CDT", -300 },
+    { "MST", -420 },
+    { "MDT", -360 },
+    { "PST", -480 },
+    { "PDT", -420 }
+};
+
+inline static void skipSpacesAndComments(const char*& s)
+{
+    int nesting = 0;
+    char ch;
+    while ((ch = *s)) {
+        if (!isASCIISpace(ch)) {
+            if (ch == '(')
+                nesting++;
+            else if (ch == ')' && nesting > 0)
+                nesting--;
+            else if (nesting == 0)
+                break;
+        }
+        s++;
+    }
+}
+
+// returns 0-11 (Jan-Dec); -1 on failure
+static int findMonth(const char* monthStr)
+{
+    ASSERT(monthStr);
+    char needle[4];
+    for (int i = 0; i < 3; ++i) {
+        if (!*monthStr)
+            return -1;
+        needle[i] = static_cast<char>(toASCIILower(*monthStr++));
+    }
+    needle[3] = '\0';
+    const char *haystack = "janfebmaraprmayjunjulaugsepoctnovdec";
+    const char *str = strstr(haystack, needle);
+    if (str) {
+        int position = static_cast<int>(str - haystack);
+        if (position % 3 == 0)
+            return position / 3;
+    }
+    return -1;
+}
+
+static bool parseLong(const char* string, char** stopPosition, int base, long* result)
+{
+    *result = strtol(string, stopPosition, base);
+    // Avoid the use of errno as it is not available on Windows CE
+    if (string == *stopPosition || *result == LONG_MIN || *result == LONG_MAX)
+        return false;
+    return true;
+}
+
+// Parses a date with the format YYYY[-MM[-DD]].
+// Year parsing is lenient, allows any number of digits, and +/-.
+// Returns 0 if a parse error occurs, else returns the end of the parsed portion of the string.
+static char* parseES5DatePortion(const char* currentPosition, long& year, long& month, long& day)
+{
+    char* postParsePosition;
+
+    // This is a bit more lenient on the year string than ES5 specifies:
+    // instead of restricting to 4 digits (or 6 digits with mandatory +/-),
+    // it accepts any integer value. Consider this an implementation fallback.
+    if (!parseLong(currentPosition, &postParsePosition, 10, &year))
+        return 0;
+
+    // Check for presence of -MM portion.
+    if (*postParsePosition != '-')
+        return postParsePosition;
+    currentPosition = postParsePosition + 1;
+    
+    if (!isASCIIDigit(*currentPosition))
+        return 0;
+    if (!parseLong(currentPosition, &postParsePosition, 10, &month))
+        return 0;
+    if ((postParsePosition - currentPosition) != 2)
+        return 0;
+
+    // Check for presence of -DD portion.
+    if (*postParsePosition != '-')
+        return postParsePosition;
+    currentPosition = postParsePosition + 1;
+    
+    if (!isASCIIDigit(*currentPosition))
+        return 0;
+    if (!parseLong(currentPosition, &postParsePosition, 10, &day))
+        return 0;
+    if ((postParsePosition - currentPosition) != 2)
+        return 0;
+    return postParsePosition;
+}
+
+// Parses a time with the format HH:mm[:ss[.sss]][Z|(+|-)00:00].
+// Fractional seconds parsing is lenient, allows any number of digits.
+// Returns 0 if a parse error occurs, else returns the end of the parsed portion of the string.
+static char* parseES5TimePortion(char* currentPosition, long& hours, long& minutes, double& seconds, long& timeZoneSeconds)
+{
+    char* postParsePosition;
+    if (!isASCIIDigit(*currentPosition))
+        return 0;
+    if (!parseLong(currentPosition, &postParsePosition, 10, &hours))
+        return 0;
+    if (*postParsePosition != ':' || (postParsePosition - currentPosition) != 2)
+        return 0;
+    currentPosition = postParsePosition + 1;
+    
+    if (!isASCIIDigit(*currentPosition))
+        return 0;
+    if (!parseLong(currentPosition, &postParsePosition, 10, &minutes))
+        return 0;
+    if ((postParsePosition - currentPosition) != 2)
+        return 0;
+    currentPosition = postParsePosition;
+
+    // Seconds are optional.
+    if (*currentPosition == ':') {
+        ++currentPosition;
+    
+        long intSeconds;
+        if (!isASCIIDigit(*currentPosition))
+            return 0;
+        if (!parseLong(currentPosition, &postParsePosition, 10, &intSeconds))
+            return 0;
+        if ((postParsePosition - currentPosition) != 2)
+            return 0;
+        seconds = intSeconds;
+        if (*postParsePosition == '.') {
+            currentPosition = postParsePosition + 1;
+            
+            // In ECMA-262-5 it's a bit unclear if '.' can be present without milliseconds, but
+            // a reasonable interpretation guided by the given examples and RFC 3339 says "no".
+            // We check the next character to avoid reading +/- timezone hours after an invalid decimal.
+            if (!isASCIIDigit(*currentPosition))
+                return 0;
+            
+            // We are more lenient than ES5 by accepting more or less than 3 fraction digits.
+            long fracSeconds;
+            if (!parseLong(currentPosition, &postParsePosition, 10, &fracSeconds))
+                return 0;
+            
+            long numFracDigits = postParsePosition - currentPosition;
+            seconds += fracSeconds * pow(10.0, static_cast<double>(-numFracDigits));
+        }
+        currentPosition = postParsePosition;
+    }
+
+    if (*currentPosition == 'Z')
+        return currentPosition + 1;
+
+    bool tzNegative;
+    if (*currentPosition == '-')
+        tzNegative = true;
+    else if (*currentPosition == '+')
+        tzNegative = false;
+    else
+        return currentPosition; // no timezone
+    ++currentPosition;
+    
+    long tzHours;
+    long tzHoursAbs;
+    long tzMinutes;
+    
+    if (!isASCIIDigit(*currentPosition))
+        return 0;
+    if (!parseLong(currentPosition, &postParsePosition, 10, &tzHours))
+        return 0;
+    if (*postParsePosition != ':' || (postParsePosition - currentPosition) != 2)
+        return 0;
+    tzHoursAbs = labs(tzHours);
+    currentPosition = postParsePosition + 1;
+    
+    if (!isASCIIDigit(*currentPosition))
+        return 0;
+    if (!parseLong(currentPosition, &postParsePosition, 10, &tzMinutes))
+        return 0;
+    if ((postParsePosition - currentPosition) != 2)
+        return 0;
+    currentPosition = postParsePosition;
+    
+    if (tzHoursAbs > 24)
+        return 0;
+    if (tzMinutes < 0 || tzMinutes > 59)
+        return 0;
+    
+    timeZoneSeconds = 60 * (tzMinutes + (60 * tzHoursAbs));
+    if (tzNegative)
+        timeZoneSeconds = -timeZoneSeconds;
+
+    return currentPosition;
+}
+
+double parseES5DateFromNullTerminatedCharacters(const char* dateString)
+{
+    // This parses a date of the form defined in ECMA-262-5, section 15.9.1.15
+    // (similar to RFC 3339 / ISO 8601: YYYY-MM-DDTHH:mm:ss[.sss]Z).
+    // In most cases it is intentionally strict (e.g. correct field widths, no stray whitespace).
+    
+    static const long daysPerMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+    
+    // The year must be present, but the other fields may be omitted - see ES5.1 15.9.1.15.
+    long year = 0;
+    long month = 1;
+    long day = 1;
+    long hours = 0;
+    long minutes = 0;
+    double seconds = 0;
+    long timeZoneSeconds = 0;
+
+    // Parse the date YYYY[-MM[-DD]]
+    char* currentPosition = parseES5DatePortion(dateString, year, month, day);
+    if (!currentPosition)
+        return std::numeric_limits<double>::quiet_NaN();
+    // Look for a time portion.
+    if (*currentPosition == 'T') {
+        // Parse the time HH:mm[:ss[.sss]][Z|(+|-)00:00]
+        currentPosition = parseES5TimePortion(currentPosition + 1, hours, minutes, seconds, timeZoneSeconds);
+        if (!currentPosition)
+            return std::numeric_limits<double>::quiet_NaN();
+    }
+    // Check that we have parsed all characters in the string.
+    if (*currentPosition)
+        return std::numeric_limits<double>::quiet_NaN();
+
+    // A few of these checks could be done inline above, but since many of them are interrelated
+    // we would be sacrificing readability to "optimize" the (presumably less common) failure path.
+    if (month < 1 || month > 12)
+        return std::numeric_limits<double>::quiet_NaN();
+    if (day < 1 || day > daysPerMonth[month - 1])
+        return std::numeric_limits<double>::quiet_NaN();
+    if (month == 2 && day > 28 && !isLeapYear(year))
+        return std::numeric_limits<double>::quiet_NaN();
+    if (hours < 0 || hours > 24)
+        return std::numeric_limits<double>::quiet_NaN();
+    if (hours == 24 && (minutes || seconds))
+        return std::numeric_limits<double>::quiet_NaN();
+    if (minutes < 0 || minutes > 59)
+        return std::numeric_limits<double>::quiet_NaN();
+    if (seconds < 0 || seconds >= 61)
+        return std::numeric_limits<double>::quiet_NaN();
+    if (seconds > 60) {
+        // Discard leap seconds by clamping to the end of a minute.
+        seconds = 60;
+    }
+        
+    double dateSeconds = ymdhmsToSeconds(year, month, day, hours, minutes, seconds) - timeZoneSeconds;
+    return dateSeconds * msPerSecond;
+}
+
+// Odd case where 'exec' is allowed to be 0, to accomodate a caller in WebCore.
+double parseDateFromNullTerminatedCharacters(const char* dateString, bool& haveTZ, int& offset)
+{
+    haveTZ = false;
+    offset = 0;
+
+    // This parses a date in the form:
+    //     Tuesday, 09-Nov-99 23:12:40 GMT
+    // or
+    //     Sat, 01-Jan-2000 08:00:00 GMT
+    // or
+    //     Sat, 01 Jan 2000 08:00:00 GMT
+    // or
+    //     01 Jan 99 22:00 +0100    (exceptions in rfc822/rfc2822)
+    // ### non RFC formats, added for Javascript:
+    //     [Wednesday] January 09 1999 23:12:40 GMT
+    //     [Wednesday] January 09 23:12:40 GMT 1999
+    //
+    // We ignore the weekday.
+     
+    // Skip leading space
+    skipSpacesAndComments(dateString);
+
+    long month = -1;
+    const char *wordStart = dateString;
+    // Check contents of first words if not number
+    while (*dateString && !isASCIIDigit(*dateString)) {
+        if (isASCIISpace(*dateString) || *dateString == '(') {
+            if (dateString - wordStart >= 3)
+                month = findMonth(wordStart);
+            skipSpacesAndComments(dateString);
+            wordStart = dateString;
+        } else
+           dateString++;
+    }
+
+    // Missing delimiter between month and day (like "January29")?
+    if (month == -1 && wordStart != dateString)
+        month = findMonth(wordStart);
+
+    skipSpacesAndComments(dateString);
+
+    if (!*dateString)
+        return std::numeric_limits<double>::quiet_NaN();
+
+    // ' 09-Nov-99 23:12:40 GMT'
+    char* newPosStr;
+    long day;
+    if (!parseLong(dateString, &newPosStr, 10, &day))
+        return std::numeric_limits<double>::quiet_NaN();
+    dateString = newPosStr;
+
+    if (!*dateString)
+        return std::numeric_limits<double>::quiet_NaN();
+
+    if (day < 0)
+        return std::numeric_limits<double>::quiet_NaN();
+
+    long year = 0;
+    if (day > 31) {
+        // ### where is the boundary and what happens below?
+        if (*dateString != '/')
+            return std::numeric_limits<double>::quiet_NaN();
+        // looks like a YYYY/MM/DD date
+        if (!*++dateString)
+            return std::numeric_limits<double>::quiet_NaN();
+        year = day;
+        if (!parseLong(dateString, &newPosStr, 10, &month))
+            return std::numeric_limits<double>::quiet_NaN();
+        month -= 1;
+        dateString = newPosStr;
+        if (*dateString++ != '/' || !*dateString)
+            return std::numeric_limits<double>::quiet_NaN();
+        if (!parseLong(dateString, &newPosStr, 10, &day))
+            return std::numeric_limits<double>::quiet_NaN();
+        dateString = newPosStr;
+    } else if (*dateString == '/' && month == -1) {
+        dateString++;
+        // This looks like a MM/DD/YYYY date, not an RFC date.
+        month = day - 1; // 0-based
+        if (!parseLong(dateString, &newPosStr, 10, &day))
+            return std::numeric_limits<double>::quiet_NaN();
+        if (day < 1 || day > 31)
+            return std::numeric_limits<double>::quiet_NaN();
+        dateString = newPosStr;
+        if (*dateString == '/')
+            dateString++;
+        if (!*dateString)
+            return std::numeric_limits<double>::quiet_NaN();
+     } else {
+        if (*dateString == '-')
+            dateString++;
+
+        skipSpacesAndComments(dateString);
+
+        if (*dateString == ',')
+            dateString++;
+
+        if (month == -1) { // not found yet
+            month = findMonth(dateString);
+            if (month == -1)
+                return std::numeric_limits<double>::quiet_NaN();
+
+            while (*dateString && *dateString != '-' && *dateString != ',' && !isASCIISpace(*dateString))
+                dateString++;
+
+            if (!*dateString)
+                return std::numeric_limits<double>::quiet_NaN();
+
+            // '-99 23:12:40 GMT'
+            if (*dateString != '-' && *dateString != '/' && *dateString != ',' && !isASCIISpace(*dateString))
+                return std::numeric_limits<double>::quiet_NaN();
+            dateString++;
+        }
+    }
+
+    if (month < 0 || month > 11)
+        return std::numeric_limits<double>::quiet_NaN();
+
+    // '99 23:12:40 GMT'
+    if (year <= 0 && *dateString) {
+        if (!parseLong(dateString, &newPosStr, 10, &year))
+            return std::numeric_limits<double>::quiet_NaN();
+    }
+
+    // Don't fail if the time is missing.
+    long hour = 0;
+    long minute = 0;
+    long second = 0;
+    if (!*newPosStr)
+        dateString = newPosStr;
+    else {
+        // ' 23:12:40 GMT'
+        if (!(isASCIISpace(*newPosStr) || *newPosStr == ',')) {
+            if (*newPosStr != ':')
+                return std::numeric_limits<double>::quiet_NaN();
+            // There was no year; the number was the hour.
+            year = -1;
+        } else {
+            // in the normal case (we parsed the year), advance to the next number
+            dateString = ++newPosStr;
+            skipSpacesAndComments(dateString);
+        }
+
+        parseLong(dateString, &newPosStr, 10, &hour);
+        // Do not check for errno here since we want to continue
+        // even if errno was set becasue we are still looking
+        // for the timezone!
+
+        // Read a number? If not, this might be a timezone name.
+        if (newPosStr != dateString) {
+            dateString = newPosStr;
+
+            if (hour < 0 || hour > 23)
+                return std::numeric_limits<double>::quiet_NaN();
+
+            if (!*dateString)
+                return std::numeric_limits<double>::quiet_NaN();
+
+            // ':12:40 GMT'
+            if (*dateString++ != ':')
+                return std::numeric_limits<double>::quiet_NaN();
+
+            if (!parseLong(dateString, &newPosStr, 10, &minute))
+                return std::numeric_limits<double>::quiet_NaN();
+            dateString = newPosStr;
+
+            if (minute < 0 || minute > 59)
+                return std::numeric_limits<double>::quiet_NaN();
+
+            // ':40 GMT'
+            if (*dateString && *dateString != ':' && !isASCIISpace(*dateString))
+                return std::numeric_limits<double>::quiet_NaN();
+
+            // seconds are optional in rfc822 + rfc2822
+            if (*dateString ==':') {
+                dateString++;
+
+                if (!parseLong(dateString, &newPosStr, 10, &second))
+                    return std::numeric_limits<double>::quiet_NaN();
+                dateString = newPosStr;
+
+                if (second < 0 || second > 59)
+                    return std::numeric_limits<double>::quiet_NaN();
+            }
+
+            skipSpacesAndComments(dateString);
+
+            if (strncasecmp(dateString, "AM", 2) == 0) {
+                if (hour > 12)
+                    return std::numeric_limits<double>::quiet_NaN();
+                if (hour == 12)
+                    hour = 0;
+                dateString += 2;
+                skipSpacesAndComments(dateString);
+            } else if (strncasecmp(dateString, "PM", 2) == 0) {
+                if (hour > 12)
+                    return std::numeric_limits<double>::quiet_NaN();
+                if (hour != 12)
+                    hour += 12;
+                dateString += 2;
+                skipSpacesAndComments(dateString);
+            }
+        }
+    }
+    
+    // The year may be after the time but before the time zone.
+    if (isASCIIDigit(*dateString) && year == -1) {
+        if (!parseLong(dateString, &newPosStr, 10, &year))
+            return std::numeric_limits<double>::quiet_NaN();
+        dateString = newPosStr;
+        skipSpacesAndComments(dateString);
+    }
+
+    // Don't fail if the time zone is missing. 
+    // Some websites omit the time zone (4275206).
+    if (*dateString) {
+        if (strncasecmp(dateString, "GMT", 3) == 0 || strncasecmp(dateString, "UTC", 3) == 0) {
+            dateString += 3;
+            haveTZ = true;
+        }
+
+        if (*dateString == '+' || *dateString == '-') {
+            long o;
+            if (!parseLong(dateString, &newPosStr, 10, &o))
+                return std::numeric_limits<double>::quiet_NaN();
+            dateString = newPosStr;
+
+            if (o < -9959 || o > 9959)
+                return std::numeric_limits<double>::quiet_NaN();
+
+            int sgn = (o < 0) ? -1 : 1;
+            o = labs(o);
+            if (*dateString != ':') {
+                if (o >= 24)
+                    offset = ((o / 100) * 60 + (o % 100)) * sgn;
+                else
+                    offset = o * 60 * sgn;
+            } else { // GMT+05:00
+                ++dateString; // skip the ':'
+                long o2;
+                if (!parseLong(dateString, &newPosStr, 10, &o2))
+                    return std::numeric_limits<double>::quiet_NaN();
+                dateString = newPosStr;
+                offset = (o * 60 + o2) * sgn;
+            }
+            haveTZ = true;
+        } else {
+            for (size_t i = 0; i < WTF_ARRAY_LENGTH(known_zones); ++i) {
+                if (0 == strncasecmp(dateString, known_zones[i].tzName, strlen(known_zones[i].tzName))) {
+                    offset = known_zones[i].tzOffset;
+                    dateString += strlen(known_zones[i].tzName);
+                    haveTZ = true;
+                    break;
+                }
+            }
+        }
+    }
+
+    skipSpacesAndComments(dateString);
+
+    if (*dateString && year == -1) {
+        if (!parseLong(dateString, &newPosStr, 10, &year))
+            return std::numeric_limits<double>::quiet_NaN();
+        dateString = newPosStr;
+        skipSpacesAndComments(dateString);
+    }
+
+    // Trailing garbage
+    if (*dateString)
+        return std::numeric_limits<double>::quiet_NaN();
+
+    // Y2K: Handle 2 digit years.
+    if (year >= 0 && year < 100) {
+        if (year < 50)
+            year += 2000;
+        else
+            year += 1900;
+    }
+    
+    return ymdhmsToSeconds(year, month + 1, day, hour, minute, second) * msPerSecond;
+}
+
+double parseDateFromNullTerminatedCharacters(const char* dateString)
+{
+    bool haveTZ;
+    int offset;
+    double ms = parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset);
+    if (isnan(ms))
+        return std::numeric_limits<double>::quiet_NaN();
+
+    // fall back to local timezone
+    if (!haveTZ) {
+        double utcOffset = calculateUTCOffset();
+        double dstOffset = calculateDSTOffset(ms, utcOffset);
+        offset = static_cast<int>((utcOffset + dstOffset) / msPerMinute);
+    }
+    return ms - (offset * msPerMinute);
+}
+
+double timeClip(double t)
+{
+    if (!isfinite(t))
+        return std::numeric_limits<double>::quiet_NaN();
+    if (fabs(t) > maxECMAScriptTime)
+        return std::numeric_limits<double>::quiet_NaN();
+    return trunc(t);
+}
+
+// See http://tools.ietf.org/html/rfc2822#section-3.3 for more information.
+String makeRFC2822DateString(unsigned dayOfWeek, unsigned day, unsigned month, unsigned year, unsigned hours, unsigned minutes, unsigned seconds, int utcOffset)
+{
+    StringBuilder stringBuilder;
+    stringBuilder.append(weekdayName[dayOfWeek]);
+    stringBuilder.appendLiteral(", ");
+    stringBuilder.appendNumber(day);
+    stringBuilder.append(' ');
+    stringBuilder.append(monthName[month]);
+    stringBuilder.append(' ');
+    stringBuilder.appendNumber(year);
+    stringBuilder.append(' ');
+
+    stringBuilder.append(twoDigitStringFromNumber(hours));
+    stringBuilder.append(':');
+    stringBuilder.append(twoDigitStringFromNumber(minutes));
+    stringBuilder.append(':');
+    stringBuilder.append(twoDigitStringFromNumber(seconds));
+    stringBuilder.append(' ');
+
+    stringBuilder.append(utcOffset > 0 ? '+' : '-');
+    int absoluteUTCOffset = abs(utcOffset);
+    stringBuilder.append(twoDigitStringFromNumber(absoluteUTCOffset / 60));
+    stringBuilder.append(twoDigitStringFromNumber(absoluteUTCOffset % 60));
+
+    return stringBuilder.toString();
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/DateMath.h b/Source/WTF/wtf/DateMath.h
new file mode 100644
index 0000000..8b8e282
--- /dev/null
+++ b/Source/WTF/wtf/DateMath.h
@@ -0,0 +1,129 @@
+/*
+ * 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) 2010 Research In Motion Limited. All rights reserved.
+ *
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ */
+
+#ifndef DateMath_h
+#define DateMath_h
+
+#include <math.h>
+#include <stdint.h>
+#include <string.h>
+#include <time.h>
+#include <wtf/CurrentTime.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnArrayPtr.h>
+#include <wtf/PassOwnArrayPtr.h>
+#include <wtf/text/WTFString.h>
+#include <wtf/UnusedParam.h>
+
+namespace WTF {
+
+void initializeDates();
+int equivalentYearForDST(int year);
+
+// Not really math related, but this is currently the only shared place to put these.
+double parseES5DateFromNullTerminatedCharacters(const char* dateString);
+WTF_EXPORT_PRIVATE double parseDateFromNullTerminatedCharacters(const char* dateString);
+double parseDateFromNullTerminatedCharacters(const char* dateString, bool& haveTZ, int& offset);
+double timeClip(double);
+// dayOfWeek: [0, 6] 0 being Monday, day: [1, 31], month: [0, 11], year: ex: 2011, hours: [0, 23], minutes: [0, 59], seconds: [0, 59], utcOffset: [-720,720]. 
+String makeRFC2822DateString(unsigned dayOfWeek, unsigned day, unsigned month, unsigned year, unsigned hours, unsigned minutes, unsigned seconds, int utcOffset);
+
+inline double jsCurrentTime()
+{
+    // JavaScript doesn't recognize fractions of a millisecond.
+    return floor(WTF::currentTimeMS());
+}
+
+const char* const weekdayName[7] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
+const char* const monthName[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+const char* const monthFullName[12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
+
+const double hoursPerDay = 24.0;
+const double minutesPerHour = 60.0;
+const double secondsPerHour = 60.0 * 60.0;
+const double secondsPerMinute = 60.0;
+const double msPerSecond = 1000.0;
+const double msPerMinute = 60.0 * 1000.0;
+const double msPerHour = 60.0 * 60.0 * 1000.0;
+const double msPerDay = 24.0 * 60.0 * 60.0 * 1000.0;
+const double msPerMonth = 2592000000.0;
+
+bool isLeapYear(int year);
+
+// Returns the number of days from 1970-01-01 to the specified date.
+WTF_EXPORT_PRIVATE double dateToDaysFrom1970(int year, int month, int day);
+WTF_EXPORT_PRIVATE int msToYear(double ms);
+double msToDays(double ms);
+int msToMinutes(double ms);
+int msToHours(double ms);
+int dayInYear(int year, int month, int day);
+WTF_EXPORT_PRIVATE int dayInYear(double ms, int year);
+WTF_EXPORT_PRIVATE int monthFromDayInYear(int dayInYear, bool leapYear);
+WTF_EXPORT_PRIVATE int dayInMonthFromDayInYear(int dayInYear, bool leapYear);
+
+// Returns offset milliseconds for UTC and DST.
+WTF_EXPORT_PRIVATE int32_t calculateUTCOffset();
+WTF_EXPORT_PRIVATE double calculateDSTOffset(double ms, double utcOffset);
+
+} // namespace WTF
+
+using WTF::isLeapYear;
+using WTF::dateToDaysFrom1970;
+using WTF::dayInMonthFromDayInYear;
+using WTF::dayInYear;
+using WTF::minutesPerHour;
+using WTF::monthFromDayInYear;
+using WTF::msPerDay;
+using WTF::msPerHour;
+using WTF::msPerMinute;
+using WTF::msPerSecond;
+using WTF::msToYear;
+using WTF::msToDays;
+using WTF::msToMinutes;
+using WTF::msToHours;
+using WTF::secondsPerMinute;
+using WTF::parseDateFromNullTerminatedCharacters;
+using WTF::makeRFC2822DateString;
+using WTF::calculateUTCOffset;
+using WTF::calculateDSTOffset;
+
+#endif // DateMath_h
diff --git a/Source/WTF/wtf/DecimalNumber.cpp b/Source/WTF/wtf/DecimalNumber.cpp
new file mode 100644
index 0000000..d33a5ae
--- /dev/null
+++ b/Source/WTF/wtf/DecimalNumber.cpp
@@ -0,0 +1,199 @@
+/*
+ * 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. ``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
+ * 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 "DecimalNumber.h"
+#include <math.h>
+#include <wtf/MathExtras.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+unsigned DecimalNumber::bufferLengthForStringDecimal() const
+{
+    unsigned length = 0;
+    // if the exponent is negative the number decimal representation is of the form:
+    // [<sign>]0.[<zeros>]<significand>
+    if (m_exponent < 0) {
+        if (m_sign)
+            ++length;
+        length += 2; // for "0."
+        length += -m_exponent - 1;
+        length += m_precision;
+        return length;
+    }
+
+    unsigned digitsBeforeDecimalPoint = m_exponent + 1;
+
+    // If the precision is <= than the number of digits to get up to the decimal
+    // point, then there is no fractional part, number is of the form:
+    // [<sign>]<significand>[<zeros>]
+    if (m_precision <= digitsBeforeDecimalPoint) {
+        if (m_sign)
+            ++length;
+        length += m_precision;
+        length += digitsBeforeDecimalPoint - m_precision;
+        return length;
+    }
+
+    // If we get here, number starts before the decimal point, and ends after it,
+    // as such is of the form:
+    // [<sign>]<significand-begin>.<significand-end>
+    if (m_sign)
+        ++length;
+    length += digitsBeforeDecimalPoint;
+    ++length; // for decimal point
+    length += m_precision - digitsBeforeDecimalPoint;
+
+    return length;
+}
+
+unsigned DecimalNumber::bufferLengthForStringExponential() const
+{
+    unsigned length = 0;
+    if (m_sign)
+        ++length;
+
+    // Add the significand
+    ++length;
+
+    if (m_precision > 1) {
+        ++length; // for decimal point
+        length += m_precision - 1;
+    }
+
+    // Add "e+" or "e-"
+    length += 2;
+
+    int exponent = (m_exponent >= 0) ? m_exponent : -m_exponent;
+
+    // Add the exponent
+    if (exponent >= 100)
+        ++length;
+    if (exponent >= 10)
+        ++length;
+    ++length;
+
+    return length;
+}
+
+unsigned DecimalNumber::toStringDecimal(LChar* buffer, unsigned bufferLength) const
+{
+    ASSERT_UNUSED(bufferLength, bufferLength >= bufferLengthForStringDecimal());
+
+    // Should always be at least one digit to add to the string!
+    ASSERT(m_precision);
+    LChar* next = buffer;
+
+    // if the exponent is negative the number decimal representation is of the form:
+    // [<sign>]0.[<zeros>]<significand>
+    if (m_exponent < 0) {
+        unsigned zeros = -m_exponent - 1;
+
+        if (m_sign)
+            *next++ = '-';
+        *next++ = '0';
+        *next++ = '.';
+        for (unsigned i = 0; i < zeros; ++i)
+            *next++ = '0';
+        for (unsigned i = 0; i < m_precision; ++i)
+            *next++ = m_significand[i];
+
+        return next - buffer;
+    }
+
+    unsigned digitsBeforeDecimalPoint = m_exponent + 1;
+
+    // If the precision is <= than the number of digits to get up to the decimal
+    // point, then there is no fractional part, number is of the form:
+    // [<sign>]<significand>[<zeros>]
+    if (m_precision <= digitsBeforeDecimalPoint) {
+        if (m_sign)
+            *next++ = '-';
+        for (unsigned i = 0; i < m_precision; ++i)
+            *next++ = m_significand[i];
+        for (unsigned i = 0; i < (digitsBeforeDecimalPoint - m_precision); ++i)
+            *next++ = '0';
+
+        return next - buffer;
+    }
+
+    // If we get here, number starts before the decimal point, and ends after it,
+    // as such is of the form:
+    // [<sign>]<significand-begin>.<significand-end>
+
+    if (m_sign)
+        *next++ = '-';
+    for (unsigned i = 0; i < digitsBeforeDecimalPoint; ++i)
+        *next++ = m_significand[i];
+    *next++ = '.';
+    for (unsigned i = digitsBeforeDecimalPoint; i < m_precision; ++i)
+        *next++ = m_significand[i];
+
+    return next - buffer;
+}
+
+unsigned DecimalNumber::toStringExponential(LChar* buffer, unsigned bufferLength) const
+{
+    ASSERT_UNUSED(bufferLength, bufferLength >= bufferLengthForStringExponential());
+
+    // Should always be at least one digit to add to the string!
+    ASSERT(m_precision);
+    LChar* next = buffer;
+
+    // Add the sign
+    if (m_sign)
+        *next++ = '-';
+
+    // Add the significand
+    *next++ = m_significand[0];
+    if (m_precision > 1) {
+        *next++ = '.';
+        for (unsigned i = 1; i < m_precision; ++i)
+            *next++ = m_significand[i];
+    }
+
+    // Add "e+" or "e-"
+    *next++ = 'e';
+    int exponent;
+    if (m_exponent >= 0) {
+        *next++ = '+';
+        exponent = m_exponent;
+    } else {
+        *next++ = '-';
+        exponent = -m_exponent;
+    }
+
+    // Add the exponent
+    if (exponent >= 100)
+        *next++ = '0' + exponent / 100;
+    if (exponent >= 10)
+        *next++ = '0' + (exponent % 100) / 10;
+    *next++ = '0' + exponent % 10;
+
+    return next - buffer;
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/DecimalNumber.h b/Source/WTF/wtf/DecimalNumber.h
new file mode 100644
index 0000000..8278dfe
--- /dev/null
+++ b/Source/WTF/wtf/DecimalNumber.h
@@ -0,0 +1,108 @@
+/*
+ * 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. ``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
+ * 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 DecimalNumber_h
+#define DecimalNumber_h
+
+#include <math.h>
+#include <wtf/dtoa.h>
+#include <wtf/MathExtras.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+enum RoundingSignificantFiguresType { RoundingSignificantFigures };
+enum RoundingDecimalPlacesType { RoundingDecimalPlaces };
+
+class DecimalNumber {
+public:
+    DecimalNumber(double d)
+    {
+        ASSERT(isfinite(d));
+        dtoa(m_significand, d, m_sign, m_exponent, m_precision);
+
+        ASSERT(m_precision);
+        // Zero should always have exponent 0.
+        ASSERT(m_significand[0] != '0' || !m_exponent);
+        // No values other than zero should have a leading zero.
+        ASSERT(m_significand[0] != '0' || m_precision == 1);
+        // No values other than zero should have trailing zeros.
+        ASSERT(m_significand[0] == '0' || m_significand[m_precision - 1] != '0');
+    }
+
+    DecimalNumber(double d, RoundingSignificantFiguresType, unsigned significantFigures)
+    {
+        ASSERT(isfinite(d));
+        dtoaRoundSF(m_significand, d, significantFigures, m_sign, m_exponent, m_precision);
+
+        ASSERT(significantFigures && significantFigures <= sizeof(DtoaBuffer));
+        while (m_precision < significantFigures)
+            m_significand[m_precision++] = '0';
+
+        ASSERT(m_precision);
+        // Zero should always have exponent 0.
+        ASSERT(m_significand[0] != '0' || !m_exponent);
+    }
+
+    DecimalNumber(double d, RoundingDecimalPlacesType, unsigned decimalPlaces)
+    {
+        ASSERT(isfinite(d));
+        dtoaRoundDP(m_significand, d, decimalPlaces, m_sign, m_exponent, m_precision);
+
+        unsigned significantFigures = 1 + m_exponent + decimalPlaces;
+        ASSERT(significantFigures && significantFigures <= sizeof(DtoaBuffer));
+        while (m_precision < significantFigures)
+            m_significand[m_precision++] = '0';
+
+        ASSERT(m_precision);
+        // Zero should always have exponent 0.
+        ASSERT(m_significand[0] != '0' || !m_exponent);
+    }
+
+    WTF_EXPORT_PRIVATE unsigned bufferLengthForStringDecimal() const;
+    WTF_EXPORT_PRIVATE unsigned bufferLengthForStringExponential() const;
+
+    WTF_EXPORT_PRIVATE unsigned toStringDecimal(LChar* buffer, unsigned bufferLength) const;
+    WTF_EXPORT_PRIVATE unsigned toStringExponential(LChar* buffer, unsigned bufferLength) const;
+
+    bool sign() const { return m_sign; }
+    int exponent() const { return m_exponent; }
+    const char* significand() const { return m_significand; } // significand contains precision characters, is not null-terminated.
+    unsigned precision() const { return m_precision; }
+
+private:
+    bool m_sign;
+    int m_exponent;
+    DtoaBuffer m_significand;
+    unsigned m_precision;
+};
+
+} // namespace WTF
+
+using WTF::DecimalNumber;
+using WTF::RoundingSignificantFigures;
+using WTF::RoundingDecimalPlaces;
+
+#endif // DecimalNumber_h
diff --git a/Source/WTF/wtf/Decoder.h b/Source/WTF/wtf/Decoder.h
new file mode 100644
index 0000000..341d58d
--- /dev/null
+++ b/Source/WTF/wtf/Decoder.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 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. ``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
+ * 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 Decoder_h
+#define Decoder_h
+
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+class String;
+
+class Decoder {
+protected:
+    Decoder() { }
+    virtual ~Decoder() { }
+    
+public:
+    virtual bool decodeBytes(Vector<uint8_t>&) = 0;
+
+    virtual bool decodeBool(bool&) = 0;
+    virtual bool decodeUInt32(uint32_t&) = 0;
+    virtual bool decodeUInt64(uint64_t&) = 0;
+    virtual bool decodeInt32(int32_t&) = 0;
+    virtual bool decodeInt64(int64_t&) = 0;
+    virtual bool decodeFloat(float&) = 0;
+    virtual bool decodeDouble(double&) = 0;
+    virtual bool decodeString(String&) = 0;
+};
+
+} // namespace WTF
+
+using WTF::Decoder;
+
+#endif // Decoder_h
diff --git a/Source/WTF/wtf/Deque.h b/Source/WTF/wtf/Deque.h
new file mode 100644
index 0000000..e5c47b6
--- /dev/null
+++ b/Source/WTF/wtf/Deque.h
@@ -0,0 +1,647 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 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:
+ *
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef WTF_Deque_h
+#define WTF_Deque_h
+
+// FIXME: Could move what Vector and Deque share into a separate file.
+// Deque doesn't actually use Vector.
+
+#include <iterator>
+#include <wtf/PassTraits.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+    template<typename T, size_t inlineCapacity> class DequeIteratorBase;
+    template<typename T, size_t inlineCapacity> class DequeIterator;
+    template<typename T, size_t inlineCapacity> class DequeConstIterator;
+
+    template<typename T, size_t inlineCapacity = 0>
+    class Deque {
+        WTF_MAKE_FAST_ALLOCATED;
+    public:
+        typedef DequeIterator<T, inlineCapacity> iterator;
+        typedef DequeConstIterator<T, inlineCapacity> const_iterator;
+        typedef std::reverse_iterator<iterator> reverse_iterator;
+        typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+        typedef PassTraits<T> Pass;
+        typedef typename PassTraits<T>::PassType PassType;
+
+        Deque();
+        Deque(const Deque<T, inlineCapacity>&);
+        Deque& operator=(const Deque<T, inlineCapacity>&);
+        ~Deque();
+
+        void swap(Deque<T, inlineCapacity>&);
+
+        size_t size() const { return m_start <= m_end ? m_end - m_start : m_end + m_buffer.capacity() - m_start; }
+        bool isEmpty() const { return m_start == m_end; }
+
+        iterator begin() { return iterator(this, m_start); }
+        iterator end() { return iterator(this, m_end); }
+        const_iterator begin() const { return const_iterator(this, m_start); }
+        const_iterator end() const { return const_iterator(this, m_end); }
+        reverse_iterator rbegin() { return reverse_iterator(end()); }
+        reverse_iterator rend() { return reverse_iterator(begin()); }
+        const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+        const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+        T& first() { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; }
+        const T& first() const { ASSERT(m_start != m_end); return m_buffer.buffer()[m_start]; }
+        PassType takeFirst();
+
+        T& last() { ASSERT(m_start != m_end); return *(--end()); }
+        const T& last() const { ASSERT(m_start != m_end); return *(--end()); }
+
+        template<typename U> void append(const U&);
+        template<typename U> void prepend(const U&);
+        void removeFirst();
+        void remove(iterator&);
+        void remove(const_iterator&);
+
+        void clear();
+
+        template<typename Predicate>
+        iterator findIf(Predicate&);
+
+    private:
+        friend class DequeIteratorBase<T, inlineCapacity>;
+
+        typedef VectorBuffer<T, inlineCapacity> Buffer;
+        typedef VectorTypeOperations<T> TypeOperations;
+        typedef DequeIteratorBase<T, inlineCapacity> IteratorBase;
+
+        void remove(size_t position);
+        void invalidateIterators();
+        void destroyAll();
+        void checkValidity() const;
+        void checkIndexValidity(size_t) const;
+        void expandCapacityIfNeeded();
+        void expandCapacity();
+
+        size_t m_start;
+        size_t m_end;
+        Buffer m_buffer;
+#ifndef NDEBUG
+        mutable IteratorBase* m_iterators;
+#endif
+    };
+
+    template<typename T, size_t inlineCapacity = 0>
+    class DequeIteratorBase {
+    protected:
+        DequeIteratorBase();
+        DequeIteratorBase(const Deque<T, inlineCapacity>*, size_t);
+        DequeIteratorBase(const DequeIteratorBase&);
+        DequeIteratorBase& operator=(const DequeIteratorBase&);
+        ~DequeIteratorBase();
+
+        void assign(const DequeIteratorBase& other) { *this = other; }
+
+        void increment();
+        void decrement();
+
+        T* before() const;
+        T* after() const;
+
+        bool isEqual(const DequeIteratorBase&) const;
+
+    private:
+        void addToIteratorsList();
+        void removeFromIteratorsList();
+        void checkValidity() const;
+        void checkValidity(const DequeIteratorBase&) const;
+
+        Deque<T, inlineCapacity>* m_deque;
+        size_t m_index;
+
+        friend class Deque<T, inlineCapacity>;
+
+#ifndef NDEBUG
+        mutable DequeIteratorBase* m_next;
+        mutable DequeIteratorBase* m_previous;
+#endif
+    };
+
+    template<typename T, size_t inlineCapacity = 0>
+    class DequeIterator : public DequeIteratorBase<T, inlineCapacity> {
+    private:
+        typedef DequeIteratorBase<T, inlineCapacity> Base;
+        typedef DequeIterator<T, inlineCapacity> Iterator;
+
+    public:
+        typedef ptrdiff_t difference_type;
+        typedef T value_type;
+        typedef T* pointer;
+        typedef T& reference;
+        typedef std::bidirectional_iterator_tag iterator_category;
+
+        DequeIterator(Deque<T, inlineCapacity>* deque, size_t index) : Base(deque, index) { }
+
+        DequeIterator(const Iterator& other) : Base(other) { }
+        DequeIterator& operator=(const Iterator& other) { Base::assign(other); return *this; }
+
+        T& operator*() const { return *Base::after(); }
+        T* operator->() const { return Base::after(); }
+
+        bool operator==(const Iterator& other) const { return Base::isEqual(other); }
+        bool operator!=(const Iterator& other) const { return !Base::isEqual(other); }
+
+        Iterator& operator++() { Base::increment(); return *this; }
+        // postfix ++ intentionally omitted
+        Iterator& operator--() { Base::decrement(); return *this; }
+        // postfix -- intentionally omitted
+    };
+
+    template<typename T, size_t inlineCapacity = 0>
+    class DequeConstIterator : public DequeIteratorBase<T, inlineCapacity> {
+    private:
+        typedef DequeIteratorBase<T, inlineCapacity> Base;
+        typedef DequeConstIterator<T, inlineCapacity> Iterator;
+        typedef DequeIterator<T, inlineCapacity> NonConstIterator;
+
+    public:
+        typedef ptrdiff_t difference_type;
+        typedef T value_type;
+        typedef const T* pointer;
+        typedef const T& reference;
+        typedef std::bidirectional_iterator_tag iterator_category;
+
+        DequeConstIterator(const Deque<T, inlineCapacity>* deque, size_t index) : Base(deque, index) { }
+
+        DequeConstIterator(const Iterator& other) : Base(other) { }
+        DequeConstIterator(const NonConstIterator& other) : Base(other) { }
+        DequeConstIterator& operator=(const Iterator& other) { Base::assign(other); return *this; }
+        DequeConstIterator& operator=(const NonConstIterator& other) { Base::assign(other); return *this; }
+
+        const T& operator*() const { return *Base::after(); }
+        const T* operator->() const { return Base::after(); }
+
+        bool operator==(const Iterator& other) const { return Base::isEqual(other); }
+        bool operator!=(const Iterator& other) const { return !Base::isEqual(other); }
+
+        Iterator& operator++() { Base::increment(); return *this; }
+        // postfix ++ intentionally omitted
+        Iterator& operator--() { Base::decrement(); return *this; }
+        // postfix -- intentionally omitted
+    };
+
+#ifdef NDEBUG
+    template<typename T, size_t inlineCapacity> inline void Deque<T, inlineCapacity>::checkValidity() const { }
+    template<typename T, size_t inlineCapacity> inline void Deque<T, inlineCapacity>::checkIndexValidity(size_t) const { }
+    template<typename T, size_t inlineCapacity> inline void Deque<T, inlineCapacity>::invalidateIterators() { }
+#else
+    template<typename T, size_t inlineCapacity>
+    void Deque<T, inlineCapacity>::checkValidity() const
+    {
+        // In this implementation a capacity of 1 would confuse append() and
+        // other places that assume the index after capacity - 1 is 0.
+        ASSERT(m_buffer.capacity() != 1);
+
+        if (!m_buffer.capacity()) {
+            ASSERT(!m_start);
+            ASSERT(!m_end);
+        } else {
+            ASSERT(m_start < m_buffer.capacity());
+            ASSERT(m_end < m_buffer.capacity());
+        }
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void Deque<T, inlineCapacity>::checkIndexValidity(size_t index) const
+    {
+        ASSERT_UNUSED(index, index <= m_buffer.capacity());
+        if (m_start <= m_end) {
+            ASSERT(index >= m_start);
+            ASSERT(index <= m_end);
+        } else {
+            ASSERT(index >= m_start || index <= m_end);
+        }
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void Deque<T, inlineCapacity>::invalidateIterators()
+    {
+        IteratorBase* next;
+        for (IteratorBase* p = m_iterators; p; p = next) {
+            next = p->m_next;
+            p->m_deque = 0;
+            p->m_next = 0;
+            p->m_previous = 0;
+        }
+        m_iterators = 0;
+    }
+#endif
+
+    template<typename T, size_t inlineCapacity>
+    inline Deque<T, inlineCapacity>::Deque()
+        : m_start(0)
+        , m_end(0)
+#ifndef NDEBUG
+        , m_iterators(0)
+#endif
+    {
+        checkValidity();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline Deque<T, inlineCapacity>::Deque(const Deque<T, inlineCapacity>& other)
+        : m_start(other.m_start)
+        , m_end(other.m_end)
+        , m_buffer(other.m_buffer.capacity())
+#ifndef NDEBUG
+        , m_iterators(0)
+#endif
+    {
+        const T* otherBuffer = other.m_buffer.buffer();
+        if (m_start <= m_end)
+            TypeOperations::uninitializedCopy(otherBuffer + m_start, otherBuffer + m_end, m_buffer.buffer() + m_start);
+        else {
+            TypeOperations::uninitializedCopy(otherBuffer, otherBuffer + m_end, m_buffer.buffer());
+            TypeOperations::uninitializedCopy(otherBuffer + m_start, otherBuffer + m_buffer.capacity(), m_buffer.buffer() + m_start);
+        }
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void deleteAllValues(const Deque<T, inlineCapacity>& collection)
+    {
+        typedef typename Deque<T, inlineCapacity>::const_iterator iterator;
+        iterator end = collection.end();
+        for (iterator it = collection.begin(); it != end; ++it)
+            delete *it;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline Deque<T, inlineCapacity>& Deque<T, inlineCapacity>::operator=(const Deque<T, inlineCapacity>& other)
+    {
+        // FIXME: This is inefficient if we're using an inline buffer and T is
+        // expensive to copy since it will copy the buffer twice instead of once.
+        Deque<T> copy(other);
+        swap(copy);
+        return *this;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Deque<T, inlineCapacity>::destroyAll()
+    {
+        if (m_start <= m_end)
+            TypeOperations::destruct(m_buffer.buffer() + m_start, m_buffer.buffer() + m_end);
+        else {
+            TypeOperations::destruct(m_buffer.buffer(), m_buffer.buffer() + m_end);
+            TypeOperations::destruct(m_buffer.buffer() + m_start, m_buffer.buffer() + m_buffer.capacity());
+        }
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline Deque<T, inlineCapacity>::~Deque()
+    {
+        checkValidity();
+        invalidateIterators();
+        destroyAll();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Deque<T, inlineCapacity>::swap(Deque<T, inlineCapacity>& other)
+    {
+        checkValidity();
+        other.checkValidity();
+        invalidateIterators();
+        std::swap(m_start, other.m_start);
+        std::swap(m_end, other.m_end);
+        m_buffer.swap(other.m_buffer);
+        checkValidity();
+        other.checkValidity();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Deque<T, inlineCapacity>::clear()
+    {
+        checkValidity();
+        invalidateIterators();
+        destroyAll();
+        m_start = 0;
+        m_end = 0;
+        checkValidity();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    template<typename Predicate>
+    inline DequeIterator<T, inlineCapacity> Deque<T, inlineCapacity>::findIf(Predicate& predicate)
+    {
+        iterator end_iterator = end();
+        for (iterator it = begin(); it != end_iterator; ++it) {
+            if (predicate(*it))
+                return it;
+        }
+        return end_iterator;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Deque<T, inlineCapacity>::expandCapacityIfNeeded()
+    {
+        if (m_start) {
+            if (m_end + 1 != m_start)
+                return;
+        } else if (m_end) {
+            if (m_end != m_buffer.capacity() - 1)
+                return;
+        } else if (m_buffer.capacity())
+            return;
+
+        expandCapacity();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void Deque<T, inlineCapacity>::expandCapacity()
+    {
+        checkValidity();
+        size_t oldCapacity = m_buffer.capacity();
+        size_t newCapacity = std::max(static_cast<size_t>(16), oldCapacity + oldCapacity / 4 + 1);
+        T* oldBuffer = m_buffer.buffer();
+        m_buffer.allocateBuffer(newCapacity);
+        if (m_start <= m_end)
+            TypeOperations::move(oldBuffer + m_start, oldBuffer + m_end, m_buffer.buffer() + m_start);
+        else {
+            TypeOperations::move(oldBuffer, oldBuffer + m_end, m_buffer.buffer());
+            size_t newStart = newCapacity - (oldCapacity - m_start);
+            TypeOperations::move(oldBuffer + m_start, oldBuffer + oldCapacity, m_buffer.buffer() + newStart);
+            m_start = newStart;
+        }
+        m_buffer.deallocateBuffer(oldBuffer);
+        checkValidity();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline typename Deque<T, inlineCapacity>::PassType Deque<T, inlineCapacity>::takeFirst()
+    {
+        T oldFirst = Pass::transfer(first());
+        removeFirst();
+        return Pass::transfer(oldFirst);
+    }
+
+    template<typename T, size_t inlineCapacity> template<typename U>
+    inline void Deque<T, inlineCapacity>::append(const U& value)
+    {
+        checkValidity();
+        expandCapacityIfNeeded();
+        new (NotNull, &m_buffer.buffer()[m_end]) T(value);
+        if (m_end == m_buffer.capacity() - 1)
+            m_end = 0;
+        else
+            ++m_end;
+        checkValidity();
+    }
+
+    template<typename T, size_t inlineCapacity> template<typename U>
+    inline void Deque<T, inlineCapacity>::prepend(const U& value)
+    {
+        checkValidity();
+        expandCapacityIfNeeded();
+        if (!m_start)
+            m_start = m_buffer.capacity() - 1;
+        else
+            --m_start;
+        new (NotNull, &m_buffer.buffer()[m_start]) T(value);
+        checkValidity();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Deque<T, inlineCapacity>::removeFirst()
+    {
+        checkValidity();
+        invalidateIterators();
+        ASSERT(!isEmpty());
+        TypeOperations::destruct(&m_buffer.buffer()[m_start], &m_buffer.buffer()[m_start + 1]);
+        if (m_start == m_buffer.capacity() - 1)
+            m_start = 0;
+        else
+            ++m_start;
+        checkValidity();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Deque<T, inlineCapacity>::remove(iterator& it)
+    {
+        it.checkValidity();
+        remove(it.m_index);
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Deque<T, inlineCapacity>::remove(const_iterator& it)
+    {
+        it.checkValidity();
+        remove(it.m_index);
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Deque<T, inlineCapacity>::remove(size_t position)
+    {
+        if (position == m_end)
+            return;
+
+        checkValidity();
+        invalidateIterators();
+
+        T* buffer = m_buffer.buffer();
+        TypeOperations::destruct(&buffer[position], &buffer[position + 1]);
+
+        // Find which segment of the circular buffer contained the remove element, and only move elements in that part.
+        if (position >= m_start) {
+            TypeOperations::moveOverlapping(buffer + m_start, buffer + position, buffer + m_start + 1);
+            m_start = (m_start + 1) % m_buffer.capacity();
+        } else {
+            TypeOperations::moveOverlapping(buffer + position + 1, buffer + m_end, buffer + position);
+            m_end = (m_end - 1 + m_buffer.capacity()) % m_buffer.capacity();
+        }
+        checkValidity();
+    }
+
+#ifdef NDEBUG
+    template<typename T, size_t inlineCapacity> inline void DequeIteratorBase<T, inlineCapacity>::checkValidity() const { }
+    template<typename T, size_t inlineCapacity> inline void DequeIteratorBase<T, inlineCapacity>::checkValidity(const DequeIteratorBase<T, inlineCapacity>&) const { }
+    template<typename T, size_t inlineCapacity> inline void DequeIteratorBase<T, inlineCapacity>::addToIteratorsList() { }
+    template<typename T, size_t inlineCapacity> inline void DequeIteratorBase<T, inlineCapacity>::removeFromIteratorsList() { }
+#else
+    template<typename T, size_t inlineCapacity>
+    void DequeIteratorBase<T, inlineCapacity>::checkValidity() const
+    {
+        ASSERT(m_deque);
+        m_deque->checkIndexValidity(m_index);
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void DequeIteratorBase<T, inlineCapacity>::checkValidity(const DequeIteratorBase& other) const
+    {
+        checkValidity();
+        other.checkValidity();
+        ASSERT(m_deque == other.m_deque);
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void DequeIteratorBase<T, inlineCapacity>::addToIteratorsList()
+    {
+        if (!m_deque)
+            m_next = 0;
+        else {
+            m_next = m_deque->m_iterators;
+            m_deque->m_iterators = this;
+            if (m_next)
+                m_next->m_previous = this;
+        }
+        m_previous = 0;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void DequeIteratorBase<T, inlineCapacity>::removeFromIteratorsList()
+    {
+        if (!m_deque) {
+            ASSERT(!m_next);
+            ASSERT(!m_previous);
+        } else {
+            if (m_next) {
+                ASSERT(m_next->m_previous == this);
+                m_next->m_previous = m_previous;
+            }
+            if (m_previous) {
+                ASSERT(m_deque->m_iterators != this);
+                ASSERT(m_previous->m_next == this);
+                m_previous->m_next = m_next;
+            } else {
+                ASSERT(m_deque->m_iterators == this);
+                m_deque->m_iterators = m_next;
+            }
+        }
+        m_next = 0;
+        m_previous = 0;
+    }
+#endif
+
+    template<typename T, size_t inlineCapacity>
+    inline DequeIteratorBase<T, inlineCapacity>::DequeIteratorBase()
+        : m_deque(0)
+    {
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline DequeIteratorBase<T, inlineCapacity>::DequeIteratorBase(const Deque<T, inlineCapacity>* deque, size_t index)
+        : m_deque(const_cast<Deque<T, inlineCapacity>*>(deque))
+        , m_index(index)
+    {
+        addToIteratorsList();
+        checkValidity();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline DequeIteratorBase<T, inlineCapacity>::DequeIteratorBase(const DequeIteratorBase& other)
+        : m_deque(other.m_deque)
+        , m_index(other.m_index)
+    {
+        addToIteratorsList();
+        checkValidity();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline DequeIteratorBase<T, inlineCapacity>& DequeIteratorBase<T, inlineCapacity>::operator=(const DequeIteratorBase& other)
+    {
+        other.checkValidity();
+        removeFromIteratorsList();
+
+        m_deque = other.m_deque;
+        m_index = other.m_index;
+        addToIteratorsList();
+        checkValidity();
+        return *this;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline DequeIteratorBase<T, inlineCapacity>::~DequeIteratorBase()
+    {
+#ifndef NDEBUG
+        removeFromIteratorsList();
+        m_deque = 0;
+#endif
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline bool DequeIteratorBase<T, inlineCapacity>::isEqual(const DequeIteratorBase& other) const
+    {
+        checkValidity(other);
+        return m_index == other.m_index;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void DequeIteratorBase<T, inlineCapacity>::increment()
+    {
+        checkValidity();
+        ASSERT(m_index != m_deque->m_end);
+        ASSERT(m_deque->m_buffer.capacity());
+        if (m_index == m_deque->m_buffer.capacity() - 1)
+            m_index = 0;
+        else
+            ++m_index;
+        checkValidity();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void DequeIteratorBase<T, inlineCapacity>::decrement()
+    {
+        checkValidity();
+        ASSERT(m_index != m_deque->m_start);
+        ASSERT(m_deque->m_buffer.capacity());
+        if (!m_index)
+            m_index = m_deque->m_buffer.capacity() - 1;
+        else
+            --m_index;
+        checkValidity();
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline T* DequeIteratorBase<T, inlineCapacity>::after() const
+    {
+        checkValidity();
+        ASSERT(m_index != m_deque->m_end);
+        return &m_deque->m_buffer.buffer()[m_index];
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline T* DequeIteratorBase<T, inlineCapacity>::before() const
+    {
+        checkValidity();
+        ASSERT(m_index != m_deque->m_start);
+        if (!m_index)
+            return &m_deque->m_buffer.buffer()[m_deque->m_buffer.capacity() - 1];
+        return &m_deque->m_buffer.buffer()[m_index - 1];
+    }
+
+} // namespace WTF
+
+using WTF::Deque;
+
+#endif // WTF_Deque_h
diff --git a/Source/WTF/wtf/DisallowCType.h b/Source/WTF/wtf/DisallowCType.h
new file mode 100644
index 0000000..a961f1d
--- /dev/null
+++ b/Source/WTF/wtf/DisallowCType.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2007 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef WTF_DisallowCType_h
+#define WTF_DisallowCType_h
+
+// The behavior of many of the functions in the <ctype.h> header is dependent
+// on the current locale. But almost all uses of these functions are for
+// locale-independent, ASCII-specific purposes. In WebKit code we use our own
+// ASCII-specific functions instead. This header makes sure we get a compile-time
+// error if we use one of the <ctype.h> functions by accident.
+
+// this breaks compilation of <QFontDatabase>, at least, so turn it off for now
+// Also generates errors on wx on Windows, presumably because these functions
+// are used from wx headers. On GTK+ for Mac many GTK+ files include <libintl.h>
+// or <glib/gi18n-lib.h>, which in turn include <xlocale/_ctype.h> which uses
+// isacii(). 
+#include <wtf/Platform.h>
+#if !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !(OS(DARWIN) && PLATFORM(GTK)) && !OS(QNX) && !defined(_LIBCPP_VERSION)
+
+#include <ctype.h>
+
+#undef isalnum
+#undef isalpha
+#undef isascii
+#undef isblank
+#undef iscntrl
+#undef isdigit
+#undef isgraph
+#undef islower
+#undef isprint
+#undef ispunct
+#undef isspace
+#undef isupper
+#undef isxdigit
+#undef toascii
+#undef tolower
+#undef toupper
+
+#define isalnum isalnum_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isalpha isalpha_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isascii isascii_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isblank isblank_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define iscntrl iscntrl_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isdigit isdigit_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isgraph isgraph_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define islower islower_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isprint isprint_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define ispunct ispunct_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isspace isspace_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isupper isupper_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define isxdigit isxdigit_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define toascii toascii_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define tolower tolower_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+#define toupper toupper_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h
+
+#endif
+
+#endif
diff --git a/Source/WTF/wtf/DoublyLinkedList.h b/Source/WTF/wtf/DoublyLinkedList.h
new file mode 100644
index 0000000..cd067ef
--- /dev/null
+++ b/Source/WTF/wtf/DoublyLinkedList.h
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+#ifndef DoublyLinkedList_h
+#define DoublyLinkedList_h
+
+namespace WTF {
+
+// This class allows nodes to share code without dictating data member layout.
+template<typename T> class DoublyLinkedListNode {
+public:
+    DoublyLinkedListNode();
+    
+    void setPrev(T*);
+    void setNext(T*);
+    
+    T* prev() const;
+    T* next() const;
+};
+
+template<typename T> inline DoublyLinkedListNode<T>::DoublyLinkedListNode()
+{
+    setPrev(0);
+    setNext(0);
+}
+
+template<typename T> inline void DoublyLinkedListNode<T>::setPrev(T* prev)
+{
+    static_cast<T*>(this)->m_prev = prev;
+}
+
+template<typename T> inline void DoublyLinkedListNode<T>::setNext(T* next)
+{
+    static_cast<T*>(this)->m_next = next;
+}
+
+template<typename T> inline T* DoublyLinkedListNode<T>::prev() const
+{
+    return static_cast<const T*>(this)->m_prev;
+}
+
+template<typename T> inline T* DoublyLinkedListNode<T>::next() const
+{
+    return static_cast<const T*>(this)->m_next;
+}
+
+template<typename T> class DoublyLinkedList {
+public:
+    DoublyLinkedList();
+    
+    bool isEmpty() const;
+    size_t size() const; // This is O(n).
+    void clear();
+
+    T* head() const;
+    T* removeHead();
+
+    T* tail() const;
+
+    void push(T*);
+    void append(T*);
+    void remove(T*);
+
+private:
+    T* m_head;
+    T* m_tail;
+};
+
+template<typename T> inline DoublyLinkedList<T>::DoublyLinkedList()
+    : m_head(0)
+    , m_tail(0)
+{
+}
+
+template<typename T> inline bool DoublyLinkedList<T>::isEmpty() const
+{
+    return !m_head;
+}
+
+template<typename T> inline size_t DoublyLinkedList<T>::size() const
+{
+    size_t size = 0;
+    for (T* node = m_head; node; node = node->next())
+        ++size;
+    return size;
+}
+
+template<typename T> inline void DoublyLinkedList<T>::clear()
+{
+    m_head = 0;
+    m_tail = 0;
+}
+
+template<typename T> inline T* DoublyLinkedList<T>::head() const
+{
+    return m_head;
+}
+
+template<typename T> inline T* DoublyLinkedList<T>::tail() const
+{
+    return m_tail;
+}
+
+template<typename T> inline void DoublyLinkedList<T>::push(T* node)
+{
+    if (!m_head) {
+        ASSERT(!m_tail);
+        m_head = node;
+        m_tail = node;
+        node->setPrev(0);
+        node->setNext(0);
+        return;
+    }
+
+    ASSERT(m_tail);
+    m_head->setPrev(node);
+    node->setNext(m_head);
+    node->setPrev(0);
+    m_head = node;
+}
+
+template<typename T> inline void DoublyLinkedList<T>::append(T* node)
+{
+    if (!m_tail) {
+        ASSERT(!m_head);
+        m_head = node;
+        m_tail = node;
+        node->setPrev(0);
+        node->setNext(0);
+        return;
+    }
+
+    ASSERT(m_head);
+    m_tail->setNext(node);
+    node->setPrev(m_tail);
+    node->setNext(0);
+    m_tail = node;
+}
+
+template<typename T> inline void DoublyLinkedList<T>::remove(T* node)
+{
+    if (node->prev()) {
+        ASSERT(node != m_head);
+        node->prev()->setNext(node->next());
+    } else {
+        ASSERT(node == m_head);
+        m_head = node->next();
+    }
+
+    if (node->next()) {
+        ASSERT(node != m_tail);
+        node->next()->setPrev(node->prev());
+    } else {
+        ASSERT(node == m_tail);
+        m_tail = node->prev();
+    }
+}
+
+template<typename T> inline T* DoublyLinkedList<T>::removeHead()
+{
+    T* node = head();
+    if (node)
+        remove(node);
+    return node;
+}
+
+} // namespace WTF
+
+using WTF::DoublyLinkedListNode;
+using WTF::DoublyLinkedList;
+
+#endif
diff --git a/Source/WTF/wtf/DynamicAnnotations.cpp b/Source/WTF/wtf/DynamicAnnotations.cpp
new file mode 100644
index 0000000..b662877
--- /dev/null
+++ b/Source/WTF/wtf/DynamicAnnotations.cpp
@@ -0,0 +1,61 @@
+/*
+ * 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) && !USE(DYNAMIC_ANNOTATIONS_NOIMPL)
+
+// Identical code folding(-Wl,--icf=all) countermeasures.
+// This makes all Annotate* functions different, which prevents the linker from
+// folding them.
+#ifdef __COUNTER__
+#define DYNAMIC_ANNOTATIONS_IMPL \
+    volatile short lineno = (__LINE__ << 8) + __COUNTER__; \
+    (void)lineno;
+#else
+#define DYNAMIC_ANNOTATIONS_IMPL \
+    volatile short lineno = (__LINE__ << 8); \
+    (void)lineno;
+#endif
+
+void WTFAnnotateBenignRaceSized(const char*, int, const volatile void*, long, const char*)
+{
+    DYNAMIC_ANNOTATIONS_IMPL
+}
+
+void WTFAnnotateHappensBefore(const char*, int, const volatile void*)
+{
+    DYNAMIC_ANNOTATIONS_IMPL
+}
+
+void WTFAnnotateHappensAfter(const char*, int, const volatile void*)
+{
+    DYNAMIC_ANNOTATIONS_IMPL
+}
+
+#endif // USE(DYNAMIC_ANNOTATIONS) && !USE(DYNAMIC_ANNOTATIONS_NOIMPL)
diff --git a/Source/WTF/wtf/DynamicAnnotations.h b/Source/WTF/wtf/DynamicAnnotations.h
new file mode 100644
index 0000000..38acce3
--- /dev/null
+++ b/Source/WTF/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/WTF/wtf/Encoder.h b/Source/WTF/wtf/Encoder.h
new file mode 100644
index 0000000..109b0db
--- /dev/null
+++ b/Source/WTF/wtf/Encoder.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 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. ``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
+ * 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 Encoder_h
+#define Encoder_h
+
+#include <stdint.h>
+
+namespace WTF {
+
+class String;
+
+class Encoder {
+protected:
+    Encoder() { }
+    virtual ~Encoder() { }
+    
+public:
+    virtual void encodeBytes(const uint8_t*, size_t) = 0;
+
+    virtual void encodeBool(bool) = 0;
+    virtual void encodeUInt32(uint32_t) = 0;
+    virtual void encodeUInt64(uint64_t) = 0;
+    virtual void encodeInt32(int32_t) = 0;
+    virtual void encodeInt64(int64_t) = 0;
+    virtual void encodeFloat(float) = 0;
+    virtual void encodeDouble(double) = 0;
+    virtual void encodeString(const String&) = 0;
+};
+
+} // namespace WTF
+
+using WTF::Encoder;
+
+#endif // Encoder_h
diff --git a/Source/WTF/wtf/ExportMacros.h b/Source/WTF/wtf/ExportMacros.h
new file mode 100644
index 0000000..ef9bd23
--- /dev/null
+++ b/Source/WTF/wtf/ExportMacros.h
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2011 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 COMPUTER, INC. ``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 COMPUTER, INC. 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. 
+ *
+ * This file handles shared library symbol export decorations. It is recommended
+ * that all WebKit projects use these definitions so that symbol exports work
+ * properly on all platforms and compilers that WebKit builds under.
+ */
+
+#ifndef ExportMacros_h
+#define ExportMacros_h
+
+#include <wtf/Platform.h>
+
+// Different platforms have different defaults for symbol visibility. Usually
+// the compiler and the linker just take care of it. However for references to
+// runtime routines from JIT stubs, it matters to be able to declare a symbol as
+// being local to the target being generated, and thus not subject to (e.g.) ELF
+// symbol interposition rules.
+
+#if !PLATFORM(CHROMIUM) && OS(WINDOWS)
+#define HAVE_INTERNAL_VISIBILITY 1
+#define WTF_INTERNAL
+#elif defined(__GNUC__) && !defined(__CC_ARM) && !defined(__ARMCC__)
+#define HAVE_INTERNAL_VISIBILITY 1
+#define WTF_INTERNAL __attribute__((visibility("hidden")))
+#else
+#define WTF_INTERNAL
+#endif
+
+#if !PLATFORM(CHROMIUM) && OS(WINDOWS)
+
+#define WTF_EXPORT_DECLARATION __declspec(dllexport)
+#define WTF_IMPORT_DECLARATION __declspec(dllimport)
+#define WTF_HIDDEN_DECLARATION
+
+#elif defined(__GNUC__) && !defined(__CC_ARM) && !defined(__ARMCC__)
+
+#define WTF_EXPORT_DECLARATION __attribute__((visibility("default")))
+#define WTF_IMPORT_DECLARATION WTF_EXPORT_DECLARATION
+#define WTF_HIDDEN_DECLARATION __attribute__((visibility("hidden")))
+
+#else
+
+#define WTF_EXPORT_DECLARATION
+#define WTF_IMPORT_DECLARATION
+#define WTF_HIDDEN_DECLARATION
+
+#endif
+
+#if defined(BUILDING_WTF) || defined(STATICALLY_LINKED_WITH_WTF) || (PLATFORM(WX) && defined(BUILDING_JavaScriptCore))
+#define WTF_IS_LINKED_IN_SAME_BINARY 1
+#endif
+
+// See note in wtf/Platform.h for more info on EXPORT_MACROS.
+#if USE(EXPORT_MACROS)
+
+#define WTF_EXPORT WTF_EXPORT_DECLARATION
+#define WTF_IMPORT WTF_IMPORT_DECLARATION
+#define WTF_HIDDEN WTF_IMPORT_DECLARATION
+
+// FIXME: When all ports are using the export macros, we should replace
+// WTF_EXPORTDATA with WTF_EXPORT_PRIVATE macros.
+#if defined(WTF_IS_LINKED_IN_SAME_BINARY)
+#define WTF_EXPORTDATA WTF_EXPORT
+#else
+#define WTF_EXPORTDATA WTF_IMPORT
+#endif
+
+#else // !USE(EXPORT_MACROS)
+
+#if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !COMPILER(GCC)
+#if defined(BUILDING_WTF) || defined(STATICALLY_LINKED_WITH_WTF)
+#define WTF_EXPORTDATA __declspec(dllexport)
+#else
+#define WTF_EXPORTDATA __declspec(dllimport)
+#endif
+#else // PLATFORM(CHROMIUM) || !OS(WINDOWS) || COMPILER(GCC)
+#define WTF_EXPORTDATA
+#endif // !PLATFORM(CHROMIUM)...
+
+#define WTF_EXPORTCLASS WTF_EXPORTDATA
+
+#define WTF_EXPORT
+#define WTF_IMPORT
+#define WTF_HIDDEN
+
+#endif // USE(EXPORT_MACROS)
+
+// WTF_TESTING (and WEBCORE_TESTING in PlatformExportMacros.h) is used for
+// exporting symbols which are referred from WebCoreTestSupport library.
+// Since the set of APIs is common between ports,
+// it is rather worth annotating inside the code than maintaining port specific export lists.
+#if USE(EXPORT_MACROS_FOR_TESTING)
+
+#if defined(WTF_IS_LINKED_IN_SAME_BINARY)
+#define WTF_TESTING WTF_EXPORT_DECLARATION
+#else
+#define WTF_TESTING WTF_IMPORT_DECLARATION
+#endif
+
+#else // USE(EXPORT_MACROS_FOR_TESTING)
+
+#define WTF_TESTING
+
+#endif // USE(EXPORT_MACROS_FOR_TESTING)
+
+#if defined(WTF_IS_LINKED_IN_SAME_BINARY)
+#define WTF_EXPORT_PRIVATE WTF_EXPORT
+#else
+#define WTF_EXPORT_PRIVATE WTF_IMPORT
+#endif
+
+// wxWebKit uses RTTI because wx itself does, so use a special macro for
+// extra exports it needs.
+#if PLATFORM(WX)
+#define WTF_EXPORT_PRIVATE_RTTI WTF_EXPORT_PRIVATE
+#define WTF_EXPORT_PRIVATE_NO_RTTI
+#else
+#define WTF_EXPORT_PRIVATE_RTTI
+#define WTF_EXPORT_PRIVATE_NO_RTTI WTF_EXPORT_PRIVATE
+#endif
+
+#if PLATFORM(WIN)
+#define WTF_EXPORT_STRING_API
+#else
+#define WTF_EXPORT_STRING_API WTF_EXPORT_PRIVATE
+#endif
+
+#define WTF_EXPORT_HIDDEN WTF_HIDDEN
+
+#define HIDDEN_INLINE WTF_EXPORT_HIDDEN inline
+
+#endif // ExportMacros_h
diff --git a/Source/WTF/wtf/FastAllocBase.h b/Source/WTF/wtf/FastAllocBase.h
new file mode 100644
index 0000000..a0804ad
--- /dev/null
+++ b/Source/WTF/wtf/FastAllocBase.h
@@ -0,0 +1,427 @@
+/*
+ * Copyright (C) 2008, 2009 Paul Pedriana <ppedriana@ea.com>. 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef FastAllocBase_h
+#define FastAllocBase_h
+
+// Provides customizable overrides of fastMalloc/fastFree and operator new/delete
+//
+// Provided functionality:
+//    Macro: WTF_MAKE_FAST_ALLOCATED
+//    namespace WTF {
+//
+//        T*    fastNew<T>();
+//        T*    fastNew<T>(arg);
+//        T*    fastNew<T>(arg, arg);
+//        T*    fastNewArray<T>(count);
+//        void  fastDelete(T* p);
+//        void  fastDeleteArray(T* p);
+//        void  fastNonNullDelete(T* p);
+//        void  fastNonNullDeleteArray(T* p);
+//    }
+//
+// FastDelete assumes that the underlying
+//
+// Example usage:
+//    class Widget {
+//        WTF_MAKE_FAST_ALLOCATED
+//    ...
+//    };
+//
+//    struct Data {
+//        WTF_MAKE_FAST_ALLOCATED
+//    public:
+//    ...
+//    };
+//
+//    char* charPtr = fastNew<char>();
+//    fastDelete(charPtr);
+//
+//    char* charArrayPtr = fastNewArray<char>(37);
+//    fastDeleteArray(charArrayPtr);
+//
+//    void** voidPtrPtr = fastNew<void*>();
+//    fastDelete(voidPtrPtr);
+//
+//    void** voidPtrArrayPtr = fastNewArray<void*>(37);
+//    fastDeleteArray(voidPtrArrayPtr);
+//
+//    POD* podPtr = fastNew<POD>();
+//    fastDelete(podPtr);
+//
+//    POD* podArrayPtr = fastNewArray<POD>(37);
+//    fastDeleteArray(podArrayPtr);
+//
+//    Object* objectPtr = fastNew<Object>();
+//    fastDelete(objectPtr);
+//
+//    Object* objectArrayPtr = fastNewArray<Object>(37);
+//    fastDeleteArray(objectArrayPtr);
+//
+
+#include <new>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wtf/Assertions.h>
+#include <wtf/FastMalloc.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/TypeTraits.h>
+
+#define WTF_MAKE_FAST_ALLOCATED \
+public: \
+    void* operator new(size_t, void* p) { return p; } \
+    void* operator new[](size_t, void* p) { return p; } \
+    \
+    void* operator new(size_t size) \
+    { \
+        void* p = ::WTF::fastMalloc(size); \
+         ::WTF::fastMallocMatchValidateMalloc(p, ::WTF::Internal::AllocTypeClassNew); \
+        return p; \
+    } \
+    \
+    void operator delete(void* p) \
+    { \
+        ::WTF::fastMallocMatchValidateFree(p, ::WTF::Internal::AllocTypeClassNew); \
+        ::WTF::fastFree(p); \
+    } \
+    \
+    void* operator new[](size_t size) \
+    { \
+        void* p = ::WTF::fastMalloc(size); \
+        ::WTF::fastMallocMatchValidateMalloc(p, ::WTF::Internal::AllocTypeClassNewArray); \
+        return p; \
+    } \
+    \
+    void operator delete[](void* p) \
+    { \
+         ::WTF::fastMallocMatchValidateFree(p, ::WTF::Internal::AllocTypeClassNewArray); \
+         ::WTF::fastFree(p); \
+    } \
+    void* operator new(size_t, NotNullTag, void* location) \
+    { \
+        ASSERT(location); \
+        return location; \
+    } \
+private: \
+typedef int __thisIsHereToForceASemicolonAfterThisMacro
+
+namespace WTF {
+
+    // fastNew / fastDelete
+
+    template <typename T>
+    inline T* fastNew()
+    {
+        void* p = fastMalloc(sizeof(T));
+
+        if (!p)
+            return 0;
+
+        fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+        return ::new (p) T;
+    }
+
+    template <typename T, typename Arg1>
+    inline T* fastNew(Arg1 arg1)
+    {
+        void* p = fastMalloc(sizeof(T));
+
+        if (!p)
+            return 0;
+
+        fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+        return ::new (p) T(arg1);
+    }
+
+    template <typename T, typename Arg1, typename Arg2>
+    inline T* fastNew(Arg1 arg1, Arg2 arg2)
+    {
+        void* p = fastMalloc(sizeof(T));
+
+        if (!p)
+            return 0;
+
+        fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+        return ::new (p) T(arg1, arg2);
+    }
+
+    template <typename T, typename Arg1, typename Arg2, typename Arg3>
+    inline T* fastNew(Arg1 arg1, Arg2 arg2, Arg3 arg3)
+    {
+        void* p = fastMalloc(sizeof(T));
+
+        if (!p)
+            return 0;
+
+        fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+        return ::new (p) T(arg1, arg2, arg3);
+    }
+
+    template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
+    inline T* fastNew(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
+    {
+        void* p = fastMalloc(sizeof(T));
+
+        if (!p)
+            return 0;
+
+        fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+        return ::new (p) T(arg1, arg2, arg3, arg4);
+    }
+
+    template <typename T, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
+    inline T* fastNew(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
+    {
+        void* p = fastMalloc(sizeof(T));
+
+        if (!p)
+            return 0;
+
+        fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew);
+        return ::new (p) T(arg1, arg2, arg3, arg4, arg5);
+    }
+
+    namespace Internal {
+
+        // We define a union of pointer to an integer and pointer to T.
+        // When non-POD arrays are allocated we add a few leading bytes to tell what
+        // the size of the array is. We return to the user the pointer to T.
+        // The way to think of it is as if we allocate a struct like so:
+        //    struct Array {
+        //        AllocAlignmentInteger m_size;
+        //        T m_T[array count];
+        //    };
+
+        template <typename T>
+        union ArraySize {
+            AllocAlignmentInteger* size;
+            T* t;
+        };
+
+        // This is a support template for fastNewArray.
+        // This handles the case wherein T has a trivial ctor and a trivial dtor.
+        template <typename T, bool trivialCtor, bool trivialDtor>
+        struct NewArrayImpl {
+            static T* fastNewArray(size_t count)
+            {
+                T* p = static_cast<T*>(fastMalloc(sizeof(T) * count));
+                fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNewArray);
+                return p;
+            }
+        };
+
+        // This is a support template for fastNewArray.
+        // This handles the case wherein T has a non-trivial ctor and a trivial dtor.
+        template <typename T>
+        struct NewArrayImpl<T, false, true> {
+            static T* fastNewArray(size_t count)
+            {
+                T* p = static_cast<T*>(fastMalloc(sizeof(T) * count));
+
+                if (!p)
+                    return 0;
+
+                fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNewArray);
+
+                for (T* pObject = p, *pObjectEnd = pObject + count; pObject != pObjectEnd; ++pObject)
+                    ::new (pObject) T;
+
+                return p;
+            }
+        };
+
+        // This is a support template for fastNewArray.
+        // This handles the case wherein T has a trivial ctor and a non-trivial dtor.
+        template <typename T>
+        struct NewArrayImpl<T, true, false> {
+            static T* fastNewArray(size_t count)
+            {
+                void* p = fastMalloc(sizeof(AllocAlignmentInteger) + (sizeof(T) * count));
+                ArraySize<T> a = { static_cast<AllocAlignmentInteger*>(p) };
+
+                if (!p)
+                    return 0;
+
+                fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNewArray);
+                *a.size++ = count;
+                // No need to construct the objects in this case.
+
+                return a.t;
+            }
+        };
+
+        // This is a support template for fastNewArray.
+        // This handles the case wherein T has a non-trivial ctor and a non-trivial dtor.
+        template <typename T>
+        struct NewArrayImpl<T, false, false> {
+            static T* fastNewArray(size_t count)
+            {
+                void* p = fastMalloc(sizeof(AllocAlignmentInteger) + (sizeof(T) * count));
+                ArraySize<T> a = { static_cast<AllocAlignmentInteger*>(p) };
+
+                if (!p)
+                    return 0;
+
+                fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNewArray);
+                *a.size++ = count;
+
+                for (T* pT = a.t, *pTEnd = pT + count; pT != pTEnd; ++pT)
+                    ::new (pT) T;
+
+                return a.t;
+            }
+        };
+    } // namespace Internal
+
+    template <typename T>
+    inline T* fastNewArray(size_t count)
+    {
+        return Internal::NewArrayImpl<T, WTF::HasTrivialConstructor<T>::value, WTF::HasTrivialDestructor<T>::value>::fastNewArray(count);
+    }
+
+    template <typename T>
+    inline void fastDelete(T* p)
+    {
+        if (!p)
+            return;
+
+        fastMallocMatchValidateFree(p, Internal::AllocTypeFastNew);
+        p->~T();
+        fastFree(p);
+    }
+
+    template <typename T>
+    inline void fastDeleteSkippingDestructor(T* p)
+    {
+        if (!p)
+            return;
+
+        fastMallocMatchValidateFree(p, Internal::AllocTypeFastNew);
+        fastFree(p);
+    }
+
+    namespace Internal {
+        // This is a support template for fastDeleteArray.
+        // This handles the case wherein T has a trivial dtor.
+        template <typename T, bool trivialDtor>
+        struct DeleteArrayImpl {
+            static void fastDeleteArray(void* p)
+            {
+                // No need to destruct the objects in this case.
+                // We expect that fastFree checks for null.
+                fastMallocMatchValidateFree(p, Internal::AllocTypeFastNewArray);
+                fastFree(p);
+            }
+        };
+
+        // This is a support template for fastDeleteArray.
+        // This handles the case wherein T has a non-trivial dtor.
+        template <typename T>
+        struct DeleteArrayImpl<T, false> {
+            static void fastDeleteArray(T* p)
+            {
+                if (!p)
+                    return;
+
+                ArraySize<T> a;
+                a.t = p;
+                a.size--; // Decrement size pointer
+
+                T* pEnd = p + *a.size;
+                while (pEnd-- != p)
+                    pEnd->~T();
+
+                fastMallocMatchValidateFree(a.size, Internal::AllocTypeFastNewArray);
+                fastFree(a.size);
+            }
+        };
+
+    } // namespace Internal
+
+    template <typename T>
+    void fastDeleteArray(T* p)
+    {
+        Internal::DeleteArrayImpl<T, WTF::HasTrivialDestructor<T>::value>::fastDeleteArray(p);
+    }
+
+
+    template <typename T>
+    inline void fastNonNullDelete(T* p)
+    {
+        fastMallocMatchValidateFree(p, Internal::AllocTypeFastNew);
+        p->~T();
+        fastFree(p);
+    }
+
+    namespace Internal {
+        // This is a support template for fastDeleteArray.
+        // This handles the case wherein T has a trivial dtor.
+        template <typename T, bool trivialDtor>
+        struct NonNullDeleteArrayImpl {
+            static void fastNonNullDeleteArray(void* p)
+            {
+                fastMallocMatchValidateFree(p, Internal::AllocTypeFastNewArray);
+                // No need to destruct the objects in this case.
+                fastFree(p);
+            }
+        };
+
+        // This is a support template for fastDeleteArray.
+        // This handles the case wherein T has a non-trivial dtor.
+        template <typename T>
+        struct NonNullDeleteArrayImpl<T, false> {
+            static void fastNonNullDeleteArray(T* p)
+            {
+                ArraySize<T> a;
+                a.t = p;
+                a.size--;
+
+                T* pEnd = p + *a.size;
+                while (pEnd-- != p)
+                    pEnd->~T();
+
+                fastMallocMatchValidateFree(a.size, Internal::AllocTypeFastNewArray);
+                fastFree(a.size);
+            }
+        };
+
+    } // namespace Internal
+
+    template <typename T>
+    void fastNonNullDeleteArray(T* p)
+    {
+        Internal::NonNullDeleteArrayImpl<T, WTF::HasTrivialDestructor<T>::value>::fastNonNullDeleteArray(p);
+    }
+
+
+} // namespace WTF
+
+using WTF::fastDeleteSkippingDestructor;
+
+#endif // FastAllocBase_h
diff --git a/Source/WTF/wtf/FastBitVector.h b/Source/WTF/wtf/FastBitVector.h
new file mode 100644
index 0000000..97f9adf
--- /dev/null
+++ b/Source/WTF/wtf/FastBitVector.h
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2012 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. ``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
+ * 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 FastBitVector_h
+#define FastBitVector_h
+
+#include <wtf/FastMalloc.h>
+#include <wtf/OwnArrayPtr.h>
+#include <wtf/PassOwnArrayPtr.h>
+#include <wtf/StdLibExtras.h>
+
+namespace WTF {
+
+class FastBitVector {
+public:
+    FastBitVector()
+        : m_array(0)
+        , m_numBits(0)
+    {
+    }
+    
+    FastBitVector(const FastBitVector& other)
+        : m_array(0)
+        , m_numBits(0)
+    {
+        *this = other;
+    }
+    
+    ~FastBitVector()
+    {
+        if (m_array)
+            fastFree(m_array);
+    }
+    
+    FastBitVector& operator=(const FastBitVector& other)
+    {
+        size_t length = other.arrayLength();
+        uint32_t* newArray = static_cast<uint32_t*>(fastCalloc(length, 4));
+        memcpy(newArray, other.m_array, length * 4);
+        if (m_array)
+            fastFree(m_array);
+        m_array = newArray;
+        m_numBits = other.m_numBits;
+        return *this;
+    }
+    
+    size_t numBits() const { return m_numBits; }
+    
+    void resize(size_t numBits)
+    {
+        // Use fastCalloc instead of fastRealloc because we expect the common
+        // use case for this method to be initializing the size of the bitvector.
+        
+        size_t newLength = (numBits + 31) >> 5;
+        uint32_t* newArray = static_cast<uint32_t*>(fastCalloc(newLength, 4));
+        memcpy(newArray, m_array, arrayLength() * 4);
+        if (m_array)
+            fastFree(m_array);
+        m_array = newArray;
+        m_numBits = numBits;
+    }
+    
+    void setAll()
+    {
+        memset(m_array, 255, arrayLength() * 4);
+    }
+    
+    void clearAll()
+    {
+        memset(m_array, 0, arrayLength() * 4);
+    }
+    
+    void set(const FastBitVector& other)
+    {
+        ASSERT(m_numBits == other.m_numBits);
+        memcpy(m_array, other.m_array, arrayLength() * 4);
+    }
+    
+    bool setAndCheck(const FastBitVector& other)
+    {
+        bool changed = false;
+        ASSERT(m_numBits == other.m_numBits);
+        for (unsigned i = arrayLength(); i--;) {
+            if (m_array[i] == other.m_array[i])
+                continue;
+            m_array[i] = other.m_array[i];
+            changed = true;
+        }
+        return changed;
+    }
+    
+    bool equals(const FastBitVector& other) const
+    {
+        ASSERT(m_numBits == other.m_numBits);
+        // Use my own comparison loop because memcmp does more than what I want
+        // and bcmp is not as standard.
+        for (unsigned i = arrayLength(); i--;) {
+            if (m_array[i] != other.m_array[i])
+                return false;
+        }
+        return true;
+    }
+    
+    void merge(const FastBitVector& other)
+    {
+        ASSERT(m_numBits == other.m_numBits);
+        for (unsigned i = arrayLength(); i--;)
+            m_array[i] |= other.m_array[i];
+    }
+    
+    void filter(const FastBitVector& other)
+    {
+        ASSERT(m_numBits == other.m_numBits);
+        for (unsigned i = arrayLength(); i--;)
+            m_array[i] &= other.m_array[i];
+    }
+    
+    void exclude(const FastBitVector& other)
+    {
+        ASSERT(m_numBits == other.m_numBits);
+        for (unsigned i = arrayLength(); i--;)
+            m_array[i] &= ~other.m_array[i];
+    }
+    
+    void set(size_t i)
+    {
+        ASSERT(i < m_numBits);
+        m_array[i >> 5] |= (1 << (i & 31));
+    }
+    
+    void clear(size_t i)
+    {
+        ASSERT(i < m_numBits);
+        m_array[i >> 5] &= ~(1 << (i & 31));
+    }
+    
+    void set(size_t i, bool value)
+    {
+        if (value)
+            set(i);
+        else
+            clear(i);
+    }
+    
+    bool get(size_t i) const
+    {
+        ASSERT(i < m_numBits);
+        return !!(m_array[i >> 5] & (1 << (i & 31)));
+    }
+private:
+    size_t arrayLength() const { return (m_numBits + 31) >> 5; }
+    
+    uint32_t* m_array; // No, this can't be an OwnArrayPtr.
+    size_t m_numBits;
+};
+
+} // namespace WTF
+
+using WTF::FastBitVector;
+
+#endif // FastBitVector_h
+
diff --git a/Source/WTF/wtf/FastMalloc.cpp b/Source/WTF/wtf/FastMalloc.cpp
new file mode 100644
index 0000000..afa0d4d
--- /dev/null
+++ b/Source/WTF/wtf/FastMalloc.cpp
@@ -0,0 +1,4727 @@
+// Copyright (c) 2005, 2007, Google Inc.
+// All rights reserved.
+// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011 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:
+// 
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * 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.
+//     * 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.
+
+// ---
+// Author: Sanjay Ghemawat <opensource@google.com>
+//
+// A malloc that uses a per-thread cache to satisfy small malloc requests.
+// (The time for malloc/free of a small object drops from 300 ns to 50 ns.)
+//
+// See doc/tcmalloc.html for a high-level
+// description of how this malloc works.
+//
+// SYNCHRONIZATION
+//  1. The thread-specific lists are accessed without acquiring any locks.
+//     This is safe because each such list is only accessed by one thread.
+//  2. We have a lock per central free-list, and hold it while manipulating
+//     the central free list for a particular size.
+//  3. The central page allocator is protected by "pageheap_lock".
+//  4. The pagemap (which maps from page-number to descriptor),
+//     can be read without holding any locks, and written while holding
+//     the "pageheap_lock".
+//  5. To improve performance, a subset of the information one can get
+//     from the pagemap is cached in a data structure, pagemap_cache_,
+//     that atomically reads and writes its entries.  This cache can be
+//     read and written without locking.
+//
+//     This multi-threaded access to the pagemap is safe for fairly
+//     subtle reasons.  We basically assume that when an object X is
+//     allocated by thread A and deallocated by thread B, there must
+//     have been appropriate synchronization in the handoff of object
+//     X from thread A to thread B.  The same logic applies to pagemap_cache_.
+//
+// THE PAGEID-TO-SIZECLASS CACHE
+// Hot PageID-to-sizeclass mappings are held by pagemap_cache_.  If this cache
+// returns 0 for a particular PageID then that means "no information," not that
+// the sizeclass is 0.  The cache may have stale information for pages that do
+// not hold the beginning of any free()'able object.  Staleness is eliminated
+// in Populate() for pages with sizeclass > 0 objects, and in do_malloc() and
+// do_memalign() for all other relevant pages.
+//
+// TODO: Bias reclamation to larger addresses
+// TODO: implement mallinfo/mallopt
+// TODO: Better testing
+//
+// 9/28/2003 (new page-level allocator replaces ptmalloc2):
+// * malloc/free of small objects goes from ~300 ns to ~50 ns.
+// * allocation of a reasonably complicated struct
+//   goes from about 1100 ns to about 300 ns.
+
+#include "config.h"
+#include "FastMalloc.h"
+
+#include "Assertions.h"
+#include <limits>
+#if OS(WINDOWS)
+#include <windows.h>
+#else
+#include <pthread.h>
+#endif
+#include <string.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/UnusedParam.h>
+
+#ifndef NO_TCMALLOC_SAMPLES
+#ifdef WTF_CHANGES
+#define NO_TCMALLOC_SAMPLES
+#endif
+#endif
+
+#if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) && defined(NDEBUG)
+#define FORCE_SYSTEM_MALLOC 0
+#else
+#define FORCE_SYSTEM_MALLOC 1
+#endif
+
+// Use a background thread to periodically scavenge memory to release back to the system
+#if PLATFORM(IOS)
+#define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 0
+#else
+#define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 1
+#endif
+
+#ifndef NDEBUG
+namespace WTF {
+
+#if OS(WINDOWS)
+
+// TLS_OUT_OF_INDEXES is not defined on WinCE.
+#ifndef TLS_OUT_OF_INDEXES
+#define TLS_OUT_OF_INDEXES 0xffffffff
+#endif
+
+static DWORD isForibiddenTlsIndex = TLS_OUT_OF_INDEXES;
+static const LPVOID kTlsAllowValue = reinterpret_cast<LPVOID>(0); // Must be zero.
+static const LPVOID kTlsForbiddenValue = reinterpret_cast<LPVOID>(1);
+
+#if !ASSERT_DISABLED
+static bool isForbidden()
+{
+    // By default, fastMalloc is allowed so we don't allocate the
+    // tls index unless we're asked to make it forbidden. If TlsSetValue
+    // has not been called on a thread, the value returned by TlsGetValue is 0.
+    return (isForibiddenTlsIndex != TLS_OUT_OF_INDEXES) && (TlsGetValue(isForibiddenTlsIndex) == kTlsForbiddenValue);
+}
+#endif
+
+void fastMallocForbid()
+{
+    if (isForibiddenTlsIndex == TLS_OUT_OF_INDEXES)
+        isForibiddenTlsIndex = TlsAlloc(); // a little racey, but close enough for debug only
+    TlsSetValue(isForibiddenTlsIndex, kTlsForbiddenValue);
+}
+
+void fastMallocAllow()
+{
+    if (isForibiddenTlsIndex == TLS_OUT_OF_INDEXES)
+        return;
+    TlsSetValue(isForibiddenTlsIndex, kTlsAllowValue);
+}
+
+#else // !OS(WINDOWS)
+
+static pthread_key_t isForbiddenKey;
+static pthread_once_t isForbiddenKeyOnce = PTHREAD_ONCE_INIT;
+static void initializeIsForbiddenKey()
+{
+  pthread_key_create(&isForbiddenKey, 0);
+}
+
+#if !ASSERT_DISABLED
+static bool isForbidden()
+{
+    pthread_once(&isForbiddenKeyOnce, initializeIsForbiddenKey);
+    return !!pthread_getspecific(isForbiddenKey);
+}
+#endif
+
+void fastMallocForbid()
+{
+    pthread_once(&isForbiddenKeyOnce, initializeIsForbiddenKey);
+    pthread_setspecific(isForbiddenKey, &isForbiddenKey);
+}
+
+void fastMallocAllow()
+{
+    pthread_once(&isForbiddenKeyOnce, initializeIsForbiddenKey);
+    pthread_setspecific(isForbiddenKey, 0);
+}
+#endif // OS(WINDOWS)
+
+} // namespace WTF
+#endif // NDEBUG
+
+namespace WTF {
+
+
+namespace Internal {
+#if !ENABLE(WTF_MALLOC_VALIDATION)
+WTF_EXPORT_PRIVATE void fastMallocMatchFailed(void*);
+#else
+COMPILE_ASSERT(((sizeof(ValidationHeader) % sizeof(AllocAlignmentInteger)) == 0), ValidationHeader_must_produce_correct_alignment);
+#endif
+
+NO_RETURN_DUE_TO_CRASH void fastMallocMatchFailed(void*)
+{
+    CRASH();
+}
+
+} // namespace Internal
+
+
+void* fastZeroedMalloc(size_t n) 
+{
+    void* result = fastMalloc(n);
+    memset(result, 0, n);
+    return result;
+}
+
+char* fastStrDup(const char* src)
+{
+    size_t len = strlen(src) + 1;
+    char* dup = static_cast<char*>(fastMalloc(len));
+    memcpy(dup, src, len);
+    return dup;
+}
+
+TryMallocReturnValue tryFastZeroedMalloc(size_t n) 
+{
+    void* result;
+    if (!tryFastMalloc(n).getValue(result))
+        return 0;
+    memset(result, 0, n);
+    return result;
+}
+
+} // namespace WTF
+
+#if FORCE_SYSTEM_MALLOC
+
+#if OS(DARWIN)
+#include <malloc/malloc.h>
+#elif OS(WINDOWS)
+#include <malloc.h>
+#endif
+
+namespace WTF {
+
+TryMallocReturnValue tryFastMalloc(size_t n) 
+{
+    ASSERT(!isForbidden());
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= n)  // If overflow would occur...
+        return 0;
+
+    void* result = malloc(n + Internal::ValidationBufferSize);
+    if (!result)
+        return 0;
+    Internal::ValidationHeader* header = static_cast<Internal::ValidationHeader*>(result);
+    header->m_size = n;
+    header->m_type = Internal::AllocTypeMalloc;
+    header->m_prefix = static_cast<unsigned>(Internal::ValidationPrefix);
+    result = header + 1;
+    *Internal::fastMallocValidationSuffix(result) = Internal::ValidationSuffix;
+    fastMallocValidate(result);
+    return result;
+#else
+    return malloc(n);
+#endif
+}
+
+void* fastMalloc(size_t n) 
+{
+    ASSERT(!isForbidden());
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    TryMallocReturnValue returnValue = tryFastMalloc(n);
+    void* result;
+    if (!returnValue.getValue(result))
+        CRASH();
+#else
+    void* result = malloc(n);
+#endif
+
+    if (!result)
+        CRASH();
+
+    return result;
+}
+
+TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size)
+{
+    ASSERT(!isForbidden());
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    size_t totalBytes = n_elements * element_size;
+    if (n_elements > 1 && element_size && (totalBytes / element_size) != n_elements)
+        return 0;
+
+    TryMallocReturnValue returnValue = tryFastMalloc(totalBytes);
+    void* result;
+    if (!returnValue.getValue(result))
+        return 0;
+    memset(result, 0, totalBytes);
+    fastMallocValidate(result);
+    return result;
+#else
+    return calloc(n_elements, element_size);
+#endif
+}
+
+void* fastCalloc(size_t n_elements, size_t element_size)
+{
+    ASSERT(!isForbidden());
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    TryMallocReturnValue returnValue = tryFastCalloc(n_elements, element_size);
+    void* result;
+    if (!returnValue.getValue(result))
+        CRASH();
+#else
+    void* result = calloc(n_elements, element_size);
+#endif
+
+    if (!result)
+        CRASH();
+
+    return result;
+}
+
+void fastFree(void* p)
+{
+    ASSERT(!isForbidden());
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    if (!p)
+        return;
+    
+    fastMallocMatchValidateFree(p, Internal::AllocTypeMalloc);
+    Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(p);
+    memset(p, 0xCC, header->m_size);
+    free(header);
+#else
+    free(p);
+#endif
+}
+
+TryMallocReturnValue tryFastRealloc(void* p, size_t n)
+{
+    ASSERT(!isForbidden());
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    if (p) {
+        if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= n)  // If overflow would occur...
+            return 0;
+        fastMallocValidate(p);
+        Internal::ValidationHeader* result = static_cast<Internal::ValidationHeader*>(realloc(Internal::fastMallocValidationHeader(p), n + Internal::ValidationBufferSize));
+        if (!result)
+            return 0;
+        result->m_size = n;
+        result = result + 1;
+        *fastMallocValidationSuffix(result) = Internal::ValidationSuffix;
+        fastMallocValidate(result);
+        return result;
+    } else {
+        return fastMalloc(n);
+    }
+#else
+    return realloc(p, n);
+#endif
+}
+
+void* fastRealloc(void* p, size_t n)
+{
+    ASSERT(!isForbidden());
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    TryMallocReturnValue returnValue = tryFastRealloc(p, n);
+    void* result;
+    if (!returnValue.getValue(result))
+        CRASH();
+#else
+    void* result = realloc(p, n);
+#endif
+
+    if (!result)
+        CRASH();
+    return result;
+}
+
+void releaseFastMallocFreeMemory() { }
+    
+FastMallocStatistics fastMallocStatistics()
+{
+    FastMallocStatistics statistics = { 0, 0, 0 };
+    return statistics;
+}
+
+size_t fastMallocSize(const void* p)
+{
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    return Internal::fastMallocValidationHeader(const_cast<void*>(p))->m_size;
+#elif OS(DARWIN)
+    return malloc_size(p);
+#elif OS(WINDOWS)
+    return _msize(const_cast<void*>(p));
+#else
+    UNUSED_PARAM(p);
+    return 1;
+#endif
+}
+
+} // namespace WTF
+
+#if OS(DARWIN)
+// This symbol is present in the JavaScriptCore exports file even when FastMalloc is disabled.
+// It will never be used in this case, so it's type and value are less interesting than its presence.
+extern "C" WTF_EXPORT_PRIVATE const int jscore_fastmalloc_introspection = 0;
+#endif
+
+#else // FORCE_SYSTEM_MALLOC
+
+#include "AlwaysInline.h"
+#include "TCPackedCache.h"
+#include "TCPageMap.h"
+#include "TCSpinLock.h"
+#include "TCSystemAlloc.h"
+#include <algorithm>
+#include <pthread.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#if HAVE(ERRNO_H)
+#include <errno.h>
+#endif
+#if OS(UNIX)
+#include <unistd.h>
+#endif
+#if OS(WINDOWS)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#endif
+
+#ifdef WTF_CHANGES
+
+#if OS(DARWIN)
+#include "MallocZoneSupport.h"
+#include <wtf/HashSet.h>
+#include <wtf/Vector.h>
+#endif
+
+#if HAVE(HEADER_DETECTION_H)
+#include "HeaderDetection.h"
+#endif
+
+#if HAVE(DISPATCH_H)
+#include <dispatch/dispatch.h>
+#endif
+
+#if HAVE(PTHREAD_MACHDEP_H)
+#include <System/pthread_machdep.h>
+
+#if defined(__PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0)
+#define WTF_USE_PTHREAD_GETSPECIFIC_DIRECT 1
+#endif
+#endif
+
+#ifndef PRIuS
+#define PRIuS "zu"
+#endif
+
+// Calling pthread_getspecific through a global function pointer is faster than a normal
+// call to the function on Mac OS X, and it's used in performance-critical code. So we
+// use a function pointer. But that's not necessarily faster on other platforms, and we had
+// problems with this technique on Windows, so we'll do this only on Mac OS X.
+#if OS(DARWIN)
+#if !USE(PTHREAD_GETSPECIFIC_DIRECT)
+static void* (*pthread_getspecific_function_pointer)(pthread_key_t) = pthread_getspecific;
+#define pthread_getspecific(key) pthread_getspecific_function_pointer(key)
+#else
+#define pthread_getspecific(key) _pthread_getspecific_direct(key)
+#define pthread_setspecific(key, val) _pthread_setspecific_direct(key, (val))
+#endif
+#endif
+
+#define DEFINE_VARIABLE(type, name, value, meaning) \
+  namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##type##_instead {  \
+  type FLAGS_##name(value);                                \
+  char FLAGS_no##name;                                                        \
+  }                                                                           \
+  using FLAG__namespace_do_not_use_directly_use_DECLARE_##type##_instead::FLAGS_##name
+  
+#define DEFINE_int64(name, value, meaning) \
+  DEFINE_VARIABLE(int64_t, name, value, meaning)
+  
+#define DEFINE_double(name, value, meaning) \
+  DEFINE_VARIABLE(double, name, value, meaning)
+
+namespace WTF {
+
+#define malloc fastMalloc
+#define calloc fastCalloc
+#define free fastFree
+#define realloc fastRealloc
+
+#define MESSAGE LOG_ERROR
+#define CHECK_CONDITION ASSERT
+
+#if OS(DARWIN)
+struct Span;
+class TCMalloc_Central_FreeListPadded;
+class TCMalloc_PageHeap;
+class TCMalloc_ThreadCache;
+template <typename T> class PageHeapAllocator;
+
+class FastMallocZone {
+public:
+    static void init();
+
+    static kern_return_t enumerate(task_t, void*, unsigned typeMmask, vm_address_t zoneAddress, memory_reader_t, vm_range_recorder_t);
+    static size_t goodSize(malloc_zone_t*, size_t size) { return size; }
+    static boolean_t check(malloc_zone_t*) { return true; }
+    static void  print(malloc_zone_t*, boolean_t) { }
+    static void log(malloc_zone_t*, void*) { }
+    static void forceLock(malloc_zone_t*) { }
+    static void forceUnlock(malloc_zone_t*) { }
+    static void statistics(malloc_zone_t*, malloc_statistics_t* stats) { memset(stats, 0, sizeof(malloc_statistics_t)); }
+
+private:
+    FastMallocZone(TCMalloc_PageHeap*, TCMalloc_ThreadCache**, TCMalloc_Central_FreeListPadded*, PageHeapAllocator<Span>*, PageHeapAllocator<TCMalloc_ThreadCache>*);
+    static size_t size(malloc_zone_t*, const void*);
+    static void* zoneMalloc(malloc_zone_t*, size_t);
+    static void* zoneCalloc(malloc_zone_t*, size_t numItems, size_t size);
+    static void zoneFree(malloc_zone_t*, void*);
+    static void* zoneRealloc(malloc_zone_t*, void*, size_t);
+    static void* zoneValloc(malloc_zone_t*, size_t) { LOG_ERROR("valloc is not supported"); return 0; }
+    static void zoneDestroy(malloc_zone_t*) { }
+
+    malloc_zone_t m_zone;
+    TCMalloc_PageHeap* m_pageHeap;
+    TCMalloc_ThreadCache** m_threadHeaps;
+    TCMalloc_Central_FreeListPadded* m_centralCaches;
+    PageHeapAllocator<Span>* m_spanAllocator;
+    PageHeapAllocator<TCMalloc_ThreadCache>* m_pageHeapAllocator;
+};
+
+#endif
+
+#endif
+
+#ifndef WTF_CHANGES
+// This #ifdef should almost never be set.  Set NO_TCMALLOC_SAMPLES if
+// you're porting to a system where you really can't get a stacktrace.
+#ifdef NO_TCMALLOC_SAMPLES
+// We use #define so code compiles even if you #include stacktrace.h somehow.
+# define GetStackTrace(stack, depth, skip)  (0)
+#else
+# include <google/stacktrace.h>
+#endif
+#endif
+
+// Even if we have support for thread-local storage in the compiler
+// and linker, the OS may not support it.  We need to check that at
+// runtime.  Right now, we have to keep a manual set of "bad" OSes.
+#if defined(HAVE_TLS)
+  static bool kernel_supports_tls = false;      // be conservative
+  static inline bool KernelSupportsTLS() {
+    return kernel_supports_tls;
+  }
+# if !HAVE_DECL_UNAME   // if too old for uname, probably too old for TLS
+    static void CheckIfKernelSupportsTLS() {
+      kernel_supports_tls = false;
+    }
+# else
+#   include <sys/utsname.h>    // DECL_UNAME checked for <sys/utsname.h> too
+    static void CheckIfKernelSupportsTLS() {
+      struct utsname buf;
+      if (uname(&buf) != 0) {   // should be impossible
+        MESSAGE("uname failed assuming no TLS support (errno=%d)\n", errno);
+        kernel_supports_tls = false;
+      } else if (strcasecmp(buf.sysname, "linux") == 0) {
+        // The linux case: the first kernel to support TLS was 2.6.0
+        if (buf.release[0] < '2' && buf.release[1] == '.')    // 0.x or 1.x
+          kernel_supports_tls = false;
+        else if (buf.release[0] == '2' && buf.release[1] == '.' &&
+                 buf.release[2] >= '0' && buf.release[2] < '6' &&
+                 buf.release[3] == '.')                       // 2.0 - 2.5
+          kernel_supports_tls = false;
+        else
+          kernel_supports_tls = true;
+      } else {        // some other kernel, we'll be optimisitic
+        kernel_supports_tls = true;
+      }
+      // TODO(csilvers): VLOG(1) the tls status once we support RAW_VLOG
+    }
+#  endif  // HAVE_DECL_UNAME
+#endif    // HAVE_TLS
+
+// __THROW is defined in glibc systems.  It means, counter-intuitively,
+// "This function will never throw an exception."  It's an optional
+// optimization tool, but we may need to use it to match glibc prototypes.
+#ifndef __THROW    // I guess we're not on a glibc system
+# define __THROW   // __THROW is just an optimization, so ok to make it ""
+#endif
+
+//-------------------------------------------------------------------
+// Configuration
+//-------------------------------------------------------------------
+
+// Not all possible combinations of the following parameters make
+// sense.  In particular, if kMaxSize increases, you may have to
+// increase kNumClasses as well.
+static const size_t kPageShift  = 12;
+static const size_t kPageSize   = 1 << kPageShift;
+static const size_t kMaxSize    = 8u * kPageSize;
+static const size_t kAlignShift = 3;
+static const size_t kAlignment  = 1 << kAlignShift;
+static const size_t kNumClasses = 68;
+
+// Allocates a big block of memory for the pagemap once we reach more than
+// 128MB
+static const size_t kPageMapBigAllocationThreshold = 128 << 20;
+
+// Minimum number of pages to fetch from system at a time.  Must be
+// significantly bigger than kPageSize to amortize system-call
+// overhead, and also to reduce external fragementation.  Also, we
+// should keep this value big because various incarnations of Linux
+// have small limits on the number of mmap() regions per
+// address-space.
+static const size_t kMinSystemAlloc = 1 << (20 - kPageShift);
+
+// Number of objects to move between a per-thread list and a central
+// list in one shot.  We want this to be not too small so we can
+// amortize the lock overhead for accessing the central list.  Making
+// it too big may temporarily cause unnecessary memory wastage in the
+// per-thread free list until the scavenger cleans up the list.
+static int num_objects_to_move[kNumClasses];
+
+// Maximum length we allow a per-thread free-list to have before we
+// move objects from it into the corresponding central free-list.  We
+// want this big to avoid locking the central free-list too often.  It
+// should not hurt to make this list somewhat big because the
+// scavenging code will shrink it down when its contents are not in use.
+static const int kMaxFreeListLength = 256;
+
+// Lower and upper bounds on the per-thread cache sizes
+static const size_t kMinThreadCacheSize = kMaxSize * 2;
+#if PLATFORM(IOS)
+static const size_t kMaxThreadCacheSize = 512 * 1024;
+#else
+static const size_t kMaxThreadCacheSize = 2 << 20;
+#endif
+
+// Default bound on the total amount of thread caches
+static const size_t kDefaultOverallThreadCacheSize = 16 << 20;
+
+// For all span-lengths < kMaxPages we keep an exact-size list.
+// REQUIRED: kMaxPages >= kMinSystemAlloc;
+static const size_t kMaxPages = kMinSystemAlloc;
+
+/* The smallest prime > 2^n */
+static int primes_list[] = {
+    // Small values might cause high rates of sampling
+    // and hence commented out.
+    // 2, 5, 11, 17, 37, 67, 131, 257,
+    // 521, 1031, 2053, 4099, 8209, 16411,
+    32771, 65537, 131101, 262147, 524309, 1048583,
+    2097169, 4194319, 8388617, 16777259, 33554467 };
+
+// Twice the approximate gap between sampling actions.
+// I.e., we take one sample approximately once every
+//      tcmalloc_sample_parameter/2
+// bytes of allocation, i.e., ~ once every 128KB.
+// Must be a prime number.
+#ifdef NO_TCMALLOC_SAMPLES
+DEFINE_int64(tcmalloc_sample_parameter, 0,
+             "Unused: code is compiled with NO_TCMALLOC_SAMPLES");
+static size_t sample_period = 0;
+#else
+DEFINE_int64(tcmalloc_sample_parameter, 262147,
+         "Twice the approximate gap between sampling actions."
+         " Must be a prime number. Otherwise will be rounded up to a "
+         " larger prime number");
+static size_t sample_period = 262147;
+#endif
+
+// Protects sample_period above
+static SpinLock sample_period_lock = SPINLOCK_INITIALIZER;
+
+// Parameters for controlling how fast memory is returned to the OS.
+
+DEFINE_double(tcmalloc_release_rate, 1,
+              "Rate at which we release unused memory to the system.  "
+              "Zero means we never release memory back to the system.  "
+              "Increase this flag to return memory faster; decrease it "
+              "to return memory slower.  Reasonable rates are in the "
+              "range [0,10]");
+
+//-------------------------------------------------------------------
+// Mapping from size to size_class and vice versa
+//-------------------------------------------------------------------
+
+// Sizes <= 1024 have an alignment >= 8.  So for such sizes we have an
+// array indexed by ceil(size/8).  Sizes > 1024 have an alignment >= 128.
+// So for these larger sizes we have an array indexed by ceil(size/128).
+//
+// We flatten both logical arrays into one physical array and use
+// arithmetic to compute an appropriate index.  The constants used by
+// ClassIndex() were selected to make the flattening work.
+//
+// Examples:
+//   Size       Expression                      Index
+//   -------------------------------------------------------
+//   0          (0 + 7) / 8                     0
+//   1          (1 + 7) / 8                     1
+//   ...
+//   1024       (1024 + 7) / 8                  128
+//   1025       (1025 + 127 + (120<<7)) / 128   129
+//   ...
+//   32768      (32768 + 127 + (120<<7)) / 128  376
+static const size_t kMaxSmallSize = 1024;
+static const int shift_amount[2] = { 3, 7 };  // For divides by 8 or 128
+static const int add_amount[2] = { 7, 127 + (120 << 7) };
+static unsigned char class_array[377];
+
+// Compute index of the class_array[] entry for a given size
+static inline int ClassIndex(size_t s) {
+  const int i = (s > kMaxSmallSize);
+  return static_cast<int>((s + add_amount[i]) >> shift_amount[i]);
+}
+
+// Mapping from size class to max size storable in that class
+static size_t class_to_size[kNumClasses];
+
+// Mapping from size class to number of pages to allocate at a time
+static size_t class_to_pages[kNumClasses];
+
+// TransferCache is used to cache transfers of num_objects_to_move[size_class]
+// back and forth between thread caches and the central cache for a given size
+// class.
+struct TCEntry {
+  void *head;  // Head of chain of objects.
+  void *tail;  // Tail of chain of objects.
+};
+// A central cache freelist can have anywhere from 0 to kNumTransferEntries
+// slots to put link list chains into.  To keep memory usage bounded the total
+// number of TCEntries across size classes is fixed.  Currently each size
+// class is initially given one TCEntry which also means that the maximum any
+// one class can have is kNumClasses.
+static const int kNumTransferEntries = kNumClasses;
+
+// Note: the following only works for "n"s that fit in 32-bits, but
+// that is fine since we only use it for small sizes.
+static inline int LgFloor(size_t n) {
+  int log = 0;
+  for (int i = 4; i >= 0; --i) {
+    int shift = (1 << i);
+    size_t x = n >> shift;
+    if (x != 0) {
+      n = x;
+      log += shift;
+    }
+  }
+  ASSERT(n == 1);
+  return log;
+}
+
+// Some very basic linked list functions for dealing with using void * as
+// storage.
+
+static inline void *SLL_Next(void *t) {
+  return *(reinterpret_cast<void**>(t));
+}
+
+static inline void SLL_SetNext(void *t, void *n) {
+  *(reinterpret_cast<void**>(t)) = n;
+}
+
+static inline void SLL_Push(void **list, void *element) {
+  SLL_SetNext(element, *list);
+  *list = element;
+}
+
+static inline void *SLL_Pop(void **list) {
+  void *result = *list;
+  *list = SLL_Next(*list);
+  return result;
+}
+
+
+// Remove N elements from a linked list to which head points.  head will be
+// modified to point to the new head.  start and end will point to the first
+// and last nodes of the range.  Note that end will point to NULL after this
+// function is called.
+static inline void SLL_PopRange(void **head, int N, void **start, void **end) {
+  if (N == 0) {
+    *start = NULL;
+    *end = NULL;
+    return;
+  }
+
+  void *tmp = *head;
+  for (int i = 1; i < N; ++i) {
+    tmp = SLL_Next(tmp);
+  }
+
+  *start = *head;
+  *end = tmp;
+  *head = SLL_Next(tmp);
+  // Unlink range from list.
+  SLL_SetNext(tmp, NULL);
+}
+
+static inline void SLL_PushRange(void **head, void *start, void *end) {
+  if (!start) return;
+  SLL_SetNext(end, *head);
+  *head = start;
+}
+
+static inline size_t SLL_Size(void *head) {
+  int count = 0;
+  while (head) {
+    count++;
+    head = SLL_Next(head);
+  }
+  return count;
+}
+
+// Setup helper functions.
+
+static ALWAYS_INLINE size_t SizeClass(size_t size) {
+  return class_array[ClassIndex(size)];
+}
+
+// Get the byte-size for a specified class
+static ALWAYS_INLINE size_t ByteSizeForClass(size_t cl) {
+  return class_to_size[cl];
+}
+static int NumMoveSize(size_t size) {
+  if (size == 0) return 0;
+  // Use approx 64k transfers between thread and central caches.
+  int num = static_cast<int>(64.0 * 1024.0 / size);
+  if (num < 2) num = 2;
+  // Clamp well below kMaxFreeListLength to avoid ping pong between central
+  // and thread caches.
+  if (num > static_cast<int>(0.8 * kMaxFreeListLength))
+    num = static_cast<int>(0.8 * kMaxFreeListLength);
+
+  // Also, avoid bringing in too many objects into small object free
+  // lists.  There are lots of such lists, and if we allow each one to
+  // fetch too many at a time, we end up having to scavenge too often
+  // (especially when there are lots of threads and each thread gets a
+  // small allowance for its thread cache).
+  //
+  // TODO: Make thread cache free list sizes dynamic so that we do not
+  // have to equally divide a fixed resource amongst lots of threads.
+  if (num > 32) num = 32;
+
+  return num;
+}
+
+// Initialize the mapping arrays
+static void InitSizeClasses() {
+  // Do some sanity checking on add_amount[]/shift_amount[]/class_array[]
+  if (ClassIndex(0) < 0) {
+    MESSAGE("Invalid class index %d for size 0\n", ClassIndex(0));
+    CRASH();
+  }
+  if (static_cast<size_t>(ClassIndex(kMaxSize)) >= sizeof(class_array)) {
+    MESSAGE("Invalid class index %d for kMaxSize\n", ClassIndex(kMaxSize));
+    CRASH();
+  }
+
+  // Compute the size classes we want to use
+  size_t sc = 1;   // Next size class to assign
+  unsigned char alignshift = kAlignShift;
+  int last_lg = -1;
+  for (size_t size = kAlignment; size <= kMaxSize; size += (1 << alignshift)) {
+    int lg = LgFloor(size);
+    if (lg > last_lg) {
+      // Increase alignment every so often.
+      //
+      // Since we double the alignment every time size doubles and
+      // size >= 128, this means that space wasted due to alignment is
+      // at most 16/128 i.e., 12.5%.  Plus we cap the alignment at 256
+      // bytes, so the space wasted as a percentage starts falling for
+      // sizes > 2K.
+      if ((lg >= 7) && (alignshift < 8)) {
+        alignshift++;
+      }
+      last_lg = lg;
+    }
+
+    // Allocate enough pages so leftover is less than 1/8 of total.
+    // This bounds wasted space to at most 12.5%.
+    size_t psize = kPageSize;
+    while ((psize % size) > (psize >> 3)) {
+      psize += kPageSize;
+    }
+    const size_t my_pages = psize >> kPageShift;
+
+    if (sc > 1 && my_pages == class_to_pages[sc-1]) {
+      // See if we can merge this into the previous class without
+      // increasing the fragmentation of the previous class.
+      const size_t my_objects = (my_pages << kPageShift) / size;
+      const size_t prev_objects = (class_to_pages[sc-1] << kPageShift)
+                                  / class_to_size[sc-1];
+      if (my_objects == prev_objects) {
+        // Adjust last class to include this size
+        class_to_size[sc-1] = size;
+        continue;
+      }
+    }
+
+    // Add new class
+    class_to_pages[sc] = my_pages;
+    class_to_size[sc] = size;
+    sc++;
+  }
+  if (sc != kNumClasses) {
+    MESSAGE("wrong number of size classes: found %" PRIuS " instead of %d\n",
+            sc, int(kNumClasses));
+    CRASH();
+  }
+
+  // Initialize the mapping arrays
+  int next_size = 0;
+  for (unsigned char c = 1; c < kNumClasses; c++) {
+    const size_t max_size_in_class = class_to_size[c];
+    for (size_t s = next_size; s <= max_size_in_class; s += kAlignment) {
+      class_array[ClassIndex(s)] = c;
+    }
+    next_size = static_cast<int>(max_size_in_class + kAlignment);
+  }
+
+  // Double-check sizes just to be safe
+  for (size_t size = 0; size <= kMaxSize; size++) {
+    const size_t sc = SizeClass(size);
+    if (sc == 0) {
+      MESSAGE("Bad size class %" PRIuS " for %" PRIuS "\n", sc, size);
+      CRASH();
+    }
+    if (sc > 1 && size <= class_to_size[sc-1]) {
+      MESSAGE("Allocating unnecessarily large class %" PRIuS " for %" PRIuS
+              "\n", sc, size);
+      CRASH();
+    }
+    if (sc >= kNumClasses) {
+      MESSAGE("Bad size class %" PRIuS " for %" PRIuS "\n", sc, size);
+      CRASH();
+    }
+    const size_t s = class_to_size[sc];
+    if (size > s) {
+     MESSAGE("Bad size %" PRIuS " for %" PRIuS " (sc = %" PRIuS ")\n", s, size, sc);
+      CRASH();
+    }
+    if (s == 0) {
+      MESSAGE("Bad size %" PRIuS " for %" PRIuS " (sc = %" PRIuS ")\n", s, size, sc);
+      CRASH();
+    }
+  }
+
+  // Initialize the num_objects_to_move array.
+  for (size_t cl = 1; cl  < kNumClasses; ++cl) {
+    num_objects_to_move[cl] = NumMoveSize(ByteSizeForClass(cl));
+  }
+
+#ifndef WTF_CHANGES
+  if (false) {
+    // Dump class sizes and maximum external wastage per size class
+    for (size_t cl = 1; cl  < kNumClasses; ++cl) {
+      const int alloc_size = class_to_pages[cl] << kPageShift;
+      const int alloc_objs = alloc_size / class_to_size[cl];
+      const int min_used = (class_to_size[cl-1] + 1) * alloc_objs;
+      const int max_waste = alloc_size - min_used;
+      MESSAGE("SC %3d [ %8d .. %8d ] from %8d ; %2.0f%% maxwaste\n",
+              int(cl),
+              int(class_to_size[cl-1] + 1),
+              int(class_to_size[cl]),
+              int(class_to_pages[cl] << kPageShift),
+              max_waste * 100.0 / alloc_size
+              );
+    }
+  }
+#endif
+}
+
+// -------------------------------------------------------------------------
+// Simple allocator for objects of a specified type.  External locking
+// is required before accessing one of these objects.
+// -------------------------------------------------------------------------
+
+// Metadata allocator -- keeps stats about how many bytes allocated
+static uint64_t metadata_system_bytes = 0;
+static void* MetaDataAlloc(size_t bytes) {
+  void* result = TCMalloc_SystemAlloc(bytes, 0);
+  if (result != NULL) {
+    metadata_system_bytes += bytes;
+  }
+  return result;
+}
+
+template <class T>
+class PageHeapAllocator {
+ private:
+  // How much to allocate from system at a time
+  static const size_t kAllocIncrement = 32 << 10;
+
+  // Aligned size of T
+  static const size_t kAlignedSize
+  = (((sizeof(T) + kAlignment - 1) / kAlignment) * kAlignment);
+
+  // Free area from which to carve new objects
+  char* free_area_;
+  size_t free_avail_;
+
+  // Linked list of all regions allocated by this allocator
+  void* allocated_regions_;
+
+  // Free list of already carved objects
+  void* free_list_;
+
+  // Number of allocated but unfreed objects
+  int inuse_;
+
+ public:
+  void Init() {
+    ASSERT(kAlignedSize <= kAllocIncrement);
+    inuse_ = 0;
+    allocated_regions_ = 0;
+    free_area_ = NULL;
+    free_avail_ = 0;
+    free_list_ = NULL;
+  }
+
+  T* New() {
+    // Consult free list
+    void* result;
+    if (free_list_ != NULL) {
+      result = free_list_;
+      free_list_ = *(reinterpret_cast<void**>(result));
+    } else {
+      if (free_avail_ < kAlignedSize) {
+        // Need more room
+        char* new_allocation = reinterpret_cast<char*>(MetaDataAlloc(kAllocIncrement));
+        if (!new_allocation)
+          CRASH();
+
+        *reinterpret_cast_ptr<void**>(new_allocation) = allocated_regions_;
+        allocated_regions_ = new_allocation;
+        free_area_ = new_allocation + kAlignedSize;
+        free_avail_ = kAllocIncrement - kAlignedSize;
+      }
+      result = free_area_;
+      free_area_ += kAlignedSize;
+      free_avail_ -= kAlignedSize;
+    }
+    inuse_++;
+    return reinterpret_cast<T*>(result);
+  }
+
+  void Delete(T* p) {
+    *(reinterpret_cast<void**>(p)) = free_list_;
+    free_list_ = p;
+    inuse_--;
+  }
+
+  int inuse() const { return inuse_; }
+
+#if defined(WTF_CHANGES) && OS(DARWIN)
+  template <class Recorder>
+  void recordAdministrativeRegions(Recorder& recorder, const RemoteMemoryReader& reader)
+  {
+      for (void* adminAllocation = allocated_regions_; adminAllocation; adminAllocation = reader.nextEntryInLinkedList(reinterpret_cast<void**>(adminAllocation)))
+          recorder.recordRegion(reinterpret_cast<vm_address_t>(adminAllocation), kAllocIncrement);
+  }
+#endif
+};
+
+// -------------------------------------------------------------------------
+// Span - a contiguous run of pages
+// -------------------------------------------------------------------------
+
+// Type that can hold a page number
+typedef uintptr_t PageID;
+
+// Type that can hold the length of a run of pages
+typedef uintptr_t Length;
+
+static const Length kMaxValidPages = (~static_cast<Length>(0)) >> kPageShift;
+
+// Convert byte size into pages.  This won't overflow, but may return
+// an unreasonably large value if bytes is huge enough.
+static inline Length pages(size_t bytes) {
+  return (bytes >> kPageShift) +
+      ((bytes & (kPageSize - 1)) > 0 ? 1 : 0);
+}
+
+// Convert a user size into the number of bytes that will actually be
+// allocated
+static size_t AllocationSize(size_t bytes) {
+  if (bytes > kMaxSize) {
+    // Large object: we allocate an integral number of pages
+    ASSERT(bytes <= (kMaxValidPages << kPageShift));
+    return pages(bytes) << kPageShift;
+  } else {
+    // Small object: find the size class to which it belongs
+    return ByteSizeForClass(SizeClass(bytes));
+  }
+}
+
+// Information kept for a span (a contiguous run of pages).
+struct Span {
+  PageID        start;          // Starting page number
+  Length        length;         // Number of pages in span
+  Span*         next;           // Used when in link list
+  Span*         prev;           // Used when in link list
+  void*         objects;        // Linked list of free objects
+  unsigned int  free : 1;       // Is the span free
+#ifndef NO_TCMALLOC_SAMPLES
+  unsigned int  sample : 1;     // Sampled object?
+#endif
+  unsigned int  sizeclass : 8;  // Size-class for small objects (or 0)
+  unsigned int  refcount : 11;  // Number of non-free objects
+  bool decommitted : 1;
+
+#undef SPAN_HISTORY
+#ifdef SPAN_HISTORY
+  // For debugging, we can keep a log events per span
+  int nexthistory;
+  char history[64];
+  int value[64];
+#endif
+};
+
+#define ASSERT_SPAN_COMMITTED(span) ASSERT(!span->decommitted)
+
+#ifdef SPAN_HISTORY
+void Event(Span* span, char op, int v = 0) {
+  span->history[span->nexthistory] = op;
+  span->value[span->nexthistory] = v;
+  span->nexthistory++;
+  if (span->nexthistory == sizeof(span->history)) span->nexthistory = 0;
+}
+#else
+#define Event(s,o,v) ((void) 0)
+#endif
+
+// Allocator/deallocator for spans
+static PageHeapAllocator<Span> span_allocator;
+static Span* NewSpan(PageID p, Length len) {
+  Span* result = span_allocator.New();
+  memset(result, 0, sizeof(*result));
+  result->start = p;
+  result->length = len;
+#ifdef SPAN_HISTORY
+  result->nexthistory = 0;
+#endif
+  return result;
+}
+
+static inline void DeleteSpan(Span* span) {
+#ifndef NDEBUG
+  // In debug mode, trash the contents of deleted Spans
+  memset(span, 0x3f, sizeof(*span));
+#endif
+  span_allocator.Delete(span);
+}
+
+// -------------------------------------------------------------------------
+// Doubly linked list of spans.
+// -------------------------------------------------------------------------
+
+static inline void DLL_Init(Span* list) {
+  list->next = list;
+  list->prev = list;
+}
+
+static inline void DLL_Remove(Span* span) {
+  span->prev->next = span->next;
+  span->next->prev = span->prev;
+  span->prev = NULL;
+  span->next = NULL;
+}
+
+static ALWAYS_INLINE bool DLL_IsEmpty(const Span* list) {
+  return list->next == list;
+}
+
+static int DLL_Length(const Span* list) {
+  int result = 0;
+  for (Span* s = list->next; s != list; s = s->next) {
+    result++;
+  }
+  return result;
+}
+
+#if 0 /* Not needed at the moment -- causes compiler warnings if not used */
+static void DLL_Print(const char* label, const Span* list) {
+  MESSAGE("%-10s %p:", label, list);
+  for (const Span* s = list->next; s != list; s = s->next) {
+    MESSAGE(" <%p,%u,%u>", s, s->start, s->length);
+  }
+  MESSAGE("\n");
+}
+#endif
+
+static inline void DLL_Prepend(Span* list, Span* span) {
+  ASSERT(span->next == NULL);
+  ASSERT(span->prev == NULL);
+  span->next = list->next;
+  span->prev = list;
+  list->next->prev = span;
+  list->next = span;
+}
+
+// -------------------------------------------------------------------------
+// Stack traces kept for sampled allocations
+//   The following state is protected by pageheap_lock_.
+// -------------------------------------------------------------------------
+
+// size/depth are made the same size as a pointer so that some generic
+// code below can conveniently cast them back and forth to void*.
+static const int kMaxStackDepth = 31;
+struct StackTrace {
+  uintptr_t size;          // Size of object
+  uintptr_t depth;         // Number of PC values stored in array below
+  void*     stack[kMaxStackDepth];
+};
+static PageHeapAllocator<StackTrace> stacktrace_allocator;
+static Span sampled_objects;
+
+// -------------------------------------------------------------------------
+// Map from page-id to per-page data
+// -------------------------------------------------------------------------
+
+// We use PageMap2<> for 32-bit and PageMap3<> for 64-bit machines.
+// We also use a simple one-level cache for hot PageID-to-sizeclass mappings,
+// because sometimes the sizeclass is all the information we need.
+
+// Selector class -- general selector uses 3-level map
+template <int BITS> class MapSelector {
+ public:
+  typedef TCMalloc_PageMap3<BITS-kPageShift> Type;
+  typedef PackedCache<BITS, uint64_t> CacheType;
+};
+
+#if defined(WTF_CHANGES)
+#if CPU(X86_64)
+// On all known X86-64 platforms, the upper 16 bits are always unused and therefore 
+// can be excluded from the PageMap key.
+// See http://en.wikipedia.org/wiki/X86-64#Virtual_address_space_details
+
+static const size_t kBitsUnusedOn64Bit = 16;
+#else
+static const size_t kBitsUnusedOn64Bit = 0;
+#endif
+
+// A three-level map for 64-bit machines
+template <> class MapSelector<64> {
+ public:
+  typedef TCMalloc_PageMap3<64 - kPageShift - kBitsUnusedOn64Bit> Type;
+  typedef PackedCache<64, uint64_t> CacheType;
+};
+#endif
+
+// A two-level map for 32-bit machines
+template <> class MapSelector<32> {
+ public:
+  typedef TCMalloc_PageMap2<32 - kPageShift> Type;
+  typedef PackedCache<32 - kPageShift, uint16_t> CacheType;
+};
+
+// -------------------------------------------------------------------------
+// Page-level allocator
+//  * Eager coalescing
+//
+// Heap for page-level allocation.  We allow allocating and freeing a
+// contiguous runs of pages (called a "span").
+// -------------------------------------------------------------------------
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+// The page heap maintains a free list for spans that are no longer in use by
+// the central cache or any thread caches. We use a background thread to
+// periodically scan the free list and release a percentage of it back to the OS.
+
+// If free_committed_pages_ exceeds kMinimumFreeCommittedPageCount, the
+// background thread:
+//     - wakes up
+//     - pauses for kScavengeDelayInSeconds
+//     - returns to the OS a percentage of the memory that remained unused during
+//       that pause (kScavengePercentage * min_free_committed_pages_since_last_scavenge_)
+// The goal of this strategy is to reduce memory pressure in a timely fashion
+// while avoiding thrashing the OS allocator.
+
+// Time delay before the page heap scavenger will consider returning pages to
+// the OS.
+static const int kScavengeDelayInSeconds = 2;
+
+// Approximate percentage of free committed pages to return to the OS in one
+// scavenge.
+static const float kScavengePercentage = .5f;
+
+// number of span lists to keep spans in when memory is returned.
+static const int kMinSpanListsWithSpans = 32;
+
+// Number of free committed pages that we want to keep around.  The minimum number of pages used when there
+// is 1 span in each of the first kMinSpanListsWithSpans spanlists.  Currently 528 pages.
+static const size_t kMinimumFreeCommittedPageCount = kMinSpanListsWithSpans * ((1.0f+kMinSpanListsWithSpans) / 2.0f);
+
+#endif
+
+static SpinLock pageheap_lock = SPINLOCK_INITIALIZER;
+
+class TCMalloc_PageHeap {
+ public:
+  void init();
+
+  // Allocate a run of "n" pages.  Returns zero if out of memory.
+  Span* New(Length n);
+
+  // Delete the span "[p, p+n-1]".
+  // REQUIRES: span was returned by earlier call to New() and
+  //           has not yet been deleted.
+  void Delete(Span* span);
+
+  // Mark an allocated span as being used for small objects of the
+  // specified size-class.
+  // REQUIRES: span was returned by an earlier call to New()
+  //           and has not yet been deleted.
+  void RegisterSizeClass(Span* span, size_t sc);
+
+  // Split an allocated span into two spans: one of length "n" pages
+  // followed by another span of length "span->length - n" pages.
+  // Modifies "*span" to point to the first span of length "n" pages.
+  // Returns a pointer to the second span.
+  //
+  // REQUIRES: "0 < n < span->length"
+  // REQUIRES: !span->free
+  // REQUIRES: span->sizeclass == 0
+  Span* Split(Span* span, Length n);
+
+  // Return the descriptor for the specified page.
+  inline Span* GetDescriptor(PageID p) const {
+    return reinterpret_cast<Span*>(pagemap_.get(p));
+  }
+
+#ifdef WTF_CHANGES
+  inline Span* GetDescriptorEnsureSafe(PageID p)
+  {
+      pagemap_.Ensure(p, 1);
+      return GetDescriptor(p);
+  }
+    
+  size_t ReturnedBytes() const;
+#endif
+
+  // Dump state to stderr
+#ifndef WTF_CHANGES
+  void Dump(TCMalloc_Printer* out);
+#endif
+
+  // Return number of bytes allocated from system
+  inline uint64_t SystemBytes() const { return system_bytes_; }
+
+  // Return number of free bytes in heap
+  uint64_t FreeBytes() const {
+    return (static_cast<uint64_t>(free_pages_) << kPageShift);
+  }
+
+  bool Check();
+  size_t CheckList(Span* list, Length min_pages, Length max_pages, bool decommitted);
+
+  // Release all pages on the free list for reuse by the OS:
+  void ReleaseFreePages();
+  void ReleaseFreeList(Span*, Span*);
+
+  // Return 0 if we have no information, or else the correct sizeclass for p.
+  // Reads and writes to pagemap_cache_ do not require locking.
+  // The entries are 64 bits on 64-bit hardware and 16 bits on
+  // 32-bit hardware, and we don't mind raciness as long as each read of
+  // an entry yields a valid entry, not a partially updated entry.
+  size_t GetSizeClassIfCached(PageID p) const {
+    return pagemap_cache_.GetOrDefault(p, 0);
+  }
+  void CacheSizeClass(PageID p, size_t cl) const { pagemap_cache_.Put(p, cl); }
+
+ private:
+  // Pick the appropriate map and cache types based on pointer size
+  typedef MapSelector<8*sizeof(uintptr_t)>::Type PageMap;
+  typedef MapSelector<8*sizeof(uintptr_t)>::CacheType PageMapCache;
+  PageMap pagemap_;
+  mutable PageMapCache pagemap_cache_;
+
+  // We segregate spans of a given size into two circular linked
+  // lists: one for normal spans, and one for spans whose memory
+  // has been returned to the system.
+  struct SpanList {
+    Span        normal;
+    Span        returned;
+  };
+
+  // List of free spans of length >= kMaxPages
+  SpanList large_;
+
+  // Array mapping from span length to a doubly linked list of free spans
+  SpanList free_[kMaxPages];
+
+  // Number of pages kept in free lists
+  uintptr_t free_pages_;
+
+  // Bytes allocated from system
+  uint64_t system_bytes_;
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+  // Number of pages kept in free lists that are still committed.
+  Length free_committed_pages_;
+
+  // Minimum number of free committed pages since last scavenge. (Can be 0 if
+  // we've committed new pages since the last scavenge.)
+  Length min_free_committed_pages_since_last_scavenge_;
+#endif
+
+  bool GrowHeap(Length n);
+
+  // REQUIRES   span->length >= n
+  // Remove span from its free list, and move any leftover part of
+  // span into appropriate free lists.  Also update "span" to have
+  // length exactly "n" and mark it as non-free so it can be returned
+  // to the client.
+  //
+  // "released" is true iff "span" was found on a "returned" list.
+  void Carve(Span* span, Length n, bool released);
+
+  void RecordSpan(Span* span) {
+    pagemap_.set(span->start, span);
+    if (span->length > 1) {
+      pagemap_.set(span->start + span->length - 1, span);
+    }
+  }
+  
+    // Allocate a large span of length == n.  If successful, returns a
+  // span of exactly the specified length.  Else, returns NULL.
+  Span* AllocLarge(Length n);
+
+#if !USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+  // Incrementally release some memory to the system.
+  // IncrementalScavenge(n) is called whenever n pages are freed.
+  void IncrementalScavenge(Length n);
+#endif
+
+  // Number of pages to deallocate before doing more scavenging
+  int64_t scavenge_counter_;
+
+  // Index of last free list we scavenged
+  size_t scavenge_index_;
+  
+#if defined(WTF_CHANGES) && OS(DARWIN)
+  friend class FastMallocZone;
+#endif
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+  void initializeScavenger();
+  ALWAYS_INLINE void signalScavenger();
+  void scavenge();
+  ALWAYS_INLINE bool shouldScavenge() const;
+
+#if HAVE(DISPATCH_H) || OS(WINDOWS)
+  void periodicScavenge();
+  ALWAYS_INLINE bool isScavengerSuspended();
+  ALWAYS_INLINE void scheduleScavenger();
+  ALWAYS_INLINE void rescheduleScavenger();
+  ALWAYS_INLINE void suspendScavenger();
+#endif
+
+#if HAVE(DISPATCH_H)
+  dispatch_queue_t m_scavengeQueue;
+  dispatch_source_t m_scavengeTimer;
+  bool m_scavengingSuspended;
+#elif OS(WINDOWS)
+  static void CALLBACK scavengerTimerFired(void*, BOOLEAN);
+  HANDLE m_scavengeQueueTimer;
+#else 
+  static NO_RETURN_WITH_VALUE void* runScavengerThread(void*);
+  NO_RETURN void scavengerThread();
+
+  // Keeps track of whether the background thread is actively scavenging memory every kScavengeDelayInSeconds, or
+  // it's blocked waiting for more pages to be deleted.
+  bool m_scavengeThreadActive;
+
+  pthread_mutex_t m_scavengeMutex;
+  pthread_cond_t m_scavengeCondition;
+#endif
+
+#endif  // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+};
+
+void TCMalloc_PageHeap::init()
+{
+  pagemap_.init(MetaDataAlloc);
+  pagemap_cache_ = PageMapCache(0);
+  free_pages_ = 0;
+  system_bytes_ = 0;
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+  free_committed_pages_ = 0;
+  min_free_committed_pages_since_last_scavenge_ = 0;
+#endif  // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+
+  scavenge_counter_ = 0;
+  // Start scavenging at kMaxPages list
+  scavenge_index_ = kMaxPages-1;
+  COMPILE_ASSERT(kNumClasses <= (1 << PageMapCache::kValuebits), valuebits);
+  DLL_Init(&large_.normal);
+  DLL_Init(&large_.returned);
+  for (size_t i = 0; i < kMaxPages; i++) {
+    DLL_Init(&free_[i].normal);
+    DLL_Init(&free_[i].returned);
+  }
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+  initializeScavenger();
+#endif  // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+}
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+
+#if HAVE(DISPATCH_H)
+
+void TCMalloc_PageHeap::initializeScavenger()
+{
+    m_scavengeQueue = dispatch_queue_create("com.apple.JavaScriptCore.FastMallocSavenger", NULL);
+    m_scavengeTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, m_scavengeQueue);
+    dispatch_time_t startTime = dispatch_time(DISPATCH_TIME_NOW, kScavengeDelayInSeconds * NSEC_PER_SEC);
+    dispatch_source_set_timer(m_scavengeTimer, startTime, kScavengeDelayInSeconds * NSEC_PER_SEC, 1000 * NSEC_PER_USEC);
+    dispatch_source_set_event_handler(m_scavengeTimer, ^{ periodicScavenge(); });
+    m_scavengingSuspended = true;
+}
+
+ALWAYS_INLINE bool TCMalloc_PageHeap::isScavengerSuspended()
+{
+    ASSERT(pageheap_lock.IsHeld());
+    return m_scavengingSuspended;
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::scheduleScavenger()
+{
+    ASSERT(pageheap_lock.IsHeld());
+    m_scavengingSuspended = false;
+    dispatch_resume(m_scavengeTimer);
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::rescheduleScavenger()
+{
+    // Nothing to do here for libdispatch.
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::suspendScavenger()
+{
+    ASSERT(pageheap_lock.IsHeld());
+    m_scavengingSuspended = true;
+    dispatch_suspend(m_scavengeTimer);
+}
+
+#elif OS(WINDOWS)
+
+void TCMalloc_PageHeap::scavengerTimerFired(void* context, BOOLEAN)
+{
+    static_cast<TCMalloc_PageHeap*>(context)->periodicScavenge();
+}
+
+void TCMalloc_PageHeap::initializeScavenger()
+{
+    m_scavengeQueueTimer = 0;
+}
+
+ALWAYS_INLINE bool TCMalloc_PageHeap::isScavengerSuspended()
+{
+    ASSERT(pageheap_lock.IsHeld());
+    return !m_scavengeQueueTimer;
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::scheduleScavenger()
+{
+    // We need to use WT_EXECUTEONLYONCE here and reschedule the timer, because
+    // Windows will fire the timer event even when the function is already running.
+    ASSERT(pageheap_lock.IsHeld());
+    CreateTimerQueueTimer(&m_scavengeQueueTimer, 0, scavengerTimerFired, this, kScavengeDelayInSeconds * 1000, 0, WT_EXECUTEONLYONCE);
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::rescheduleScavenger()
+{
+    // We must delete the timer and create it again, because it is not possible to retrigger a timer on Windows.
+    suspendScavenger();
+    scheduleScavenger();
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::suspendScavenger()
+{
+    ASSERT(pageheap_lock.IsHeld());
+    HANDLE scavengeQueueTimer = m_scavengeQueueTimer;
+    m_scavengeQueueTimer = 0;
+    DeleteTimerQueueTimer(0, scavengeQueueTimer, 0);
+}
+
+#else
+
+void TCMalloc_PageHeap::initializeScavenger()
+{
+    // Create a non-recursive mutex.
+#if !defined(PTHREAD_MUTEX_NORMAL) || PTHREAD_MUTEX_NORMAL == PTHREAD_MUTEX_DEFAULT
+    pthread_mutex_init(&m_scavengeMutex, 0);
+#else
+    pthread_mutexattr_t attr;
+    pthread_mutexattr_init(&attr);
+    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
+
+    pthread_mutex_init(&m_scavengeMutex, &attr);
+
+    pthread_mutexattr_destroy(&attr);
+#endif
+
+    pthread_cond_init(&m_scavengeCondition, 0);
+    m_scavengeThreadActive = true;
+    pthread_t thread;
+    pthread_create(&thread, 0, runScavengerThread, this);
+}
+
+void* TCMalloc_PageHeap::runScavengerThread(void* context)
+{
+    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
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger()
+{
+    // shouldScavenge() should be called only when the pageheap_lock spinlock is held, additionally, 
+    // m_scavengeThreadActive is only set to false whilst pageheap_lock is held. The caller must ensure this is
+    // taken prior to calling this method. If the scavenger thread is sleeping and shouldScavenge() indicates there
+    // is memory to free the scavenger thread is signalled to start.
+    ASSERT(pageheap_lock.IsHeld());
+    if (!m_scavengeThreadActive && shouldScavenge())
+        pthread_cond_signal(&m_scavengeCondition);
+}
+
+#endif
+
+void TCMalloc_PageHeap::scavenge()
+{
+    size_t pagesToRelease = min_free_committed_pages_since_last_scavenge_ * kScavengePercentage;
+    size_t targetPageCount = std::max<size_t>(kMinimumFreeCommittedPageCount, free_committed_pages_ - pagesToRelease);
+
+    Length lastFreeCommittedPages = free_committed_pages_;
+    while (free_committed_pages_ > targetPageCount) {
+        ASSERT(Check());
+        for (int i = kMaxPages; i > 0 && free_committed_pages_ >= targetPageCount; i--) {
+            SpanList* slist = (static_cast<size_t>(i) == kMaxPages) ? &large_ : &free_[i];
+            // If the span size is bigger than kMinSpanListsWithSpans pages return all the spans in the list, else return all but 1 span.  
+            // Return only 50% of a spanlist at a time so spans of size 1 are not the only ones left.
+            size_t length = DLL_Length(&slist->normal);
+            size_t numSpansToReturn = (i > kMinSpanListsWithSpans) ? length : length / 2;
+            for (int j = 0; static_cast<size_t>(j) < numSpansToReturn && !DLL_IsEmpty(&slist->normal) && free_committed_pages_ > targetPageCount; j++) {
+                Span* s = slist->normal.prev; 
+                DLL_Remove(s);
+                ASSERT(!s->decommitted);
+                if (!s->decommitted) {
+                    TCMalloc_SystemRelease(reinterpret_cast<void*>(s->start << kPageShift),
+                                           static_cast<size_t>(s->length << kPageShift));
+                    ASSERT(free_committed_pages_ >= s->length);
+                    free_committed_pages_ -= s->length;
+                    s->decommitted = true;
+                }
+                DLL_Prepend(&slist->returned, s);
+            }
+        }
+
+        if (lastFreeCommittedPages == free_committed_pages_)
+            break;
+        lastFreeCommittedPages = free_committed_pages_;
+    }
+
+    min_free_committed_pages_since_last_scavenge_ = free_committed_pages_;
+}
+
+ALWAYS_INLINE bool TCMalloc_PageHeap::shouldScavenge() const 
+{
+    return free_committed_pages_ > kMinimumFreeCommittedPageCount; 
+}
+
+#endif  // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+
+inline Span* TCMalloc_PageHeap::New(Length n) {
+  ASSERT(Check());
+  ASSERT(n > 0);
+
+  // Find first size >= n that has a non-empty list
+  for (Length s = n; s < kMaxPages; s++) {
+    Span* ll = NULL;
+    bool released = false;
+    if (!DLL_IsEmpty(&free_[s].normal)) {
+      // Found normal span
+      ll = &free_[s].normal;
+    } else if (!DLL_IsEmpty(&free_[s].returned)) {
+      // Found returned span; reallocate it
+      ll = &free_[s].returned;
+      released = true;
+    } else {
+      // Keep looking in larger classes
+      continue;
+    }
+
+    Span* result = ll->next;
+    Carve(result, n, released);
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+    // The newly allocated memory is from a span that's in the normal span list (already committed).  Update the
+    // free committed pages count.
+    ASSERT(free_committed_pages_ >= n);
+    free_committed_pages_ -= n;
+    if (free_committed_pages_ < min_free_committed_pages_since_last_scavenge_) 
+      min_free_committed_pages_since_last_scavenge_ = free_committed_pages_;
+#endif  // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+    ASSERT(Check());
+    free_pages_ -= n;
+    return result;
+  }
+
+  Span* result = AllocLarge(n);
+  if (result != NULL) {
+      ASSERT_SPAN_COMMITTED(result);
+      return result;
+  }
+
+  // Grow the heap and try again
+  if (!GrowHeap(n)) {
+    ASSERT(Check());
+    return NULL;
+  }
+
+  return New(n);
+}
+
+Span* TCMalloc_PageHeap::AllocLarge(Length n) {
+  // find the best span (closest to n in size).
+  // The following loops implements address-ordered best-fit.
+  bool from_released = false;
+  Span *best = NULL;
+
+  // Search through normal list
+  for (Span* span = large_.normal.next;
+       span != &large_.normal;
+       span = span->next) {
+    if (span->length >= n) {
+      if ((best == NULL)
+          || (span->length < best->length)
+          || ((span->length == best->length) && (span->start < best->start))) {
+        best = span;
+        from_released = false;
+      }
+    }
+  }
+
+  // Search through released list in case it has a better fit
+  for (Span* span = large_.returned.next;
+       span != &large_.returned;
+       span = span->next) {
+    if (span->length >= n) {
+      if ((best == NULL)
+          || (span->length < best->length)
+          || ((span->length == best->length) && (span->start < best->start))) {
+        best = span;
+        from_released = true;
+      }
+    }
+  }
+
+  if (best != NULL) {
+    Carve(best, n, from_released);
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+    // The newly allocated memory is from a span that's in the normal span list (already committed).  Update the
+    // free committed pages count.
+    ASSERT(free_committed_pages_ >= n);
+    free_committed_pages_ -= n;
+    if (free_committed_pages_ < min_free_committed_pages_since_last_scavenge_)
+      min_free_committed_pages_since_last_scavenge_ = free_committed_pages_;
+#endif  // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+    ASSERT(Check());
+    free_pages_ -= n;
+    return best;
+  }
+  return NULL;
+}
+
+Span* TCMalloc_PageHeap::Split(Span* span, Length n) {
+  ASSERT(0 < n);
+  ASSERT(n < span->length);
+  ASSERT(!span->free);
+  ASSERT(span->sizeclass == 0);
+  Event(span, 'T', n);
+
+  const Length extra = span->length - n;
+  Span* leftover = NewSpan(span->start + n, extra);
+  Event(leftover, 'U', extra);
+  RecordSpan(leftover);
+  pagemap_.set(span->start + n - 1, span); // Update map from pageid to span
+  span->length = n;
+
+  return leftover;
+}
+
+inline void TCMalloc_PageHeap::Carve(Span* span, Length n, bool released) {
+  ASSERT(n > 0);
+  DLL_Remove(span);
+  span->free = 0;
+  Event(span, 'A', n);
+
+  if (released) {
+    // If the span chosen to carve from is decommited, commit the entire span at once to avoid committing spans 1 page at a time.
+    ASSERT(span->decommitted);
+    TCMalloc_SystemCommit(reinterpret_cast<void*>(span->start << kPageShift), static_cast<size_t>(span->length << kPageShift));
+    span->decommitted = false;
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+    free_committed_pages_ += span->length;
+#endif
+  }
+  
+  const int extra = static_cast<int>(span->length - n);
+  ASSERT(extra >= 0);
+  if (extra > 0) {
+    Span* leftover = NewSpan(span->start + n, extra);
+    leftover->free = 1;
+    leftover->decommitted = false;
+    Event(leftover, 'S', extra);
+    RecordSpan(leftover);
+
+    // Place leftover span on appropriate free list
+    SpanList* listpair = (static_cast<size_t>(extra) < kMaxPages) ? &free_[extra] : &large_;
+    Span* dst = &listpair->normal;
+    DLL_Prepend(dst, leftover);
+
+    span->length = n;
+    pagemap_.set(span->start + n - 1, span);
+  }
+}
+
+static ALWAYS_INLINE void mergeDecommittedStates(Span* destination, Span* other)
+{
+    if (destination->decommitted && !other->decommitted) {
+        TCMalloc_SystemRelease(reinterpret_cast<void*>(other->start << kPageShift),
+                               static_cast<size_t>(other->length << kPageShift));
+    } else if (other->decommitted && !destination->decommitted) {
+        TCMalloc_SystemRelease(reinterpret_cast<void*>(destination->start << kPageShift),
+                               static_cast<size_t>(destination->length << kPageShift));
+        destination->decommitted = true;
+    }
+}
+
+inline void TCMalloc_PageHeap::Delete(Span* span) {
+  ASSERT(Check());
+  ASSERT(!span->free);
+  ASSERT(span->length > 0);
+  ASSERT(GetDescriptor(span->start) == span);
+  ASSERT(GetDescriptor(span->start + span->length - 1) == span);
+  span->sizeclass = 0;
+#ifndef NO_TCMALLOC_SAMPLES
+  span->sample = 0;
+#endif
+
+  // Coalesce -- we guarantee that "p" != 0, so no bounds checking
+  // necessary.  We do not bother resetting the stale pagemap
+  // entries for the pieces we are merging together because we only
+  // care about the pagemap entries for the boundaries.
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+  // Track the total size of the neighboring free spans that are committed.
+  Length neighboringCommittedSpansLength = 0;
+#endif
+  const PageID p = span->start;
+  const Length n = span->length;
+  Span* prev = GetDescriptor(p-1);
+  if (prev != NULL && prev->free) {
+    // Merge preceding span into this span
+    ASSERT(prev->start + prev->length == p);
+    const Length len = prev->length;
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+    if (!prev->decommitted)
+        neighboringCommittedSpansLength += len;
+#endif
+    mergeDecommittedStates(span, prev);
+    DLL_Remove(prev);
+    DeleteSpan(prev);
+    span->start -= len;
+    span->length += len;
+    pagemap_.set(span->start, span);
+    Event(span, 'L', len);
+  }
+  Span* next = GetDescriptor(p+n);
+  if (next != NULL && next->free) {
+    // Merge next span into this span
+    ASSERT(next->start == p+n);
+    const Length len = next->length;
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+    if (!next->decommitted)
+        neighboringCommittedSpansLength += len;
+#endif
+    mergeDecommittedStates(span, next);
+    DLL_Remove(next);
+    DeleteSpan(next);
+    span->length += len;
+    pagemap_.set(span->start + span->length - 1, span);
+    Event(span, 'R', len);
+  }
+
+  Event(span, 'D', span->length);
+  span->free = 1;
+  if (span->decommitted) {
+    if (span->length < kMaxPages)
+      DLL_Prepend(&free_[span->length].returned, span);
+    else
+      DLL_Prepend(&large_.returned, span);
+  } else {
+    if (span->length < kMaxPages)
+      DLL_Prepend(&free_[span->length].normal, span);
+    else
+      DLL_Prepend(&large_.normal, span);
+  }
+  free_pages_ += n;
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+  if (span->decommitted) {
+      // If the merged span is decommitted, that means we decommitted any neighboring spans that were
+      // committed.  Update the free committed pages count.
+      free_committed_pages_ -= neighboringCommittedSpansLength;
+      if (free_committed_pages_ < min_free_committed_pages_since_last_scavenge_)
+            min_free_committed_pages_since_last_scavenge_ = free_committed_pages_;
+  } else {
+      // If the merged span remains committed, add the deleted span's size to the free committed pages count.
+      free_committed_pages_ += n;
+  }
+
+  // Make sure the scavenge thread becomes active if we have enough freed pages to release some back to the system.
+  signalScavenger();
+#else
+  IncrementalScavenge(n);
+#endif
+
+  ASSERT(Check());
+}
+
+#if !USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+void TCMalloc_PageHeap::IncrementalScavenge(Length n) {
+  // Fast path; not yet time to release memory
+  scavenge_counter_ -= n;
+  if (scavenge_counter_ >= 0) return;  // Not yet time to scavenge
+
+#if PLATFORM(IOS)
+  static const size_t kDefaultReleaseDelay = 64;
+#else
+  // If there is nothing to release, wait for so many pages before
+  // scavenging again.  With 4K pages, this comes to 16MB of memory.
+  static const size_t kDefaultReleaseDelay = 1 << 8;
+#endif
+
+  // Find index of free list to scavenge
+  size_t index = scavenge_index_ + 1;
+  for (size_t i = 0; i < kMaxPages+1; i++) {
+    if (index > kMaxPages) index = 0;
+    SpanList* slist = (index == kMaxPages) ? &large_ : &free_[index];
+    if (!DLL_IsEmpty(&slist->normal)) {
+      // Release the last span on the normal portion of this list
+      Span* s = slist->normal.prev;
+      DLL_Remove(s);
+      TCMalloc_SystemRelease(reinterpret_cast<void*>(s->start << kPageShift),
+                             static_cast<size_t>(s->length << kPageShift));
+      s->decommitted = true;
+      DLL_Prepend(&slist->returned, s);
+
+#if PLATFORM(IOS)
+      scavenge_counter_ = std::max<size_t>(16UL, std::min<size_t>(kDefaultReleaseDelay, kDefaultReleaseDelay - (free_pages_ / kDefaultReleaseDelay)));
+#else
+      scavenge_counter_ = std::max<size_t>(64UL, std::min<size_t>(kDefaultReleaseDelay, kDefaultReleaseDelay - (free_pages_ / kDefaultReleaseDelay)));
+#endif
+
+      if (index == kMaxPages && !DLL_IsEmpty(&slist->normal))
+        scavenge_index_ = index - 1;
+      else
+        scavenge_index_ = index;
+      return;
+    }
+    index++;
+  }
+
+  // Nothing to scavenge, delay for a while
+  scavenge_counter_ = kDefaultReleaseDelay;
+}
+#endif
+
+void TCMalloc_PageHeap::RegisterSizeClass(Span* span, size_t sc) {
+  // Associate span object with all interior pages as well
+  ASSERT(!span->free);
+  ASSERT(GetDescriptor(span->start) == span);
+  ASSERT(GetDescriptor(span->start+span->length-1) == span);
+  Event(span, 'C', sc);
+  span->sizeclass = static_cast<unsigned int>(sc);
+  for (Length i = 1; i < span->length-1; i++) {
+    pagemap_.set(span->start+i, span);
+  }
+}
+    
+#ifdef WTF_CHANGES
+size_t TCMalloc_PageHeap::ReturnedBytes() const {
+    size_t result = 0;
+    for (unsigned s = 0; s < kMaxPages; s++) {
+        const int r_length = DLL_Length(&free_[s].returned);
+        unsigned r_pages = s * r_length;
+        result += r_pages << kPageShift;
+    }
+    
+    for (Span* s = large_.returned.next; s != &large_.returned; s = s->next)
+        result += s->length << kPageShift;
+    return result;
+}
+#endif
+
+#ifndef WTF_CHANGES
+static double PagesToMB(uint64_t pages) {
+  return (pages << kPageShift) / 1048576.0;
+}
+
+void TCMalloc_PageHeap::Dump(TCMalloc_Printer* out) {
+  int nonempty_sizes = 0;
+  for (int s = 0; s < kMaxPages; s++) {
+    if (!DLL_IsEmpty(&free_[s].normal) || !DLL_IsEmpty(&free_[s].returned)) {
+      nonempty_sizes++;
+    }
+  }
+  out->printf("------------------------------------------------\n");
+  out->printf("PageHeap: %d sizes; %6.1f MB free\n",
+              nonempty_sizes, PagesToMB(free_pages_));
+  out->printf("------------------------------------------------\n");
+  uint64_t total_normal = 0;
+  uint64_t total_returned = 0;
+  for (int s = 0; s < kMaxPages; s++) {
+    const int n_length = DLL_Length(&free_[s].normal);
+    const int r_length = DLL_Length(&free_[s].returned);
+    if (n_length + r_length > 0) {
+      uint64_t n_pages = s * n_length;
+      uint64_t r_pages = s * r_length;
+      total_normal += n_pages;
+      total_returned += r_pages;
+      out->printf("%6u pages * %6u spans ~ %6.1f MB; %6.1f MB cum"
+                  "; unmapped: %6.1f MB; %6.1f MB cum\n",
+                  s,
+                  (n_length + r_length),
+                  PagesToMB(n_pages + r_pages),
+                  PagesToMB(total_normal + total_returned),
+                  PagesToMB(r_pages),
+                  PagesToMB(total_returned));
+    }
+  }
+
+  uint64_t n_pages = 0;
+  uint64_t r_pages = 0;
+  int n_spans = 0;
+  int r_spans = 0;
+  out->printf("Normal large spans:\n");
+  for (Span* s = large_.normal.next; s != &large_.normal; s = s->next) {
+    out->printf("   [ %6" PRIuS " pages ] %6.1f MB\n",
+                s->length, PagesToMB(s->length));
+    n_pages += s->length;
+    n_spans++;
+  }
+  out->printf("Unmapped large spans:\n");
+  for (Span* s = large_.returned.next; s != &large_.returned; s = s->next) {
+    out->printf("   [ %6" PRIuS " pages ] %6.1f MB\n",
+                s->length, PagesToMB(s->length));
+    r_pages += s->length;
+    r_spans++;
+  }
+  total_normal += n_pages;
+  total_returned += r_pages;
+  out->printf(">255   large * %6u spans ~ %6.1f MB; %6.1f MB cum"
+              "; unmapped: %6.1f MB; %6.1f MB cum\n",
+              (n_spans + r_spans),
+              PagesToMB(n_pages + r_pages),
+              PagesToMB(total_normal + total_returned),
+              PagesToMB(r_pages),
+              PagesToMB(total_returned));
+}
+#endif
+
+bool TCMalloc_PageHeap::GrowHeap(Length n) {
+  ASSERT(kMaxPages >= kMinSystemAlloc);
+  if (n > kMaxValidPages) return false;
+  Length ask = (n>kMinSystemAlloc) ? n : static_cast<Length>(kMinSystemAlloc);
+  size_t actual_size;
+  void* ptr = TCMalloc_SystemAlloc(ask << kPageShift, &actual_size, kPageSize);
+  if (ptr == NULL) {
+    if (n < ask) {
+      // Try growing just "n" pages
+      ask = n;
+      ptr = TCMalloc_SystemAlloc(ask << kPageShift, &actual_size, kPageSize);
+    }
+    if (ptr == NULL) return false;
+  }
+  ask = actual_size >> kPageShift;
+
+  uint64_t old_system_bytes = system_bytes_;
+  system_bytes_ += (ask << kPageShift);
+  const PageID p = reinterpret_cast<uintptr_t>(ptr) >> kPageShift;
+  ASSERT(p > 0);
+
+  // If we have already a lot of pages allocated, just pre allocate a bunch of
+  // memory for the page map. This prevents fragmentation by pagemap metadata
+  // when a program keeps allocating and freeing large blocks.
+
+  if (old_system_bytes < kPageMapBigAllocationThreshold
+      && system_bytes_ >= kPageMapBigAllocationThreshold) {
+    pagemap_.PreallocateMoreMemory();
+  }
+
+  // Make sure pagemap_ has entries for all of the new pages.
+  // Plus ensure one before and one after so coalescing code
+  // does not need bounds-checking.
+  if (pagemap_.Ensure(p-1, ask+2)) {
+    // Pretend the new area is allocated and then Delete() it to
+    // cause any necessary coalescing to occur.
+    //
+    // We do not adjust free_pages_ here since Delete() will do it for us.
+    Span* span = NewSpan(p, ask);
+    RecordSpan(span);
+    Delete(span);
+    ASSERT(Check());
+    return true;
+  } else {
+    // We could not allocate memory within "pagemap_"
+    // TODO: Once we can return memory to the system, return the new span
+    return false;
+  }
+}
+
+bool TCMalloc_PageHeap::Check() {
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+  size_t totalFreeCommitted = 0;
+#endif
+  ASSERT(free_[0].normal.next == &free_[0].normal);
+  ASSERT(free_[0].returned.next == &free_[0].returned);
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+  totalFreeCommitted = CheckList(&large_.normal, kMaxPages, 1000000000, false);
+#else
+  CheckList(&large_.normal, kMaxPages, 1000000000, false);
+#endif
+    CheckList(&large_.returned, kMaxPages, 1000000000, true);
+  for (Length s = 1; s < kMaxPages; s++) {
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+    totalFreeCommitted += CheckList(&free_[s].normal, s, s, false);
+#else
+    CheckList(&free_[s].normal, s, s, false);
+#endif
+    CheckList(&free_[s].returned, s, s, true);
+  }
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+  ASSERT(totalFreeCommitted == free_committed_pages_);
+#endif
+  return true;
+}
+
+#if ASSERT_DISABLED
+size_t TCMalloc_PageHeap::CheckList(Span*, Length, Length, bool) {
+  return 0;
+}
+#else
+size_t TCMalloc_PageHeap::CheckList(Span* list, Length min_pages, Length max_pages, bool decommitted) {
+  size_t freeCount = 0;
+  for (Span* s = list->next; s != list; s = s->next) {
+    CHECK_CONDITION(s->free);
+    CHECK_CONDITION(s->length >= min_pages);
+    CHECK_CONDITION(s->length <= max_pages);
+    CHECK_CONDITION(GetDescriptor(s->start) == s);
+    CHECK_CONDITION(GetDescriptor(s->start+s->length-1) == s);
+    CHECK_CONDITION(s->decommitted == decommitted);
+    freeCount += s->length;
+  }
+  return freeCount;
+}
+#endif
+
+void TCMalloc_PageHeap::ReleaseFreeList(Span* list, Span* returned) {
+  // Walk backwards through list so that when we push these
+  // spans on the "returned" list, we preserve the order.
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+  size_t freePageReduction = 0;
+#endif
+
+  while (!DLL_IsEmpty(list)) {
+    Span* s = list->prev;
+
+    DLL_Remove(s);
+    s->decommitted = true;
+    DLL_Prepend(returned, s);
+    TCMalloc_SystemRelease(reinterpret_cast<void*>(s->start << kPageShift),
+                           static_cast<size_t>(s->length << kPageShift));
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+    freePageReduction += s->length;
+#endif
+  }
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+    free_committed_pages_ -= freePageReduction;
+    if (free_committed_pages_ < min_free_committed_pages_since_last_scavenge_) 
+        min_free_committed_pages_since_last_scavenge_ = free_committed_pages_;
+#endif
+}
+
+void TCMalloc_PageHeap::ReleaseFreePages() {
+  for (Length s = 0; s < kMaxPages; s++) {
+    ReleaseFreeList(&free_[s].normal, &free_[s].returned);
+  }
+  ReleaseFreeList(&large_.normal, &large_.returned);
+  ASSERT(Check());
+}
+
+//-------------------------------------------------------------------
+// Free list
+//-------------------------------------------------------------------
+
+class TCMalloc_ThreadCache_FreeList {
+ private:
+  void*    list_;       // Linked list of nodes
+  uint16_t length_;     // Current length
+  uint16_t lowater_;    // Low water mark for list length
+
+ public:
+  void Init() {
+    list_ = NULL;
+    length_ = 0;
+    lowater_ = 0;
+  }
+
+  // Return current length of list
+  int length() const {
+    return length_;
+  }
+
+  // Is list empty?
+  bool empty() const {
+    return list_ == NULL;
+  }
+
+  // Low-water mark management
+  int lowwatermark() const { return lowater_; }
+  void clear_lowwatermark() { lowater_ = length_; }
+
+  ALWAYS_INLINE void Push(void* ptr) {
+    SLL_Push(&list_, ptr);
+    length_++;
+  }
+
+  void PushRange(int N, void *start, void *end) {
+    SLL_PushRange(&list_, start, end);
+    length_ = length_ + static_cast<uint16_t>(N);
+  }
+
+  void PopRange(int N, void **start, void **end) {
+    SLL_PopRange(&list_, N, start, end);
+    ASSERT(length_ >= N);
+    length_ = length_ - static_cast<uint16_t>(N);
+    if (length_ < lowater_) lowater_ = length_;
+  }
+
+  ALWAYS_INLINE void* Pop() {
+    ASSERT(list_ != NULL);
+    length_--;
+    if (length_ < lowater_) lowater_ = length_;
+    return SLL_Pop(&list_);
+  }
+
+#ifdef WTF_CHANGES
+  template <class Finder, class Reader>
+  void enumerateFreeObjects(Finder& finder, const Reader& reader)
+  {
+      for (void* nextObject = list_; nextObject; nextObject = reader.nextEntryInLinkedList(reinterpret_cast<void**>(nextObject)))
+          finder.visit(nextObject);
+  }
+#endif
+};
+
+//-------------------------------------------------------------------
+// Data kept per thread
+//-------------------------------------------------------------------
+
+class TCMalloc_ThreadCache {
+ private:
+  typedef TCMalloc_ThreadCache_FreeList FreeList;
+#if OS(WINDOWS)
+  typedef DWORD ThreadIdentifier;
+#else
+  typedef pthread_t ThreadIdentifier;
+#endif
+
+  size_t        size_;                  // Combined size of data
+  ThreadIdentifier tid_;                // Which thread owns it
+  bool          in_setspecific_;           // Called pthread_setspecific?
+  FreeList      list_[kNumClasses];     // Array indexed by size-class
+
+  // We sample allocations, biased by the size of the allocation
+  uint32_t      rnd_;                   // Cheap random number generator
+  size_t        bytes_until_sample_;    // Bytes until we sample next
+
+  // Allocate a new heap. REQUIRES: pageheap_lock is held.
+  static inline TCMalloc_ThreadCache* NewHeap(ThreadIdentifier tid);
+
+  // Use only as pthread thread-specific destructor function.
+  static void DestroyThreadCache(void* ptr);
+ public:
+  // All ThreadCache objects are kept in a linked list (for stats collection)
+  TCMalloc_ThreadCache* next_;
+  TCMalloc_ThreadCache* prev_;
+
+  void Init(ThreadIdentifier tid);
+  void Cleanup();
+
+  // Accessors (mostly just for printing stats)
+  int freelist_length(size_t cl) const { return list_[cl].length(); }
+
+  // Total byte size in cache
+  size_t Size() const { return size_; }
+
+  ALWAYS_INLINE void* Allocate(size_t size);
+  void Deallocate(void* ptr, size_t size_class);
+
+  ALWAYS_INLINE void FetchFromCentralCache(size_t cl, size_t allocationSize);
+  void ReleaseToCentralCache(size_t cl, int N);
+  void Scavenge();
+  void Print() const;
+
+  // Record allocation of "k" bytes.  Return true iff allocation
+  // should be sampled
+  bool SampleAllocation(size_t k);
+
+  // Pick next sampling point
+  void PickNextSample(size_t k);
+
+  static void                  InitModule();
+  static void                  InitTSD();
+  static TCMalloc_ThreadCache* GetThreadHeap();
+  static TCMalloc_ThreadCache* GetCache();
+  static TCMalloc_ThreadCache* GetCacheIfPresent();
+  static TCMalloc_ThreadCache* CreateCacheIfNecessary();
+  static void                  DeleteCache(TCMalloc_ThreadCache* heap);
+  static void                  BecomeIdle();
+  static void                  RecomputeThreadCacheSize();
+
+#ifdef WTF_CHANGES
+  template <class Finder, class Reader>
+  void enumerateFreeObjects(Finder& finder, const Reader& reader)
+  {
+      for (unsigned sizeClass = 0; sizeClass < kNumClasses; sizeClass++)
+          list_[sizeClass].enumerateFreeObjects(finder, reader);
+  }
+#endif
+};
+
+//-------------------------------------------------------------------
+// Data kept per size-class in central cache
+//-------------------------------------------------------------------
+
+class TCMalloc_Central_FreeList {
+ public:
+  void Init(size_t cl);
+
+  // These methods all do internal locking.
+
+  // Insert the specified range into the central freelist.  N is the number of
+  // elements in the range.
+  void InsertRange(void *start, void *end, int N);
+
+  // Returns the actual number of fetched elements into N.
+  void RemoveRange(void **start, void **end, int *N);
+
+  // Returns the number of free objects in cache.
+  size_t length() {
+    SpinLockHolder h(&lock_);
+    return counter_;
+  }
+
+  // Returns the number of free objects in the transfer cache.
+  int tc_length() {
+    SpinLockHolder h(&lock_);
+    return used_slots_ * num_objects_to_move[size_class_];
+  }
+
+#ifdef WTF_CHANGES
+  template <class Finder, class Reader>
+  void enumerateFreeObjects(Finder& finder, const Reader& reader, TCMalloc_Central_FreeList* remoteCentralFreeList)
+  {
+    for (Span* span = &empty_; span && span != &empty_; span = (span->next ? reader(span->next) : 0))
+      ASSERT(!span->objects);
+
+    ASSERT(!nonempty_.objects);
+    static const ptrdiff_t nonemptyOffset = reinterpret_cast<const char*>(&nonempty_) - reinterpret_cast<const char*>(this);
+
+    Span* remoteNonempty = reinterpret_cast<Span*>(reinterpret_cast<char*>(remoteCentralFreeList) + nonemptyOffset);
+    Span* remoteSpan = nonempty_.next;
+
+    for (Span* span = reader(remoteSpan); span && remoteSpan != remoteNonempty; remoteSpan = span->next, span = (span->next ? reader(span->next) : 0)) {
+      for (void* nextObject = span->objects; nextObject; nextObject = reader.nextEntryInLinkedList(reinterpret_cast<void**>(nextObject)))
+        finder.visit(nextObject);
+    }
+  }
+#endif
+
+ private:
+  // REQUIRES: lock_ is held
+  // Remove object from cache and return.
+  // Return NULL if no free entries in cache.
+  void* FetchFromSpans();
+
+  // REQUIRES: lock_ is held
+  // Remove object from cache and return.  Fetches
+  // from pageheap if cache is empty.  Only returns
+  // NULL on allocation failure.
+  void* FetchFromSpansSafe();
+
+  // REQUIRES: lock_ is held
+  // Release a linked list of objects to spans.
+  // May temporarily release lock_.
+  void ReleaseListToSpans(void *start);
+
+  // REQUIRES: lock_ is held
+  // Release an object to spans.
+  // May temporarily release lock_.
+  ALWAYS_INLINE void ReleaseToSpans(void* object);
+
+  // REQUIRES: lock_ is held
+  // Populate cache by fetching from the page heap.
+  // May temporarily release lock_.
+  ALWAYS_INLINE void Populate();
+
+  // REQUIRES: lock is held.
+  // Tries to make room for a TCEntry.  If the cache is full it will try to
+  // expand it at the cost of some other cache size.  Return false if there is
+  // no space.
+  bool MakeCacheSpace();
+
+  // REQUIRES: lock_ for locked_size_class is held.
+  // Picks a "random" size class to steal TCEntry slot from.  In reality it
+  // just iterates over the sizeclasses but does so without taking a lock.
+  // Returns true on success.
+  // May temporarily lock a "random" size class.
+  static ALWAYS_INLINE bool EvictRandomSizeClass(size_t locked_size_class, bool force);
+
+  // REQUIRES: lock_ is *not* held.
+  // Tries to shrink the Cache.  If force is true it will relase objects to
+  // spans if it allows it to shrink the cache.  Return false if it failed to
+  // shrink the cache.  Decrements cache_size_ on succeess.
+  // May temporarily take lock_.  If it takes lock_, the locked_size_class
+  // lock is released to the thread from holding two size class locks
+  // concurrently which could lead to a deadlock.
+  bool ShrinkCache(int locked_size_class, bool force);
+
+  // This lock protects all the data members.  cached_entries and cache_size_
+  // may be looked at without holding the lock.
+  SpinLock lock_;
+
+  // We keep linked lists of empty and non-empty spans.
+  size_t   size_class_;     // My size class
+  Span     empty_;          // Dummy header for list of empty spans
+  Span     nonempty_;       // Dummy header for list of non-empty spans
+  size_t   counter_;        // Number of free objects in cache entry
+
+  // Here we reserve space for TCEntry cache slots.  Since one size class can
+  // end up getting all the TCEntries quota in the system we just preallocate
+  // sufficient number of entries here.
+  TCEntry tc_slots_[kNumTransferEntries];
+
+  // Number of currently used cached entries in tc_slots_.  This variable is
+  // updated under a lock but can be read without one.
+  int32_t used_slots_;
+  // The current number of slots for this size class.  This is an
+  // adaptive value that is increased if there is lots of traffic
+  // on a given size class.
+  int32_t cache_size_;
+};
+
+#if COMPILER(CLANG) && defined(__has_warning)
+#pragma clang diagnostic push
+#if __has_warning("-Wunused-private-field")
+#pragma clang diagnostic ignored "-Wunused-private-field"
+#endif
+#endif
+
+// Pad each CentralCache object to multiple of 64 bytes
+class TCMalloc_Central_FreeListPadded : public TCMalloc_Central_FreeList {
+ private:
+  char pad_[(64 - (sizeof(TCMalloc_Central_FreeList) % 64)) % 64];
+};
+
+#if COMPILER(CLANG) && defined(__has_warning)
+#pragma clang diagnostic pop
+#endif
+
+//-------------------------------------------------------------------
+// Global variables
+//-------------------------------------------------------------------
+
+// Central cache -- a collection of free-lists, one per size-class.
+// We have a separate lock per free-list to reduce contention.
+static TCMalloc_Central_FreeListPadded central_cache[kNumClasses];
+
+// Page-level allocator
+static AllocAlignmentInteger pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(AllocAlignmentInteger) - 1) / sizeof(AllocAlignmentInteger)];
+static bool phinited = false;
+
+// Avoid extra level of indirection by making "pageheap" be just an alias
+// of pageheap_memory.
+typedef union {
+    void* m_memory;
+    TCMalloc_PageHeap* m_pageHeap;
+} PageHeapUnion;
+
+static inline TCMalloc_PageHeap* getPageHeap()
+{
+    PageHeapUnion u = { &pageheap_memory[0] };
+    return u.m_pageHeap;
+}
+
+#define pageheap getPageHeap()
+
+#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY
+
+#if HAVE(DISPATCH_H) || OS(WINDOWS)
+
+void TCMalloc_PageHeap::periodicScavenge()
+{
+    SpinLockHolder h(&pageheap_lock);
+    pageheap->scavenge();
+
+    if (shouldScavenge()) {
+        rescheduleScavenger();
+        return;
+    }
+
+    suspendScavenger();
+}
+
+ALWAYS_INLINE void TCMalloc_PageHeap::signalScavenger()
+{
+    ASSERT(pageheap_lock.IsHeld());
+    if (isScavengerSuspended() && shouldScavenge())
+        scheduleScavenger();
+}
+
+#else
+
+void TCMalloc_PageHeap::scavengerThread()
+{
+#if HAVE(PTHREAD_SETNAME_NP)
+    pthread_setname_np("JavaScriptCore: FastMalloc scavenger");
+#endif
+
+    while (1) {
+        pageheap_lock.Lock();
+        if (!shouldScavenge()) {
+            // Set to false so that signalScavenger() will check whether we need to be siganlled.
+            m_scavengeThreadActive = false;
+
+            // We need to unlock now, as this thread will block on the condvar until scavenging is required.
+            pageheap_lock.Unlock();
+
+            // Block until there are enough free committed pages to release back to the system.
+            pthread_mutex_lock(&m_scavengeMutex);
+            pthread_cond_wait(&m_scavengeCondition, &m_scavengeMutex);
+            // After exiting the pthread_cond_wait, we hold the lock on m_scavengeMutex. Unlock it to prevent
+            // deadlock next time round the loop.
+            pthread_mutex_unlock(&m_scavengeMutex);
+
+            // Set to true to prevent unnecessary signalling of the condvar.
+            m_scavengeThreadActive = true;
+        } else
+            pageheap_lock.Unlock();
+
+        // Wait for a while to calculate how much memory remains unused during this pause.
+        sleep(kScavengeDelayInSeconds);
+
+        {
+            SpinLockHolder h(&pageheap_lock);
+            pageheap->scavenge();
+        }
+    }
+}
+
+#endif
+
+#endif
+
+// If TLS is available, we also store a copy
+// of the per-thread object in a __thread variable
+// since __thread variables are faster to read
+// than pthread_getspecific().  We still need
+// pthread_setspecific() because __thread
+// variables provide no way to run cleanup
+// code when a thread is destroyed.
+#ifdef HAVE_TLS
+static __thread TCMalloc_ThreadCache *threadlocal_heap;
+#endif
+// Thread-specific key.  Initialization here is somewhat tricky
+// because some Linux startup code invokes malloc() before it
+// is in a good enough state to handle pthread_keycreate().
+// Therefore, we use TSD keys only after tsd_inited is set to true.
+// Until then, we use a slow path to get the heap object.
+static bool tsd_inited = false;
+#if USE(PTHREAD_GETSPECIFIC_DIRECT)
+static const pthread_key_t heap_key = __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0;
+#else
+static pthread_key_t heap_key;
+#endif
+#if OS(WINDOWS)
+DWORD tlsIndex = TLS_OUT_OF_INDEXES;
+#endif
+
+static ALWAYS_INLINE void setThreadHeap(TCMalloc_ThreadCache* heap)
+{
+#if USE(PTHREAD_GETSPECIFIC_DIRECT)
+    // Can't have two libraries both doing this in the same process,
+    // so check and make this crash right away.
+    if (pthread_getspecific(heap_key))
+        CRASH();
+#endif
+
+    // Still do pthread_setspecific even if there's an alternate form
+    // of thread-local storage in use, to benefit from the delete callback.
+    pthread_setspecific(heap_key, heap);
+
+#if OS(WINDOWS)
+    TlsSetValue(tlsIndex, heap);
+#endif
+}
+
+// Allocator for thread heaps
+static PageHeapAllocator<TCMalloc_ThreadCache> threadheap_allocator;
+
+// Linked list of heap objects.  Protected by pageheap_lock.
+static TCMalloc_ThreadCache* thread_heaps = NULL;
+static int thread_heap_count = 0;
+
+// Overall thread cache size.  Protected by pageheap_lock.
+static size_t overall_thread_cache_size = kDefaultOverallThreadCacheSize;
+
+// Global per-thread cache size.  Writes are protected by
+// pageheap_lock.  Reads are done without any locking, which should be
+// fine as long as size_t can be written atomically and we don't place
+// invariants between this variable and other pieces of state.
+static volatile size_t per_thread_cache_size = kMaxThreadCacheSize;
+
+//-------------------------------------------------------------------
+// Central cache implementation
+//-------------------------------------------------------------------
+
+void TCMalloc_Central_FreeList::Init(size_t cl) {
+  lock_.Init();
+  size_class_ = cl;
+  DLL_Init(&empty_);
+  DLL_Init(&nonempty_);
+  counter_ = 0;
+
+  cache_size_ = 1;
+  used_slots_ = 0;
+  ASSERT(cache_size_ <= kNumTransferEntries);
+}
+
+void TCMalloc_Central_FreeList::ReleaseListToSpans(void* start) {
+  while (start) {
+    void *next = SLL_Next(start);
+    ReleaseToSpans(start);
+    start = next;
+  }
+}
+
+ALWAYS_INLINE void TCMalloc_Central_FreeList::ReleaseToSpans(void* object) {
+  const PageID p = reinterpret_cast<uintptr_t>(object) >> kPageShift;
+  Span* span = pageheap->GetDescriptor(p);
+  ASSERT(span != NULL);
+  ASSERT(span->refcount > 0);
+
+  // If span is empty, move it to non-empty list
+  if (span->objects == NULL) {
+    DLL_Remove(span);
+    DLL_Prepend(&nonempty_, span);
+    Event(span, 'N', 0);
+  }
+
+  // The following check is expensive, so it is disabled by default
+  if (false) {
+    // Check that object does not occur in list
+    unsigned got = 0;
+    for (void* p = span->objects; p != NULL; p = *((void**) p)) {
+      ASSERT(p != object);
+      got++;
+    }
+    ASSERT(got + span->refcount ==
+           (span->length<<kPageShift)/ByteSizeForClass(span->sizeclass));
+  }
+
+  counter_++;
+  span->refcount--;
+  if (span->refcount == 0) {
+    Event(span, '#', 0);
+    counter_ -= (span->length<<kPageShift) / ByteSizeForClass(span->sizeclass);
+    DLL_Remove(span);
+
+    // Release central list lock while operating on pageheap
+    lock_.Unlock();
+    {
+      SpinLockHolder h(&pageheap_lock);
+      pageheap->Delete(span);
+    }
+    lock_.Lock();
+  } else {
+    *(reinterpret_cast<void**>(object)) = span->objects;
+    span->objects = object;
+  }
+}
+
+ALWAYS_INLINE bool TCMalloc_Central_FreeList::EvictRandomSizeClass(
+    size_t locked_size_class, bool force) {
+  static int race_counter = 0;
+  int t = race_counter++;  // Updated without a lock, but who cares.
+  if (t >= static_cast<int>(kNumClasses)) {
+    while (t >= static_cast<int>(kNumClasses)) {
+      t -= kNumClasses;
+    }
+    race_counter = t;
+  }
+  ASSERT(t >= 0);
+  ASSERT(t < static_cast<int>(kNumClasses));
+  if (t == static_cast<int>(locked_size_class)) return false;
+  return central_cache[t].ShrinkCache(static_cast<int>(locked_size_class), force);
+}
+
+bool TCMalloc_Central_FreeList::MakeCacheSpace() {
+  // Is there room in the cache?
+  if (used_slots_ < cache_size_) return true;
+  // Check if we can expand this cache?
+  if (cache_size_ == kNumTransferEntries) return false;
+  // Ok, we'll try to grab an entry from some other size class.
+  if (EvictRandomSizeClass(size_class_, false) ||
+      EvictRandomSizeClass(size_class_, true)) {
+    // Succeeded in evicting, we're going to make our cache larger.
+    cache_size_++;
+    return true;
+  }
+  return false;
+}
+
+
+namespace {
+class LockInverter {
+ private:
+  SpinLock *held_, *temp_;
+ public:
+  inline explicit LockInverter(SpinLock* held, SpinLock *temp)
+    : held_(held), temp_(temp) { held_->Unlock(); temp_->Lock(); }
+  inline ~LockInverter() { temp_->Unlock(); held_->Lock();  }
+};
+}
+
+bool TCMalloc_Central_FreeList::ShrinkCache(int locked_size_class, bool force) {
+  // Start with a quick check without taking a lock.
+  if (cache_size_ == 0) return false;
+  // We don't evict from a full cache unless we are 'forcing'.
+  if (force == false && used_slots_ == cache_size_) return false;
+
+  // Grab lock, but first release the other lock held by this thread.  We use
+  // the lock inverter to ensure that we never hold two size class locks
+  // concurrently.  That can create a deadlock because there is no well
+  // defined nesting order.
+  LockInverter li(&central_cache[locked_size_class].lock_, &lock_);
+  ASSERT(used_slots_ <= cache_size_);
+  ASSERT(0 <= cache_size_);
+  if (cache_size_ == 0) return false;
+  if (used_slots_ == cache_size_) {
+    if (force == false) return false;
+    // ReleaseListToSpans releases the lock, so we have to make all the
+    // updates to the central list before calling it.
+    cache_size_--;
+    used_slots_--;
+    ReleaseListToSpans(tc_slots_[used_slots_].head);
+    return true;
+  }
+  cache_size_--;
+  return true;
+}
+
+void TCMalloc_Central_FreeList::InsertRange(void *start, void *end, int N) {
+  SpinLockHolder h(&lock_);
+  if (N == num_objects_to_move[size_class_] &&
+    MakeCacheSpace()) {
+    int slot = used_slots_++;
+    ASSERT(slot >=0);
+    ASSERT(slot < kNumTransferEntries);
+    TCEntry *entry = &tc_slots_[slot];
+    entry->head = start;
+    entry->tail = end;
+    return;
+  }
+  ReleaseListToSpans(start);
+}
+
+void TCMalloc_Central_FreeList::RemoveRange(void **start, void **end, int *N) {
+  int num = *N;
+  ASSERT(num > 0);
+
+  SpinLockHolder h(&lock_);
+  if (num == num_objects_to_move[size_class_] && used_slots_ > 0) {
+    int slot = --used_slots_;
+    ASSERT(slot >= 0);
+    TCEntry *entry = &tc_slots_[slot];
+    *start = entry->head;
+    *end = entry->tail;
+    return;
+  }
+
+  // TODO: Prefetch multiple TCEntries?
+  void *tail = FetchFromSpansSafe();
+  if (!tail) {
+    // We are completely out of memory.
+    *start = *end = NULL;
+    *N = 0;
+    return;
+  }
+
+  SLL_SetNext(tail, NULL);
+  void *head = tail;
+  int count = 1;
+  while (count < num) {
+    void *t = FetchFromSpans();
+    if (!t) break;
+    SLL_Push(&head, t);
+    count++;
+  }
+  *start = head;
+  *end = tail;
+  *N = count;
+}
+
+
+void* TCMalloc_Central_FreeList::FetchFromSpansSafe() {
+  void *t = FetchFromSpans();
+  if (!t) {
+    Populate();
+    t = FetchFromSpans();
+  }
+  return t;
+}
+
+void* TCMalloc_Central_FreeList::FetchFromSpans() {
+  if (DLL_IsEmpty(&nonempty_)) return NULL;
+  Span* span = nonempty_.next;
+
+  ASSERT(span->objects != NULL);
+  ASSERT_SPAN_COMMITTED(span);
+  span->refcount++;
+  void* result = span->objects;
+  span->objects = *(reinterpret_cast<void**>(result));
+  if (span->objects == NULL) {
+    // Move to empty list
+    DLL_Remove(span);
+    DLL_Prepend(&empty_, span);
+    Event(span, 'E', 0);
+  }
+  counter_--;
+  return result;
+}
+
+// Fetch memory from the system and add to the central cache freelist.
+ALWAYS_INLINE void TCMalloc_Central_FreeList::Populate() {
+  // Release central list lock while operating on pageheap
+  lock_.Unlock();
+  const size_t npages = class_to_pages[size_class_];
+
+  Span* span;
+  {
+    SpinLockHolder h(&pageheap_lock);
+    span = pageheap->New(npages);
+    if (span) pageheap->RegisterSizeClass(span, size_class_);
+  }
+  if (span == NULL) {
+#if HAVE(ERRNO_H)
+    MESSAGE("allocation failed: %d\n", errno);
+#elif OS(WINDOWS)
+    MESSAGE("allocation failed: %d\n", ::GetLastError());
+#else
+    MESSAGE("allocation failed\n");
+#endif
+    lock_.Lock();
+    return;
+  }
+  ASSERT_SPAN_COMMITTED(span);
+  ASSERT(span->length == npages);
+  // Cache sizeclass info eagerly.  Locking is not necessary.
+  // (Instead of being eager, we could just replace any stale info
+  // about this span, but that seems to be no better in practice.)
+  for (size_t i = 0; i < npages; i++) {
+    pageheap->CacheSizeClass(span->start + i, size_class_);
+  }
+
+  // Split the block into pieces and add to the free-list
+  // TODO: coloring of objects to avoid cache conflicts?
+  void** tail = &span->objects;
+  char* ptr = reinterpret_cast<char*>(span->start << kPageShift);
+  char* limit = ptr + (npages << kPageShift);
+  const size_t size = ByteSizeForClass(size_class_);
+  int num = 0;
+  char* nptr;
+  while ((nptr = ptr + size) <= limit) {
+    *tail = ptr;
+    tail = reinterpret_cast_ptr<void**>(ptr);
+    ptr = nptr;
+    num++;
+  }
+  ASSERT(ptr <= limit);
+  *tail = NULL;
+  span->refcount = 0; // No sub-object in use yet
+
+  // Add span to list of non-empty spans
+  lock_.Lock();
+  DLL_Prepend(&nonempty_, span);
+  counter_ += num;
+}
+
+//-------------------------------------------------------------------
+// TCMalloc_ThreadCache implementation
+//-------------------------------------------------------------------
+
+inline bool TCMalloc_ThreadCache::SampleAllocation(size_t k) {
+  if (bytes_until_sample_ < k) {
+    PickNextSample(k);
+    return true;
+  } else {
+    bytes_until_sample_ -= k;
+    return false;
+  }
+}
+
+void TCMalloc_ThreadCache::Init(ThreadIdentifier tid) {
+  size_ = 0;
+  next_ = NULL;
+  prev_ = NULL;
+  tid_  = tid;
+  in_setspecific_ = false;
+  for (size_t cl = 0; cl < kNumClasses; ++cl) {
+    list_[cl].Init();
+  }
+
+  // Initialize RNG -- run it for a bit to get to good values
+  bytes_until_sample_ = 0;
+  rnd_ = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this));
+  for (int i = 0; i < 100; i++) {
+    PickNextSample(static_cast<size_t>(FLAGS_tcmalloc_sample_parameter * 2));
+  }
+}
+
+void TCMalloc_ThreadCache::Cleanup() {
+  // Put unused memory back into central cache
+  for (size_t cl = 0; cl < kNumClasses; ++cl) {
+    if (list_[cl].length() > 0) {
+      ReleaseToCentralCache(cl, list_[cl].length());
+    }
+  }
+}
+
+ALWAYS_INLINE void* TCMalloc_ThreadCache::Allocate(size_t size) {
+  ASSERT(size <= kMaxSize);
+  const size_t cl = SizeClass(size);
+  FreeList* list = &list_[cl];
+  size_t allocationSize = ByteSizeForClass(cl);
+  if (list->empty()) {
+    FetchFromCentralCache(cl, allocationSize);
+    if (list->empty()) return NULL;
+  }
+  size_ -= allocationSize;
+  return list->Pop();
+}
+
+inline void TCMalloc_ThreadCache::Deallocate(void* ptr, size_t cl) {
+  size_ += ByteSizeForClass(cl);
+  FreeList* list = &list_[cl];
+  list->Push(ptr);
+  // If enough data is free, put back into central cache
+  if (list->length() > kMaxFreeListLength) {
+    ReleaseToCentralCache(cl, num_objects_to_move[cl]);
+  }
+  if (size_ >= per_thread_cache_size) Scavenge();
+}
+
+// Remove some objects of class "cl" from central cache and add to thread heap
+ALWAYS_INLINE void TCMalloc_ThreadCache::FetchFromCentralCache(size_t cl, size_t allocationSize) {
+  int fetch_count = num_objects_to_move[cl];
+  void *start, *end;
+  central_cache[cl].RemoveRange(&start, &end, &fetch_count);
+  list_[cl].PushRange(fetch_count, start, end);
+  size_ += allocationSize * fetch_count;
+}
+
+// Remove some objects of class "cl" from thread heap and add to central cache
+inline void TCMalloc_ThreadCache::ReleaseToCentralCache(size_t cl, int N) {
+  ASSERT(N > 0);
+  FreeList* src = &list_[cl];
+  if (N > src->length()) N = src->length();
+  size_ -= N*ByteSizeForClass(cl);
+
+  // We return prepackaged chains of the correct size to the central cache.
+  // TODO: Use the same format internally in the thread caches?
+  int batch_size = num_objects_to_move[cl];
+  while (N > batch_size) {
+    void *tail, *head;
+    src->PopRange(batch_size, &head, &tail);
+    central_cache[cl].InsertRange(head, tail, batch_size);
+    N -= batch_size;
+  }
+  void *tail, *head;
+  src->PopRange(N, &head, &tail);
+  central_cache[cl].InsertRange(head, tail, N);
+}
+
+// Release idle memory to the central cache
+inline void TCMalloc_ThreadCache::Scavenge() {
+  // If the low-water mark for the free list is L, it means we would
+  // not have had to allocate anything from the central cache even if
+  // we had reduced the free list size by L.  We aim to get closer to
+  // that situation by dropping L/2 nodes from the free list.  This
+  // may not release much memory, but if so we will call scavenge again
+  // pretty soon and the low-water marks will be high on that call.
+  //int64 start = CycleClock::Now();
+
+  for (size_t cl = 0; cl < kNumClasses; cl++) {
+    FreeList* list = &list_[cl];
+    const int lowmark = list->lowwatermark();
+    if (lowmark > 0) {
+      const int drop = (lowmark > 1) ? lowmark/2 : 1;
+      ReleaseToCentralCache(cl, drop);
+    }
+    list->clear_lowwatermark();
+  }
+
+  //int64 finish = CycleClock::Now();
+  //CycleTimer ct;
+  //MESSAGE("GC: %.0f ns\n", ct.CyclesToUsec(finish-start)*1000.0);
+}
+
+void TCMalloc_ThreadCache::PickNextSample(size_t k) {
+  // Make next "random" number
+  // x^32+x^22+x^2+x^1+1 is a primitive polynomial for random numbers
+  static const uint32_t kPoly = (1 << 22) | (1 << 2) | (1 << 1) | (1 << 0);
+  uint32_t r = rnd_;
+  rnd_ = (r << 1) ^ ((static_cast<int32_t>(r) >> 31) & kPoly);
+
+  // Next point is "rnd_ % (sample_period)".  I.e., average
+  // increment is "sample_period/2".
+  const int flag_value = static_cast<int>(FLAGS_tcmalloc_sample_parameter);
+  static int last_flag_value = -1;
+
+  if (flag_value != last_flag_value) {
+    SpinLockHolder h(&sample_period_lock);
+    int i;
+    for (i = 0; i < (static_cast<int>(sizeof(primes_list)/sizeof(primes_list[0])) - 1); i++) {
+      if (primes_list[i] >= flag_value) {
+        break;
+      }
+    }
+    sample_period = primes_list[i];
+    last_flag_value = flag_value;
+  }
+
+  bytes_until_sample_ += rnd_ % sample_period;
+
+  if (k > (static_cast<size_t>(-1) >> 2)) {
+    // If the user has asked for a huge allocation then it is possible
+    // for the code below to loop infinitely.  Just return (note that
+    // this throws off the sampling accuracy somewhat, but a user who
+    // is allocating more than 1G of memory at a time can live with a
+    // minor inaccuracy in profiling of small allocations, and also
+    // would rather not wait for the loop below to terminate).
+    return;
+  }
+
+  while (bytes_until_sample_ < k) {
+    // Increase bytes_until_sample_ by enough average sampling periods
+    // (sample_period >> 1) to allow us to sample past the current
+    // allocation.
+    bytes_until_sample_ += (sample_period >> 1);
+  }
+
+  bytes_until_sample_ -= k;
+}
+
+void TCMalloc_ThreadCache::InitModule() {
+  // There is a slight potential race here because of double-checked
+  // locking idiom.  However, as long as the program does a small
+  // allocation before switching to multi-threaded mode, we will be
+  // fine.  We increase the chances of doing such a small allocation
+  // by doing one in the constructor of the module_enter_exit_hook
+  // object declared below.
+  SpinLockHolder h(&pageheap_lock);
+  if (!phinited) {
+#ifdef WTF_CHANGES
+    InitTSD();
+#endif
+    InitSizeClasses();
+    threadheap_allocator.Init();
+    span_allocator.Init();
+    span_allocator.New(); // Reduce cache conflicts
+    span_allocator.New(); // Reduce cache conflicts
+    stacktrace_allocator.Init();
+    DLL_Init(&sampled_objects);
+    for (size_t i = 0; i < kNumClasses; ++i) {
+      central_cache[i].Init(i);
+    }
+    pageheap->init();
+    phinited = 1;
+#if defined(WTF_CHANGES) && OS(DARWIN)
+    FastMallocZone::init();
+#endif
+  }
+}
+
+inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::NewHeap(ThreadIdentifier tid) {
+  // Create the heap and add it to the linked list
+  TCMalloc_ThreadCache *heap = threadheap_allocator.New();
+  heap->Init(tid);
+  heap->next_ = thread_heaps;
+  heap->prev_ = NULL;
+  if (thread_heaps != NULL) thread_heaps->prev_ = heap;
+  thread_heaps = heap;
+  thread_heap_count++;
+  RecomputeThreadCacheSize();
+  return heap;
+}
+
+inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetThreadHeap() {
+#ifdef HAVE_TLS
+    // __thread is faster, but only when the kernel supports it
+  if (KernelSupportsTLS())
+    return threadlocal_heap;
+#elif OS(WINDOWS)
+    return static_cast<TCMalloc_ThreadCache*>(TlsGetValue(tlsIndex));
+#else
+    return static_cast<TCMalloc_ThreadCache*>(pthread_getspecific(heap_key));
+#endif
+}
+
+inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetCache() {
+  TCMalloc_ThreadCache* ptr = NULL;
+  if (!tsd_inited) {
+    InitModule();
+  } else {
+    ptr = GetThreadHeap();
+  }
+  if (ptr == NULL) ptr = CreateCacheIfNecessary();
+  return ptr;
+}
+
+// In deletion paths, we do not try to create a thread-cache.  This is
+// because we may be in the thread destruction code and may have
+// already cleaned up the cache for this thread.
+inline TCMalloc_ThreadCache* TCMalloc_ThreadCache::GetCacheIfPresent() {
+  if (!tsd_inited) return NULL;
+  void* const p = GetThreadHeap();
+  return reinterpret_cast<TCMalloc_ThreadCache*>(p);
+}
+
+void TCMalloc_ThreadCache::InitTSD() {
+  ASSERT(!tsd_inited);
+#if USE(PTHREAD_GETSPECIFIC_DIRECT)
+  pthread_key_init_np(heap_key, DestroyThreadCache);
+#else
+  pthread_key_create(&heap_key, DestroyThreadCache);
+#endif
+#if OS(WINDOWS)
+  tlsIndex = TlsAlloc();
+#endif
+  tsd_inited = true;
+    
+#if !OS(WINDOWS)
+  // We may have used a fake pthread_t for the main thread.  Fix it.
+  pthread_t zero;
+  memset(&zero, 0, sizeof(zero));
+#endif
+#ifndef WTF_CHANGES
+  SpinLockHolder h(&pageheap_lock);
+#else
+  ASSERT(pageheap_lock.IsHeld());
+#endif
+  for (TCMalloc_ThreadCache* h = thread_heaps; h != NULL; h = h->next_) {
+#if OS(WINDOWS)
+    if (h->tid_ == 0) {
+      h->tid_ = GetCurrentThreadId();
+    }
+#else
+    if (pthread_equal(h->tid_, zero)) {
+      h->tid_ = pthread_self();
+    }
+#endif
+  }
+}
+
+TCMalloc_ThreadCache* TCMalloc_ThreadCache::CreateCacheIfNecessary() {
+  // Initialize per-thread data if necessary
+  TCMalloc_ThreadCache* heap = NULL;
+  {
+    SpinLockHolder h(&pageheap_lock);
+
+#if OS(WINDOWS)
+    DWORD me;
+    if (!tsd_inited) {
+      me = 0;
+    } else {
+      me = GetCurrentThreadId();
+    }
+#else
+    // Early on in glibc's life, we cannot even call pthread_self()
+    pthread_t me;
+    if (!tsd_inited) {
+      memset(&me, 0, sizeof(me));
+    } else {
+      me = pthread_self();
+    }
+#endif
+
+    // This may be a recursive malloc call from pthread_setspecific()
+    // In that case, the heap for this thread has already been created
+    // and added to the linked list.  So we search for that first.
+    for (TCMalloc_ThreadCache* h = thread_heaps; h != NULL; h = h->next_) {
+#if OS(WINDOWS)
+      if (h->tid_ == me) {
+#else
+      if (pthread_equal(h->tid_, me)) {
+#endif
+        heap = h;
+        break;
+      }
+    }
+
+    if (heap == NULL) heap = NewHeap(me);
+  }
+
+  // We call pthread_setspecific() outside the lock because it may
+  // call malloc() recursively.  The recursive call will never get
+  // here again because it will find the already allocated heap in the
+  // linked list of heaps.
+  if (!heap->in_setspecific_ && tsd_inited) {
+    heap->in_setspecific_ = true;
+    setThreadHeap(heap);
+  }
+  return heap;
+}
+
+void TCMalloc_ThreadCache::BecomeIdle() {
+  if (!tsd_inited) return;              // No caches yet
+  TCMalloc_ThreadCache* heap = GetThreadHeap();
+  if (heap == NULL) return;             // No thread cache to remove
+  if (heap->in_setspecific_) return;    // Do not disturb the active caller
+
+  heap->in_setspecific_ = true;
+  setThreadHeap(NULL);
+#ifdef HAVE_TLS
+  // Also update the copy in __thread
+  threadlocal_heap = NULL;
+#endif
+  heap->in_setspecific_ = false;
+  if (GetThreadHeap() == heap) {
+    // Somehow heap got reinstated by a recursive call to malloc
+    // from pthread_setspecific.  We give up in this case.
+    return;
+  }
+
+  // We can now get rid of the heap
+  DeleteCache(heap);
+}
+
+void TCMalloc_ThreadCache::DestroyThreadCache(void* ptr) {
+  // Note that "ptr" cannot be NULL since pthread promises not
+  // to invoke the destructor on NULL values, but for safety,
+  // we check anyway.
+  if (ptr == NULL) return;
+#ifdef HAVE_TLS
+  // Prevent fast path of GetThreadHeap() from returning heap.
+  threadlocal_heap = NULL;
+#endif
+  DeleteCache(reinterpret_cast<TCMalloc_ThreadCache*>(ptr));
+}
+
+void TCMalloc_ThreadCache::DeleteCache(TCMalloc_ThreadCache* heap) {
+  // Remove all memory from heap
+  heap->Cleanup();
+
+  // Remove from linked list
+  SpinLockHolder h(&pageheap_lock);
+  if (heap->next_ != NULL) heap->next_->prev_ = heap->prev_;
+  if (heap->prev_ != NULL) heap->prev_->next_ = heap->next_;
+  if (thread_heaps == heap) thread_heaps = heap->next_;
+  thread_heap_count--;
+  RecomputeThreadCacheSize();
+
+  threadheap_allocator.Delete(heap);
+}
+
+void TCMalloc_ThreadCache::RecomputeThreadCacheSize() {
+  // Divide available space across threads
+  int n = thread_heap_count > 0 ? thread_heap_count : 1;
+  size_t space = overall_thread_cache_size / n;
+
+  // Limit to allowed range
+  if (space < kMinThreadCacheSize) space = kMinThreadCacheSize;
+  if (space > kMaxThreadCacheSize) space = kMaxThreadCacheSize;
+
+  per_thread_cache_size = space;
+}
+
+void TCMalloc_ThreadCache::Print() const {
+  for (size_t cl = 0; cl < kNumClasses; ++cl) {
+    MESSAGE("      %5" PRIuS " : %4d len; %4d lo\n",
+            ByteSizeForClass(cl),
+            list_[cl].length(),
+            list_[cl].lowwatermark());
+  }
+}
+
+// Extract interesting stats
+struct TCMallocStats {
+  uint64_t system_bytes;        // Bytes alloced from system
+  uint64_t thread_bytes;        // Bytes in thread caches
+  uint64_t central_bytes;       // Bytes in central cache
+  uint64_t transfer_bytes;      // Bytes in central transfer cache
+  uint64_t pageheap_bytes;      // Bytes in page heap
+  uint64_t metadata_bytes;      // Bytes alloced for metadata
+};
+
+#ifndef WTF_CHANGES
+// Get stats into "r".  Also get per-size-class counts if class_count != NULL
+static void ExtractStats(TCMallocStats* r, uint64_t* class_count) {
+  r->central_bytes = 0;
+  r->transfer_bytes = 0;
+  for (int cl = 0; cl < kNumClasses; ++cl) {
+    const int length = central_cache[cl].length();
+    const int tc_length = central_cache[cl].tc_length();
+    r->central_bytes += static_cast<uint64_t>(ByteSizeForClass(cl)) * length;
+    r->transfer_bytes +=
+      static_cast<uint64_t>(ByteSizeForClass(cl)) * tc_length;
+    if (class_count) class_count[cl] = length + tc_length;
+  }
+
+  // Add stats from per-thread heaps
+  r->thread_bytes = 0;
+  { // scope
+    SpinLockHolder h(&pageheap_lock);
+    for (TCMalloc_ThreadCache* h = thread_heaps; h != NULL; h = h->next_) {
+      r->thread_bytes += h->Size();
+      if (class_count) {
+        for (size_t cl = 0; cl < kNumClasses; ++cl) {
+          class_count[cl] += h->freelist_length(cl);
+        }
+      }
+    }
+  }
+
+  { //scope
+    SpinLockHolder h(&pageheap_lock);
+    r->system_bytes = pageheap->SystemBytes();
+    r->metadata_bytes = metadata_system_bytes;
+    r->pageheap_bytes = pageheap->FreeBytes();
+  }
+}
+#endif
+
+#ifndef WTF_CHANGES
+// WRITE stats to "out"
+static void DumpStats(TCMalloc_Printer* out, int level) {
+  TCMallocStats stats;
+  uint64_t class_count[kNumClasses];
+  ExtractStats(&stats, (level >= 2 ? class_count : NULL));
+
+  if (level >= 2) {
+    out->printf("------------------------------------------------\n");
+    uint64_t cumulative = 0;
+    for (int cl = 0; cl < kNumClasses; ++cl) {
+      if (class_count[cl] > 0) {
+        uint64_t class_bytes = class_count[cl] * ByteSizeForClass(cl);
+        cumulative += class_bytes;
+        out->printf("class %3d [ %8" PRIuS " bytes ] : "
+                "%8" PRIu64 " objs; %5.1f MB; %5.1f cum MB\n",
+                cl, ByteSizeForClass(cl),
+                class_count[cl],
+                class_bytes / 1048576.0,
+                cumulative / 1048576.0);
+      }
+    }
+
+    SpinLockHolder h(&pageheap_lock);
+    pageheap->Dump(out);
+  }
+
+  const uint64_t bytes_in_use = stats.system_bytes
+                                - stats.pageheap_bytes
+                                - stats.central_bytes
+                                - stats.transfer_bytes
+                                - stats.thread_bytes;
+
+  out->printf("------------------------------------------------\n"
+              "MALLOC: %12" PRIu64 " Heap size\n"
+              "MALLOC: %12" PRIu64 " Bytes in use by application\n"
+              "MALLOC: %12" PRIu64 " Bytes free in page heap\n"
+              "MALLOC: %12" PRIu64 " Bytes free in central cache\n"
+              "MALLOC: %12" PRIu64 " Bytes free in transfer cache\n"
+              "MALLOC: %12" PRIu64 " Bytes free in thread caches\n"
+              "MALLOC: %12" PRIu64 " Spans in use\n"
+              "MALLOC: %12" PRIu64 " Thread heaps in use\n"
+              "MALLOC: %12" PRIu64 " Metadata allocated\n"
+              "------------------------------------------------\n",
+              stats.system_bytes,
+              bytes_in_use,
+              stats.pageheap_bytes,
+              stats.central_bytes,
+              stats.transfer_bytes,
+              stats.thread_bytes,
+              uint64_t(span_allocator.inuse()),
+              uint64_t(threadheap_allocator.inuse()),
+              stats.metadata_bytes);
+}
+
+static void PrintStats(int level) {
+  const int kBufferSize = 16 << 10;
+  char* buffer = new char[kBufferSize];
+  TCMalloc_Printer printer(buffer, kBufferSize);
+  DumpStats(&printer, level);
+  write(STDERR_FILENO, buffer, strlen(buffer));
+  delete[] buffer;
+}
+
+static void** DumpStackTraces() {
+  // Count how much space we need
+  int needed_slots = 0;
+  {
+    SpinLockHolder h(&pageheap_lock);
+    for (Span* s = sampled_objects.next; s != &sampled_objects; s = s->next) {
+      StackTrace* stack = reinterpret_cast<StackTrace*>(s->objects);
+      needed_slots += 3 + stack->depth;
+    }
+    needed_slots += 100;            // Slop in case sample grows
+    needed_slots += needed_slots/8; // An extra 12.5% slop
+  }
+
+  void** result = new void*[needed_slots];
+  if (result == NULL) {
+    MESSAGE("tcmalloc: could not allocate %d slots for stack traces\n",
+            needed_slots);
+    return NULL;
+  }
+
+  SpinLockHolder h(&pageheap_lock);
+  int used_slots = 0;
+  for (Span* s = sampled_objects.next; s != &sampled_objects; s = s->next) {
+    ASSERT(used_slots < needed_slots);  // Need to leave room for terminator
+    StackTrace* stack = reinterpret_cast<StackTrace*>(s->objects);
+    if (used_slots + 3 + stack->depth >= needed_slots) {
+      // No more room
+      break;
+    }
+
+    result[used_slots+0] = reinterpret_cast<void*>(static_cast<uintptr_t>(1));
+    result[used_slots+1] = reinterpret_cast<void*>(stack->size);
+    result[used_slots+2] = reinterpret_cast<void*>(stack->depth);
+    for (int d = 0; d < stack->depth; d++) {
+      result[used_slots+3+d] = stack->stack[d];
+    }
+    used_slots += 3 + stack->depth;
+  }
+  result[used_slots] = reinterpret_cast<void*>(static_cast<uintptr_t>(0));
+  return result;
+}
+#endif
+
+#ifndef WTF_CHANGES
+
+// TCMalloc's support for extra malloc interfaces
+class TCMallocImplementation : public MallocExtension {
+ public:
+  virtual void GetStats(char* buffer, int buffer_length) {
+    ASSERT(buffer_length > 0);
+    TCMalloc_Printer printer(buffer, buffer_length);
+
+    // Print level one stats unless lots of space is available
+    if (buffer_length < 10000) {
+      DumpStats(&printer, 1);
+    } else {
+      DumpStats(&printer, 2);
+    }
+  }
+
+  virtual void** ReadStackTraces() {
+    return DumpStackTraces();
+  }
+
+  virtual bool GetNumericProperty(const char* name, size_t* value) {
+    ASSERT(name != NULL);
+
+    if (strcmp(name, "generic.current_allocated_bytes") == 0) {
+      TCMallocStats stats;
+      ExtractStats(&stats, NULL);
+      *value = stats.system_bytes
+               - stats.thread_bytes
+               - stats.central_bytes
+               - stats.pageheap_bytes;
+      return true;
+    }
+
+    if (strcmp(name, "generic.heap_size") == 0) {
+      TCMallocStats stats;
+      ExtractStats(&stats, NULL);
+      *value = stats.system_bytes;
+      return true;
+    }
+
+    if (strcmp(name, "tcmalloc.slack_bytes") == 0) {
+      // We assume that bytes in the page heap are not fragmented too
+      // badly, and are therefore available for allocation.
+      SpinLockHolder l(&pageheap_lock);
+      *value = pageheap->FreeBytes();
+      return true;
+    }
+
+    if (strcmp(name, "tcmalloc.max_total_thread_cache_bytes") == 0) {
+      SpinLockHolder l(&pageheap_lock);
+      *value = overall_thread_cache_size;
+      return true;
+    }
+
+    if (strcmp(name, "tcmalloc.current_total_thread_cache_bytes") == 0) {
+      TCMallocStats stats;
+      ExtractStats(&stats, NULL);
+      *value = stats.thread_bytes;
+      return true;
+    }
+
+    return false;
+  }
+
+  virtual bool SetNumericProperty(const char* name, size_t value) {
+    ASSERT(name != NULL);
+
+    if (strcmp(name, "tcmalloc.max_total_thread_cache_bytes") == 0) {
+      // Clip the value to a reasonable range
+      if (value < kMinThreadCacheSize) value = kMinThreadCacheSize;
+      if (value > (1<<30)) value = (1<<30);     // Limit to 1GB
+
+      SpinLockHolder l(&pageheap_lock);
+      overall_thread_cache_size = static_cast<size_t>(value);
+      TCMalloc_ThreadCache::RecomputeThreadCacheSize();
+      return true;
+    }
+
+    return false;
+  }
+
+  virtual void MarkThreadIdle() {
+    TCMalloc_ThreadCache::BecomeIdle();
+  }
+
+  virtual void ReleaseFreeMemory() {
+    SpinLockHolder h(&pageheap_lock);
+    pageheap->ReleaseFreePages();
+  }
+};
+#endif
+
+// The constructor allocates an object to ensure that initialization
+// runs before main(), and therefore we do not have a chance to become
+// multi-threaded before initialization.  We also create the TSD key
+// here.  Presumably by the time this constructor runs, glibc is in
+// good enough shape to handle pthread_key_create().
+//
+// The constructor also takes the opportunity to tell STL to use
+// tcmalloc.  We want to do this early, before construct time, so
+// all user STL allocations go through tcmalloc (which works really
+// well for STL).
+//
+// The destructor prints stats when the program exits.
+class TCMallocGuard {
+ public:
+
+  TCMallocGuard() {
+#ifdef HAVE_TLS    // this is true if the cc/ld/libc combo support TLS
+    // Check whether the kernel also supports TLS (needs to happen at runtime)
+    CheckIfKernelSupportsTLS();
+#endif
+#ifndef WTF_CHANGES
+#ifdef WIN32                    // patch the windows VirtualAlloc, etc.
+    PatchWindowsFunctions();    // defined in windows/patch_functions.cc
+#endif
+#endif
+    free(malloc(1));
+    TCMalloc_ThreadCache::InitTSD();
+    free(malloc(1));
+#ifndef WTF_CHANGES
+    MallocExtension::Register(new TCMallocImplementation);
+#endif
+  }
+
+#ifndef WTF_CHANGES
+  ~TCMallocGuard() {
+    const char* env = getenv("MALLOCSTATS");
+    if (env != NULL) {
+      int level = atoi(env);
+      if (level < 1) level = 1;
+      PrintStats(level);
+    }
+#ifdef WIN32
+    UnpatchWindowsFunctions();
+#endif
+  }
+#endif
+};
+
+#ifndef WTF_CHANGES
+static TCMallocGuard module_enter_exit_hook;
+#endif
+
+
+//-------------------------------------------------------------------
+// Helpers for the exported routines below
+//-------------------------------------------------------------------
+
+#ifndef WTF_CHANGES
+
+static Span* DoSampledAllocation(size_t size) {
+
+  // Grab the stack trace outside the heap lock
+  StackTrace tmp;
+  tmp.depth = GetStackTrace(tmp.stack, kMaxStackDepth, 1);
+  tmp.size = size;
+
+  SpinLockHolder h(&pageheap_lock);
+  // Allocate span
+  Span *span = pageheap->New(pages(size == 0 ? 1 : size));
+  if (span == NULL) {
+    return NULL;
+  }
+
+  // Allocate stack trace
+  StackTrace *stack = stacktrace_allocator.New();
+  if (stack == NULL) {
+    // Sampling failed because of lack of memory
+    return span;
+  }
+
+  *stack = tmp;
+  span->sample = 1;
+  span->objects = stack;
+  DLL_Prepend(&sampled_objects, span);
+
+  return span;
+}
+#endif
+
+static inline bool CheckCachedSizeClass(void *ptr) {
+  PageID p = reinterpret_cast<uintptr_t>(ptr) >> kPageShift;
+  size_t cached_value = pageheap->GetSizeClassIfCached(p);
+  return cached_value == 0 ||
+      cached_value == pageheap->GetDescriptor(p)->sizeclass;
+}
+
+static inline void* CheckedMallocResult(void *result)
+{
+  ASSERT(result == 0 || CheckCachedSizeClass(result));
+  return result;
+}
+
+static inline void* SpanToMallocResult(Span *span) {
+  ASSERT_SPAN_COMMITTED(span);
+  pageheap->CacheSizeClass(span->start, 0);
+  return
+      CheckedMallocResult(reinterpret_cast<void*>(span->start << kPageShift));
+}
+
+#ifdef WTF_CHANGES
+template <bool crashOnFailure>
+#endif
+static ALWAYS_INLINE void* do_malloc(size_t size) {
+  void* ret = NULL;
+
+#ifdef WTF_CHANGES
+    ASSERT(!isForbidden());
+#endif
+
+  // The following call forces module initialization
+  TCMalloc_ThreadCache* heap = TCMalloc_ThreadCache::GetCache();
+#ifndef WTF_CHANGES
+  if ((FLAGS_tcmalloc_sample_parameter > 0) && heap->SampleAllocation(size)) {
+    Span* span = DoSampledAllocation(size);
+    if (span != NULL) {
+      ret = SpanToMallocResult(span);
+    }
+  } else
+#endif
+  if (size > kMaxSize) {
+    // Use page-level allocator
+    SpinLockHolder h(&pageheap_lock);
+    Span* span = pageheap->New(pages(size));
+    if (span != NULL) {
+      ret = SpanToMallocResult(span);
+    }
+  } else {
+    // The common case, and also the simplest.  This just pops the
+    // size-appropriate freelist, afer replenishing it if it's empty.
+    ret = CheckedMallocResult(heap->Allocate(size));
+  }
+  if (!ret) {
+#ifdef WTF_CHANGES
+    if (crashOnFailure) // This branch should be optimized out by the compiler.
+        CRASH();
+#else
+    errno = ENOMEM;
+#endif
+  }
+  return ret;
+}
+
+static ALWAYS_INLINE void do_free(void* ptr) {
+  if (ptr == NULL) return;
+  ASSERT(pageheap != NULL);  // Should not call free() before malloc()
+  const PageID p = reinterpret_cast<uintptr_t>(ptr) >> kPageShift;
+  Span* span = NULL;
+  size_t cl = pageheap->GetSizeClassIfCached(p);
+
+  if (cl == 0) {
+    span = pageheap->GetDescriptor(p);
+    cl = span->sizeclass;
+    pageheap->CacheSizeClass(p, cl);
+  }
+  if (cl != 0) {
+#ifndef NO_TCMALLOC_SAMPLES
+    ASSERT(!pageheap->GetDescriptor(p)->sample);
+#endif
+    TCMalloc_ThreadCache* heap = TCMalloc_ThreadCache::GetCacheIfPresent();
+    if (heap != NULL) {
+      heap->Deallocate(ptr, cl);
+    } else {
+      // Delete directly into central cache
+      SLL_SetNext(ptr, NULL);
+      central_cache[cl].InsertRange(ptr, ptr, 1);
+    }
+  } else {
+    SpinLockHolder h(&pageheap_lock);
+    ASSERT(reinterpret_cast<uintptr_t>(ptr) % kPageSize == 0);
+    ASSERT(span != NULL && span->start == p);
+#ifndef NO_TCMALLOC_SAMPLES
+    if (span->sample) {
+      DLL_Remove(span);
+      stacktrace_allocator.Delete(reinterpret_cast<StackTrace*>(span->objects));
+      span->objects = NULL;
+    }
+#endif
+    pageheap->Delete(span);
+  }
+}
+
+#ifndef WTF_CHANGES
+// For use by exported routines below that want specific alignments
+//
+// Note: this code can be slow, and can significantly fragment memory.
+// The expectation is that memalign/posix_memalign/valloc/pvalloc will
+// not be invoked very often.  This requirement simplifies our
+// implementation and allows us to tune for expected allocation
+// patterns.
+static void* do_memalign(size_t align, size_t size) {
+  ASSERT((align & (align - 1)) == 0);
+  ASSERT(align > 0);
+  if (pageheap == NULL) TCMalloc_ThreadCache::InitModule();
+
+  // Allocate at least one byte to avoid boundary conditions below
+  if (size == 0) size = 1;
+
+  if (size <= kMaxSize && align < kPageSize) {
+    // Search through acceptable size classes looking for one with
+    // enough alignment.  This depends on the fact that
+    // InitSizeClasses() currently produces several size classes that
+    // are aligned at powers of two.  We will waste time and space if
+    // we miss in the size class array, but that is deemed acceptable
+    // since memalign() should be used rarely.
+    size_t cl = SizeClass(size);
+    while (cl < kNumClasses && ((class_to_size[cl] & (align - 1)) != 0)) {
+      cl++;
+    }
+    if (cl < kNumClasses) {
+      TCMalloc_ThreadCache* heap = TCMalloc_ThreadCache::GetCache();
+      return CheckedMallocResult(heap->Allocate(class_to_size[cl]));
+    }
+  }
+
+  // We will allocate directly from the page heap
+  SpinLockHolder h(&pageheap_lock);
+
+  if (align <= kPageSize) {
+    // Any page-level allocation will be fine
+    // TODO: We could put the rest of this page in the appropriate
+    // TODO: cache but it does not seem worth it.
+    Span* span = pageheap->New(pages(size));
+    return span == NULL ? NULL : SpanToMallocResult(span);
+  }
+
+  // Allocate extra pages and carve off an aligned portion
+  const Length alloc = pages(size + align);
+  Span* span = pageheap->New(alloc);
+  if (span == NULL) return NULL;
+
+  // Skip starting portion so that we end up aligned
+  Length skip = 0;
+  while ((((span->start+skip) << kPageShift) & (align - 1)) != 0) {
+    skip++;
+  }
+  ASSERT(skip < alloc);
+  if (skip > 0) {
+    Span* rest = pageheap->Split(span, skip);
+    pageheap->Delete(span);
+    span = rest;
+  }
+
+  // Skip trailing portion that we do not need to return
+  const Length needed = pages(size);
+  ASSERT(span->length >= needed);
+  if (span->length > needed) {
+    Span* trailer = pageheap->Split(span, needed);
+    pageheap->Delete(trailer);
+  }
+  return SpanToMallocResult(span);
+}
+#endif
+
+// Helpers for use by exported routines below:
+
+#ifndef WTF_CHANGES
+static inline void do_malloc_stats() {
+  PrintStats(1);
+}
+#endif
+
+static inline int do_mallopt(int, int) {
+  return 1;     // Indicates error
+}
+
+#ifdef HAVE_STRUCT_MALLINFO  // mallinfo isn't defined on freebsd, for instance
+static inline struct mallinfo do_mallinfo() {
+  TCMallocStats stats;
+  ExtractStats(&stats, NULL);
+
+  // Just some of the fields are filled in.
+  struct mallinfo info;
+  memset(&info, 0, sizeof(info));
+
+  // Unfortunately, the struct contains "int" field, so some of the
+  // size values will be truncated.
+  info.arena     = static_cast<int>(stats.system_bytes);
+  info.fsmblks   = static_cast<int>(stats.thread_bytes
+                                    + stats.central_bytes
+                                    + stats.transfer_bytes);
+  info.fordblks  = static_cast<int>(stats.pageheap_bytes);
+  info.uordblks  = static_cast<int>(stats.system_bytes
+                                    - stats.thread_bytes
+                                    - stats.central_bytes
+                                    - stats.transfer_bytes
+                                    - stats.pageheap_bytes);
+
+  return info;
+}
+#endif
+
+//-------------------------------------------------------------------
+// Exported routines
+//-------------------------------------------------------------------
+
+// CAVEAT: The code structure below ensures that MallocHook methods are always
+//         called from the stack frame of the invoked allocation function.
+//         heap-checker.cc depends on this to start a stack trace from
+//         the call to the (de)allocation function.
+
+#ifndef WTF_CHANGES
+extern "C" 
+#else
+#define do_malloc do_malloc<crashOnFailure>
+
+template <bool crashOnFailure>
+ALWAYS_INLINE void* malloc(size_t);
+
+void* fastMalloc(size_t size)
+{
+    return malloc<true>(size);
+}
+
+TryMallocReturnValue tryFastMalloc(size_t size)
+{
+    return malloc<false>(size);
+}
+
+template <bool crashOnFailure>
+ALWAYS_INLINE
+#endif
+void* malloc(size_t size) {
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= size)  // If overflow would occur...
+        return 0;
+    void* result = do_malloc(size + Internal::ValidationBufferSize);
+    if (!result)
+        return 0;
+
+    Internal::ValidationHeader* header = static_cast<Internal::ValidationHeader*>(result);
+    header->m_size = size;
+    header->m_type = Internal::AllocTypeMalloc;
+    header->m_prefix = static_cast<unsigned>(Internal::ValidationPrefix);
+    result = header + 1;
+    *Internal::fastMallocValidationSuffix(result) = Internal::ValidationSuffix;
+    fastMallocValidate(result);
+#else
+    void* result = do_malloc(size);
+#endif
+
+#ifndef WTF_CHANGES
+  MallocHook::InvokeNewHook(result, size);
+#endif
+  return result;
+}
+
+#ifndef WTF_CHANGES
+extern "C" 
+#endif
+void free(void* ptr) {
+#ifndef WTF_CHANGES
+  MallocHook::InvokeDeleteHook(ptr);
+#endif
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    if (!ptr)
+        return;
+
+    fastMallocValidate(ptr);
+    Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(ptr);
+    memset(ptr, 0xCC, header->m_size);
+    do_free(header);
+#else
+    do_free(ptr);
+#endif
+}
+
+#ifndef WTF_CHANGES
+extern "C" 
+#else
+template <bool crashOnFailure>
+ALWAYS_INLINE void* calloc(size_t, size_t);
+
+void* fastCalloc(size_t n, size_t elem_size)
+{
+    void* result = calloc<true>(n, elem_size);
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    fastMallocValidate(result);
+#endif
+    return result;
+}
+
+TryMallocReturnValue tryFastCalloc(size_t n, size_t elem_size)
+{
+    void* result = calloc<false>(n, elem_size);
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    fastMallocValidate(result);
+#endif
+    return result;
+}
+
+template <bool crashOnFailure>
+ALWAYS_INLINE
+#endif
+void* calloc(size_t n, size_t elem_size) {
+  size_t totalBytes = n * elem_size;
+    
+  // Protect against overflow
+  if (n > 1 && elem_size && (totalBytes / elem_size) != n)
+    return 0;
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    void* result = malloc<crashOnFailure>(totalBytes);
+    if (!result)
+        return 0;
+
+    memset(result, 0, totalBytes);
+    fastMallocValidate(result);
+#else
+    void* result = do_malloc(totalBytes);
+    if (result != NULL) {
+        memset(result, 0, totalBytes);
+    }
+#endif
+
+#ifndef WTF_CHANGES
+  MallocHook::InvokeNewHook(result, totalBytes);
+#endif
+  return result;
+}
+
+// Since cfree isn't used anywhere, we don't compile it in.
+#ifndef WTF_CHANGES
+#ifndef WTF_CHANGES
+extern "C" 
+#endif
+void cfree(void* ptr) {
+#ifndef WTF_CHANGES
+    MallocHook::InvokeDeleteHook(ptr);
+#endif
+  do_free(ptr);
+}
+#endif
+
+#ifndef WTF_CHANGES
+extern "C" 
+#else
+template <bool crashOnFailure>
+ALWAYS_INLINE void* realloc(void*, size_t);
+
+void* fastRealloc(void* old_ptr, size_t new_size)
+{
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    fastMallocValidate(old_ptr);
+#endif
+    void* result = realloc<true>(old_ptr, new_size);
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    fastMallocValidate(result);
+#endif
+    return result;
+}
+
+TryMallocReturnValue tryFastRealloc(void* old_ptr, size_t new_size)
+{
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    fastMallocValidate(old_ptr);
+#endif
+    void* result = realloc<false>(old_ptr, new_size);
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    fastMallocValidate(result);
+#endif
+    return result;
+}
+
+template <bool crashOnFailure>
+ALWAYS_INLINE
+#endif
+void* realloc(void* old_ptr, size_t new_size) {
+  if (old_ptr == NULL) {
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    void* result = malloc<crashOnFailure>(new_size);
+#else
+    void* result = do_malloc(new_size);
+#ifndef WTF_CHANGES
+    MallocHook::InvokeNewHook(result, new_size);
+#endif
+#endif
+    return result;
+  }
+  if (new_size == 0) {
+#ifndef WTF_CHANGES
+    MallocHook::InvokeDeleteHook(old_ptr);
+#endif
+    free(old_ptr);
+    return NULL;
+  }
+
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= new_size)  // If overflow would occur...
+        return 0;
+    Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(old_ptr);
+    fastMallocValidate(old_ptr);
+    old_ptr = header;
+    header->m_size = new_size;
+    new_size += Internal::ValidationBufferSize;
+#endif
+
+  // Get the size of the old entry
+  const PageID p = reinterpret_cast<uintptr_t>(old_ptr) >> kPageShift;
+  size_t cl = pageheap->GetSizeClassIfCached(p);
+  Span *span = NULL;
+  size_t old_size;
+  if (cl == 0) {
+    span = pageheap->GetDescriptor(p);
+    cl = span->sizeclass;
+    pageheap->CacheSizeClass(p, cl);
+  }
+  if (cl != 0) {
+    old_size = ByteSizeForClass(cl);
+  } else {
+    ASSERT(span != NULL);
+    old_size = span->length << kPageShift;
+  }
+
+  // Reallocate if the new size is larger than the old size,
+  // or if the new size is significantly smaller than the old size.
+  if ((new_size > old_size) || (AllocationSize(new_size) < old_size)) {
+    // Need to reallocate
+    void* new_ptr = do_malloc(new_size);
+    if (new_ptr == NULL) {
+      return NULL;
+    }
+#ifndef WTF_CHANGES
+    MallocHook::InvokeNewHook(new_ptr, new_size);
+#endif
+    memcpy(new_ptr, old_ptr, ((old_size < new_size) ? old_size : new_size));
+#ifndef WTF_CHANGES
+    MallocHook::InvokeDeleteHook(old_ptr);
+#endif
+    // We could use a variant of do_free() that leverages the fact
+    // that we already know the sizeclass of old_ptr.  The benefit
+    // would be small, so don't bother.
+    do_free(old_ptr);
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    new_ptr = static_cast<Internal::ValidationHeader*>(new_ptr) + 1;
+    *Internal::fastMallocValidationSuffix(new_ptr) = Internal::ValidationSuffix;
+#endif
+    return new_ptr;
+  } else {
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    old_ptr = static_cast<Internal::ValidationHeader*>(old_ptr) + 1; // Set old_ptr back to the user pointer.
+    *Internal::fastMallocValidationSuffix(old_ptr) = Internal::ValidationSuffix;
+#endif
+    return old_ptr;
+  }
+}
+
+#ifdef WTF_CHANGES
+#undef do_malloc
+#else
+
+static SpinLock set_new_handler_lock = SPINLOCK_INITIALIZER;
+
+static inline void* cpp_alloc(size_t size, bool nothrow) {
+  for (;;) {
+    void* p = do_malloc(size);
+#ifdef PREANSINEW
+    return p;
+#else
+    if (p == NULL) {  // allocation failed
+      // Get the current new handler.  NB: this function is not
+      // thread-safe.  We make a feeble stab at making it so here, but
+      // this lock only protects against tcmalloc interfering with
+      // itself, not with other libraries calling set_new_handler.
+      std::new_handler nh;
+      {
+        SpinLockHolder h(&set_new_handler_lock);
+        nh = std::set_new_handler(0);
+        (void) std::set_new_handler(nh);
+      }
+      // If no new_handler is established, the allocation failed.
+      if (!nh) {
+        if (nothrow) return 0;
+        throw std::bad_alloc();
+      }
+      // Otherwise, try the new_handler.  If it returns, retry the
+      // allocation.  If it throws std::bad_alloc, fail the allocation.
+      // if it throws something else, don't interfere.
+      try {
+        (*nh)();
+      } catch (const std::bad_alloc&) {
+        if (!nothrow) throw;
+        return p;
+      }
+    } else {  // allocation success
+      return p;
+    }
+#endif
+  }
+}
+
+#if ENABLE(GLOBAL_FASTMALLOC_NEW)
+
+void* operator new(size_t size) {
+  void* p = cpp_alloc(size, false);
+  // We keep this next instruction out of cpp_alloc for a reason: when
+  // it's in, and new just calls cpp_alloc, the optimizer may fold the
+  // new call into cpp_alloc, which messes up our whole section-based
+  // stacktracing (see ATTRIBUTE_SECTION, above).  This ensures cpp_alloc
+  // isn't the last thing this fn calls, and prevents the folding.
+  MallocHook::InvokeNewHook(p, size);
+  return p;
+}
+
+void* operator new(size_t size, const std::nothrow_t&) __THROW {
+  void* p = cpp_alloc(size, true);
+  MallocHook::InvokeNewHook(p, size);
+  return p;
+}
+
+void operator delete(void* p) __THROW {
+  MallocHook::InvokeDeleteHook(p);
+  do_free(p);
+}
+
+void operator delete(void* p, const std::nothrow_t&) __THROW {
+  MallocHook::InvokeDeleteHook(p);
+  do_free(p);
+}
+
+void* operator new[](size_t size) {
+  void* p = cpp_alloc(size, false);
+  // We keep this next instruction out of cpp_alloc for a reason: when
+  // it's in, and new just calls cpp_alloc, the optimizer may fold the
+  // new call into cpp_alloc, which messes up our whole section-based
+  // stacktracing (see ATTRIBUTE_SECTION, above).  This ensures cpp_alloc
+  // isn't the last thing this fn calls, and prevents the folding.
+  MallocHook::InvokeNewHook(p, size);
+  return p;
+}
+
+void* operator new[](size_t size, const std::nothrow_t&) __THROW {
+  void* p = cpp_alloc(size, true);
+  MallocHook::InvokeNewHook(p, size);
+  return p;
+}
+
+void operator delete[](void* p) __THROW {
+  MallocHook::InvokeDeleteHook(p);
+  do_free(p);
+}
+
+void operator delete[](void* p, const std::nothrow_t&) __THROW {
+  MallocHook::InvokeDeleteHook(p);
+  do_free(p);
+}
+
+#endif
+
+extern "C" void* memalign(size_t align, size_t size) __THROW {
+  void* result = do_memalign(align, size);
+  MallocHook::InvokeNewHook(result, size);
+  return result;
+}
+
+extern "C" int posix_memalign(void** result_ptr, size_t align, size_t size)
+    __THROW {
+  if (((align % sizeof(void*)) != 0) ||
+      ((align & (align - 1)) != 0) ||
+      (align == 0)) {
+    return EINVAL;
+  }
+
+  void* result = do_memalign(align, size);
+  MallocHook::InvokeNewHook(result, size);
+  if (result == NULL) {
+    return ENOMEM;
+  } else {
+    *result_ptr = result;
+    return 0;
+  }
+}
+
+static size_t pagesize = 0;
+
+extern "C" void* valloc(size_t size) __THROW {
+  // Allocate page-aligned object of length >= size bytes
+  if (pagesize == 0) pagesize = getpagesize();
+  void* result = do_memalign(pagesize, size);
+  MallocHook::InvokeNewHook(result, size);
+  return result;
+}
+
+extern "C" void* pvalloc(size_t size) __THROW {
+  // Round up size to a multiple of pagesize
+  if (pagesize == 0) pagesize = getpagesize();
+  size = (size + pagesize - 1) & ~(pagesize - 1);
+  void* result = do_memalign(pagesize, size);
+  MallocHook::InvokeNewHook(result, size);
+  return result;
+}
+
+extern "C" void malloc_stats(void) {
+  do_malloc_stats();
+}
+
+extern "C" int mallopt(int cmd, int value) {
+  return do_mallopt(cmd, value);
+}
+
+#ifdef HAVE_STRUCT_MALLINFO
+extern "C" struct mallinfo mallinfo(void) {
+  return do_mallinfo();
+}
+#endif
+
+//-------------------------------------------------------------------
+// Some library routines on RedHat 9 allocate memory using malloc()
+// and free it using __libc_free() (or vice-versa).  Since we provide
+// our own implementations of malloc/free, we need to make sure that
+// the __libc_XXX variants (defined as part of glibc) also point to
+// the same implementations.
+//-------------------------------------------------------------------
+
+#if defined(__GLIBC__)
+extern "C" {
+#if COMPILER(GCC) && !defined(__MACH__) && defined(HAVE___ATTRIBUTE__)
+  // Potentially faster variants that use the gcc alias extension.
+  // Mach-O (Darwin) does not support weak aliases, hence the __MACH__ check.
+# define ALIAS(x) __attribute__ ((weak, alias (x)))
+  void* __libc_malloc(size_t size)              ALIAS("malloc");
+  void  __libc_free(void* ptr)                  ALIAS("free");
+  void* __libc_realloc(void* ptr, size_t size)  ALIAS("realloc");
+  void* __libc_calloc(size_t n, size_t size)    ALIAS("calloc");
+  void  __libc_cfree(void* ptr)                 ALIAS("cfree");
+  void* __libc_memalign(size_t align, size_t s) ALIAS("memalign");
+  void* __libc_valloc(size_t size)              ALIAS("valloc");
+  void* __libc_pvalloc(size_t size)             ALIAS("pvalloc");
+  int __posix_memalign(void** r, size_t a, size_t s) ALIAS("posix_memalign");
+# undef ALIAS
+# else   /* not __GNUC__ */
+  // Portable wrappers
+  void* __libc_malloc(size_t size)              { return malloc(size);       }
+  void  __libc_free(void* ptr)                  { free(ptr);                 }
+  void* __libc_realloc(void* ptr, size_t size)  { return realloc(ptr, size); }
+  void* __libc_calloc(size_t n, size_t size)    { return calloc(n, size);    }
+  void  __libc_cfree(void* ptr)                 { cfree(ptr);                }
+  void* __libc_memalign(size_t align, size_t s) { return memalign(align, s); }
+  void* __libc_valloc(size_t size)              { return valloc(size);       }
+  void* __libc_pvalloc(size_t size)             { return pvalloc(size);      }
+  int __posix_memalign(void** r, size_t a, size_t s) {
+    return posix_memalign(r, a, s);
+  }
+# endif  /* __GNUC__ */
+}
+#endif   /* __GLIBC__ */
+
+// Override __libc_memalign in libc on linux boxes specially.
+// They have a bug in libc that causes them to (very rarely) allocate
+// with __libc_memalign() yet deallocate with free() and the
+// definitions above don't catch it.
+// This function is an exception to the rule of calling MallocHook method
+// from the stack frame of the allocation function;
+// heap-checker handles this special case explicitly.
+static void *MemalignOverride(size_t align, size_t size, const void *caller)
+    __THROW {
+  void* result = do_memalign(align, size);
+  MallocHook::InvokeNewHook(result, size);
+  return result;
+}
+void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
+
+#endif
+
+#ifdef WTF_CHANGES
+void releaseFastMallocFreeMemory()
+{
+    // Flush free pages in the current thread cache back to the page heap.
+    // Low watermark mechanism in Scavenge() prevents full return on the first pass.
+    // The second pass flushes everything.
+    if (TCMalloc_ThreadCache* threadCache = TCMalloc_ThreadCache::GetCacheIfPresent()) {
+        threadCache->Scavenge();
+        threadCache->Scavenge();
+    }
+
+    SpinLockHolder h(&pageheap_lock);
+    pageheap->ReleaseFreePages();
+}
+    
+FastMallocStatistics fastMallocStatistics()
+{
+    FastMallocStatistics statistics;
+
+    SpinLockHolder lockHolder(&pageheap_lock);
+    statistics.reservedVMBytes = static_cast<size_t>(pageheap->SystemBytes());
+    statistics.committedVMBytes = statistics.reservedVMBytes - pageheap->ReturnedBytes();
+
+    statistics.freeListBytes = 0;
+    for (unsigned cl = 0; cl < kNumClasses; ++cl) {
+        const int length = central_cache[cl].length();
+        const int tc_length = central_cache[cl].tc_length();
+
+        statistics.freeListBytes += ByteSizeForClass(cl) * (length + tc_length);
+    }
+    for (TCMalloc_ThreadCache* threadCache = thread_heaps; threadCache ; threadCache = threadCache->next_)
+        statistics.freeListBytes += threadCache->Size();
+
+    return statistics;
+}
+
+size_t fastMallocSize(const void* ptr)
+{
+#if ENABLE(WTF_MALLOC_VALIDATION)
+    return Internal::fastMallocValidationHeader(const_cast<void*>(ptr))->m_size;
+#else
+    const PageID p = reinterpret_cast<uintptr_t>(ptr) >> kPageShift;
+    Span* span = pageheap->GetDescriptorEnsureSafe(p);
+
+    if (!span || span->free)
+        return 0;
+
+    for (void* free = span->objects; free != NULL; free = *((void**) free)) {
+        if (ptr == free)
+            return 0;
+    }
+
+    if (size_t cl = span->sizeclass)
+        return ByteSizeForClass(cl);
+
+    return span->length << kPageShift;
+#endif
+}
+
+#if OS(DARWIN)
+
+class FreeObjectFinder {
+    const RemoteMemoryReader& m_reader;
+    HashSet<void*> m_freeObjects;
+
+public:
+    FreeObjectFinder(const RemoteMemoryReader& reader) : m_reader(reader) { }
+
+    void visit(void* ptr) { m_freeObjects.add(ptr); }
+    bool isFreeObject(void* ptr) const { return m_freeObjects.contains(ptr); }
+    bool isFreeObject(vm_address_t ptr) const { return isFreeObject(reinterpret_cast<void*>(ptr)); }
+    size_t freeObjectCount() const { return m_freeObjects.size(); }
+
+    void findFreeObjects(TCMalloc_ThreadCache* threadCache)
+    {
+        for (; threadCache; threadCache = (threadCache->next_ ? m_reader(threadCache->next_) : 0))
+            threadCache->enumerateFreeObjects(*this, m_reader);
+    }
+
+    void findFreeObjects(TCMalloc_Central_FreeListPadded* centralFreeList, size_t numSizes, TCMalloc_Central_FreeListPadded* remoteCentralFreeList)
+    {
+        for (unsigned i = 0; i < numSizes; i++)
+            centralFreeList[i].enumerateFreeObjects(*this, m_reader, remoteCentralFreeList + i);
+    }
+};
+
+class PageMapFreeObjectFinder {
+    const RemoteMemoryReader& m_reader;
+    FreeObjectFinder& m_freeObjectFinder;
+
+public:
+    PageMapFreeObjectFinder(const RemoteMemoryReader& reader, FreeObjectFinder& freeObjectFinder)
+        : m_reader(reader)
+        , m_freeObjectFinder(freeObjectFinder)
+    { }
+
+    int visit(void* ptr) const
+    {
+        if (!ptr)
+            return 1;
+
+        Span* span = m_reader(reinterpret_cast<Span*>(ptr));
+        if (!span)
+            return 1;
+
+        if (span->free) {
+            void* ptr = reinterpret_cast<void*>(span->start << kPageShift);
+            m_freeObjectFinder.visit(ptr);
+        } else if (span->sizeclass) {
+            // Walk the free list of the small-object span, keeping track of each object seen
+            for (void* nextObject = span->objects; nextObject; nextObject = m_reader.nextEntryInLinkedList(reinterpret_cast<void**>(nextObject)))
+                m_freeObjectFinder.visit(nextObject);
+        }
+        return span->length;
+    }
+};
+
+class PageMapMemoryUsageRecorder {
+    task_t m_task;
+    void* m_context;
+    unsigned m_typeMask;
+    vm_range_recorder_t* m_recorder;
+    const RemoteMemoryReader& m_reader;
+    const FreeObjectFinder& m_freeObjectFinder;
+
+    HashSet<void*> m_seenPointers;
+    Vector<Span*> m_coalescedSpans;
+
+public:
+    PageMapMemoryUsageRecorder(task_t task, void* context, unsigned typeMask, vm_range_recorder_t* recorder, const RemoteMemoryReader& reader, const FreeObjectFinder& freeObjectFinder)
+        : m_task(task)
+        , m_context(context)
+        , m_typeMask(typeMask)
+        , m_recorder(recorder)
+        , m_reader(reader)
+        , m_freeObjectFinder(freeObjectFinder)
+    { }
+
+    ~PageMapMemoryUsageRecorder()
+    {
+        ASSERT(!m_coalescedSpans.size());
+    }
+
+    void recordPendingRegions()
+    {
+        Span* lastSpan = m_coalescedSpans[m_coalescedSpans.size() - 1];
+        vm_range_t ptrRange = { m_coalescedSpans[0]->start << kPageShift, 0 };
+        ptrRange.size = (lastSpan->start << kPageShift) - ptrRange.address + (lastSpan->length * kPageSize);
+
+        // Mark the memory region the spans represent as a candidate for containing pointers
+        if (m_typeMask & MALLOC_PTR_REGION_RANGE_TYPE)
+            (*m_recorder)(m_task, m_context, MALLOC_PTR_REGION_RANGE_TYPE, &ptrRange, 1);
+
+        if (!(m_typeMask & MALLOC_PTR_IN_USE_RANGE_TYPE)) {
+            m_coalescedSpans.clear();
+            return;
+        }
+
+        Vector<vm_range_t, 1024> allocatedPointers;
+        for (size_t i = 0; i < m_coalescedSpans.size(); ++i) {
+            Span *theSpan = m_coalescedSpans[i];
+            if (theSpan->free)
+                continue;
+
+            vm_address_t spanStartAddress = theSpan->start << kPageShift;
+            vm_size_t spanSizeInBytes = theSpan->length * kPageSize;
+
+            if (!theSpan->sizeclass) {
+                // If it's an allocated large object span, mark it as in use
+                if (!m_freeObjectFinder.isFreeObject(spanStartAddress))
+                    allocatedPointers.append((vm_range_t){spanStartAddress, spanSizeInBytes});
+            } else {
+                const size_t objectSize = ByteSizeForClass(theSpan->sizeclass);
+
+                // Mark each allocated small object within the span as in use
+                const vm_address_t endOfSpan = spanStartAddress + spanSizeInBytes;
+                for (vm_address_t object = spanStartAddress; object + objectSize <= endOfSpan; object += objectSize) {
+                    if (!m_freeObjectFinder.isFreeObject(object))
+                        allocatedPointers.append((vm_range_t){object, objectSize});
+                }
+            }
+        }
+
+        (*m_recorder)(m_task, m_context, MALLOC_PTR_IN_USE_RANGE_TYPE, allocatedPointers.data(), allocatedPointers.size());
+
+        m_coalescedSpans.clear();
+    }
+
+    int visit(void* ptr)
+    {
+        if (!ptr)
+            return 1;
+
+        Span* span = m_reader(reinterpret_cast<Span*>(ptr));
+        if (!span || !span->start)
+            return 1;
+
+        if (m_seenPointers.contains(ptr))
+            return span->length;
+        m_seenPointers.add(ptr);
+
+        if (!m_coalescedSpans.size()) {
+            m_coalescedSpans.append(span);
+            return span->length;
+        }
+
+        Span* previousSpan = m_coalescedSpans[m_coalescedSpans.size() - 1];
+        vm_address_t previousSpanStartAddress = previousSpan->start << kPageShift;
+        vm_size_t previousSpanSizeInBytes = previousSpan->length * kPageSize;
+
+        // If the new span is adjacent to the previous span, do nothing for now.
+        vm_address_t spanStartAddress = span->start << kPageShift;
+        if (spanStartAddress == previousSpanStartAddress + previousSpanSizeInBytes) {
+            m_coalescedSpans.append(span);
+            return span->length;
+        }
+
+        // New span is not adjacent to previous span, so record the spans coalesced so far.
+        recordPendingRegions();
+        m_coalescedSpans.append(span);
+
+        return span->length;
+    }
+};
+
+class AdminRegionRecorder {
+    task_t m_task;
+    void* m_context;
+    unsigned m_typeMask;
+    vm_range_recorder_t* m_recorder;
+
+    Vector<vm_range_t, 1024> m_pendingRegions;
+
+public:
+    AdminRegionRecorder(task_t task, void* context, unsigned typeMask, vm_range_recorder_t* recorder)
+        : m_task(task)
+        , m_context(context)
+        , m_typeMask(typeMask)
+        , m_recorder(recorder)
+    { }
+
+    void recordRegion(vm_address_t ptr, size_t size)
+    {
+        if (m_typeMask & MALLOC_ADMIN_REGION_RANGE_TYPE)
+            m_pendingRegions.append((vm_range_t){ ptr, size });
+    }
+
+    void visit(void *ptr, size_t size)
+    {
+        recordRegion(reinterpret_cast<vm_address_t>(ptr), size);
+    }
+
+    void recordPendingRegions()
+    {
+        if (m_pendingRegions.size()) {
+            (*m_recorder)(m_task, m_context, MALLOC_ADMIN_REGION_RANGE_TYPE, m_pendingRegions.data(), m_pendingRegions.size());
+            m_pendingRegions.clear();
+        }
+    }
+
+    ~AdminRegionRecorder()
+    {
+        ASSERT(!m_pendingRegions.size());
+    }
+};
+
+kern_return_t FastMallocZone::enumerate(task_t task, void* context, unsigned typeMask, vm_address_t zoneAddress, memory_reader_t reader, vm_range_recorder_t recorder)
+{
+    RemoteMemoryReader memoryReader(task, reader);
+
+    InitSizeClasses();
+
+    FastMallocZone* mzone = memoryReader(reinterpret_cast<FastMallocZone*>(zoneAddress));
+    TCMalloc_PageHeap* pageHeap = memoryReader(mzone->m_pageHeap);
+    TCMalloc_ThreadCache** threadHeapsPointer = memoryReader(mzone->m_threadHeaps);
+    TCMalloc_ThreadCache* threadHeaps = memoryReader(*threadHeapsPointer);
+
+    TCMalloc_Central_FreeListPadded* centralCaches = memoryReader(mzone->m_centralCaches, sizeof(TCMalloc_Central_FreeListPadded) * kNumClasses);
+
+    FreeObjectFinder finder(memoryReader);
+    finder.findFreeObjects(threadHeaps);
+    finder.findFreeObjects(centralCaches, kNumClasses, mzone->m_centralCaches);
+
+    TCMalloc_PageHeap::PageMap* pageMap = &pageHeap->pagemap_;
+    PageMapFreeObjectFinder pageMapFinder(memoryReader, finder);
+    pageMap->visitValues(pageMapFinder, memoryReader);
+
+    PageMapMemoryUsageRecorder usageRecorder(task, context, typeMask, recorder, memoryReader, finder);
+    pageMap->visitValues(usageRecorder, memoryReader);
+    usageRecorder.recordPendingRegions();
+
+    AdminRegionRecorder adminRegionRecorder(task, context, typeMask, recorder);
+    pageMap->visitAllocations(adminRegionRecorder, memoryReader);
+
+    PageHeapAllocator<Span>* spanAllocator = memoryReader(mzone->m_spanAllocator);
+    PageHeapAllocator<TCMalloc_ThreadCache>* pageHeapAllocator = memoryReader(mzone->m_pageHeapAllocator);
+
+    spanAllocator->recordAdministrativeRegions(adminRegionRecorder, memoryReader);
+    pageHeapAllocator->recordAdministrativeRegions(adminRegionRecorder, memoryReader);
+
+    adminRegionRecorder.recordPendingRegions();
+
+    return 0;
+}
+
+size_t FastMallocZone::size(malloc_zone_t*, const void*)
+{
+    return 0;
+}
+
+void* FastMallocZone::zoneMalloc(malloc_zone_t*, size_t)
+{
+    return 0;
+}
+
+void* FastMallocZone::zoneCalloc(malloc_zone_t*, size_t, size_t)
+{
+    return 0;
+}
+
+void FastMallocZone::zoneFree(malloc_zone_t*, void* ptr)
+{
+    // Due to <rdar://problem/5671357> zoneFree may be called by the system free even if the pointer
+    // is not in this zone.  When this happens, the pointer being freed was not allocated by any
+    // zone so we need to print a useful error for the application developer.
+    malloc_printf("*** error for object %p: pointer being freed was not allocated\n", ptr);
+}
+
+void* FastMallocZone::zoneRealloc(malloc_zone_t*, void*, size_t)
+{
+    return 0;
+}
+
+
+#undef malloc
+#undef free
+#undef realloc
+#undef calloc
+
+extern "C" {
+malloc_introspection_t jscore_fastmalloc_introspection = { &FastMallocZone::enumerate, &FastMallocZone::goodSize, &FastMallocZone::check, &FastMallocZone::print,
+    &FastMallocZone::log, &FastMallocZone::forceLock, &FastMallocZone::forceUnlock, &FastMallocZone::statistics
+
+#if OS(IOS) || __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
+    , 0 // zone_locked will not be called on the zone unless it advertises itself as version five or higher.
+#endif
+#if OS(IOS) || __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+    , 0, 0, 0, 0 // These members will not be used unless the zone advertises itself as version seven or higher.
+#endif
+
+    };
+}
+
+FastMallocZone::FastMallocZone(TCMalloc_PageHeap* pageHeap, TCMalloc_ThreadCache** threadHeaps, TCMalloc_Central_FreeListPadded* centralCaches, PageHeapAllocator<Span>* spanAllocator, PageHeapAllocator<TCMalloc_ThreadCache>* pageHeapAllocator)
+    : m_pageHeap(pageHeap)
+    , m_threadHeaps(threadHeaps)
+    , m_centralCaches(centralCaches)
+    , m_spanAllocator(spanAllocator)
+    , m_pageHeapAllocator(pageHeapAllocator)
+{
+    memset(&m_zone, 0, sizeof(m_zone));
+    m_zone.version = 4;
+    m_zone.zone_name = "JavaScriptCore FastMalloc";
+    m_zone.size = &FastMallocZone::size;
+    m_zone.malloc = &FastMallocZone::zoneMalloc;
+    m_zone.calloc = &FastMallocZone::zoneCalloc;
+    m_zone.realloc = &FastMallocZone::zoneRealloc;
+    m_zone.free = &FastMallocZone::zoneFree;
+    m_zone.valloc = &FastMallocZone::zoneValloc;
+    m_zone.destroy = &FastMallocZone::zoneDestroy;
+    m_zone.introspect = &jscore_fastmalloc_introspection;
+    malloc_zone_register(&m_zone);
+}
+
+
+void FastMallocZone::init()
+{
+    static FastMallocZone zone(pageheap, &thread_heaps, static_cast<TCMalloc_Central_FreeListPadded*>(central_cache), &span_allocator, &threadheap_allocator);
+}
+
+#endif // OS(DARWIN)
+
+} // namespace WTF
+#endif // WTF_CHANGES
+
+#endif // FORCE_SYSTEM_MALLOC
diff --git a/Source/WTF/wtf/FastMalloc.h b/Source/WTF/wtf/FastMalloc.h
new file mode 100644
index 0000000..1300a8e
--- /dev/null
+++ b/Source/WTF/wtf/FastMalloc.h
@@ -0,0 +1,281 @@
+/*
+ *  Copyright (C) 2005, 2006, 2007, 2008, 2009 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_FastMalloc_h
+#define WTF_FastMalloc_h
+
+#include <wtf/Platform.h>
+#include <wtf/PossiblyNull.h>
+#include <stdlib.h>
+#include <new>
+
+namespace WTF {
+
+    // These functions call CRASH() if an allocation fails.
+    WTF_EXPORT_PRIVATE void* fastMalloc(size_t);
+    WTF_EXPORT_PRIVATE void* fastZeroedMalloc(size_t);
+    WTF_EXPORT_PRIVATE void* fastCalloc(size_t numElements, size_t elementSize);
+    WTF_EXPORT_PRIVATE void* fastRealloc(void*, size_t);
+    WTF_EXPORT_PRIVATE char* fastStrDup(const char*);
+    WTF_EXPORT_PRIVATE size_t fastMallocSize(const void*);
+
+    struct TryMallocReturnValue {
+        TryMallocReturnValue(void* data)
+            : m_data(data)
+        {
+        }
+        TryMallocReturnValue(const TryMallocReturnValue& source)
+            : m_data(source.m_data)
+        {
+            source.m_data = 0;
+        }
+        ~TryMallocReturnValue() { ASSERT(!m_data); }
+        template <typename T> bool getValue(T& data) WARN_UNUSED_RETURN;
+        template <typename T> operator PossiblyNull<T>()
+        { 
+            T value; 
+            getValue(value); 
+            return PossiblyNull<T>(value);
+        } 
+    private:
+        mutable void* m_data;
+    };
+    
+    template <typename T> bool TryMallocReturnValue::getValue(T& data)
+    {
+        union u { void* data; T target; } res;
+        res.data = m_data;
+        data = res.target;
+        bool returnValue = !!m_data;
+        m_data = 0;
+        return returnValue;
+    }
+
+    WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastMalloc(size_t n);
+    TryMallocReturnValue tryFastZeroedMalloc(size_t n);
+    WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size);
+    WTF_EXPORT_PRIVATE TryMallocReturnValue tryFastRealloc(void* p, size_t n);
+
+    WTF_EXPORT_PRIVATE void fastFree(void*);
+
+#ifndef NDEBUG    
+    WTF_EXPORT_PRIVATE void fastMallocForbid();
+    WTF_EXPORT_PRIVATE void fastMallocAllow();
+#endif
+
+    WTF_EXPORT_PRIVATE void releaseFastMallocFreeMemory();
+    
+    struct FastMallocStatistics {
+        size_t reservedVMBytes;
+        size_t committedVMBytes;
+        size_t freeListBytes;
+    };
+    WTF_EXPORT_PRIVATE FastMallocStatistics fastMallocStatistics();
+
+    // 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[].
+        };
+
+        enum {
+            ValidationPrefix = 0xf00df00d,
+            ValidationSuffix = 0x0badf00d
+        };
+
+        typedef unsigned ValidationTag;
+
+        struct ValidationHeader {
+            AllocType m_type;
+            unsigned m_size;
+            ValidationTag m_prefix;
+            unsigned m_alignment;
+        };
+
+        static const int ValidationBufferSize = sizeof(ValidationHeader) + sizeof(ValidationTag);
+    }
+
+#if ENABLE(WTF_MALLOC_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 {
+    
+        // Handle a detected alloc/free mismatch. By default this calls CRASH().
+        void fastMallocMatchFailed(void* p);
+
+        inline ValidationHeader* fastMallocValidationHeader(void* p)
+        {
+            return reinterpret_cast<ValidationHeader*>(static_cast<char*>(p) - sizeof(ValidationHeader));
+        }
+
+        inline ValidationTag* fastMallocValidationSuffix(void* p)
+        {
+            ValidationHeader* header = fastMallocValidationHeader(p);
+            if (header->m_prefix != static_cast<unsigned>(ValidationPrefix))
+                fastMallocMatchFailed(p);
+            
+            return reinterpret_cast<ValidationTag*>(static_cast<char*>(p) + header->m_size);
+        }
+
+        // Return the AllocType tag associated with the allocated block p.
+        inline AllocType fastMallocMatchValidationType(void* p)
+        {
+            return fastMallocValidationHeader(p)->m_type;
+        }
+
+        // Set the AllocType tag to be associaged with the allocated block p.
+        inline void setFastMallocMatchValidationType(void* p, AllocType allocType)
+        {
+            fastMallocValidationHeader(p)->m_type = allocType;
+        }
+
+    } // 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)
+    {
+        if (!p)
+            return;
+    
+        Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(p);
+        if (header->m_prefix != static_cast<unsigned>(Internal::ValidationPrefix))
+            Internal::fastMallocMatchFailed(p);
+
+        if (*Internal::fastMallocValidationSuffix(p) != Internal::ValidationSuffix)
+            Internal::fastMallocMatchFailed(p);
+
+        Internal::setFastMallocMatchValidationType(p, Internal::AllocTypeMalloc);  // Set it to this so that fastFree thinks it's OK.
+    }
+
+    inline void fastMallocValidate(void* p)
+    {
+        if (!p)
+            return;
+        
+        Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(p);
+        if (header->m_prefix != static_cast<unsigned>(Internal::ValidationPrefix))
+            Internal::fastMallocMatchFailed(p);
+        
+        if (*Internal::fastMallocValidationSuffix(p) != Internal::ValidationSuffix)
+            Internal::fastMallocMatchFailed(p);
+    }
+
+#else
+
+    inline void fastMallocMatchValidateMalloc(void*, Internal::AllocType)
+    {
+    }
+
+    inline void fastMallocMatchValidateFree(void*, Internal::AllocType)
+    {
+    }
+
+#endif
+
+} // namespace WTF
+
+using WTF::fastCalloc;
+using WTF::fastFree;
+using WTF::fastMalloc;
+using WTF::fastMallocSize;
+using WTF::fastRealloc;
+using WTF::fastStrDup;
+using WTF::fastZeroedMalloc;
+using WTF::tryFastCalloc;
+using WTF::tryFastMalloc;
+using WTF::tryFastRealloc;
+using WTF::tryFastZeroedMalloc;
+
+#ifndef NDEBUG    
+using WTF::fastMallocForbid;
+using WTF::fastMallocAllow;
+#endif
+
+#if COMPILER(GCC) && OS(DARWIN)
+#define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline))
+#elif COMPILER(GCC)
+#define WTF_PRIVATE_INLINE inline __attribute__((always_inline))
+#elif COMPILER(MSVC) || COMPILER(RVCT)
+#define WTF_PRIVATE_INLINE __forceinline
+#else
+#define WTF_PRIVATE_INLINE inline
+#endif
+
+#if !defined(_CRTDBG_MAP_ALLOC) && !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC)
+
+// The nothrow functions here are actually not all that helpful, because fastMalloc will
+// call CRASH() rather than returning 0, and returning 0 is what nothrow is all about.
+// But since WebKit code never uses exceptions or nothrow at all, this is probably OK.
+// Long term we will adopt FastAllocBase.h everywhere, and and replace this with
+// debug-only code to make sure we don't use the system malloc via the default operator
+// new by accident.
+
+#if ENABLE(GLOBAL_FASTMALLOC_NEW)
+
+#if COMPILER(MSVC)
+#pragma warning(push)
+#pragma warning(disable: 4290) // Disable the C++ exception specification ignored warning.
+#endif
+WTF_PRIVATE_INLINE void* operator new(size_t size) throw (std::bad_alloc) { return fastMalloc(size); }
+WTF_PRIVATE_INLINE void* operator new(size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); }
+WTF_PRIVATE_INLINE void operator delete(void* p) throw() { fastFree(p); }
+WTF_PRIVATE_INLINE void operator delete(void* p, const std::nothrow_t&) throw() { fastFree(p); }
+WTF_PRIVATE_INLINE void* operator new[](size_t size) throw (std::bad_alloc) { return fastMalloc(size); }
+WTF_PRIVATE_INLINE void* operator new[](size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); }
+WTF_PRIVATE_INLINE void operator delete[](void* p) throw() { fastFree(p); }
+WTF_PRIVATE_INLINE void operator delete[](void* p, const std::nothrow_t&) throw() { fastFree(p); }
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+
+#endif
+
+#endif
+
+#endif /* WTF_FastMalloc_h */
diff --git a/Source/WTF/wtf/FixedArray.h b/Source/WTF/wtf/FixedArray.h
new file mode 100644
index 0000000..c67d18c
--- /dev/null
+++ b/Source/WTF/wtf/FixedArray.h
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#ifndef FixedArray_h
+#define FixedArray_h
+
+#include <wtf/Assertions.h>
+
+namespace WTF {
+
+template <typename T, size_t Size> class FixedArray {
+public:
+    T& operator[](size_t i)
+    {
+        ASSERT(i < Size);
+        return m_data[i];
+    }
+
+    const T& operator[](size_t i) const
+    {
+        ASSERT(i < Size);
+        return m_data[i];
+    }
+
+    T* data() { return m_data; }
+    size_t size() const { return Size; }
+
+private:
+    T m_data[Size];
+};
+
+} // namespace WTF
+
+using WTF::FixedArray;
+
+#endif // FixedArray_h
diff --git a/Source/WTF/wtf/Float32Array.h b/Source/WTF/wtf/Float32Array.h
new file mode 100644
index 0000000..47204ec
--- /dev/null
+++ b/Source/WTF/wtf/Float32Array.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 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:
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 Float32Array_h
+#define Float32Array_h
+
+#include <wtf/TypedArrayBase.h>
+#include <wtf/MathExtras.h>
+
+namespace WTF {
+
+class Float32Array : public TypedArrayBase<float> {
+public:
+    static inline PassRefPtr<Float32Array> create(unsigned length);
+    static inline PassRefPtr<Float32Array> create(const float* array, unsigned length);
+    static inline PassRefPtr<Float32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+
+    // Should only be used when it is known the entire array will be filled. Do
+    // not return these results directly to JavaScript without filling first.
+    static inline PassRefPtr<Float32Array> createUninitialized(unsigned length);
+
+    // Can’t use "using" here due to a bug in the RVCT compiler.
+    bool set(TypedArrayBase<float>* array, unsigned offset) { return TypedArrayBase<float>::set(array, offset); }
+
+    void set(unsigned index, double value)
+    {
+        if (index >= TypedArrayBase<float>::m_length)
+            return;
+        TypedArrayBase<float>::data()[index] = static_cast<float>(value);
+    }
+
+    inline PassRefPtr<Float32Array> subarray(int start) const;
+    inline PassRefPtr<Float32Array> subarray(int start, int end) const;
+
+    virtual ViewType getType() const
+    {
+        return TypeFloat32;
+    }
+
+private:
+    inline Float32Array(PassRefPtr<ArrayBuffer>,
+                    unsigned byteOffset,
+                    unsigned length);
+    // Make constructor visible to superclass.
+    friend class TypedArrayBase<float>;
+};
+
+PassRefPtr<Float32Array> Float32Array::create(unsigned length)
+{
+    return TypedArrayBase<float>::create<Float32Array>(length);
+}
+
+PassRefPtr<Float32Array> Float32Array::create(const float* array, unsigned length)
+{
+    return TypedArrayBase<float>::create<Float32Array>(array, length);
+}
+
+PassRefPtr<Float32Array> Float32Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+{
+    return TypedArrayBase<float>::create<Float32Array>(buffer, byteOffset, length);
+}
+
+PassRefPtr<Float32Array> Float32Array::createUninitialized(unsigned length)
+{
+    return TypedArrayBase<float>::createUninitialized<Float32Array>(length);
+}
+
+Float32Array::Float32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+    : TypedArrayBase<float>(buffer, byteOffset, length)
+{
+}
+
+PassRefPtr<Float32Array> Float32Array::subarray(int start) const
+{
+    return subarray(start, length());
+}
+
+PassRefPtr<Float32Array> Float32Array::subarray(int start, int end) const
+{
+    return subarrayImpl<Float32Array>(start, end);
+}
+
+} // namespace WTF
+
+using WTF::Float32Array;
+
+#endif // Float32Array_h
diff --git a/Source/WTF/wtf/Float64Array.h b/Source/WTF/wtf/Float64Array.h
new file mode 100644
index 0000000..1d9a9c8
--- /dev/null
+++ b/Source/WTF/wtf/Float64Array.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * 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:
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 Float64Array_h
+#define Float64Array_h
+
+#include <wtf/TypedArrayBase.h>
+#include <wtf/MathExtras.h>
+
+namespace WTF {
+
+class Float64Array : public TypedArrayBase<double> {
+public:
+    static inline PassRefPtr<Float64Array> create(unsigned length);
+    static inline PassRefPtr<Float64Array> create(const double* array, unsigned length);
+    static inline PassRefPtr<Float64Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+
+    // Should only be used when it is known the entire array will be filled. Do
+    // not return these results directly to JavaScript without filling first.
+    static inline PassRefPtr<Float64Array> createUninitialized(unsigned length);
+
+    // Can’t use "using" here due to a bug in the RVCT compiler.
+    bool set(TypedArrayBase<double>* array, unsigned offset) { return TypedArrayBase<double>::set(array, offset); }
+
+    void set(unsigned index, double value)
+    {
+        if (index >= TypedArrayBase<double>::m_length)
+            return;
+        TypedArrayBase<double>::data()[index] = static_cast<double>(value);
+    }
+
+    inline PassRefPtr<Float64Array> subarray(int start) const;
+    inline PassRefPtr<Float64Array> subarray(int start, int end) const;
+
+    virtual ViewType getType() const
+    {
+        return TypeFloat64;
+    }
+
+private:
+    inline Float64Array(PassRefPtr<ArrayBuffer>,
+                 unsigned byteOffset,
+                 unsigned length);
+    // Make constructor visible to superclass.
+    friend class TypedArrayBase<double>;
+};
+
+PassRefPtr<Float64Array> Float64Array::create(unsigned length)
+{
+    return TypedArrayBase<double>::create<Float64Array>(length);
+}
+
+PassRefPtr<Float64Array> Float64Array::create(const double* array, unsigned length)
+{
+    return TypedArrayBase<double>::create<Float64Array>(array, length);
+}
+
+PassRefPtr<Float64Array> Float64Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+{
+    return TypedArrayBase<double>::create<Float64Array>(buffer, byteOffset, length);
+}
+
+PassRefPtr<Float64Array> Float64Array::createUninitialized(unsigned length)
+{
+    return TypedArrayBase<double>::createUninitialized<Float64Array>(length);
+}
+
+Float64Array::Float64Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+    : TypedArrayBase<double>(buffer, byteOffset, length)
+{
+}
+
+PassRefPtr<Float64Array> Float64Array::subarray(int start) const
+{
+    return subarray(start, length());
+}
+
+PassRefPtr<Float64Array> Float64Array::subarray(int start, int end) const
+{
+    return subarrayImpl<Float64Array>(start, end);
+}
+
+} // namespace WTF
+
+using WTF::Float64Array;
+
+#endif // Float64Array_h
diff --git a/Source/WTF/wtf/Forward.h b/Source/WTF/wtf/Forward.h
new file mode 100644
index 0000000..5c2acfe
--- /dev/null
+++ b/Source/WTF/wtf/Forward.h
@@ -0,0 +1,94 @@
+/*
+ *  Copyright (C) 2006, 2009, 2011 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_Forward_h
+#define WTF_Forward_h
+
+#include <stddef.h>
+
+namespace WTF {
+    template<typename T> class Function;
+    template<typename T> class ListRefPtr;
+    template<typename T> class OwnArrayPtr;
+    template<typename T> class OwnPtr;
+    template<typename T> class PassOwnArrayPtr;
+    template<typename T> class PassOwnPtr;
+    template<typename T> class PassRefPtr;
+    template<typename T> class RefPtr;
+    template<typename T, size_t inlineCapacity> class Vector;
+    
+    class ArrayBuffer;
+    class ArrayBufferView;
+    class AtomicString;
+    class AtomicStringImpl;
+    class CString;
+    class Decoder;
+    class Encoder;
+    class Float32Array;
+    class Float64Array;
+    class Int8Array;
+    class Int16Array;
+    class Int32Array;
+    class MemoryInstrumentation;
+    class MemoryObjectInfo;
+    class String;
+    template <typename T> class StringBuffer;
+    class StringBuilder;
+    class StringImpl;
+    class Uint8Array;
+    class Uint8ClampedArray;
+    class Uint16Array;
+    class Uint32Array;
+}
+
+using WTF::Function;
+using WTF::ListRefPtr;
+using WTF::OwnArrayPtr;
+using WTF::OwnPtr;
+using WTF::PassOwnArrayPtr;
+using WTF::PassOwnPtr;
+using WTF::PassRefPtr;
+using WTF::RefPtr;
+using WTF::Vector;
+
+using WTF::ArrayBuffer;
+using WTF::ArrayBufferView;
+using WTF::AtomicString;
+using WTF::AtomicStringImpl;
+using WTF::CString;
+using WTF::Encoder;
+using WTF::Decoder;
+using WTF::Float32Array;
+using WTF::Float64Array;
+using WTF::Int8Array;
+using WTF::Int16Array;
+using WTF::Int32Array;
+using WTF::MemoryInstrumentation;
+using WTF::MemoryObjectInfo;
+using WTF::String;
+using WTF::StringBuffer;
+using WTF::StringBuilder;
+using WTF::StringImpl;
+using WTF::Uint8Array;
+using WTF::Uint8ClampedArray;
+using WTF::Uint16Array;
+using WTF::Uint32Array;
+
+#endif // WTF_Forward_h
diff --git a/Source/WTF/wtf/Functional.h b/Source/WTF/wtf/Functional.h
new file mode 100644
index 0000000..f507e0c
--- /dev/null
+++ b/Source/WTF/wtf/Functional.h
@@ -0,0 +1,692 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+#ifndef WTF_Functional_h
+#define WTF_Functional_h
+
+#include <wtf/Assertions.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+#if PLATFORM(MAC) && COMPILER_SUPPORTS(BLOCKS)
+#include <Block.h>
+#include <objc/objc-runtime.h>
+#include <wtf/ObjcRuntimeExtras.h>
+#endif
+
+namespace WTF {
+
+// Functional.h provides a very simple way to bind a function pointer and arguments together into a function object
+// that can be stored, copied and invoked, similar to how boost::bind and std::bind in C++11.
+
+// Helper class template to determine whether a given type has ref and deref member functions
+// with the right type signature.
+template<typename T>
+class HasRefAndDeref {
+    typedef char YesType;
+    struct NoType {
+        char padding[8];
+    };
+
+    struct BaseMixin {
+        void deref();
+        void ref();
+    };
+
+    struct Base : public T, public BaseMixin { };
+
+    template<typename U, U> struct
+    TypeChecker { };
+
+    template<typename U>
+    static NoType refCheck(U*, TypeChecker<void (BaseMixin::*)(), &U::ref>* = 0);
+    static YesType refCheck(...);
+
+    template<typename U>
+    static NoType derefCheck(U*, TypeChecker<void (BaseMixin::*)(), &U::deref>* = 0);
+    static YesType derefCheck(...);
+
+public:
+    static const bool value = sizeof(refCheck(static_cast<Base*>(0))) == sizeof(YesType) && sizeof(derefCheck(static_cast<Base*>(0))) == sizeof(YesType);
+};
+
+// A FunctionWrapper is a class template that can wrap a function pointer or a member function pointer and
+// provide a unified interface for calling that function.
+template<typename>
+class FunctionWrapper;
+
+template<typename R>
+class FunctionWrapper<R (*)()> {
+public:
+    typedef R ResultType;
+    static const bool shouldRefFirstParameter = false;
+
+    explicit FunctionWrapper(R (*function)())
+        : m_function(function)
+    {
+    }
+
+    R operator()()
+    {
+        return m_function();
+    }
+
+private:
+    R (*m_function)();
+};
+
+template<typename R, typename P1>
+class FunctionWrapper<R (*)(P1)> {
+public:
+    typedef R ResultType;
+    static const bool shouldRefFirstParameter = false;
+
+    explicit FunctionWrapper(R (*function)(P1))
+        : m_function(function)
+    {
+    }
+
+    R operator()(P1 p1)
+    {
+        return m_function(p1);
+    }
+
+private:
+    R (*m_function)(P1);
+};
+
+template<typename R, typename P1, typename P2>
+class FunctionWrapper<R (*)(P1, P2)> {
+public:
+    typedef R ResultType;
+    static const bool shouldRefFirstParameter = false;
+
+    explicit FunctionWrapper(R (*function)(P1, P2))
+        : m_function(function)
+    {
+    }
+
+    R operator()(P1 p1, P2 p2)
+    {
+        return m_function(p1, p2);
+    }
+
+private:
+    R (*m_function)(P1, P2);
+};
+
+template<typename R, typename P1, typename P2, typename P3>
+class FunctionWrapper<R (*)(P1, P2, P3)> {
+public:
+    typedef R ResultType;
+    static const bool shouldRefFirstParameter = false;
+
+    explicit FunctionWrapper(R (*function)(P1, P2, P3))
+        : m_function(function)
+    {
+    }
+
+    R operator()(P1 p1, P2 p2, P3 p3)
+    {
+        return m_function(p1, p2, p3);
+    }
+
+private:
+    R (*m_function)(P1, P2, P3);
+};
+
+template<typename R, typename C>
+class FunctionWrapper<R (C::*)()> {
+public:
+    typedef R ResultType;
+    static const bool shouldRefFirstParameter = HasRefAndDeref<C>::value;
+
+    explicit FunctionWrapper(R (C::*function)())
+        : m_function(function)
+    {
+    }
+
+    R operator()(C* c)
+    {
+        return (c->*m_function)();
+    }
+
+private:
+    R (C::*m_function)();
+};
+
+template<typename R, typename C, typename P1>
+class FunctionWrapper<R (C::*)(P1)> {
+public:
+    typedef R ResultType;
+    static const bool shouldRefFirstParameter = HasRefAndDeref<C>::value;
+
+    explicit FunctionWrapper(R (C::*function)(P1))
+        : m_function(function)
+    {
+    }
+
+    R operator()(C* c, P1 p1)
+    {
+        return (c->*m_function)(p1);
+    }
+
+private:
+    R (C::*m_function)(P1);
+};
+
+template<typename R, typename C, typename P1, typename P2>
+class FunctionWrapper<R (C::*)(P1, P2)> {
+public:
+    typedef R ResultType;
+    static const bool shouldRefFirstParameter = HasRefAndDeref<C>::value;
+
+    explicit FunctionWrapper(R (C::*function)(P1, P2))
+        : m_function(function)
+    {
+    }
+
+    R operator()(C* c, P1 p1, P2 p2)
+    {
+        return (c->*m_function)(p1, p2);
+    }
+
+private:
+    R (C::*m_function)(P1, P2);
+};
+
+template<typename R, typename C, typename P1, typename P2, typename P3>
+class FunctionWrapper<R (C::*)(P1, P2, P3)> {
+public:
+    typedef R ResultType;
+    static const bool shouldRefFirstParameter = HasRefAndDeref<C>::value;
+
+    explicit FunctionWrapper(R (C::*function)(P1, P2, P3))
+        : m_function(function)
+    {
+    }
+
+    R operator()(C* c, P1 p1, P2 p2, P3 p3)
+    {
+        return (c->*m_function)(p1, p2, p3);
+    }
+
+private:
+    R (C::*m_function)(P1, P2, P3);
+};
+
+template<typename R, typename C, typename P1, typename P2, typename P3, typename P4>
+class FunctionWrapper<R (C::*)(P1, P2, P3, P4)> {
+public:
+    typedef R ResultType;
+    static const bool shouldRefFirstParameter = HasRefAndDeref<C>::value;
+
+    explicit FunctionWrapper(R (C::*function)(P1, P2, P3, P4))
+        : m_function(function)
+    {
+    }
+
+    R operator()(C* c, P1 p1, P2 p2, P3 p3, P4 p4)
+    {
+        return (c->*m_function)(p1, p2, p3, p4);
+    }
+
+private:
+    R (C::*m_function)(P1, P2, P3, P4);
+};
+
+template<typename R, typename C, typename P1, typename P2, typename P3, typename P4, typename P5>
+class FunctionWrapper<R (C::*)(P1, P2, P3, P4, P5)> {
+public:
+    typedef R ResultType;
+    static const bool shouldRefFirstParameter = HasRefAndDeref<C>::value;
+
+    explicit FunctionWrapper(R (C::*function)(P1, P2, P3, P4, P5))
+        : m_function(function)
+    {
+    }
+
+    R operator()(C* c, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
+    {
+        return (c->*m_function)(p1, p2, p3, p4, p5);
+    }
+
+private:
+    R (C::*m_function)(P1, P2, P3, P4, P5);
+};
+
+#if PLATFORM(MAC) && COMPILER_SUPPORTS(BLOCKS)
+template<typename R>
+class FunctionWrapper<R (^)()> {
+public:
+    typedef R ResultType;
+    static const bool shouldRefFirstParameter = false;
+
+    explicit FunctionWrapper(R (^block)())
+        : m_block(Block_copy(block))
+    {
+    }
+
+    FunctionWrapper(const FunctionWrapper& other)
+        : m_block(Block_copy(other.m_block))
+    {
+    }
+
+    ~FunctionWrapper()
+    {
+        Block_release(m_block);
+    }
+
+    R operator()()
+    {
+        return m_block();
+    }
+
+private:
+    R (^m_block)();
+};
+#endif
+
+template<typename T, bool shouldRefAndDeref> struct RefAndDeref {
+    static void ref(T) { }
+    static void deref(T) { }
+};
+
+template<typename T> struct RefAndDeref<T*, true> {
+    static void ref(T* t) { t->ref(); }
+    static void deref(T* t) { t->deref(); }
+};
+
+template<typename T> struct ParamStorageTraits {
+    typedef T StorageType;
+
+    static StorageType wrap(const T& value) { return value; }
+    static const T& unwrap(const StorageType& value) { return value; }
+};
+
+template<typename T> struct ParamStorageTraits<PassRefPtr<T> > {
+    typedef RefPtr<T> StorageType;
+
+    static StorageType wrap(PassRefPtr<T> value) { return value; }
+    static T* unwrap(const StorageType& value) { return value.get(); }
+};
+
+template<typename T> struct ParamStorageTraits<RefPtr<T> > {
+    typedef RefPtr<T> StorageType;
+
+    static StorageType wrap(RefPtr<T> value) { return value.release(); }
+    static T* unwrap(const StorageType& value) { return value.get(); }
+};
+
+
+template<typename> class RetainPtr;
+
+template<typename T> struct ParamStorageTraits<RetainPtr<T> > {
+    typedef RetainPtr<T> StorageType;
+
+    static StorageType wrap(const RetainPtr<T>& value) { return value; }
+    static typename RetainPtr<T>::PtrType unwrap(const StorageType& value) { return value.get(); }
+};
+
+class FunctionImplBase : public ThreadSafeRefCounted<FunctionImplBase> {
+public:
+    virtual ~FunctionImplBase() { }
+};
+
+template<typename>
+class FunctionImpl;
+
+template<typename R>
+class FunctionImpl<R ()> : public FunctionImplBase {
+public:
+    virtual R operator()() = 0;
+};
+
+template<typename FunctionWrapper, typename FunctionType>
+class BoundFunctionImpl;
+
+template<typename FunctionWrapper, typename R>
+class BoundFunctionImpl<FunctionWrapper, R ()> : public FunctionImpl<typename FunctionWrapper::ResultType ()> {
+public:
+    explicit BoundFunctionImpl(FunctionWrapper functionWrapper)
+        : m_functionWrapper(functionWrapper)
+    {
+    }
+
+    virtual R operator()()
+    {
+        return m_functionWrapper();
+    }
+
+private:
+    FunctionWrapper m_functionWrapper;
+};
+
+template<typename FunctionWrapper, typename R, typename P1>
+class BoundFunctionImpl<FunctionWrapper, R (P1)> : public FunctionImpl<typename FunctionWrapper::ResultType ()> {
+
+public:
+    BoundFunctionImpl(FunctionWrapper functionWrapper, const P1& p1)
+        : m_functionWrapper(functionWrapper)
+        , m_p1(ParamStorageTraits<P1>::wrap(p1))
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::ref(m_p1);
+    }
+
+    ~BoundFunctionImpl()
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::deref(m_p1);
+    }
+
+    virtual R operator()()
+    {
+        return m_functionWrapper(ParamStorageTraits<P1>::unwrap(m_p1));
+    }
+
+private:
+    FunctionWrapper m_functionWrapper;
+    typename ParamStorageTraits<P1>::StorageType m_p1;
+};
+
+template<typename FunctionWrapper, typename R, typename P1, typename P2>
+class BoundFunctionImpl<FunctionWrapper, R (P1, P2)> : public FunctionImpl<typename FunctionWrapper::ResultType ()> {
+public:
+    BoundFunctionImpl(FunctionWrapper functionWrapper, const P1& p1, const P2& p2)
+        : m_functionWrapper(functionWrapper)
+        , m_p1(ParamStorageTraits<P1>::wrap(p1))
+        , m_p2(ParamStorageTraits<P2>::wrap(p2))
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::ref(m_p1);
+    }
+    
+    ~BoundFunctionImpl()
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::deref(m_p1);
+    }
+
+    virtual typename FunctionWrapper::ResultType operator()()
+    {
+        return m_functionWrapper(ParamStorageTraits<P1>::unwrap(m_p1), ParamStorageTraits<P2>::unwrap(m_p2));
+    }
+
+private:
+    FunctionWrapper m_functionWrapper;
+    typename ParamStorageTraits<P1>::StorageType m_p1;
+    typename ParamStorageTraits<P2>::StorageType m_p2;
+};
+
+template<typename FunctionWrapper, typename R, typename P1, typename P2, typename P3>
+class BoundFunctionImpl<FunctionWrapper, R (P1, P2, P3)> : public FunctionImpl<typename FunctionWrapper::ResultType ()> {
+public:
+    BoundFunctionImpl(FunctionWrapper functionWrapper, const P1& p1, const P2& p2, const P3& p3)
+        : m_functionWrapper(functionWrapper)
+        , m_p1(ParamStorageTraits<P1>::wrap(p1))
+        , m_p2(ParamStorageTraits<P2>::wrap(p2))
+        , m_p3(ParamStorageTraits<P3>::wrap(p3))
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::ref(m_p1);
+    }
+    
+    ~BoundFunctionImpl()
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::deref(m_p1);
+    }
+
+    virtual typename FunctionWrapper::ResultType operator()()
+    {
+        return m_functionWrapper(ParamStorageTraits<P1>::unwrap(m_p1), ParamStorageTraits<P2>::unwrap(m_p2), ParamStorageTraits<P3>::unwrap(m_p3));
+    }
+
+private:
+    FunctionWrapper m_functionWrapper;
+    typename ParamStorageTraits<P1>::StorageType m_p1;
+    typename ParamStorageTraits<P2>::StorageType m_p2;
+    typename ParamStorageTraits<P3>::StorageType m_p3;
+};
+
+template<typename FunctionWrapper, typename R, typename P1, typename P2, typename P3, typename P4>
+class BoundFunctionImpl<FunctionWrapper, R (P1, P2, P3, P4)> : public FunctionImpl<typename FunctionWrapper::ResultType ()> {
+public:
+    BoundFunctionImpl(FunctionWrapper functionWrapper, const P1& p1, const P2& p2, const P3& p3, const P4& p4)
+        : m_functionWrapper(functionWrapper)
+        , m_p1(ParamStorageTraits<P1>::wrap(p1))
+        , m_p2(ParamStorageTraits<P2>::wrap(p2))
+        , m_p3(ParamStorageTraits<P3>::wrap(p3))
+        , m_p4(ParamStorageTraits<P4>::wrap(p4))
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::ref(m_p1);
+    }
+    
+    ~BoundFunctionImpl()
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::deref(m_p1);
+    }
+
+    virtual typename FunctionWrapper::ResultType operator()()
+    {
+        return m_functionWrapper(ParamStorageTraits<P1>::unwrap(m_p1), ParamStorageTraits<P2>::unwrap(m_p2), ParamStorageTraits<P3>::unwrap(m_p3), ParamStorageTraits<P4>::unwrap(m_p4));
+    }
+
+private:
+    FunctionWrapper m_functionWrapper;
+    typename ParamStorageTraits<P1>::StorageType m_p1;
+    typename ParamStorageTraits<P2>::StorageType m_p2;
+    typename ParamStorageTraits<P3>::StorageType m_p3;
+    typename ParamStorageTraits<P4>::StorageType m_p4;
+};
+
+template<typename FunctionWrapper, typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
+class BoundFunctionImpl<FunctionWrapper, R (P1, P2, P3, P4, P5)> : public FunctionImpl<typename FunctionWrapper::ResultType ()> {
+public:
+    BoundFunctionImpl(FunctionWrapper functionWrapper, const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5)
+        : m_functionWrapper(functionWrapper)
+        , m_p1(ParamStorageTraits<P1>::wrap(p1))
+        , m_p2(ParamStorageTraits<P2>::wrap(p2))
+        , m_p3(ParamStorageTraits<P3>::wrap(p3))
+        , m_p4(ParamStorageTraits<P4>::wrap(p4))
+        , m_p5(ParamStorageTraits<P5>::wrap(p5))
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::ref(m_p1);
+    }
+    
+    ~BoundFunctionImpl()
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::deref(m_p1);
+    }
+
+    virtual typename FunctionWrapper::ResultType operator()()
+    {
+        return m_functionWrapper(ParamStorageTraits<P1>::unwrap(m_p1), ParamStorageTraits<P2>::unwrap(m_p2), ParamStorageTraits<P3>::unwrap(m_p3), ParamStorageTraits<P4>::unwrap(m_p4), ParamStorageTraits<P5>::unwrap(m_p5));
+    }
+
+private:
+    FunctionWrapper m_functionWrapper;
+    typename ParamStorageTraits<P1>::StorageType m_p1;
+    typename ParamStorageTraits<P2>::StorageType m_p2;
+    typename ParamStorageTraits<P3>::StorageType m_p3;
+    typename ParamStorageTraits<P4>::StorageType m_p4;
+    typename ParamStorageTraits<P5>::StorageType m_p5;
+};
+
+template<typename FunctionWrapper, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
+class BoundFunctionImpl<FunctionWrapper, R (P1, P2, P3, P4, P5, P6)> : public FunctionImpl<typename FunctionWrapper::ResultType ()> {
+public:
+    BoundFunctionImpl(FunctionWrapper functionWrapper, const P1& p1, const P2& p2, const P3& p3, const P4& p4, const P5& p5, const P6& p6)
+        : m_functionWrapper(functionWrapper)
+        , m_p1(ParamStorageTraits<P1>::wrap(p1))
+        , m_p2(ParamStorageTraits<P2>::wrap(p2))
+        , m_p3(ParamStorageTraits<P3>::wrap(p3))
+        , m_p4(ParamStorageTraits<P4>::wrap(p4))
+        , m_p5(ParamStorageTraits<P5>::wrap(p5))
+        , m_p6(ParamStorageTraits<P6>::wrap(p6))
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::ref(m_p1);
+    }
+
+    ~BoundFunctionImpl()
+    {
+        RefAndDeref<P1, FunctionWrapper::shouldRefFirstParameter>::deref(m_p1);
+    }
+
+    virtual typename FunctionWrapper::ResultType operator()()
+    {
+        return m_functionWrapper(ParamStorageTraits<P1>::unwrap(m_p1), ParamStorageTraits<P2>::unwrap(m_p2), ParamStorageTraits<P3>::unwrap(m_p3), ParamStorageTraits<P4>::unwrap(m_p4), ParamStorageTraits<P5>::unwrap(m_p5), ParamStorageTraits<P6>::unwrap(m_p6));
+    }
+
+private:
+    FunctionWrapper m_functionWrapper;
+    typename ParamStorageTraits<P1>::StorageType m_p1;
+    typename ParamStorageTraits<P2>::StorageType m_p2;
+    typename ParamStorageTraits<P3>::StorageType m_p3;
+    typename ParamStorageTraits<P4>::StorageType m_p4;
+    typename ParamStorageTraits<P5>::StorageType m_p5;
+    typename ParamStorageTraits<P6>::StorageType m_p6;
+};
+
+class FunctionBase {
+public:
+    bool isNull() const
+    {
+        return !m_impl;
+    }
+
+protected:
+    FunctionBase()
+    {
+    }
+
+    explicit FunctionBase(PassRefPtr<FunctionImplBase> impl)
+        : m_impl(impl)
+    {
+    }
+
+    template<typename FunctionType> FunctionImpl<FunctionType>* impl() const
+    { 
+        return static_cast<FunctionImpl<FunctionType>*>(m_impl.get());
+    }
+
+private:
+    RefPtr<FunctionImplBase> m_impl;
+};
+
+template<typename>
+class Function;
+
+template<typename R>
+class Function<R ()> : public FunctionBase {
+public:
+    Function()
+    {
+    }
+
+    Function(PassRefPtr<FunctionImpl<R ()> > impl)
+        : FunctionBase(impl)
+    {
+    }
+
+    R operator()() const
+    {
+        ASSERT(!isNull());
+
+        return impl<R ()>()->operator()();
+    }
+
+#if PLATFORM(MAC) && COMPILER_SUPPORTS(BLOCKS)
+    typedef void (^BlockType)();
+    operator BlockType() const
+    {
+        // Declare a RefPtr here so we'll be sure that the underlying FunctionImpl object's
+        // lifecycle is managed correctly.
+        RefPtr<FunctionImpl<R ()> > functionImpl = impl<R ()>();
+        BlockType block = ^{
+           functionImpl->operator()();
+        };
+
+        // This is equivalent to:
+        //
+        //   return [[block copy] autorelease];
+        //
+        // We're using manual objc_msgSend calls here because we don't want to make the entire
+        // file Objective-C. It's useful to be able to implicitly convert a Function to
+        // a block even in C++ code, since that allows us to do things like:
+        //
+        //   dispatch_async(queue, bind(...));
+        //
+        id copiedBlock = wtfObjcMsgSend<id>((id)block, sel_registerName("copy"));
+        id autoreleasedBlock = wtfObjcMsgSend<id>(copiedBlock, sel_registerName("autorelease"));
+        return (BlockType)autoreleasedBlock;
+    }
+#endif
+};
+
+template<typename FunctionType>
+Function<typename FunctionWrapper<FunctionType>::ResultType ()> bind(FunctionType function)
+{
+    return Function<typename FunctionWrapper<FunctionType>::ResultType ()>(adoptRef(new BoundFunctionImpl<FunctionWrapper<FunctionType>, typename FunctionWrapper<FunctionType>::ResultType ()>(FunctionWrapper<FunctionType>(function))));
+}
+
+template<typename FunctionType, typename A1>
+Function<typename FunctionWrapper<FunctionType>::ResultType ()> bind(FunctionType function, const A1& a1)
+{
+    return Function<typename FunctionWrapper<FunctionType>::ResultType ()>(adoptRef(new BoundFunctionImpl<FunctionWrapper<FunctionType>, typename FunctionWrapper<FunctionType>::ResultType (A1)>(FunctionWrapper<FunctionType>(function), a1)));
+}
+
+template<typename FunctionType, typename A1, typename A2>
+Function<typename FunctionWrapper<FunctionType>::ResultType ()> bind(FunctionType function, const A1& a1, const A2& a2)
+{
+    return Function<typename FunctionWrapper<FunctionType>::ResultType ()>(adoptRef(new BoundFunctionImpl<FunctionWrapper<FunctionType>, typename FunctionWrapper<FunctionType>::ResultType (A1, A2)>(FunctionWrapper<FunctionType>(function), a1, a2)));
+}
+
+template<typename FunctionType, typename A1, typename A2, typename A3>
+Function<typename FunctionWrapper<FunctionType>::ResultType ()> bind(FunctionType function, const A1& a1, const A2& a2, const A3& a3)
+{
+    return Function<typename FunctionWrapper<FunctionType>::ResultType ()>(adoptRef(new BoundFunctionImpl<FunctionWrapper<FunctionType>, typename FunctionWrapper<FunctionType>::ResultType (A1, A2, A3)>(FunctionWrapper<FunctionType>(function), a1, a2, a3)));
+}
+
+template<typename FunctionType, typename A1, typename A2, typename A3, typename A4>
+Function<typename FunctionWrapper<FunctionType>::ResultType ()> bind(FunctionType function, const A1& a1, const A2& a2, const A3& a3, const A4& a4)
+{
+    return Function<typename FunctionWrapper<FunctionType>::ResultType ()>(adoptRef(new BoundFunctionImpl<FunctionWrapper<FunctionType>, typename FunctionWrapper<FunctionType>::ResultType (A1, A2, A3, A4)>(FunctionWrapper<FunctionType>(function), a1, a2, a3, a4)));
+}
+
+template<typename FunctionType, typename A1, typename A2, typename A3, typename A4, typename A5>
+Function<typename FunctionWrapper<FunctionType>::ResultType ()> bind(FunctionType function, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5)
+{
+    return Function<typename FunctionWrapper<FunctionType>::ResultType ()>(adoptRef(new BoundFunctionImpl<FunctionWrapper<FunctionType>, typename FunctionWrapper<FunctionType>::ResultType (A1, A2, A3, A4, A5)>(FunctionWrapper<FunctionType>(function), a1, a2, a3, a4, a5)));
+}
+
+template<typename FunctionType, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
+Function<typename FunctionWrapper<FunctionType>::ResultType ()> bind(FunctionType function, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6)
+{
+    return Function<typename FunctionWrapper<FunctionType>::ResultType ()>(adoptRef(new BoundFunctionImpl<FunctionWrapper<FunctionType>, typename FunctionWrapper<FunctionType>::ResultType (A1, A2, A3, A4, A5, A6)>(FunctionWrapper<FunctionType>(function), a1, a2, a3, a4, a5, a6)));
+}
+
+}
+
+using WTF::Function;
+using WTF::bind;
+
+#endif // WTF_Functional_h
diff --git a/Source/WTF/wtf/GetPtr.h b/Source/WTF/wtf/GetPtr.h
new file mode 100644
index 0000000..25a0e6d
--- /dev/null
+++ b/Source/WTF/wtf/GetPtr.h
@@ -0,0 +1,33 @@
+/*
+ *  Copyright (C) 2006 Apple Computer, 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.
+ *
+ */
+
+#ifndef WTF_GetPtr_h
+#define WTF_GetPtr_h
+
+namespace WTF {
+
+    template <typename T> inline T* getPtr(T* p)
+    {
+        return p;
+    }
+
+} // namespace WTF
+
+#endif // WTF_GetPtr_h
diff --git a/Source/WTF/wtf/GregorianDateTime.cpp b/Source/WTF/wtf/GregorianDateTime.cpp
new file mode 100644
index 0000000..61f73bf
--- /dev/null
+++ b/Source/WTF/wtf/GregorianDateTime.cpp
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
+ *
+ * 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 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 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 "config.h"
+#include "GregorianDateTime.h"
+
+#include "DateMath.h"
+
+#if OS(WINDOWS)
+#include <windows.h>
+#else
+#include <time.h>
+#endif
+
+namespace WTF {
+
+void GregorianDateTime::setToCurrentLocalTime()
+{
+#if OS(WINDOWS)
+    SYSTEMTIME systemTime;
+    GetLocalTime(&systemTime);
+    TIME_ZONE_INFORMATION timeZoneInformation;
+    DWORD timeZoneId = GetTimeZoneInformation(&timeZoneInformation);
+
+    LONG bias = timeZoneInformation.Bias;
+    if (timeZoneId == TIME_ZONE_ID_DAYLIGHT)
+        bias += timeZoneInformation.DaylightBias;
+    else if (timeZoneId == TIME_ZONE_ID_STANDARD)
+        bias += timeZoneInformation.StandardBias;
+    else
+        ASSERT(timeZoneId == TIME_ZONE_ID_UNKNOWN);
+
+    m_year = systemTime.wYear;
+    m_month = systemTime.wMonth - 1;
+    m_monthDay = systemTime.wDay;
+    m_yearDay = dayInYear(m_year, m_month, m_monthDay);
+    m_weekDay = systemTime.wDayOfWeek;
+    m_hour = systemTime.wHour;
+    m_minute = systemTime.wMinute;
+    m_second = systemTime.wSecond;
+    m_utcOffset = -bias * secondsPerMinute;
+    m_isDST = timeZoneId == TIME_ZONE_ID_DAYLIGHT ? 1 : 0;
+#else
+    tm localTM;
+    time_t localTime = time(0);
+    localtime_r(&localTime, &localTM);
+
+    m_year = localTM.tm_year + 1900;
+    m_month = localTM.tm_mon;
+    m_monthDay = localTM.tm_mday;
+    m_yearDay = localTM.tm_yday;
+    m_weekDay = localTM.tm_wday;
+    m_hour = localTM.tm_hour;
+    m_minute = localTM.tm_min;
+    m_second = localTM.tm_sec;
+    m_isDST = localTM.tm_isdst;
+#if HAVE(TM_GMTOFF)
+    m_utcOffset = localTM.tm_gmtoff;
+#else
+    int utcOffset = calculateUTCOffset();
+    utcOffset += calculateDSTOffset(localTime * msPerSecond, utcOffset);
+    m_utcOffset = utcOffset / msPerSecond;
+#endif
+#endif
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/GregorianDateTime.h b/Source/WTF/wtf/GregorianDateTime.h
new file mode 100644
index 0000000..49fadf2
--- /dev/null
+++ b/Source/WTF/wtf/GregorianDateTime.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
+ *
+ * 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 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 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.
+ */
+
+#ifndef WTF_GregorianDateTime_h
+#define WTF_GregorianDateTime_h
+
+#include <string.h>
+#include <time.h>
+#include <wtf/Noncopyable.h>
+
+namespace WTF {
+
+class GregorianDateTime {
+    WTF_MAKE_NONCOPYABLE(GregorianDateTime);
+public:
+    GregorianDateTime()
+        : m_year(0)
+        , m_month(0)
+        , m_yearDay(0)
+        , m_monthDay(0)
+        , m_weekDay(0)
+        , m_hour(0)
+        , m_minute(0)
+        , m_second(0)
+        , m_utcOffset(0)
+        , m_isDST(0)
+    {
+    }
+
+    inline int year() const { return m_year; }
+    inline int month() const { return m_month; }
+    inline int yearDay() const { return m_yearDay; }
+    inline int monthDay() const { return m_monthDay; }
+    inline int weekDay() const { return m_weekDay; }
+    inline int hour() const { return m_hour; }
+    inline int minute() const { return m_minute; }
+    inline int second() const { return m_second; }
+    inline int utcOffset() const { return m_utcOffset; }
+    inline int isDST() const { return m_isDST; }
+
+    inline void setYear(int year) { m_year = year; }
+    inline void setMonth(int month) { m_month = month; }
+    inline void setYearDay(int yearDay) { m_yearDay = yearDay; }
+    inline void setMonthDay(int monthDay) { m_monthDay = monthDay; }
+    inline void setWeekDay(int weekDay) { m_weekDay = weekDay; }
+    inline void setHour(int hour) { m_hour = hour; }
+    inline void setMinute(int minute) { m_minute = minute; }
+    inline void setSecond(int second) { m_second = second; }
+    inline void setUtcOffset(int utcOffset) { m_utcOffset = utcOffset; }
+    inline void setIsDST(int isDST) { m_isDST = isDST; }
+
+    WTF_EXPORT_PRIVATE void setToCurrentLocalTime();
+
+    operator tm() const
+    {
+        tm ret;
+        memset(&ret, 0, sizeof(ret));
+
+        ret.tm_year = m_year - 1900;
+        ret.tm_mon = m_month;
+        ret.tm_yday = m_yearDay;
+        ret.tm_mday = m_monthDay;
+        ret.tm_wday = m_weekDay;
+        ret.tm_hour = m_hour;
+        ret.tm_min = m_minute;
+        ret.tm_sec = m_second;
+        ret.tm_isdst = m_isDST;
+
+#if HAVE(TM_GMTOFF)
+        ret.tm_gmtoff = static_cast<long>(m_utcOffset);
+#endif
+
+        return ret;
+    }
+
+    void copyFrom(const GregorianDateTime& other)
+    {
+        m_year = other.m_year;
+        m_month = other.m_month;
+        m_yearDay = other.m_yearDay;
+        m_monthDay = other.m_monthDay;
+        m_weekDay = other.m_weekDay;
+        m_hour = other.m_hour;
+        m_minute = other.m_minute;
+        m_second = other.m_second;
+        m_utcOffset = other.m_utcOffset;
+        m_isDST = other.m_isDST;
+    }
+
+private:
+    int m_year;
+    int m_month;
+    int m_yearDay;
+    int m_monthDay;
+    int m_weekDay;
+    int m_hour;
+    int m_minute;
+    int m_second;
+    int m_utcOffset;
+    int m_isDST;
+};
+
+} // namespace WTF
+
+using WTF::GregorianDateTime;
+
+#endif // WTF_GregorianDateTime_h
diff --git a/Source/WTF/wtf/HashCountedSet.h b/Source/WTF/wtf/HashCountedSet.h
new file mode 100644
index 0000000..eff4a29
--- /dev/null
+++ b/Source/WTF/wtf/HashCountedSet.h
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2005, 2006, 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_HashCountedSet_h
+#define WTF_HashCountedSet_h
+
+#include <wtf/Assertions.h>
+#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+    template<typename Value, typename HashFunctions = typename DefaultHash<Value>::Hash,
+        typename Traits = HashTraits<Value> > class HashCountedSet {
+        WTF_MAKE_FAST_ALLOCATED;
+    private:
+        typedef HashMap<Value, unsigned, HashFunctions, Traits> ImplType;
+    public:
+        typedef Value ValueType;
+        typedef typename ImplType::iterator iterator;
+        typedef typename ImplType::const_iterator const_iterator;
+        typedef typename ImplType::AddResult AddResult;
+        
+        HashCountedSet() {}
+
+        void swap(HashCountedSet&);
+        
+        int size() const;
+        int capacity() const;
+        bool isEmpty() const;
+        
+        // Iterators iterate over pairs of values and counts.
+        iterator begin();
+        iterator end();
+        const_iterator begin() const;
+        const_iterator end() const;
+        
+        iterator find(const ValueType&);
+        const_iterator find(const ValueType&) const;
+        bool contains(const ValueType&) const;
+        unsigned count(const ValueType&) const;
+
+        // Increases the count if an equal value is already present
+        // the return value is a pair of an interator to the new value's 
+        // location, and a bool that is true if an new entry was added.
+        AddResult add(const ValueType&);
+        
+        // Reduces the count of the value, and removes it if count
+        // goes down to zero, returns true if the value is removed.
+        bool remove(const ValueType&);
+        bool remove(iterator);
+ 
+        // Removes the value, regardless of its count.
+        void removeAll(iterator);
+        void removeAll(const ValueType&);
+
+        // Clears the whole set.
+        void clear();
+
+    private:
+        ImplType m_impl;
+    };
+
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline void HashCountedSet<Value, HashFunctions, Traits>::swap(HashCountedSet& other)
+    {
+        m_impl.swap(other.m_impl);
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline int HashCountedSet<Value, HashFunctions, Traits>::size() const
+    {
+        return m_impl.size(); 
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline int HashCountedSet<Value, HashFunctions, Traits>::capacity() const
+    {
+        return m_impl.capacity(); 
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline bool HashCountedSet<Value, HashFunctions, Traits>::isEmpty() const
+    {
+        return size() == 0; 
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline typename HashCountedSet<Value, HashFunctions, Traits>::iterator HashCountedSet<Value, HashFunctions, Traits>::begin()
+    {
+        return m_impl.begin(); 
+    }
+
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline typename HashCountedSet<Value, HashFunctions, Traits>::iterator HashCountedSet<Value, HashFunctions, Traits>::end()
+    {
+        return m_impl.end(); 
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator HashCountedSet<Value, HashFunctions, Traits>::begin() const
+    {
+        return m_impl.begin(); 
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator HashCountedSet<Value, HashFunctions, Traits>::end() const
+    {
+        return m_impl.end(); 
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline typename HashCountedSet<Value, HashFunctions, Traits>::iterator HashCountedSet<Value, HashFunctions, Traits>::find(const ValueType& value)
+    {
+        return m_impl.find(value); 
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator HashCountedSet<Value, HashFunctions, Traits>::find(const ValueType& value) const
+    {
+        return m_impl.find(value); 
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline bool HashCountedSet<Value, HashFunctions, Traits>::contains(const ValueType& value) const
+    {
+        return m_impl.contains(value); 
+    }
+
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline unsigned HashCountedSet<Value, HashFunctions, Traits>::count(const ValueType& value) const
+    {
+        return m_impl.get(value);
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline typename HashCountedSet<Value, HashFunctions, Traits>::AddResult HashCountedSet<Value, HashFunctions, Traits>::add(const ValueType &value)
+    {
+        AddResult result = m_impl.add(value, 0);
+        ++result.iterator->value;
+        return result;
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline bool HashCountedSet<Value, HashFunctions, Traits>::remove(const ValueType& value)
+    {
+        return remove(find(value));
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline bool HashCountedSet<Value, HashFunctions, Traits>::remove(iterator it)
+    {
+        if (it == end())
+            return false;
+
+        unsigned oldVal = it->value;
+        ASSERT(oldVal);
+        unsigned newVal = oldVal - 1;
+        if (newVal) {
+            it->value = newVal;
+            return false;
+        }
+
+        m_impl.remove(it);
+        return true;
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline void HashCountedSet<Value, HashFunctions, Traits>::removeAll(const ValueType& value)
+    {
+        removeAll(find(value));
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline void HashCountedSet<Value, HashFunctions, Traits>::removeAll(iterator it)
+    {
+        if (it == end())
+            return;
+
+        m_impl.remove(it);
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline void HashCountedSet<Value, HashFunctions, Traits>::clear()
+    {
+        m_impl.clear(); 
+    }
+    
+    template<typename Value, typename HashFunctions, typename Traits, typename VectorType>
+    inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits>& collection, VectorType& vector)
+    {
+        typedef typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator iterator;
+        
+        vector.resize(collection.size());
+        
+        iterator it = collection.begin();
+        iterator end = collection.end();
+        for (unsigned i = 0; it != end; ++it, ++i)
+            vector[i] = *it;
+    }
+
+    template<typename Value, typename HashFunctions, typename Traits>
+    inline void copyToVector(const HashCountedSet<Value, HashFunctions, Traits>& collection, Vector<Value>& vector)
+    {
+        typedef typename HashCountedSet<Value, HashFunctions, Traits>::const_iterator iterator;
+        
+        vector.resize(collection.size());
+        
+        iterator it = collection.begin();
+        iterator end = collection.end();
+        for (unsigned i = 0; it != end; ++it, ++i)
+            vector[i] = (*it).key;
+    }
+
+
+} // namespace khtml
+
+using WTF::HashCountedSet;
+
+#endif /* WTF_HashCountedSet_h */
diff --git a/Source/WTF/wtf/HashFunctions.h b/Source/WTF/wtf/HashFunctions.h
new file mode 100644
index 0000000..75fabcd
--- /dev/null
+++ b/Source/WTF/wtf/HashFunctions.h
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2005, 2006, 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_HashFunctions_h
+#define WTF_HashFunctions_h
+
+#include <wtf/RefPtr.h>
+#include <stdint.h>
+
+namespace WTF {
+
+    template<size_t size> struct IntTypes;
+    template<> struct IntTypes<1> { typedef int8_t SignedType; typedef uint8_t UnsignedType; };
+    template<> struct IntTypes<2> { typedef int16_t SignedType; typedef uint16_t UnsignedType; };
+    template<> struct IntTypes<4> { typedef int32_t SignedType; typedef uint32_t UnsignedType; };
+    template<> struct IntTypes<8> { typedef int64_t SignedType; typedef uint64_t UnsignedType; };
+
+    // integer hash function
+
+    // Thomas Wang's 32 Bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
+    inline unsigned intHash(uint8_t key8)
+    {
+        unsigned key = key8;
+        key += ~(key << 15);
+        key ^= (key >> 10);
+        key += (key << 3);
+        key ^= (key >> 6);
+        key += ~(key << 11);
+        key ^= (key >> 16);
+        return key;
+    }
+
+    // Thomas Wang's 32 Bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
+    inline unsigned intHash(uint16_t key16)
+    {
+        unsigned key = key16;
+        key += ~(key << 15);
+        key ^= (key >> 10);
+        key += (key << 3);
+        key ^= (key >> 6);
+        key += ~(key << 11);
+        key ^= (key >> 16);
+        return key;
+    }
+
+    // Thomas Wang's 32 Bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
+    inline unsigned intHash(uint32_t key) 
+    {
+        key += ~(key << 15);
+        key ^= (key >> 10);
+        key += (key << 3);
+        key ^= (key >> 6);
+        key += ~(key << 11);
+        key ^= (key >> 16);
+        return key;
+    }
+    
+    // Thomas Wang's 64 bit Mix Function: http://www.cris.com/~Ttwang/tech/inthash.htm
+    inline unsigned intHash(uint64_t key)
+    {
+        key += ~(key << 32);
+        key ^= (key >> 22);
+        key += ~(key << 13);
+        key ^= (key >> 8);
+        key += (key << 3);
+        key ^= (key >> 15);
+        key += ~(key << 27);
+        key ^= (key >> 31);
+        return static_cast<unsigned>(key);
+    }
+
+    // Compound integer hash method: http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECTION00832000000000000000
+    inline unsigned pairIntHash(unsigned key1, unsigned key2)
+    {
+        unsigned shortRandom1 = 277951225; // A random 32-bit value.
+        unsigned shortRandom2 = 95187966; // A random 32-bit value.
+        uint64_t longRandom = 19248658165952622LL; // A random 64-bit value.
+
+        uint64_t product = longRandom * (shortRandom1 * key1 + shortRandom2 * key2);
+        unsigned highBits = static_cast<unsigned>(product >> (sizeof(uint64_t) - sizeof(unsigned)));
+        return highBits;
+    }
+
+    template<typename T> struct IntHash {
+        static unsigned hash(T key) { return intHash(static_cast<typename IntTypes<sizeof(T)>::UnsignedType>(key)); }
+        static bool equal(T a, T b) { return a == b; }
+        static const bool safeToCompareToEmptyOrDeleted = true;
+    };
+
+    template<typename T> struct FloatHash {
+        typedef typename IntTypes<sizeof(T)>::UnsignedType Bits;
+        static unsigned hash(T key)
+        {
+            return intHash(bitwise_cast<Bits>(key));
+        }
+        static bool equal(T a, T b)
+        {
+            return bitwise_cast<Bits>(a) == bitwise_cast<Bits>(b);
+        }
+        static const bool safeToCompareToEmptyOrDeleted = true;
+    };
+
+    // pointer identity hash function
+
+    template<typename T> struct PtrHash {
+        static unsigned hash(T key)
+        {
+#if COMPILER(MSVC)
+#pragma warning(push)
+#pragma warning(disable: 4244) // work around what seems to be a bug in MSVC's conversion warnings
+#endif
+            return IntHash<uintptr_t>::hash(reinterpret_cast<uintptr_t>(key));
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+        }
+        static bool equal(T a, T b) { return a == b; }
+        static const bool safeToCompareToEmptyOrDeleted = true;
+    };
+    template<typename P> struct PtrHash<RefPtr<P> > : PtrHash<P*> {
+        using PtrHash<P*>::hash;
+        static unsigned hash(const RefPtr<P>& key) { return hash(key.get()); }
+        using PtrHash<P*>::equal;
+        static bool equal(const RefPtr<P>& a, const RefPtr<P>& b) { return a == b; }
+        static bool equal(P* a, const RefPtr<P>& b) { return a == b; }
+        static bool equal(const RefPtr<P>& a, P* b) { return a == b; }
+    };
+
+    // default hash function for each type
+
+    template<typename T> struct DefaultHash;
+
+    template<typename T, typename U> struct PairHash {
+        static unsigned hash(const std::pair<T, U>& p)
+        {
+            return pairIntHash(DefaultHash<T>::Hash::hash(p.first), DefaultHash<U>::Hash::hash(p.second));
+        }
+        static bool equal(const std::pair<T, U>& a, const std::pair<T, U>& b)
+        {
+            return DefaultHash<T>::Hash::equal(a.first, b.first) && DefaultHash<U>::Hash::equal(a.second, b.second);
+        }
+        static const bool safeToCompareToEmptyOrDeleted = DefaultHash<T>::Hash::safeToCompareToEmptyOrDeleted 
+                                                            && DefaultHash<U>::Hash::safeToCompareToEmptyOrDeleted;
+    };
+
+    template<typename T, typename U> struct IntPairHash {
+        static unsigned hash(const std::pair<T, U>& p) { return pairIntHash(p.first, p.second); }
+        static bool equal(const std::pair<T, U>& a, const std::pair<T, U>& b) { return PairHash<T, T>::equal(a, b); }
+        static const bool safeToCompareToEmptyOrDeleted = PairHash<T, U>::safeToCompareToEmptyOrDeleted;
+    };
+
+    // make IntHash the default hash function for many integer types
+
+    template<> struct DefaultHash<short> { typedef IntHash<unsigned> Hash; };
+    template<> struct DefaultHash<unsigned short> { typedef IntHash<unsigned> Hash; };
+    template<> struct DefaultHash<int> { typedef IntHash<unsigned> Hash; };
+    template<> struct DefaultHash<unsigned> { typedef IntHash<unsigned> Hash; };
+    template<> struct DefaultHash<long> { typedef IntHash<unsigned long> Hash; };
+    template<> struct DefaultHash<unsigned long> { typedef IntHash<unsigned long> Hash; };
+    template<> struct DefaultHash<long long> { typedef IntHash<unsigned long long> Hash; };
+    template<> struct DefaultHash<unsigned long long> { typedef IntHash<unsigned long long> Hash; };
+
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+    template<> struct DefaultHash<wchar_t> { typedef IntHash<wchar_t> Hash; };
+#endif
+
+    template<> struct DefaultHash<float> { typedef FloatHash<float> Hash; };
+    template<> struct DefaultHash<double> { typedef FloatHash<double> Hash; };
+
+    // make PtrHash the default hash function for pointer types that don't specialize
+
+    template<typename P> struct DefaultHash<P*> { typedef PtrHash<P*> Hash; };
+    template<typename P> struct DefaultHash<RefPtr<P> > { typedef PtrHash<RefPtr<P> > Hash; };
+
+    // make IntPairHash the default hash function for pairs of (at most) 32-bit integers.
+
+    template<> struct DefaultHash<std::pair<short, short> > { typedef IntPairHash<short, short> Hash; };
+    template<> struct DefaultHash<std::pair<short, unsigned short> > { typedef IntPairHash<short, unsigned short> Hash; };
+    template<> struct DefaultHash<std::pair<short, int> > { typedef IntPairHash<short, int> Hash; };
+    template<> struct DefaultHash<std::pair<short, unsigned> > { typedef IntPairHash<short, unsigned> Hash; };
+    template<> struct DefaultHash<std::pair<unsigned short, short> > { typedef IntPairHash<unsigned short, short> Hash; };
+    template<> struct DefaultHash<std::pair<unsigned short, unsigned short> > { typedef IntPairHash<unsigned short, unsigned short> Hash; };
+    template<> struct DefaultHash<std::pair<unsigned short, int> > { typedef IntPairHash<unsigned short, int> Hash; };
+    template<> struct DefaultHash<std::pair<unsigned short, unsigned> > { typedef IntPairHash<unsigned short, unsigned> Hash; };
+    template<> struct DefaultHash<std::pair<int, short> > { typedef IntPairHash<int, short> Hash; };
+    template<> struct DefaultHash<std::pair<int, unsigned short> > { typedef IntPairHash<int, unsigned short> Hash; };
+    template<> struct DefaultHash<std::pair<int, int> > { typedef IntPairHash<int, int> Hash; };
+    template<> struct DefaultHash<std::pair<int, unsigned> > { typedef IntPairHash<unsigned, unsigned> Hash; };
+    template<> struct DefaultHash<std::pair<unsigned, short> > { typedef IntPairHash<unsigned, short> Hash; };
+    template<> struct DefaultHash<std::pair<unsigned, unsigned short> > { typedef IntPairHash<unsigned, unsigned short> Hash; };
+    template<> struct DefaultHash<std::pair<unsigned, int> > { typedef IntPairHash<unsigned, int> Hash; };
+    template<> struct DefaultHash<std::pair<unsigned, unsigned> > { typedef IntPairHash<unsigned, unsigned> Hash; };
+
+    // make PairHash the default hash function for pairs of arbitrary values.
+
+    template<typename T, typename U> struct DefaultHash<std::pair<T, U> > { typedef PairHash<T, U> Hash; };
+
+} // namespace WTF
+
+using WTF::DefaultHash;
+using WTF::IntHash;
+using WTF::PtrHash;
+
+#endif // WTF_HashFunctions_h
diff --git a/Source/WTF/wtf/HashIterators.h b/Source/WTF/wtf/HashIterators.h
new file mode 100644
index 0000000..9be4de3
--- /dev/null
+++ b/Source/WTF/wtf/HashIterators.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. 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_HashIterators_h
+#define WTF_HashIterators_h
+
+namespace WTF {
+
+    template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstKeysIterator;
+    template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstValuesIterator;
+    template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableKeysIterator;
+    template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableValuesIterator;
+
+    template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > {
+    private:
+        typedef KeyValuePair<KeyType, MappedType> ValueType;
+    public:
+        typedef HashTableConstKeysIterator<HashTableType, KeyType, MappedType> Keys;
+        typedef HashTableConstValuesIterator<HashTableType, KeyType, MappedType> Values;
+
+        HashTableConstIteratorAdapter() {}
+        HashTableConstIteratorAdapter(const typename HashTableType::const_iterator& impl) : m_impl(impl) {}
+
+        const ValueType* get() const { return (const ValueType*)m_impl.get(); }
+        const ValueType& operator*() const { return *get(); }
+        const ValueType* operator->() const { return get(); }
+
+        HashTableConstIteratorAdapter& operator++() { ++m_impl; return *this; }
+        // postfix ++ intentionally omitted
+
+        Keys keys() { return Keys(*this); }
+        Values values() { return Values(*this); }
+
+        typename HashTableType::const_iterator m_impl;
+    };
+
+    template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > {
+    private:
+        typedef KeyValuePair<KeyType, MappedType> ValueType;
+    public:
+        typedef HashTableKeysIterator<HashTableType, KeyType, MappedType> Keys;
+        typedef HashTableValuesIterator<HashTableType, KeyType, MappedType> Values;
+
+        HashTableIteratorAdapter() {}
+        HashTableIteratorAdapter(const typename HashTableType::iterator& impl) : m_impl(impl) {}
+
+        ValueType* get() const { return (ValueType*)m_impl.get(); }
+        ValueType& operator*() const { return *get(); }
+        ValueType* operator->() const { return get(); }
+
+        HashTableIteratorAdapter& operator++() { ++m_impl; return *this; }
+        // postfix ++ intentionally omitted
+
+        operator HashTableConstIteratorAdapter<HashTableType, ValueType>() {
+            typename HashTableType::const_iterator i = m_impl;
+            return i;
+        }
+
+        Keys keys() { return Keys(*this); }
+        Values values() { return Values(*this); }
+
+        typename HashTableType::iterator m_impl;
+    };
+
+    template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstKeysIterator {
+    private:
+        typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > ConstIterator;
+
+    public:
+        HashTableConstKeysIterator(const ConstIterator& impl) : m_impl(impl) {}
+        
+        const KeyType* get() const { return &(m_impl.get()->key); }
+        const KeyType& operator*() const { return *get(); }
+        const KeyType* operator->() const { return get(); }
+
+        HashTableConstKeysIterator& operator++() { ++m_impl; return *this; }
+        // postfix ++ intentionally omitted
+
+        ConstIterator m_impl;
+    };
+
+    template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstValuesIterator {
+    private:
+        typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > ConstIterator;
+
+    public:
+        HashTableConstValuesIterator(const ConstIterator& impl) : m_impl(impl) {}
+        
+        const MappedType* get() const { return &(m_impl.get()->value); }
+        const MappedType& operator*() const { return *get(); }
+        const MappedType* operator->() const { return get(); }
+
+        HashTableConstValuesIterator& operator++() { ++m_impl; return *this; }
+        // postfix ++ intentionally omitted
+
+        ConstIterator m_impl;
+    };
+
+    template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableKeysIterator {
+    private:
+        typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > Iterator;
+        typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > ConstIterator;
+
+    public:
+        HashTableKeysIterator(const Iterator& impl) : m_impl(impl) {}
+        
+        KeyType* get() const { return &(m_impl.get()->key); }
+        KeyType& operator*() const { return *get(); }
+        KeyType* operator->() const { return get(); }
+
+        HashTableKeysIterator& operator++() { ++m_impl; return *this; }
+        // postfix ++ intentionally omitted
+
+        operator HashTableConstKeysIterator<HashTableType, KeyType, MappedType>() {
+            ConstIterator i = m_impl;
+            return i;
+        }
+
+        Iterator m_impl;
+    };
+
+    template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableValuesIterator {
+    private:
+        typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > Iterator;
+        typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > ConstIterator;
+
+    public:
+        HashTableValuesIterator(const Iterator& impl) : m_impl(impl) {}
+        
+        MappedType* get() const { return &(m_impl.get()->value); }
+        MappedType& operator*() const { return *get(); }
+        MappedType* operator->() const { return get(); }
+
+        HashTableValuesIterator& operator++() { ++m_impl; return *this; }
+        // postfix ++ intentionally omitted
+
+        operator HashTableConstValuesIterator<HashTableType, KeyType, MappedType>() {
+            ConstIterator i = m_impl;
+            return i;
+        }
+
+        Iterator m_impl;
+    };
+
+    template<typename T, typename U, typename V>
+        inline bool operator==(const HashTableConstKeysIterator<T, U, V>& a, const HashTableConstKeysIterator<T, U, V>& b)
+    {
+        return a.m_impl == b.m_impl;
+    }
+
+    template<typename T, typename U, typename V>
+        inline bool operator!=(const HashTableConstKeysIterator<T, U, V>& a, const HashTableConstKeysIterator<T, U, V>& b)
+    {
+        return a.m_impl != b.m_impl;
+    }
+
+    template<typename T, typename U, typename V>
+        inline bool operator==(const HashTableConstValuesIterator<T, U, V>& a, const HashTableConstValuesIterator<T, U, V>& b)
+    {
+        return a.m_impl == b.m_impl;
+    }
+
+    template<typename T, typename U, typename V>
+        inline bool operator!=(const HashTableConstValuesIterator<T, U, V>& a, const HashTableConstValuesIterator<T, U, V>& b)
+    {
+        return a.m_impl != b.m_impl;
+    }
+
+    template<typename T, typename U, typename V>
+        inline bool operator==(const HashTableKeysIterator<T, U, V>& a, const HashTableKeysIterator<T, U, V>& b)
+    {
+        return a.m_impl == b.m_impl;
+    }
+
+    template<typename T, typename U, typename V>
+        inline bool operator!=(const HashTableKeysIterator<T, U, V>& a, const HashTableKeysIterator<T, U, V>& b)
+    {
+        return a.m_impl != b.m_impl;
+    }
+
+    template<typename T, typename U, typename V>
+        inline bool operator==(const HashTableValuesIterator<T, U, V>& a, const HashTableValuesIterator<T, U, V>& b)
+    {
+        return a.m_impl == b.m_impl;
+    }
+
+    template<typename T, typename U, typename V>
+        inline bool operator!=(const HashTableValuesIterator<T, U, V>& a, const HashTableValuesIterator<T, U, V>& b)
+    {
+        return a.m_impl != b.m_impl;
+    }
+
+
+} // namespace WTF
+
+#endif // WTF_HashIterators_h
diff --git a/Source/WTF/wtf/HashMap.h b/Source/WTF/wtf/HashMap.h
new file mode 100644
index 0000000..10ee425
--- /dev/null
+++ b/Source/WTF/wtf/HashMap.h
@@ -0,0 +1,488 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2011 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_HashMap_h
+#define WTF_HashMap_h
+
+#include <wtf/HashTable.h>
+
+namespace WTF {
+
+    template<typename KeyTraits, typename MappedTraits> struct HashMapValueTraits;
+
+    template<typename T> struct ReferenceTypeMaker {
+        typedef T& ReferenceType;
+    };
+    template<typename T> struct ReferenceTypeMaker<T&> {
+        typedef T& ReferenceType;
+    };
+
+    template<typename T> struct KeyValuePairKeyExtractor {
+        static const typename T::KeyType& extract(const T& p) { return p.key; }
+    };
+
+    template<typename KeyArg, typename MappedArg, typename HashArg = typename DefaultHash<KeyArg>::Hash,
+        typename KeyTraitsArg = HashTraits<KeyArg>, typename MappedTraitsArg = HashTraits<MappedArg> >
+    class HashMap {
+        WTF_MAKE_FAST_ALLOCATED;
+    private:
+        typedef KeyTraitsArg KeyTraits;
+        typedef MappedTraitsArg MappedTraits;
+        typedef HashMapValueTraits<KeyTraits, MappedTraits> ValueTraits;
+
+    public:
+        typedef typename KeyTraits::TraitType KeyType;
+        typedef typename MappedTraits::TraitType MappedType;
+        typedef typename ValueTraits::TraitType ValueType;
+
+    private:
+        typedef typename MappedTraits::PassInType MappedPassInType;
+        typedef typename MappedTraits::PassOutType MappedPassOutType;
+        typedef typename MappedTraits::PeekType MappedPeekType;
+
+        typedef typename ReferenceTypeMaker<MappedPassInType>::ReferenceType MappedPassInReferenceType;
+
+        typedef HashArg HashFunctions;
+
+        typedef HashTable<KeyType, ValueType, KeyValuePairKeyExtractor<ValueType>,
+            HashFunctions, ValueTraits, KeyTraits> HashTableType;
+
+        class HashMapKeysProxy;
+        class HashMapValuesProxy;
+
+    public:
+        typedef HashTableIteratorAdapter<HashTableType, ValueType> iterator;
+        typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator;
+        typedef typename HashTableType::AddResult AddResult;
+
+    public:
+        void swap(HashMap&);
+
+        int size() const;
+        int capacity() const;
+        bool isEmpty() const;
+
+        // iterators iterate over pairs of keys and values
+        iterator begin();
+        iterator end();
+        const_iterator begin() const;
+        const_iterator end() const;
+
+        HashMapKeysProxy& keys() { return static_cast<HashMapKeysProxy&>(*this); }
+        const HashMapKeysProxy& keys() const { return static_cast<const HashMapKeysProxy&>(*this); }
+
+        HashMapValuesProxy& values() { return static_cast<HashMapValuesProxy&>(*this); }
+        const HashMapValuesProxy& values() const { return static_cast<const HashMapValuesProxy&>(*this); }
+
+        iterator find(const KeyType&);
+        const_iterator find(const KeyType&) const;
+        bool contains(const KeyType&) const;
+        MappedPeekType get(const KeyType&) const;
+
+        // replaces value but not key if key is already present
+        // return value is a pair of the iterator to the key location, 
+        // and a boolean that's true if a new value was actually added
+        AddResult set(const KeyType&, MappedPassInType);
+
+        // does nothing if key is already present
+        // return value is a pair of the iterator to the key location, 
+        // and a boolean that's true if a new value was actually added
+        AddResult add(const KeyType&, MappedPassInType);
+
+        void remove(const KeyType&);
+        void remove(iterator);
+        void clear();
+
+        MappedPassOutType take(const KeyType&); // efficient combination of get with remove
+
+        // An alternate version of find() that finds the object by hashing and comparing
+        // with some other type, to avoid the cost of type conversion. HashTranslator
+        // must have the following function members:
+        //   static unsigned hash(const T&);
+        //   static bool equal(const ValueType&, const T&);
+        template<typename T, typename HashTranslator> iterator find(const T&);
+        template<typename T, typename HashTranslator> const_iterator find(const T&) const;
+        template<typename T, typename HashTranslator> bool contains(const T&) const;
+
+        // An alternate version of add() that finds the object by hashing and comparing
+        // with some other type, to avoid the cost of type conversion if the object is already
+        // in the table. HashTranslator must have the following function members:
+        //   static unsigned hash(const T&);
+        //   static bool equal(const ValueType&, const T&);
+        //   static translate(ValueType&, const T&, unsigned hashCode);
+        template<typename T, typename HashTranslator> AddResult add(const T&, MappedPassInType);
+
+        void checkConsistency() const;
+
+    private:
+        AddResult inlineAdd(const KeyType&, MappedPassInReferenceType);
+
+        class HashMapKeysProxy : private HashMap {
+        public:
+            typedef typename HashMap::iterator::Keys iterator;
+            typedef typename HashMap::const_iterator::Keys const_iterator;
+            
+            iterator begin()
+            {
+                return HashMap::begin().keys();
+            }
+            
+            iterator end()
+            {
+                return HashMap::end().keys();
+            }
+
+            const_iterator begin() const
+            {
+                return HashMap::begin().keys();
+            }
+            
+            const_iterator end() const
+            {
+                return HashMap::end().keys();
+            }
+
+        private:
+            friend class HashMap;
+
+            // These are intentionally not implemented.
+            HashMapKeysProxy();
+            HashMapKeysProxy(const HashMapKeysProxy&);
+            HashMapKeysProxy& operator=(const HashMapKeysProxy&);
+            ~HashMapKeysProxy();
+        };
+
+        class HashMapValuesProxy : private HashMap {
+        public:
+            typedef typename HashMap::iterator::Values iterator;
+            typedef typename HashMap::const_iterator::Values const_iterator;
+            
+            iterator begin()
+            {
+                return HashMap::begin().values();
+            }
+            
+            iterator end()
+            {
+                return HashMap::end().values();
+            }
+
+            const_iterator begin() const
+            {
+                return HashMap::begin().values();
+            }
+            
+            const_iterator end() const
+            {
+                return HashMap::end().values();
+            }
+
+        private:
+            friend class HashMap;
+
+            // These are intentionally not implemented.
+            HashMapValuesProxy();
+            HashMapValuesProxy(const HashMapValuesProxy&);
+            HashMapValuesProxy& operator=(const HashMapValuesProxy&);
+            ~HashMapValuesProxy();
+        };
+
+        HashTableType m_impl;
+    };
+
+    template<typename KeyTraits, typename MappedTraits> struct HashMapValueTraits : KeyValuePairHashTraits<KeyTraits, MappedTraits> {
+        static const bool hasIsEmptyValueFunction = true;
+        static bool isEmptyValue(const typename KeyValuePairHashTraits<KeyTraits, MappedTraits>::TraitType& value)
+        {
+            return isHashTraitsEmptyValue<KeyTraits>(value.key);
+        }
+    };
+
+    template<typename ValueTraits, typename HashFunctions>
+    struct HashMapTranslator {
+        template<typename T> static unsigned hash(const T& key) { return HashFunctions::hash(key); }
+        template<typename T, typename U> static bool equal(const T& a, const U& b) { return HashFunctions::equal(a, b); }
+        template<typename T, typename U, typename V> static void translate(T& location, const U& key, const V& mapped)
+        {
+            location.key = key;
+            ValueTraits::ValueTraits::store(mapped, location.value);
+        }
+    };
+
+    template<typename ValueTraits, typename Translator>
+    struct HashMapTranslatorAdapter {
+        template<typename T> static unsigned hash(const T& key) { return Translator::hash(key); }
+        template<typename T, typename U> static bool equal(const T& a, const U& b) { return Translator::equal(a, b); }
+        template<typename T, typename U, typename V> static void translate(T& location, const U& key, const V& mapped, unsigned hashCode)
+        {
+            Translator::translate(location.key, key, hashCode);
+            ValueTraits::ValueTraits::store(mapped, location.value);
+        }
+    };
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void HashMap<T, U, V, W, X>::swap(HashMap& other)
+    {
+        m_impl.swap(other.m_impl); 
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline int HashMap<T, U, V, W, X>::size() const
+    {
+        return m_impl.size(); 
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline int HashMap<T, U, V, W, X>::capacity() const
+    { 
+        return m_impl.capacity(); 
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline bool HashMap<T, U, V, W, X>::isEmpty() const
+    {
+        return m_impl.isEmpty();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<T, U, V, W, X>::iterator HashMap<T, U, V, W, X>::begin()
+    {
+        return m_impl.begin();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<T, U, V, W, X>::iterator HashMap<T, U, V, W, X>::end()
+    {
+        return m_impl.end();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<T, U, V, W, X>::const_iterator HashMap<T, U, V, W, X>::begin() const
+    {
+        return m_impl.begin();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<T, U, V, W, X>::const_iterator HashMap<T, U, V, W, X>::end() const
+    {
+        return m_impl.end();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<T, U, V, W, X>::iterator HashMap<T, U, V, W, X>::find(const KeyType& key)
+    {
+        return m_impl.find(key);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<T, U, V, W, X>::const_iterator HashMap<T, U, V, W, X>::find(const KeyType& key) const
+    {
+        return m_impl.find(key);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline bool HashMap<T, U, V, W, X>::contains(const KeyType& key) const
+    {
+        return m_impl.contains(key);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    template<typename TYPE, typename HashTranslator>
+    inline typename HashMap<T, U, V, W, X>::iterator
+    HashMap<T, U, V, W, X>::find(const TYPE& value)
+    {
+        return m_impl.template find<HashMapTranslatorAdapter<ValueTraits, HashTranslator> >(value);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    template<typename TYPE, typename HashTranslator>
+    inline typename HashMap<T, U, V, W, X>::const_iterator 
+    HashMap<T, U, V, W, X>::find(const TYPE& value) const
+    {
+        return m_impl.template find<HashMapTranslatorAdapter<ValueTraits, HashTranslator> >(value);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    template<typename TYPE, typename HashTranslator>
+    inline bool
+    HashMap<T, U, V, W, X>::contains(const TYPE& value) const
+    {
+        return m_impl.template contains<HashMapTranslatorAdapter<ValueTraits, HashTranslator> >(value);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    typename HashMap<T, U, V, W, X>::AddResult
+    HashMap<T, U, V, W, X>::inlineAdd(const KeyType& key, MappedPassInReferenceType mapped) 
+    {
+        return m_impl.template add<HashMapTranslator<ValueTraits, HashFunctions> >(key, mapped);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    typename HashMap<T, U, V, W, X>::AddResult
+    HashMap<T, U, V, W, X>::set(const KeyType& key, MappedPassInType mapped) 
+    {
+        AddResult result = inlineAdd(key, mapped);
+        if (!result.isNewEntry) {
+            // The inlineAdd call above found an existing hash table entry; we need to set the mapped value.
+            MappedTraits::store(mapped, result.iterator->value);
+        }
+        return result;
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    template<typename TYPE, typename HashTranslator>
+    typename HashMap<T, U, V, W, X>::AddResult
+    HashMap<T, U, V, W, X>::add(const TYPE& key, MappedPassInType value)
+    {
+        return m_impl.template addPassingHashCode<HashMapTranslatorAdapter<ValueTraits, HashTranslator> >(key, value);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    typename HashMap<T, U, V, W, X>::AddResult
+    HashMap<T, U, V, W, X>::add(const KeyType& key, MappedPassInType mapped)
+    {
+        return inlineAdd(key, mapped);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename MappedTraits>
+    typename HashMap<T, U, V, W, MappedTraits>::MappedPeekType
+    HashMap<T, U, V, W, MappedTraits>::get(const KeyType& key) const
+    {
+        ValueType* entry = const_cast<HashTableType&>(m_impl).lookup(key);
+        if (!entry)
+            return MappedTraits::peek(MappedTraits::emptyValue());
+        return MappedTraits::peek(entry->value);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void HashMap<T, U, V, W, X>::remove(iterator it)
+    {
+        if (it.m_impl == m_impl.end())
+            return;
+        m_impl.internalCheckTableConsistency();
+        m_impl.removeWithoutEntryConsistencyCheck(it.m_impl);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void HashMap<T, U, V, W, X>::remove(const KeyType& key)
+    {
+        remove(find(key));
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void HashMap<T, U, V, W, X>::clear()
+    {
+        m_impl.clear();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename MappedTraits>
+    typename HashMap<T, U, V, W, MappedTraits>::MappedPassOutType
+    HashMap<T, U, V, W, MappedTraits>::take(const KeyType& key)
+    {
+        iterator it = find(key);
+        if (it == end())
+            return MappedTraits::passOut(MappedTraits::emptyValue());
+        MappedPassOutType result = MappedTraits::passOut(it->value);
+        remove(it);
+        return result;
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void HashMap<T, U, V, W, X>::checkConsistency() const
+    {
+        m_impl.checkTableConsistency();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    bool operator==(const HashMap<T, U, V, W, X>& a, const HashMap<T, U, V, W, X>& b)
+    {
+        if (a.size() != b.size())
+            return false;
+
+        typedef typename HashMap<T, U, V, W, X>::const_iterator const_iterator;
+
+        const_iterator end = a.end();
+        const_iterator notFound = b.end();
+        for (const_iterator it = a.begin(); it != end; ++it) {
+            const_iterator bPos = b.find(it->key);
+            if (bPos == notFound || it->value != bPos->value)
+                return false;
+        }
+
+        return true;
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline bool operator!=(const HashMap<T, U, V, W, X>& a, const HashMap<T, U, V, W, X>& b)
+    {
+        return !(a == b);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void deleteAllValues(const HashMap<T, U, V, W, X>& collection)
+    {
+        typedef typename HashMap<T, U, V, W, X>::const_iterator iterator;
+        iterator end = collection.end();
+        for (iterator it = collection.begin(); it != end; ++it)
+            delete it->value;
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void deleteAllKeys(const HashMap<T, U, V, W, X>& collection)
+    {
+        typedef typename HashMap<T, U, V, W, X>::const_iterator iterator;
+        iterator end = collection.end();
+        for (iterator it = collection.begin(); it != end; ++it)
+            delete it->key;
+    }
+    
+    template<typename T, typename U, typename V, typename W, typename X, typename Y>
+    inline void copyKeysToVector(const HashMap<T, U, V, W, X>& collection, Y& vector)
+    {
+        typedef typename HashMap<T, U, V, W, X>::const_iterator::Keys iterator;
+        
+        vector.resize(collection.size());
+        
+        iterator it = collection.begin().keys();
+        iterator end = collection.end().keys();
+        for (unsigned i = 0; it != end; ++it, ++i)
+            vector[i] = *it;
+    }  
+
+    template<typename T, typename U, typename V, typename W, typename X, typename Y>
+    inline void copyValuesToVector(const HashMap<T, U, V, W, X>& collection, Y& vector)
+    {
+        typedef typename HashMap<T, U, V, W, X>::const_iterator::Values iterator;
+        
+        vector.resize(collection.size());
+        
+        iterator it = collection.begin().values();
+        iterator end = collection.end().values();
+        for (unsigned i = 0; it != end; ++it, ++i)
+            vector[i] = *it;
+    }   
+
+} // namespace WTF
+
+using WTF::HashMap;
+
+#include <wtf/RefPtrHashMap.h>
+
+#endif /* WTF_HashMap_h */
diff --git a/Source/WTF/wtf/HashSet.h b/Source/WTF/wtf/HashSet.h
new file mode 100644
index 0000000..40bd7fe
--- /dev/null
+++ b/Source/WTF/wtf/HashSet.h
@@ -0,0 +1,244 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2011 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_HashSet_h
+#define WTF_HashSet_h
+
+#include <wtf/FastAllocBase.h>
+#include <wtf/HashTable.h>
+
+namespace WTF {
+
+    struct IdentityExtractor;
+    
+    template<typename Value, typename HashFunctions, typename Traits> class HashSet;
+    template<typename Value, typename HashFunctions, typename Traits>
+    void deleteAllValues(const HashSet<Value, HashFunctions, Traits>&);
+
+    template<typename ValueArg, typename HashArg = typename DefaultHash<ValueArg>::Hash,
+        typename TraitsArg = HashTraits<ValueArg> > class HashSet {
+        WTF_MAKE_FAST_ALLOCATED;
+    private:
+        typedef HashArg HashFunctions;
+        typedef TraitsArg ValueTraits;
+
+    public:
+        typedef typename ValueTraits::TraitType ValueType;
+
+    private:
+        typedef HashTable<ValueType, ValueType, IdentityExtractor,
+            HashFunctions, ValueTraits, ValueTraits> HashTableType;
+
+    public:
+        typedef HashTableConstIteratorAdapter<HashTableType, ValueType> iterator;
+        typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator;
+        typedef typename HashTableType::AddResult AddResult;
+
+        void swap(HashSet&);
+
+        int size() const;
+        int capacity() const;
+        bool isEmpty() const;
+
+        iterator begin() const;
+        iterator end() const;
+
+        iterator find(const ValueType&) const;
+        bool contains(const ValueType&) const;
+
+        // An alternate version of find() that finds the object by hashing and comparing
+        // with some other type, to avoid the cost of type conversion. HashTranslator
+        // must have the following function members:
+        //   static unsigned hash(const T&);
+        //   static bool equal(const ValueType&, const T&);
+        // FIXME: We should reverse the order of the template arguments so that callers
+        // can just pass the translator and let the compiler deduce T.
+        template<typename T, typename HashTranslator> iterator find(const T&) const;
+        template<typename T, typename HashTranslator> bool contains(const T&) const;
+
+        // The return value is a pair of an interator to the new value's location, 
+        // and a bool that is true if an new entry was added.
+        AddResult add(const ValueType&);
+
+        // An alternate version of add() that finds the object by hashing and comparing
+        // with some other type, to avoid the cost of type conversion if the object is already
+        // in the table. HashTranslator must have the following function members:
+        //   static unsigned hash(const T&);
+        //   static bool equal(const ValueType&, const T&);
+        //   static translate(ValueType&, const T&, unsigned hashCode);
+        // FIXME: We should reverse the order of the template arguments so that callers
+        // can just pass the translator and let the compiler deduce T.
+        template<typename T, typename HashTranslator> AddResult add(const T&);
+
+        void remove(const ValueType&);
+        void remove(iterator);
+        void clear();
+
+    private:
+        friend void deleteAllValues<>(const HashSet&);
+
+        HashTableType m_impl;
+    };
+
+    struct IdentityExtractor {
+        template<typename T> static const T& extract(const T& t) { return t; }
+    };
+
+    template<typename Translator>
+    struct HashSetTranslatorAdapter {
+        template<typename T> static unsigned hash(const T& key) { return Translator::hash(key); }
+        template<typename T, typename U> static bool equal(const T& a, const U& b) { return Translator::equal(a, b); }
+        template<typename T, typename U> static void translate(T& location, const U& key, const U&, unsigned hashCode)
+        {
+            Translator::translate(location, key, hashCode);
+        }
+    };
+
+    template<typename T, typename U, typename V>
+    inline void HashSet<T, U, V>::swap(HashSet& other)
+    {
+        m_impl.swap(other.m_impl); 
+    }
+
+    template<typename T, typename U, typename V>
+    inline int HashSet<T, U, V>::size() const
+    {
+        return m_impl.size(); 
+    }
+
+    template<typename T, typename U, typename V>
+    inline int HashSet<T, U, V>::capacity() const
+    {
+        return m_impl.capacity(); 
+    }
+
+    template<typename T, typename U, typename V>
+    inline bool HashSet<T, U, V>::isEmpty() const
+    {
+        return m_impl.isEmpty(); 
+    }
+
+    template<typename T, typename U, typename V>
+    inline typename HashSet<T, U, V>::iterator HashSet<T, U, V>::begin() const
+    {
+        return m_impl.begin(); 
+    }
+
+    template<typename T, typename U, typename V>
+    inline typename HashSet<T, U, V>::iterator HashSet<T, U, V>::end() const
+    {
+        return m_impl.end(); 
+    }
+
+    template<typename T, typename U, typename V>
+    inline typename HashSet<T, U, V>::iterator HashSet<T, U, V>::find(const ValueType& value) const
+    {
+        return m_impl.find(value); 
+    }
+
+    template<typename T, typename U, typename V>
+    inline bool HashSet<T, U, V>::contains(const ValueType& value) const
+    {
+        return m_impl.contains(value); 
+    }
+
+    template<typename Value, typename HashFunctions, typename Traits>
+    template<typename T, typename HashTranslator>
+    typename HashSet<Value, HashFunctions, Traits>::iterator
+    inline HashSet<Value, HashFunctions, Traits>::find(const T& value) const
+    {
+        return m_impl.template find<HashSetTranslatorAdapter<HashTranslator> >(value);
+    }
+
+    template<typename Value, typename HashFunctions, typename Traits>
+    template<typename T, typename HashTranslator>
+    inline bool HashSet<Value, HashFunctions, Traits>::contains(const T& value) const
+    {
+        return m_impl.template contains<HashSetTranslatorAdapter<HashTranslator> >(value);
+    }
+
+    template<typename T, typename U, typename V>
+    inline typename HashSet<T, U, V>::AddResult HashSet<T, U, V>::add(const ValueType& value)
+    {
+        return m_impl.add(value);
+    }
+
+    template<typename Value, typename HashFunctions, typename Traits>
+    template<typename T, typename HashTranslator>
+    inline typename HashSet<Value, HashFunctions, Traits>::AddResult
+    HashSet<Value, HashFunctions, Traits>::add(const T& value)
+    {
+        return m_impl.template addPassingHashCode<HashSetTranslatorAdapter<HashTranslator> >(value, value);
+    }
+
+    template<typename T, typename U, typename V>
+    inline void HashSet<T, U, V>::remove(iterator it)
+    {
+        if (it.m_impl == m_impl.end())
+            return;
+        m_impl.internalCheckTableConsistency();
+        m_impl.removeWithoutEntryConsistencyCheck(it.m_impl);
+    }
+
+    template<typename T, typename U, typename V>
+    inline void HashSet<T, U, V>::remove(const ValueType& value)
+    {
+        remove(find(value));
+    }
+
+    template<typename T, typename U, typename V>
+    inline void HashSet<T, U, V>::clear()
+    {
+        m_impl.clear(); 
+    }
+
+    template<typename ValueType, typename HashTableType>
+    void deleteAllValues(HashTableType& collection)
+    {
+        typedef typename HashTableType::const_iterator iterator;
+        iterator end = collection.end();
+        for (iterator it = collection.begin(); it != end; ++it)
+            delete *it;
+    }
+
+    template<typename T, typename U, typename V>
+    inline void deleteAllValues(const HashSet<T, U, V>& collection)
+    {
+        deleteAllValues<typename HashSet<T, U, V>::ValueType>(collection.m_impl);
+    }
+
+    template<typename T, typename U, typename V, typename W>
+    inline void copyToVector(const HashSet<T, U, V>& collection, W& vector)
+    {
+        typedef typename HashSet<T, U, V>::const_iterator iterator;
+        
+        vector.resize(collection.size());
+        
+        iterator it = collection.begin();
+        iterator end = collection.end();
+        for (unsigned i = 0; it != end; ++it, ++i)
+            vector[i] = *it;
+    }  
+
+} // namespace WTF
+
+using WTF::HashSet;
+
+#endif /* WTF_HashSet_h */
diff --git a/Source/WTF/wtf/HashTable.cpp b/Source/WTF/wtf/HashTable.cpp
new file mode 100644
index 0000000..ba65efa
--- /dev/null
+++ b/Source/WTF/wtf/HashTable.cpp
@@ -0,0 +1,68 @@
+/*
+    Copyright (C) 2005 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.
+*/
+
+#include "config.h"
+#include "HashTable.h"
+#include "DataLog.h"
+
+namespace WTF {
+
+#if DUMP_HASHTABLE_STATS
+
+int HashTableStats::numAccesses;
+int HashTableStats::numCollisions;
+int HashTableStats::collisionGraph[4096];
+int HashTableStats::maxCollisions;
+int HashTableStats::numRehashes;
+int HashTableStats::numRemoves;
+int HashTableStats::numReinserts;
+
+static Mutex& hashTableStatsMutex()
+{
+    AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
+    return mutex;
+}
+
+void HashTableStats::recordCollisionAtCount(int count)
+{
+    MutexLocker lock(hashTableStatsMutex());
+    if (count > maxCollisions)
+        maxCollisions = count;
+    numCollisions++;
+    collisionGraph[count]++;
+}
+
+void HashTableStats::dumpStats()
+{
+    MutexLocker lock(hashTableStatsMutex());
+
+    dataLog("\nWTF::HashTable statistics\n\n");
+    dataLog("%d accesses\n", numAccesses);
+    dataLog("%d total collisions, average %.2f probes per access\n", numCollisions, 1.0 * (numAccesses + numCollisions) / numAccesses);
+    dataLog("longest collision chain: %d\n", maxCollisions);
+    for (int i = 1; i <= maxCollisions; i++) {
+        dataLog("  %d lookups with exactly %d collisions (%.2f%% , %.2f%% with this many or more)\n", collisionGraph[i], i, 100.0 * (collisionGraph[i] - collisionGraph[i+1]) / numAccesses, 100.0 * collisionGraph[i] / numAccesses);
+    }
+    dataLog("%d rehashes\n", numRehashes);
+    dataLog("%d reinserts\n", numReinserts);
+}
+
+#endif
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/HashTable.h b/Source/WTF/wtf/HashTable.h
new file mode 100644
index 0000000..16fdd9e
--- /dev/null
+++ b/Source/WTF/wtf/HashTable.h
@@ -0,0 +1,1420 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 David Levin <levin@chromium.org>
+ *
+ * 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_HashTable_h
+#define WTF_HashTable_h
+
+#include <wtf/Alignment.h>
+#include <wtf/Assertions.h>
+#include <wtf/DataLog.h>
+#include <wtf/FastMalloc.h>
+#include <wtf/HashTraits.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/Threading.h>
+#include <wtf/ValueCheck.h>
+
+#ifndef NDEBUG
+// Required for CHECK_HASHTABLE_ITERATORS.
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#endif
+
+namespace WTF {
+
+#define DUMP_HASHTABLE_STATS 0
+#define DUMP_HASHTABLE_STATS_PER_TABLE 0
+
+// Enables internal WTF consistency checks that are invoked automatically. Non-WTF callers can call checkTableConsistency() even if internal checks are disabled.
+#define CHECK_HASHTABLE_CONSISTENCY 0
+
+#ifdef NDEBUG
+#define CHECK_HASHTABLE_ITERATORS 0
+#define CHECK_HASHTABLE_USE_AFTER_DESTRUCTION 0
+#else
+#define CHECK_HASHTABLE_ITERATORS 1
+#define CHECK_HASHTABLE_USE_AFTER_DESTRUCTION 1
+#endif
+
+#if DUMP_HASHTABLE_STATS
+
+    struct HashTableStats {
+        // The following variables are all atomically incremented when modified.
+        WTF_EXPORTDATA static int numAccesses;
+        WTF_EXPORTDATA static int numRehashes;
+        WTF_EXPORTDATA static int numRemoves;
+        WTF_EXPORTDATA static int numReinserts;
+
+        // The following variables are only modified in the recordCollisionAtCount method within a mutex.
+        WTF_EXPORTDATA static int maxCollisions;
+        WTF_EXPORTDATA static int numCollisions;
+        WTF_EXPORTDATA static int collisionGraph[4096];
+
+        WTF_EXPORT_PRIVATE static void recordCollisionAtCount(int count);
+        WTF_EXPORT_PRIVATE static void dumpStats();
+    };
+
+#endif
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    class HashTable;
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    class HashTableIterator;
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    class HashTableConstIterator;
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void addIterator(const HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*,
+        HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*);
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void removeIterator(HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*);
+
+#if !CHECK_HASHTABLE_ITERATORS
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    inline void addIterator(const HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*,
+        HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*) { }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    inline void removeIterator(HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>*) { }
+
+#endif
+
+    typedef enum { HashItemKnownGood } HashItemKnownGoodTag;
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    class HashTableConstIterator {
+    private:
+        typedef HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> HashTableType;
+        typedef HashTableIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> iterator;
+        typedef HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> const_iterator;
+        typedef Value ValueType;
+        typedef const ValueType& ReferenceType;
+        typedef const ValueType* PointerType;
+
+        friend class HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>;
+        friend class HashTableIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>;
+
+        void skipEmptyBuckets()
+        {
+            while (m_position != m_endPosition && HashTableType::isEmptyOrDeletedBucket(*m_position))
+                ++m_position;
+        }
+
+        HashTableConstIterator(const HashTableType* table, PointerType position, PointerType endPosition)
+            : m_position(position), m_endPosition(endPosition)
+        {
+            addIterator(table, this);
+            skipEmptyBuckets();
+        }
+
+        HashTableConstIterator(const HashTableType* table, PointerType position, PointerType endPosition, HashItemKnownGoodTag)
+            : m_position(position), m_endPosition(endPosition)
+        {
+            addIterator(table, this);
+        }
+
+    public:
+        HashTableConstIterator()
+        {
+            addIterator(static_cast<const HashTableType*>(0), this);
+        }
+
+        // default copy, assignment and destructor are OK if CHECK_HASHTABLE_ITERATORS is 0
+
+#if CHECK_HASHTABLE_ITERATORS
+        ~HashTableConstIterator()
+        {
+            removeIterator(this);
+        }
+
+        HashTableConstIterator(const const_iterator& other)
+            : m_position(other.m_position), m_endPosition(other.m_endPosition)
+        {
+            addIterator(other.m_table, this);
+        }
+
+        const_iterator& operator=(const const_iterator& other)
+        {
+            m_position = other.m_position;
+            m_endPosition = other.m_endPosition;
+
+            removeIterator(this);
+            addIterator(other.m_table, this);
+
+            return *this;
+        }
+#endif
+
+        PointerType get() const
+        {
+            checkValidity();
+            return m_position;
+        }
+        ReferenceType operator*() const { return *get(); }
+        PointerType operator->() const { return get(); }
+
+        const_iterator& operator++()
+        {
+            checkValidity();
+            ASSERT(m_position != m_endPosition);
+            ++m_position;
+            skipEmptyBuckets();
+            return *this;
+        }
+
+        // postfix ++ intentionally omitted
+
+        // Comparison.
+        bool operator==(const const_iterator& other) const
+        {
+            checkValidity(other);
+            return m_position == other.m_position;
+        }
+        bool operator!=(const const_iterator& other) const
+        {
+            checkValidity(other);
+            return m_position != other.m_position;
+        }
+        bool operator==(const iterator& other) const
+        {
+            return *this == static_cast<const_iterator>(other);
+        }
+        bool operator!=(const iterator& other) const
+        {
+            return *this != static_cast<const_iterator>(other);
+        }
+
+    private:
+        void checkValidity() const
+        {
+#if CHECK_HASHTABLE_ITERATORS
+            ASSERT(m_table);
+#endif
+        }
+
+
+#if CHECK_HASHTABLE_ITERATORS
+        void checkValidity(const const_iterator& other) const
+        {
+            ASSERT(m_table);
+            ASSERT_UNUSED(other, other.m_table);
+            ASSERT(m_table == other.m_table);
+        }
+#else
+        void checkValidity(const const_iterator&) const { }
+#endif
+
+        PointerType m_position;
+        PointerType m_endPosition;
+
+#if CHECK_HASHTABLE_ITERATORS
+    public:
+        // Any modifications of the m_next or m_previous of an iterator that is in a linked list of a HashTable::m_iterator,
+        // should be guarded with m_table->m_mutex.
+        mutable const HashTableType* m_table;
+        mutable const_iterator* m_next;
+        mutable const_iterator* m_previous;
+#endif
+    };
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    class HashTableIterator {
+    private:
+        typedef HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> HashTableType;
+        typedef HashTableIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> iterator;
+        typedef HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> const_iterator;
+        typedef Value ValueType;
+        typedef ValueType& ReferenceType;
+        typedef ValueType* PointerType;
+
+        friend class HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>;
+
+        HashTableIterator(HashTableType* table, PointerType pos, PointerType end) : m_iterator(table, pos, end) { }
+        HashTableIterator(HashTableType* table, PointerType pos, PointerType end, HashItemKnownGoodTag tag) : m_iterator(table, pos, end, tag) { }
+
+    public:
+        HashTableIterator() { }
+
+        // default copy, assignment and destructor are OK
+
+        PointerType get() const { return const_cast<PointerType>(m_iterator.get()); }
+        ReferenceType operator*() const { return *get(); }
+        PointerType operator->() const { return get(); }
+
+        iterator& operator++() { ++m_iterator; return *this; }
+
+        // postfix ++ intentionally omitted
+
+        // Comparison.
+        bool operator==(const iterator& other) const { return m_iterator == other.m_iterator; }
+        bool operator!=(const iterator& other) const { return m_iterator != other.m_iterator; }
+        bool operator==(const const_iterator& other) const { return m_iterator == other; }
+        bool operator!=(const const_iterator& other) const { return m_iterator != other; }
+
+        operator const_iterator() const { return m_iterator; }
+
+    private:
+        const_iterator m_iterator;
+    };
+
+    using std::swap;
+
+    // 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);
+    }
+
+    template<typename T, typename U> inline void hashTableSwap(KeyValuePair<T, U>& a, KeyValuePair<T, U>& b)
+    {
+        swap(a.key, b.key);
+        swap(a.value, b.value);
+    }
+
+    template<typename T, bool useSwap> struct Mover;
+    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 HashFunctions> class IdentityHashTranslator {
+    public:
+        template<typename T> static unsigned hash(const T& key) { return HashFunctions::hash(key); }
+        template<typename T> static bool equal(const T& a, const T& b) { return HashFunctions::equal(a, b); }
+        template<typename T, typename U> static void translate(T& location, const U&, const T& value) { location = value; }
+    };
+
+    template<typename IteratorType> struct HashTableAddResult {
+        HashTableAddResult(IteratorType iter, bool isNewEntry) : iterator(iter), isNewEntry(isNewEntry) { }
+        IteratorType iterator;
+        bool isNewEntry;
+    };
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    class HashTable {
+    public:
+        typedef HashTableIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> iterator;
+        typedef HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> const_iterator;
+        typedef Traits ValueTraits;
+        typedef Key KeyType;
+        typedef Value ValueType;
+        typedef IdentityHashTranslator<HashFunctions> IdentityTranslatorType;
+        typedef HashTableAddResult<iterator> AddResult;
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+        struct Stats {
+            Stats()
+                : numAccesses(0)
+                , numRehashes(0)
+                , numRemoves(0)
+                , numReinserts(0)
+                , maxCollisions(0)
+                , numCollisions(0)
+                , collisionGraph()
+            {
+            }
+
+            int numAccesses;
+            int numRehashes;
+            int numRemoves;
+            int numReinserts;
+
+            int maxCollisions;
+            int numCollisions;
+            int collisionGraph[4096];
+
+            void recordCollisionAtCount(int count)
+            {
+                if (count > maxCollisions)
+                    maxCollisions = count;
+                numCollisions++;
+                collisionGraph[count]++;
+            }
+
+            void dumpStats()
+            {
+                dataLog("\nWTF::HashTable::Stats dump\n\n");
+                dataLog("%d accesses\n", numAccesses);
+                dataLog("%d total collisions, average %.2f probes per access\n", numCollisions, 1.0 * (numAccesses + numCollisions) / numAccesses);
+                dataLog("longest collision chain: %d\n", maxCollisions);
+                for (int i = 1; i <= maxCollisions; i++) {
+                    dataLog("  %d lookups with exactly %d collisions (%.2f%% , %.2f%% with this many or more)\n", collisionGraph[i], i, 100.0 * (collisionGraph[i] - collisionGraph[i+1]) / numAccesses, 100.0 * collisionGraph[i] / numAccesses);
+                }
+                dataLog("%d rehashes\n", numRehashes);
+                dataLog("%d reinserts\n", numReinserts);
+            }
+        };
+#endif
+
+        HashTable();
+        ~HashTable() 
+        {
+            invalidateIterators(); 
+            if (m_table)
+                deallocateTable(m_table, m_tableSize);
+#if CHECK_HASHTABLE_USE_AFTER_DESTRUCTION
+            m_table = (ValueType*)(uintptr_t)0xbbadbeef;
+#endif
+        }
+
+        HashTable(const HashTable&);
+        void swap(HashTable&);
+        HashTable& operator=(const HashTable&);
+
+        // When the hash table is empty, just return the same iterator for end as for begin.
+        // This is more efficient because we don't have to skip all the empty and deleted
+        // buckets, and iterating an empty table is a common case that's worth optimizing.
+        iterator begin() { return isEmpty() ? end() : makeIterator(m_table); }
+        iterator end() { return makeKnownGoodIterator(m_table + m_tableSize); }
+        const_iterator begin() const { return isEmpty() ? end() : makeConstIterator(m_table); }
+        const_iterator end() const { return makeKnownGoodConstIterator(m_table + m_tableSize); }
+
+        int size() const { return m_keyCount; }
+        int capacity() const { return m_tableSize; }
+        bool isEmpty() const { return !m_keyCount; }
+
+        AddResult add(const ValueType& value) { return add<IdentityTranslatorType>(Extractor::extract(value), value); }
+
+        // A special version of add() that finds the object by hashing and comparing
+        // with some other type, to avoid the cost of type conversion if the object is already
+        // in the table.
+        template<typename HashTranslator, typename T, typename Extra> AddResult add(const T& key, const Extra&);
+        template<typename HashTranslator, typename T, typename Extra> AddResult addPassingHashCode(const T& key, const Extra&);
+
+        iterator find(const KeyType& key) { return find<IdentityTranslatorType>(key); }
+        const_iterator find(const KeyType& key) const { return find<IdentityTranslatorType>(key); }
+        bool contains(const KeyType& key) const { return contains<IdentityTranslatorType>(key); }
+
+        template<typename HashTranslator, typename T> iterator find(const T&);
+        template<typename HashTranslator, typename T> const_iterator find(const T&) const;
+        template<typename HashTranslator, typename T> bool contains(const T&) const;
+
+        void remove(const KeyType&);
+        void remove(iterator);
+        void removeWithoutEntryConsistencyCheck(iterator);
+        void removeWithoutEntryConsistencyCheck(const_iterator);
+        void clear();
+
+        static bool isEmptyBucket(const ValueType& value) { return isHashTraitsEmptyValue<KeyTraits>(Extractor::extract(value)); }
+        static bool isDeletedBucket(const ValueType& value) { return KeyTraits::isDeletedValue(Extractor::extract(value)); }
+        static bool isEmptyOrDeletedBucket(const ValueType& value) { return isEmptyBucket(value) || isDeletedBucket(value); }
+
+        ValueType* lookup(const Key& key) { return lookup<IdentityTranslatorType>(key); }
+        template<typename HashTranslator, typename T> ValueType* lookup(const T&);
+
+#if !ASSERT_DISABLED
+        void checkTableConsistency() const;
+#else
+        static void checkTableConsistency() { }
+#endif
+#if CHECK_HASHTABLE_CONSISTENCY
+        void internalCheckTableConsistency() const { checkTableConsistency(); }
+        void internalCheckTableConsistencyExceptSize() const { checkTableConsistencyExceptSize(); }
+#else
+        static void internalCheckTableConsistencyExceptSize() { }
+        static void internalCheckTableConsistency() { }
+#endif
+
+    private:
+        static ValueType* allocateTable(int size);
+        static void deallocateTable(ValueType* table, int size);
+
+        typedef std::pair<ValueType*, bool> LookupType;
+        typedef std::pair<LookupType, unsigned> FullLookupType;
+
+        LookupType lookupForWriting(const Key& key) { return lookupForWriting<IdentityTranslatorType>(key); };
+        template<typename HashTranslator, typename T> FullLookupType fullLookupForWriting(const T&);
+        template<typename HashTranslator, typename T> LookupType lookupForWriting(const T&);
+
+        template<typename HashTranslator, typename T> void checkKey(const T&);
+
+        void removeAndInvalidateWithoutEntryConsistencyCheck(ValueType*);
+        void removeAndInvalidate(ValueType*);
+        void remove(ValueType*);
+
+        bool shouldExpand() const { return (m_keyCount + m_deletedCount) * m_maxLoad >= m_tableSize; }
+        bool mustRehashInPlace() const { return m_keyCount * m_minLoad < m_tableSize * 2; }
+        bool shouldShrink() const { return m_keyCount * m_minLoad < m_tableSize && m_tableSize > KeyTraits::minimumTableSize; }
+        void expand();
+        void shrink() { rehash(m_tableSize / 2); }
+
+        void rehash(int newTableSize);
+        void reinsert(ValueType&);
+
+        static void initializeBucket(ValueType& bucket);
+        static void deleteBucket(ValueType& bucket) { bucket.~ValueType(); Traits::constructDeletedValue(bucket); }
+
+        FullLookupType makeLookupResult(ValueType* position, bool found, unsigned hash)
+            { return FullLookupType(LookupType(position, found), hash); }
+
+        iterator makeIterator(ValueType* pos) { return iterator(this, pos, m_table + m_tableSize); }
+        const_iterator makeConstIterator(ValueType* pos) const { return const_iterator(this, pos, m_table + m_tableSize); }
+        iterator makeKnownGoodIterator(ValueType* pos) { return iterator(this, pos, m_table + m_tableSize, HashItemKnownGood); }
+        const_iterator makeKnownGoodConstIterator(ValueType* pos) const { return const_iterator(this, pos, m_table + m_tableSize, HashItemKnownGood); }
+
+#if !ASSERT_DISABLED
+        void checkTableConsistencyExceptSize() const;
+#else
+        static void checkTableConsistencyExceptSize() { }
+#endif
+
+#if CHECK_HASHTABLE_ITERATORS
+        void invalidateIterators();
+#else
+        static void invalidateIterators() { }
+#endif
+
+        static const int m_maxLoad = 2;
+        static const int m_minLoad = 6;
+
+        ValueType* m_table;
+        int m_tableSize;
+        int m_tableSizeMask;
+        int m_keyCount;
+        int m_deletedCount;
+
+#if CHECK_HASHTABLE_ITERATORS
+    public:
+        // All access to m_iterators should be guarded with m_mutex.
+        mutable const_iterator* m_iterators;
+        // Use OwnPtr so HashTable can still be memmove'd or memcpy'ed.
+        mutable OwnPtr<Mutex> m_mutex;
+#endif
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+    public:
+        mutable OwnPtr<Stats> m_stats;
+#endif
+    };
+
+    // Set all the bits to one after the most significant bit: 00110101010 -> 00111111111.
+    template<unsigned size> struct OneifyLowBits;
+    template<>
+    struct OneifyLowBits<0> {
+        static const unsigned value = 0;
+    };
+    template<unsigned number>
+    struct OneifyLowBits {
+        static const unsigned value = number | OneifyLowBits<(number >> 1)>::value;
+    };
+    // Compute the first power of two integer that is an upper bound of the parameter 'number'.
+    template<unsigned number>
+    struct UpperPowerOfTwoBound {
+        static const unsigned value = (OneifyLowBits<number - 1>::value + 1) * 2;
+    };
+
+    // Because power of two numbers are the limit of maxLoad, their capacity is twice the
+    // UpperPowerOfTwoBound, or 4 times their values.
+    template<unsigned size, bool isPowerOfTwo> struct HashTableCapacityForSizeSplitter;
+    template<unsigned size>
+    struct HashTableCapacityForSizeSplitter<size, true> {
+        static const unsigned value = size * 4;
+    };
+    template<unsigned size>
+    struct HashTableCapacityForSizeSplitter<size, false> {
+        static const unsigned value = UpperPowerOfTwoBound<size>::value;
+    };
+
+    // HashTableCapacityForSize computes the upper power of two capacity to hold the size parameter.
+    // This is done at compile time to initialize the HashTraits.
+    template<unsigned size>
+    struct HashTableCapacityForSize {
+        static const unsigned value = HashTableCapacityForSizeSplitter<size, !(size & (size - 1))>::value;
+        COMPILE_ASSERT(size > 0, HashTableNonZeroMinimumCapacity);
+        COMPILE_ASSERT(!static_cast<int>(value >> 31), HashTableNoCapacityOverflow);
+        COMPILE_ASSERT(value > (2 * size), HashTableCapacityHoldsContentSize);
+    };
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    inline HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::HashTable()
+        : m_table(0)
+        , m_tableSize(0)
+        , m_tableSizeMask(0)
+        , m_keyCount(0)
+        , m_deletedCount(0)
+#if CHECK_HASHTABLE_ITERATORS
+        , m_iterators(0)
+        , m_mutex(adoptPtr(new Mutex))
+#endif
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+        , m_stats(adoptPtr(new Stats))
+#endif
+    {
+    }
+
+    inline unsigned doubleHash(unsigned key)
+    {
+        key = ~key + (key >> 23);
+        key ^= (key << 12);
+        key ^= (key >> 7);
+        key ^= (key << 2);
+        key ^= (key >> 20);
+        return key;
+    }
+
+#if ASSERT_DISABLED
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    template<typename HashTranslator, typename T>
+    inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::checkKey(const T&)
+    {
+    }
+
+#else
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    template<typename HashTranslator, typename T>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::checkKey(const T& key)
+    {
+        if (!HashFunctions::safeToCompareToEmptyOrDeleted)
+            return;
+        ASSERT(!HashTranslator::equal(KeyTraits::emptyValue(), key));
+        AlignedBuffer<sizeof(ValueType), WTF_ALIGN_OF(ValueType)> deletedValueBuffer;
+        ValueType* deletedValuePtr = reinterpret_cast_ptr<ValueType*>(deletedValueBuffer.buffer);
+        ValueType& deletedValue = *deletedValuePtr;
+        Traits::constructDeletedValue(deletedValue);
+        ASSERT(!HashTranslator::equal(Extractor::extract(deletedValue), key));
+    }
+
+#endif
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    template<typename HashTranslator, typename T>
+    inline Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::lookup(const T& key)
+    {
+        checkKey<HashTranslator>(key);
+
+        int k = 0;
+        int sizeMask = m_tableSizeMask;
+        ValueType* table = m_table;
+        unsigned h = HashTranslator::hash(key);
+        int i = h & sizeMask;
+
+        if (!table)
+            return 0;
+
+#if DUMP_HASHTABLE_STATS
+        atomicIncrement(&HashTableStats::numAccesses);
+        int probeCount = 0;
+#endif
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+        ++m_stats->numAccesses;
+        int perTableProbeCount = 0;
+#endif
+
+        while (1) {
+            ValueType* entry = table + i;
+                
+            // we count on the compiler to optimize out this branch
+            if (HashFunctions::safeToCompareToEmptyOrDeleted) {
+                if (HashTranslator::equal(Extractor::extract(*entry), key))
+                    return entry;
+                
+                if (isEmptyBucket(*entry))
+                    return 0;
+            } else {
+                if (isEmptyBucket(*entry))
+                    return 0;
+                
+                if (!isDeletedBucket(*entry) && HashTranslator::equal(Extractor::extract(*entry), key))
+                    return entry;
+            }
+#if DUMP_HASHTABLE_STATS
+            ++probeCount;
+            HashTableStats::recordCollisionAtCount(probeCount);
+#endif
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+            ++perTableProbeCount;
+            m_stats->recordCollisionAtCount(perTableProbeCount);
+#endif
+
+            if (k == 0)
+                k = 1 | doubleHash(h);
+            i = (i + k) & sizeMask;
+        }
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    template<typename HashTranslator, typename T>
+    inline typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::LookupType HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::lookupForWriting(const T& key)
+    {
+        ASSERT(m_table);
+        checkKey<HashTranslator>(key);
+
+        int k = 0;
+        ValueType* table = m_table;
+        int sizeMask = m_tableSizeMask;
+        unsigned h = HashTranslator::hash(key);
+        int i = h & sizeMask;
+
+#if DUMP_HASHTABLE_STATS
+        atomicIncrement(&HashTableStats::numAccesses);
+        int probeCount = 0;
+#endif
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+        ++m_stats->numAccesses;
+        int perTableProbeCount = 0;
+#endif
+
+        ValueType* deletedEntry = 0;
+
+        while (1) {
+            ValueType* entry = table + i;
+            
+            // we count on the compiler to optimize out this branch
+            if (HashFunctions::safeToCompareToEmptyOrDeleted) {
+                if (isEmptyBucket(*entry))
+                    return LookupType(deletedEntry ? deletedEntry : entry, false);
+                
+                if (HashTranslator::equal(Extractor::extract(*entry), key))
+                    return LookupType(entry, true);
+                
+                if (isDeletedBucket(*entry))
+                    deletedEntry = entry;
+            } else {
+                if (isEmptyBucket(*entry))
+                    return LookupType(deletedEntry ? deletedEntry : entry, false);
+            
+                if (isDeletedBucket(*entry))
+                    deletedEntry = entry;
+                else if (HashTranslator::equal(Extractor::extract(*entry), key))
+                    return LookupType(entry, true);
+            }
+#if DUMP_HASHTABLE_STATS
+            ++probeCount;
+            HashTableStats::recordCollisionAtCount(probeCount);
+#endif
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+            ++perTableProbeCount;
+            m_stats->recordCollisionAtCount(perTableProbeCount);
+#endif
+
+            if (k == 0)
+                k = 1 | doubleHash(h);
+            i = (i + k) & sizeMask;
+        }
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    template<typename HashTranslator, typename T>
+    inline typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::FullLookupType HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::fullLookupForWriting(const T& key)
+    {
+        ASSERT(m_table);
+        checkKey<HashTranslator>(key);
+
+        int k = 0;
+        ValueType* table = m_table;
+        int sizeMask = m_tableSizeMask;
+        unsigned h = HashTranslator::hash(key);
+        int i = h & sizeMask;
+
+#if DUMP_HASHTABLE_STATS
+        atomicIncrement(&HashTableStats::numAccesses);
+        int probeCount = 0;
+#endif
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+        ++m_stats->numAccesses;
+        int perTableProbeCount = 0;
+#endif
+
+        ValueType* deletedEntry = 0;
+
+        while (1) {
+            ValueType* entry = table + i;
+            
+            // we count on the compiler to optimize out this branch
+            if (HashFunctions::safeToCompareToEmptyOrDeleted) {
+                if (isEmptyBucket(*entry))
+                    return makeLookupResult(deletedEntry ? deletedEntry : entry, false, h);
+                
+                if (HashTranslator::equal(Extractor::extract(*entry), key))
+                    return makeLookupResult(entry, true, h);
+                
+                if (isDeletedBucket(*entry))
+                    deletedEntry = entry;
+            } else {
+                if (isEmptyBucket(*entry))
+                    return makeLookupResult(deletedEntry ? deletedEntry : entry, false, h);
+            
+                if (isDeletedBucket(*entry))
+                    deletedEntry = entry;
+                else if (HashTranslator::equal(Extractor::extract(*entry), key))
+                    return makeLookupResult(entry, true, h);
+            }
+#if DUMP_HASHTABLE_STATS
+            ++probeCount;
+            HashTableStats::recordCollisionAtCount(probeCount);
+#endif
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+            ++perTableProbeCount;
+            m_stats->recordCollisionAtCount(perTableProbeCount);
+#endif
+
+            if (k == 0)
+                k = 1 | doubleHash(h);
+            i = (i + k) & sizeMask;
+        }
+    }
+
+    template<bool emptyValueIsZero> struct HashTableBucketInitializer;
+
+    template<> struct HashTableBucketInitializer<false> {
+        template<typename Traits, typename Value> static void initialize(Value& bucket)
+        {
+            new (NotNull, &bucket) Value(Traits::emptyValue());
+        }
+    };
+
+    template<> struct HashTableBucketInitializer<true> {
+        template<typename Traits, typename Value> static void initialize(Value& bucket)
+        {
+            // This initializes the bucket without copying the empty value.
+            // That makes it possible to use this with types that don't support copying.
+            // The memset to 0 looks like a slow operation but is optimized by the compilers.
+            memset(&bucket, 0, sizeof(bucket));
+        }
+    };
+    
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::initializeBucket(ValueType& bucket)
+    {
+        HashTableBucketInitializer<Traits::emptyValueIsZero>::template initialize<Traits>(bucket);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    template<typename HashTranslator, typename T, typename Extra>
+    inline typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::AddResult HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::add(const T& key, const Extra& extra)
+    {
+        checkKey<HashTranslator>(key);
+
+        invalidateIterators();
+
+        if (!m_table)
+            expand();
+
+        internalCheckTableConsistency();
+
+        ASSERT(m_table);
+
+        int k = 0;
+        ValueType* table = m_table;
+        int sizeMask = m_tableSizeMask;
+        unsigned h = HashTranslator::hash(key);
+        int i = h & sizeMask;
+
+#if DUMP_HASHTABLE_STATS
+        atomicIncrement(&HashTableStats::numAccesses);
+        int probeCount = 0;
+#endif
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+        ++m_stats->numAccesses;
+        int perTableProbeCount = 0;
+#endif
+
+        ValueType* deletedEntry = 0;
+        ValueType* entry;
+        while (1) {
+            entry = table + i;
+            
+            // we count on the compiler to optimize out this branch
+            if (HashFunctions::safeToCompareToEmptyOrDeleted) {
+                if (isEmptyBucket(*entry))
+                    break;
+                
+                if (HashTranslator::equal(Extractor::extract(*entry), key))
+                    return AddResult(makeKnownGoodIterator(entry), false);
+                
+                if (isDeletedBucket(*entry))
+                    deletedEntry = entry;
+            } else {
+                if (isEmptyBucket(*entry))
+                    break;
+            
+                if (isDeletedBucket(*entry))
+                    deletedEntry = entry;
+                else if (HashTranslator::equal(Extractor::extract(*entry), key))
+                    return AddResult(makeKnownGoodIterator(entry), false);
+            }
+#if DUMP_HASHTABLE_STATS
+            ++probeCount;
+            HashTableStats::recordCollisionAtCount(probeCount);
+#endif
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+            ++perTableProbeCount;
+            m_stats->recordCollisionAtCount(perTableProbeCount);
+#endif
+
+            if (k == 0)
+                k = 1 | doubleHash(h);
+            i = (i + k) & sizeMask;
+        }
+
+        if (deletedEntry) {
+            initializeBucket(*deletedEntry);
+            entry = deletedEntry;
+            --m_deletedCount; 
+        }
+
+        HashTranslator::translate(*entry, key, extra);
+
+        ++m_keyCount;
+        
+        if (shouldExpand()) {
+            // FIXME: This makes an extra copy on expand. Probably not that bad since
+            // expand is rare, but would be better to have a version of expand that can
+            // follow a pivot entry and return the new position.
+            KeyType enteredKey = Extractor::extract(*entry);
+            expand();
+            AddResult result(find(enteredKey), true);
+            ASSERT(result.iterator != end());
+            return result;
+        }
+        
+        internalCheckTableConsistency();
+        
+        return AddResult(makeKnownGoodIterator(entry), true);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    template<typename HashTranslator, typename T, typename Extra>
+    inline typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::AddResult HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::addPassingHashCode(const T& key, const Extra& extra)
+    {
+        checkKey<HashTranslator>(key);
+
+        invalidateIterators();
+
+        if (!m_table)
+            expand();
+
+        internalCheckTableConsistency();
+
+        FullLookupType lookupResult = fullLookupForWriting<HashTranslator>(key);
+
+        ValueType* entry = lookupResult.first.first;
+        bool found = lookupResult.first.second;
+        unsigned h = lookupResult.second;
+        
+        if (found)
+            return AddResult(makeKnownGoodIterator(entry), false);
+        
+        if (isDeletedBucket(*entry)) {
+            initializeBucket(*entry);
+            --m_deletedCount;
+        }
+        
+        HashTranslator::translate(*entry, key, extra, h);
+        ++m_keyCount;
+        if (shouldExpand()) {
+            // FIXME: This makes an extra copy on expand. Probably not that bad since
+            // expand is rare, but would be better to have a version of expand that can
+            // follow a pivot entry and return the new position.
+            KeyType enteredKey = Extractor::extract(*entry);
+            expand();
+            AddResult result(find(enteredKey), true);
+            ASSERT(result.iterator != end());
+            return result;
+        }
+
+        internalCheckTableConsistency();
+
+        return AddResult(makeKnownGoodIterator(entry), true);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::reinsert(ValueType& entry)
+    {
+        ASSERT(m_table);
+        ASSERT(!lookupForWriting(Extractor::extract(entry)).second);
+        ASSERT(!isDeletedBucket(*(lookupForWriting(Extractor::extract(entry)).first)));
+#if DUMP_HASHTABLE_STATS
+        atomicIncrement(&HashTableStats::numReinserts);
+#endif
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+        ++m_stats->numReinserts;
+#endif
+
+        Mover<ValueType, Traits::needsDestruction>::move(entry, *lookupForWriting(Extractor::extract(entry)).first);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    template <typename HashTranslator, typename T> 
+    typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::find(const T& key)
+    {
+        if (!m_table)
+            return end();
+
+        ValueType* entry = lookup<HashTranslator>(key);
+        if (!entry)
+            return end();
+
+        return makeKnownGoodIterator(entry);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    template <typename HashTranslator, typename T> 
+    typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::const_iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::find(const T& key) const
+    {
+        if (!m_table)
+            return end();
+
+        ValueType* entry = const_cast<HashTable*>(this)->lookup<HashTranslator>(key);
+        if (!entry)
+            return end();
+
+        return makeKnownGoodConstIterator(entry);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    template <typename HashTranslator, typename T> 
+    bool HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::contains(const T& key) const
+    {
+        if (!m_table)
+            return false;
+
+        return const_cast<HashTable*>(this)->lookup<HashTranslator>(key);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::removeAndInvalidateWithoutEntryConsistencyCheck(ValueType* pos)
+    {
+        invalidateIterators();
+        remove(pos);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::removeAndInvalidate(ValueType* pos)
+    {
+        invalidateIterators();
+        internalCheckTableConsistency();
+        remove(pos);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::remove(ValueType* pos)
+    {
+#if DUMP_HASHTABLE_STATS
+        atomicIncrement(&HashTableStats::numRemoves);
+#endif
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+        ++m_stats->numRemoves;
+#endif
+
+        deleteBucket(*pos);
+        ++m_deletedCount;
+        --m_keyCount;
+
+        if (shouldShrink())
+            shrink();
+
+        internalCheckTableConsistency();
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::remove(iterator it)
+    {
+        if (it == end())
+            return;
+
+        removeAndInvalidate(const_cast<ValueType*>(it.m_iterator.m_position));
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::removeWithoutEntryConsistencyCheck(iterator it)
+    {
+        if (it == end())
+            return;
+
+        removeAndInvalidateWithoutEntryConsistencyCheck(const_cast<ValueType*>(it.m_iterator.m_position));
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::removeWithoutEntryConsistencyCheck(const_iterator it)
+    {
+        if (it == end())
+            return;
+
+        removeAndInvalidateWithoutEntryConsistencyCheck(const_cast<ValueType*>(it.m_position));
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    inline void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::remove(const KeyType& key)
+    {
+        remove(find(key));
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    Value* HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::allocateTable(int size)
+    {
+        // would use a template member function with explicit specializations here, but
+        // gcc doesn't appear to support that
+        if (Traits::emptyValueIsZero)
+            return static_cast<ValueType*>(fastZeroedMalloc(size * sizeof(ValueType)));
+        ValueType* result = static_cast<ValueType*>(fastMalloc(size * sizeof(ValueType)));
+        for (int i = 0; i < size; i++)
+            initializeBucket(result[i]);
+        return result;
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::deallocateTable(ValueType* table, int size)
+    {
+        if (Traits::needsDestruction) {
+            for (int i = 0; i < size; ++i) {
+                if (!isDeletedBucket(table[i]))
+                    table[i].~ValueType();
+            }
+        }
+        fastFree(table);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::expand()
+    {
+        int newSize;
+        if (m_tableSize == 0)
+            newSize = KeyTraits::minimumTableSize;
+        else if (mustRehashInPlace())
+            newSize = m_tableSize;
+        else
+            newSize = m_tableSize * 2;
+
+        rehash(newSize);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::rehash(int newTableSize)
+    {
+        internalCheckTableConsistencyExceptSize();
+
+        int oldTableSize = m_tableSize;
+        ValueType* oldTable = m_table;
+
+#if DUMP_HASHTABLE_STATS
+        if (oldTableSize != 0)
+            atomicIncrement(&HashTableStats::numRehashes);
+#endif
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+        if (oldTableSize != 0)
+            ++m_stats->numRehashes;
+#endif
+
+        m_tableSize = newTableSize;
+        m_tableSizeMask = newTableSize - 1;
+        m_table = allocateTable(newTableSize);
+
+        for (int i = 0; i != oldTableSize; ++i)
+            if (!isEmptyOrDeletedBucket(oldTable[i]))
+                reinsert(oldTable[i]);
+
+        m_deletedCount = 0;
+
+        deallocateTable(oldTable, oldTableSize);
+
+        internalCheckTableConsistency();
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::clear()
+    {
+        invalidateIterators();
+        if (!m_table)
+            return;
+
+        deallocateTable(m_table, m_tableSize);
+        m_table = 0;
+        m_tableSize = 0;
+        m_tableSizeMask = 0;
+        m_keyCount = 0;
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::HashTable(const HashTable& other)
+        : m_table(0)
+        , m_tableSize(0)
+        , m_tableSizeMask(0)
+        , m_keyCount(0)
+        , m_deletedCount(0)
+#if CHECK_HASHTABLE_ITERATORS
+        , m_iterators(0)
+        , m_mutex(adoptPtr(new Mutex))
+#endif
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+        , m_stats(adoptPtr(new Stats(*other.m_stats)))
+#endif
+    {
+        // Copy the hash table the dumb way, by adding each element to the new table.
+        // It might be more efficient to copy the table slots, but it's not clear that efficiency is needed.
+        const_iterator end = other.end();
+        for (const_iterator it = other.begin(); it != end; ++it)
+            add(*it);
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::swap(HashTable& other)
+    {
+        invalidateIterators();
+        other.invalidateIterators();
+
+        ValueType* tmp_table = m_table;
+        m_table = other.m_table;
+        other.m_table = tmp_table;
+
+        int tmp_tableSize = m_tableSize;
+        m_tableSize = other.m_tableSize;
+        other.m_tableSize = tmp_tableSize;
+
+        int tmp_tableSizeMask = m_tableSizeMask;
+        m_tableSizeMask = other.m_tableSizeMask;
+        other.m_tableSizeMask = tmp_tableSizeMask;
+
+        int tmp_keyCount = m_keyCount;
+        m_keyCount = other.m_keyCount;
+        other.m_keyCount = tmp_keyCount;
+
+        int tmp_deletedCount = m_deletedCount;
+        m_deletedCount = other.m_deletedCount;
+        other.m_deletedCount = tmp_deletedCount;
+
+#if DUMP_HASHTABLE_STATS_PER_TABLE
+        m_stats.swap(other.m_stats);
+#endif
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>& HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::operator=(const HashTable& other)
+    {
+        HashTable tmp(other);
+        swap(tmp);
+        return *this;
+    }
+
+#if !ASSERT_DISABLED
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::checkTableConsistency() const
+    {
+        checkTableConsistencyExceptSize();
+        ASSERT(!m_table || !shouldExpand());
+        ASSERT(!shouldShrink());
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::checkTableConsistencyExceptSize() const
+    {
+        if (!m_table)
+            return;
+
+        int count = 0;
+        int deletedCount = 0;
+        for (int j = 0; j < m_tableSize; ++j) {
+            ValueType* entry = m_table + j;
+            if (isEmptyBucket(*entry))
+                continue;
+
+            if (isDeletedBucket(*entry)) {
+                ++deletedCount;
+                continue;
+            }
+
+            const_iterator it = find(Extractor::extract(*entry));
+            ASSERT(entry == it.m_position);
+            ++count;
+
+            ValueCheck<Key>::checkConsistency(it->key);
+        }
+
+        ASSERT(count == m_keyCount);
+        ASSERT(deletedCount == m_deletedCount);
+        ASSERT(m_tableSize >= KeyTraits::minimumTableSize);
+        ASSERT(m_tableSizeMask);
+        ASSERT(m_tableSize == m_tableSizeMask + 1);
+    }
+
+#endif // ASSERT_DISABLED
+
+#if CHECK_HASHTABLE_ITERATORS
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::invalidateIterators()
+    {
+        MutexLocker lock(*m_mutex);
+        const_iterator* next;
+        for (const_iterator* p = m_iterators; p; p = next) {
+            next = p->m_next;
+            p->m_table = 0;
+            p->m_next = 0;
+            p->m_previous = 0;
+        }
+        m_iterators = 0;
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void addIterator(const HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>* table,
+        HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>* it)
+    {
+        it->m_table = table;
+        it->m_previous = 0;
+
+        // Insert iterator at head of doubly-linked list of iterators.
+        if (!table) {
+            it->m_next = 0;
+        } else {
+            MutexLocker lock(*table->m_mutex);
+            ASSERT(table->m_iterators != it);
+            it->m_next = table->m_iterators;
+            table->m_iterators = it;
+            if (it->m_next) {
+                ASSERT(!it->m_next->m_previous);
+                it->m_next->m_previous = it;
+            }
+        }
+    }
+
+    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
+    void removeIterator(HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>* it)
+    {
+        typedef HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> HashTableType;
+        typedef HashTableConstIterator<Key, Value, Extractor, HashFunctions, Traits, KeyTraits> const_iterator;
+
+        // Delete iterator from doubly-linked list of iterators.
+        if (!it->m_table) {
+            ASSERT(!it->m_next);
+            ASSERT(!it->m_previous);
+        } else {
+            MutexLocker lock(*it->m_table->m_mutex);
+            if (it->m_next) {
+                ASSERT(it->m_next->m_previous == it);
+                it->m_next->m_previous = it->m_previous;
+            }
+            if (it->m_previous) {
+                ASSERT(it->m_table->m_iterators != it);
+                ASSERT(it->m_previous->m_next == it);
+                it->m_previous->m_next = it->m_next;
+            } else {
+                ASSERT(it->m_table->m_iterators == it);
+                it->m_table->m_iterators = it->m_next;
+            }
+        }
+
+        it->m_table = 0;
+        it->m_next = 0;
+        it->m_previous = 0;
+    }
+
+#endif // CHECK_HASHTABLE_ITERATORS
+
+    // iterator adapters
+
+    template<typename HashTableType, typename ValueType> struct HashTableConstIteratorAdapter {
+        HashTableConstIteratorAdapter() {}
+        HashTableConstIteratorAdapter(const typename HashTableType::const_iterator& impl) : m_impl(impl) {}
+
+        const ValueType* get() const { return (const ValueType*)m_impl.get(); }
+        const ValueType& operator*() const { return *get(); }
+        const ValueType* operator->() const { return get(); }
+
+        HashTableConstIteratorAdapter& operator++() { ++m_impl; return *this; }
+        // postfix ++ intentionally omitted
+
+        typename HashTableType::const_iterator m_impl;
+    };
+
+    template<typename HashTableType, typename ValueType> struct HashTableIteratorAdapter {
+        HashTableIteratorAdapter() {}
+        HashTableIteratorAdapter(const typename HashTableType::iterator& impl) : m_impl(impl) {}
+
+        ValueType* get() const { return (ValueType*)m_impl.get(); }
+        ValueType& operator*() const { return *get(); }
+        ValueType* operator->() const { return get(); }
+
+        HashTableIteratorAdapter& operator++() { ++m_impl; return *this; }
+        // postfix ++ intentionally omitted
+
+        operator HashTableConstIteratorAdapter<HashTableType, ValueType>() {
+            typename HashTableType::const_iterator i = m_impl;
+            return i;
+        }
+
+        typename HashTableType::iterator m_impl;
+    };
+
+    template<typename T, typename U>
+    inline bool operator==(const HashTableConstIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
+    {
+        return a.m_impl == b.m_impl;
+    }
+
+    template<typename T, typename U>
+    inline bool operator!=(const HashTableConstIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
+    {
+        return a.m_impl != b.m_impl;
+    }
+
+    template<typename T, typename U>
+    inline bool operator==(const HashTableIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
+    {
+        return a.m_impl == b.m_impl;
+    }
+
+    template<typename T, typename U>
+    inline bool operator!=(const HashTableIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
+    {
+        return a.m_impl != b.m_impl;
+    }
+
+    // All 4 combinations of ==, != and Const,non const.
+    template<typename T, typename U>
+    inline bool operator==(const HashTableConstIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
+    {
+        return a.m_impl == b.m_impl;
+    }
+
+    template<typename T, typename U>
+    inline bool operator!=(const HashTableConstIteratorAdapter<T, U>& a, const HashTableIteratorAdapter<T, U>& b)
+    {
+        return a.m_impl != b.m_impl;
+    }
+
+    template<typename T, typename U>
+    inline bool operator==(const HashTableIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
+    {
+        return a.m_impl == b.m_impl;
+    }
+
+    template<typename T, typename U>
+    inline bool operator!=(const HashTableIteratorAdapter<T, U>& a, const HashTableConstIteratorAdapter<T, U>& b)
+    {
+        return a.m_impl != b.m_impl;
+    }
+
+} // namespace WTF
+
+#include <wtf/HashIterators.h>
+
+#endif // WTF_HashTable_h
diff --git a/Source/WTF/wtf/HashTraits.h b/Source/WTF/wtf/HashTraits.h
new file mode 100644
index 0000000..8803408
--- /dev/null
+++ b/Source/WTF/wtf/HashTraits.h
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 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_HashTraits_h
+#define WTF_HashTraits_h
+
+#include <wtf/HashFunctions.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/TypeTraits.h>
+#include <utility>
+#include <limits>
+
+namespace WTF {
+
+    class String;
+
+    template<typename T> class OwnPtr;
+    template<typename T> class PassOwnPtr;
+
+    template<typename T> struct HashTraits;
+
+    template<bool isInteger, typename T> struct GenericHashTraitsBase;
+
+    template<typename T> struct GenericHashTraitsBase<false, T> {
+        // The emptyValueIsZero flag is used to optimize allocation of empty hash tables with zeroed memory.
+        static const bool emptyValueIsZero = false;
+        
+        // The hasIsEmptyValueFunction flag allows the hash table to automatically generate code to check
+        // for the empty value when it can be done with the equality operator, but allows custom functions
+        // for cases like String that need them.
+        static const bool hasIsEmptyValueFunction = false;
+
+        // The needsDestruction flag is used to optimize destruction and rehashing.
+        static const bool needsDestruction = true;
+
+        // The starting table size. Can be overridden when we know beforehand that
+        // a hash table will have at least N entries.
+        static const int minimumTableSize = 8;
+    };
+
+    // Default integer traits disallow both 0 and -1 as keys (max value instead of -1 for unsigned).
+    template<typename T> struct GenericHashTraitsBase<true, T> : GenericHashTraitsBase<false, T> {
+        static const bool emptyValueIsZero = true;
+        static const bool needsDestruction = false;
+        static void constructDeletedValue(T& slot) { slot = static_cast<T>(-1); }
+        static bool isDeletedValue(T value) { return value == static_cast<T>(-1); }
+    };
+
+    template<typename T> struct GenericHashTraits : GenericHashTraitsBase<IsInteger<T>::value, T> {
+        typedef T TraitType;
+        typedef T EmptyValueType;
+
+        static T emptyValue() { return T(); }
+
+        // Type for functions that take ownership, such as add.
+        // The store function either not be called or called once to store something passed in.
+        // The value passed to the store function will be either PassInType or PassInType&.
+        typedef const T& PassInType;
+        static void store(const T& value, T& storage) { storage = value; }
+
+        // Type for return value of functions that transfer ownership, such as take. 
+        typedef T PassOutType;
+        static PassOutType passOut(const T& value) { return value; }
+
+        // Type for return value of functions that do not transfer ownership, such as get.
+        // FIXME: We could change this type to const T& for better performance if we figured out
+        // a way to handle the return value from emptyValue, which is a temporary.
+        typedef T PeekType;
+        static PeekType peek(const T& value) { return value; }
+    };
+
+    template<typename T> struct HashTraits : GenericHashTraits<T> { };
+
+    template<typename T> struct FloatHashTraits : GenericHashTraits<T> {
+        static const bool needsDestruction = false;
+        static T emptyValue() { return std::numeric_limits<T>::infinity(); }
+        static void constructDeletedValue(T& slot) { slot = -std::numeric_limits<T>::infinity(); }
+        static bool isDeletedValue(T value) { return value == -std::numeric_limits<T>::infinity(); }
+    };
+
+    template<> struct HashTraits<float> : FloatHashTraits<float> { };
+    template<> struct HashTraits<double> : FloatHashTraits<double> { };
+
+    // Default unsigned traits disallow both 0 and max as keys -- use these traits to allow zero and disallow max - 1.
+    template<typename T> struct UnsignedWithZeroKeyHashTraits : GenericHashTraits<T> {
+        static const bool emptyValueIsZero = false;
+        static const bool needsDestruction = false;
+        static T emptyValue() { return std::numeric_limits<T>::max(); }
+        static void constructDeletedValue(T& slot) { slot = std::numeric_limits<T>::max() - 1; }
+        static bool isDeletedValue(T value) { return value == std::numeric_limits<T>::max() - 1; }
+    };
+
+    template<typename P> struct HashTraits<P*> : GenericHashTraits<P*> {
+        static const bool emptyValueIsZero = true;
+        static const bool needsDestruction = false;
+        static void constructDeletedValue(P*& slot) { slot = reinterpret_cast<P*>(-1); }
+        static bool isDeletedValue(P* value) { return value == reinterpret_cast<P*>(-1); }
+    };
+
+    template<typename T> struct SimpleClassHashTraits : GenericHashTraits<T> {
+        static const bool emptyValueIsZero = true;
+        static void constructDeletedValue(T& slot) { new (NotNull, &slot) T(HashTableDeletedValue); }
+        static bool isDeletedValue(const T& value) { return value.isHashTableDeletedValue(); }
+    };
+
+    template<typename P> struct HashTraits<OwnPtr<P> > : SimpleClassHashTraits<OwnPtr<P> > {
+        typedef std::nullptr_t EmptyValueType;
+
+        static EmptyValueType emptyValue() { return nullptr; }
+
+        typedef PassOwnPtr<P> PassInType;
+        static void store(PassOwnPtr<P> value, OwnPtr<P>& storage) { storage = value; }
+
+        typedef PassOwnPtr<P> PassOutType;
+        static PassOwnPtr<P> passOut(OwnPtr<P>& value) { return value.release(); }
+        static PassOwnPtr<P> passOut(std::nullptr_t) { return nullptr; }
+
+        typedef typename OwnPtr<P>::PtrType PeekType;
+        static PeekType peek(const OwnPtr<P>& value) { return value.get(); }
+        static PeekType peek(std::nullptr_t) { return 0; }
+    };
+
+    template<typename P> struct HashTraits<RefPtr<P> > : SimpleClassHashTraits<RefPtr<P> > {
+        typedef PassRefPtr<P> PassInType;
+        static void store(PassRefPtr<P> value, RefPtr<P>& storage) { storage = value; }
+
+        // FIXME: We should change PassOutType to PassRefPtr for better performance.
+        // FIXME: We should consider changing PeekType to a raw pointer for better performance,
+        // but then callers won't need to call get; doing so will require updating many call sites.
+    };
+
+    template<> struct HashTraits<String> : SimpleClassHashTraits<String> {
+        static const bool hasIsEmptyValueFunction = true;
+        static bool isEmptyValue(const String&);
+    };
+
+    // This struct template is an implementation detail of the isHashTraitsEmptyValue function,
+    // which selects either the emptyValue function or the isEmptyValue function to check for empty values.
+    template<typename Traits, bool hasEmptyValueFunction> struct HashTraitsEmptyValueChecker;
+    template<typename Traits> struct HashTraitsEmptyValueChecker<Traits, true> {
+        template<typename T> static bool isEmptyValue(const T& value) { return Traits::isEmptyValue(value); }
+    };
+    template<typename Traits> struct HashTraitsEmptyValueChecker<Traits, false> {
+        template<typename T> static bool isEmptyValue(const T& value) { return value == Traits::emptyValue(); }
+    };
+    template<typename Traits, typename T> inline bool isHashTraitsEmptyValue(const T& value)
+    {
+        return HashTraitsEmptyValueChecker<Traits, Traits::hasIsEmptyValueFunction>::isEmptyValue(value);
+    }
+
+    template<typename FirstTraitsArg, typename SecondTraitsArg>
+    struct PairHashTraits : GenericHashTraits<std::pair<typename FirstTraitsArg::TraitType, typename SecondTraitsArg::TraitType> > {
+        typedef FirstTraitsArg FirstTraits;
+        typedef SecondTraitsArg SecondTraits;
+        typedef std::pair<typename FirstTraits::TraitType, typename SecondTraits::TraitType> TraitType;
+        typedef std::pair<typename FirstTraits::EmptyValueType, typename SecondTraits::EmptyValueType> EmptyValueType;
+
+        static const bool emptyValueIsZero = FirstTraits::emptyValueIsZero && SecondTraits::emptyValueIsZero;
+        static EmptyValueType emptyValue() { return std::make_pair(FirstTraits::emptyValue(), SecondTraits::emptyValue()); }
+
+        static const bool needsDestruction = FirstTraits::needsDestruction || SecondTraits::needsDestruction;
+
+        static const int minimumTableSize = FirstTraits::minimumTableSize;
+
+        static void constructDeletedValue(TraitType& slot) { FirstTraits::constructDeletedValue(slot.first); }
+        static bool isDeletedValue(const TraitType& value) { return FirstTraits::isDeletedValue(value.first); }
+    };
+
+    template<typename First, typename Second>
+    struct HashTraits<std::pair<First, Second> > : public PairHashTraits<HashTraits<First>, HashTraits<Second> > { };
+
+    template<typename KeyTypeArg, typename ValueTypeArg>
+    struct KeyValuePair {
+        typedef KeyTypeArg KeyType;
+
+        KeyValuePair()
+        {
+        }
+
+        KeyValuePair(const KeyTypeArg& key, const ValueTypeArg& value)
+            : key(key)
+            , value(value)
+        {
+        }
+
+        template <typename OtherKeyType, typename OtherValueType>
+        KeyValuePair(const KeyValuePair<OtherKeyType, OtherValueType>& other)
+            : key(other.key)
+            , value(other.value)
+        {
+        }
+
+        KeyTypeArg key;
+        ValueTypeArg value;
+    };
+
+    template<typename KeyTraitsArg, typename ValueTraitsArg>
+    struct KeyValuePairHashTraits : GenericHashTraits<KeyValuePair<typename KeyTraitsArg::TraitType, typename ValueTraitsArg::TraitType> > {
+        typedef KeyTraitsArg KeyTraits;
+        typedef ValueTraitsArg ValueTraits;
+        typedef KeyValuePair<typename KeyTraits::TraitType, typename ValueTraits::TraitType> TraitType;
+        typedef KeyValuePair<typename KeyTraits::EmptyValueType, typename ValueTraits::EmptyValueType> EmptyValueType;
+
+        static const bool emptyValueIsZero = KeyTraits::emptyValueIsZero && ValueTraits::emptyValueIsZero;
+        static EmptyValueType emptyValue() { return KeyValuePair<typename KeyTraits::EmptyValueType, typename ValueTraits::EmptyValueType>(KeyTraits::emptyValue(), ValueTraits::emptyValue()); }
+
+        static const bool needsDestruction = KeyTraits::needsDestruction || ValueTraits::needsDestruction;
+
+        static const int minimumTableSize = KeyTraits::minimumTableSize;
+
+        static void constructDeletedValue(TraitType& slot) { KeyTraits::constructDeletedValue(slot.key); }
+        static bool isDeletedValue(const TraitType& value) { return KeyTraits::isDeletedValue(value.key); }
+    };
+
+    template<typename Key, typename Value>
+    struct HashTraits<KeyValuePair<Key, Value> > : public KeyValuePairHashTraits<HashTraits<Key>, HashTraits<Value> > { };
+
+    template<typename T>
+    struct NullableHashTraits : public HashTraits<T> {
+        static const bool emptyValueIsZero = false;
+        static T emptyValue() { return reinterpret_cast<T>(1); }
+    };
+
+} // namespace WTF
+
+using WTF::HashTraits;
+using WTF::PairHashTraits;
+using WTF::NullableHashTraits;
+
+#endif // WTF_HashTraits_h
diff --git a/Source/WTF/wtf/HexNumber.h b/Source/WTF/wtf/HexNumber.h
new file mode 100644
index 0000000..a198b92
--- /dev/null
+++ b/Source/WTF/wtf/HexNumber.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2011 Research In Motion Limited. 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 HexNumber_h
+#define HexNumber_h
+
+#include <wtf/text/StringConcatenate.h>
+
+namespace WTF {
+
+enum HexConversionMode {
+    Lowercase,
+    Uppercase
+};
+
+namespace Internal {
+
+const char lowerHexDigits[17] = "0123456789abcdef";
+const char upperHexDigits[17] = "0123456789ABCDEF";
+inline const char* hexDigitsForMode(HexConversionMode mode)
+{
+    return mode == Lowercase ? lowerHexDigits : upperHexDigits;
+}
+
+}; // namespace Internal
+
+template<typename T>
+inline void appendByteAsHex(unsigned char byte, T& destination, HexConversionMode mode = Uppercase)
+{
+    const char* hexDigits = Internal::hexDigitsForMode(mode);
+    destination.append(hexDigits[byte >> 4]);
+    destination.append(hexDigits[byte & 0xF]);
+}
+
+template<typename T>
+inline void placeByteAsHexCompressIfPossible(unsigned char byte, T& destination, unsigned& index, HexConversionMode mode = Uppercase)
+{
+    const char* hexDigits = Internal::hexDigitsForMode(mode);
+    if (byte >= 0x10)
+        destination[index++] = hexDigits[byte >> 4];
+    destination[index++] = hexDigits[byte & 0xF];
+}
+
+template<typename T>
+inline void placeByteAsHex(unsigned char byte, T& destination, HexConversionMode mode = Uppercase)
+{
+    const char* hexDigits = Internal::hexDigitsForMode(mode);
+    *destination++ = hexDigits[byte >> 4];
+    *destination++ = hexDigits[byte & 0xF];
+}
+
+template<typename T>
+inline void appendUnsignedAsHex(unsigned number, T& destination, HexConversionMode mode = Uppercase)
+{
+    const char* hexDigits = Internal::hexDigitsForMode(mode);
+    Vector<UChar, 8> result;
+    do {
+        result.prepend(hexDigits[number % 16]);
+        number >>= 4;
+    } while (number > 0);
+
+    destination.append(result.data(), result.size());
+}
+
+// Same as appendUnsignedAsHex, but using exactly 'desiredDigits' for the conversion.
+template<typename T>
+inline void appendUnsignedAsHexFixedSize(unsigned number, T& destination, unsigned desiredDigits, HexConversionMode mode = Uppercase)
+{
+    ASSERT(desiredDigits);
+
+    const char* hexDigits = Internal::hexDigitsForMode(mode);
+    Vector<UChar, 8> result;
+    do {
+        result.prepend(hexDigits[number % 16]);
+        number >>= 4;
+    } while (result.size() < desiredDigits);
+
+    ASSERT(result.size() == desiredDigits);
+    destination.append(result.data(), result.size());
+}
+
+} // namespace WTF
+
+using WTF::appendByteAsHex;
+using WTF::appendUnsignedAsHex;
+using WTF::appendUnsignedAsHexFixedSize;
+using WTF::placeByteAsHex;
+using WTF::placeByteAsHexCompressIfPossible;
+using WTF::Lowercase;
+
+#endif // HexNumber_h
diff --git a/Source/WTF/wtf/InlineASM.h b/Source/WTF/wtf/InlineASM.h
new file mode 100644
index 0000000..37069a7
--- /dev/null
+++ b/Source/WTF/wtf/InlineASM.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2011 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. ``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
+ * 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 InlineASM_h
+#define InlineASM_h
+
+#include <wtf/Platform.h>
+
+/* asm directive helpers */ 
+
+#if OS(DARWIN) || (OS(WINDOWS) && CPU(X86))
+#define SYMBOL_STRING(name) "_" #name
+#else
+#define SYMBOL_STRING(name) #name
+#endif
+
+#if OS(IOS)
+#define THUMB_FUNC_PARAM(name) SYMBOL_STRING(name)
+#else
+#define THUMB_FUNC_PARAM(name)
+#endif
+
+#if (OS(LINUX) || OS(FREEBSD)) && CPU(X86_64)
+#define GLOBAL_REFERENCE(name) #name "@plt"
+#elif CPU(X86) && COMPILER(MINGW)
+#define GLOBAL_REFERENCE(name) "@" #name "@4"
+#else
+#define GLOBAL_REFERENCE(name) SYMBOL_STRING(name)
+#endif
+
+#if HAVE(INTERNAL_VISIBILITY)
+#define LOCAL_REFERENCE(name) SYMBOL_STRING(name)
+#else
+#define LOCAL_REFERENCE(name) GLOBAL_REFERENCE(name)
+#endif
+
+#if OS(DARWIN)
+    // Mach-O platform
+#define HIDE_SYMBOL(name) ".private_extern _" #name
+#elif OS(AIX)
+    // IBM's own file format
+#define HIDE_SYMBOL(name) ".lglobl " #name
+#elif   OS(LINUX)               \
+     || OS(FREEBSD)             \
+     || OS(OPENBSD)             \
+     || OS(SOLARIS)             \
+     || (OS(HPUX) && CPU(IA64)) \
+     || OS(NETBSD)
+    // ELF platform
+#define HIDE_SYMBOL(name) ".hidden " #name
+#else
+#define HIDE_SYMBOL(name)
+#endif
+
+// FIXME: figure out how this works on all the platforms. I know that
+// on ELF, the preferred form is ".Lstuff" as opposed to "Lstuff".
+// Don't know about any of the others.
+#if PLATFORM(MAC)
+#define LOCAL_LABEL_STRING(name) "L" #name
+#elif   OS(LINUX)               \
+     || OS(FREEBSD)             \
+     || OS(OPENBSD)             \
+     || OS(NETBSD)              \
+     || OS(QNX)
+    // GNU as-compatible syntax.
+#define LOCAL_LABEL_STRING(name) ".L" #name
+#endif
+
+#if (CPU(ARM_TRADITIONAL) && (defined(thumb2) || defined(__thumb2__) || defined(__thumb) || defined(__thumb__))) || CPU(ARM_THUMB2)
+#define INLINE_ARM_FUNCTION(name) ".thumb" "\n" ".thumb_func " THUMB_FUNC_PARAM(name) "\n"
+#else
+#define INLINE_ARM_FUNCTION(name)
+#endif
+
+#endif // InlineASM_h
diff --git a/Source/WTF/wtf/Int16Array.h b/Source/WTF/wtf/Int16Array.h
new file mode 100644
index 0000000..be98583
--- /dev/null
+++ b/Source/WTF/wtf/Int16Array.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 Int16Array_h
+#define Int16Array_h
+
+#include <wtf/IntegralTypedArrayBase.h>
+
+namespace WTF {
+
+class ArrayBuffer;
+
+class Int16Array : public IntegralTypedArrayBase<short> {
+public:
+    static inline PassRefPtr<Int16Array> create(unsigned length);
+    static inline PassRefPtr<Int16Array> create(const short* array, unsigned length);
+    static inline PassRefPtr<Int16Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+
+    // Should only be used when it is known the entire array will be filled. Do
+    // not return these results directly to JavaScript without filling first.
+    static inline PassRefPtr<Int16Array> createUninitialized(unsigned length);
+
+    // Can’t use "using" here due to a bug in the RVCT compiler.
+    bool set(TypedArrayBase<short>* array, unsigned offset) { return TypedArrayBase<short>::set(array, offset); }
+    void set(unsigned index, double value) { IntegralTypedArrayBase<short>::set(index, value); }
+
+    inline PassRefPtr<Int16Array> subarray(int start) const;
+    inline PassRefPtr<Int16Array> subarray(int start, int end) const;
+
+    virtual ViewType getType() const
+    {
+        return TypeInt16;
+    }
+
+private:
+    inline Int16Array(PassRefPtr<ArrayBuffer>,
+                    unsigned byteOffset,
+                    unsigned length);
+    // Make constructor visible to superclass.
+    friend class TypedArrayBase<short>;
+};
+
+PassRefPtr<Int16Array> Int16Array::create(unsigned length)
+{
+    return TypedArrayBase<short>::create<Int16Array>(length);
+}
+
+PassRefPtr<Int16Array> Int16Array::create(const short* array, unsigned length)
+{
+    return TypedArrayBase<short>::create<Int16Array>(array, length);
+}
+
+PassRefPtr<Int16Array> Int16Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+{
+    return TypedArrayBase<short>::create<Int16Array>(buffer, byteOffset, length);
+}
+
+PassRefPtr<Int16Array> Int16Array::createUninitialized(unsigned length)
+{
+    return TypedArrayBase<short>::createUninitialized<Int16Array>(length);
+}
+
+Int16Array::Int16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+    : IntegralTypedArrayBase<short>(buffer, byteOffset, length)
+{
+}
+
+PassRefPtr<Int16Array> Int16Array::subarray(int start) const
+{
+    return subarray(start, length());
+}
+
+PassRefPtr<Int16Array> Int16Array::subarray(int start, int end) const
+{
+    return subarrayImpl<Int16Array>(start, end);
+}
+
+} // namespace WTF
+
+using WTF::Int16Array;
+
+#endif // Int16Array_h
diff --git a/Source/WTF/wtf/Int32Array.h b/Source/WTF/wtf/Int32Array.h
new file mode 100644
index 0000000..99bce1a
--- /dev/null
+++ b/Source/WTF/wtf/Int32Array.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 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:
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 Int32Array_h
+#define Int32Array_h
+
+#include <wtf/IntegralTypedArrayBase.h>
+
+namespace WTF {
+
+class Int32Array : public IntegralTypedArrayBase<int> {
+public:
+    static inline PassRefPtr<Int32Array> create(unsigned length);
+    static inline PassRefPtr<Int32Array> create(const int* array, unsigned length);
+    static inline PassRefPtr<Int32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+
+    // Should only be used when it is known the entire array will be filled. Do
+    // not return these results directly to JavaScript without filling first.
+    static inline PassRefPtr<Int32Array> createUninitialized(unsigned length);
+
+    // Can’t use "using" here due to a bug in the RVCT compiler.
+    bool set(TypedArrayBase<int>* array, unsigned offset) { return TypedArrayBase<int>::set(array, offset); }
+    void set(unsigned index, double value) { IntegralTypedArrayBase<int>::set(index, value); }
+
+    inline PassRefPtr<Int32Array> subarray(int start) const;
+    inline PassRefPtr<Int32Array> subarray(int start, int end) const;
+
+    virtual ViewType getType() const
+    {
+        return TypeInt32;
+    }
+
+private:
+    inline Int32Array(PassRefPtr<ArrayBuffer>,
+                  unsigned byteOffset,
+                  unsigned length);
+    // Make constructor visible to superclass.
+    friend class TypedArrayBase<int>;
+};
+
+PassRefPtr<Int32Array> Int32Array::create(unsigned length)
+{
+    return TypedArrayBase<int>::create<Int32Array>(length);
+}
+
+PassRefPtr<Int32Array> Int32Array::create(const int* array, unsigned length)
+{
+    return TypedArrayBase<int>::create<Int32Array>(array, length);
+}
+
+PassRefPtr<Int32Array> Int32Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+{
+    return TypedArrayBase<int>::create<Int32Array>(buffer, byteOffset, length);
+}
+
+PassRefPtr<Int32Array> Int32Array::createUninitialized(unsigned length)
+{
+    return TypedArrayBase<int>::createUninitialized<Int32Array>(length);
+}
+
+Int32Array::Int32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+    : IntegralTypedArrayBase<int>(buffer, byteOffset, length)
+{
+}
+
+PassRefPtr<Int32Array> Int32Array::subarray(int start) const
+{
+    return subarray(start, length());
+}
+
+PassRefPtr<Int32Array> Int32Array::subarray(int start, int end) const
+{
+    return subarrayImpl<Int32Array>(start, end);
+}
+
+} // namespace WTF
+
+using WTF::Int32Array;
+
+#endif // Int32Array_h
diff --git a/Source/WTF/wtf/Int8Array.h b/Source/WTF/wtf/Int8Array.h
new file mode 100644
index 0000000..bb3e37e
--- /dev/null
+++ b/Source/WTF/wtf/Int8Array.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 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:
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 Int8Array_h
+#define Int8Array_h
+
+#include <wtf/IntegralTypedArrayBase.h>
+
+namespace WTF {
+
+class ArrayBuffer;
+
+class Int8Array : public IntegralTypedArrayBase<signed char> {
+public:
+    static inline PassRefPtr<Int8Array> create(unsigned length);
+    static inline PassRefPtr<Int8Array> create(const signed char* array, unsigned length);
+    static inline PassRefPtr<Int8Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+
+    // Should only be used when it is known the entire array will be filled. Do
+    // not return these results directly to JavaScript without filling first.
+    static inline PassRefPtr<Int8Array> createUninitialized(unsigned length);
+
+    // Can’t use "using" here due to a bug in the RVCT compiler.
+    bool set(TypedArrayBase<signed char>* array, unsigned offset) { return TypedArrayBase<signed char>::set(array, offset); }
+    void set(unsigned index, double value) { IntegralTypedArrayBase<signed char>::set(index, value); }
+
+    inline PassRefPtr<Int8Array> subarray(int start) const;
+    inline PassRefPtr<Int8Array> subarray(int start, int end) const;
+
+    virtual ViewType getType() const
+    {
+        return TypeInt8;
+    }
+
+private:
+    inline Int8Array(PassRefPtr<ArrayBuffer>,
+                   unsigned byteOffset,
+                   unsigned length);
+    // Make constructor visible to superclass.
+    friend class TypedArrayBase<signed char>;
+};
+
+PassRefPtr<Int8Array> Int8Array::create(unsigned length)
+{
+    return TypedArrayBase<signed char>::create<Int8Array>(length);
+}
+
+PassRefPtr<Int8Array> Int8Array::create(const signed char* array, unsigned length)
+{
+    return TypedArrayBase<signed char>::create<Int8Array>(array, length);
+}
+
+PassRefPtr<Int8Array> Int8Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+{
+    return TypedArrayBase<signed char>::create<Int8Array>(buffer, byteOffset, length);
+}
+
+PassRefPtr<Int8Array> Int8Array::createUninitialized(unsigned length)
+{
+    return TypedArrayBase<signed char>::createUninitialized<Int8Array>(length);
+}
+
+Int8Array::Int8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+    : IntegralTypedArrayBase<signed char>(buffer, byteOffset, length)
+{
+}
+
+PassRefPtr<Int8Array> Int8Array::subarray(int start) const
+{
+    return subarray(start, length());
+}
+
+PassRefPtr<Int8Array> Int8Array::subarray(int start, int end) const
+{
+    return subarrayImpl<Int8Array>(start, end);
+}
+
+} // namespace WTF
+
+using WTF::Int8Array;
+
+#endif // Int8Array_h
diff --git a/Source/WTF/wtf/IntegralTypedArrayBase.h b/Source/WTF/wtf/IntegralTypedArrayBase.h
new file mode 100644
index 0000000..23dbdde
--- /dev/null
+++ b/Source/WTF/wtf/IntegralTypedArrayBase.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2010, 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:
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 IntegralTypedArrayBase_h
+#define IntegralTypedArrayBase_h
+
+#include <wtf/TypedArrayBase.h>
+#include <limits>
+#include <wtf/MathExtras.h>
+
+// Base class for all WebGL<T>Array types holding integral
+// (non-floating-point) values.
+
+namespace WTF {
+
+template <typename T>
+class IntegralTypedArrayBase : public TypedArrayBase<T> {
+  public:
+    void set(unsigned index, double value)
+    {
+        if (index >= TypedArrayBase<T>::m_length)
+            return;
+        if (isnan(value)) // Clamp NaN to 0
+            value = 0;
+        // The double cast is necessary to get the correct wrapping
+        // for out-of-range values with Int32Array and Uint32Array.
+        TypedArrayBase<T>::data()[index] = static_cast<T>(static_cast<int64_t>(value));
+    }
+
+  protected:
+    IntegralTypedArrayBase(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+        : TypedArrayBase<T>(buffer, byteOffset, length)
+    {
+    }
+};
+
+} // namespace WTF
+
+using WTF::IntegralTypedArrayBase;
+
+#endif // IntegralTypedArrayBase_h
diff --git a/Source/WTF/wtf/ListHashSet.h b/Source/WTF/wtf/ListHashSet.h
new file mode 100644
index 0000000..8feef72
--- /dev/null
+++ b/Source/WTF/wtf/ListHashSet.h
@@ -0,0 +1,872 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com>
+ *
+ * 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_ListHashSet_h
+#define WTF_ListHashSet_h
+
+#include <wtf/HashSet.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WTF {
+
+    // ListHashSet: Just like HashSet, this class provides a Set
+    // interface - a collection of unique objects with O(1) insertion,
+    // removal and test for containership. However, it also has an
+    // order - iterating it will always give back values in the order
+    // in which they are added.
+
+    // Unlike iteration of most WTF Hash data structures, iteration is
+    // guaranteed safe against mutation of the ListHashSet, except for
+    // removal of the item currently pointed to by a given iterator.
+
+    // In theory it would be possible to add prepend, insertAfter
+    // and an append that moves the element to the end even if already present,
+    // but unclear yet if these are needed.
+
+    template<typename Value, size_t inlineCapacity, typename HashFunctions> class ListHashSet;
+
+    template<typename Value, size_t inlineCapacity, typename HashFunctions>
+    void deleteAllValues(const ListHashSet<Value, inlineCapacity, HashFunctions>&);
+
+    template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator;
+    template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator;
+    template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetReverseIterator;
+    template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstReverseIterator;
+
+    template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode;
+    template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator;
+
+    template<typename HashArg> struct ListHashSetNodeHashFunctions;
+    template<typename HashArg> struct ListHashSetTranslator;
+
+    template<typename ValueArg, size_t inlineCapacity = 256, typename HashArg = typename DefaultHash<ValueArg>::Hash> class ListHashSet {
+        WTF_MAKE_FAST_ALLOCATED;
+    private:
+        typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+        typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
+
+        typedef HashTraits<Node*> NodeTraits;
+        typedef ListHashSetNodeHashFunctions<HashArg> NodeHash;
+        typedef ListHashSetTranslator<HashArg> BaseTranslator;
+
+        typedef HashTable<Node*, Node*, IdentityExtractor, NodeHash, NodeTraits, NodeTraits> ImplType;
+        typedef HashTableIterator<Node*, Node*, IdentityExtractor, NodeHash, NodeTraits, NodeTraits> ImplTypeIterator;
+        typedef HashTableConstIterator<Node*, Node*, IdentityExtractor, NodeHash, NodeTraits, NodeTraits> ImplTypeConstIterator;
+
+        typedef HashArg HashFunctions;
+
+    public:
+        typedef ValueArg ValueType;
+
+        typedef ListHashSetIterator<ValueType, inlineCapacity, HashArg> iterator;
+        typedef ListHashSetConstIterator<ValueType, inlineCapacity, HashArg> const_iterator;
+        friend class ListHashSetConstIterator<ValueType, inlineCapacity, HashArg>;
+
+        typedef ListHashSetReverseIterator<ValueType, inlineCapacity, HashArg> reverse_iterator;
+        typedef ListHashSetConstReverseIterator<ValueType, inlineCapacity, HashArg> const_reverse_iterator;
+        friend class ListHashSetConstReverseIterator<ValueType, inlineCapacity, HashArg>;
+
+        typedef HashTableAddResult<iterator> AddResult;
+
+        ListHashSet();
+        ListHashSet(const ListHashSet&);
+        ListHashSet& operator=(const ListHashSet&);
+        ~ListHashSet();
+
+        void swap(ListHashSet&);
+
+        int size() const;
+        int capacity() const;
+        bool isEmpty() const;
+
+        size_t sizeInBytes() const;
+
+        iterator begin();
+        iterator end();
+        const_iterator begin() const;
+        const_iterator end() const;
+
+        reverse_iterator rbegin();
+        reverse_iterator rend();
+        const_reverse_iterator rbegin() const;
+        const_reverse_iterator rend() const;
+
+        ValueType& first();
+        const ValueType& first() const;
+
+        ValueType& last();
+        const ValueType& last() const;
+        void removeLast();
+
+        iterator find(const ValueType&);
+        const_iterator find(const ValueType&) const;
+        bool contains(const ValueType&) const;
+
+        // An alternate version of find() that finds the object by hashing and comparing
+        // with some other type, to avoid the cost of type conversion.
+        // The HashTranslator interface is defined in HashSet.
+        // FIXME: We should reverse the order of the template arguments so that callers
+        // can just pass the translator let the compiler deduce T.
+        template<typename T, typename HashTranslator> iterator find(const T&);
+        template<typename T, typename HashTranslator> const_iterator find(const T&) const;
+        template<typename T, typename HashTranslator> bool contains(const T&) const;
+
+        // The return value of add is a pair of an iterator to the new value's location, 
+        // and a bool that is true if an new entry was added.
+        AddResult add(const ValueType&);
+
+        AddResult insertBefore(const ValueType& beforeValue, const ValueType& newValue);
+        AddResult insertBefore(iterator, const ValueType&);
+
+        void remove(const ValueType&);
+        void remove(iterator);
+        void clear();
+
+    private:
+        void unlinkAndDelete(Node*);
+        void appendNode(Node*);
+        void insertNodeBefore(Node* beforeNode, Node* newNode);
+        void deleteAllNodes();
+        
+        iterator makeIterator(Node*);
+        const_iterator makeConstIterator(Node*) const;
+        reverse_iterator makeReverseIterator(Node*);
+        const_reverse_iterator makeConstReverseIterator(Node*) const;
+
+        friend void deleteAllValues<>(const ListHashSet&);
+
+        ImplType m_impl;
+        Node* m_head;
+        Node* m_tail;
+        OwnPtr<NodeAllocator> m_allocator;
+    };
+
+    template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNodeAllocator {
+        typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+        typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
+
+        ListHashSetNodeAllocator() 
+            : m_freeList(pool())
+            , m_isDoneWithInitialFreeList(false)
+        { 
+            memset(m_pool.pool, 0, sizeof(m_pool.pool));
+        }
+
+        Node* allocate()
+        { 
+            Node* result = m_freeList;
+
+            if (!result)
+                return static_cast<Node*>(fastMalloc(sizeof(Node)));
+
+            ASSERT(!result->m_isAllocated);
+
+            Node* next = result->m_next;
+            ASSERT(!next || !next->m_isAllocated);
+            if (!next && !m_isDoneWithInitialFreeList) {
+                next = result + 1;
+                if (next == pastPool()) {
+                    m_isDoneWithInitialFreeList = true;
+                    next = 0;
+                } else {
+                    ASSERT(inPool(next));
+                    ASSERT(!next->m_isAllocated);
+                }
+            }
+            m_freeList = next;
+
+            return result;
+        }
+
+        void deallocate(Node* node) 
+        {
+            if (inPool(node)) {
+#ifndef NDEBUG
+                node->m_isAllocated = false;
+#endif
+                node->m_next = m_freeList;
+                m_freeList = node;
+                return;
+            }
+
+            fastFree(node);
+        }
+
+        bool inPool(Node* node)
+        {
+            return node >= pool() && node < pastPool();
+        }
+
+    private:
+        Node* pool() { return reinterpret_cast_ptr<Node*>(m_pool.pool); }
+        Node* pastPool() { return pool() + m_poolSize; }
+
+        Node* m_freeList;
+        bool m_isDoneWithInitialFreeList;
+        static const size_t m_poolSize = inlineCapacity;
+        union {
+            char pool[sizeof(Node) * m_poolSize];
+            double forAlignment;
+        } m_pool;
+    };
+
+    template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode {
+        typedef ListHashSetNodeAllocator<ValueArg, inlineCapacity> NodeAllocator;
+
+        ListHashSetNode(ValueArg value)
+            : m_value(value)
+            , m_prev(0)
+            , m_next(0)
+#ifndef NDEBUG
+            , m_isAllocated(true)
+#endif
+        {
+        }
+
+        void* operator new(size_t, NodeAllocator* allocator)
+        {
+            return allocator->allocate();
+        }
+        void destroy(NodeAllocator* allocator)
+        {
+            this->~ListHashSetNode();
+            allocator->deallocate(this);
+        }
+
+        ValueArg m_value;
+        ListHashSetNode* m_prev;
+        ListHashSetNode* m_next;
+
+#ifndef NDEBUG
+        bool m_isAllocated;
+#endif
+    };
+
+    template<typename HashArg> struct ListHashSetNodeHashFunctions {
+        template<typename T> static unsigned hash(const T& key) { return HashArg::hash(key->m_value); }
+        template<typename T> static bool equal(const T& a, const T& b) { return HashArg::equal(a->m_value, b->m_value); }
+        static const bool safeToCompareToEmptyOrDeleted = false;
+    };
+
+    template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetIterator {
+    private:
+        typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+        typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
+        typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
+        typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+        typedef ValueArg ValueType;
+        typedef ValueType& ReferenceType;
+        typedef ValueType* PointerType;
+
+        friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
+
+        ListHashSetIterator(const ListHashSetType* set, Node* position) : m_iterator(set, position) { }
+
+    public:
+        ListHashSetIterator() { }
+
+        // default copy, assignment and destructor are OK
+
+        PointerType get() const { return const_cast<PointerType>(m_iterator.get()); }
+        ReferenceType operator*() const { return *get(); }
+        PointerType operator->() const { return get(); }
+
+        iterator& operator++() { ++m_iterator; return *this; }
+
+        // postfix ++ intentionally omitted
+
+        iterator& operator--() { --m_iterator; return *this; }
+
+        // postfix -- intentionally omitted
+
+        // Comparison.
+        bool operator==(const iterator& other) const { return m_iterator == other.m_iterator; }
+        bool operator!=(const iterator& other) const { return m_iterator != other.m_iterator; }
+
+        operator const_iterator() const { return m_iterator; }
+
+    private:
+        Node* node() { return m_iterator.node(); }
+
+        const_iterator m_iterator;
+    };
+
+    template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstIterator {
+    private:
+        typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+        typedef ListHashSetIterator<ValueArg, inlineCapacity, HashArg> iterator;
+        typedef ListHashSetConstIterator<ValueArg, inlineCapacity, HashArg> const_iterator;
+        typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+        typedef ValueArg ValueType;
+        typedef const ValueType& ReferenceType;
+        typedef const ValueType* PointerType;
+
+        friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
+        friend class ListHashSetIterator<ValueArg, inlineCapacity, HashArg>;
+
+        ListHashSetConstIterator(const ListHashSetType* set, Node* position)
+            : m_set(set)
+            , m_position(position)
+        {
+        }
+
+    public:
+        ListHashSetConstIterator()
+        {
+        }
+
+        PointerType get() const
+        {
+            return &m_position->m_value;
+        }
+        ReferenceType operator*() const { return *get(); }
+        PointerType operator->() const { return get(); }
+
+        const_iterator& operator++()
+        {
+            ASSERT(m_position != 0);
+            m_position = m_position->m_next;
+            return *this;
+        }
+
+        // postfix ++ intentionally omitted
+
+        const_iterator& operator--()
+        {
+            ASSERT(m_position != m_set->m_head);
+            if (!m_position)
+                m_position = m_set->m_tail;
+            else
+                m_position = m_position->m_prev;
+            return *this;
+        }
+
+        // postfix -- intentionally omitted
+
+        // Comparison.
+        bool operator==(const const_iterator& other) const
+        {
+            return m_position == other.m_position;
+        }
+        bool operator!=(const const_iterator& other) const
+        {
+            return m_position != other.m_position;
+        }
+
+    private:
+        Node* node() { return m_position; }
+
+        const ListHashSetType* m_set;
+        Node* m_position;
+    };
+
+    template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetReverseIterator {
+    private:
+        typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+        typedef ListHashSetReverseIterator<ValueArg, inlineCapacity, HashArg> reverse_iterator;
+        typedef ListHashSetConstReverseIterator<ValueArg, inlineCapacity, HashArg> const_reverse_iterator;
+        typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+        typedef ValueArg ValueType;
+        typedef ValueType& ReferenceType;
+        typedef ValueType* PointerType;
+
+        friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
+
+        ListHashSetReverseIterator(const ListHashSetType* set, Node* position) : m_iterator(set, position) { }
+
+    public:
+        ListHashSetReverseIterator() { }
+
+        // default copy, assignment and destructor are OK
+
+        PointerType get() const { return const_cast<PointerType>(m_iterator.get()); }
+        ReferenceType operator*() const { return *get(); }
+        PointerType operator->() const { return get(); }
+
+        reverse_iterator& operator++() { ++m_iterator; return *this; }
+
+        // postfix ++ intentionally omitted
+
+        reverse_iterator& operator--() { --m_iterator; return *this; }
+
+        // postfix -- intentionally omitted
+
+        // Comparison.
+        bool operator==(const reverse_iterator& other) const { return m_iterator == other.m_iterator; }
+        bool operator!=(const reverse_iterator& other) const { return m_iterator != other.m_iterator; }
+
+        operator const_reverse_iterator() const { return m_iterator; }
+
+    private:
+        Node* node() { return m_iterator.node(); }
+
+        const_reverse_iterator m_iterator;
+    };
+
+    template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSetConstReverseIterator {
+    private:
+        typedef ListHashSet<ValueArg, inlineCapacity, HashArg> ListHashSetType;
+        typedef ListHashSetReverseIterator<ValueArg, inlineCapacity, HashArg> reverse_iterator;
+        typedef ListHashSetConstReverseIterator<ValueArg, inlineCapacity, HashArg> const_reverse_iterator;
+        typedef ListHashSetNode<ValueArg, inlineCapacity> Node;
+        typedef ValueArg ValueType;
+        typedef const ValueType& ReferenceType;
+        typedef const ValueType* PointerType;
+
+        friend class ListHashSet<ValueArg, inlineCapacity, HashArg>;
+        friend class ListHashSetReverseIterator<ValueArg, inlineCapacity, HashArg>;
+
+        ListHashSetConstReverseIterator(const ListHashSetType* set, Node* position)
+            : m_set(set)
+            , m_position(position)
+        {
+        }
+
+    public:
+        ListHashSetConstReverseIterator()
+        {
+        }
+
+        PointerType get() const
+        {
+            return &m_position->m_value;
+        }
+        ReferenceType operator*() const { return *get(); }
+        PointerType operator->() const { return get(); }
+
+        const_reverse_iterator& operator++()
+        {
+            ASSERT(m_position != 0);
+            m_position = m_position->m_prev;
+            return *this;
+        }
+
+        // postfix ++ intentionally omitted
+
+        const_reverse_iterator& operator--()
+        {
+            ASSERT(m_position != m_set->m_tail);
+            if (!m_position)
+                m_position = m_set->m_head;
+            else
+                m_position = m_position->m_next;
+            return *this;
+        }
+
+        // postfix -- intentionally omitted
+
+        // Comparison.
+        bool operator==(const const_reverse_iterator& other) const
+        {
+            return m_position == other.m_position;
+        }
+        bool operator!=(const const_reverse_iterator& other) const
+        {
+            return m_position != other.m_position;
+        }
+
+    private:
+        Node* node() { return m_position; }
+
+        const ListHashSetType* m_set;
+        Node* m_position;
+    };
+
+    template<typename HashFunctions>
+    struct ListHashSetTranslator {
+        template<typename T> static unsigned hash(const T& key) { return HashFunctions::hash(key); }
+        template<typename T, typename U> static bool equal(const T& a, const U& b) { return HashFunctions::equal(a->m_value, b); }
+        template<typename T, typename U, typename V> static void translate(T*& location, const U& key, const V& allocator)
+        {
+            location = new (allocator) T(key);
+        }
+    };
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline ListHashSet<T, inlineCapacity, U>::ListHashSet()
+        : m_head(0)
+        , m_tail(0)
+        , m_allocator(adoptPtr(new NodeAllocator))
+    {
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline ListHashSet<T, inlineCapacity, U>::ListHashSet(const ListHashSet& other)
+        : m_head(0)
+        , m_tail(0)
+        , m_allocator(adoptPtr(new NodeAllocator))
+    {
+        const_iterator end = other.end();
+        for (const_iterator it = other.begin(); it != end; ++it)
+            add(*it);
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline ListHashSet<T, inlineCapacity, U>& ListHashSet<T, inlineCapacity, U>::operator=(const ListHashSet& other)
+    {
+        ListHashSet tmp(other);
+        swap(tmp);
+        return *this;
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline void ListHashSet<T, inlineCapacity, U>::swap(ListHashSet& other)
+    {
+        m_impl.swap(other.m_impl);
+        std::swap(m_head, other.m_head);
+        std::swap(m_tail, other.m_tail);
+        m_allocator.swap(other.m_allocator);
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline ListHashSet<T, inlineCapacity, U>::~ListHashSet()
+    {
+        deleteAllNodes();
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline int ListHashSet<T, inlineCapacity, U>::size() const
+    {
+        return m_impl.size(); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline int ListHashSet<T, inlineCapacity, U>::capacity() const
+    {
+        return m_impl.capacity(); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline bool ListHashSet<T, inlineCapacity, U>::isEmpty() const
+    {
+        return m_impl.isEmpty(); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    size_t ListHashSet<T, inlineCapacity, U>::sizeInBytes() const
+    {
+        size_t result = sizeof(*this) + sizeof(*m_allocator);
+        result += sizeof(typename ImplType::ValueType) * m_impl.capacity();
+        for (Node* node = m_head; node; node = node->m_next) {
+            if (!m_allocator->inPool(node))
+                result += sizeof(Node);
+        }
+        return result;
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::begin()
+    {
+        return makeIterator(m_head); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::end()
+    {
+        return makeIterator(0);
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::begin() const
+    {
+        return makeConstIterator(m_head); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::end() const
+    {
+        return makeConstIterator(0); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline typename ListHashSet<T, inlineCapacity, U>::reverse_iterator ListHashSet<T, inlineCapacity, U>::rbegin()
+    {
+        return makeReverseIterator(m_tail); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline typename ListHashSet<T, inlineCapacity, U>::reverse_iterator ListHashSet<T, inlineCapacity, U>::rend()
+    {
+        return makeReverseIterator(0);
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline typename ListHashSet<T, inlineCapacity, U>::const_reverse_iterator ListHashSet<T, inlineCapacity, U>::rbegin() const
+    {
+        return makeConstReverseIterator(m_tail); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline typename ListHashSet<T, inlineCapacity, U>::const_reverse_iterator ListHashSet<T, inlineCapacity, U>::rend() const
+    {
+        return makeConstReverseIterator(0); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline T& ListHashSet<T, inlineCapacity, U>::first()
+    {
+        ASSERT(!isEmpty());
+        return m_head->m_value;
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline const T& ListHashSet<T, inlineCapacity, U>::first() const
+    {
+        ASSERT(!isEmpty());
+        return m_head->m_value;
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline T& ListHashSet<T, inlineCapacity, U>::last()
+    {
+        ASSERT(!isEmpty());
+        return m_tail->m_value;
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline const T& ListHashSet<T, inlineCapacity, U>::last() const
+    {
+        ASSERT(!isEmpty());
+        return m_tail->m_value;
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline void ListHashSet<T, inlineCapacity, U>::removeLast()
+    {
+        ASSERT(!isEmpty());
+        m_impl.remove(m_tail);
+        unlinkAndDelete(m_tail);
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value)
+    {
+        ImplTypeIterator it = m_impl.template find<BaseTranslator>(value);
+        if (it == m_impl.end())
+            return end();
+        return makeIterator(*it); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline typename ListHashSet<T, inlineCapacity, U>::const_iterator ListHashSet<T, inlineCapacity, U>::find(const ValueType& value) const
+    {
+        ImplTypeConstIterator it = m_impl.template find<BaseTranslator>(value);
+        if (it == m_impl.end())
+            return end();
+        return makeConstIterator(*it);
+    }
+
+    template<typename Translator>
+    struct ListHashSetTranslatorAdapter {
+        template<typename T> static unsigned hash(const T& key) { return Translator::hash(key); }
+        template<typename T, typename U> static bool equal(const T& a, const U& b) { return Translator::equal(a->m_value, b); }
+    };
+
+    template<typename ValueType, size_t inlineCapacity, typename U>
+    template<typename T, typename HashTranslator>
+    inline typename ListHashSet<ValueType, inlineCapacity, U>::iterator ListHashSet<ValueType, inlineCapacity, U>::find(const T& value)
+    {
+        ImplTypeConstIterator it = m_impl.template find<ListHashSetTranslatorAdapter<HashTranslator> >(value);
+        if (it == m_impl.end())
+            return end();
+        return makeIterator(*it);
+    }
+
+    template<typename ValueType, size_t inlineCapacity, typename U>
+    template<typename T, typename HashTranslator>
+    inline typename ListHashSet<ValueType, inlineCapacity, U>::const_iterator ListHashSet<ValueType, inlineCapacity, U>::find(const T& value) const
+    {
+        ImplTypeConstIterator it = m_impl.template find<ListHashSetTranslatorAdapter<HashTranslator> >(value);
+        if (it == m_impl.end())
+            return end();
+        return makeConstIterator(*it);
+    }
+
+    template<typename ValueType, size_t inlineCapacity, typename U>
+    template<typename T, typename HashTranslator>
+    inline bool ListHashSet<ValueType, inlineCapacity, U>::contains(const T& value) const
+    {
+        return m_impl.template contains<ListHashSetTranslatorAdapter<HashTranslator> >(value);
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline bool ListHashSet<T, inlineCapacity, U>::contains(const ValueType& value) const
+    {
+        return m_impl.template contains<BaseTranslator>(value);
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    typename ListHashSet<T, inlineCapacity, U>::AddResult ListHashSet<T, inlineCapacity, U>::add(const ValueType &value)
+    {
+        typename ImplType::AddResult result = m_impl.template add<BaseTranslator>(value, m_allocator.get());
+        if (result.isNewEntry)
+            appendNode(*result.iterator);
+        return AddResult(makeIterator(*result.iterator), result.isNewEntry);
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    typename ListHashSet<T, inlineCapacity, U>::AddResult ListHashSet<T, inlineCapacity, U>::insertBefore(iterator it, const ValueType& newValue)
+    {
+        typename ImplType::AddResult result = m_impl.template add<BaseTranslator>(newValue, m_allocator.get());
+        if (result.isNewEntry)
+            insertNodeBefore(it.node(), *result.iterator);
+        return AddResult(makeIterator(*result.iterator), result.isNewEntry);
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    typename ListHashSet<T, inlineCapacity, U>::AddResult ListHashSet<T, inlineCapacity, U>::insertBefore(const ValueType& beforeValue, const ValueType& newValue)
+    {
+        return insertBefore(find(beforeValue), newValue); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline void ListHashSet<T, inlineCapacity, U>::remove(iterator it)
+    {
+        if (it == end())
+            return;
+        m_impl.remove(it.node());
+        unlinkAndDelete(it.node());
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline void ListHashSet<T, inlineCapacity, U>::remove(const ValueType& value)
+    {
+        remove(find(value));
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline void ListHashSet<T, inlineCapacity, U>::clear()
+    {
+        deleteAllNodes();
+        m_impl.clear(); 
+        m_head = 0;
+        m_tail = 0;
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    void ListHashSet<T, inlineCapacity, U>::unlinkAndDelete(Node* node)
+    {
+        if (!node->m_prev) {
+            ASSERT(node == m_head);
+            m_head = node->m_next;
+        } else {
+            ASSERT(node != m_head);
+            node->m_prev->m_next = node->m_next;
+        }
+
+        if (!node->m_next) {
+            ASSERT(node == m_tail);
+            m_tail = node->m_prev;
+        } else {
+            ASSERT(node != m_tail);
+            node->m_next->m_prev = node->m_prev;
+        }
+
+        node->destroy(m_allocator.get());
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    void ListHashSet<T, inlineCapacity, U>::appendNode(Node* node)
+    {
+        node->m_prev = m_tail;
+        node->m_next = 0;
+
+        if (m_tail) {
+            ASSERT(m_head);
+            m_tail->m_next = node;
+        } else {
+            ASSERT(!m_head);
+            m_head = node;
+        }
+
+        m_tail = node;
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    void ListHashSet<T, inlineCapacity, U>::insertNodeBefore(Node* beforeNode, Node* newNode)
+    {
+        if (!beforeNode)
+            return appendNode(newNode);
+        
+        newNode->m_next = beforeNode;
+        newNode->m_prev = beforeNode->m_prev;
+        if (beforeNode->m_prev)
+            beforeNode->m_prev->m_next = newNode;
+        beforeNode->m_prev = newNode;
+
+        if (!newNode->m_prev)
+            m_head = newNode;
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    void ListHashSet<T, inlineCapacity, U>::deleteAllNodes()
+    {
+        if (!m_head)
+            return;
+
+        for (Node* node = m_head, *next = m_head->m_next; node; node = next, next = node ? node->m_next : 0)
+            node->destroy(m_allocator.get());
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline ListHashSetReverseIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeReverseIterator(Node* position) 
+    {
+        return ListHashSetReverseIterator<T, inlineCapacity, U>(this, position); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline ListHashSetConstReverseIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeConstReverseIterator(Node* position) const
+    { 
+        return ListHashSetConstReverseIterator<T, inlineCapacity, U>(this, position); 
+    }
+    
+    template<typename T, size_t inlineCapacity, typename U>
+    inline ListHashSetIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeIterator(Node* position) 
+    {
+        return ListHashSetIterator<T, inlineCapacity, U>(this, position); 
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline ListHashSetConstIterator<T, inlineCapacity, U> ListHashSet<T, inlineCapacity, U>::makeConstIterator(Node* position) const
+    { 
+        return ListHashSetConstIterator<T, inlineCapacity, U>(this, position); 
+    }
+    template<bool, typename ValueType, typename HashTableType>
+    void deleteAllValues(HashTableType& collection)
+    {
+        typedef typename HashTableType::const_iterator iterator;
+        iterator end = collection.end();
+        for (iterator it = collection.begin(); it != end; ++it)
+            delete (*it)->m_value;
+    }
+
+    template<typename T, size_t inlineCapacity, typename U>
+    inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U>& collection)
+    {
+        deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U>::ValueType>(collection.m_impl);
+    }
+
+} // namespace WTF
+
+using WTF::ListHashSet;
+
+#endif /* WTF_ListHashSet_h */
diff --git a/Source/WTF/wtf/ListRefPtr.h b/Source/WTF/wtf/ListRefPtr.h
new file mode 100644
index 0000000..4ba0632
--- /dev/null
+++ b/Source/WTF/wtf/ListRefPtr.h
@@ -0,0 +1,61 @@
+/*
+ *  Copyright (C) 2005, 2006, 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_ListRefPtr_h
+#define WTF_ListRefPtr_h
+
+#include <wtf/RefPtr.h>
+
+namespace WTF {
+
+    // Specialized version of RefPtr desgined for use in singly-linked lists. 
+    // Derefs the list iteratively to avoid recursive derefing that can overflow the stack.
+    template <typename T> class ListRefPtr : public RefPtr<T> {
+    public:
+        ListRefPtr() : RefPtr<T>() {}
+        ListRefPtr(T* ptr) : RefPtr<T>(ptr) {}
+        ListRefPtr(const RefPtr<T>& o) : RefPtr<T>(o) {}
+        // see comment in PassRefPtr.h for why this takes const reference
+        template <typename U> ListRefPtr(const PassRefPtr<U>& o) : RefPtr<T>(o) {}
+        
+        ~ListRefPtr()
+        {
+            RefPtr<T> reaper = this->release();
+            while (reaper && reaper->hasOneRef())
+                reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper
+        }
+        
+        ListRefPtr& operator=(T* optr) { RefPtr<T>::operator=(optr); return *this; }
+        ListRefPtr& operator=(const RefPtr<T>& o) { RefPtr<T>::operator=(o); return *this; }
+        ListRefPtr& operator=(const PassRefPtr<T>& o) { RefPtr<T>::operator=(o); return *this; }
+        template <typename U> ListRefPtr& operator=(const RefPtr<U>& o) { RefPtr<T>::operator=(o); return *this; }
+        template <typename U> ListRefPtr& operator=(const PassRefPtr<U>& o) { RefPtr<T>::operator=(o); return *this; }
+    };
+
+    template <typename T> inline T* getPtr(const ListRefPtr<T>& p)
+    {
+        return p.get();
+    }
+
+} // namespace WTF
+
+using WTF::ListRefPtr;
+
+#endif // WTF_ListRefPtr_h
diff --git a/Source/WTF/wtf/Locker.h b/Source/WTF/wtf/Locker.h
new file mode 100644
index 0000000..c465b99
--- /dev/null
+++ b/Source/WTF/wtf/Locker.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2008 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+#ifndef Locker_h
+#define Locker_h
+
+#include <wtf/Noncopyable.h>
+
+namespace WTF {
+
+template <typename T> class Locker {
+    WTF_MAKE_NONCOPYABLE(Locker);
+public:
+    Locker(T& lockable) : m_lockable(lockable) { m_lockable.lock(); }
+    ~Locker() { m_lockable.unlock(); }
+private:
+    T& m_lockable;
+};
+
+}
+
+using WTF::Locker;
+
+#endif
diff --git a/Source/WTF/wtf/MD5.cpp b/Source/WTF/wtf/MD5.cpp
new file mode 100644
index 0000000..07bbadd
--- /dev/null
+++ b/Source/WTF/wtf/MD5.cpp
@@ -0,0 +1,309 @@
+// The original file was copied from sqlite, and was in the public domain.
+// Modifications Copyright 2006 Google Inc. All Rights Reserved
+/*
+ * Copyright (C) 2010 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.
+ *     * 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.
+ *     * 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.
+ */
+/*
+ * This code implements the MD5 message-digest algorithm.
+ * The algorithm is due to Ron Rivest.  This code was
+ * written by Colin Plumb in 1993, no copyright is claimed.
+ * This code is in the public domain; do with it what you wish.
+ *
+ * Equivalent code is available from RSA Data Security, Inc.
+ * This code has been tested against that, and is equivalent,
+ * except that you don't need to include two pages of legalese
+ * with every copy.
+ *
+ * To compute the message digest of a chunk of bytes, construct an
+ * MD5 instance, call addBytes as needed on buffers full of bytes,
+ * and then call checksum, which will fill a supplied 16-byte array
+ * with the digest.
+ */
+
+#include "config.h"
+#include "MD5.h"
+
+#include "Assertions.h"
+#ifndef NDEBUG
+#include "StringExtras.h"
+#include "text/CString.h"
+#endif
+#include <wtf/StdLibExtras.h>
+
+namespace WTF {
+
+#ifdef NDEBUG
+static inline void testMD5() { }
+#else
+// MD5 test case.
+static bool isTestMD5Done;
+
+static void expectMD5(CString input, CString expected)
+{
+    MD5 md5;
+    md5.addBytes(reinterpret_cast<const uint8_t*>(input.data()), input.length());
+    Vector<uint8_t, 16> digest;
+    md5.checksum(digest);
+    char* buf = 0;
+    CString actual = CString::newUninitialized(32, buf);
+    for (size_t i = 0; i < 16; i++) {
+        snprintf(buf, 3, "%02x", digest.at(i));
+        buf += 2;
+    }
+    ASSERT_WITH_MESSAGE(actual == expected, "input:%s[%lu] actual:%s expected:%s", input.data(), static_cast<unsigned long>(input.length()), actual.data(), expected.data());
+}
+
+static void testMD5()
+{
+    if (isTestMD5Done)
+        return;
+    isTestMD5Done = true;
+
+    // MD5 Test suite from http://www.ietf.org/rfc/rfc1321.txt
+    expectMD5("", "d41d8cd98f00b204e9800998ecf8427e");
+    expectMD5("a", "0cc175b9c0f1b6a831c399e269772661");
+    expectMD5("abc", "900150983cd24fb0d6963f7d28e17f72");
+    expectMD5("message digest", "f96b697d7cb7938d525a2f31aaf161d0");
+    expectMD5("abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b");
+    expectMD5("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "d174ab98d277d9f5a5611c2c9f419d9f");
+    expectMD5("12345678901234567890123456789012345678901234567890123456789012345678901234567890", "57edf4a22be3c955ac49da2e2107b67a");
+}
+#endif
+
+// Note: this code is harmless on little-endian machines.
+
+static void reverseBytes(uint8_t* buf, unsigned longs)
+{
+    ASSERT(longs > 0);
+    do {
+        uint32_t t = static_cast<uint32_t>(buf[3] << 8 | buf[2]) << 16 | buf[1] << 8 | buf[0];
+        ASSERT_WITH_MESSAGE(!(reinterpret_cast<uintptr_t>(buf) % sizeof(t)), "alignment error of buf");
+        *reinterpret_cast_ptr<uint32_t *>(buf) = t;
+        buf += 4;
+    } while (--longs);
+}
+
+// The four core functions.
+// F1 is originally defined as (x & y | ~x & z), but optimized somewhat: 4 bit ops -> 3 bit ops.
+#define F1(x, y, z) (z ^ (x & (y ^ z)))
+#define F2(x, y, z) F1(z, x, y)
+#define F3(x, y, z) (x ^ y ^ z)
+#define F4(x, y, z) (y ^ (x | ~z))
+
+// This is the central step in the MD5 algorithm.
+#define MD5STEP(f, w, x, y, z, data, s) \
+    (w += f(x, y, z) + data, w = w << s | w >> (32 - s), w += x)
+
+static void MD5Transform(uint32_t buf[4], const uint32_t in[16])
+{
+    uint32_t a = buf[0];
+    uint32_t b = buf[1];
+    uint32_t c = buf[2];
+    uint32_t d = buf[3];
+
+    MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478,  7);
+    MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
+    MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
+    MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
+    MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf,  7);
+    MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
+    MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
+    MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
+    MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8,  7);
+    MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
+    MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
+    MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
+    MD5STEP(F1, a, b, c, d, in[12]+0x6b901122,  7);
+    MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
+    MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
+    MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
+
+    MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562,  5);
+    MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340,  9);
+    MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
+    MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
+    MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d,  5);
+    MD5STEP(F2, d, a, b, c, in[10]+0x02441453,  9);
+    MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
+    MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
+    MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6,  5);
+    MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6,  9);
+    MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
+    MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
+    MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905,  5);
+    MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8,  9);
+    MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
+    MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
+
+    MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942,  4);
+    MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
+    MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
+    MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
+    MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44,  4);
+    MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
+    MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
+    MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
+    MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6,  4);
+    MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
+    MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
+    MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
+    MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039,  4);
+    MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
+    MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
+    MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
+
+    MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244,  6);
+    MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
+    MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
+    MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
+    MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3,  6);
+    MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
+    MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
+    MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
+    MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f,  6);
+    MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
+    MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
+    MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
+    MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82,  6);
+    MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
+    MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
+    MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
+
+    buf[0] += a;
+    buf[1] += b;
+    buf[2] += c;
+    buf[3] += d;
+}
+
+MD5::MD5()
+{
+    // FIXME: Move unit tests somewhere outside the constructor. See bug 55853.
+    testMD5();
+    m_buf[0] = 0x67452301;
+    m_buf[1] = 0xefcdab89;
+    m_buf[2] = 0x98badcfe;
+    m_buf[3] = 0x10325476;
+    m_bits[0] = 0;
+    m_bits[1] = 0;
+    memset(m_in, 0, sizeof(m_in));
+    ASSERT_WITH_MESSAGE(!(reinterpret_cast<uintptr_t>(m_in) % sizeof(uint32_t)), "alignment error of m_in");
+}
+
+void MD5::addBytes(const uint8_t* input, size_t length)
+{
+    const uint8_t* buf = input;
+
+    // Update bitcount
+    uint32_t t = m_bits[0];
+    m_bits[0] = t + (length << 3);
+    if (m_bits[0] < t)
+        m_bits[1]++; // Carry from low to high
+    m_bits[1] += length >> 29;
+
+    t = (t >> 3) & 0x3f; // Bytes already in shsInfo->data
+
+    // Handle any leading odd-sized chunks
+
+    if (t) {
+        uint8_t* p = m_in + t;
+
+        t = 64 - t;
+        if (length < t) {
+            memcpy(p, buf, length);
+            return;
+        }
+        memcpy(p, buf, t);
+        reverseBytes(m_in, 16);
+        MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t*>(m_in)); // m_in is 4-byte aligned.
+        buf += t;
+        length -= t;
+    }
+
+    // Process data in 64-byte chunks
+
+    while (length >= 64) {
+        memcpy(m_in, buf, 64);
+        reverseBytes(m_in, 16);
+        MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t*>(m_in)); // m_in is 4-byte aligned.
+        buf += 64;
+        length -= 64;
+    }
+
+    // Handle any remaining bytes of data.
+    memcpy(m_in, buf, length);
+}
+
+void MD5::checksum(Vector<uint8_t, 16>& digest)
+{
+    // Compute number of bytes mod 64
+    unsigned count = (m_bits[0] >> 3) & 0x3F;
+
+    // Set the first char of padding to 0x80.  This is safe since there is
+    // always at least one byte free
+    uint8_t* p = m_in + count;
+    *p++ = 0x80;
+
+    // Bytes of padding needed to make 64 bytes
+    count = 64 - 1 - count;
+
+    // Pad out to 56 mod 64
+    if (count < 8) {
+        // Two lots of padding:  Pad the first block to 64 bytes
+        memset(p, 0, count);
+        reverseBytes(m_in, 16);
+        MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t *>(m_in)); // m_in is 4-byte aligned.
+
+        // Now fill the next block with 56 bytes
+        memset(m_in, 0, 56);
+    } else {
+        // Pad block to 56 bytes
+        memset(p, 0, count - 8);
+    }
+    reverseBytes(m_in, 14);
+
+    // Append length in bits and transform
+    // m_in is 4-byte aligned.
+    (reinterpret_cast_ptr<uint32_t*>(m_in))[14] = m_bits[0];
+    (reinterpret_cast_ptr<uint32_t*>(m_in))[15] = m_bits[1];
+
+    MD5Transform(m_buf, reinterpret_cast_ptr<uint32_t*>(m_in));
+    reverseBytes(reinterpret_cast<uint8_t*>(m_buf), 4);
+
+    // Now, m_buf contains checksum result.
+    if (!digest.isEmpty())
+        digest.clear();
+    digest.append(reinterpret_cast<uint8_t*>(m_buf), 16);
+
+    // In case it's sensitive
+    memset(m_buf, 0, sizeof(m_buf));
+    memset(m_bits, 0, sizeof(m_bits));
+    memset(m_in, 0, sizeof(m_in));
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/MD5.h b/Source/WTF/wtf/MD5.h
new file mode 100644
index 0000000..ef027cc
--- /dev/null
+++ b/Source/WTF/wtf/MD5.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 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.
+ *     * 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.
+ *     * 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_MD5_h
+#define WTF_MD5_h
+
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+class MD5 {
+public:
+    WTF_EXPORT_PRIVATE MD5();
+
+    void addBytes(const Vector<uint8_t>& input)
+    {
+        addBytes(input.data(), input.size());
+    }
+    WTF_EXPORT_PRIVATE void addBytes(const uint8_t* input, size_t length);
+
+    // checksum has a side effect of resetting the state of the object.
+    WTF_EXPORT_PRIVATE void checksum(Vector<uint8_t, 16>&);
+
+private:
+    uint32_t m_buf[4];
+    uint32_t m_bits[2];
+    uint8_t m_in[64];
+};
+
+} // namespace WTF
+
+using WTF::MD5;
+
+#endif // WTF_MD5_h
diff --git a/Source/WTF/wtf/MainThread.cpp b/Source/WTF/wtf/MainThread.cpp
new file mode 100644
index 0000000..f8686aa
--- /dev/null
+++ b/Source/WTF/wtf/MainThread.cpp
@@ -0,0 +1,292 @@
+/*
+ * Copyright (C) 2007, 2008 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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 "config.h"
+#include "MainThread.h"
+
+#include "CurrentTime.h"
+#include "Deque.h"
+#include "Functional.h"
+#include "StdLibExtras.h"
+#include "Threading.h"
+#include <wtf/ThreadSpecific.h>
+
+#if PLATFORM(CHROMIUM)
+#error Chromium uses a different main thread implementation
+#endif
+
+namespace WTF {
+
+struct FunctionWithContext {
+    MainThreadFunction* function;
+    void* context;
+    ThreadCondition* syncFlag;
+
+    FunctionWithContext(MainThreadFunction* function = 0, void* context = 0, ThreadCondition* syncFlag = 0)
+        : function(function)
+        , context(context)
+        , syncFlag(syncFlag)
+    { 
+    }
+    bool operator == (const FunctionWithContext& o)
+    {
+        return function == o.function
+            && context == o.context
+            && syncFlag == o.syncFlag;
+    }
+};
+
+class FunctionWithContextFinder {
+public:
+    FunctionWithContextFinder(const FunctionWithContext& m) : m(m) {}
+    bool operator() (FunctionWithContext& o) { return o == m; }
+    FunctionWithContext m;
+};
+
+
+typedef Deque<FunctionWithContext> FunctionQueue;
+
+static bool callbacksPaused; // This global variable is only accessed from main thread.
+#if !PLATFORM(MAC)
+static ThreadIdentifier mainThreadIdentifier;
+#endif
+
+static Mutex& mainThreadFunctionQueueMutex()
+{
+    DEFINE_STATIC_LOCAL(Mutex, staticMutex, ());
+    return staticMutex;
+}
+
+static FunctionQueue& functionQueue()
+{
+    DEFINE_STATIC_LOCAL(FunctionQueue, staticFunctionQueue, ());
+    return staticFunctionQueue;
+}
+
+
+#if !PLATFORM(MAC)
+
+void initializeMainThread()
+{
+    static bool initializedMainThread;
+    if (initializedMainThread)
+        return;
+    initializedMainThread = true;
+
+    mainThreadIdentifier = currentThread();
+
+    mainThreadFunctionQueueMutex();
+    initializeMainThreadPlatform();
+    initializeGCThreads();
+}
+
+#else
+
+static pthread_once_t initializeMainThreadKeyOnce = PTHREAD_ONCE_INIT;
+
+static void initializeMainThreadOnce()
+{
+    mainThreadFunctionQueueMutex();
+    initializeMainThreadPlatform();
+}
+
+void initializeMainThread()
+{
+    pthread_once(&initializeMainThreadKeyOnce, initializeMainThreadOnce);
+}
+
+static void initializeMainThreadToProcessMainThreadOnce()
+{
+    mainThreadFunctionQueueMutex();
+    initializeMainThreadToProcessMainThreadPlatform();
+}
+
+void initializeMainThreadToProcessMainThread()
+{
+    pthread_once(&initializeMainThreadKeyOnce, initializeMainThreadToProcessMainThreadOnce);
+}
+#endif
+
+// 0.1 sec delays in UI is approximate threshold when they become noticeable. Have a limit that's half of that.
+static const double maxRunLoopSuspensionTime = 0.05;
+
+void dispatchFunctionsFromMainThread()
+{
+    ASSERT(isMainThread());
+
+    if (callbacksPaused)
+        return;
+
+    double startTime = currentTime();
+
+    FunctionWithContext invocation;
+    while (true) {
+        {
+            MutexLocker locker(mainThreadFunctionQueueMutex());
+            if (!functionQueue().size())
+                break;
+            invocation = functionQueue().takeFirst();
+        }
+
+        invocation.function(invocation.context);
+        if (invocation.syncFlag) {
+            MutexLocker locker(mainThreadFunctionQueueMutex());
+            invocation.syncFlag->signal();
+        }
+
+        // If we are running accumulated functions for too long so UI may become unresponsive, we need to
+        // yield so the user input can be processed. Otherwise user may not be able to even close the window.
+        // This code has effect only in case the scheduleDispatchFunctionsOnMainThread() is implemented in a way that
+        // allows input events to be processed before we are back here.
+        if (currentTime() - startTime > maxRunLoopSuspensionTime) {
+            scheduleDispatchFunctionsOnMainThread();
+            break;
+        }
+    }
+}
+
+void callOnMainThread(MainThreadFunction* function, void* context)
+{
+    ASSERT(function);
+    bool needToSchedule = false;
+    {
+        MutexLocker locker(mainThreadFunctionQueueMutex());
+        needToSchedule = functionQueue().size() == 0;
+        functionQueue().append(FunctionWithContext(function, context));
+    }
+    if (needToSchedule)
+        scheduleDispatchFunctionsOnMainThread();
+}
+
+void callOnMainThreadAndWait(MainThreadFunction* function, void* context)
+{
+    ASSERT(function);
+
+    if (isMainThread()) {
+        function(context);
+        return;
+    }
+
+    ThreadCondition syncFlag;
+    Mutex& functionQueueMutex = mainThreadFunctionQueueMutex();
+    MutexLocker locker(functionQueueMutex);
+    functionQueue().append(FunctionWithContext(function, context, &syncFlag));
+    if (functionQueue().size() == 1)
+        scheduleDispatchFunctionsOnMainThread();
+    syncFlag.wait(functionQueueMutex);
+}
+
+void cancelCallOnMainThread(MainThreadFunction* function, void* context)
+{
+    ASSERT(function);
+
+    MutexLocker locker(mainThreadFunctionQueueMutex());
+
+    FunctionWithContextFinder pred(FunctionWithContext(function, context));
+
+    while (true) {
+        // We must redefine 'i' each pass, because the itererator's operator= 
+        // requires 'this' to be valid, and remove() invalidates all iterators
+        FunctionQueue::iterator i(functionQueue().findIf(pred));
+        if (i == functionQueue().end())
+            break;
+        functionQueue().remove(i);
+    }
+}
+
+static void callFunctionObject(void* context)
+{
+    Function<void ()>* function = static_cast<Function<void ()>*>(context);
+    (*function)();
+    delete function;
+}
+
+void callOnMainThread(const Function<void ()>& function)
+{
+    callOnMainThread(callFunctionObject, new Function<void ()>(function));
+}
+
+void setMainThreadCallbacksPaused(bool paused)
+{
+    ASSERT(isMainThread());
+
+    if (callbacksPaused == paused)
+        return;
+
+    callbacksPaused = paused;
+
+    if (!callbacksPaused)
+        scheduleDispatchFunctionsOnMainThread();
+}
+
+#if !PLATFORM(MAC)
+bool isMainThread()
+{
+    return currentThread() == mainThreadIdentifier;
+}
+#endif
+
+#if ENABLE(PARALLEL_GC)
+static ThreadSpecific<bool>* isGCThread;
+#endif
+
+void initializeGCThreads()
+{
+#if ENABLE(PARALLEL_GC)
+    isGCThread = new ThreadSpecific<bool>();
+#endif
+}
+
+#if ENABLE(PARALLEL_GC)
+void registerGCThread()
+{
+    if (!isGCThread) {
+        // This happens if we're running in a process that doesn't care about
+        // MainThread.
+        return;
+    }
+
+    **isGCThread = true;
+}
+
+bool isMainThreadOrGCThread()
+{
+    if (isGCThread->isSet() && **isGCThread)
+        return true;
+
+    return isMainThread();
+}
+#elif PLATFORM(MAC)
+// This is necessary because JavaScriptCore.exp doesn't support preprocessor macros.
+bool isMainThreadOrGCThread()
+{
+    return isMainThread();
+}
+#endif
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/MainThread.h b/Source/WTF/wtf/MainThread.h
new file mode 100644
index 0000000..9a40ad4
--- /dev/null
+++ b/Source/WTF/wtf/MainThread.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef MainThread_h
+#define MainThread_h
+
+#include <stdint.h>
+
+namespace WTF {
+
+typedef uint32_t ThreadIdentifier;
+typedef void MainThreadFunction(void*);
+
+// Must be called from the main thread.
+WTF_EXPORT_PRIVATE void initializeMainThread();
+
+WTF_EXPORT_PRIVATE void callOnMainThread(MainThreadFunction*, void* context);
+WTF_EXPORT_PRIVATE void callOnMainThreadAndWait(MainThreadFunction*, void* context);
+WTF_EXPORT_PRIVATE void cancelCallOnMainThread(MainThreadFunction*, void* context);
+
+template<typename> class Function;
+WTF_EXPORT_PRIVATE void callOnMainThread(const Function<void ()>&);
+    
+WTF_EXPORT_PRIVATE void setMainThreadCallbacksPaused(bool paused);
+
+WTF_EXPORT_PRIVATE bool isMainThread();
+
+void initializeGCThreads();
+
+#if ENABLE(PARALLEL_GC)
+void registerGCThread();
+WTF_EXPORT_PRIVATE bool isMainThreadOrGCThread();
+#elif PLATFORM(MAC)
+WTF_EXPORT_PRIVATE bool isMainThreadOrGCThread();
+#else
+inline bool isMainThreadOrGCThread() { return isMainThread(); }
+#endif
+
+// NOTE: these functions are internal to the callOnMainThread implementation.
+void initializeMainThreadPlatform();
+void scheduleDispatchFunctionsOnMainThread();
+void dispatchFunctionsFromMainThread();
+
+#if PLATFORM(MAC)
+// This version of initializeMainThread sets up the main thread as corresponding
+// to the process's main thread, and not necessarily the thread that calls this
+// function. It should only be used as a legacy aid for Mac WebKit.
+WTF_EXPORT_PRIVATE void initializeMainThreadToProcessMainThread();
+void initializeMainThreadToProcessMainThreadPlatform();
+#endif
+
+} // namespace WTF
+
+using WTF::callOnMainThread;
+using WTF::callOnMainThreadAndWait;
+using WTF::cancelCallOnMainThread;
+using WTF::setMainThreadCallbacksPaused;
+using WTF::isMainThread;
+using WTF::isMainThreadOrGCThread;
+#endif // MainThread_h
diff --git a/Source/WTF/wtf/MallocZoneSupport.h b/Source/WTF/wtf/MallocZoneSupport.h
new file mode 100644
index 0000000..4332e40
--- /dev/null
+++ b/Source/WTF/wtf/MallocZoneSupport.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2007 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef MallocZoneSupport_h
+#define MallocZoneSupport_h
+
+#include <malloc/malloc.h>
+
+namespace WTF {
+
+class RemoteMemoryReader {
+    task_t m_task;
+    memory_reader_t* m_reader;
+
+public:
+    RemoteMemoryReader(task_t task, memory_reader_t* reader)
+        : m_task(task)
+        , m_reader(reader)
+    { }
+
+    void* operator()(vm_address_t address, size_t size) const
+    {
+        void* output;
+        kern_return_t err = (*m_reader)(m_task, address, size, static_cast<void**>(&output));
+        if (err)
+            output = 0;
+        return output;
+    }
+
+    template <typename T>
+    T* operator()(T* address, size_t size=sizeof(T)) const
+    {
+        return static_cast<T*>((*this)(reinterpret_cast<vm_address_t>(address), size));
+    }
+
+    template <typename T>
+    T* nextEntryInLinkedList(T** address) const
+    {
+        T** output = (*this)(address);
+        if (!output)
+            return 0;
+        return *output;
+    }
+};
+
+} // namespace WTF
+
+#endif // MallocZoneSupport_h
diff --git a/Source/WTF/wtf/MathExtras.h b/Source/WTF/wtf/MathExtras.h
new file mode 100644
index 0000000..df1b236
--- /dev/null
+++ b/Source/WTF/wtf/MathExtras.h
@@ -0,0 +1,395 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 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 COMPUTER, INC. ``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 COMPUTER, INC. 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_MathExtras_h
+#define WTF_MathExtras_h
+
+#include <algorithm>
+#include <cmath>
+#include <float.h>
+#include <limits>
+#include <stdint.h>
+#include <stdlib.h>
+#include <wtf/StdLibExtras.h>
+
+#if OS(SOLARIS)
+#include <ieeefp.h>
+#endif
+
+#if OS(OPENBSD)
+#include <sys/types.h>
+#include <machine/ieee.h>
+#endif
+
+#if OS(QNX)
+// FIXME: Look into a way to have cmath import its functions into both the standard and global
+// namespace. For now, we include math.h since the QNX cmath header only imports its functions
+// into the standard namespace.
+#include <math.h>
+#endif
+
+#ifndef M_PI
+const double piDouble = 3.14159265358979323846;
+const float piFloat = 3.14159265358979323846f;
+#else
+const double piDouble = M_PI;
+const float piFloat = static_cast<float>(M_PI);
+#endif
+
+#ifndef M_PI_2
+const double piOverTwoDouble = 1.57079632679489661923;
+const float piOverTwoFloat = 1.57079632679489661923f;
+#else
+const double piOverTwoDouble = M_PI_2;
+const float piOverTwoFloat = static_cast<float>(M_PI_2);
+#endif
+
+#ifndef M_PI_4
+const double piOverFourDouble = 0.785398163397448309616;
+const float piOverFourFloat = 0.785398163397448309616f;
+#else
+const double piOverFourDouble = M_PI_4;
+const float piOverFourFloat = static_cast<float>(M_PI_4);
+#endif
+
+#if OS(DARWIN)
+
+// Work around a bug in the Mac OS X libc where ceil(-0.1) return +0.
+inline double wtf_ceil(double x) { return copysign(ceil(x), x); }
+
+#define ceil(x) wtf_ceil(x)
+
+#endif
+
+#if OS(SOLARIS)
+
+#ifndef isfinite
+inline bool isfinite(double x) { return finite(x) && !isnand(x); }
+#endif
+#ifndef isinf
+inline bool isinf(double x) { return !finite(x) && !isnand(x); }
+#endif
+#ifndef signbit
+inline bool signbit(double x) { return copysign(1.0, x) < 0; }
+#endif
+
+#endif
+
+#if OS(OPENBSD)
+
+#ifndef isfinite
+inline bool isfinite(double x) { return finite(x); }
+#endif
+#ifndef signbit
+inline bool signbit(double x) { struct ieee_double *p = (struct ieee_double *)&x; return p->dbl_sign; }
+#endif
+
+#endif
+
+#if COMPILER(MSVC) || (COMPILER(RVCT) && !(RVCT_VERSION_AT_LEAST(3, 0, 0, 0)))
+
+// We must not do 'num + 0.5' or 'num - 0.5' because they can cause precision loss.
+static double round(double num)
+{
+    double integer = ceil(num);
+    if (num > 0)
+        return integer - num > 0.5 ? integer - 1.0 : integer;
+    return integer - num >= 0.5 ? integer - 1.0 : integer;
+}
+static float roundf(float num)
+{
+    float integer = ceilf(num);
+    if (num > 0)
+        return integer - num > 0.5f ? integer - 1.0f : integer;
+    return integer - num >= 0.5f ? integer - 1.0f : integer;
+}
+inline long long llround(double num) { return static_cast<long long>(round(num)); }
+inline long long llroundf(float num) { return static_cast<long long>(roundf(num)); }
+inline long lround(double num) { return static_cast<long>(round(num)); }
+inline long lroundf(float num) { return static_cast<long>(roundf(num)); }
+inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); }
+
+#endif
+
+#if COMPILER(GCC) && OS(QNX)
+// The stdlib on QNX doesn't contain long abs(long). See PR #104666.
+inline long long abs(long num) { return labs(num); }
+#endif
+
+#if OS(ANDROID) || COMPILER(MSVC)
+// ANDROID and MSVC's math.h does not currently supply log2 or log2f.
+inline double log2(double num)
+{
+    // This constant is roughly M_LN2, which is not provided by default on Windows and Android.
+    return log(num) / 0.693147180559945309417232121458176568;
+}
+
+inline float log2f(float num)
+{
+    // This constant is roughly M_LN2, which is not provided by default on Windows and Android.
+    return logf(num) / 0.693147180559945309417232121458176568f;
+}
+#endif
+
+#if COMPILER(MSVC)
+// The 64bit version of abs() is already defined in stdlib.h which comes with VC10
+#if COMPILER(MSVC9_OR_LOWER)
+inline long long abs(long long num) { return _abs64(num); }
+#endif
+
+inline bool isinf(double num) { return !_finite(num) && !_isnan(num); }
+inline bool isnan(double num) { return !!_isnan(num); }
+inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
+
+inline double nextafter(double x, double y) { return _nextafter(x, y); }
+inline float nextafterf(float x, float y) { return x > y ? x - FLT_EPSILON : x + FLT_EPSILON; }
+
+inline double copysign(double x, double y) { return _copysign(x, y); }
+inline int isfinite(double x) { return _finite(x); }
+
+// Work around a bug in Win, where atan2(+-infinity, +-infinity) yields NaN instead of specific values.
+inline double wtf_atan2(double x, double y)
+{
+    double posInf = std::numeric_limits<double>::infinity();
+    double negInf = -std::numeric_limits<double>::infinity();
+    double nan = std::numeric_limits<double>::quiet_NaN();
+
+    double result = nan;
+
+    if (x == posInf && y == posInf)
+        result = piOverFourDouble;
+    else if (x == posInf && y == negInf)
+        result = 3 * piOverFourDouble;
+    else if (x == negInf && y == posInf)
+        result = -piOverFourDouble;
+    else if (x == negInf && y == negInf)
+        result = -3 * piOverFourDouble;
+    else
+        result = ::atan2(x, y);
+
+    return result;
+}
+
+// Work around a bug in the Microsoft CRT, where fmod(x, +-infinity) yields NaN instead of x.
+inline double wtf_fmod(double x, double y) { return (!isinf(x) && isinf(y)) ? x : fmod(x, y); }
+
+// Work around a bug in the Microsoft CRT, where pow(NaN, 0) yields NaN instead of 1.
+inline double wtf_pow(double x, double y) { return y == 0 ? 1 : pow(x, y); }
+
+#define atan2(x, y) wtf_atan2(x, y)
+#define fmod(x, y) wtf_fmod(x, y)
+#define pow(x, y) wtf_pow(x, y)
+
+// MSVC's math functions do not bring lrint.
+inline long int lrint(double flt)
+{
+    int64_t intgr;
+#if CPU(X86)
+    __asm {
+        fld flt
+        fistp intgr
+    };
+#else
+    ASSERT(isfinite(flt));
+    double rounded = round(flt);
+    intgr = static_cast<int64_t>(rounded);
+    // If the fractional part is exactly 0.5, we need to check whether
+    // the rounded result is even. If it is not we need to add 1 to
+    // negative values and subtract one from positive values.
+    if ((fabs(intgr - flt) == 0.5) & intgr)
+        intgr -= ((intgr >> 62) | 1); // 1 with the sign of result, i.e. -1 or 1.
+#endif
+    return static_cast<long int>(intgr);
+}
+
+#endif // COMPILER(MSVC)
+
+inline double deg2rad(double d)  { return d * piDouble / 180.0; }
+inline double rad2deg(double r)  { return r * 180.0 / piDouble; }
+inline double deg2grad(double d) { return d * 400.0 / 360.0; }
+inline double grad2deg(double g) { return g * 360.0 / 400.0; }
+inline double turn2deg(double t) { return t * 360.0; }
+inline double deg2turn(double d) { return d / 360.0; }
+inline double rad2grad(double r) { return r * 200.0 / piDouble; }
+inline double grad2rad(double g) { return g * piDouble / 200.0; }
+
+inline float deg2rad(float d)  { return d * piFloat / 180.0f; }
+inline float rad2deg(float r)  { return r * 180.0f / piFloat; }
+inline float deg2grad(float d) { return d * 400.0f / 360.0f; }
+inline float grad2deg(float g) { return g * 360.0f / 400.0f; }
+inline float turn2deg(float t) { return t * 360.0f; }
+inline float deg2turn(float d) { return d / 360.0f; }
+inline float rad2grad(float r) { return r * 200.0f / piFloat; }
+inline float grad2rad(float g) { return g * piFloat / 200.0f; }
+
+// std::numeric_limits<T>::min() returns the smallest positive value for floating point types
+template<typename T> inline T defaultMinimumForClamp() { return std::numeric_limits<T>::min(); }
+template<> inline float defaultMinimumForClamp() { return -std::numeric_limits<float>::max(); }
+template<> inline double defaultMinimumForClamp() { return -std::numeric_limits<double>::max(); }
+template<typename T> inline T defaultMaximumForClamp() { return std::numeric_limits<T>::max(); }
+
+template<typename T> inline T clampTo(double value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>())
+{
+    if (value >= static_cast<double>(max))
+        return max;
+    if (value <= static_cast<double>(min))
+        return min;
+    return static_cast<T>(value);
+}
+template<> inline long long int clampTo(double, long long int, long long int); // clampTo does not support long long ints.
+
+inline int clampToInteger(double value)
+{
+    return clampTo<int>(value);
+}
+
+inline float clampToFloat(double value)
+{
+    return clampTo<float>(value);
+}
+
+inline int clampToPositiveInteger(double value)
+{
+    return clampTo<int>(value, 0);
+}
+
+inline int clampToInteger(float value)
+{
+    return clampTo<int>(value);
+}
+
+inline int clampToInteger(unsigned x)
+{
+    const unsigned intMax = static_cast<unsigned>(std::numeric_limits<int>::max());
+
+    if (x >= intMax)
+        return std::numeric_limits<int>::max();
+    return static_cast<int>(x);
+}
+
+inline bool isWithinIntRange(float x)
+{
+    return x > static_cast<float>(std::numeric_limits<int>::min()) && x < static_cast<float>(std::numeric_limits<int>::max());
+}
+
+template<typename T> inline bool hasZeroOrOneBitsSet(T value)
+{
+    return !((value - 1) & value);
+}
+
+template<typename T> inline bool hasTwoOrMoreBitsSet(T value)
+{
+    return !hasZeroOrOneBitsSet(value);
+}
+
+template<typename T> inline T timesThreePlusOneDividedByTwo(T value)
+{
+    // Mathematically equivalent to:
+    //   (value * 3 + 1) / 2;
+    // or:
+    //   (unsigned)ceil(value * 1.5));
+    // This form is not prone to internal overflow.
+    return value + (value >> 1) + (value & 1);
+}
+
+#if !COMPILER(MSVC) && !COMPILER(RVCT) && !OS(SOLARIS)
+using std::isfinite;
+#if !COMPILER_QUIRK(GCC11_GLOBAL_ISINF_ISNAN)
+using std::isinf;
+using std::isnan;
+#endif
+using std::signbit;
+#endif
+
+#if COMPILER_QUIRK(GCC11_GLOBAL_ISINF_ISNAN)
+// A workaround to avoid conflicting declarations of isinf and isnan when compiling with GCC in C++11 mode.
+namespace std {
+    inline bool wtf_isinf(float f) { return std::isinf(f); }
+    inline bool wtf_isinf(double d) { return std::isinf(d); }
+    inline bool wtf_isnan(float f) { return std::isnan(f); }
+    inline bool wtf_isnan(double d) { return std::isnan(d); }
+};
+
+using std::wtf_isinf;
+using std::wtf_isnan;
+
+#define isinf(x) wtf_isinf(x)
+#define isnan(x) wtf_isnan(x)
+#endif
+
+#ifndef UINT64_C
+#if COMPILER(MSVC)
+#define UINT64_C(c) c ## ui64
+#else
+#define UINT64_C(c) c ## ull
+#endif
+#endif
+
+
+// decompose 'number' to its sign, exponent, and mantissa components.
+// The result is interpreted as:
+//     (sign ? -1 : 1) * pow(2, exponent) * (mantissa / (1 << 52))
+inline void decomposeDouble(double number, bool& sign, int32_t& exponent, uint64_t& mantissa)
+{
+    ASSERT(isfinite(number));
+
+    sign = signbit(number);
+
+    uint64_t bits = WTF::bitwise_cast<uint64_t>(number);
+    exponent = (static_cast<int32_t>(bits >> 52) & 0x7ff) - 0x3ff;
+    mantissa = bits & 0xFFFFFFFFFFFFFull;
+
+    // Check for zero/denormal values; if so, adjust the exponent,
+    // if not insert the implicit, omitted leading 1 bit.
+    if (exponent == -0x3ff)
+        exponent = mantissa ? -0x3fe : 0;
+    else
+        mantissa |= 0x10000000000000ull;
+}
+
+// Calculate d % 2^{64}.
+inline void doubleToInteger(double d, unsigned long long& value)
+{
+    if (isnan(d) || isinf(d))
+        value = 0;
+    else {
+        // -2^{64} < fmodValue < 2^{64}.
+        double fmodValue = fmod(trunc(d), std::numeric_limits<unsigned long long>::max() + 1.0);
+        if (fmodValue >= 0) {
+            // 0 <= fmodValue < 2^{64}.
+            // 0 <= value < 2^{64}. This cast causes no loss.
+            value = static_cast<unsigned long long>(fmodValue);
+        } else {
+            // -2^{64} < fmodValue < 0.
+            // 0 < fmodValueInUnsignedLongLong < 2^{64}. This cast causes no loss.
+            unsigned long long fmodValueInUnsignedLongLong = static_cast<unsigned long long>(-fmodValue);
+            // -1 < (std::numeric_limits<unsigned long long>::max() - fmodValueInUnsignedLongLong) < 2^{64} - 1.
+            // 0 < value < 2^{64}.
+            value = std::numeric_limits<unsigned long long>::max() - fmodValueInUnsignedLongLong + 1;
+        }
+    }
+}
+
+#endif // #ifndef WTF_MathExtras_h
diff --git a/Source/WTF/wtf/MediaTime.cpp b/Source/WTF/wtf/MediaTime.cpp
new file mode 100644
index 0000000..6eb2bb0
--- /dev/null
+++ b/Source/WTF/wtf/MediaTime.cpp
@@ -0,0 +1,352 @@
+/*
+ * Copyright (C) 2012 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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 "config.h"
+#include "MediaTime.h"
+
+#include <algorithm>
+#include <wtf/CheckedArithmetic.h>
+#include <wtf/MathExtras.h>
+
+using namespace std;
+
+namespace WTF {
+
+static int32_t greatestCommonDivisor(int32_t a, int32_t b)
+{
+    // Euclid's Algorithm
+    int32_t temp = 0;
+    while (b) {
+        temp = b;
+        b = a % b;
+        a = temp;
+    }
+    return a;
+}
+
+static int32_t leastCommonMultiple(int32_t a, int32_t b, int32_t &result)
+{
+    return safeMultiply(a, b / greatestCommonDivisor(a, b), result);
+}
+
+const int32_t MediaTime::MaximumTimeScale = 0x7fffffffL;
+
+MediaTime::MediaTime()
+    : m_timeValue(0)
+    , m_timeScale(DefaultTimeScale)
+    , m_timeFlags(Valid)
+{
+}
+
+MediaTime::MediaTime(int64_t value, int32_t scale, uint32_t flags)
+    : m_timeValue(value)
+    , m_timeScale(scale)
+    , m_timeFlags(flags)
+{
+}
+
+MediaTime::~MediaTime()
+{
+}
+
+MediaTime::MediaTime(const MediaTime& rhs)
+{
+    *this = rhs;
+}
+
+MediaTime MediaTime::createWithFloat(float floatTime, int32_t timeScale)
+{
+    if (floatTime != floatTime)
+        return invalidTime();
+    if (isinf(floatTime))
+        return signbit(floatTime) ? negativeInfiniteTime() : positiveInfiniteTime();
+    if (floatTime > numeric_limits<int64_t>::max())
+        return positiveInfiniteTime();
+    if (floatTime < numeric_limits<int64_t>::min())
+        return negativeInfiniteTime();
+
+    while (floatTime * timeScale > numeric_limits<int64_t>::max())
+        timeScale /= 2;
+    return MediaTime(static_cast<int64_t>(floatTime * timeScale), timeScale, Valid);
+}
+
+MediaTime MediaTime::createWithDouble(double doubleTime, int32_t timeScale)
+{
+    if (doubleTime != doubleTime)
+        return invalidTime();
+    if (isinf(doubleTime))
+        return signbit(doubleTime) ? negativeInfiniteTime() : positiveInfiniteTime();
+    if (doubleTime > numeric_limits<int64_t>::max())
+        return positiveInfiniteTime();
+    if (doubleTime < numeric_limits<int64_t>::min())
+        return negativeInfiniteTime();
+
+    while (doubleTime * timeScale > numeric_limits<int64_t>::max())
+        timeScale /= 2;
+    return MediaTime(static_cast<int64_t>(doubleTime * timeScale), timeScale, Valid);
+}
+
+float MediaTime::toFloat() const
+{
+    if (isInvalid() || isIndefinite())
+        return std::numeric_limits<float>::quiet_NaN();
+    if (isPositiveInfinite())
+        return std::numeric_limits<float>::infinity();
+    if (isNegativeInfinite())
+        return -std::numeric_limits<float>::infinity();
+    return static_cast<float>(m_timeValue) / m_timeScale;
+}
+
+double MediaTime::toDouble() const
+{
+    if (isInvalid() || isIndefinite())
+        return std::numeric_limits<double>::quiet_NaN();
+    if (isPositiveInfinite())
+        return std::numeric_limits<double>::infinity();
+    if (isNegativeInfinite())
+        return -std::numeric_limits<double>::infinity();
+    return static_cast<double>(m_timeValue) / m_timeScale;
+}
+
+MediaTime& MediaTime::operator=(const MediaTime& rhs)
+{
+    m_timeValue = rhs.m_timeValue;
+    m_timeScale = rhs.m_timeScale;
+    m_timeFlags = rhs.m_timeFlags;
+    return *this;
+}
+
+MediaTime MediaTime::operator+(const MediaTime& rhs) const
+{
+    if (rhs.isInvalid() || isInvalid())
+        return invalidTime();
+
+    if (rhs.isIndefinite() || isIndefinite())
+        return indefiniteTime();
+
+    if (isPositiveInfinite()) {
+        if (rhs.isNegativeInfinite())
+            return invalidTime();
+        return positiveInfiniteTime();
+    }
+
+    if (isNegativeInfinite()) {
+        if (rhs.isPositiveInfinite())
+            return invalidTime();
+        return negativeInfiniteTime();
+    }
+
+    int32_t commonTimeScale;
+    if (!leastCommonMultiple(this->m_timeScale, rhs.m_timeScale, commonTimeScale) || commonTimeScale > MaximumTimeScale)
+        commonTimeScale = MaximumTimeScale;
+    MediaTime a = *this;
+    MediaTime b = rhs;
+    a.setTimeScale(commonTimeScale);
+    b.setTimeScale(commonTimeScale);
+    while (!safeAdd(a.m_timeValue, b.m_timeValue, a.m_timeValue)) {
+        if (commonTimeScale == 1)
+            return a.m_timeValue > 0 ? positiveInfiniteTime() : negativeInfiniteTime();
+        commonTimeScale /= 2;
+        a.setTimeScale(commonTimeScale);
+        b.setTimeScale(commonTimeScale);
+    }
+    return a;
+}
+
+MediaTime MediaTime::operator-(const MediaTime& rhs) const
+{
+    if (rhs.isInvalid() || isInvalid())
+        return invalidTime();
+
+    if (rhs.isIndefinite() || isIndefinite())
+        return indefiniteTime();
+
+    if (isPositiveInfinite()) {
+        if (rhs.isPositiveInfinite())
+            return invalidTime();
+        return positiveInfiniteTime();
+    }
+
+    if (isNegativeInfinite()) {
+        if (rhs.isNegativeInfinite())
+            return invalidTime();
+        return negativeInfiniteTime();
+    }
+
+    int32_t commonTimeScale;
+    if (!leastCommonMultiple(this->m_timeScale, rhs.m_timeScale, commonTimeScale) || commonTimeScale > MaximumTimeScale)
+        commonTimeScale = MaximumTimeScale;
+    MediaTime a = *this;
+    MediaTime b = rhs;
+    a.setTimeScale(commonTimeScale);
+    b.setTimeScale(commonTimeScale);
+    while (!safeSub(a.m_timeValue, b.m_timeValue, a.m_timeValue)) {
+        if (commonTimeScale == 1)
+            return a.m_timeValue > 0 ? positiveInfiniteTime() : negativeInfiniteTime();
+        commonTimeScale /= 2;
+        a.setTimeScale(commonTimeScale);
+        b.setTimeScale(commonTimeScale);
+    }
+    return a;
+}
+
+bool MediaTime::operator<(const MediaTime& rhs) const
+{
+    return compare(rhs) == LessThan;
+}
+
+bool MediaTime::operator>(const MediaTime& rhs) const
+{
+    return compare(rhs) == GreaterThan;
+}
+
+bool MediaTime::operator==(const MediaTime& rhs) const
+{
+    return compare(rhs) == EqualTo;
+}
+
+bool MediaTime::operator>=(const MediaTime& rhs) const
+{
+    return compare(rhs) >= EqualTo;
+}
+
+bool MediaTime::operator<=(const MediaTime& rhs) const
+{
+    return compare(rhs) <= EqualTo;
+}
+
+MediaTime::ComparisonFlags MediaTime::compare(const MediaTime& rhs) const
+{
+    if ((isPositiveInfinite() && rhs.isPositiveInfinite())
+        || (isNegativeInfinite() && rhs.isNegativeInfinite())
+        || (isInvalid() && rhs.isInvalid())
+        || (isIndefinite() && rhs.isIndefinite()))
+        return EqualTo;
+
+    if (isInvalid())
+        return GreaterThan;
+
+    if (rhs.isInvalid())
+        return LessThan;
+
+    if (rhs.isNegativeInfinite() || isPositiveInfinite())
+        return GreaterThan;
+
+    if (rhs.isPositiveInfinite() || isNegativeInfinite())
+        return LessThan;
+
+    if (isIndefinite())
+        return GreaterThan;
+
+    if (rhs.isIndefinite())
+        return LessThan;
+
+    int64_t rhsWhole = rhs.m_timeValue / rhs.m_timeScale;
+    int64_t lhsWhole = m_timeValue / m_timeScale;
+    if (lhsWhole > rhsWhole)
+        return GreaterThan;
+    if (lhsWhole < rhsWhole)
+        return LessThan;
+
+    int64_t rhsRemain = rhs.m_timeValue % rhs.m_timeScale;
+    int64_t lhsRemain = m_timeValue % m_timeScale;
+    int64_t lhsFactor = lhsRemain * rhs.m_timeScale;
+    int64_t rhsFactor = rhsRemain * m_timeScale;
+
+    if (lhsFactor == rhsFactor)
+        return EqualTo;
+    return lhsFactor > rhsFactor ? GreaterThan : LessThan;
+}
+
+const MediaTime& MediaTime::zeroTime()
+{
+    static const MediaTime* time = new MediaTime(0, 1, Valid);
+    return *time;
+}
+
+const MediaTime& MediaTime::invalidTime()
+{
+    static const MediaTime* time = new MediaTime(-1, 1, 0);
+    return *time;
+}
+
+const MediaTime& MediaTime::positiveInfiniteTime()
+{
+    static const MediaTime* time = new MediaTime(0, 1, PositiveInfinite | Valid);
+    return *time;
+}
+
+const MediaTime& MediaTime::negativeInfiniteTime()
+{
+    static const MediaTime* time = new MediaTime(-1, 1, NegativeInfinite | Valid);
+    return *time;
+}
+
+const MediaTime& MediaTime::indefiniteTime()
+{
+    static const MediaTime* time = new MediaTime(0, 1, Indefinite | Valid);
+    return *time;
+}
+
+void MediaTime::setTimeScale(int32_t timeScale)
+{
+    if (timeScale == m_timeScale)
+        return;
+    timeScale = std::min(MaximumTimeScale, timeScale);
+    int64_t wholePart = m_timeValue / m_timeScale;
+
+    // If setting the time scale will cause an overflow, divide the
+    // timescale by two until the number will fit, and round the
+    // result.
+    int64_t newWholePart;
+    while (!safeMultiply(wholePart, timeScale, newWholePart))
+        timeScale /= 2;
+
+    int64_t remainder = m_timeValue % m_timeScale;
+    m_timeValue = newWholePart + (remainder * timeScale) / m_timeScale;
+    m_timeScale = timeScale;
+}
+
+static int32_t signum(int64_t val)
+{
+    return (0 < val) - (val < 0);
+}
+
+MediaTime abs(const MediaTime& rhs)
+{
+    if (rhs.isInvalid())
+        return MediaTime::invalidTime();
+    if (rhs.isNegativeInfinite() || rhs.isPositiveInfinite())
+        return MediaTime::positiveInfiniteTime();
+    MediaTime val = rhs;
+    val.m_timeValue *= signum(rhs.m_timeScale) * signum(rhs.m_timeValue);
+    return val;
+}
+
+}
+
diff --git a/Source/WTF/wtf/MediaTime.h b/Source/WTF/wtf/MediaTime.h
new file mode 100755
index 0000000..413b1a7
--- /dev/null
+++ b/Source/WTF/wtf/MediaTime.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2012 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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 "FastAllocBase.h"
+
+#include <cmath>
+#include <limits>
+#include <math.h>
+#include <stdint.h>
+
+namespace WTF {
+
+class WTF_EXPORT_PRIVATE MediaTime {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    enum {
+        Valid = 1 << 0,
+        HasBeenRounded = 1 << 1,
+        PositiveInfinite = 1 << 2,
+        NegativeInfinite = 1 << 3,
+        Indefinite = 1 << 4,
+    };
+
+    MediaTime();
+    MediaTime(int64_t value, int32_t scale = DefaultTimeScale, uint32_t flags = Valid);
+    MediaTime(const MediaTime& rhs);
+    ~MediaTime();
+
+    static MediaTime createWithFloat(float floatTime, int32_t timeScale = DefaultTimeScale);
+    static MediaTime createWithDouble(double doubleTime, int32_t timeScale = DefaultTimeScale);
+
+    float toFloat() const;
+    double toDouble() const;
+
+    MediaTime& operator=(const MediaTime& rhs);
+    MediaTime operator+(const MediaTime& rhs) const;
+    MediaTime operator-(const MediaTime& rhs) const;
+    bool operator<(const MediaTime& rhs) const;
+    bool operator>(const MediaTime& rhs) const;
+    bool operator==(const MediaTime& rhs) const;
+    bool operator>=(const MediaTime& rhs) const;
+    bool operator<=(const MediaTime& rhs) const;
+
+    typedef enum {
+        LessThan = -1,
+        EqualTo = 0,
+        GreaterThan = 1,
+    } ComparisonFlags;
+
+    ComparisonFlags compare(const MediaTime& rhs) const;
+
+    bool isValid() const { return m_timeFlags & Valid; }
+    bool isInvalid() const { return !isValid(); }
+    bool hasBeenRounded() const { return m_timeFlags & HasBeenRounded; }
+    bool isPositiveInfinite() const { return m_timeFlags & PositiveInfinite; }
+    bool isNegativeInfinite() const { return m_timeFlags & NegativeInfinite; }
+    bool isIndefinite() const { return m_timeFlags & Indefinite; }
+
+    static const MediaTime& zeroTime();
+    static const MediaTime& invalidTime();
+    static const MediaTime& positiveInfiniteTime();
+    static const MediaTime& negativeInfiniteTime();
+    static const MediaTime& indefiniteTime();
+
+    const int64_t& timeValue() const { return m_timeValue; }
+    const int32_t& timeScale() const { return m_timeScale; }
+
+    friend WTF_EXPORT_PRIVATE MediaTime abs(const MediaTime& rhs);
+private:
+    static const int32_t DefaultTimeScale = 6000;
+    static const int32_t MaximumTimeScale;
+
+    void setTimeScale(int32_t);
+
+    int64_t m_timeValue;
+    int32_t m_timeScale;
+    uint32_t m_timeFlags;
+};
+
+WTF_EXPORT_PRIVATE extern MediaTime abs(const MediaTime& rhs);
+}
+
+using WTF::MediaTime;
+using WTF::abs;
diff --git a/Source/WTF/wtf/MemoryInstrumentation.h b/Source/WTF/wtf/MemoryInstrumentation.h
new file mode 100644
index 0000000..997f412
--- /dev/null
+++ b/Source/WTF/wtf/MemoryInstrumentation.h
@@ -0,0 +1,303 @@
+/*
+ * Copyright (C) 2012 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.
+ *     * 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.
+ *     * 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 MemoryInstrumentation_h
+#define MemoryInstrumentation_h
+
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WTF {
+
+class MemoryClassInfo;
+class MemoryObjectInfo;
+class MemoryInstrumentation;
+
+typedef const char* MemoryObjectType;
+
+enum MemoryOwningType {
+    byPointer,
+    byReference
+};
+
+class MemoryObjectInfo {
+public:
+    MemoryObjectInfo(MemoryInstrumentation* memoryInstrumentation, MemoryObjectType ownerObjectType)
+        : m_memoryInstrumentation(memoryInstrumentation)
+        , m_objectType(ownerObjectType)
+        , m_objectSize(0)
+        , m_pointer(0)
+    { }
+
+    typedef MemoryClassInfo ClassInfo;
+
+    MemoryObjectType objectType() const { return m_objectType; }
+    size_t objectSize() const { return m_objectSize; }
+    const void* reportedPointer() const { return m_pointer; }
+
+    MemoryInstrumentation* memoryInstrumentation() { return m_memoryInstrumentation; }
+
+private:
+    friend class MemoryClassInfo;
+    friend class MemoryInstrumentation;
+
+    void reportObjectInfo(const void* pointer, MemoryObjectType objectType, size_t objectSize)
+    {
+        if (!m_objectSize) {
+            m_pointer = pointer;
+            m_objectSize = objectSize;
+            if (objectType)
+                m_objectType = objectType;
+        }
+    }
+
+    MemoryInstrumentation* m_memoryInstrumentation;
+    MemoryObjectType m_objectType;
+    size_t m_objectSize;
+    const void* m_pointer;
+};
+
+template<typename T> void reportMemoryUsage(const T* const&, MemoryObjectInfo*);
+
+class MemoryInstrumentationClient {
+public:
+    virtual ~MemoryInstrumentationClient() { }
+    virtual void countObjectSize(const void*, MemoryObjectType, size_t) = 0;
+    virtual bool visited(const void*) = 0;
+    virtual void checkCountedObject(const void*) = 0;
+};
+
+class MemoryInstrumentation {
+public:
+    explicit MemoryInstrumentation(MemoryInstrumentationClient* client) : m_client(client) { }
+    virtual ~MemoryInstrumentation() { }
+
+    template <typename T> void addRootObject(const T& t, MemoryObjectType objectType = 0)
+    {
+        addObject(t, objectType);
+        processDeferredInstrumentedPointers();
+    }
+
+protected:
+    class InstrumentedPointerBase {
+    public:
+        virtual ~InstrumentedPointerBase() { }
+        virtual void process(MemoryInstrumentation*) = 0;
+    };
+
+private:
+    void countObjectSize(const void* object, MemoryObjectType objectType, size_t size) { m_client->countObjectSize(object, objectType, size); }
+    bool visited(const void* pointer) { return m_client->visited(pointer); }
+    void checkCountedObject(const void* pointer) { return m_client->checkCountedObject(pointer); }
+
+    virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) = 0;
+    virtual void processDeferredInstrumentedPointers() = 0;
+
+    friend class MemoryClassInfo;
+    template<typename T> friend void reportMemoryUsage(const T* const&, MemoryObjectInfo*);
+
+    template<typename T> static void selectInstrumentationMethod(const T* const& object, MemoryObjectInfo* memoryObjectInfo)
+    {
+        // If there is reportMemoryUsage method on the object, call it.
+        // Otherwise count only object's self size.
+        reportObjectMemoryUsage<T, void (T::*)(MemoryObjectInfo*) const>(object, memoryObjectInfo, 0);
+    }
+
+    template<typename Type, Type Ptr> struct MemberHelperStruct;
+    template<typename T, typename Type>
+    static void reportObjectMemoryUsage(const T* const& object, MemoryObjectInfo* memoryObjectInfo,  MemberHelperStruct<Type, &T::reportMemoryUsage>*)
+    {
+        object->reportMemoryUsage(memoryObjectInfo);
+    }
+
+    template<typename T, typename Type>
+    static void reportObjectMemoryUsage(const T* const& object, MemoryObjectInfo* memoryObjectInfo, ...)
+    {
+        memoryObjectInfo->reportObjectInfo(object, 0, sizeof(T));
+    }
+
+    template<typename T>
+    static void countNotInstrumentedObject(const T* const&, MemoryObjectInfo*);
+
+    template<typename T> class InstrumentedPointer : public InstrumentedPointerBase {
+    public:
+        explicit InstrumentedPointer(const T* pointer, MemoryObjectType ownerObjectType) : m_pointer(pointer), m_ownerObjectType(ownerObjectType) { }
+        virtual void process(MemoryInstrumentation*) OVERRIDE;
+
+    private:
+        const T* m_pointer;
+        const MemoryObjectType m_ownerObjectType;
+    };
+
+    template<typename T> void addObject(const T& t, MemoryObjectType ownerObjectType) { OwningTraits<T>::addObject(this, t, ownerObjectType); }
+    void addRawBuffer(const void* const& buffer, MemoryObjectType ownerObjectType, size_t size)
+    {
+        if (!buffer || visited(buffer))
+            return;
+        countObjectSize(buffer, ownerObjectType, size);
+    }
+
+    template<typename T>
+    struct OwningTraits { // Default byReference implementation.
+        static void addObject(MemoryInstrumentation* instrumentation, const T& t, MemoryObjectType ownerObjectType)
+        {
+            instrumentation->addObjectImpl(&t, ownerObjectType, byReference);
+        }
+    };
+
+    template<typename T>
+    struct OwningTraits<T*> { // Custom byPointer implementation.
+        static void addObject(MemoryInstrumentation* instrumentation, const T* const& t, MemoryObjectType ownerObjectType)
+        {
+            instrumentation->addObjectImpl(t, ownerObjectType, byPointer);
+        }
+    };
+
+    template<typename T> void addObjectImpl(const T* const&, MemoryObjectType, MemoryOwningType);
+    template<typename T> void addObjectImpl(const OwnPtr<T>* const&, MemoryObjectType, MemoryOwningType);
+    template<typename T> void addObjectImpl(const RefPtr<T>* const&, MemoryObjectType, MemoryOwningType);
+
+    MemoryInstrumentationClient* m_client;
+};
+
+class MemoryClassInfo {
+public:
+    template<typename T>
+    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T* pointer, MemoryObjectType objectType = 0, size_t actualSize = 0)
+        : m_memoryObjectInfo(memoryObjectInfo)
+        , m_memoryInstrumentation(memoryObjectInfo->memoryInstrumentation())
+    {
+        m_memoryObjectInfo->reportObjectInfo(pointer, objectType, actualSize ? actualSize : sizeof(T));
+        m_objectType = memoryObjectInfo->objectType();
+    }
+
+    template<typename M> void addMember(const M& member) { m_memoryInstrumentation->addObject(member, m_objectType); }
+    void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); }
+    void addPrivateBuffer(size_t size, MemoryObjectType ownerObjectType = 0)
+    {
+        if (size)
+            m_memoryInstrumentation->countObjectSize(0, ownerObjectType ? ownerObjectType : m_objectType, size);
+    }
+
+    void addWeakPointer(void*) { }
+
+private:
+    MemoryObjectInfo* m_memoryObjectInfo;
+    MemoryInstrumentation* m_memoryInstrumentation;
+    MemoryObjectType m_objectType;
+};
+
+template<typename T>
+void reportMemoryUsage(const T* const& object, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryInstrumentation::selectInstrumentationMethod<T>(object, memoryObjectInfo);
+}
+
+template<typename T>
+void MemoryInstrumentation::addObjectImpl(const T* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
+{
+    if (owningType == byReference) {
+        MemoryObjectInfo memoryObjectInfo(this, ownerObjectType);
+        reportMemoryUsage(object, &memoryObjectInfo);
+    } else {
+        if (!object || visited(object))
+            return;
+        deferInstrumentedPointer(adoptPtr(new InstrumentedPointer<T>(object, ownerObjectType)));
+    }
+}
+
+template<typename T>
+void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
+{
+    if (owningType == byPointer && !visited(object))
+        countObjectSize(object, ownerObjectType, sizeof(*object));
+    addObjectImpl(object->get(), ownerObjectType, byPointer);
+}
+
+template<typename T>
+void MemoryInstrumentation::addObjectImpl(const RefPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
+{
+    if (owningType == byPointer && !visited(object))
+        countObjectSize(object, ownerObjectType, sizeof(*object));
+    addObjectImpl(object->get(), ownerObjectType, byPointer);
+}
+
+template<typename T>
+void MemoryInstrumentation::InstrumentedPointer<T>::process(MemoryInstrumentation* memoryInstrumentation)
+{
+    MemoryObjectInfo memoryObjectInfo(memoryInstrumentation, m_ownerObjectType);
+    reportMemoryUsage(m_pointer, &memoryObjectInfo);
+
+    const void* pointer = memoryObjectInfo.reportedPointer();
+    ASSERT(pointer);
+    if (pointer != m_pointer && memoryInstrumentation->visited(pointer))
+        return;
+    memoryInstrumentation->countObjectSize(pointer, memoryObjectInfo.objectType(), memoryObjectInfo.objectSize());
+    memoryInstrumentation->checkCountedObject(pointer);
+}
+
+// Link time guard for classes with external memory instrumentation.
+template<typename T, size_t inlineCapacity> class Vector;
+template<typename T, size_t inlineCapacity> void reportMemoryUsage(const Vector<T, inlineCapacity>* const&, MemoryObjectInfo*);
+
+template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> class HashMap;
+template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> void reportMemoryUsage(const HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>* const&, MemoryObjectInfo*);
+
+template<typename ValueArg, typename HashArg, typename TraitsArg> class HashCountedSet;
+template<typename ValueArg, typename HashArg, typename TraitsArg> void reportMemoryUsage(const HashCountedSet<ValueArg, HashArg, TraitsArg>* const&, MemoryObjectInfo*);
+
+template<typename ValueArg, size_t inlineCapacity, typename HashArg> class ListHashSet;
+template<typename ValueArg, size_t inlineCapacity, typename HashArg> void reportMemoryUsage(const ListHashSet<ValueArg, inlineCapacity, HashArg>* const&, MemoryObjectInfo*);
+
+class String;
+void reportMemoryUsage(const String* const&, MemoryObjectInfo*);
+
+class StringImpl;
+void reportMemoryUsage(const StringImpl* const&, MemoryObjectInfo*);
+
+class AtomicString;
+void reportMemoryUsage(const AtomicString* const&, MemoryObjectInfo*);
+
+class CString;
+void reportMemoryUsage(const CString* const&, MemoryObjectInfo*);
+
+class CStringBuffer;
+void reportMemoryUsage(const CStringBuffer* const&, MemoryObjectInfo*);
+
+class ParsedURL;
+void reportMemoryUsage(const ParsedURL* const&, MemoryObjectInfo*);
+
+class URLString;
+void reportMemoryUsage(const URLString* const&, MemoryObjectInfo*);
+
+} // namespace WTF
+
+#endif // !defined(MemoryInstrumentation_h)
diff --git a/Source/WTF/wtf/MemoryInstrumentationArrayBufferView.h b/Source/WTF/wtf/MemoryInstrumentationArrayBufferView.h
new file mode 100644
index 0000000..006f451
--- /dev/null
+++ b/Source/WTF/wtf/MemoryInstrumentationArrayBufferView.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2012 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.
+ *     * 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.
+ *     * 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 MemoryInstrumentationArrayBufferView_h
+#define MemoryInstrumentationArrayBufferView_h
+
+#include <wtf/ArrayBufferView.h>
+#include <wtf/MemoryInstrumentation.h>
+
+namespace WTF {
+
+inline void reportMemoryUsage(const ArrayBufferView* const& arrayBufferView, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, arrayBufferView);
+    info.addMember(arrayBufferView->buffer().get());
+}
+
+inline void reportMemoryUsage(const ArrayBuffer* const& arrayBuffer, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, arrayBuffer);
+    info.addRawBuffer(arrayBuffer->data(), arrayBuffer->byteLength());
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationArrayBufferView_h)
diff --git a/Source/WTF/wtf/MemoryInstrumentationHashCountedSet.h b/Source/WTF/wtf/MemoryInstrumentationHashCountedSet.h
new file mode 100644
index 0000000..6238401
--- /dev/null
+++ b/Source/WTF/wtf/MemoryInstrumentationHashCountedSet.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2012 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.
+ *     * 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.
+ *     * 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 MemoryInstrumentationHashCountedSet_h
+#define MemoryInstrumentationHashCountedSet_h
+
+#include <wtf/HashCountedSet.h>
+#include <wtf/MemoryInstrumentationSequence.h>
+
+namespace WTF {
+
+template<typename ValueArg, typename HashArg, typename TraitsArg>
+void reportMemoryUsage(const HashCountedSet<ValueArg, HashArg, TraitsArg>* const& hashSet, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, hashSet);
+
+    typedef HashMap<ValueArg, unsigned, HashArg, TraitsArg> HashMapType;
+    info.addPrivateBuffer(sizeof(typename HashMapType::ValueType) * hashSet->capacity());
+    reportSequenceMemoryUsage<ValueArg, typename HashMapType::const_iterator::Keys>(hashSet->begin().keys(), hashSet->end().keys(), info);
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationHashCountedSet_h)
diff --git a/Source/WTF/wtf/MemoryInstrumentationHashMap.h b/Source/WTF/wtf/MemoryInstrumentationHashMap.h
new file mode 100644
index 0000000..699c4eb
--- /dev/null
+++ b/Source/WTF/wtf/MemoryInstrumentationHashMap.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2012 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.
+ *     * 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.
+ *     * 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 MemoryInstrumentationHashMap_h
+#define MemoryInstrumentationHashMap_h
+
+#include <wtf/HashMap.h>
+#include <wtf/MemoryInstrumentationSequence.h>
+
+namespace WTF {
+
+template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg>
+void reportMemoryUsage(const HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>* const& hashMap, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, hashMap);
+    typedef HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> HashMapType;
+    info.addPrivateBuffer(sizeof(typename HashMapType::ValueType) * hashMap->capacity());
+
+    reportSequenceMemoryUsage<KeyArg, typename HashMapType::const_iterator::Keys>(hashMap->begin().keys(), hashMap->end().keys(), info);
+    reportSequenceMemoryUsage<MappedArg, typename HashMapType::const_iterator::Values>(hashMap->begin().values(), hashMap->end().values(), info);
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationHashMap_h)
diff --git a/Source/WTF/wtf/MemoryInstrumentationHashSet.h b/Source/WTF/wtf/MemoryInstrumentationHashSet.h
new file mode 100644
index 0000000..aa1567b
--- /dev/null
+++ b/Source/WTF/wtf/MemoryInstrumentationHashSet.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 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.
+ *     * 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.
+ *     * 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 MemoryInstrumentationHashSet_h
+#define MemoryInstrumentationHashSet_h
+
+#include <wtf/HashSet.h>
+#include <wtf/MemoryInstrumentationSequence.h>
+
+namespace WTF {
+
+template<typename ValueArg, typename HashArg, typename TraitsArg>
+void reportMemoryUsage(const HashSet<ValueArg, HashArg, TraitsArg>* const& hashSet, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, hashSet);
+    info.addPrivateBuffer(sizeof(typename HashTable<ValueArg, ValueArg, IdentityExtractor, HashArg, TraitsArg, TraitsArg>::ValueType) * hashSet->capacity());
+    reportSequenceMemoryUsage<ValueArg, typename HashSet<ValueArg, HashArg, TraitsArg>::const_iterator>(hashSet->begin(), hashSet->end(), info);
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationHashSet_h)
diff --git a/Source/WTF/wtf/MemoryInstrumentationListHashSet.h b/Source/WTF/wtf/MemoryInstrumentationListHashSet.h
new file mode 100644
index 0000000..0e31c56
--- /dev/null
+++ b/Source/WTF/wtf/MemoryInstrumentationListHashSet.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 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.
+ *     * 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.
+ *     * 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 MemoryInstrumentationListHashSet_h
+#define MemoryInstrumentationListHashSet_h
+
+#include <wtf/ListHashSet.h>
+#include <wtf/MemoryInstrumentationSequence.h>
+
+namespace WTF {
+
+template<typename ValueArg, size_t inlineCapacity, typename HashArg>
+void reportMemoryUsage(const ListHashSet<ValueArg, inlineCapacity, HashArg>* const& set, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, set);
+    info.addPrivateBuffer(set->sizeInBytes() - sizeof(*set));
+    reportSequenceMemoryUsage<ValueArg, typename ListHashSet<ValueArg, inlineCapacity, HashArg>::const_iterator>(set->begin(), set->end(), info);
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationListHashSet_h)
diff --git a/Source/WTF/wtf/MemoryInstrumentationParsedURL.h b/Source/WTF/wtf/MemoryInstrumentationParsedURL.h
new file mode 100644
index 0000000..c1f4972
--- /dev/null
+++ b/Source/WTF/wtf/MemoryInstrumentationParsedURL.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 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.
+ *     * 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.
+ *     * 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 MemoryInstrumentationParsedURL_h
+#define MemoryInstrumentationParsedURL_h
+
+#include <wtf/MemoryInstrumentation.h>
+#include <wtf/MemoryInstrumentationString.h>
+#include <wtf/url/api/ParsedURL.h>
+
+namespace WTF {
+
+inline void reportMemoryUsage(const URLString* const& urlString, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, urlString);
+    info.addMember(urlString->string());
+}
+
+inline void reportMemoryUsage(const ParsedURL* const& parsedURL, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, parsedURL);
+    info.addMember(parsedURL->spec());
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationiParsedURL_h)
diff --git a/Source/WTF/wtf/MemoryInstrumentationSequence.h b/Source/WTF/wtf/MemoryInstrumentationSequence.h
new file mode 100644
index 0000000..bbf204c
--- /dev/null
+++ b/Source/WTF/wtf/MemoryInstrumentationSequence.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 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.
+ *     * 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.
+ *     * 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 MemoryInstrumentationSequence_h
+#define MemoryInstrumentationSequence_h
+
+#include <wtf/MemoryInstrumentation.h>
+#include <wtf/TypeTraits.h>
+
+namespace WTF {
+
+template<typename ValueType>
+struct SequenceMemoryInstrumentationTraits {
+    template <typename I> static void reportMemoryUsage(I iterator, I end, MemoryClassInfo& info)
+    {
+        while (iterator != end) {
+            info.addMember(*iterator);
+            ++iterator;
+        }
+    }
+};
+
+template<> struct SequenceMemoryInstrumentationTraits<int> {
+    template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
+};
+
+template<> struct SequenceMemoryInstrumentationTraits<void*> {
+    template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
+};
+
+template<> struct SequenceMemoryInstrumentationTraits<char*> {
+    template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
+};
+
+template<> struct SequenceMemoryInstrumentationTraits<const char*> {
+    template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
+};
+
+template<> struct SequenceMemoryInstrumentationTraits<const void*> {
+    template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
+};
+
+template<typename ValueType, typename I> void reportSequenceMemoryUsage(I begin, I end, MemoryClassInfo& info)
+{
+    // Check if type is convertible to integer to handle iteration through enum values.
+    SequenceMemoryInstrumentationTraits<typename Conditional<IsConvertibleToInteger<ValueType>::value, int, ValueType>::Type>::reportMemoryUsage(begin, end, info);
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationSequence_h)
diff --git a/Source/WTF/wtf/MemoryInstrumentationString.h b/Source/WTF/wtf/MemoryInstrumentationString.h
new file mode 100644
index 0000000..6e8800f
--- /dev/null
+++ b/Source/WTF/wtf/MemoryInstrumentationString.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2012 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.
+ *     * 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.
+ *     * 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 MemoryInstrumentationString_h
+#define MemoryInstrumentationString_h
+
+#include <wtf/MemoryInstrumentation.h>
+#include <wtf/text/AtomicString.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+inline void reportMemoryUsage(const StringImpl* const& stringImpl, MemoryObjectInfo* memoryObjectInfo)
+{
+    size_t selfSize = sizeof(StringImpl);
+
+    size_t length = stringImpl->length() + (stringImpl->hasTerminatingNullCharacter() ? 1 : 0);
+    size_t bufferSize = length * (stringImpl->is8Bit() ? sizeof(LChar) : sizeof(UChar));
+    const void* buffer = stringImpl->is8Bit() ? static_cast<const void*>(stringImpl->characters8()) : static_cast<const void*>(stringImpl->characters16());
+
+    // Count size used by internal buffer but skip strings that were constructed from literals.
+    if (stringImpl->hasInternalBuffer() && buffer == stringImpl + 1)
+        selfSize += bufferSize;
+
+    MemoryClassInfo info(memoryObjectInfo, stringImpl, 0, selfSize);
+
+    if (StringImpl* baseString = stringImpl->baseString())
+        info.addMember(baseString);
+    else {
+        if (stringImpl->hasOwnedBuffer())
+            info.addRawBuffer(buffer, bufferSize);
+
+        if (stringImpl->has16BitShadow())
+            info.addRawBuffer(stringImpl->characters(), length * sizeof(UChar));
+    }
+}
+
+inline void reportMemoryUsage(const String* const& string, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, string);
+    info.addMember(string->impl());
+}
+
+inline void reportMemoryUsage(const AtomicString* const& atomicString, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, atomicString);
+    info.addMember(atomicString->string());
+}
+
+inline void reportMemoryUsage(const CStringBuffer* const& cStringBuffer, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, cStringBuffer, 0, sizeof(*cStringBuffer) + cStringBuffer->length());
+}
+
+inline void reportMemoryUsage(const CString* const& cString, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, cString);
+    info.addMember(cString->buffer());
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationVector_h)
diff --git a/Source/WTF/wtf/MemoryInstrumentationVector.h b/Source/WTF/wtf/MemoryInstrumentationVector.h
new file mode 100644
index 0000000..406b983
--- /dev/null
+++ b/Source/WTF/wtf/MemoryInstrumentationVector.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 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.
+ *     * 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.
+ *     * 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 MemoryInstrumentationVector_h
+#define MemoryInstrumentationVector_h
+
+#include <wtf/MemoryInstrumentationSequence.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+template<typename T, size_t inlineCapacity>
+void reportMemoryUsage(const Vector<T, inlineCapacity>* const& vector, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, vector);
+    if (inlineCapacity < vector->capacity())
+        info.addRawBuffer(vector->data(), vector->capacity() * sizeof(T));
+    reportSequenceMemoryUsage<T, typename Vector<T, inlineCapacity>::const_iterator>(vector->begin(), vector->end(), info);
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationVector_h)
diff --git a/Source/WTF/wtf/MessageQueue.h b/Source/WTF/wtf/MessageQueue.h
new file mode 100644
index 0000000..dda852f
--- /dev/null
+++ b/Source/WTF/wtf/MessageQueue.h
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 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:
+ *
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef MessageQueue_h
+#define MessageQueue_h
+
+#include <limits>
+#include <wtf/Assertions.h>
+#include <wtf/Deque.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Threading.h>
+
+namespace WTF {
+
+    enum MessageQueueWaitResult {
+        MessageQueueTerminated,       // Queue was destroyed while waiting for message.
+        MessageQueueTimeout,          // Timeout was specified and it expired.
+        MessageQueueMessageReceived   // A message was successfully received and returned.
+    };
+
+    // The queue takes ownership of messages and transfer it to the new owner
+    // when messages are fetched from the queue.
+    // Essentially, MessageQueue acts as a queue of OwnPtr<DataType>.
+    template<typename DataType>
+    class MessageQueue {
+        WTF_MAKE_NONCOPYABLE(MessageQueue);
+    public:
+        MessageQueue() : m_killed(false) { }
+        ~MessageQueue();
+
+        void append(PassOwnPtr<DataType>);
+        bool appendAndCheckEmpty(PassOwnPtr<DataType>);
+        void prepend(PassOwnPtr<DataType>);
+
+        PassOwnPtr<DataType> waitForMessage();
+        PassOwnPtr<DataType> tryGetMessage();
+        PassOwnPtr<DataType> tryGetMessageIgnoringKilled();
+        template<typename Predicate>
+        PassOwnPtr<DataType> waitForMessageFilteredWithTimeout(MessageQueueWaitResult&, Predicate&, double absoluteTime);
+
+        template<typename Predicate>
+        void removeIf(Predicate&);
+
+        void kill();
+        bool killed() const;
+
+        // The result of isEmpty() is only valid if no other thread is manipulating the queue at the same time.
+        bool isEmpty();
+
+        static double infiniteTime() { return std::numeric_limits<double>::max(); }
+
+    private:
+        static bool alwaysTruePredicate(DataType*) { return true; }
+
+        mutable Mutex m_mutex;
+        ThreadCondition m_condition;
+        Deque<DataType*> m_queue;
+        bool m_killed;
+    };
+
+    template<typename DataType>
+    MessageQueue<DataType>::~MessageQueue()
+    {
+        deleteAllValues(m_queue);
+    }
+
+    template<typename DataType>
+    inline void MessageQueue<DataType>::append(PassOwnPtr<DataType> message)
+    {
+        MutexLocker lock(m_mutex);
+        m_queue.append(message.leakPtr());
+        m_condition.signal();
+    }
+
+    // Returns true if the queue was empty before the item was added.
+    template<typename DataType>
+    inline bool MessageQueue<DataType>::appendAndCheckEmpty(PassOwnPtr<DataType> message)
+    {
+        MutexLocker lock(m_mutex);
+        bool wasEmpty = m_queue.isEmpty();
+        m_queue.append(message.leakPtr());
+        m_condition.signal();
+        return wasEmpty;
+    }
+
+    template<typename DataType>
+    inline void MessageQueue<DataType>::prepend(PassOwnPtr<DataType> message)
+    {
+        MutexLocker lock(m_mutex);
+        m_queue.prepend(message.leakPtr());
+        m_condition.signal();
+    }
+
+    template<typename DataType>
+    inline PassOwnPtr<DataType> MessageQueue<DataType>::waitForMessage()
+    {
+        MessageQueueWaitResult exitReason; 
+        OwnPtr<DataType> result = waitForMessageFilteredWithTimeout(exitReason, MessageQueue<DataType>::alwaysTruePredicate, infiniteTime());
+        ASSERT(exitReason == MessageQueueTerminated || exitReason == MessageQueueMessageReceived);
+        return result.release();
+    }
+
+    template<typename DataType>
+    template<typename Predicate>
+    inline PassOwnPtr<DataType> MessageQueue<DataType>::waitForMessageFilteredWithTimeout(MessageQueueWaitResult& result, Predicate& predicate, double absoluteTime)
+    {
+        MutexLocker lock(m_mutex);
+        bool timedOut = false;
+
+        DequeConstIterator<DataType*> found = m_queue.end();
+        while (!m_killed && !timedOut && (found = m_queue.findIf(predicate)) == m_queue.end())
+            timedOut = !m_condition.timedWait(m_mutex, absoluteTime);
+
+        ASSERT(!timedOut || absoluteTime != infiniteTime());
+
+        if (m_killed) {
+            result = MessageQueueTerminated;
+            return nullptr;
+        }
+
+        if (timedOut) {
+            result = MessageQueueTimeout;
+            return nullptr;
+        }
+
+        ASSERT(found != m_queue.end());
+        OwnPtr<DataType> message = adoptPtr(*found);
+        m_queue.remove(found);
+        result = MessageQueueMessageReceived;
+        return message.release();
+    }
+
+    template<typename DataType>
+    inline PassOwnPtr<DataType> MessageQueue<DataType>::tryGetMessage()
+    {
+        MutexLocker lock(m_mutex);
+        if (m_killed)
+            return nullptr;
+        if (m_queue.isEmpty())
+            return nullptr;
+
+        return adoptPtr(m_queue.takeFirst());
+    }
+
+    template<typename DataType>
+    inline PassOwnPtr<DataType> MessageQueue<DataType>::tryGetMessageIgnoringKilled()
+    {
+        MutexLocker lock(m_mutex);
+        if (m_queue.isEmpty())
+            return nullptr;
+
+        return adoptPtr(m_queue.takeFirst());
+    }
+
+    template<typename DataType>
+    template<typename Predicate>
+    inline void MessageQueue<DataType>::removeIf(Predicate& predicate)
+    {
+        MutexLocker lock(m_mutex);
+        DequeConstIterator<DataType*> found = m_queue.end();
+        while ((found = m_queue.findIf(predicate)) != m_queue.end()) {
+            DataType* message = *found;
+            m_queue.remove(found);
+            delete message;
+        }
+    }
+
+    template<typename DataType>
+    inline bool MessageQueue<DataType>::isEmpty()
+    {
+        MutexLocker lock(m_mutex);
+        if (m_killed)
+            return true;
+        return m_queue.isEmpty();
+    }
+
+    template<typename DataType>
+    inline void MessageQueue<DataType>::kill()
+    {
+        MutexLocker lock(m_mutex);
+        m_killed = true;
+        m_condition.broadcast();
+    }
+
+    template<typename DataType>
+    inline bool MessageQueue<DataType>::killed() const
+    {
+        MutexLocker lock(m_mutex);
+        return m_killed;
+    }
+} // namespace WTF
+
+using WTF::MessageQueue;
+// MessageQueueWaitResult enum and all its values.
+using WTF::MessageQueueWaitResult;
+using WTF::MessageQueueTerminated;
+using WTF::MessageQueueTimeout;
+using WTF::MessageQueueMessageReceived;
+
+#endif // MessageQueue_h
diff --git a/Source/WTF/wtf/MetaAllocator.cpp b/Source/WTF/wtf/MetaAllocator.cpp
new file mode 100644
index 0000000..73b36aa
--- /dev/null
+++ b/Source/WTF/wtf/MetaAllocator.cpp
@@ -0,0 +1,459 @@
+/*
+ * Copyright (C) 2011 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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 "config.h"
+#include "MetaAllocator.h"
+
+#include <wtf/DataLog.h>
+#include <wtf/FastMalloc.h>
+
+namespace WTF {
+
+MetaAllocator::~MetaAllocator()
+{
+    for (FreeSpaceNode* node = m_freeSpaceSizeMap.first(); node;) {
+        FreeSpaceNode* next = node->successor();
+        m_freeSpaceSizeMap.remove(node);
+        freeFreeSpaceNode(node);
+        node = next;
+    }
+    m_lock.Finalize();
+#ifndef NDEBUG
+    ASSERT(!m_mallocBalance);
+#endif
+}
+
+void MetaAllocatorTracker::notify(MetaAllocatorHandle* handle)
+{
+    m_allocations.insert(handle);
+}
+
+void MetaAllocatorTracker::release(MetaAllocatorHandle* handle)
+{
+    m_allocations.remove(handle);
+}
+
+ALWAYS_INLINE void MetaAllocator::release(MetaAllocatorHandle* handle)
+{
+    SpinLockHolder locker(&m_lock);
+    if (handle->sizeInBytes()) {
+        decrementPageOccupancy(handle->start(), handle->sizeInBytes());
+        addFreeSpaceFromReleasedHandle(handle->start(), handle->sizeInBytes());
+    }
+
+    if (UNLIKELY(!!m_tracker))
+        m_tracker->release(handle);
+}
+
+MetaAllocatorHandle::MetaAllocatorHandle(MetaAllocator* allocator, void* start, size_t sizeInBytes, void* ownerUID)
+    : m_allocator(allocator)
+    , m_start(start)
+    , m_sizeInBytes(sizeInBytes)
+    , m_ownerUID(ownerUID)
+{
+    ASSERT(allocator);
+    ASSERT(start);
+    ASSERT(sizeInBytes);
+}
+
+MetaAllocatorHandle::~MetaAllocatorHandle()
+{
+    ASSERT(m_allocator);
+    m_allocator->release(this);
+}
+
+void MetaAllocatorHandle::shrink(size_t newSizeInBytes)
+{
+    ASSERT(newSizeInBytes <= m_sizeInBytes);
+    
+    SpinLockHolder locker(&m_allocator->m_lock);
+
+    newSizeInBytes = m_allocator->roundUp(newSizeInBytes);
+    
+    ASSERT(newSizeInBytes <= m_sizeInBytes);
+    
+    if (newSizeInBytes == m_sizeInBytes)
+        return;
+    
+    uintptr_t freeStart = reinterpret_cast<uintptr_t>(m_start) + newSizeInBytes;
+    size_t freeSize = m_sizeInBytes - newSizeInBytes;
+    uintptr_t freeEnd = freeStart + freeSize;
+    
+    uintptr_t firstCompletelyFreePage = (freeStart + m_allocator->m_pageSize - 1) & ~(m_allocator->m_pageSize - 1);
+    if (firstCompletelyFreePage < freeEnd)
+        m_allocator->decrementPageOccupancy(reinterpret_cast<void*>(firstCompletelyFreePage), freeSize - (firstCompletelyFreePage - freeStart));
+    
+    m_allocator->addFreeSpaceFromReleasedHandle(reinterpret_cast<void*>(freeStart), freeSize);
+    
+    m_sizeInBytes = newSizeInBytes;
+}
+
+MetaAllocator::MetaAllocator(size_t allocationGranule)
+    : m_allocationGranule(allocationGranule)
+    , m_pageSize(pageSize())
+    , m_bytesAllocated(0)
+    , m_bytesReserved(0)
+    , m_bytesCommitted(0)
+    , m_tracker(0)
+#ifndef NDEBUG
+    , m_mallocBalance(0)
+#endif
+#if ENABLE(META_ALLOCATOR_PROFILE)
+    , m_numAllocations(0)
+    , m_numFrees(0)
+#endif
+{
+    m_lock.Init();
+    
+    for (m_logPageSize = 0; m_logPageSize < 32; ++m_logPageSize) {
+        if (static_cast<size_t>(1) << m_logPageSize == m_pageSize)
+            break;
+    }
+    
+    ASSERT(static_cast<size_t>(1) << m_logPageSize == m_pageSize);
+    
+    for (m_logAllocationGranule = 0; m_logAllocationGranule < 32; ++m_logAllocationGranule) {
+        if (static_cast<size_t>(1) << m_logAllocationGranule == m_allocationGranule)
+            break;
+    }
+    
+    ASSERT(static_cast<size_t>(1) << m_logAllocationGranule == m_allocationGranule);
+}
+
+PassRefPtr<MetaAllocatorHandle> MetaAllocator::allocate(size_t sizeInBytes, void* ownerUID)
+{
+    SpinLockHolder locker(&m_lock);
+
+    if (!sizeInBytes)
+        return 0;
+    
+    sizeInBytes = roundUp(sizeInBytes);
+    
+    void* start = findAndRemoveFreeSpace(sizeInBytes);
+    if (!start) {
+        size_t requestedNumberOfPages = (sizeInBytes + m_pageSize - 1) >> m_logPageSize;
+        size_t numberOfPages = requestedNumberOfPages;
+        
+        start = allocateNewSpace(numberOfPages);
+        if (!start)
+            return 0;
+        
+        ASSERT(numberOfPages >= requestedNumberOfPages);
+        
+        size_t roundedUpSize = numberOfPages << m_logPageSize;
+        
+        ASSERT(roundedUpSize >= sizeInBytes);
+        
+        m_bytesReserved += roundedUpSize;
+        
+        if (roundedUpSize > sizeInBytes) {
+            void* freeSpaceStart = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(start) + sizeInBytes);
+            size_t freeSpaceSize = roundedUpSize - sizeInBytes;
+            addFreeSpace(freeSpaceStart, freeSpaceSize);
+        }
+    }
+    incrementPageOccupancy(start, sizeInBytes);
+    m_bytesAllocated += sizeInBytes;
+#if ENABLE(META_ALLOCATOR_PROFILE)
+    m_numAllocations++;
+#endif
+
+    MetaAllocatorHandle* handle = new MetaAllocatorHandle(this, start, sizeInBytes, ownerUID);
+
+    if (UNLIKELY(!!m_tracker))
+        m_tracker->notify(handle);
+
+    return adoptRef(handle);
+}
+
+MetaAllocator::Statistics MetaAllocator::currentStatistics()
+{
+    SpinLockHolder locker(&m_lock);
+    Statistics result;
+    result.bytesAllocated = m_bytesAllocated;
+    result.bytesReserved = m_bytesReserved;
+    result.bytesCommitted = m_bytesCommitted;
+    return result;
+}
+
+void* MetaAllocator::findAndRemoveFreeSpace(size_t sizeInBytes)
+{
+    FreeSpaceNode* node = m_freeSpaceSizeMap.findLeastGreaterThanOrEqual(sizeInBytes);
+    
+    if (!node)
+        return 0;
+    
+    ASSERT(node->m_sizeInBytes >= sizeInBytes);
+    
+    m_freeSpaceSizeMap.remove(node);
+    
+    void* result;
+    
+    if (node->m_sizeInBytes == sizeInBytes) {
+        // Easy case: perfect fit, so just remove the node entirely.
+        result = node->m_start;
+        
+        m_freeSpaceStartAddressMap.remove(node->m_start);
+        m_freeSpaceEndAddressMap.remove(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(node->m_start) + node->m_sizeInBytes));
+        freeFreeSpaceNode(node);
+    } else {
+        // Try to be a good citizen and ensure that the returned chunk of memory
+        // straddles as few pages as possible, but only insofar as doing so will
+        // not increase fragmentation. The intuition is that minimizing
+        // fragmentation is a strictly higher priority than minimizing the number
+        // of committed pages, since in the long run, smaller fragmentation means
+        // fewer committed pages and fewer failures in general.
+        
+        uintptr_t firstPage = reinterpret_cast<uintptr_t>(node->m_start) >> m_logPageSize;
+        uintptr_t lastPage = (reinterpret_cast<uintptr_t>(node->m_start) + node->m_sizeInBytes - 1) >> m_logPageSize;
+    
+        uintptr_t lastPageForLeftAllocation = (reinterpret_cast<uintptr_t>(node->m_start) + sizeInBytes - 1) >> m_logPageSize;
+        uintptr_t firstPageForRightAllocation = (reinterpret_cast<uintptr_t>(node->m_start) + node->m_sizeInBytes - sizeInBytes) >> m_logPageSize;
+        
+        if (lastPageForLeftAllocation - firstPage + 1 <= lastPage - firstPageForRightAllocation + 1) {
+            // Allocate in the left side of the returned chunk, and slide the node to the right.
+            result = node->m_start;
+            
+            m_freeSpaceStartAddressMap.remove(node->m_start);
+            
+            node->m_sizeInBytes -= sizeInBytes;
+            node->m_start = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(node->m_start) + sizeInBytes);
+            
+            m_freeSpaceSizeMap.insert(node);
+            m_freeSpaceStartAddressMap.add(node->m_start, node);
+        } else {
+            // Allocate in the right size of the returned chunk, and slide the node to the left;
+            
+            result = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(node->m_start) + node->m_sizeInBytes - sizeInBytes);
+            
+            m_freeSpaceEndAddressMap.remove(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(node->m_start) + node->m_sizeInBytes));
+            
+            node->m_sizeInBytes -= sizeInBytes;
+            
+            m_freeSpaceSizeMap.insert(node);
+            m_freeSpaceEndAddressMap.add(result, node);
+        }
+    }
+    
+#if ENABLE(META_ALLOCATOR_PROFILE)
+    dumpProfile();
+#endif
+
+    return result;
+}
+
+void MetaAllocator::addFreeSpaceFromReleasedHandle(void* start, size_t sizeInBytes)
+{
+#if ENABLE(META_ALLOCATOR_PROFILE)
+    m_numFrees++;
+#endif
+    m_bytesAllocated -= sizeInBytes;
+    addFreeSpace(start, sizeInBytes);
+}
+
+void MetaAllocator::addFreshFreeSpace(void* start, size_t sizeInBytes)
+{
+    SpinLockHolder locker(&m_lock);
+    m_bytesReserved += sizeInBytes;
+    addFreeSpace(start, sizeInBytes);
+}
+
+size_t MetaAllocator::debugFreeSpaceSize()
+{
+#ifndef NDEBUG
+    SpinLockHolder locker(&m_lock);
+    size_t result = 0;
+    for (FreeSpaceNode* node = m_freeSpaceSizeMap.first(); node; node = node->successor())
+        result += node->m_sizeInBytes;
+    return result;
+#else
+    CRASH();
+    return 0;
+#endif
+}
+
+void MetaAllocator::addFreeSpace(void* start, size_t sizeInBytes)
+{
+    void* end = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(start) + sizeInBytes);
+    
+    HashMap<void*, FreeSpaceNode*>::iterator leftNeighbor = m_freeSpaceEndAddressMap.find(start);
+    HashMap<void*, FreeSpaceNode*>::iterator rightNeighbor = m_freeSpaceStartAddressMap.find(end);
+    
+    if (leftNeighbor != m_freeSpaceEndAddressMap.end()) {
+        // We have something we can coalesce with on the left. Remove it from the tree, and
+        // remove its end from the end address map.
+        
+        ASSERT(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(leftNeighbor->value->m_start) + leftNeighbor->value->m_sizeInBytes) == leftNeighbor->key);
+        
+        FreeSpaceNode* leftNode = leftNeighbor->value;
+        
+        void* leftStart = leftNode->m_start;
+        size_t leftSize = leftNode->m_sizeInBytes;
+        void* leftEnd = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(leftStart) + leftSize);
+        
+        ASSERT(leftEnd == start);
+        
+        m_freeSpaceSizeMap.remove(leftNode);
+        m_freeSpaceEndAddressMap.remove(leftEnd);
+        
+        // Now check if there is also something to coalesce with on the right.
+        if (rightNeighbor != m_freeSpaceStartAddressMap.end()) {
+            // Freeing something in the middle of free blocks. Coalesce both left and
+            // right, whilst removing the right neighbor from the maps.
+            
+            ASSERT(rightNeighbor->value->m_start == rightNeighbor->key);
+            
+            FreeSpaceNode* rightNode = rightNeighbor->value;
+            void* rightStart = rightNeighbor->key;
+            size_t rightSize = rightNode->m_sizeInBytes;
+            void* rightEnd = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(rightStart) + rightSize);
+            
+            ASSERT(rightStart == end);
+            ASSERT(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(leftStart) + leftSize + sizeInBytes + rightSize) == rightEnd);
+            
+            m_freeSpaceSizeMap.remove(rightNode);
+            m_freeSpaceStartAddressMap.remove(rightStart);
+            m_freeSpaceEndAddressMap.remove(rightEnd);
+            
+            freeFreeSpaceNode(rightNode);
+            
+            leftNode->m_sizeInBytes += sizeInBytes + rightSize;
+            
+            m_freeSpaceSizeMap.insert(leftNode);
+            m_freeSpaceEndAddressMap.add(rightEnd, leftNode);
+        } else {
+            leftNode->m_sizeInBytes += sizeInBytes;
+            
+            m_freeSpaceSizeMap.insert(leftNode);
+            m_freeSpaceEndAddressMap.add(end, leftNode);
+        }
+    } else {
+        // Cannot coalesce with left; try to see if we can coalesce with right.
+        
+        if (rightNeighbor != m_freeSpaceStartAddressMap.end()) {
+            FreeSpaceNode* rightNode = rightNeighbor->value;
+            void* rightStart = rightNeighbor->key;
+            size_t rightSize = rightNode->m_sizeInBytes;
+            void* rightEnd = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(rightStart) + rightSize);
+            
+            ASSERT(rightStart == end);
+            ASSERT_UNUSED(rightEnd, reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(start) + sizeInBytes + rightSize) == rightEnd);
+            
+            m_freeSpaceSizeMap.remove(rightNode);
+            m_freeSpaceStartAddressMap.remove(rightStart);
+            
+            rightNode->m_sizeInBytes += sizeInBytes;
+            rightNode->m_start = start;
+            
+            m_freeSpaceSizeMap.insert(rightNode);
+            m_freeSpaceStartAddressMap.add(start, rightNode);
+        } else {
+            // Nothing to coalesce with, so create a new free space node and add it.
+            
+            FreeSpaceNode* node = allocFreeSpaceNode();
+            
+            node->m_sizeInBytes = sizeInBytes;
+            node->m_start = start;
+            
+            m_freeSpaceSizeMap.insert(node);
+            m_freeSpaceStartAddressMap.add(start, node);
+            m_freeSpaceEndAddressMap.add(end, node);
+        }
+    }
+    
+#if ENABLE(META_ALLOCATOR_PROFILE)
+    dumpProfile();
+#endif
+}
+
+void MetaAllocator::incrementPageOccupancy(void* address, size_t sizeInBytes)
+{
+    uintptr_t firstPage = reinterpret_cast<uintptr_t>(address) >> m_logPageSize;
+    uintptr_t lastPage = (reinterpret_cast<uintptr_t>(address) + sizeInBytes - 1) >> m_logPageSize;
+    
+    for (uintptr_t page = firstPage; page <= lastPage; ++page) {
+        HashMap<uintptr_t, size_t>::iterator iter = m_pageOccupancyMap.find(page);
+        if (iter == m_pageOccupancyMap.end()) {
+            m_pageOccupancyMap.add(page, 1);
+            m_bytesCommitted += m_pageSize;
+            notifyNeedPage(reinterpret_cast<void*>(page << m_logPageSize));
+        } else
+            iter->value++;
+    }
+}
+
+void MetaAllocator::decrementPageOccupancy(void* address, size_t sizeInBytes)
+{
+    uintptr_t firstPage = reinterpret_cast<uintptr_t>(address) >> m_logPageSize;
+    uintptr_t lastPage = (reinterpret_cast<uintptr_t>(address) + sizeInBytes - 1) >> m_logPageSize;
+    
+    for (uintptr_t page = firstPage; page <= lastPage; ++page) {
+        HashMap<uintptr_t, size_t>::iterator iter = m_pageOccupancyMap.find(page);
+        ASSERT(iter != m_pageOccupancyMap.end());
+        if (!--(iter->value)) {
+            m_pageOccupancyMap.remove(iter);
+            m_bytesCommitted -= m_pageSize;
+            notifyPageIsFree(reinterpret_cast<void*>(page << m_logPageSize));
+        }
+    }
+}
+
+size_t MetaAllocator::roundUp(size_t sizeInBytes)
+{
+    if (std::numeric_limits<size_t>::max() - m_allocationGranule <= sizeInBytes)
+        CRASH();
+    return (sizeInBytes + m_allocationGranule - 1) & ~(m_allocationGranule - 1);
+}
+
+MetaAllocator::FreeSpaceNode* MetaAllocator::allocFreeSpaceNode()
+{
+#ifndef NDEBUG
+    m_mallocBalance++;
+#endif
+    return new (NotNull, fastMalloc(sizeof(FreeSpaceNode))) FreeSpaceNode(0, 0);
+}
+
+void MetaAllocator::freeFreeSpaceNode(FreeSpaceNode* node)
+{
+#ifndef NDEBUG
+    m_mallocBalance--;
+#endif
+    fastFree(node);
+}
+
+#if ENABLE(META_ALLOCATOR_PROFILE)
+void MetaAllocator::dumpProfile()
+{
+    dataLog("%d: MetaAllocator(%p): num allocations = %u, num frees = %u, allocated = %lu, reserved = %lu, committed = %lu\n",
+            getpid(), this, m_numAllocations, m_numFrees, m_bytesAllocated, m_bytesReserved, m_bytesCommitted);
+}
+#endif
+
+} // namespace WTF
+
+
diff --git a/Source/WTF/wtf/MetaAllocator.h b/Source/WTF/wtf/MetaAllocator.h
new file mode 100644
index 0000000..ece6412
--- /dev/null
+++ b/Source/WTF/wtf/MetaAllocator.h
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2011 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef WTF_MetaAllocator_h
+#define WTF_MetaAllocator_h
+
+#include <wtf/Assertions.h>
+#include <wtf/HashMap.h>
+#include <wtf/MetaAllocatorHandle.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/PageBlock.h>
+#include <wtf/RedBlackTree.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/TCSpinLock.h>
+
+namespace WTF {
+
+#define ENABLE_META_ALLOCATOR_PROFILE 0
+
+class MetaAllocatorTracker {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    void notify(MetaAllocatorHandle*);
+    void release(MetaAllocatorHandle*);
+
+    MetaAllocatorHandle* find(void* address)
+    {
+        MetaAllocatorHandle* handle = m_allocations.findGreatestLessThanOrEqual(address);
+        if (handle && address < handle->end())
+            return handle;
+        return 0;
+    }
+
+    RedBlackTree<MetaAllocatorHandle, void*> m_allocations;
+};
+
+class MetaAllocator {
+    WTF_MAKE_NONCOPYABLE(MetaAllocator);
+
+public:
+    WTF_EXPORT_PRIVATE MetaAllocator(size_t allocationGranule);
+    
+    WTF_EXPORT_PRIVATE virtual ~MetaAllocator();
+    
+    WTF_EXPORT_PRIVATE PassRefPtr<MetaAllocatorHandle> allocate(size_t sizeInBytes, void* ownerUID);
+
+    void trackAllocations(MetaAllocatorTracker* tracker)
+    {
+        m_tracker = tracker;
+    }
+    
+    // Non-atomic methods for getting allocator statistics.
+    size_t bytesAllocated() { return m_bytesAllocated; }
+    size_t bytesReserved() { return m_bytesReserved; }
+    size_t bytesCommitted() { return m_bytesCommitted; }
+    
+    // Atomic method for getting allocator statistics.
+    struct Statistics {
+        size_t bytesAllocated;
+        size_t bytesReserved;
+        size_t bytesCommitted;
+    };
+    Statistics currentStatistics();
+
+    // Add more free space to the allocator. Call this directly from
+    // the constructor if you wish to operate the allocator within a
+    // fixed pool.
+    WTF_EXPORT_PRIVATE void addFreshFreeSpace(void* start, size_t sizeInBytes);
+
+    // This is meant only for implementing tests. Never call this in release
+    // builds.
+    WTF_EXPORT_PRIVATE size_t debugFreeSpaceSize();
+    
+#if ENABLE(META_ALLOCATOR_PROFILE)
+    void dumpProfile();
+#else
+    void dumpProfile() { }
+#endif
+
+protected:
+    
+    // Allocate new virtual space, but don't commit. This may return more
+    // pages than we asked, in which case numPages is changed.
+    virtual void* allocateNewSpace(size_t& numPages) = 0;
+    
+    // Commit a page.
+    virtual void notifyNeedPage(void* page) = 0;
+    
+    // Uncommit a page.
+    virtual void notifyPageIsFree(void* page) = 0;
+    
+    // NOTE: none of the above methods are called during allocator
+    // destruction, in part because a MetaAllocator cannot die so long
+    // as there are Handles that refer to it.
+
+private:
+    
+    friend class MetaAllocatorHandle;
+    
+    class FreeSpaceNode : public RedBlackTree<FreeSpaceNode, size_t>::Node {
+    public:
+        FreeSpaceNode(void* start, size_t sizeInBytes)
+            : m_start(start)
+            , m_sizeInBytes(sizeInBytes)
+        {
+        }
+
+        size_t key()
+        {
+            return m_sizeInBytes;
+        }
+
+        void* m_start;
+        size_t m_sizeInBytes;
+    };
+    typedef RedBlackTree<FreeSpaceNode, size_t> Tree;
+
+    // Release a MetaAllocatorHandle.
+    void release(MetaAllocatorHandle*);
+    
+    // Remove free space from the allocator. This is effectively
+    // the allocate() function, except that it does not mark the
+    // returned space as being in-use.
+    void* findAndRemoveFreeSpace(size_t sizeInBytes);
+
+    // This is called when memory from an allocation is freed.
+    void addFreeSpaceFromReleasedHandle(void* start, size_t sizeInBytes);
+    
+    // This is the low-level implementation of adding free space; it
+    // is called from both addFreeSpaceFromReleasedHandle and from
+    // addFreshFreeSpace.
+    void addFreeSpace(void* start, size_t sizeInBytes);
+    
+    // Management of used space.
+    
+    void incrementPageOccupancy(void* address, size_t sizeInBytes);
+    void decrementPageOccupancy(void* address, size_t sizeInBytes);
+
+    // Utilities.
+    
+    size_t roundUp(size_t sizeInBytes);
+    
+    FreeSpaceNode* allocFreeSpaceNode();
+    WTF_EXPORT_PRIVATE void freeFreeSpaceNode(FreeSpaceNode*);
+    
+    size_t m_allocationGranule;
+    unsigned m_logAllocationGranule;
+    size_t m_pageSize;
+    unsigned m_logPageSize;
+    
+    Tree m_freeSpaceSizeMap;
+    HashMap<void*, FreeSpaceNode*> m_freeSpaceStartAddressMap;
+    HashMap<void*, FreeSpaceNode*> m_freeSpaceEndAddressMap;
+    HashMap<uintptr_t, size_t> m_pageOccupancyMap;
+    
+    size_t m_bytesAllocated;
+    size_t m_bytesReserved;
+    size_t m_bytesCommitted;
+    
+    SpinLock m_lock;
+
+    MetaAllocatorTracker* m_tracker;
+
+#ifndef NDEBUG
+    size_t m_mallocBalance;
+#endif
+
+#if ENABLE(META_ALLOCATOR_PROFILE)
+    unsigned m_numAllocations;
+    unsigned m_numFrees;
+#endif
+};
+
+} // namespace WTF
+
+#endif // WTF_MetaAllocator_h
+
diff --git a/Source/WTF/wtf/MetaAllocatorHandle.h b/Source/WTF/wtf/MetaAllocatorHandle.h
new file mode 100644
index 0000000..242e0b8
--- /dev/null
+++ b/Source/WTF/wtf/MetaAllocatorHandle.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2011 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef WTF_MetaAllocatorHandle_h
+#define WTF_MetaAllocatorHandle_h
+
+#include <wtf/Assertions.h>
+#include <wtf/RedBlackTree.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WTF {
+
+class MetaAllocator;
+
+class MetaAllocatorHandle : public RefCounted<MetaAllocatorHandle>, public RedBlackTree<MetaAllocatorHandle, void*>::Node {
+private:
+    MetaAllocatorHandle(MetaAllocator*, void* start, size_t sizeInBytes, void* ownerUID);
+    
+public:
+    WTF_EXPORT_PRIVATE ~MetaAllocatorHandle();
+    
+    void* start() const
+    {
+        return m_start;
+    }
+    
+    void* end() const
+    {
+        return reinterpret_cast<void*>(endAsInteger());
+    }
+    
+    uintptr_t startAsInteger() const
+    {
+        return reinterpret_cast<uintptr_t>(m_start);
+    }
+    
+    uintptr_t endAsInteger() const
+    {
+        return startAsInteger() + m_sizeInBytes;
+    }
+        
+    size_t sizeInBytes() const
+    {
+        return m_sizeInBytes;
+    }
+        
+    WTF_EXPORT_PRIVATE void shrink(size_t newSizeInBytes);
+    
+    bool isManaged()
+    {
+        return !!m_allocator;
+    }
+        
+    MetaAllocator* allocator()
+    {
+        ASSERT(m_allocator);
+        return m_allocator;
+    }
+
+    void* ownerUID()
+    {
+        return m_ownerUID;
+    }
+
+    void* key()
+    {
+        return m_start;
+    }
+    
+private:
+    friend class MetaAllocator;
+    
+    MetaAllocator* m_allocator;
+    void* m_start;
+    size_t m_sizeInBytes;
+    void* m_ownerUID;
+};
+
+}
+
+#endif
diff --git a/Source/WTF/wtf/NonCopyingSort.h b/Source/WTF/wtf/NonCopyingSort.h
new file mode 100644
index 0000000..fd611bd
--- /dev/null
+++ b/Source/WTF/wtf/NonCopyingSort.h
@@ -0,0 +1,89 @@
+/*
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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_NonCopyingSort_h
+#define WTF_NonCopyingSort_h
+
+namespace WTF {
+
+using std::swap;
+
+template<typename RandomAccessIterator, typename Predicate>
+inline void siftDown(RandomAccessIterator array, ptrdiff_t start, ptrdiff_t end, Predicate compareLess) 
+{
+    ptrdiff_t root = start;
+
+    while (root * 2 + 1 <= end) {
+        ptrdiff_t child = root * 2 + 1;
+        if (child < end && compareLess(array[child], array[child + 1]))
+            child++;
+        
+        if (compareLess(array[root], array[child])) {
+            swap(array[root], array[child]);
+            root = child;
+        } else
+            return;
+    }
+}
+
+template<typename RandomAccessIterator, typename Predicate>
+inline void heapify(RandomAccessIterator array, ptrdiff_t count, Predicate compareLess) 
+{
+    ptrdiff_t start = (count - 2) / 2;
+     
+    while (start >= 0) {
+        siftDown(array, start, count - 1, compareLess);
+        start--;
+    }
+}
+
+template<typename RandomAccessIterator, typename Predicate>
+void heapSort(RandomAccessIterator start, RandomAccessIterator end, Predicate compareLess)
+{
+    ptrdiff_t count = end - start;
+    heapify(start, count, compareLess);
+
+    ptrdiff_t endIndex = count - 1;
+    while (endIndex > 0) {
+        swap(start[endIndex], start[0]);
+        siftDown(start, 0, endIndex - 1, compareLess);
+        endIndex--;
+    }
+}
+
+template<typename RandomAccessIterator, typename Predicate>
+inline void nonCopyingSort(RandomAccessIterator start, RandomAccessIterator end, Predicate compareLess)
+{
+    // heapsort happens to use only swaps, not copies, but the essential thing about
+    // this function is the fact that it does not copy, not the specific algorithm
+    heapSort(start, end, compareLess);
+}
+
+} // namespace WTF
+
+using WTF::nonCopyingSort;
+
+#endif // WTF_NonCopyingSort_h
diff --git a/Source/WTF/wtf/Noncopyable.h b/Source/WTF/wtf/Noncopyable.h
new file mode 100644
index 0000000..f6bdfbb
--- /dev/null
+++ b/Source/WTF/wtf/Noncopyable.h
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (C) 2006, 2010 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_Noncopyable_h
+#define WTF_Noncopyable_h
+
+#include <wtf/Compiler.h>
+
+#if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
+    #define WTF_MAKE_NONCOPYABLE(ClassName) \
+        private: \
+            ClassName(const ClassName&) = delete; \
+            ClassName& operator=(const ClassName&) = delete;
+#else
+    #define WTF_MAKE_NONCOPYABLE(ClassName) \
+        private: \
+            ClassName(const ClassName&); \
+            ClassName& operator=(const ClassName&)
+#endif
+
+#endif // WTF_Noncopyable_h
diff --git a/Source/WTF/wtf/NotFound.h b/Source/WTF/wtf/NotFound.h
new file mode 100644
index 0000000..4263bce
--- /dev/null
+++ b/Source/WTF/wtf/NotFound.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2008 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. ``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
+ * 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 NotFound_h
+#define NotFound_h
+
+namespace WTF {
+
+    const size_t notFound = static_cast<size_t>(-1);
+
+} // namespace WTF
+
+using WTF::notFound;
+
+#endif // NotFound_h
diff --git a/Source/WTF/wtf/NullPtr.cpp b/Source/WTF/wtf/NullPtr.cpp
new file mode 100644
index 0000000..d6b0429
--- /dev/null
+++ b/Source/WTF/wtf/NullPtr.cpp
@@ -0,0 +1,34 @@
+/*
+
+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 "config.h"
+#include "NullPtr.h"
+
+#if !(COMPILER_SUPPORTS(CXX_NULLPTR) || defined(_LIBCPP_VERSION))
+
+std::nullptr_t nullptr;
+
+#endif
diff --git a/Source/WTF/wtf/NullPtr.h b/Source/WTF/wtf/NullPtr.h
new file mode 100644
index 0000000..98c0514
--- /dev/null
+++ b/Source/WTF/wtf/NullPtr.h
@@ -0,0 +1,56 @@
+/*
+
+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.
+
+*/
+
+#ifndef NullPtr_h
+#define NullPtr_h
+
+// For compilers and standard libraries that do not yet include it, this adds the
+// nullptr_t type and nullptr object. They are defined in the same namespaces they
+// would be in compiler and library that had the support.
+
+#include <ciso646>
+
+#if COMPILER_SUPPORTS(CXX_NULLPTR) || defined(_LIBCPP_VERSION)
+
+#include <cstddef>
+
+// libstdc++ supports nullptr_t starting with gcc 4.6.
+#if defined(__GLIBCXX__) && __GLIBCXX__ < 20110325
+namespace std {
+typedef decltype(nullptr) nullptr_t;
+}
+#endif
+
+#else
+
+namespace std {
+class WTF_EXPORT_PRIVATE nullptr_t { };
+}
+extern WTF_EXPORT_PRIVATE std::nullptr_t nullptr;
+
+#endif
+
+#endif
diff --git a/Source/WTF/wtf/NumberOfCores.cpp b/Source/WTF/wtf/NumberOfCores.cpp
new file mode 100644
index 0000000..4bbdb94
--- /dev/null
+++ b/Source/WTF/wtf/NumberOfCores.cpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2012 University of Szeged. 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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 "NumberOfCores.h"
+
+#if OS(DARWIN) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
+#include <sys/param.h>
+// sys/types.h must come before sys/sysctl.h because the latter uses
+// data types defined in the former. See sysctl(3) and style(9).
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#elif OS(LINUX) || OS(AIX) || OS(SOLARIS)
+#include <unistd.h>
+#elif OS(WINDOWS) || OS(QNX)
+#include <wtf/UnusedParam.h>
+#if OS(WINDOWS)
+#include <windows.h>
+#elif OS(QNX)
+#include <sys/syspage.h>
+#endif
+#endif
+
+namespace WTF {
+
+int numberOfProcessorCores()
+{
+    const int defaultIfUnavailable = 1;
+    static int s_numberOfCores = -1;
+
+    if (s_numberOfCores > 0)
+        return s_numberOfCores;
+
+#if OS(DARWIN) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
+    unsigned result;
+    size_t length = sizeof(result);
+    int name[] = {
+            CTL_HW,
+            HW_NCPU
+    };
+    int sysctlResult = sysctl(name, sizeof(name) / sizeof(int), &result, &length, 0, 0);
+
+    s_numberOfCores = sysctlResult < 0 ? defaultIfUnavailable : result;
+#elif OS(LINUX) || OS(AIX) || OS(SOLARIS)
+    long sysconfResult = sysconf(_SC_NPROCESSORS_ONLN);
+
+    s_numberOfCores = sysconfResult < 0 ? defaultIfUnavailable : static_cast<int>(sysconfResult);
+#elif OS(WINDOWS)
+    UNUSED_PARAM(defaultIfUnavailable);
+    SYSTEM_INFO sysInfo;
+    GetSystemInfo(&sysInfo);
+
+    s_numberOfCores = sysInfo.dwNumberOfProcessors;
+#elif OS(QNX)
+    UNUSED_PARAM(defaultIfUnavailable);
+
+    s_numberOfCores = _syspage_ptr->num_cpu;
+#else
+    s_numberOfCores = defaultIfUnavailable;
+#endif
+    return s_numberOfCores;
+}
+
+}
diff --git a/Source/WTF/wtf/NumberOfCores.h b/Source/WTF/wtf/NumberOfCores.h
new file mode 100644
index 0000000..8bc8d94
--- /dev/null
+++ b/Source/WTF/wtf/NumberOfCores.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2012 University of Szeged. 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 NumberOfCores_h
+#define NumberOfCores_h
+
+namespace WTF {
+
+int numberOfProcessorCores();
+
+}
+
+#endif
diff --git a/Source/WTF/wtf/OSAllocator.h b/Source/WTF/wtf/OSAllocator.h
new file mode 100644
index 0000000..a12a467
--- /dev/null
+++ b/Source/WTF/wtf/OSAllocator.h
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ */
+
+#ifndef OSAllocator_h
+#define OSAllocator_h
+
+#include <algorithm>
+#include <wtf/UnusedParam.h>
+#include <wtf/VMTags.h>
+
+namespace WTF {
+
+class OSAllocator {
+public:
+    enum Usage {
+        UnknownUsage = -1,
+        FastMallocPages = VM_TAG_FOR_TCMALLOC_MEMORY,
+        JSGCHeapPages = VM_TAG_FOR_COLLECTOR_MEMORY,
+        JSVMStackPages = VM_TAG_FOR_REGISTERFILE_MEMORY,
+        JSJITCodePages = VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY,
+    };
+
+    // These methods are symmetric; reserveUncommitted allocates VM in an uncommitted state,
+    // releaseDecommitted should be called on a region of VM allocated by a single reservation,
+    // the memory must all currently be in a decommitted state.
+    static void* reserveUncommitted(size_t, Usage = UnknownUsage, bool writable = true, bool executable = false, bool includesGuardPages = false);
+    WTF_EXPORT_PRIVATE static void releaseDecommitted(void*, size_t);
+
+    // These methods are symmetric; they commit or decommit a region of VM (uncommitted VM should
+    // never be accessed, since the OS may not have attached physical memory for these regions).
+    // Clients should only call commit on uncommitted regions and decommit on committed regions.
+    static void commit(void*, size_t, bool writable, bool executable);
+    static void decommit(void*, size_t);
+
+    // These methods are symmetric; reserveAndCommit allocates VM in an committed state,
+    // decommitAndRelease should be called on a region of VM allocated by a single reservation,
+    // the memory must all currently be in a committed state.
+    WTF_EXPORT_PRIVATE static void* reserveAndCommit(size_t, Usage = UnknownUsage, bool writable = true, bool executable = false, bool includesGuardPages = false);
+    static void decommitAndRelease(void* base, size_t size);
+
+    // These methods are akin to reserveAndCommit/decommitAndRelease, above - however rather than
+    // committing/decommitting the entire region additional parameters allow a subregion to be
+    // specified.
+    static void* reserveAndCommit(size_t reserveSize, size_t commitSize, Usage = UnknownUsage, bool writable = true, bool executable = false);
+    static void decommitAndRelease(void* releaseBase, size_t releaseSize, void* decommitBase, size_t decommitSize);
+
+    // Reallocate an existing, committed allocation.
+    // The prior allocation must be fully comitted, and the new size will also be fully committed.
+    // This interface is provided since it may be possible to optimize this operation on some platforms.
+    template<typename T>
+    static T* reallocateCommitted(T*, size_t oldSize, size_t newSize, Usage = UnknownUsage, bool writable = true, bool executable = false);
+};
+
+inline void* OSAllocator::reserveAndCommit(size_t reserveSize, size_t commitSize, Usage usage, bool writable, bool executable)
+{
+    void* base = reserveUncommitted(reserveSize, usage, writable, executable);
+    commit(base, commitSize, writable, executable);
+    return base;
+}
+
+inline void OSAllocator::decommitAndRelease(void* releaseBase, size_t releaseSize, void* decommitBase, size_t decommitSize)
+{
+    ASSERT(decommitBase >= releaseBase && (static_cast<char*>(decommitBase) + decommitSize) <= (static_cast<char*>(releaseBase) + releaseSize));
+#if OS(WINCE)
+    // On most platforms we can actually skip this final decommit; releasing the VM will
+    // implicitly decommit any physical memory in the region. This is not true on WINCE.
+    decommit(decommitBase, decommitSize);
+#else
+    UNUSED_PARAM(decommitBase);
+    UNUSED_PARAM(decommitSize);
+#endif
+    releaseDecommitted(releaseBase, releaseSize);
+}
+
+inline void OSAllocator::decommitAndRelease(void* base, size_t size)
+{
+    decommitAndRelease(base, size, base, size);
+}
+
+template<typename T>
+inline T* OSAllocator::reallocateCommitted(T* oldBase, size_t oldSize, size_t newSize, Usage usage, bool writable, bool executable)
+{
+    void* newBase = reserveAndCommit(newSize, usage, writable, executable);
+    memcpy(newBase, oldBase, std::min(oldSize, newSize));
+    decommitAndRelease(oldBase, oldSize);
+    return static_cast<T*>(newBase);
+}
+
+} // namespace WTF
+
+using WTF::OSAllocator;
+
+#endif // OSAllocator_h
diff --git a/Source/WTF/wtf/OSAllocatorPosix.cpp b/Source/WTF/wtf/OSAllocatorPosix.cpp
new file mode 100644
index 0000000..a2f6a79
--- /dev/null
+++ b/Source/WTF/wtf/OSAllocatorPosix.cpp
@@ -0,0 +1,187 @@
+/*
+ * 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 "config.h"
+#include "OSAllocator.h"
+
+#include "PageAllocation.h"
+#include <errno.h>
+#include <sys/mman.h>
+#include <wtf/Assertions.h>
+#include <wtf/UnusedParam.h>
+
+namespace WTF {
+
+void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, bool executable, bool includesGuardPages)
+{
+#if OS(QNX)
+    // Reserve memory with PROT_NONE and MAP_LAZY so it isn't committed now.
+    void* result = mmap(0, bytes, PROT_NONE, MAP_LAZY | MAP_PRIVATE | MAP_ANON, -1, 0);
+    if (result == MAP_FAILED)
+        CRASH();
+#else // OS(QNX)
+
+    void* result = reserveAndCommit(bytes, usage, writable, executable, includesGuardPages);
+#if OS(LINUX)
+    madvise(result, bytes, MADV_DONTNEED);
+#elif HAVE(MADV_FREE_REUSE)
+    // To support the "reserve then commit" model, we have to initially decommit.
+    while (madvise(result, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
+#endif
+
+#endif // OS(QNX)
+
+    return result;
+}
+
+void* OSAllocator::reserveAndCommit(size_t bytes, Usage usage, bool writable, bool executable, bool includesGuardPages)
+{
+    // All POSIX reservations start out logically committed.
+    int protection = PROT_READ;
+    if (writable)
+        protection |= PROT_WRITE;
+    if (executable)
+        protection |= PROT_EXEC;
+
+    int flags = MAP_PRIVATE | MAP_ANON;
+#if PLATFORM(IOS)
+    if (executable)
+        flags |= MAP_JIT;
+#endif
+
+#if (OS(LINUX) && CPU(X86_64))
+    // Linux distros usually do not allow overcommit by default, so
+    // JSC's strategy of mmaping a large amount of memory upfront
+    // won't work very well on some systems. Fortunately there's a
+    // flag we can pass to mmap to disable the overcommit check for
+    // this particular call, so we can get away with it as long as the
+    // overcommit flag value in /proc/sys/vm/overcommit_memory is 0
+    // ('heuristic') and not 2 (always check). 0 is the usual default
+    // value, so this should work well in general.
+    flags |= MAP_NORESERVE;
+#endif
+
+#if OS(DARWIN)
+    int fd = usage;
+#else
+    UNUSED_PARAM(usage);
+    int fd = -1;
+#endif
+
+    void* result = 0;
+#if (OS(DARWIN) && CPU(X86_64))
+    if (executable) {
+        ASSERT(includesGuardPages);
+        // Cook up an address to allocate at, using the following recipe:
+        //   17 bits of zero, stay in userspace kids.
+        //   26 bits of randomness for ASLR.
+        //   21 bits of zero, at least stay aligned within one level of the pagetables.
+        //
+        // But! - as a temporary workaround for some plugin problems (rdar://problem/6812854),
+        // for now instead of 2^26 bits of ASLR lets stick with 25 bits of randomization plus
+        // 2^24, which should put up somewhere in the middle of userspace (in the address range
+        // 0x200000000000 .. 0x5fffffffffff).
+        intptr_t randomLocation = 0;
+        randomLocation = arc4random() & ((1 << 25) - 1);
+        randomLocation += (1 << 24);
+        randomLocation <<= 21;
+        result = reinterpret_cast<void*>(randomLocation);
+    }
+#endif
+
+    result = mmap(result, bytes, protection, flags, fd, 0);
+    if (result == MAP_FAILED) {
+#if ENABLE(LLINT)
+        if (executable)
+            result = 0;
+        else
+#endif
+            CRASH();
+    }
+    if (result && includesGuardPages) {
+        // We use mmap to remap the guardpages rather than using mprotect as
+        // mprotect results in multiple references to the code region.  This
+        // breaks the madvise based mechanism we use to return physical memory
+        // to the OS.
+        mmap(result, pageSize(), PROT_NONE, MAP_FIXED | MAP_PRIVATE | MAP_ANON, fd, 0);
+        mmap(static_cast<char*>(result) + bytes - pageSize(), pageSize(), PROT_NONE, MAP_FIXED | MAP_PRIVATE | MAP_ANON, fd, 0);
+    }
+    return result;
+}
+
+void OSAllocator::commit(void* address, size_t bytes, bool writable, bool executable)
+{
+#if OS(QNX)
+    int protection = PROT_READ;
+    if (writable)
+        protection |= PROT_WRITE;
+    if (executable)
+        protection |= PROT_EXEC;
+    if (MAP_FAILED == mmap(address, bytes, protection, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0))
+        CRASH();
+#elif OS(LINUX)
+    UNUSED_PARAM(writable);
+    UNUSED_PARAM(executable);
+    madvise(address, bytes, MADV_WILLNEED);
+#elif HAVE(MADV_FREE_REUSE)
+    UNUSED_PARAM(writable);
+    UNUSED_PARAM(executable);
+    while (madvise(address, bytes, MADV_FREE_REUSE) == -1 && errno == EAGAIN) { }
+#else
+    // Non-MADV_FREE_REUSE reservations automatically commit on demand.
+    UNUSED_PARAM(address);
+    UNUSED_PARAM(bytes);
+    UNUSED_PARAM(writable);
+    UNUSED_PARAM(executable);
+#endif
+}
+
+void OSAllocator::decommit(void* address, size_t bytes)
+{
+#if OS(QNX)
+    // Use PROT_NONE and MAP_LAZY to decommit the pages.
+    mmap(address, bytes, PROT_NONE, MAP_FIXED | MAP_LAZY | MAP_PRIVATE | MAP_ANON, -1, 0);
+#elif OS(LINUX)
+    madvise(address, bytes, MADV_DONTNEED);
+#elif HAVE(MADV_FREE_REUSE)
+    while (madvise(address, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
+#elif HAVE(MADV_FREE)
+    while (madvise(address, bytes, MADV_FREE) == -1 && errno == EAGAIN) { }
+#elif HAVE(MADV_DONTNEED)
+    while (madvise(address, bytes, MADV_DONTNEED) == -1 && errno == EAGAIN) { }
+#else
+    UNUSED_PARAM(address);
+    UNUSED_PARAM(bytes);
+#endif
+}
+
+void OSAllocator::releaseDecommitted(void* address, size_t bytes)
+{
+    int result = munmap(address, bytes);
+    if (result == -1)
+        CRASH();
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/OSAllocatorWin.cpp b/Source/WTF/wtf/OSAllocatorWin.cpp
new file mode 100644
index 0000000..7f5d9b8
--- /dev/null
+++ b/Source/WTF/wtf/OSAllocatorWin.cpp
@@ -0,0 +1,80 @@
+/*
+ * 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 "config.h"
+#include "OSAllocator.h"
+
+#include "windows.h"
+#include <wtf/Assertions.h>
+
+namespace WTF {
+
+static inline DWORD protection(bool writable, bool executable)
+{
+    return executable ?
+        (writable ? PAGE_EXECUTE_READWRITE : PAGE_EXECUTE_READ) :
+        (writable ? PAGE_READWRITE : PAGE_READONLY);
+}
+
+void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool executable, bool)
+{
+    void* result = VirtualAlloc(0, bytes, MEM_RESERVE, protection(writable, executable));
+    if (!result)
+        CRASH();
+    return result;
+}
+
+void* OSAllocator::reserveAndCommit(size_t bytes, Usage, bool writable, bool executable, bool)
+{
+    void* result = VirtualAlloc(0, bytes, MEM_RESERVE | MEM_COMMIT, protection(writable, executable));
+    if (!result)
+        CRASH();
+    return result;
+}
+
+void OSAllocator::commit(void* address, size_t bytes, bool writable, bool executable)
+{
+    void* result = VirtualAlloc(address, bytes, MEM_COMMIT, protection(writable, executable));
+    if (!result)
+        CRASH();
+}
+
+void OSAllocator::decommit(void* address, size_t bytes)
+{
+    bool result = VirtualFree(address, bytes, MEM_DECOMMIT);
+    if (!result)
+        CRASH();
+}
+
+void OSAllocator::releaseDecommitted(void* address, size_t bytes)
+{
+    // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
+    // dwSize must be 0 if dwFreeType is MEM_RELEASE.
+    bool result = VirtualFree(address, 0, MEM_RELEASE);
+    if (!result)
+        CRASH();
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/OSRandomSource.cpp b/Source/WTF/wtf/OSRandomSource.cpp
new file mode 100644
index 0000000..0c1416a
--- /dev/null
+++ b/Source/WTF/wtf/OSRandomSource.cpp
@@ -0,0 +1,71 @@
+/*
+ * 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:
+ * 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 GOOGLE, INC. ``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 COMPUTER, INC. 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 "OSRandomSource.h"
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#if OS(UNIX)
+#include <fcntl.h>
+#include <unistd.h>
+#endif
+
+#if OS(WINDOWS)
+#include <windows.h>
+#include <wincrypt.h> // windows.h must be included before wincrypt.h.
+#endif
+
+namespace WTF {
+
+#if USE(OS_RANDOMNESS)
+void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length)
+{
+#if OS(UNIX)
+    int fd = open("/dev/urandom", O_RDONLY, 0);
+    if (fd < 0)
+        CRASH(); // We need /dev/urandom for this API to work...
+
+    if (read(fd, buffer, length) != static_cast<ssize_t>(length))
+        CRASH();
+
+    close(fd);
+#elif OS(WINDOWS)
+    HCRYPTPROV hCryptProv = 0;
+    if (!CryptAcquireContext(&hCryptProv, 0, MS_DEF_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
+        CRASH();
+    if (!CryptGenRandom(hCryptProv, length, buffer))
+        CRASH();
+    CryptReleaseContext(hCryptProv, 0);
+#else
+    #error "This configuration doesn't have a strong source of randomness."
+    // WARNING: When adding new sources of OS randomness, the randomness must
+    //          be of cryptographic quality!
+#endif
+}
+#endif
+
+}
diff --git a/Source/WTF/wtf/OSRandomSource.h b/Source/WTF/wtf/OSRandomSource.h
new file mode 100644
index 0000000..214a954
--- /dev/null
+++ b/Source/WTF/wtf/OSRandomSource.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 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:
+ * 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 GOOGLE, INC. ``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 COMPUTER, INC. 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_OSRandomSource_h
+#define WTF_OSRandomSource_h
+
+namespace WTF {
+
+#if USE(OS_RANDOMNESS)
+// This function attempts to fill buffer with randomness from the operating
+// system.  If insufficient randomness is available, the buffer will be
+// partially filled.  Rather than calling this function directly, consider
+// calling cryptographicallyRandomNumber or cryptographicallyRandomValues.
+void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length);
+#endif
+
+}
+
+#endif
diff --git a/Source/WTF/wtf/ObjcRuntimeExtras.h b/Source/WTF/wtf/ObjcRuntimeExtras.h
new file mode 100644
index 0000000..3788d4a
--- /dev/null
+++ b/Source/WTF/wtf/ObjcRuntimeExtras.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#ifndef WTF_ObjcRuntimeExtras_h
+#define WTF_ObjcRuntimeExtras_h
+
+template<typename RetType>
+RetType wtfObjcMsgSend(id target, SEL selector)
+{
+    return reinterpret_cast<RetType (*)(id, SEL)>(objc_msgSend)(target, selector);
+}
+
+template<typename RetType, typename Arg1Type>
+RetType wtfObjcMsgSend(id target, SEL selector, Arg1Type arg1)
+{
+    return reinterpret_cast<RetType (*)(id, SEL, Arg1Type)>(objc_msgSend)(target, selector, arg1);
+}
+
+template<typename RetType, typename Arg1Type, typename Arg2Type>
+RetType wtfObjcMsgSend(id target, SEL selector, Arg1Type arg1, Arg2Type arg2)
+{
+    return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type)>(objc_msgSend)(target, selector, arg1, arg2);
+}
+
+template<typename RetType, typename Arg1Type, typename Arg2Type, typename Arg3Type>
+RetType wtfObjcMsgSend(id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3)
+{
+    return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type)>(objc_msgSend)(target, selector, arg1, arg2, arg3);
+}
+
+template<typename RetType, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Arg4Type>
+RetType wtfObjcMsgSend(id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4)
+{
+    return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type, Arg4Type)>(objc_msgSend)(target, selector, arg1, arg2, arg3, arg4);
+}
+
+template<typename RetType, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Arg4Type, typename Arg5Type>
+RetType wtfObjcMsgSend(id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4, Arg5Type arg5)
+{
+    return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type, Arg4Type, Arg5Type)>(objc_msgSend)(target, selector, arg1, arg2, arg3, arg4, arg5);
+}
+
+template<typename RetType>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector)
+{
+    return reinterpret_cast<RetType (*)(id, SEL)>(implementation)(target, selector);
+}
+
+template<typename RetType, typename Arg1Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1)
+{
+    return reinterpret_cast<RetType (*)(id, SEL, Arg1Type)>(implementation)(target, selector, arg1);
+}
+
+template<typename RetType, typename Arg1Type, typename Arg2Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1, Arg2Type arg2)
+{
+    return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type)>(implementation)(target, selector, arg1, arg2);
+}
+
+template<typename RetType, typename Arg1Type, typename Arg2Type, typename Arg3Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3)
+{
+    return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type)>(implementation)(target, selector, arg1, arg2, arg3);
+}
+
+template<typename RetType, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Arg4Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4)
+{
+    return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type, Arg4Type)>(implementation)(target, selector, arg1, arg2, arg3, arg4);
+}
+
+template<typename RetType, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Arg4Type, typename Arg5Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4, Arg5Type arg5)
+{
+    return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type, Arg4Type, Arg5Type)>(implementation)(target, selector, arg1, arg2, arg3, arg4, arg5);
+}
+
+template<typename RetType, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Arg4Type, typename Arg5Type, typename Arg6Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4, Arg5Type arg5, Arg6Type arg6)
+{
+    return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type, Arg4Type, Arg5Type, Arg6Type)>(implementation)(target, selector, arg1, arg2, arg3, arg4, arg5, arg6);
+}
+
+#endif
diff --git a/Source/WTF/wtf/OwnArrayPtr.h b/Source/WTF/wtf/OwnArrayPtr.h
new file mode 100644
index 0000000..b3d72df
--- /dev/null
+++ b/Source/WTF/wtf/OwnArrayPtr.h
@@ -0,0 +1,157 @@
+/*
+ *  Copyright (C) 2006, 2010 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_OwnArrayPtr_h
+#define WTF_OwnArrayPtr_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/NullPtr.h>
+#include <wtf/PassOwnArrayPtr.h>
+#include <algorithm>
+
+namespace WTF {
+
+template<typename T> class PassOwnArrayPtr;
+template<typename T> PassOwnArrayPtr<T> adoptArrayPtr(T*);
+
+template <typename T> class OwnArrayPtr {
+public:
+    typedef T* PtrType;
+
+    OwnArrayPtr() : m_ptr(0) { }
+
+    // See comment in PassOwnArrayPtr.h for why this takes a const reference.
+    template<typename U> OwnArrayPtr(const PassOwnArrayPtr<U>& o);
+
+    // This copy constructor is used implicitly by gcc when it generates
+    // transients for assigning a PassOwnArrayPtr<T> object to a stack-allocated
+    // OwnArrayPtr<T> object. It should never be called explicitly and gcc
+    // should optimize away the constructor when generating code.
+    OwnArrayPtr(const OwnArrayPtr<T>&);
+
+    ~OwnArrayPtr() { deleteOwnedArrayPtr(m_ptr); }
+
+    PtrType get() const { return m_ptr; }
+
+    void clear();
+    PassOwnArrayPtr<T> release();
+    PtrType leakPtr() WARN_UNUSED_RETURN;
+
+    T& operator*() const { ASSERT(m_ptr); return *m_ptr; }
+    PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
+
+    T& operator[](std::ptrdiff_t i) const { ASSERT(m_ptr); ASSERT(i >= 0); return m_ptr[i]; }
+
+    bool operator!() const { return !m_ptr; }
+
+    // This conversion operator allows implicit conversion to bool but not to other integer types.
+    typedef T* OwnArrayPtr::*UnspecifiedBoolType;
+    operator UnspecifiedBoolType() const { return m_ptr ? &OwnArrayPtr::m_ptr : 0; }
+
+    OwnArrayPtr& operator=(const PassOwnArrayPtr<T>&);
+    OwnArrayPtr& operator=(std::nullptr_t) { clear(); return *this; }
+    template<typename U> OwnArrayPtr& operator=(const PassOwnArrayPtr<U>&);
+
+    void swap(OwnArrayPtr& o) { std::swap(m_ptr, o.m_ptr); }
+
+private:
+    PtrType m_ptr;
+};
+
+template<typename T> template<typename U> inline OwnArrayPtr<T>::OwnArrayPtr(const PassOwnArrayPtr<U>& o)
+    : m_ptr(o.leakPtr())
+{
+}
+
+template<typename T> inline void OwnArrayPtr<T>::clear()
+{
+    PtrType ptr = m_ptr;
+    m_ptr = 0;
+    deleteOwnedArrayPtr(ptr);
+}
+
+template<typename T> inline PassOwnArrayPtr<T> OwnArrayPtr<T>::release()
+{
+    PtrType ptr = m_ptr;
+    m_ptr = 0;
+    return adoptArrayPtr(ptr);
+}
+
+template<typename T> inline typename OwnArrayPtr<T>::PtrType OwnArrayPtr<T>::leakPtr()
+{
+    PtrType ptr = m_ptr;
+    m_ptr = 0;
+    return ptr;
+}
+
+template<typename T> inline OwnArrayPtr<T>& OwnArrayPtr<T>::operator=(const PassOwnArrayPtr<T>& o)
+{
+    PtrType ptr = m_ptr;
+    m_ptr = o.leakPtr();
+    ASSERT(!ptr || m_ptr != ptr);
+    deleteOwnedArrayPtr(ptr);
+    return *this;
+}
+
+template<typename T> template<typename U> inline OwnArrayPtr<T>& OwnArrayPtr<T>::operator=(const PassOwnArrayPtr<U>& o)
+{
+    PtrType ptr = m_ptr;
+    m_ptr = o.leakPtr();
+    ASSERT(!ptr || m_ptr != ptr);
+    deleteOwnedArrayPtr(ptr);
+    return *this;
+}
+
+template <typename T> inline void swap(OwnArrayPtr<T>& a, OwnArrayPtr<T>& b)
+{
+    a.swap(b);
+}
+
+template<typename T, typename U> inline bool operator==(const OwnArrayPtr<T>& a, U* b)
+{
+    return a.get() == b; 
+}
+
+template<typename T, typename U> inline bool operator==(T* a, const OwnArrayPtr<U>& b) 
+{
+    return a == b.get(); 
+}
+
+template<typename T, typename U> inline bool operator!=(const OwnArrayPtr<T>& a, U* b)
+{
+    return a.get() != b; 
+}
+
+template<typename T, typename U> inline bool operator!=(T* a, const OwnArrayPtr<U>& b)
+{
+    return a != b.get(); 
+}
+
+template <typename T> inline T* getPtr(const OwnArrayPtr<T>& p)
+{
+    return p.get();
+}
+
+} // namespace WTF
+
+using WTF::OwnArrayPtr;
+
+#endif // WTF_OwnArrayPtr_h
diff --git a/Source/WTF/wtf/OwnPtr.h b/Source/WTF/wtf/OwnPtr.h
new file mode 100644
index 0000000..fa79aa1
--- /dev/null
+++ b/Source/WTF/wtf/OwnPtr.h
@@ -0,0 +1,220 @@
+/*
+ *  Copyright (C) 2006, 2007, 2008, 2009, 2010 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_OwnPtr_h
+#define WTF_OwnPtr_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/NullPtr.h>
+#include <wtf/OwnPtrCommon.h>
+#include <wtf/TypeTraits.h>
+#include <algorithm>
+#include <memory>
+
+namespace WTF {
+
+    // Unlike most of our smart pointers, OwnPtr can take either the pointer type or the pointed-to type.
+
+    template<typename T> class PassOwnPtr;
+    template<typename T> PassOwnPtr<T> adoptPtr(T*);
+
+    template<typename T> class OwnPtr {
+#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+        // If rvalue references are not supported, the copy constructor is
+        // public so OwnPtr cannot be marked noncopyable. See note below.
+        WTF_MAKE_NONCOPYABLE(OwnPtr);
+#endif
+    public:
+        typedef typename RemovePointer<T>::Type ValueType;
+        typedef ValueType* PtrType;
+
+        OwnPtr() : m_ptr(0) { }
+        OwnPtr(std::nullptr_t) : m_ptr(0) { }
+
+        // See comment in PassOwnPtr.h for why this takes a const reference.
+        template<typename U> OwnPtr(const PassOwnPtr<U>& o);
+
+#if !COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+        // This copy constructor is used implicitly by gcc when it generates
+        // transients for assigning a PassOwnPtr<T> object to a stack-allocated
+        // OwnPtr<T> object. It should never be called explicitly and gcc
+        // should optimize away the constructor when generating code.
+        OwnPtr(const OwnPtr<ValueType>&);
+#endif
+
+        ~OwnPtr() { deleteOwnedPtr(m_ptr); }
+
+        PtrType get() const { return m_ptr; }
+
+        void clear();
+        PassOwnPtr<T> release();
+        PtrType leakPtr() WARN_UNUSED_RETURN;
+
+        ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; }
+        PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
+
+        bool operator!() const { return !m_ptr; }
+
+        // This conversion operator allows implicit conversion to bool but not to other integer types.
+        typedef PtrType OwnPtr::*UnspecifiedBoolType;
+        operator UnspecifiedBoolType() const { return m_ptr ? &OwnPtr::m_ptr : 0; }
+
+        OwnPtr& operator=(const PassOwnPtr<T>&);
+        OwnPtr& operator=(std::nullptr_t) { clear(); return *this; }
+        template<typename U> OwnPtr& operator=(const PassOwnPtr<U>&);
+
+#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+        OwnPtr(OwnPtr&&);
+        template<typename U> OwnPtr(OwnPtr<U>&&);
+
+        OwnPtr& operator=(OwnPtr&&);
+        template<typename U> OwnPtr& operator=(OwnPtr<U>&&);
+#endif
+
+        void swap(OwnPtr& o) { std::swap(m_ptr, o.m_ptr); }
+
+    private:
+#if !COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+        // If rvalue references are supported, noncopyable takes care of this.
+        OwnPtr& operator=(const OwnPtr&);
+#endif
+
+        // We should never have two OwnPtrs for the same underlying object (otherwise we'll get
+        // double-destruction), so these equality operators should never be needed.
+        template<typename U> bool operator==(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+        template<typename U> bool operator!=(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+        template<typename U> bool operator==(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+        template<typename U> bool operator!=(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+
+        PtrType m_ptr;
+    };
+
+    template<typename T> template<typename U> inline OwnPtr<T>::OwnPtr(const PassOwnPtr<U>& o)
+        : m_ptr(o.leakPtr())
+    {
+    }
+
+    template<typename T> inline void OwnPtr<T>::clear()
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = 0;
+        deleteOwnedPtr(ptr);
+    }
+
+    template<typename T> inline PassOwnPtr<T> OwnPtr<T>::release()
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = 0;
+        return adoptPtr(ptr);
+    }
+
+    template<typename T> inline typename OwnPtr<T>::PtrType OwnPtr<T>::leakPtr()
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = 0;
+        return ptr;
+    }
+
+    template<typename T> inline OwnPtr<T>& OwnPtr<T>::operator=(const PassOwnPtr<T>& o)
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = o.leakPtr();
+        ASSERT(!ptr || m_ptr != ptr);
+        deleteOwnedPtr(ptr);
+        return *this;
+    }
+
+    template<typename T> template<typename U> inline OwnPtr<T>& OwnPtr<T>::operator=(const PassOwnPtr<U>& o)
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = o.leakPtr();
+        ASSERT(!ptr || m_ptr != ptr);
+        deleteOwnedPtr(ptr);
+        return *this;
+    }
+
+#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+    template<typename T> inline OwnPtr<T>::OwnPtr(OwnPtr<T>&& o)
+        : m_ptr(o.leakPtr())
+    {
+    }
+
+    template<typename T> template<typename U> inline OwnPtr<T>::OwnPtr(OwnPtr<U>&& o)
+        : m_ptr(o.leakPtr())
+    {
+    }
+
+    template<typename T> inline OwnPtr<T>& OwnPtr<T>::operator=(OwnPtr<T>&& o)
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = o.leakPtr();
+        ASSERT(!ptr || m_ptr != ptr);
+        deleteOwnedPtr(ptr);
+
+        return *this;
+    }
+
+    template<typename T> template<typename U> inline OwnPtr<T>& OwnPtr<T>::operator=(OwnPtr<U>&& o)
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = o.leakPtr();
+        ASSERT(!ptr || m_ptr != ptr);
+        deleteOwnedPtr(ptr);
+
+        return *this;
+    }
+#endif
+
+    template<typename T> inline void swap(OwnPtr<T>& a, OwnPtr<T>& b)
+    {
+        a.swap(b);
+    }
+
+    template<typename T, typename U> inline bool operator==(const OwnPtr<T>& a, U* b)
+    {
+        return a.get() == b; 
+    }
+
+    template<typename T, typename U> inline bool operator==(T* a, const OwnPtr<U>& b) 
+    {
+        return a == b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator!=(const OwnPtr<T>& a, U* b)
+    {
+        return a.get() != b; 
+    }
+
+    template<typename T, typename U> inline bool operator!=(T* a, const OwnPtr<U>& b)
+    {
+        return a != b.get(); 
+    }
+
+    template<typename T> inline typename OwnPtr<T>::PtrType getPtr(const OwnPtr<T>& p)
+    {
+        return p.get();
+    }
+
+} // namespace WTF
+
+using WTF::OwnPtr;
+
+#endif // WTF_OwnPtr_h
diff --git a/Source/WTF/wtf/OwnPtrCommon.h b/Source/WTF/wtf/OwnPtrCommon.h
new file mode 100644
index 0000000..c564001
--- /dev/null
+++ b/Source/WTF/wtf/OwnPtrCommon.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
+ * Copyright (C) 2010 Company 100 Inc.
+ *
+ * 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. ``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
+ * 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_OwnPtrCommon_h
+#define WTF_OwnPtrCommon_h
+
+#if OS(WINDOWS)
+typedef struct HBITMAP__* HBITMAP;
+typedef struct HBRUSH__* HBRUSH;
+typedef struct HDC__* HDC;
+typedef struct HFONT__* HFONT;
+typedef struct HPALETTE__* HPALETTE;
+typedef struct HPEN__* HPEN;
+typedef struct HRGN__* HRGN;
+#endif
+
+#if PLATFORM(EFL)
+typedef struct _Ecore_Evas Ecore_Evas;
+typedef struct _Ecore_IMF_Context Ecore_IMF_Context;
+typedef struct _Ecore_Pipe Ecore_Pipe;
+typedef struct _Ecore_Timer Ecore_Timer;
+typedef struct _Eina_Hash Eina_Hash;
+typedef struct _Eina_Module Eina_Module;
+typedef struct _Evas_Object Evas_Object;
+#if USE(ACCELERATED_COMPOSITING)
+typedef struct _Evas_GL Evas_GL;
+#endif
+#endif
+
+namespace WTF {
+
+    template <typename T> inline void deleteOwnedPtr(T* ptr)
+    {
+        typedef char known[sizeof(T) ? 1 : -1];
+        if (sizeof(known))
+            delete ptr;
+    }
+
+#if OS(WINDOWS)
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(HBITMAP);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(HBRUSH);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(HDC);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(HFONT);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(HPALETTE);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(HPEN);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(HRGN);
+#endif
+
+#if PLATFORM(EFL)
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_Evas*);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_IMF_Context*);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_Pipe*);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_Timer*);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Eina_Hash*);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Eina_Module*);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Evas_Object*);
+#if USE(ACCELERATED_COMPOSITING)
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Evas_GL*);
+#endif
+#endif
+
+} // namespace WTF
+
+#endif // WTF_OwnPtrCommon_h
diff --git a/Source/WTF/wtf/PackedIntVector.h b/Source/WTF/wtf/PackedIntVector.h
new file mode 100644
index 0000000..9289eb6
--- /dev/null
+++ b/Source/WTF/wtf/PackedIntVector.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2011 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. ``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
+ * 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 PackedIntVector_h
+#define PackedIntVector_h
+
+#include <wtf/BitVector.h>
+
+namespace WTF {
+
+// This class allows you to create an array of integers, where those
+// integers have only a handful of bits each. It is not meant to be
+// efficient in time, but only in space. (Though making it efficient
+// in time for power-of-2 values of bitCount would not be difficult.)
+// Note that this does not work as expected for signed types, if you
+// are relying on the sign being preserved.
+
+template<typename T, unsigned bitCount>
+class PackedIntVector {
+public:
+    PackedIntVector()
+    {
+        ASSERT(bitCount);
+        ASSERT(bitCount < sizeof(void*) * 8);
+    }
+    
+    PackedIntVector(const PackedIntVector& other)
+        : m_bits(other.m_bits)
+    {
+    }
+    
+    PackedIntVector& operator=(const PackedIntVector& other)
+    {
+        m_bits = other.m_bits;
+        return *this;
+    }
+    
+    size_t size() const
+    {
+        return m_bits.size() / bitCount;
+    }
+    
+    void ensureSize(size_t numInts)
+    {
+        m_bits.ensureSize(numInts * bitCount);
+    }
+    
+    void resize(size_t numInts)
+    {
+        m_bits.resize(numInts * bitCount);
+    }
+    
+    void clearAll()
+    {
+        m_bits.clearAll();
+    }
+    
+    T get(size_t index) const
+    {
+        uintptr_t result = 0;
+        for (unsigned subIndex = 0; subIndex < bitCount; ++subIndex) {
+            result <<= 1;
+            result |= (m_bits.quickGet(index * bitCount + subIndex) ? 1 : 0);
+        }
+        return static_cast<T>(result);
+    }
+    
+    void set(size_t index, T value)
+    {
+        // Do arithmetic using uintptr_t, because (1) we know what it is
+        // (T might be an enum) and (2) it's the largest integer type that
+        // is likely to perform decently well.
+        uintptr_t myValue = static_cast<uintptr_t>(value);
+        
+        // Preliminary sanity check that the value is not out of range.
+        ASSERT((myValue & mask()) == myValue);
+        
+        for (unsigned subIndex = bitCount; subIndex-- > 0;) {
+            m_bits.quickSet(index * bitCount + subIndex, !!(myValue & 1));
+            myValue >>= 1;
+        }
+        
+        // Final sanity check that we stored what the user thought we
+        // stored.
+        ASSERT(get(index) == value);
+    }
+private:
+    // This returns the mask, and is careful to not step on the wrap-around
+    // semantics of the shift amount (1 << 32 is 1 since 32 wraps to 0). There
+    // is the separate question of why you would ever use this to store 32-bit
+    // or 64-bit values, but it's probably better to have this work as expected
+    // in such situations regardless.
+    static uintptr_t mask() { return (static_cast<uintptr_t>(2) << (bitCount - 1)) - 1; }
+               
+    // Stores integers bit by bit in big endian.
+    BitVector m_bits;
+};
+
+} // namespace WTF
+
+using WTF::PackedIntVector;
+
+#endif // PackedIntVector_h
+
diff --git a/Source/WTF/wtf/PageAllocation.h b/Source/WTF/wtf/PageAllocation.h
new file mode 100644
index 0000000..18d3188
--- /dev/null
+++ b/Source/WTF/wtf/PageAllocation.h
@@ -0,0 +1,120 @@
+/*
+ * 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. ``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
+ * 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 PageAllocation_h
+#define PageAllocation_h
+
+#include <wtf/Assertions.h>
+#include <wtf/OSAllocator.h>
+#include <wtf/PageBlock.h>
+#include <wtf/UnusedParam.h>
+#include <wtf/VMTags.h>
+#include <algorithm>
+
+#if OS(DARWIN)
+#include <mach/mach_init.h>
+#include <mach/vm_map.h>
+#endif
+
+#if OS(WINDOWS)
+#include <malloc.h>
+#include <windows.h>
+#endif
+
+#if HAVE(ERRNO_H)
+#include <errno.h>
+#endif
+
+#if HAVE(MMAP)
+#include <sys/mman.h>
+#include <unistd.h>
+#endif
+
+namespace WTF {
+
+/*
+    PageAllocation
+
+    The PageAllocation class provides a cross-platform memory allocation interface
+    with similar capabilities to posix mmap/munmap.  Memory is allocated by calling
+    PageAllocation::allocate, and deallocated by calling deallocate on the
+    PageAllocation object.  The PageAllocation holds the allocation's base pointer
+    and size.
+
+    The allocate method is passed the size required (which must be a multiple of
+    the system page size, which can be accessed using PageAllocation::pageSize).
+    Callers may also optinally provide a flag indicating the usage (for use by
+    system memory usage tracking tools, where implemented), and boolean values
+    specifying the required protection (defaulting to writable, non-executable).
+*/
+
+class PageAllocation : private PageBlock {
+public:
+    PageAllocation()
+    {
+    }
+
+    using PageBlock::size;
+    using PageBlock::base;
+
+#ifndef __clang__
+    using PageBlock::operator bool;
+#else
+    // FIXME: This is a workaround for <rdar://problem/8876150>, wherein Clang incorrectly emits an access
+    // control warning when a client tries to use operator bool exposed above via "using PageBlock::operator bool".
+    operator bool() const { return PageBlock::operator bool(); }
+#endif
+
+    static PageAllocation allocate(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false)
+    {
+        ASSERT(isPageAligned(size));
+        return PageAllocation(OSAllocator::reserveAndCommit(size, usage, writable, executable), size);
+    }
+
+    void deallocate()
+    {
+        // Clear base & size before calling release; if this is *inside* allocation
+        // then we won't be able to clear then after deallocating the memory.
+        PageAllocation tmp;
+        std::swap(tmp, *this);
+
+        ASSERT(tmp);
+        ASSERT(!*this);
+
+        OSAllocator::decommitAndRelease(tmp.base(), tmp.size());
+    }
+
+private:
+    PageAllocation(void* base, size_t size)
+        : PageBlock(base, size, false)
+    {
+    }
+};
+
+} // namespace WTF
+
+using WTF::PageAllocation;
+
+#endif // PageAllocation_h
diff --git a/Source/WTF/wtf/PageAllocationAligned.cpp b/Source/WTF/wtf/PageAllocationAligned.cpp
new file mode 100644
index 0000000..6f54710
--- /dev/null
+++ b/Source/WTF/wtf/PageAllocationAligned.cpp
@@ -0,0 +1,87 @@
+/*
+ * 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 "config.h"
+#include "PageAllocationAligned.h"
+
+namespace WTF {
+
+PageAllocationAligned PageAllocationAligned::allocate(size_t size, size_t alignment, OSAllocator::Usage usage, bool writable, bool executable)
+{
+    ASSERT(isPageAligned(size));
+    ASSERT(isPageAligned(alignment));
+    ASSERT(isPowerOfTwo(alignment));
+    ASSERT(size >= alignment);
+    size_t alignmentMask = alignment - 1;
+
+#if OS(DARWIN)
+    int flags = VM_FLAGS_ANYWHERE;
+    if (usage != OSAllocator::UnknownUsage)
+        flags |= usage;
+    int protection = PROT_READ;
+    if (writable)
+        protection |= PROT_WRITE;
+    if (executable)
+        protection |= PROT_EXEC;
+
+    vm_address_t address = 0;
+    vm_map(current_task(), &address, size, alignmentMask, flags, MEMORY_OBJECT_NULL, 0, FALSE, protection, PROT_READ | PROT_WRITE | PROT_EXEC, VM_INHERIT_DEFAULT);
+    return PageAllocationAligned(reinterpret_cast<void*>(address), size);
+#else
+    size_t alignmentDelta = alignment - pageSize();
+
+    // Resererve with suffcient additional VM to correctly align.
+    size_t reservationSize = size + alignmentDelta;
+    void* reservationBase = OSAllocator::reserveUncommitted(reservationSize, usage, writable, executable);
+
+    // Select an aligned region within the reservation and commit.
+    void* alignedBase = reinterpret_cast<uintptr_t>(reservationBase) & alignmentMask
+        ? reinterpret_cast<void*>((reinterpret_cast<uintptr_t>(reservationBase) & ~alignmentMask) + alignment)
+        : reservationBase;
+    OSAllocator::commit(alignedBase, size, writable, executable);
+
+    return PageAllocationAligned(alignedBase, size, reservationBase, reservationSize);
+#endif
+}
+
+void PageAllocationAligned::deallocate()
+{
+    // Clear base & size before calling release; if this is *inside* allocation
+    // then we won't be able to clear then after deallocating the memory.
+    PageAllocationAligned tmp;
+    std::swap(tmp, *this);
+
+    ASSERT(tmp);
+    ASSERT(!*this);
+
+#if OS(DARWIN)
+    vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(tmp.base()), tmp.size());
+#else
+    ASSERT(tmp.m_reservation.contains(tmp.base(), tmp.size()));
+    OSAllocator::decommitAndRelease(tmp.m_reservation.base(), tmp.m_reservation.size(), tmp.base(), tmp.size());
+#endif
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/PageAllocationAligned.h b/Source/WTF/wtf/PageAllocationAligned.h
new file mode 100644
index 0000000..c018dab
--- /dev/null
+++ b/Source/WTF/wtf/PageAllocationAligned.h
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+#ifndef PageAllocationAligned_h
+#define PageAllocationAligned_h
+
+#include <wtf/OSAllocator.h>
+#include <wtf/PageReservation.h>
+
+namespace WTF {
+
+class PageAllocationAligned : private PageBlock {
+public:
+    PageAllocationAligned()
+    {
+    }
+
+    using PageBlock::operator bool;
+    using PageBlock::size;
+    using PageBlock::base;
+
+    static PageAllocationAligned allocate(size_t size, size_t alignment, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false);
+
+    void deallocate();
+
+private:
+#if OS(DARWIN)
+    PageAllocationAligned(void* base, size_t size)
+        : PageBlock(base, size, false)
+    {
+    }
+#else
+    PageAllocationAligned(void* base, size_t size, void* reservationBase, size_t reservationSize)
+        : PageBlock(base, size, false)
+        , m_reservation(reservationBase, reservationSize, false)
+    {
+    }
+
+    PageBlock m_reservation;
+#endif
+};
+
+
+} // namespace WTF
+
+using WTF::PageAllocationAligned;
+
+#endif // PageAllocationAligned_h
diff --git a/Source/WTF/wtf/PageBlock.cpp b/Source/WTF/wtf/PageBlock.cpp
new file mode 100644
index 0000000..8bbd7eb
--- /dev/null
+++ b/Source/WTF/wtf/PageBlock.cpp
@@ -0,0 +1,78 @@
+/*
+ * 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 "config.h"
+#include "PageBlock.h"
+
+#if OS(UNIX)
+#include <unistd.h>
+#endif
+
+#if OS(WINDOWS)
+#include <malloc.h>
+#include <windows.h>
+#endif
+
+namespace WTF {
+
+static size_t s_pageSize;
+static size_t s_pageMask;
+
+#if OS(UNIX)
+
+inline size_t systemPageSize()
+{
+    return getpagesize();
+}
+
+#elif OS(WINDOWS)
+
+inline size_t systemPageSize()
+{
+    static size_t size = 0;
+    SYSTEM_INFO system_info;
+    GetSystemInfo(&system_info);
+    size = system_info.dwPageSize;
+    return size;
+}
+
+#endif
+
+size_t pageSize()
+{
+    if (!s_pageSize)
+        s_pageSize = systemPageSize();
+    ASSERT(isPowerOfTwo(s_pageSize));
+    return s_pageSize;
+}
+
+size_t pageMask()
+{
+    if (!s_pageMask)
+        s_pageMask = ~(pageSize() - 1);
+    return s_pageMask;
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/PageBlock.h b/Source/WTF/wtf/PageBlock.h
new file mode 100644
index 0000000..56e5570
--- /dev/null
+++ b/Source/WTF/wtf/PageBlock.h
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+#ifndef PageBlock_h
+#define PageBlock_h
+
+namespace WTF {
+
+WTF_EXPORT_PRIVATE size_t pageSize();
+WTF_EXPORT_PRIVATE size_t pageMask();
+inline bool isPageAligned(void* address) { return !(reinterpret_cast<intptr_t>(address) & (pageSize() - 1)); }
+inline bool isPageAligned(size_t size) { return !(size & (pageSize() - 1)); }
+inline bool isPowerOfTwo(size_t size) { return !(size & (size - 1)); }
+
+class PageBlock {
+public:
+    PageBlock();
+    PageBlock(const PageBlock&);
+    PageBlock(void*, size_t, bool hasGuardPages);
+    
+    void* base() const { return m_base; }
+    size_t size() const { return m_size; }
+
+    operator bool() const { return !!m_realBase; }
+
+    bool contains(void* containedBase, size_t containedSize)
+    {
+        return containedBase >= m_base
+            && (static_cast<char*>(containedBase) + containedSize) <= (static_cast<char*>(m_base) + m_size);
+    }
+
+private:
+    void* m_realBase;
+    void* m_base;
+    size_t m_size;
+};
+
+inline PageBlock::PageBlock()
+    : m_realBase(0)
+    , m_base(0)
+    , m_size(0)
+{
+}
+
+inline PageBlock::PageBlock(const PageBlock& other)
+    : m_realBase(other.m_realBase)
+    , m_base(other.m_base)
+    , m_size(other.m_size)
+{
+}
+
+inline PageBlock::PageBlock(void* base, size_t size, bool hasGuardPages)
+    : m_realBase(base)
+    , m_base(static_cast<char*>(base) + ((base && hasGuardPages) ? pageSize() : 0))
+    , m_size(size)
+{
+}
+
+} // namespace WTF
+
+using WTF::pageSize;
+using WTF::isPageAligned;
+using WTF::isPageAligned;
+using WTF::isPowerOfTwo;
+
+#endif // PageBlock_h
diff --git a/Source/WTF/wtf/PageReservation.h b/Source/WTF/wtf/PageReservation.h
new file mode 100644
index 0000000..77783eb
--- /dev/null
+++ b/Source/WTF/wtf/PageReservation.h
@@ -0,0 +1,149 @@
+/*
+ * 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. ``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
+ * 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 PageReservation_h
+#define PageReservation_h
+
+#include <wtf/PageAllocation.h>
+
+namespace WTF {
+
+/*
+    PageReservation
+
+    Like PageAllocation, the PageReservation class provides a cross-platform memory
+    allocation interface, but with a set of capabilities more similar to that of
+    VirtualAlloc than posix mmap.  PageReservation can be used to allocate virtual
+    memory without committing physical memory pages using PageReservation::reserve.
+    Following a call to reserve all memory in the region is in a decommited state,
+    in which the memory should not be used (accessing the memory may cause a fault).
+
+    Before using memory it must be committed by calling commit, which is passed start
+    and size values (both of which require system page size granularity).  One the
+    committed memory is no longer needed 'decommit' may be called to return the
+    memory to its devommitted state.  Commit should only be called on memory that is
+    currently decommitted, and decommit should only be called on memory regions that
+    are currently committed.  All memory should be decommited before the reservation
+    is deallocated.  Values in memory may not be retained accross a pair of calls if
+    the region of memory is decommitted and then committed again.
+
+    Memory protection should not be changed on decommitted memory, and if protection
+    is changed on memory while it is committed it should be returned to the orignal
+    protection before decommit is called.
+*/
+
+class PageReservation : private PageBlock {
+public:
+    PageReservation()
+        : m_committed(0)
+        , m_writable(false)
+        , m_executable(false)
+    {
+    }
+
+    using PageBlock::base;
+    using PageBlock::size;
+
+#ifndef __clang__
+    using PageBlock::operator bool;
+#else
+    // FIXME: This is a workaround for <rdar://problem/8876150>, wherein Clang incorrectly emits an access
+    // control warning when a client tries to use operator bool exposed above via "using PageBlock::operator bool".
+    operator bool() const { return PageBlock::operator bool(); }
+#endif
+
+    void commit(void* start, size_t size)
+    {
+        ASSERT(*this);
+        ASSERT(isPageAligned(start));
+        ASSERT(isPageAligned(size));
+        ASSERT(contains(start, size));
+
+        m_committed += size;
+        OSAllocator::commit(start, size, m_writable, m_executable);
+    }
+
+    void decommit(void* start, size_t size)
+    {
+        ASSERT(*this);
+        ASSERT(isPageAligned(start));
+        ASSERT(isPageAligned(size));
+        ASSERT(contains(start, size));
+
+        m_committed -= size;
+        OSAllocator::decommit(start, size);
+    }
+
+    size_t committed()
+    {
+        return m_committed;
+    }
+
+    static PageReservation reserve(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false)
+    {
+        ASSERT(isPageAligned(size));
+        return PageReservation(OSAllocator::reserveUncommitted(size, usage, writable, executable), size, writable, executable, false);
+    }
+    
+    static PageReservation reserveWithGuardPages(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false)
+    {
+        ASSERT(isPageAligned(size));
+        return PageReservation(OSAllocator::reserveUncommitted(size + pageSize() * 2, usage, writable, executable, true), size, writable, executable, true);
+    }
+
+    void deallocate()
+    {
+        ASSERT(!m_committed);
+
+        // Clear base & size before calling release; if this is *inside* allocation
+        // then we won't be able to clear then after deallocating the memory.
+        PageReservation tmp;
+        std::swap(tmp, *this);
+
+        ASSERT(tmp);
+        ASSERT(!*this);
+
+        OSAllocator::releaseDecommitted(tmp.base(), tmp.size());
+    }
+
+private:
+    PageReservation(void* base, size_t size, bool writable, bool executable, bool hasGuardPages)
+        : PageBlock(base, size, hasGuardPages)
+        , m_committed(0)
+        , m_writable(writable)
+        , m_executable(executable)
+    {
+    }
+
+    size_t m_committed;
+    bool m_writable;
+    bool m_executable;
+};
+
+}
+
+using WTF::PageReservation;
+
+#endif // PageReservation_h
diff --git a/Source/WTF/wtf/ParallelJobs.h b/Source/WTF/wtf/ParallelJobs.h
new file mode 100644
index 0000000..0923886
--- /dev/null
+++ b/Source/WTF/wtf/ParallelJobs.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2011 University of Szeged
+ * Copyright (C) 2011 Gabor Loki <loki@webkit.org>
+ * 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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 ParallelJobs_h
+#define ParallelJobs_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
+// Usage:
+//
+//     // Initialize parallel jobs
+//     ParallelJobs<TypeOfParameter> parallelJobs(&worker [, requestedNumberOfJobs]);
+//
+//     // Fill the parameter array
+//     for(i = 0; i < parallelJobs.numberOfJobs(); ++i) {
+//       TypeOfParameter& params = parallelJobs.parameter(i);
+//       params.attr1 = localVars ...
+//       ...
+//     }
+//
+//     // Execute parallel jobs
+//     parallelJobs.execute();
+//
+
+#if ENABLE(THREADING_GENERIC)
+#include <wtf/ParallelJobsGeneric.h>
+
+#elif ENABLE(THREADING_OPENMP)
+#include <wtf/ParallelJobsOpenMP.h>
+
+#elif ENABLE(THREADING_LIBDISPATCH)
+#include <wtf/ParallelJobsLibdispatch.h>
+
+#else
+#error "No parallel processing API for ParallelJobs"
+
+#endif
+
+namespace WTF {
+
+template<typename Type>
+class ParallelJobs {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    typedef void (*WorkerFunction)(Type*);
+
+    ParallelJobs(WorkerFunction func, int requestedJobNumber) :
+        m_parallelEnvironment(reinterpret_cast<ParallelEnvironment::ThreadFunction>(func), sizeof(Type), requestedJobNumber)
+    {
+        m_parameters.grow(m_parallelEnvironment.numberOfJobs());
+        ASSERT(numberOfJobs() == m_parameters.size());
+    }
+
+    size_t numberOfJobs()
+    {
+        return m_parameters.size();
+    }
+
+    Type& parameter(size_t i)
+    {
+        return m_parameters[i];
+    }
+
+    void execute()
+    {
+        m_parallelEnvironment.execute(reinterpret_cast<unsigned char*>(m_parameters.data()));
+    }
+
+private:
+    ParallelEnvironment m_parallelEnvironment;
+    Vector<Type> m_parameters;
+};
+
+} // namespace WTF
+
+using WTF::ParallelJobs;
+
+#endif // ParallelJobs_h
diff --git a/Source/WTF/wtf/ParallelJobsGeneric.cpp b/Source/WTF/wtf/ParallelJobsGeneric.cpp
new file mode 100644
index 0000000..2cc0bc6
--- /dev/null
+++ b/Source/WTF/wtf/ParallelJobsGeneric.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2011 University of Szeged
+ * Copyright (C) 2011 Gabor Loki <loki@webkit.org>
+ * 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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"
+
+#if ENABLE(THREADING_GENERIC)
+
+#include "ParallelJobs.h"
+#include <wtf/NumberOfCores.h>
+
+namespace WTF {
+
+Vector< RefPtr<ParallelEnvironment::ThreadPrivate> >* ParallelEnvironment::s_threadPool = 0;
+
+ParallelEnvironment::ParallelEnvironment(ThreadFunction threadFunction, size_t sizeOfParameter, int requestedJobNumber) :
+    m_threadFunction(threadFunction),
+    m_sizeOfParameter(sizeOfParameter)
+{
+    ASSERT_ARG(requestedJobNumber, requestedJobNumber >= 1);
+
+    int maxNumberOfCores = numberOfProcessorCores();
+
+    if (!requestedJobNumber || requestedJobNumber > maxNumberOfCores)
+        requestedJobNumber = static_cast<unsigned>(maxNumberOfCores);
+
+    if (!s_threadPool)
+        s_threadPool = new Vector< RefPtr<ThreadPrivate> >();
+
+    // The main thread should be also a worker.
+    int maxNumberOfNewThreads = requestedJobNumber - 1;
+
+    for (int i = 0; i < maxNumberOfCores && m_threads.size() < static_cast<unsigned>(maxNumberOfNewThreads); ++i) {
+        if (s_threadPool->size() < static_cast<unsigned>(i) + 1U)
+            s_threadPool->append(ThreadPrivate::create());
+
+        if ((*s_threadPool)[i]->tryLockFor(this))
+            m_threads.append((*s_threadPool)[i]);
+    }
+
+    m_numberOfJobs = m_threads.size() + 1;
+}
+
+void ParallelEnvironment::execute(void* parameters)
+{
+    unsigned char* currentParameter = static_cast<unsigned char*>(parameters);
+    size_t i;
+    for (i = 0; i < m_threads.size(); ++i) {
+        m_threads[i]->execute(m_threadFunction, currentParameter);
+        currentParameter += m_sizeOfParameter;
+    }
+
+    // The work for the main thread.
+    (*m_threadFunction)(currentParameter);
+
+    // Wait until all jobs are done.
+    for (i = 0; i < m_threads.size(); ++i)
+        m_threads[i]->waitForFinish();
+}
+
+bool ParallelEnvironment::ThreadPrivate::tryLockFor(ParallelEnvironment* parent)
+{
+    bool locked = m_mutex.tryLock();
+
+    if (!locked)
+        return false;
+
+    if (m_parent) {
+        m_mutex.unlock();
+        return false;
+    }
+
+    if (!m_threadID)
+        m_threadID = createThread(&ParallelEnvironment::ThreadPrivate::workerThread, this, "Parallel worker");
+
+    if (m_threadID)
+        m_parent = parent;
+
+    m_mutex.unlock();
+    return m_threadID;
+}
+
+void ParallelEnvironment::ThreadPrivate::execute(ThreadFunction threadFunction, void* parameters)
+{
+    MutexLocker lock(m_mutex);
+
+    m_threadFunction = threadFunction;
+    m_parameters = parameters;
+    m_running = true;
+    m_threadCondition.signal();
+}
+
+void ParallelEnvironment::ThreadPrivate::waitForFinish()
+{
+    MutexLocker lock(m_mutex);
+
+    while (m_running)
+        m_threadCondition.wait(m_mutex);
+}
+
+void ParallelEnvironment::ThreadPrivate::workerThread(void* threadData)
+{
+    ThreadPrivate* sharedThread = reinterpret_cast<ThreadPrivate*>(threadData);
+    MutexLocker lock(sharedThread->m_mutex);
+
+    while (sharedThread->m_threadID) {
+        if (sharedThread->m_running) {
+            (*sharedThread->m_threadFunction)(sharedThread->m_parameters);
+            sharedThread->m_running = false;
+            sharedThread->m_parent = 0;
+            sharedThread->m_threadCondition.signal();
+        }
+
+        sharedThread->m_threadCondition.wait(sharedThread->m_mutex);
+    }
+}
+
+} // namespace WTF
+#endif // ENABLE(THREADING_GENERIC)
diff --git a/Source/WTF/wtf/ParallelJobsGeneric.h b/Source/WTF/wtf/ParallelJobsGeneric.h
new file mode 100644
index 0000000..731b960
--- /dev/null
+++ b/Source/WTF/wtf/ParallelJobsGeneric.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2011 University of Szeged
+ * Copyright (C) 2011 Gabor Loki <loki@webkit.org>
+ * 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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 ParallelJobsGeneric_h
+#define ParallelJobsGeneric_h
+
+#if ENABLE(THREADING_GENERIC)
+
+#include <wtf/RefCounted.h>
+#include <wtf/Threading.h>
+
+namespace WTF {
+
+class ParallelEnvironment {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    typedef void (*ThreadFunction)(void*);
+
+    WTF_EXPORT_PRIVATE ParallelEnvironment(ThreadFunction, size_t sizeOfParameter, int requestedJobNumber);
+
+    int numberOfJobs()
+    {
+        return m_numberOfJobs;
+    }
+
+    WTF_EXPORT_PRIVATE void execute(void* parameters);
+
+    class ThreadPrivate : public RefCounted<ThreadPrivate> {
+    public:
+        ThreadPrivate()
+            : m_threadID(0)
+            , m_running(false)
+            , m_parent(0)
+        {
+        }
+
+        bool tryLockFor(ParallelEnvironment*);
+
+        void execute(ThreadFunction, void*);
+
+        void waitForFinish();
+
+        static PassRefPtr<ThreadPrivate> create()
+        {
+            return adoptRef(new ThreadPrivate());
+        }
+
+        static void workerThread(void*);
+
+    private:
+        ThreadIdentifier m_threadID;
+        bool m_running;
+        ParallelEnvironment* m_parent;
+
+        mutable Mutex m_mutex;
+        ThreadCondition m_threadCondition;
+
+        ThreadFunction m_threadFunction;
+        void* m_parameters;
+    };
+
+private:
+    ThreadFunction m_threadFunction;
+    size_t m_sizeOfParameter;
+    int m_numberOfJobs;
+
+    Vector< RefPtr<ThreadPrivate> > m_threads;
+    static Vector< RefPtr<ThreadPrivate> >* s_threadPool;
+};
+
+} // namespace WTF
+
+#endif // ENABLE(THREADING_GENERIC)
+
+
+#endif // ParallelJobsGeneric_h
diff --git a/Source/WTF/wtf/ParallelJobsLibdispatch.h b/Source/WTF/wtf/ParallelJobsLibdispatch.h
new file mode 100644
index 0000000..ca7d9a4
--- /dev/null
+++ b/Source/WTF/wtf/ParallelJobsLibdispatch.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2011 University of Szeged
+ * Copyright (C) 2011 Gabor Loki <loki@webkit.org>
+ * 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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 ParallelJobsLibdispatch_h
+#define ParallelJobsLibdispatch_h
+
+#if ENABLE(THREADING_LIBDISPATCH)
+
+#include <dispatch/dispatch.h>
+
+namespace WTF {
+
+class ParallelEnvironment {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    typedef void (*ThreadFunction)(void*);
+
+    ParallelEnvironment(ThreadFunction threadFunction, size_t sizeOfParameter, int requestedJobNumber)
+        : m_threadFunction(threadFunction)
+        , m_sizeOfParameter(sizeOfParameter)
+        , m_numberOfJobs(requestedJobNumber)
+    {
+        // We go with the requested number of jobs. libdispatch will distribute the work optimally.
+        ASSERT_ARG(requestedJobNumber, requestedJobNumber > 0);
+    }
+
+    int numberOfJobs()
+    {
+        return m_numberOfJobs;
+    }
+
+    void execute(unsigned char* parameters)
+    {
+        static dispatch_queue_t globalQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
+
+        dispatch_apply(m_numberOfJobs, globalQueue, ^(size_t i) { (*m_threadFunction)(parameters + (m_sizeOfParameter * i)); });
+    }
+
+private:
+    ThreadFunction m_threadFunction;
+    size_t m_sizeOfParameter;
+    int m_numberOfJobs;
+};
+
+} // namespace WTF
+
+#endif // ENABLE(THREADING_LIBDISPATCH)
+
+#endif // ParallelJobsLibdispatch_h
diff --git a/Source/WTF/wtf/ParallelJobsOpenMP.h b/Source/WTF/wtf/ParallelJobsOpenMP.h
new file mode 100644
index 0000000..706bd80
--- /dev/null
+++ b/Source/WTF/wtf/ParallelJobsOpenMP.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2011 University of Szeged
+ * Copyright (C) 2011 Gabor Loki <loki@webkit.org>
+ * 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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 ParallelJobsOpenMP_h
+#define ParallelJobsOpenMP_h
+
+#if ENABLE(THREADING_OPENMP)
+
+#include <omp.h>
+
+namespace WTF {
+
+class ParallelEnvironment {
+    WTF_MAKE_NONCOPYABLE(ParallelEnvironment);
+public:
+    typedef void (*ThreadFunction)(void*);
+
+    ParallelEnvironment(ThreadFunction threadFunction, size_t sizeOfParameter, int requestedJobNumber) :
+        m_threadFunction(threadFunction),
+        m_sizeOfParameter(sizeOfParameter)
+    {
+        int maxNumberOfThreads = omp_get_max_threads();
+
+        if (!requestedJobNumber || requestedJobNumber > maxNumberOfThreads)
+            requestedJobNumber = maxNumberOfThreads;
+
+        ASSERT(requestedJobNumber > 0);
+
+        m_numberOfJobs = requestedJobNumber;
+
+    }
+
+    int numberOfJobs()
+    {
+        return m_numberOfJobs;
+    }
+
+    void execute(unsigned char* parameters)
+    {
+        omp_set_num_threads(m_numberOfJobs);
+
+#pragma omp parallel for
+        for (int i = 0; i < m_numberOfJobs; ++i)
+            (*m_threadFunction)(parameters + i * m_sizeOfParameter);
+    }
+
+private:
+    ThreadFunction m_threadFunction;
+    size_t m_sizeOfParameter;
+    int m_numberOfJobs;
+};
+
+} // namespace WTF
+
+#endif // ENABLE(THREADING_OPENMP)
+
+#endif // ParallelJobsOpenMP_h
diff --git a/Source/WTF/wtf/PassOwnArrayPtr.h b/Source/WTF/wtf/PassOwnArrayPtr.h
new file mode 100644
index 0000000..1db7343
--- /dev/null
+++ b/Source/WTF/wtf/PassOwnArrayPtr.h
@@ -0,0 +1,169 @@
+/*
+ * 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. ``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
+ * 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_PassOwnArrayPtr_h
+#define WTF_PassOwnArrayPtr_h
+
+#include <wtf/Assertions.h>
+#include <wtf/NullPtr.h>
+#include <wtf/TypeTraits.h>
+
+namespace WTF {
+
+template<typename T> class OwnArrayPtr;
+template<typename T> class PassOwnArrayPtr;
+template<typename T> PassOwnArrayPtr<T> adoptArrayPtr(T*);
+template<typename T> void deleteOwnedArrayPtr(T* ptr);
+
+template<typename T> class PassOwnArrayPtr {
+public:
+    typedef T* PtrType;
+
+    PassOwnArrayPtr() : m_ptr(0) { }
+    PassOwnArrayPtr(std::nullptr_t) : m_ptr(0) { }
+
+    // It somewhat breaks the type system to allow transfer of ownership out of
+    // a const PassOwnArrayPtr. However, it makes it much easier to work with PassOwnArrayPtr
+    // temporaries, and we don't have a need to use real const PassOwnArrayPtrs anyway.
+    PassOwnArrayPtr(const PassOwnArrayPtr& o) : m_ptr(o.leakPtr()) { }
+    template<typename U> PassOwnArrayPtr(const PassOwnArrayPtr<U>& o) : m_ptr(o.leakPtr()) { }
+
+    ~PassOwnArrayPtr() { deleteOwnedArrayPtr(m_ptr); }
+
+    PtrType get() const { return m_ptr; }
+
+    PtrType leakPtr() const WARN_UNUSED_RETURN;
+
+    T& operator*() const { ASSERT(m_ptr); return *m_ptr; }
+    PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
+
+    bool operator!() const { return !m_ptr; }
+
+    // This conversion operator allows implicit conversion to bool but not to other integer types.
+    typedef PtrType PassOwnArrayPtr::*UnspecifiedBoolType;
+    operator UnspecifiedBoolType() const { return m_ptr ? &PassOwnArrayPtr::m_ptr : 0; }
+
+    PassOwnArrayPtr& operator=(const PassOwnArrayPtr&) { COMPILE_ASSERT(!sizeof(T*), PassOwnArrayPtr_should_never_be_assigned_to); return *this; }
+
+    template<typename U> friend PassOwnArrayPtr<U> adoptArrayPtr(U*);
+
+private:
+    explicit PassOwnArrayPtr(PtrType ptr) : m_ptr(ptr) { }
+
+    mutable PtrType m_ptr;
+};
+
+template<typename T> inline typename PassOwnArrayPtr<T>::PtrType PassOwnArrayPtr<T>::leakPtr() const
+{
+    PtrType ptr = m_ptr;
+    m_ptr = 0;
+    return ptr;
+}
+
+template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b) 
+{
+    return a.get() == b.get(); 
+}
+
+template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T>& a, const OwnArrayPtr<U>& b) 
+{
+    return a.get() == b.get(); 
+}
+
+template<typename T, typename U> inline bool operator==(const OwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b) 
+{
+    return a.get() == b.get(); 
+}
+
+template<typename T, typename U> inline bool operator==(const PassOwnArrayPtr<T>& a, U* b) 
+{
+    return a.get() == b; 
+}
+
+template<typename T, typename U> inline bool operator==(T* a, const PassOwnArrayPtr<U>& b) 
+{
+    return a == b.get(); 
+}
+
+template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b) 
+{
+    return a.get() != b.get(); 
+}
+
+template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T>& a, const OwnArrayPtr<U>& b) 
+{
+    return a.get() != b.get(); 
+}
+
+template<typename T, typename U> inline bool operator!=(const OwnArrayPtr<T>& a, const PassOwnArrayPtr<U>& b) 
+{
+    return a.get() != b.get(); 
+}
+
+template<typename T, typename U> inline bool operator!=(const PassOwnArrayPtr<T>& a, U* b)
+{
+    return a.get() != b; 
+}
+
+template<typename T, typename U> inline bool operator!=(T* a, const PassOwnArrayPtr<U>& b) 
+{
+    return a != b.get(); 
+}
+
+template<typename T> inline PassOwnArrayPtr<T> adoptArrayPtr(T* ptr)
+{
+    return PassOwnArrayPtr<T>(ptr);
+}
+
+template<typename T> inline void deleteOwnedArrayPtr(T* ptr)
+{
+    typedef char known[sizeof(T) ? 1 : -1];
+    if (sizeof(known))
+        delete [] ptr;
+}
+
+template<typename T, typename U> inline PassOwnArrayPtr<T> static_pointer_cast(const PassOwnArrayPtr<U>& p) 
+{
+    return adoptArrayPtr(static_cast<T*>(p.leakPtr()));
+}
+
+template<typename T, typename U> inline PassOwnArrayPtr<T> const_pointer_cast(const PassOwnArrayPtr<U>& p) 
+{
+    return adoptArrayPtr(const_cast<T*>(p.leakPtr()));
+}
+
+template<typename T> inline T* getPtr(const PassOwnArrayPtr<T>& p)
+{
+    return p.get();
+}
+
+} // namespace WTF
+
+using WTF::PassOwnArrayPtr;
+using WTF::adoptArrayPtr;
+using WTF::const_pointer_cast;
+using WTF::static_pointer_cast;
+
+#endif // WTF_PassOwnArrayPtr_h
diff --git a/Source/WTF/wtf/PassOwnPtr.h b/Source/WTF/wtf/PassOwnPtr.h
new file mode 100644
index 0000000..5ebf83d
--- /dev/null
+++ b/Source/WTF/wtf/PassOwnPtr.h
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2009, 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. ``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
+ * 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_PassOwnPtr_h
+#define WTF_PassOwnPtr_h
+
+#include <wtf/Assertions.h>
+#include <wtf/NullPtr.h>
+#include <wtf/OwnPtrCommon.h>
+#include <wtf/TypeTraits.h>
+
+namespace WTF {
+
+    // Unlike most of our smart pointers, PassOwnPtr can take either the pointer type or the pointed-to type.
+
+    template<typename T> class OwnPtr;
+    template<typename T> class PassOwnPtr;
+    template<typename T> PassOwnPtr<T> adoptPtr(T*);
+
+    template<typename T> class PassOwnPtr {
+    public:
+        typedef typename RemovePointer<T>::Type ValueType;
+        typedef ValueType* PtrType;
+
+        PassOwnPtr() : m_ptr(0) { }
+        PassOwnPtr(std::nullptr_t) : m_ptr(0) { }
+
+        // It somewhat breaks the type system to allow transfer of ownership out of
+        // a const PassOwnPtr. However, it makes it much easier to work with PassOwnPtr
+        // temporaries, and we don't have a need to use real const PassOwnPtrs anyway.
+        PassOwnPtr(const PassOwnPtr& o) : m_ptr(o.leakPtr()) { }
+        template<typename U> PassOwnPtr(const PassOwnPtr<U>& o) : m_ptr(o.leakPtr()) { }
+
+        ~PassOwnPtr() { deleteOwnedPtr(m_ptr); }
+
+        PtrType get() const { return m_ptr; }
+
+        PtrType leakPtr() const WARN_UNUSED_RETURN;
+
+        ValueType& operator*() const { ASSERT(m_ptr); return *m_ptr; }
+        PtrType operator->() const { ASSERT(m_ptr); return m_ptr; }
+
+        bool operator!() const { return !m_ptr; }
+
+        // This conversion operator allows implicit conversion to bool but not to other integer types.
+        typedef PtrType PassOwnPtr::*UnspecifiedBoolType;
+        operator UnspecifiedBoolType() const { return m_ptr ? &PassOwnPtr::m_ptr : 0; }
+
+        PassOwnPtr& operator=(const PassOwnPtr&) { COMPILE_ASSERT(!sizeof(T*), PassOwnPtr_should_never_be_assigned_to); return *this; }
+
+        template<typename U> friend PassOwnPtr<U> adoptPtr(U*);
+
+    private:
+        explicit PassOwnPtr(PtrType ptr) : m_ptr(ptr) { }
+
+        // We should never have two OwnPtrs for the same underlying object (otherwise we'll get
+        // double-destruction), so these equality operators should never be needed.
+        template<typename U> bool operator==(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+        template<typename U> bool operator!=(const PassOwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+        template<typename U> bool operator==(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+        template<typename U> bool operator!=(const OwnPtr<U>&) { COMPILE_ASSERT(!sizeof(U*), OwnPtrs_should_never_be_equal); return false; }
+
+        mutable PtrType m_ptr;
+    };
+
+    template<typename T> inline typename PassOwnPtr<T>::PtrType PassOwnPtr<T>::leakPtr() const
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = 0;
+        return ptr;
+    }
+
+    template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, const PassOwnPtr<U>& b) 
+    {
+        return a.get() == b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, const OwnPtr<U>& b) 
+    {
+        return a.get() == b.get(); 
+    }
+    
+    template<typename T, typename U> inline bool operator==(const OwnPtr<T>& a, const PassOwnPtr<U>& b) 
+    {
+        return a.get() == b.get(); 
+    }
+    
+    template<typename T, typename U> inline bool operator==(const PassOwnPtr<T>& a, U* b) 
+    {
+        return a.get() == b; 
+    }
+    
+    template<typename T, typename U> inline bool operator==(T* a, const PassOwnPtr<U>& b) 
+    {
+        return a == b.get(); 
+    }
+    
+    template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, const PassOwnPtr<U>& b) 
+    {
+        return a.get() != b.get(); 
+    }
+    
+    template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, const OwnPtr<U>& b) 
+    {
+        return a.get() != b.get(); 
+    }
+    
+    template<typename T, typename U> inline bool operator!=(const OwnPtr<T>& a, const PassOwnPtr<U>& b) 
+    {
+        return a.get() != b.get(); 
+    }
+    
+    template<typename T, typename U> inline bool operator!=(const PassOwnPtr<T>& a, U* b)
+    {
+        return a.get() != b; 
+    }
+    
+    template<typename T, typename U> inline bool operator!=(T* a, const PassOwnPtr<U>& b) 
+    {
+        return a != b.get(); 
+    }
+
+    template<typename T> inline PassOwnPtr<T> adoptPtr(T* ptr)
+    {
+        return PassOwnPtr<T>(ptr);
+    }
+
+    template<typename T, typename U> inline PassOwnPtr<T> static_pointer_cast(const PassOwnPtr<U>& p) 
+    {
+        return adoptPtr(static_cast<T*>(p.leakPtr()));
+    }
+
+    template<typename T, typename U> inline PassOwnPtr<T> const_pointer_cast(const PassOwnPtr<U>& p) 
+    {
+        return adoptPtr(const_cast<T*>(p.leakPtr()));
+    }
+
+    template<typename T> inline T* getPtr(const PassOwnPtr<T>& p)
+    {
+        return p.get();
+    }
+
+} // namespace WTF
+
+using WTF::PassOwnPtr;
+using WTF::adoptPtr;
+using WTF::const_pointer_cast;
+using WTF::static_pointer_cast;
+
+#endif // WTF_PassOwnPtr_h
diff --git a/Source/WTF/wtf/PassRefPtr.h b/Source/WTF/wtf/PassRefPtr.h
new file mode 100644
index 0000000..5f50671
--- /dev/null
+++ b/Source/WTF/wtf/PassRefPtr.h
@@ -0,0 +1,188 @@
+/*
+ *  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 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_PassRefPtr_h
+#define WTF_PassRefPtr_h
+
+#include <wtf/AlwaysInline.h>
+#include <wtf/Assertions.h>
+#include <wtf/NullPtr.h>
+
+namespace WTF {
+
+    template<typename T> class RefPtr;
+    template<typename T> class PassRefPtr;
+    template<typename T> PassRefPtr<T> adoptRef(T*);
+
+    inline void adopted(const void*) { }
+
+#if !(PLATFORM(QT) && CPU(ARM))
+    #define REF_DEREF_INLINE ALWAYS_INLINE
+#else
+    // Older version of gcc used by Harmattan SDK fails to build with ALWAYS_INLINE.
+    // See https://bugs.webkit.org/show_bug.cgi?id=37253 for details.
+    #define REF_DEREF_INLINE inline
+#endif
+
+    template<typename T> REF_DEREF_INLINE void refIfNotNull(T* ptr)
+    {
+        if (LIKELY(ptr != 0))
+            ptr->ref();
+    }
+
+    template<typename T> REF_DEREF_INLINE void derefIfNotNull(T* ptr)
+    {
+        if (LIKELY(ptr != 0))
+            ptr->deref();
+    }
+
+    #undef REF_DEREF_INLINE
+
+    template<typename T> class PassRefPtr {
+    public:
+        PassRefPtr() : m_ptr(0) { }
+        PassRefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
+        // It somewhat breaks the type system to allow transfer of ownership out of
+        // a const PassRefPtr. However, it makes it much easier to work with PassRefPtr
+        // temporaries, and we don't have a need to use real const PassRefPtrs anyway.
+        PassRefPtr(const PassRefPtr& o) : m_ptr(o.leakRef()) { }
+        template<typename U> PassRefPtr(const PassRefPtr<U>& o) : m_ptr(o.leakRef()) { }
+
+        ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull(m_ptr); }
+
+        template<typename U> PassRefPtr(const RefPtr<U>&);
+        
+        T* get() const { return m_ptr; }
+
+        T* leakRef() const WARN_UNUSED_RETURN;
+
+        T& operator*() const { return *m_ptr; }
+        T* operator->() const { return m_ptr; }
+
+        bool operator!() const { return !m_ptr; }
+
+        // This conversion operator allows implicit conversion to bool but not to other integer types.
+        typedef T* (PassRefPtr::*UnspecifiedBoolType);
+        operator UnspecifiedBoolType() const { return m_ptr ? &PassRefPtr::m_ptr : 0; }
+
+        PassRefPtr& operator=(const PassRefPtr&) { COMPILE_ASSERT(!sizeof(T*), PassRefPtr_should_never_be_assigned_to); return *this; }
+
+        friend PassRefPtr adoptRef<T>(T*);
+
+    private:
+        // adopting constructor
+        PassRefPtr(T* ptr, bool) : m_ptr(ptr) { }
+
+        mutable T* m_ptr;
+    };
+    
+    template<typename T> template<typename U> inline PassRefPtr<T>::PassRefPtr(const RefPtr<U>& o)
+        : m_ptr(o.get())
+    {
+        T* ptr = m_ptr;
+        refIfNotNull(ptr);
+    }
+
+    template<typename T> inline T* PassRefPtr<T>::leakRef() const
+    {
+        T* ptr = m_ptr;
+        m_ptr = 0;
+        return ptr;
+    }
+
+    template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a, const PassRefPtr<U>& b) 
+    { 
+        return a.get() == b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a, const RefPtr<U>& b) 
+    { 
+        return a.get() == b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, const PassRefPtr<U>& b) 
+    { 
+        return a.get() == b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator==(const PassRefPtr<T>& a, U* b) 
+    { 
+        return a.get() == b; 
+    }
+    
+    template<typename T, typename U> inline bool operator==(T* a, const PassRefPtr<U>& b) 
+    {
+        return a == b.get(); 
+    }
+    
+    template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a, const PassRefPtr<U>& b) 
+    { 
+        return a.get() != b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a, const RefPtr<U>& b) 
+    { 
+        return a.get() != b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const PassRefPtr<U>& b) 
+    { 
+        return a.get() != b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a, U* b)
+    {
+        return a.get() != b; 
+    }
+
+    template<typename T, typename U> inline bool operator!=(T* a, const PassRefPtr<U>& b) 
+    { 
+        return a != b.get(); 
+    }
+    
+    template<typename T> inline PassRefPtr<T> adoptRef(T* p)
+    {
+        adopted(p);
+        return PassRefPtr<T>(p, true);
+    }
+
+    template<typename T, typename U> inline PassRefPtr<T> static_pointer_cast(const PassRefPtr<U>& p) 
+    { 
+        return adoptRef(static_cast<T*>(p.leakRef())); 
+    }
+
+    template<typename T, typename U> inline PassRefPtr<T> const_pointer_cast(const PassRefPtr<U>& p) 
+    { 
+        return adoptRef(const_cast<T*>(p.leakRef())); 
+    }
+
+    template<typename T> inline T* getPtr(const PassRefPtr<T>& p)
+    {
+        return p.get();
+    }
+
+} // namespace WTF
+
+using WTF::PassRefPtr;
+using WTF::adoptRef;
+using WTF::static_pointer_cast;
+using WTF::const_pointer_cast;
+
+#endif // WTF_PassRefPtr_h
diff --git a/Source/WTF/wtf/PassTraits.h b/Source/WTF/wtf/PassTraits.h
new file mode 100644
index 0000000..9564e3a
--- /dev/null
+++ b/Source/WTF/wtf/PassTraits.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2011 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef WTF_PassTraits_h
+#define WTF_PassTraits_h
+
+#include <wtf/OwnPtr.h>
+#include <wtf/RefPtr.h>
+
+// The PassTraits template exists to help optimize (or make possible) use
+// of WTF data structures with WTF smart pointers that have a Pass
+// variant for transfer of ownership
+
+namespace WTF {
+
+template<typename T> struct PassTraits {
+    typedef T Type;
+    typedef T PassType;
+    static PassType transfer(Type& value) { return value; }
+};
+
+template<typename T> struct PassTraits<OwnPtr<T> > {
+    typedef OwnPtr<T> Type;
+    typedef PassOwnPtr<T> PassType;
+    static PassType transfer(Type& value) { return value.release(); }
+};
+
+template<typename T> struct PassTraits<RefPtr<T> > {
+    typedef RefPtr<T> Type;
+    typedef PassRefPtr<T> PassType;
+    static PassType transfer(Type& value) { return value.release(); }
+};
+
+} // namespace WTF
+
+using WTF::PassTraits;
+
+#endif // WTF_PassTraits_h
diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
new file mode 100644
index 0000000..0ab8086
--- /dev/null
+++ b/Source/WTF/wtf/Platform.h
@@ -0,0 +1,1206 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ * Copyright (C) 2010, 2011 Research In Motion Limited. 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 COMPUTER, INC. ``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 COMPUTER, INC. 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_Platform_h
+#define WTF_Platform_h
+
+/* Include compiler specific macros */
+#include <wtf/Compiler.h>
+
+/* ==== PLATFORM handles OS, operating environment, graphics API, and
+   CPU. This macro will be phased out in favor of platform adaptation
+   macros, policy decision macros, and top-level port definitions. ==== */
+#define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE  && WTF_PLATFORM_##WTF_FEATURE)
+
+
+/* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
+
+/* CPU() - the target CPU architecture */
+#define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE  && WTF_CPU_##WTF_FEATURE)
+/* HAVE() - specific system features (headers, functions or similar) that are present or not */
+#define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE  && HAVE_##WTF_FEATURE)
+/* OS() - underlying operating system; only to be used for mandated low-level services like 
+   virtual memory, not to choose a GUI toolkit */
+#define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE  && WTF_OS_##WTF_FEATURE)
+
+
+/* ==== Policy decision macros: these define policy choices for a particular port. ==== */
+
+/* USE() - use a particular third-party library or optional OS service */
+#define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE  && WTF_USE_##WTF_FEATURE)
+/* ENABLE() - turn on a specific feature of WebKit */
+#define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE  && ENABLE_##WTF_FEATURE)
+
+
+/* ==== CPU() - the target CPU architecture ==== */
+
+/* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */
+
+/* CPU(ALPHA) - DEC Alpha */
+#if defined(__alpha__)
+#define WTF_CPU_ALPHA 1
+#endif
+
+/* CPU(IA64) - Itanium / IA-64 */
+#if defined(__ia64__)
+#define WTF_CPU_IA64 1
+/* 32-bit mode on Itanium */
+#if !defined(__LP64__)
+#define WTF_CPU_IA64_32 1
+#endif
+#endif
+
+/* CPU(MIPS) - MIPS 32-bit */
+/* Note: Only O32 ABI is tested, so we enable it for O32 ABI for now.  */
+#if (defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_)) \
+    && defined(_ABIO32)
+#define WTF_CPU_MIPS 1
+#if defined(__MIPSEB__)
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+#define WTF_MIPS_PIC (defined __PIC__)
+#define WTF_MIPS_ARCH __mips
+#define WTF_MIPS_ISA(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH == v)
+#define WTF_MIPS_ISA_AT_LEAST(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH >= v)
+#define WTF_MIPS_ARCH_REV __mips_isa_rev
+#define WTF_MIPS_ISA_REV(v) (defined WTF_MIPS_ARCH_REV && WTF_MIPS_ARCH_REV == v)
+#define WTF_MIPS_DOUBLE_FLOAT (defined __mips_hard_float && !defined __mips_single_float)
+#define WTF_MIPS_FP64 (defined __mips_fpr && __mips_fpr == 64)
+/* MIPS requires allocators to use aligned memory */
+#define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
+#endif /* MIPS */
+
+/* CPU(PPC) - PowerPC 32-bit */
+#if   defined(__ppc__)     \
+    || defined(__PPC__)     \
+    || defined(__powerpc__) \
+    || defined(__powerpc)   \
+    || defined(__POWERPC__) \
+    || defined(_M_PPC)      \
+    || defined(__PPC)
+#define WTF_CPU_PPC 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(PPC64) - PowerPC 64-bit */
+#if   defined(__ppc64__) \
+    || defined(__PPC64__)
+#define WTF_CPU_PPC64 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(SH4) - SuperH SH-4 */
+#if defined(__SH4__)
+#define WTF_CPU_SH4 1
+#endif
+
+/* CPU(SPARC32) - SPARC 32-bit */
+#if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8)
+#define WTF_CPU_SPARC32 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(SPARC64) - SPARC 64-bit */
+#if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)
+#define WTF_CPU_SPARC64 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */
+#if CPU(SPARC32) || CPU(SPARC64)
+#define WTF_CPU_SPARC 1
+#endif
+
+/* CPU(S390X) - S390 64-bit */
+#if defined(__s390x__)
+#define WTF_CPU_S390X 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(S390) - S390 32-bit */
+#if defined(__s390__)
+#define WTF_CPU_S390 1
+#define WTF_CPU_BIG_ENDIAN 1
+#endif
+
+/* CPU(X86) - i386 / x86 32-bit */
+#if   defined(__i386__) \
+    || defined(i386)     \
+    || defined(_M_IX86)  \
+    || defined(_X86_)    \
+    || defined(__THW_INTEL)
+#define WTF_CPU_X86 1
+#endif
+
+/* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */
+#if   defined(__x86_64__) \
+    || defined(_M_X64)
+#define WTF_CPU_X86_64 1
+#endif
+
+/* CPU(ARM) - ARM, any version*/
+#if   defined(arm) \
+    || defined(__arm__) \
+    || defined(ARM) \
+    || defined(_ARM_)
+#define WTF_CPU_ARM 1
+
+#if defined(__ARM_PCS_VFP)
+#define WTF_CPU_ARM_HARDFP 1
+#endif
+
+#if defined(__ARMEB__) || (COMPILER(RVCT) && defined(__BIG_ENDIAN))
+#define WTF_CPU_BIG_ENDIAN 1
+
+#elif !defined(__ARM_EABI__) \
+    && !defined(__EABI__) \
+    && !defined(__VFP_FP__) \
+    && !defined(_WIN32_WCE) \
+    && !defined(ANDROID)
+#define WTF_CPU_MIDDLE_ENDIAN 1
+
+#endif
+
+#define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N)
+
+/* Set WTF_ARM_ARCH_VERSION */
+#if   defined(__ARM_ARCH_4__) \
+    || defined(__ARM_ARCH_4T__) \
+    || defined(__MARM_ARMV4__) \
+    || defined(_ARMV4I_)
+#define WTF_ARM_ARCH_VERSION 4
+
+#elif defined(__ARM_ARCH_5__) \
+    || defined(__ARM_ARCH_5T__) \
+    || defined(__MARM_ARMV5__)
+#define WTF_ARM_ARCH_VERSION 5
+
+#elif defined(__ARM_ARCH_5E__) \
+    || defined(__ARM_ARCH_5TE__) \
+    || defined(__ARM_ARCH_5TEJ__)
+#define WTF_ARM_ARCH_VERSION 5
+/*ARMv5TE requires allocators to use aligned memory*/
+#define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
+
+#elif defined(__ARM_ARCH_6__) \
+    || defined(__ARM_ARCH_6J__) \
+    || defined(__ARM_ARCH_6K__) \
+    || defined(__ARM_ARCH_6Z__) \
+    || defined(__ARM_ARCH_6ZK__) \
+    || defined(__ARM_ARCH_6T2__) \
+    || defined(__ARMV6__)
+#define WTF_ARM_ARCH_VERSION 6
+
+#elif defined(__ARM_ARCH_7A__) \
+    || defined(__ARM_ARCH_7R__)
+#define WTF_ARM_ARCH_VERSION 7
+
+/* RVCT sets _TARGET_ARCH_ARM */
+#elif defined(__TARGET_ARCH_ARM)
+#define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM
+
+#if defined(__TARGET_ARCH_5E) \
+    || defined(__TARGET_ARCH_5TE) \
+    || defined(__TARGET_ARCH_5TEJ)
+/*ARMv5TE requires allocators to use aligned memory*/
+#define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
+#endif
+
+#else
+#define WTF_ARM_ARCH_VERSION 0
+
+#endif
+
+/* Set WTF_THUMB_ARCH_VERSION */
+#if   defined(__ARM_ARCH_4T__)
+#define WTF_THUMB_ARCH_VERSION 1
+
+#elif defined(__ARM_ARCH_5T__) \
+    || defined(__ARM_ARCH_5TE__) \
+    || defined(__ARM_ARCH_5TEJ__)
+#define WTF_THUMB_ARCH_VERSION 2
+
+#elif defined(__ARM_ARCH_6J__) \
+    || defined(__ARM_ARCH_6K__) \
+    || defined(__ARM_ARCH_6Z__) \
+    || defined(__ARM_ARCH_6ZK__) \
+    || defined(__ARM_ARCH_6M__)
+#define WTF_THUMB_ARCH_VERSION 3
+
+#elif defined(__ARM_ARCH_6T2__) \
+    || defined(__ARM_ARCH_7__) \
+    || defined(__ARM_ARCH_7A__) \
+    || defined(__ARM_ARCH_7R__) \
+    || defined(__ARM_ARCH_7M__)
+#define WTF_THUMB_ARCH_VERSION 4
+
+/* RVCT sets __TARGET_ARCH_THUMB */
+#elif defined(__TARGET_ARCH_THUMB)
+#define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB
+
+#else
+#define WTF_THUMB_ARCH_VERSION 0
+#endif
+
+
+/* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */
+/* On ARMv5 and below the natural alignment is required. 
+   And there are some other differences for v5 or earlier. */
+#if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6)
+#define WTF_CPU_ARMV5_OR_LOWER 1
+#endif
+
+
+/* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */
+/* CPU(ARM_THUMB2) - Thumb2 instruction set is available */
+/* Only one of these will be defined. */
+#if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2)
+#  if defined(thumb2) || defined(__thumb2__) \
+    || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4)
+#    define WTF_CPU_ARM_TRADITIONAL 0
+#    define WTF_CPU_ARM_THUMB2 1
+#  elif WTF_ARM_ARCH_AT_LEAST(4)
+#    define WTF_CPU_ARM_TRADITIONAL 1
+#    define WTF_CPU_ARM_THUMB2 0
+#  else
+#    error "Not supported ARM architecture"
+#  endif
+#elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */
+#  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
+
+#if CPU(ARM_NEON) && (!COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 7, 0))
+// All NEON intrinsics usage can be disabled by this macro.
+#define HAVE_ARM_NEON_INTRINSICS 1
+#endif
+
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
+#define WTF_CPU_ARM_VFP 1
+#endif
+
+#if defined(__ARM_ARCH_7S__)
+#define WTF_CPU_APPLE_ARMV7S 1
+#endif
+
+#endif /* ARM */
+
+#if CPU(ARM) || CPU(MIPS) || CPU(SH4) || CPU(SPARC)
+#define WTF_CPU_NEEDS_ALIGNED_ACCESS 1
+#endif
+
+/* ==== OS() - underlying operating system; only to be used for mandated low-level services like 
+   virtual memory, not to choose a GUI toolkit ==== */
+
+/* OS(ANDROID) - Android */
+#ifdef ANDROID
+#define WTF_OS_ANDROID 1
+#endif
+
+/* OS(AIX) - AIX */
+#ifdef _AIX
+#define WTF_OS_AIX 1
+#endif
+
+/* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */
+#ifdef __APPLE__
+#define WTF_OS_DARWIN 1
+
+#include <Availability.h>
+#include <AvailabilityMacros.h>
+#include <TargetConditionals.h>
+#endif
+
+/* OS(IOS) - iOS */
+/* OS(MAC_OS_X) - Mac OS X (not including iOS) */
+#if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \
+    || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)                 \
+    || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR))
+#define WTF_OS_IOS 1
+#elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC
+#define WTF_OS_MAC_OS_X 1
+
+/* FIXME: These can be removed after sufficient time has passed since the removal of BUILDING_ON / TARGETING macros. */
+
+#define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED 0 / 0
+#define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED 0 / 0
+
+#define BUILDING_ON_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED
+#define BUILDING_ON_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED
+#define BUILDING_ON_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED
+
+#define TARGETING_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED
+#define TARGETING_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED
+#define TARGETING_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED
+#endif
+
+/* OS(FREEBSD) - FreeBSD */
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
+#define WTF_OS_FREEBSD 1
+#endif
+
+/* OS(HURD) - GNU/Hurd */
+#ifdef __GNU__
+#define WTF_OS_HURD 1
+#endif
+
+/* OS(LINUX) - Linux */
+#ifdef __linux__
+#define WTF_OS_LINUX 1
+#endif
+
+/* OS(NETBSD) - NetBSD */
+#if defined(__NetBSD__)
+#define WTF_OS_NETBSD 1
+#endif
+
+/* OS(OPENBSD) - OpenBSD */
+#ifdef __OpenBSD__
+#define WTF_OS_OPENBSD 1
+#endif
+
+/* OS(QNX) - QNX */
+#if defined(__QNXNTO__)
+#define WTF_OS_QNX 1
+#endif
+
+/* OS(SOLARIS) - Solaris */
+#if defined(sun) || defined(__sun)
+#define WTF_OS_SOLARIS 1
+#endif
+
+/* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */
+#if defined(_WIN32_WCE)
+#define WTF_OS_WINCE 1
+#endif
+
+/* OS(WINDOWS) - Any version of Windows */
+#if defined(WIN32) || defined(_WIN32)
+#define WTF_OS_WINDOWS 1
+#endif
+
+#define WTF_OS_WIN ERROR "USE WINDOWS WITH OS NOT WIN"
+#define WTF_OS_MAC ERROR "USE MAC_OS_X WITH OS NOT MAC"
+
+/* OS(UNIX) - Any Unix-like system */
+#if   OS(AIX)              \
+    || OS(ANDROID)          \
+    || OS(DARWIN)           \
+    || OS(FREEBSD)          \
+    || OS(HURD)             \
+    || OS(LINUX)            \
+    || OS(NETBSD)           \
+    || OS(OPENBSD)          \
+    || OS(QNX)              \
+    || OS(SOLARIS)          \
+    || defined(unix)        \
+    || defined(__unix)      \
+    || defined(__unix__)
+#define WTF_OS_UNIX 1
+#endif
+
+/* Operating environments */
+
+/* FIXME: these are all mixes of OS, operating environment and policy choices. */
+/* PLATFORM(CHROMIUM) */
+/* PLATFORM(QT) */
+/* PLATFORM(WX) */
+/* PLATFORM(GTK) */
+/* PLATFORM(BLACKBERRY) */
+/* PLATFORM(MAC) */
+/* PLATFORM(WIN) */
+#if defined(BUILDING_CHROMIUM__)
+#define WTF_PLATFORM_CHROMIUM 1
+#elif defined(BUILDING_QT__)
+#define WTF_PLATFORM_QT 1
+#elif defined(BUILDING_WX__)
+#define WTF_PLATFORM_WX 1
+#elif defined(BUILDING_GTK__)
+#define WTF_PLATFORM_GTK 1
+#elif defined(BUILDING_BLACKBERRY__)
+#define WTF_PLATFORM_BLACKBERRY 1
+#elif OS(DARWIN)
+#define WTF_PLATFORM_MAC 1
+#elif OS(WINDOWS)
+#define WTF_PLATFORM_WIN 1
+#endif
+
+/* PLATFORM(IOS) */
+/* FIXME: this is sometimes used as an OS switch and sometimes for higher-level things */
+#if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
+#define WTF_PLATFORM_IOS 1
+#endif
+
+/* PLATFORM(IOS_SIMULATOR) */
+#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
+#define WTF_PLATFORM_IOS 1
+#define WTF_PLATFORM_IOS_SIMULATOR 1
+#endif
+
+/* Graphics engines */
+
+/* USE(CG) and PLATFORM(CI) */
+#if PLATFORM(MAC) || PLATFORM(IOS)
+#define WTF_USE_CG 1
+#endif
+#if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG))
+#define WTF_USE_CA 1
+#endif
+
+/* USE(SKIA) for Win/Linux/Mac/Android */
+#if PLATFORM(CHROMIUM)
+#if OS(DARWIN)
+#define WTF_USE_SKIA 1
+#define WTF_USE_ICCJPEG 1
+#define WTF_USE_QCMSLIB 1
+#elif OS(ANDROID)
+#define WTF_USE_SKIA 1
+#define WTF_USE_LOW_QUALITY_IMAGE_INTERPOLATION 1
+#define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_DITHERING 1
+#define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_FANCY_UPSAMPLING 1
+#else
+#define WTF_USE_SKIA 1
+#define WTF_USE_ICCJPEG 1
+#define WTF_USE_QCMSLIB 1
+#endif
+#endif
+
+#if OS(QNX)
+#define USE_SYSTEM_MALLOC 1
+#endif
+
+#if PLATFORM(BLACKBERRY)
+#define WTF_USE_MERSENNE_TWISTER_19937 1
+#define WTF_USE_SKIA 1
+#define WTF_USE_LOW_QUALITY_IMAGE_INTERPOLATION 1
+#define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_DITHERING 1
+#define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_FANCY_UPSAMPLING 1
+#endif
+
+#if PLATFORM(GTK)
+#define WTF_USE_CAIRO 1
+#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
+#endif
+
+
+#if OS(WINCE)
+#define WTF_USE_MERSENNE_TWISTER_19937 1
+#endif
+
+/* On Windows, use QueryPerformanceCounter by default */
+#if OS(WINDOWS)
+#define WTF_USE_QUERY_PERFORMANCE_COUNTER  1
+#endif
+
+#if OS(WINCE) && !PLATFORM(QT)
+#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)
+
+#endif  /* OS(WINCE) && !PLATFORM(QT) */
+
+#if OS(WINCE) && !PLATFORM(QT)
+#define WTF_USE_WCHAR_UNICODE 1
+#elif PLATFORM(GTK)
+/* The GTK+ Unicode backend is configurable */
+#else
+#define WTF_USE_ICU_UNICODE 1
+#endif
+
+#if PLATFORM(MAC) && !PLATFORM(IOS)
+#if CPU(X86_64)
+#define WTF_USE_PLUGIN_HOST_PROCESS 1
+#endif
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
+#define ENABLE_GESTURE_EVENTS 1
+#define ENABLE_RUBBER_BANDING 1
+#define WTF_USE_SCROLLBAR_PAINTER 1
+#define HAVE_XPC 1
+#endif
+#if !defined(ENABLE_DASHBOARD_SUPPORT)
+#define ENABLE_DASHBOARD_SUPPORT 1
+#endif
+#define WTF_USE_CF 1
+#define WTF_USE_PTHREADS 1
+#define HAVE_PTHREAD_RWLOCK 1
+#define HAVE_READLINE 1
+#define HAVE_RUNLOOP_TIMER 1
+#define ENABLE_FULLSCREEN_API 1
+#define ENABLE_SMOOTH_SCROLLING 1
+#define ENABLE_WEB_ARCHIVE 1
+#define ENABLE_WEB_AUDIO 1
+#if defined(ENABLE_VIDEO)
+#define ENABLE_VIDEO_TRACK 1
+#endif
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+#define HAVE_LAYER_HOSTING_IN_WINDOW_SERVER 1
+#endif
+#define WTF_USE_APPKIT 1
+#define WTF_USE_SECURITY_FRAMEWORK 1
+#endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
+
+#if PLATFORM(CHROMIUM) && OS(DARWIN)
+#define WTF_USE_CF 1
+#define WTF_USE_PTHREADS 1
+#define HAVE_PTHREAD_RWLOCK 1
+
+#define WTF_USE_WK_SCROLLBAR_PAINTER 1
+#endif
+
+#if PLATFORM(IOS)
+#define DONT_FINALIZE_ON_MAIN_THREAD 1
+#endif
+
+#if PLATFORM(QT) && OS(DARWIN)
+#define WTF_USE_CF 1
+#endif
+
+#if OS(DARWIN) && !PLATFORM(GTK) && !PLATFORM(QT)
+#define ENABLE_PURGEABLE_MEMORY 1
+#endif
+
+#if PLATFORM(IOS)
+#define ENABLE_CONTEXT_MENUS 0
+#define ENABLE_DRAG_SUPPORT 0
+#define ENABLE_GEOLOCATION 1
+#define ENABLE_ICONDATABASE 0
+#define ENABLE_INSPECTOR 1
+#define ENABLE_NETSCAPE_PLUGIN_API 0
+#define ENABLE_ORIENTATION_EVENTS 1
+#define ENABLE_REPAINT_THROTTLING 1
+#define ENABLE_WEB_ARCHIVE 1
+#define HAVE_PTHREAD_RWLOCK 1
+#define HAVE_READLINE 1
+#define WTF_USE_CF 1
+#define WTF_USE_CFNETWORK 1
+#define WTF_USE_NETWORK_CFDATA_ARRAY_CALLBACK 1
+#define WTF_USE_PTHREADS 1
+
+#if PLATFORM(IOS_SIMULATOR)
+    #define ENABLE_JIT 0
+    #define ENABLE_YARR_JIT 0
+#else
+    #define ENABLE_JIT 1
+    #define ENABLE_LLINT 1
+    #define ENABLE_YARR_JIT 1
+#endif
+
+#define WTF_USE_APPKIT 0
+#define WTF_USE_SECURITY_FRAMEWORK 0
+#endif
+
+#if PLATFORM(WIN) && !OS(WINCE)
+#define WTF_USE_CF 1
+#endif
+
+#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(WIN_CAIRO)
+#define WTF_USE_CFNETWORK 1
+#endif
+
+#if USE(CFNETWORK) || PLATFORM(MAC) || PLATFORM(IOS)
+#define WTF_USE_CFURLCACHE 1
+#endif
+
+#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(QT)
+#define ENABLE_WEB_ARCHIVE 1
+#endif
+
+#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(WIN_CAIRO) && !PLATFORM(QT)
+#define ENABLE_FULLSCREEN_API 1
+#endif
+
+#if PLATFORM(WX)
+#if !CPU(PPC)
+#if !defined(ENABLE_ASSEMBLER)
+#define ENABLE_ASSEMBLER 1
+#endif
+#define ENABLE_JIT 1
+#endif
+#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
+#define ENABLE_LLINT 0
+#if OS(DARWIN)
+#define WTF_USE_CF 1
+#define ENABLE_WEB_ARCHIVE 1
+#endif
+#endif
+
+#if OS(UNIX) && (PLATFORM(GTK) || PLATFORM(QT))
+#define WTF_USE_PTHREADS 1
+#define HAVE_PTHREAD_RWLOCK 1
+#endif
+
+#if !defined(HAVE_ACCESSIBILITY)
+#if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && !OS(ANDROID))
+#define HAVE_ACCESSIBILITY 1
+#endif
+#endif /* !defined(HAVE_ACCESSIBILITY) */
+
+#if OS(UNIX)
+#define HAVE_SIGNAL_H 1
+#define WTF_USE_OS_RANDOMNESS 1
+#endif
+
+#if (OS(FREEBSD) || OS(OPENBSD)) && !defined(__GLIBC__)
+#define HAVE_PTHREAD_NP_H 1
+#endif
+
+#if !defined(HAVE_VASPRINTF)
+#if !COMPILER(MSVC) && !COMPILER(RVCT) && !COMPILER(MINGW) && !(COMPILER(GCC) && OS(QNX))
+#define HAVE_VASPRINTF 1
+#endif
+#endif
+
+#if !defined(HAVE_STRNSTR)
+#if OS(DARWIN) || (OS(FREEBSD) && !defined(__GLIBC__))
+#define HAVE_STRNSTR 1
+#endif
+#endif
+
+#if !OS(WINDOWS) && !OS(SOLARIS) \
+    && !OS(RVCT) \
+    && !OS(ANDROID)
+#define HAVE_TM_GMTOFF 1
+#define HAVE_TM_ZONE 1
+#define HAVE_TIMEGM 1
+#endif
+
+#if OS(DARWIN)
+
+#define HAVE_ERRNO_H 1
+#define HAVE_LANGINFO_H 1
+#define HAVE_MMAP 1
+#define HAVE_MERGESORT 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TIMEB_H 1
+#define WTF_USE_ACCELERATE 1
+
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
+
+#define HAVE_DISPATCH_H 1
+#define HAVE_HOSTED_CORE_ANIMATION 1
+
+#if !PLATFORM(IOS)
+#define HAVE_MADV_FREE_REUSE 1
+#define HAVE_MADV_FREE 1
+#define HAVE_PTHREAD_SETNAME_NP 1
+#endif
+
+#endif
+
+#if PLATFORM(IOS)
+#define HAVE_MADV_FREE 1
+#define HAVE_PTHREAD_SETNAME_NP 1
+#endif
+
+#elif OS(WINDOWS)
+
+#if !OS(WINCE)
+#define HAVE_SYS_TIMEB_H 1
+#define HAVE_ALIGNED_MALLOC 1
+#define HAVE_ISDEBUGGERPRESENT 1
+#endif
+#define HAVE_VIRTUALALLOC 1
+#define WTF_USE_OS_RANDOMNESS 1
+
+#elif OS(QNX)
+
+#define HAVE_ERRNO_H 1
+#define HAVE_MMAP 1
+#define HAVE_MADV_FREE_REUSE 1
+#define HAVE_MADV_FREE 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_TIME_H 1
+#define WTF_USE_PTHREADS 1
+
+#elif OS(ANDROID)
+
+#define HAVE_ERRNO_H 1
+#define HAVE_NMAP 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? */
+
+#define HAVE_ERRNO_H 1
+#define HAVE_LANGINFO_H 1
+#define HAVE_MMAP 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_TIME_H 1
+
+#endif
+
+/* ENABLE macro defaults */
+
+#if PLATFORM(QT)
+/* We must not customize the global operator new and delete for the Qt port. */
+#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
+#if !OS(UNIX)
+#define USE_SYSTEM_MALLOC 1
+#endif
+#endif
+
+#if !defined(ENABLE_ICONDATABASE)
+#define ENABLE_ICONDATABASE 1
+#endif
+
+#if !defined(ENABLE_SQL_DATABASE)
+#define ENABLE_SQL_DATABASE 1
+#endif
+
+#if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
+#define ENABLE_JAVASCRIPT_DEBUGGER 1
+#endif
+
+#if !defined(ENABLE_FTPDIR)
+#define ENABLE_FTPDIR 1
+#endif
+
+#if !defined(ENABLE_CONTEXT_MENUS)
+#define ENABLE_CONTEXT_MENUS 1
+#endif
+
+#if !defined(ENABLE_DRAG_SUPPORT)
+#define ENABLE_DRAG_SUPPORT 1
+#endif
+
+#if !defined(ENABLE_INSPECTOR)
+#define ENABLE_INSPECTOR 1
+#endif
+
+#if !defined(ENABLE_NETSCAPE_PLUGIN_API)
+#define ENABLE_NETSCAPE_PLUGIN_API 1
+#endif
+
+#if !defined(ENABLE_GLOBAL_FASTMALLOC_NEW)
+#define ENABLE_GLOBAL_FASTMALLOC_NEW 1
+#endif
+
+#if !defined(ENABLE_PARSED_STYLE_SHEET_CACHING)
+#define ENABLE_PARSED_STYLE_SHEET_CACHING 1
+#endif
+
+#if !defined(ENABLE_SUBPIXEL_LAYOUT)
+#if PLATFORM(CHROMIUM)
+#define ENABLE_SUBPIXEL_LAYOUT 1 
+#else
+#define ENABLE_SUBPIXEL_LAYOUT 0
+#endif
+#endif
+
+#if !defined(ENABLE_GESTURE_ANIMATION)
+#if PLATFORM(QT) || !ENABLE(SMOOTH_SCROLLING)
+#define ENABLE_GESTURE_ANIMATION 0
+#else
+#define ENABLE_GESTURE_ANIMATION 1
+#endif
+#endif
+
+#if !defined(ENABLE_SATURATED_LAYOUT_ARITHMETIC)
+#define ENABLE_SATURATED_LAYOUT_ARITHMETIC 0
+#endif
+
+#if ENABLE(ENABLE_SATURATED_LAYOUT_ARITHMETIC) && !ENABLE(ENABLE_SUBPIXEL_LAYOUT)
+#error "ENABLE_SATURATED_LAYOUT_ARITHMETIC requires ENABLE_SUBPIXEL_LAYOUT"
+#endif
+
+#if ENABLE(INPUT_TYPE_DATE) || ENABLE(INPUT_TYPE_DATETIME) || ENABLE(INPUT_TYPE_DATETIMELOCAL) || ENABLE(INPUT_TYPE_MONTH) || ENABLE(INPUT_TYPE_TIME) || ENABLE(INPUT_TYPE_WEEK)
+#define ENABLE_DATE_AND_TIME_INPUT_TYPES 1
+#endif
+
+#define ENABLE_DEBUG_WITH_BREAKPOINT 0
+#define ENABLE_SAMPLING_COUNTERS 0
+#define ENABLE_SAMPLING_FLAGS 0
+#define ENABLE_SAMPLING_REGIONS 0
+#define ENABLE_OPCODE_SAMPLING 0
+#define ENABLE_CODEBLOCK_SAMPLING 0
+#if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING)
+#error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING"
+#endif
+#if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS) || ENABLE(SAMPLING_REGIONS)
+#define ENABLE_SAMPLING_THREAD 1
+#endif
+
+#if !defined(ENABLE_TEXT_CARET) && !PLATFORM(IOS)
+#define ENABLE_TEXT_CARET 1
+#endif
+
+#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64)
+#if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
+    || (CPU(IA64) && !CPU(IA64_32)) \
+    || CPU(ALPHA) \
+    || CPU(SPARC64) \
+    || CPU(S390X) \
+    || CPU(PPC64)
+#define WTF_USE_JSVALUE64 1
+#else
+#define WTF_USE_JSVALUE32_64 1
+#endif
+#endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) */
+
+/* Disable the JIT on versions of GCC prior to 4.1 */
+#if !defined(ENABLE_JIT) && COMPILER(GCC) && !GCC_VERSION_AT_LEAST(4, 1, 0)
+#define ENABLE_JIT 0
+#endif
+
+/* JIT is not implemented for Windows 64-bit */
+#if !defined(ENABLE_JIT) && OS(WINDOWS) && CPU(X86_64)
+#define ENABLE_JIT 0
+#define ENABLE_YARR_JIT 0
+#endif
+
+#if !defined(ENABLE_JIT) && CPU(SH4) && PLATFORM(QT)
+#define ENABLE_JIT 1
+#endif
+
+/* The JIT is enabled by default on all x86, x86-64, ARM & MIPS platforms. */
+#if !defined(ENABLE_JIT) \
+    && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(MIPS)) \
+    && (OS(DARWIN) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 1, 0)) \
+    && !OS(WINCE) \
+    && !OS(QNX)
+#define ENABLE_JIT 1
+#endif
+
+/* If possible, try to enable a disassembler. This is optional. We proceed in two
+   steps: first we try to find some disassembler that we can use, and then we
+   decide if the high-level disassembler API can be enabled. */
+#if !defined(WTF_USE_UDIS86) && ENABLE(JIT) && (PLATFORM(MAC) || (PLATFORM(QT) && OS(LINUX))) \
+    && (CPU(X86) || CPU(X86_64))
+#define WTF_USE_UDIS86 1
+#endif
+
+#if !defined(ENABLE_DISASSEMBLER) && USE(UDIS86)
+#define ENABLE_DISASSEMBLER 1
+#endif
+
+/* On the GTK+ port we take an extra precaution for LLINT support:
+ * We disable it on x86 builds if the build target doesn't support SSE2
+ * instructions (LLINT requires SSE2 on this platform). */
+#if !defined(ENABLE_LLINT) && PLATFORM(GTK) && CPU(X86) && COMPILER(GCC) \
+    && !defined(__SSE2__)
+#define ENABLE_LLINT 0
+#endif
+
+/* On some of the platforms where we have a JIT, we want to also have the 
+   low-level interpreter. */
+#if !defined(ENABLE_LLINT) \
+    && ENABLE(JIT) \
+    && (OS(DARWIN) || OS(LINUX)) \
+    && (PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(GTK) || (PLATFORM(QT) && OS(LINUX))) \
+    && (CPU(X86) || CPU(X86_64) || CPU(ARM_THUMB2))
+#define ENABLE_LLINT 1
+#endif
+
+#if !defined(ENABLE_DFG_JIT) && ENABLE(JIT) && !COMPILER(MSVC)
+/* Enable the DFG JIT on X86 and X86_64.  Only tested on Mac and GNU/Linux. */
+#if (CPU(X86) || CPU(X86_64)) && (PLATFORM(MAC) || OS(LINUX))
+#define ENABLE_DFG_JIT 1
+#endif
+/* Enable the DFG JIT on ARMv7.  Only tested on iOS. */
+#if CPU(ARM_THUMB2) && (PLATFORM(IOS) || PLATFORM(BLACKBERRY))
+#define ENABLE_DFG_JIT 1
+#endif
+/* Enable the DFG JIT on ARM. */
+#if CPU(ARM_TRADITIONAL)
+#define ENABLE_DFG_JIT 1
+#endif
+#endif
+
+/* If the jit is not available, enable the LLInt C Loop: */
+#if !ENABLE(JIT)
+#undef ENABLE_LLINT        /* Undef so that we can redefine it. */
+#undef ENABLE_LLINT_C_LOOP /* Undef so that we can redefine it. */
+#undef ENABLE_DFG_JIT      /* Undef so that we can redefine it. */
+#define ENABLE_LLINT 1
+#define ENABLE_LLINT_C_LOOP 1
+#define ENABLE_DFG_JIT 0
+#endif
+
+/* Do a sanity check to make sure that we at least have one execution engine in
+   use: */
+#if !(ENABLE(JIT) || ENABLE(LLINT))
+#error You have to have at least one execution model enabled to build JSC
+#endif
+
+/* Profiling of types and values used by JIT code. DFG_JIT depends on it, but you
+   can enable it manually with DFG turned off if you want to use it as a standalone
+   profiler. In that case, you probably want to also enable VERBOSE_VALUE_PROFILE
+   below. */
+#if !defined(ENABLE_VALUE_PROFILER) && ENABLE(DFG_JIT)
+#define ENABLE_VALUE_PROFILER 1
+#endif
+
+#if !defined(ENABLE_VERBOSE_VALUE_PROFILE) && ENABLE(VALUE_PROFILER)
+#define ENABLE_VERBOSE_VALUE_PROFILE 0
+#endif
+
+#if !defined(ENABLE_SIMPLE_HEAP_PROFILING)
+#define ENABLE_SIMPLE_HEAP_PROFILING 0
+#endif
+
+/* Counts uses of write barriers using sampling counters. Be sure to also
+   set ENABLE_SAMPLING_COUNTERS to 1. */
+#if !defined(ENABLE_WRITE_BARRIER_PROFILING)
+#define ENABLE_WRITE_BARRIER_PROFILING 0
+#endif
+
+/* Configure the JIT */
+#if CPU(X86) && COMPILER(MSVC)
+#define JSC_HOST_CALL __fastcall
+#elif CPU(X86) && COMPILER(GCC)
+#define JSC_HOST_CALL __attribute__ ((fastcall))
+#else
+#define JSC_HOST_CALL
+#endif
+
+/* Configure the interpreter */
+#if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(4, 0, 0, 0) && defined(__GNUC__))
+#define HAVE_COMPUTED_GOTO 1
+#endif
+
+/* Determine if we need to enable Computed Goto Opcodes or not: */
+#if HAVE(COMPUTED_GOTO) && ENABLE(LLINT)
+#define ENABLE_COMPUTED_GOTO_OPCODES 1
+#endif
+
+/* Regular Expression Tracing - Set to 1 to trace RegExp's in jsc.  Results dumped at exit */
+#define ENABLE_REGEXP_TRACING 0
+
+/* Yet Another Regex Runtime - turned on by default for JIT enabled ports. */
+#if !defined(ENABLE_YARR_JIT) && (ENABLE(JIT) || ENABLE(LLINT_C_LOOP)) && !PLATFORM(CHROMIUM)
+#define ENABLE_YARR_JIT 1
+
+/* Setting this flag compares JIT results with interpreter results. */
+#define ENABLE_YARR_JIT_DEBUG 0
+#endif
+
+/* If either the JIT or the RegExp JIT is enabled, then the Assembler must be
+   enabled as well: */
+#if ENABLE(JIT) || ENABLE(YARR_JIT)
+#if defined(ENABLE_ASSEMBLER) && !ENABLE_ASSEMBLER
+#error "Cannot enable the JIT or RegExp JIT without enabling the Assembler"
+#else
+#undef ENABLE_ASSEMBLER
+#define ENABLE_ASSEMBLER 1
+#endif
+#endif
+
+/* Pick which allocator to use; we only need an executable allocator if the assembler is compiled in.
+   On x86-64 we use a single fixed mmap, on other platforms we mmap on demand. */
+#if ENABLE(ASSEMBLER)
+#if CPU(X86_64) || PLATFORM(IOS)
+#define ENABLE_EXECUTABLE_ALLOCATOR_FIXED 1
+#else
+#define ENABLE_EXECUTABLE_ALLOCATOR_DEMAND 1
+#endif
+#endif
+
+#if !defined(ENABLE_PAN_SCROLLING) && OS(WINDOWS)
+#define ENABLE_PAN_SCROLLING 1
+#endif
+
+/*Add other platforms as they update their platfrom specific code to handle TextRun's with 8 bit data. */
+#if PLATFORM(MAC)
+#define ENABLE_8BIT_TEXTRUN 1
+#endif
+
+/* Use the QXmlStreamReader implementation for XMLDocumentParser */
+/* Use the QXmlQuery implementation for XSLTProcessor */
+#if PLATFORM(QT)
+#if !USE(LIBXML2)
+#define WTF_USE_QXMLSTREAM 1
+#define WTF_USE_QXMLQUERY 1
+#endif
+#endif
+
+/* Accelerated compositing */
+#if PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(QT) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO))
+#define WTF_USE_ACCELERATED_COMPOSITING 1
+#endif
+
+#if PLATFORM(MAC) || PLATFORM(IOS)
+#define ENABLE_CSS_IMAGE_SET 1
+#endif
+
+#if ENABLE(WEBGL) && !defined(WTF_USE_3D_GRAPHICS)
+#define WTF_USE_3D_GRAPHICS 1
+#endif
+
+/* Qt always uses Texture Mapper */
+#if PLATFORM(QT)
+#define WTF_USE_TEXTURE_MAPPER 1
+#endif
+
+#if USE(TEXTURE_MAPPER) && USE(3D_GRAPHICS) && !defined(WTF_USE_TEXTURE_MAPPER_GL)
+#define WTF_USE_TEXTURE_MAPPER_GL 1
+#endif
+
+/* Compositing on the UI-process in WebKit2 */
+#if PLATFORM(QT)
+#define WTF_USE_COORDINATED_GRAPHICS 1
+#endif
+
+#if PLATFORM(MAC) || PLATFORM(IOS)
+#define WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK 1
+#endif
+
+#if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(EFL)))
+#define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
+#endif
+
+#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+#define ENABLE_THREADED_SCROLLING 1
+#endif
+
+/* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */
+#define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK
+
+/* FIXME: Eventually we should enable this for all platforms and get rid of the define. */
+#if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
+#define WTF_USE_PLATFORM_STRATEGIES 1
+#endif
+
+#if PLATFORM(WIN)
+#define WTF_USE_CROSS_PLATFORM_CONTEXT_MENUS 1
+#endif
+
+#if PLATFORM(MAC) && HAVE(ACCESSIBILITY)
+#define WTF_USE_ACCESSIBILITY_CONTEXT_MENUS 1
+#endif
+
+#if CPU(ARM_THUMB2)
+#define ENABLE_BRANCH_COMPACTION 1
+#endif
+
+#if !defined(ENABLE_THREADING_LIBDISPATCH) && HAVE(DISPATCH_H)
+#define ENABLE_THREADING_LIBDISPATCH 1
+#elif !defined(ENABLE_THREADING_OPENMP) && defined(_OPENMP)
+#define ENABLE_THREADING_OPENMP 1
+#elif !defined(THREADING_GENERIC)
+#define ENABLE_THREADING_GENERIC 1
+#endif
+
+#if ENABLE(GLIB_SUPPORT)
+#include <wtf/gobject/GTypedefs.h>
+#endif
+
+/* FIXME: This define won't be needed once #27551 is fully landed. However, 
+   since most ports try to support sub-project independence, adding new headers
+   to WTF causes many ports to break, and so this way we can address the build
+   breakages one port at a time. */
+#if !defined(WTF_USE_EXPORT_MACROS) && (PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(WX))
+#define WTF_USE_EXPORT_MACROS 1
+#endif
+
+#if !defined(WTF_USE_EXPORT_MACROS_FOR_TESTING) && (PLATFORM(GTK) || PLATFORM(WIN))
+#define WTF_USE_EXPORT_MACROS_FOR_TESTING 1
+#endif
+
+#if (PLATFORM(QT) && !OS(DARWIN) && !OS(WINDOWS)) || PLATFORM(GTK) || PLATFORM(EFL)
+#define WTF_USE_UNIX_DOMAIN_SOCKETS 1
+#endif
+
+#if !defined(ENABLE_COMPARE_AND_SWAP) && (OS(WINDOWS) || (COMPILER(GCC) && (CPU(X86) || CPU(X86_64) || CPU(ARM_THUMB2))))
+#define ENABLE_COMPARE_AND_SWAP 1
+#endif
+
+#define ENABLE_OBJECT_MARK_LOGGING 0
+
+#if !defined(ENABLE_PARALLEL_GC) && !ENABLE(OBJECT_MARK_LOGGING) && (PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(BLACKBERRY) || PLATFORM(GTK)) && ENABLE(COMPARE_AND_SWAP)
+#define ENABLE_PARALLEL_GC 1
+#elif PLATFORM(QT)
+// Parallel GC is temporarily disabled on Qt because of regular crashes, see https://bugs.webkit.org/show_bug.cgi?id=90957 for details
+#define ENABLE_PARALLEL_GC 0
+#endif
+
+#if !defined(ENABLE_GC_VALIDATION) && !defined(NDEBUG)
+#define ENABLE_GC_VALIDATION 1
+#endif
+
+#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
+#define WTF_USE_AVFOUNDATION 1
+#endif
+
+#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
+#define WTF_USE_COREMEDIA 1
+#endif
+
+#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) || PLATFORM(BLACKBERRY)
+#define WTF_USE_REQUEST_ANIMATION_FRAME_TIMER 1
+#endif
+
+#if PLATFORM(MAC) || PLATFORM(BLACKBERRY)
+#define WTF_USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR 1
+#endif
+
+#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
+#define HAVE_INVERTED_WHEEL_EVENTS 1
+#endif
+
+#if PLATFORM(MAC)
+#define WTF_USE_COREAUDIO 1
+#endif
+
+#if !defined(WTF_USE_V8) && PLATFORM(CHROMIUM)
+#define WTF_USE_V8 1
+#endif
+
+/* Not using V8 implies using JSC and vice versa */
+#if !USE(V8)
+#define WTF_USE_JSC 1
+#endif
+
+#if ENABLE(NOTIFICATIONS) && PLATFORM(MAC)
+#define ENABLE_TEXT_NOTIFICATIONS_ONLY 1
+#endif
+
+#if !defined(WTF_USE_ZLIB) && !PLATFORM(QT)
+#define WTF_USE_ZLIB 1
+#endif
+
+#if PLATFORM(QT)
+#include <qglobal.h>
+#if defined(QT_OPENGL_ES_2) && !defined(WTF_USE_OPENGL_ES_2)
+#define WTF_USE_OPENGL_ES_2 1
+#endif
+#endif
+
+#endif /* WTF_Platform_h */
diff --git a/Source/WTF/wtf/PlatformBlackBerry.cmake b/Source/WTF/wtf/PlatformBlackBerry.cmake
new file mode 100644
index 0000000..5f30d08
--- /dev/null
+++ b/Source/WTF/wtf/PlatformBlackBerry.cmake
@@ -0,0 +1,12 @@
+LIST(APPEND WTF_SOURCES
+    OSAllocatorPosix.cpp
+    TCSystemAlloc.cpp
+    ThreadIdentifierDataPthreads.cpp
+    ThreadingPthreads.cpp
+    blackberry/MainThreadBlackBerry.cpp
+    unicode/icu/CollatorICU.cpp
+)
+
+LIST(INSERT WTF_INCLUDE_DIRECTORIES 0
+    "${BLACKBERRY_THIRD_PARTY_DIR}/icu"
+)
diff --git a/Source/WTF/wtf/PlatformEfl.cmake b/Source/WTF/wtf/PlatformEfl.cmake
new file mode 100644
index 0000000..73d57e5
--- /dev/null
+++ b/Source/WTF/wtf/PlatformEfl.cmake
@@ -0,0 +1,40 @@
+LIST(APPEND WTF_SOURCES
+    efl/MainThreadEfl.cpp
+    efl/OwnPtrEfl.cpp
+    efl/RefPtrEfl.cpp
+    gobject/GOwnPtr.cpp
+    gobject/GRefPtr.cpp
+
+    OSAllocatorPosix.cpp
+    ThreadIdentifierDataPthreads.cpp
+    ThreadingPthreads.cpp
+
+    unicode/icu/CollatorICU.cpp
+)
+
+LIST(APPEND WTF_LIBRARIES
+    pthread
+    ${GLIB_LIBRARIES}
+    ${GLIB_GIO_LIBRARIES}
+    ${GLIB_GOBJECT_LIBRARIES}
+    ${ICU_LIBRARIES}
+    ${ICU_I18N_LIBRARIES}
+    ${ECORE_LIBRARIES}
+    ${ECORE_EVAS_LIBRARIES}
+    ${ECORE_IMF_LIBRARIES}
+    ${EINA_LIBRARIES}
+    ${EVAS_LIBRARIES}
+    ${CMAKE_DL_LIBS}
+)
+
+LIST(APPEND WTF_INCLUDE_DIRECTORIES
+    ${ECORE_INCLUDE_DIRS}
+    ${ECORE_EVAS_INCLUDE_DIRS}
+    ${EINA_INCLUDE_DIRS}
+    ${EVAS_INCLUDE_DIRS}
+    ${GLIB_INCLUDE_DIRS}
+    ${ICU_INCLUDE_DIRS}
+    ${JAVASCRIPTCORE_DIR}/wtf/gobject
+    ${JAVASCRIPTCORE_DIR}/wtf/unicode
+    ${JAVASCRIPTCORE_DIR}/wtf/efl
+)
diff --git a/Source/WTF/wtf/PlatformWinCE.cmake b/Source/WTF/wtf/PlatformWinCE.cmake
new file mode 100644
index 0000000..d558ee5
--- /dev/null
+++ b/Source/WTF/wtf/PlatformWinCE.cmake
@@ -0,0 +1,22 @@
+LIST(APPEND WTF_HEADERS
+    unicode/wchar/UnicodeWchar.h
+)
+
+LIST(APPEND WTF_SOURCES
+    NullPtr.cpp
+    OSAllocatorWin.cpp
+    ThreadingWin.cpp
+    ThreadSpecificWin.cpp
+
+    threads/win/BinarySemaphoreWin.cpp
+
+    unicode/CollatorDefault.cpp
+    unicode/wchar/UnicodeWchar.cpp
+
+    win/MainThreadWin.cpp
+    win/OwnPtrWin.cpp
+)
+
+LIST(APPEND WTF_LIBRARIES
+    mmtimer
+)
diff --git a/Source/WTF/wtf/PossiblyNull.h b/Source/WTF/wtf/PossiblyNull.h
new file mode 100644
index 0000000..46a7d71
--- /dev/null
+++ b/Source/WTF/wtf/PossiblyNull.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 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. ``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
+ * 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 PossiblyNull_h
+#define PossiblyNull_h
+
+#include <wtf/Assertions.h>
+
+namespace WTF {
+
+template <typename T> struct PossiblyNull {
+    PossiblyNull(T data)
+        : m_data(data)
+    {
+    }
+    PossiblyNull(const PossiblyNull<T>& source)
+        : m_data(source.m_data)
+    {
+        source.m_data = 0;
+    }
+    ~PossiblyNull() { ASSERT(!m_data); }
+    bool getValue(T& out) WARN_UNUSED_RETURN;
+private:
+    mutable T m_data;
+};
+
+template <typename T> bool PossiblyNull<T>::getValue(T& out)
+{
+    out = m_data;
+    bool result = !!m_data;
+    m_data = 0;
+    return result;
+}
+
+}
+
+#endif
diff --git a/Source/WTF/wtf/RAMSize.cpp b/Source/WTF/wtf/RAMSize.cpp
new file mode 100644
index 0000000..5b2cc67
--- /dev/null
+++ b/Source/WTF/wtf/RAMSize.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 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 "config.h"
+#include "RAMSize.h"
+
+#include "StdLibExtras.h"
+#if OS(DARWIN)
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#elif OS(UNIX)
+#include <unistd.h>
+#elif OS(WINDOWS)
+#include <windows.h>
+#elif OS(QNX)
+#include <sys/stat.h>
+#endif
+
+namespace WTF {
+
+static const size_t ramSizeGuess = 128 * MB;
+
+static size_t computeRAMSize()
+{
+#if OS(DARWIN)
+    int mib[2];
+    uint64_t ramSize;
+    size_t length;
+
+    mib[0] = CTL_HW;
+    mib[1] = HW_MEMSIZE;
+    length = sizeof(int64_t);
+    int sysctlResult = sysctl(mib, 2, &ramSize, &length, 0, 0);
+    if (sysctlResult == -1)
+        return ramSizeGuess;
+    return ramSize > std::numeric_limits<size_t>::max() ? std::numeric_limits<size_t>::max() : static_cast<size_t>(ramSize);
+#elif OS(UNIX)
+    long pages = sysconf(_SC_PHYS_PAGES);
+    long pageSize = sysconf(_SC_PAGE_SIZE);
+    if (pages == -1 || pageSize == -1)
+        return ramSizeGuess;
+    return pages * pageSize;
+#elif OS(WINCE)
+    MEMORYSTATUS status;
+    status.dwLength = sizeof(status);
+    GlobalMemoryStatus(&status);
+    if (status.dwTotalPhys <= 0)
+        return ramSizeGuess;
+    return status.dwTotalPhys;
+#elif OS(WINDOWS)
+    MEMORYSTATUSEX status;
+    status.dwLength = sizeof(status);
+    bool result = GlobalMemoryStatusEx(&status);
+    if (!result)
+        return ramSizeGuess;
+    return status.ullTotalPhys;
+#elif OS(QNX)
+    struct stat mst;
+    if (stat("/proc", &mst))
+        return ramSizeGuess;
+    return mst.st_size;
+#endif
+}
+
+size_t ramSize()
+{
+    static const size_t ramSize = computeRAMSize();
+    return ramSize;
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/RAMSize.h b/Source/WTF/wtf/RAMSize.h
new file mode 100644
index 0000000..cafb4fa
--- /dev/null
+++ b/Source/WTF/wtf/RAMSize.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#ifndef RAMSize_h
+#define RAMSize_h
+
+namespace WTF {
+
+WTF_EXPORT_PRIVATE size_t ramSize();
+
+}
+
+using WTF::ramSize;
+
+#endif // RAMSize_h
diff --git a/Source/WTF/wtf/RandomNumber.cpp b/Source/WTF/wtf/RandomNumber.cpp
new file mode 100644
index 0000000..06074ed
--- /dev/null
+++ b/Source/WTF/wtf/RandomNumber.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *           (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
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 "RandomNumber.h"
+
+#include "CryptographicallyRandomNumber.h"
+#include "RandomNumberSeed.h"
+
+#include <limits>
+#include <limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if USE(MERSENNE_TWISTER_19937)
+extern "C" {
+#include "mt19937ar.c"
+}
+#endif
+
+namespace WTF {
+
+double randomNumber()
+{
+#if USE(OS_RANDOMNESS)
+    uint32_t bits = cryptographicallyRandomNumber();
+    return static_cast<double>(bits) / (static_cast<double>(std::numeric_limits<uint32_t>::max()) + 1.0);
+#else
+    // Without OS_RANDOMNESS, we fall back to other random number generators
+    // that might not be cryptographically secure. Ideally, most ports would
+    // define USE(OS_RANDOMNESS).
+
+#if USE(MERSENNE_TWISTER_19937)
+    return genrand_res53();
+#else
+    uint32_t part1 = rand() & (RAND_MAX - 1);
+    uint32_t part2 = rand() & (RAND_MAX - 1);
+    // rand only provides 31 bits, and the low order bits of that aren't very random
+    // so we take the high 26 bits of part 1, and the high 27 bits of part2.
+    part1 >>= 5; // drop the low 5 bits
+    part2 >>= 4; // drop the low 4 bits
+    uint64_t fullRandom = part1;
+    fullRandom <<= 27;
+    fullRandom |= part2;
+
+    // Mask off the low 53bits
+    fullRandom &= (1LL << 53) - 1;
+    return static_cast<double>(fullRandom)/static_cast<double>(1LL << 53);
+#endif
+#endif
+}
+
+}
diff --git a/Source/WTF/wtf/RandomNumber.h b/Source/WTF/wtf/RandomNumber.h
new file mode 100644
index 0000000..76b2235
--- /dev/null
+++ b/Source/WTF/wtf/RandomNumber.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2008 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
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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_RandomNumber_h
+#define WTF_RandomNumber_h
+
+namespace WTF {
+
+    // Returns a pseudo-random number in the range [0, 1), attempts to be
+    // cryptographically secure if possible on the target platform
+    WTF_EXPORT_PRIVATE double randomNumber();
+
+}
+
+using WTF::randomNumber;
+
+#endif
diff --git a/Source/WTF/wtf/RandomNumberSeed.h b/Source/WTF/wtf/RandomNumberSeed.h
new file mode 100644
index 0000000..b5547be
--- /dev/null
+++ b/Source/WTF/wtf/RandomNumberSeed.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2008 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
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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_RandomNumberSeed_h
+#define WTF_RandomNumberSeed_h
+
+#include <stdlib.h>
+#include <time.h>
+
+#if HAVE(SYS_TIME_H)
+#include <sys/time.h>
+#endif
+
+#if OS(UNIX)
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+
+#if USE(MERSENNE_TWISTER_19937)
+extern "C" {
+void init_by_array(unsigned long init_key[],int key_length);
+}
+#endif
+
+// Internal JavaScriptCore usage only
+namespace WTF {
+
+inline void initializeRandomNumberGenerator()
+{
+#if OS(DARWIN)
+    // On Darwin we use arc4random which initialises itself.
+#elif OS(WINCE)
+    // initialize rand()
+    srand(GetTickCount());
+#elif COMPILER(MSVC) && defined(_CRT_RAND_S)
+    // On Windows we use rand_s which initialises itself
+#elif OS(UNIX)
+    // srandomdev is not guaranteed to exist on linux so we use this poor seed, this should be improved
+    timeval time;
+    gettimeofday(&time, 0);
+    srandom(static_cast<unsigned>(time.tv_usec * getpid()));
+#else
+    srand(static_cast<unsigned>(time(0)));
+#endif
+
+#if USE(MERSENNE_TWISTER_19937)
+    // use rand() to initialize the Mersenne Twister random number generator.
+    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);
+#endif
+}
+
+}
+
+#endif
diff --git a/Source/WTF/wtf/RedBlackTree.h b/Source/WTF/wtf/RedBlackTree.h
new file mode 100644
index 0000000..19460c1
--- /dev/null
+++ b/Source/WTF/wtf/RedBlackTree.h
@@ -0,0 +1,574 @@
+/*
+ * Copyright (C) 2010, 2011 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef RedBlackTree_h
+#define RedBlackTree_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+
+namespace WTF {
+
+// This implements a red-black tree with the following properties:
+// - The allocation of nodes in the tree is entirely up to the user.
+// - If you are in possession of a pointer to a node, you can delete
+//   it from the tree. The tree will subsequently no longer have a
+//   reference to this node.
+// - The key type must implement operator< and ==.
+
+template<class NodeType, typename KeyType>
+class RedBlackTree {
+    WTF_MAKE_NONCOPYABLE(RedBlackTree);
+private:
+    enum Color {
+        Red = 1,
+        Black
+    };
+    
+public:
+    class Node {
+        friend class RedBlackTree;
+        
+    public:
+        const NodeType* successor() const
+        {
+            const Node* x = this;
+            if (x->right())
+                return treeMinimum(x->right());
+            const NodeType* y = x->parent();
+            while (y && x == y->right()) {
+                x = y;
+                y = y->parent();
+            }
+            return y;
+        }
+        
+        const NodeType* predecessor() const
+        {
+            const Node* x = this;
+            if (x->left())
+                return treeMaximum(x->left());
+            const NodeType* y = x->parent();
+            while (y && x == y->left()) {
+                x = y;
+                y = y->parent();
+            }
+            return y;
+        }
+        
+        NodeType* successor()
+        {
+            return const_cast<NodeType*>(const_cast<const Node*>(this)->successor());
+        }
+
+        NodeType* predecessor()
+        {
+            return const_cast<NodeType*>(const_cast<const Node*>(this)->predecessor());
+        }
+
+    private:
+        void reset()
+        {
+            m_left = 0;
+            m_right = 0;
+            m_parentAndRed = 1; // initialize to red
+        }
+        
+        // NOTE: these methods should pack the parent and red into a single
+        // word. But doing so appears to reveal a bug in the compiler.
+        NodeType* parent() const
+        {
+            return reinterpret_cast<NodeType*>(m_parentAndRed & ~static_cast<uintptr_t>(1));
+        }
+        
+        void setParent(NodeType* newParent)
+        {
+            m_parentAndRed = reinterpret_cast<uintptr_t>(newParent) | (m_parentAndRed & 1);
+        }
+        
+        NodeType* left() const
+        {
+            return m_left;
+        }
+        
+        void setLeft(NodeType* node)
+        {
+            m_left = node;
+        }
+        
+        NodeType* right() const
+        {
+            return m_right;
+        }
+        
+        void setRight(NodeType* node)
+        {
+            m_right = node;
+        }
+        
+        Color color() const
+        {
+            if (m_parentAndRed & 1)
+                return Red;
+            return Black;
+        }
+        
+        void setColor(Color value)
+        {
+            if (value == Red)
+                m_parentAndRed |= 1;
+            else
+                m_parentAndRed &= ~static_cast<uintptr_t>(1);
+        }
+        
+        NodeType* m_left;
+        NodeType* m_right;
+        uintptr_t m_parentAndRed;
+    };
+
+    RedBlackTree()
+        : m_root(0)
+    {
+    }
+    
+    void insert(NodeType* x)
+    {
+        x->reset();
+        treeInsert(x);
+        x->setColor(Red);
+
+        while (x != m_root && x->parent()->color() == Red) {
+            if (x->parent() == x->parent()->parent()->left()) {
+                NodeType* y = x->parent()->parent()->right();
+                if (y && y->color() == Red) {
+                    // Case 1
+                    x->parent()->setColor(Black);
+                    y->setColor(Black);
+                    x->parent()->parent()->setColor(Red);
+                    x = x->parent()->parent();
+                } else {
+                    if (x == x->parent()->right()) {
+                        // Case 2
+                        x = x->parent();
+                        leftRotate(x);
+                    }
+                    // Case 3
+                    x->parent()->setColor(Black);
+                    x->parent()->parent()->setColor(Red);
+                    rightRotate(x->parent()->parent());
+                }
+            } else {
+                // Same as "then" clause with "right" and "left" exchanged.
+                NodeType* y = x->parent()->parent()->left();
+                if (y && y->color() == Red) {
+                    // Case 1
+                    x->parent()->setColor(Black);
+                    y->setColor(Black);
+                    x->parent()->parent()->setColor(Red);
+                    x = x->parent()->parent();
+                } else {
+                    if (x == x->parent()->left()) {
+                        // Case 2
+                        x = x->parent();
+                        rightRotate(x);
+                    }
+                    // Case 3
+                    x->parent()->setColor(Black);
+                    x->parent()->parent()->setColor(Red);
+                    leftRotate(x->parent()->parent());
+                }
+            }
+        }
+
+        m_root->setColor(Black);
+    }
+
+    NodeType* remove(NodeType* z)
+    {
+        ASSERT(z);
+        ASSERT(z->parent() || z == m_root);
+        
+        // Y is the node to be unlinked from the tree.
+        NodeType* y;
+        if (!z->left() || !z->right())
+            y = z;
+        else
+            y = z->successor();
+
+        // Y is guaranteed to be non-null at this point.
+        NodeType* x;
+        if (y->left())
+            x = y->left();
+        else
+            x = y->right();
+
+        // X is the child of y which might potentially replace y in
+        // the tree. X might be null at this point.
+        NodeType* xParent;
+        if (x) {
+            x->setParent(y->parent());
+            xParent = x->parent();
+        } else
+            xParent = y->parent();
+        if (!y->parent())
+            m_root = x;
+        else {
+            if (y == y->parent()->left())
+                y->parent()->setLeft(x);
+            else
+                y->parent()->setRight(x);
+        }
+            
+        if (y != z) {
+            if (y->color() == Black)
+                removeFixup(x, xParent);
+            
+            y->setParent(z->parent());
+            y->setColor(z->color());
+            y->setLeft(z->left());
+            y->setRight(z->right());
+            
+            if (z->left())
+                z->left()->setParent(y);
+            if (z->right())
+                z->right()->setParent(y);
+            if (z->parent()) {
+                if (z->parent()->left() == z)
+                    z->parent()->setLeft(y);
+                else
+                    z->parent()->setRight(y);
+            } else {
+                ASSERT(m_root == z);
+                m_root = y;
+            }
+        } else if (y->color() == Black)
+            removeFixup(x, xParent);
+
+        return z;
+    }
+    
+    NodeType* remove(const KeyType& key)
+    {
+        NodeType* result = findExact(key);
+        if (!result)
+            return 0;
+        return remove(result);
+    }
+    
+    NodeType* findExact(const KeyType& key) const
+    {
+        for (NodeType* current = m_root; current;) {
+            if (current->key() == key)
+                return current;
+            if (key < current->key())
+                current = current->left();
+            else
+                current = current->right();
+        }
+        return 0;
+    }
+    
+    NodeType* findLeastGreaterThanOrEqual(const KeyType& key) const
+    {
+        NodeType* best = 0;
+        for (NodeType* current = m_root; current;) {
+            if (current->key() == key)
+                return current;
+            if (current->key() < key)
+                current = current->right();
+            else {
+                best = current;
+                current = current->left();
+            }
+        }
+        return best;
+    }
+    
+    NodeType* findGreatestLessThanOrEqual(const KeyType& key) const
+    {
+        NodeType* best = 0;
+        for (NodeType* current = m_root; current;) {
+            if (current->key() == key)
+                return current;
+            if (current->key() > key)
+                current = current->left();
+            else {
+                best = current;
+                current = current->right();
+            }
+        }
+        return best;
+    }
+    
+    NodeType* first() const
+    {
+        if (!m_root)
+            return 0;
+        return treeMinimum(m_root);
+    }
+    
+    NodeType* last() const
+    {
+        if (!m_root)
+            return 0;
+        return treeMaximum(m_root);
+    }
+    
+    // This is an O(n) operation.
+    size_t size()
+    {
+        size_t result = 0;
+        for (NodeType* current = first(); current; current = current->successor())
+            result++;
+        return result;
+    }
+    
+    // This is an O(1) operation.
+    bool isEmpty()
+    {
+        return !m_root;
+    }
+    
+private:
+    // Finds the minimum element in the sub-tree rooted at the given
+    // node.
+    static NodeType* treeMinimum(NodeType* x)
+    {
+        while (x->left())
+            x = x->left();
+        return x;
+    }
+    
+    static NodeType* treeMaximum(NodeType* x)
+    {
+        while (x->right())
+            x = x->right();
+        return x;
+    }
+
+    static const NodeType* treeMinimum(const NodeType* x)
+    {
+        while (x->left())
+            x = x->left();
+        return x;
+    }
+    
+    static const NodeType* treeMaximum(const NodeType* x)
+    {
+        while (x->right())
+            x = x->right();
+        return x;
+    }
+
+    void treeInsert(NodeType* z)
+    {
+        ASSERT(!z->left());
+        ASSERT(!z->right());
+        ASSERT(!z->parent());
+        ASSERT(z->color() == Red);
+        
+        NodeType* y = 0;
+        NodeType* x = m_root;
+        while (x) {
+            y = x;
+            if (z->key() < x->key())
+                x = x->left();
+            else
+                x = x->right();
+        }
+        z->setParent(y);
+        if (!y)
+            m_root = z;
+        else {
+            if (z->key() < y->key())
+                y->setLeft(z);
+            else
+                y->setRight(z);
+        }
+    }
+
+    //----------------------------------------------------------------------
+    // Red-Black tree operations
+    //
+
+    // Left-rotates the subtree rooted at x.
+    // Returns the new root of the subtree (x's right child).
+    NodeType* leftRotate(NodeType* x)
+    {
+        // Set y.
+        NodeType* y = x->right();
+
+        // Turn y's left subtree into x's right subtree.
+        x->setRight(y->left());
+        if (y->left())
+            y->left()->setParent(x);
+
+        // Link x's parent to y.
+        y->setParent(x->parent());
+        if (!x->parent())
+            m_root = y;
+        else {
+            if (x == x->parent()->left())
+                x->parent()->setLeft(y);
+            else
+                x->parent()->setRight(y);
+        }
+
+        // Put x on y's left.
+        y->setLeft(x);
+        x->setParent(y);
+
+        return y;
+    }
+
+    // Right-rotates the subtree rooted at y.
+    // Returns the new root of the subtree (y's left child).
+    NodeType* rightRotate(NodeType* y)
+    {
+        // Set x.
+        NodeType* x = y->left();
+
+        // Turn x's right subtree into y's left subtree.
+        y->setLeft(x->right());
+        if (x->right())
+            x->right()->setParent(y);
+
+        // Link y's parent to x.
+        x->setParent(y->parent());
+        if (!y->parent())
+            m_root = x;
+        else {
+            if (y == y->parent()->left())
+                y->parent()->setLeft(x);
+            else
+                y->parent()->setRight(x);
+        }
+
+        // Put y on x's right.
+        x->setRight(y);
+        y->setParent(x);
+
+        return x;
+    }
+
+    // Restores the red-black property to the tree after splicing out
+    // a node. Note that x may be null, which is why xParent must be
+    // supplied.
+    void removeFixup(NodeType* x, NodeType* xParent)
+    {
+        while (x != m_root && (!x || x->color() == Black)) {
+            if (x == xParent->left()) {
+                // Note: the text points out that w can not be null.
+                // The reason is not obvious from simply looking at
+                // the code; it comes about from the properties of the
+                // red-black tree.
+                NodeType* w = xParent->right();
+                ASSERT(w); // x's sibling should not be null.
+                if (w->color() == Red) {
+                    // Case 1
+                    w->setColor(Black);
+                    xParent->setColor(Red);
+                    leftRotate(xParent);
+                    w = xParent->right();
+                }
+                if ((!w->left() || w->left()->color() == Black)
+                    && (!w->right() || w->right()->color() == Black)) {
+                    // Case 2
+                    w->setColor(Red);
+                    x = xParent;
+                    xParent = x->parent();
+                } else {
+                    if (!w->right() || w->right()->color() == Black) {
+                        // Case 3
+                        w->left()->setColor(Black);
+                        w->setColor(Red);
+                        rightRotate(w);
+                        w = xParent->right();
+                    }
+                    // Case 4
+                    w->setColor(xParent->color());
+                    xParent->setColor(Black);
+                    if (w->right())
+                        w->right()->setColor(Black);
+                    leftRotate(xParent);
+                    x = m_root;
+                    xParent = x->parent();
+                }
+            } else {
+                // Same as "then" clause with "right" and "left"
+                // exchanged.
+
+                // Note: the text points out that w can not be null.
+                // The reason is not obvious from simply looking at
+                // the code; it comes about from the properties of the
+                // red-black tree.
+                NodeType* w = xParent->left();
+                ASSERT(w); // x's sibling should not be null.
+                if (w->color() == Red) {
+                    // Case 1
+                    w->setColor(Black);
+                    xParent->setColor(Red);
+                    rightRotate(xParent);
+                    w = xParent->left();
+                }
+                if ((!w->right() || w->right()->color() == Black)
+                    && (!w->left() || w->left()->color() == Black)) {
+                    // Case 2
+                    w->setColor(Red);
+                    x = xParent;
+                    xParent = x->parent();
+                } else {
+                    if (!w->left() || w->left()->color() == Black) {
+                        // Case 3
+                        w->right()->setColor(Black);
+                        w->setColor(Red);
+                        leftRotate(w);
+                        w = xParent->left();
+                    }
+                    // Case 4
+                    w->setColor(xParent->color());
+                    xParent->setColor(Black);
+                    if (w->left())
+                        w->left()->setColor(Black);
+                    rightRotate(xParent);
+                    x = m_root;
+                    xParent = x->parent();
+                }
+            }
+        }
+        if (x)
+            x->setColor(Black);
+    }
+
+    NodeType* m_root;
+};
+
+}
+
+#endif
+
diff --git a/Source/WTF/wtf/RefCounted.h b/Source/WTF/wtf/RefCounted.h
new file mode 100644
index 0000000..0504b9e
--- /dev/null
+++ b/Source/WTF/wtf/RefCounted.h
@@ -0,0 +1,253 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 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 RefCounted_h
+#define RefCounted_h
+
+#include <wtf/Assertions.h>
+#include <wtf/FastAllocBase.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/ThreadRestrictionVerifier.h>
+#include <wtf/UnusedParam.h>
+
+namespace WTF {
+
+#ifdef NDEBUG
+#define CHECK_REF_COUNTED_LIFECYCLE 0
+#else
+#define CHECK_REF_COUNTED_LIFECYCLE 1
+#endif
+
+// 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 {
+public:
+    void ref()
+    {
+#if CHECK_REF_COUNTED_LIFECYCLE
+        // Start thread verification as soon as the ref count gets to 2. This
+        // heuristic reflects the fact that items are often created on one thread
+        // and then given to another thread to be used.
+        // FIXME: Make this restriction tigher. Especially as we move to more
+        // common methods for sharing items across threads like CrossThreadCopier.h
+        // We should be able to add a "detachFromThread" method to make this explicit.
+        if (m_refCount == 1)
+            m_verifier.setShared(true);
+        // If this assert fires, it either indicates a thread safety issue or
+        // that the verification needs to change. See ThreadRestrictionVerifier for
+        // the different modes.
+        ASSERT(m_verifier.isSafeToUse());
+        ASSERT(!m_deletionHasBegun);
+        ASSERT(!m_adoptionIsRequired);
+#endif
+        ++m_refCount;
+    }
+
+    bool hasOneRef() const
+    {
+#if CHECK_REF_COUNTED_LIFECYCLE
+        ASSERT(m_verifier.isSafeToUse());
+        ASSERT(!m_deletionHasBegun);
+#endif
+        return m_refCount == 1;
+    }
+
+    int refCount() const
+    {
+#if CHECK_REF_COUNTED_LIFECYCLE
+        ASSERT(m_verifier.isSafeToUse());
+#endif
+        return m_refCount;
+    }
+
+    void setMutexForVerifier(Mutex&);
+
+#if HAVE(DISPATCH_H)
+    void setDispatchQueueForVerifier(dispatch_queue_t);
+#endif
+
+    // Turns off verification. Use of this method is discouraged (instead extend
+    // ThreadRestrictionVerifier to verify your case).
+    // NB. It is necessary to call this in the constructor of many objects in
+    // JavaScriptCore, because JavaScriptCore objects may be used from multiple
+    // threads even if the reference counting is done in a racy manner. This is
+    // because a JSC instance may be used from multiple threads so long as all
+    // accesses into that instance are protected by a per-instance lock. It would
+    // be absolutely wrong to prohibit this pattern, and it would be a disastrous
+    // regression to require that the objects within that instance use a thread-
+    // safe version of reference counting.
+    void turnOffVerifier()
+    {
+#if CHECK_REF_COUNTED_LIFECYCLE
+        m_verifier.turnOffVerification();
+#endif
+    }
+
+    void relaxAdoptionRequirement()
+    {
+#if CHECK_REF_COUNTED_LIFECYCLE
+        ASSERT(!m_deletionHasBegun);
+        ASSERT(m_adoptionIsRequired);
+        m_adoptionIsRequired = false;
+#endif
+    }
+
+    // Helper for generating JIT code. Please do not use for non-JIT purposes.
+    const int* addressOfCount() const
+    {
+        return &m_refCount;
+    }
+
+protected:
+    RefCountedBase()
+        : m_refCount(1)
+#if CHECK_REF_COUNTED_LIFECYCLE
+        , m_deletionHasBegun(false)
+        , m_adoptionIsRequired(true)
+#endif
+    {
+    }
+
+    ~RefCountedBase()
+    {
+#if CHECK_REF_COUNTED_LIFECYCLE
+        ASSERT(m_deletionHasBegun);
+        ASSERT(!m_adoptionIsRequired);
+#endif
+    }
+
+    // Returns whether the pointer should be freed or not.
+    bool derefBase()
+    {
+#if CHECK_REF_COUNTED_LIFECYCLE
+        ASSERT(m_verifier.isSafeToUse());
+        ASSERT(!m_deletionHasBegun);
+        ASSERT(!m_adoptionIsRequired);
+#endif
+
+        ASSERT(m_refCount > 0);
+        if (m_refCount == 1) {
+#if CHECK_REF_COUNTED_LIFECYCLE
+            m_deletionHasBegun = true;
+#endif
+            return true;
+        }
+
+        --m_refCount;
+#if CHECK_REF_COUNTED_LIFECYCLE
+        // Stop thread verification when the ref goes to 1 because it
+        // is safe to be passed to another thread at this point.
+        if (m_refCount == 1)
+            m_verifier.setShared(false);
+#endif
+        return false;
+    }
+
+#if CHECK_REF_COUNTED_LIFECYCLE
+    bool deletionHasBegun() const
+    {
+        return m_deletionHasBegun;
+    }
+#endif
+
+private:
+
+#if CHECK_REF_COUNTED_LIFECYCLE
+    friend void adopted(RefCountedBase*);
+#endif
+
+    int m_refCount;
+#if CHECK_REF_COUNTED_LIFECYCLE
+    bool m_deletionHasBegun;
+    bool m_adoptionIsRequired;
+    ThreadRestrictionVerifier m_verifier;
+#endif
+};
+
+#if CHECK_REF_COUNTED_LIFECYCLE
+inline void adopted(RefCountedBase* object)
+{
+    if (!object)
+        return;
+    ASSERT(!object->m_deletionHasBegun);
+    object->m_adoptionIsRequired = false;
+}
+#endif
+
+template<typename T> class RefCounted : public RefCountedBase {
+    WTF_MAKE_NONCOPYABLE(RefCounted); WTF_MAKE_FAST_ALLOCATED;
+public:
+    void deref()
+    {
+        if (derefBase())
+            delete static_cast<T*>(this);
+    }
+
+protected:
+    RefCounted() { }
+    ~RefCounted()
+    {
+    }
+};
+
+template<typename T> class RefCountedCustomAllocated : public RefCountedBase {
+    WTF_MAKE_NONCOPYABLE(RefCountedCustomAllocated);
+
+public:
+    void deref()
+    {
+        if (derefBase())
+            delete static_cast<T*>(this);
+    }
+
+protected:
+    ~RefCountedCustomAllocated()
+    {
+    }
+};
+
+#if CHECK_REF_COUNTED_LIFECYCLE
+inline void RefCountedBase::setMutexForVerifier(Mutex& mutex)
+{
+    m_verifier.setMutexMode(mutex);
+}
+#else
+inline void RefCountedBase::setMutexForVerifier(Mutex&) { }
+#endif
+
+#if HAVE(DISPATCH_H)
+#if CHECK_REF_COUNTED_LIFECYCLE
+inline void RefCountedBase::setDispatchQueueForVerifier(dispatch_queue_t queue)
+{
+    m_verifier.setDispatchQueueMode(queue);
+}
+#else
+inline void RefCountedBase::setDispatchQueueForVerifier(dispatch_queue_t) { }
+#endif
+#endif // HAVE(DISPATCH_H)
+
+} // namespace WTF
+
+using WTF::RefCounted;
+using WTF::RefCountedCustomAllocated;
+
+#endif // RefCounted_h
diff --git a/Source/WTF/wtf/RefCountedArray.h b/Source/WTF/wtf/RefCountedArray.h
new file mode 100644
index 0000000..289f1fc
--- /dev/null
+++ b/Source/WTF/wtf/RefCountedArray.h
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2011 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. ``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
+ * 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 RefCountedArray_h
+#define RefCountedArray_h
+
+#include <wtf/FastMalloc.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/Vector.h>
+
+// This implements a reference counted array for POD** values, which is optimized for:
+// - An empty array only uses one word.
+// - A copy of the array only uses one word (i.e. assignment means aliasing).
+// - The vector can't grow beyond 2^32-1 elements.
+// - In all other regards this has similar space usage to a Vector.
+//
+// ** This could be modified to support non-POD values quite easily. It just
+//    hasn't been, so far, because there has been no need. Moreover, even now,
+//    it's used for things that aren't quite POD according to the official
+//    defintion, such as JSC::Instruction.
+
+namespace WTF {
+
+template<typename T>
+class RefCountedArray {
+public:
+    RefCountedArray()
+        : m_data(0)
+    {
+    }
+    
+    RefCountedArray(const RefCountedArray& other)
+        : m_data(other.m_data)
+    {
+        if (m_data)
+            Header::fromPayload(m_data)->refCount++;
+    }
+    
+    explicit RefCountedArray(const Vector<T>& other)
+    {
+        if (other.isEmpty()) {
+            m_data = 0;
+            return;
+        }
+        
+        m_data = (static_cast<Header*>(fastMalloc(Header::size() + sizeof(T) * other.size())))->payload();
+        Header::fromPayload(m_data)->refCount = 1;
+        Header::fromPayload(m_data)->length = other.size();
+        ASSERT(Header::fromPayload(m_data)->length == other.size());
+        memcpy(m_data, other.begin(), sizeof(T) * other.size());
+    }
+    
+    RefCountedArray& operator=(const RefCountedArray& other)
+    {
+        T* oldData = m_data;
+        m_data = other.m_data;
+        if (m_data)
+            Header::fromPayload(m_data)->refCount++;
+        
+        if (!oldData)
+            return *this;
+        if (--Header::fromPayload(oldData)->refCount)
+            return *this;
+        fastFree(Header::fromPayload(oldData));
+        return *this;
+    }
+    
+    ~RefCountedArray()
+    {
+        if (!m_data)
+            return;
+        if (--Header::fromPayload(m_data)->refCount)
+            return;
+        fastFree(Header::fromPayload(m_data));
+    }
+    
+    size_t size() const
+    {
+        if (!m_data)
+            return 0;
+        return Header::fromPayload(m_data)->length;
+    }
+    
+    T* data() { return m_data; }
+    T* begin() { return m_data; }
+    T* end()
+    {
+        if (!m_data)
+            return 0;
+        return m_data + Header::fromPayload(m_data)->length;
+    }
+    
+    const T* data() const { return m_data; }
+    const T* begin() const { return m_data; }
+    const T* end() const { return const_cast<RefCountedArray*>(this)->end(); }
+    
+    T& at(size_t i)
+    {
+        ASSERT(i < size());
+        return begin()[i];
+    }
+    
+    const T& at(size_t i) const
+    {
+        ASSERT(i < size());
+        return begin()[i];
+    }
+    
+    T& operator[](size_t i) { return at(i); }
+    const T& operator[](size_t i) const { return at(i); }
+    
+private:
+    struct Header {
+        unsigned refCount;
+        unsigned length;
+        
+        static size_t size()
+        {
+            return (sizeof(Header) + 7) & ~7;
+        }
+        
+        T* payload()
+        {
+            char* result = reinterpret_cast<char*>(this) + size();
+            ASSERT(!(bitwise_cast<uintptr_t>(result) & 7));
+            return reinterpret_cast_ptr<T*>(result);
+        }
+        
+        static Header* fromPayload(T* payload)
+        {
+            return reinterpret_cast_ptr<Header*>(reinterpret_cast<char*>(payload) - size());
+        }
+    };
+    
+    T* m_data;
+};
+
+} // namespace WTF
+
+using WTF::RefCountedArray;
+
+#endif // RefCountedArray_h
+
diff --git a/Source/WTF/wtf/RefCountedLeakCounter.cpp b/Source/WTF/wtf/RefCountedLeakCounter.cpp
new file mode 100644
index 0000000..4a04528
--- /dev/null
+++ b/Source/WTF/wtf/RefCountedLeakCounter.cpp
@@ -0,0 +1,92 @@
+/*
+ *  Copyright (C) 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.
+ *
+ */
+
+#include "config.h"
+#include "RefCountedLeakCounter.h"
+
+#include <wtf/HashCountedSet.h>
+
+namespace WTF {
+
+#ifdef NDEBUG
+
+void RefCountedLeakCounter::suppressMessages(const char*) { }
+void RefCountedLeakCounter::cancelMessageSuppression(const char*) { }
+
+RefCountedLeakCounter::RefCountedLeakCounter(const char*) { }
+RefCountedLeakCounter::~RefCountedLeakCounter() { }
+
+void RefCountedLeakCounter::increment() { }
+void RefCountedLeakCounter::decrement() { }
+
+#else
+
+#define LOG_CHANNEL_PREFIX Log
+static WTFLogChannel LogRefCountedLeaks = { 0x00000000, "", WTFLogChannelOn };
+
+typedef HashCountedSet<const char*, PtrHash<const char*> > ReasonSet;
+static ReasonSet* leakMessageSuppressionReasons;
+
+void RefCountedLeakCounter::suppressMessages(const char* reason)
+{
+    if (!leakMessageSuppressionReasons)
+        leakMessageSuppressionReasons = new ReasonSet;
+    leakMessageSuppressionReasons->add(reason);
+}
+
+void RefCountedLeakCounter::cancelMessageSuppression(const char* reason)
+{
+    ASSERT(leakMessageSuppressionReasons);
+    ASSERT(leakMessageSuppressionReasons->contains(reason));
+    leakMessageSuppressionReasons->remove(reason);
+}
+
+RefCountedLeakCounter::RefCountedLeakCounter(const char* description)
+    : m_description(description)
+{
+}    
+
+RefCountedLeakCounter::~RefCountedLeakCounter()
+{
+    static bool loggedSuppressionReason;
+    if (m_count) {
+        if (!leakMessageSuppressionReasons || leakMessageSuppressionReasons->isEmpty())
+            LOG(RefCountedLeaks, "LEAK: %u %s", m_count, m_description);
+        else if (!loggedSuppressionReason) {
+            // This logs only one reason. Later we could change it so we log all the reasons.
+            LOG(RefCountedLeaks, "No leak checking done: %s", leakMessageSuppressionReasons->begin()->key);
+            loggedSuppressionReason = true;
+        }
+    }
+}
+
+void RefCountedLeakCounter::increment()
+{
+    atomicIncrement(&m_count);
+}
+
+void RefCountedLeakCounter::decrement()
+{
+    atomicDecrement(&m_count);
+}
+
+#endif
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/RefCountedLeakCounter.h b/Source/WTF/wtf/RefCountedLeakCounter.h
new file mode 100644
index 0000000..8d894dd
--- /dev/null
+++ b/Source/WTF/wtf/RefCountedLeakCounter.h
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 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 RefCountedLeakCounter_h
+#define RefCountedLeakCounter_h
+ 
+#include <wtf/Assertions.h>
+#include <wtf/Threading.h>
+
+namespace WTF {
+    
+    struct RefCountedLeakCounter {
+        WTF_EXPORT_PRIVATE static void suppressMessages(const char*);
+        WTF_EXPORT_PRIVATE static void cancelMessageSuppression(const char*);
+        
+        WTF_EXPORT_PRIVATE explicit RefCountedLeakCounter(const char* description);
+        WTF_EXPORT_PRIVATE ~RefCountedLeakCounter();
+
+        WTF_EXPORT_PRIVATE void increment();
+        WTF_EXPORT_PRIVATE void decrement();
+
+#ifndef NDEBUG
+    private:
+#if COMPILER(MINGW) || COMPILER(MSVC7_OR_LOWER) || OS(WINCE)
+        int m_count;
+#else
+        volatile int m_count;
+#endif
+        const char* m_description;
+#endif
+    };
+
+}  // namespace WTF
+
+#endif
diff --git a/Source/WTF/wtf/RefPtr.h b/Source/WTF/wtf/RefPtr.h
new file mode 100644
index 0000000..322cbd6
--- /dev/null
+++ b/Source/WTF/wtf/RefPtr.h
@@ -0,0 +1,207 @@
+/*
+ *  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 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.
+ *
+ */
+
+// RefPtr and PassRefPtr are documented at http://webkit.org/coding/RefPtr.html
+
+#ifndef WTF_RefPtr_h
+#define WTF_RefPtr_h
+
+#include <algorithm>
+#include <wtf/FastAllocBase.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WTF {
+
+    enum PlacementNewAdoptType { PlacementNewAdopt };
+
+    template<typename T> class PassRefPtr;
+
+    enum HashTableDeletedValueType { HashTableDeletedValue };
+
+    template<typename T> class RefPtr {
+        WTF_MAKE_FAST_ALLOCATED;
+    public:
+        ALWAYS_INLINE RefPtr() : m_ptr(0) { }
+        ALWAYS_INLINE RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
+        ALWAYS_INLINE RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { refIfNotNull(m_ptr); }
+        template<typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { refIfNotNull(m_ptr); }
+
+        // See comments in PassRefPtr.h for an explanation of why this takes a const reference.
+        template<typename U> RefPtr(const PassRefPtr<U>&);
+
+        // Special constructor for cases where we overwrite an object in place.
+        ALWAYS_INLINE RefPtr(PlacementNewAdoptType) { }
+
+        // Hash table deleted values, which are only constructed and never copied or destroyed.
+        RefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
+        bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
+
+        ALWAYS_INLINE ~RefPtr() { derefIfNotNull(m_ptr); }
+
+        T* get() const { return m_ptr; }
+        
+        void clear();
+        PassRefPtr<T> release() { PassRefPtr<T> tmp = adoptRef(m_ptr); m_ptr = 0; return tmp; }
+
+        T& operator*() const { return *m_ptr; }
+        ALWAYS_INLINE T* operator->() const { return m_ptr; }
+        
+        bool operator!() const { return !m_ptr; }
+    
+        // This conversion operator allows implicit conversion to bool but not to other integer types.
+        typedef T* (RefPtr::*UnspecifiedBoolType);
+        operator UnspecifiedBoolType() const { return m_ptr ? &RefPtr::m_ptr : 0; }
+        
+        RefPtr& operator=(const RefPtr&);
+        RefPtr& operator=(T*);
+        RefPtr& operator=(const PassRefPtr<T>&);
+#if !COMPILER_SUPPORTS(CXX_NULLPTR)
+        RefPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
+        template<typename U> RefPtr& operator=(const RefPtr<U>&);
+        template<typename U> RefPtr& operator=(const PassRefPtr<U>&);
+
+        void swap(RefPtr&);
+
+        static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
+
+    private:
+        T* m_ptr;
+    };
+    
+    template<typename T> template<typename U> inline RefPtr<T>::RefPtr(const PassRefPtr<U>& o)
+        : m_ptr(o.leakRef())
+    {
+    }
+
+    template<typename T> inline void RefPtr<T>::clear()
+    {
+        T* ptr = m_ptr;
+        m_ptr = 0;
+        derefIfNotNull(ptr);
+    }
+
+    template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<T>& o)
+    {
+        T* optr = o.get();
+        refIfNotNull(optr);
+        T* ptr = m_ptr;
+        m_ptr = optr;
+        derefIfNotNull(ptr);
+        return *this;
+    }
+    
+    template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<U>& o)
+    {
+        T* optr = o.get();
+        refIfNotNull(optr);
+        T* ptr = m_ptr;
+        m_ptr = optr;
+        derefIfNotNull(ptr);
+        return *this;
+    }
+    
+    template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(T* optr)
+    {
+        refIfNotNull(optr);
+        T* ptr = m_ptr;
+        m_ptr = optr;
+        derefIfNotNull(ptr);
+        return *this;
+    }
+
+    template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<T>& o)
+    {
+        T* ptr = m_ptr;
+        m_ptr = o.leakRef();
+        derefIfNotNull(ptr);
+        return *this;
+    }
+
+    template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<U>& o)
+    {
+        T* ptr = m_ptr;
+        m_ptr = o.leakRef();
+        derefIfNotNull(ptr);
+        return *this;
+    }
+
+    template<class T> inline void RefPtr<T>::swap(RefPtr<T>& o)
+    {
+        std::swap(m_ptr, o.m_ptr);
+    }
+
+    template<class T> inline void swap(RefPtr<T>& a, RefPtr<T>& b)
+    {
+        a.swap(b);
+    }
+
+    template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, const RefPtr<U>& b)
+    { 
+        return a.get() == b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, U* b)
+    { 
+        return a.get() == b; 
+    }
+    
+    template<typename T, typename U> inline bool operator==(T* a, const RefPtr<U>& b) 
+    {
+        return a == b.get(); 
+    }
+    
+    template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const RefPtr<U>& b)
+    { 
+        return a.get() != b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, U* b)
+    {
+        return a.get() != b; 
+    }
+
+    template<typename T, typename U> inline bool operator!=(T* a, const RefPtr<U>& b)
+    { 
+        return a != b.get(); 
+    }
+    
+    template<typename T, typename U> inline RefPtr<T> static_pointer_cast(const RefPtr<U>& p)
+    { 
+        return RefPtr<T>(static_cast<T*>(p.get())); 
+    }
+
+    template<typename T, typename U> inline RefPtr<T> const_pointer_cast(const RefPtr<U>& p)
+    { 
+        return RefPtr<T>(const_cast<T*>(p.get())); 
+    }
+
+    template<typename T> inline T* getPtr(const RefPtr<T>& p)
+    {
+        return p.get();
+    }
+
+} // namespace WTF
+
+using WTF::RefPtr;
+using WTF::static_pointer_cast;
+using WTF::const_pointer_cast;
+
+#endif // WTF_RefPtr_h
diff --git a/Source/WTF/wtf/RefPtrHashMap.h b/Source/WTF/wtf/RefPtrHashMap.h
new file mode 100644
index 0000000..9541837
--- /dev/null
+++ b/Source/WTF/wtf/RefPtrHashMap.h
@@ -0,0 +1,330 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2008, 2011 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 RefPtrHashMap_h
+#define RefPtrHashMap_h
+
+namespace WTF {
+
+    // This specialization is a copy of HashMap for use with RefPtr keys, with overloaded functions
+    // to allow for lookup by pointer instead of RefPtr, avoiding ref-count churn.
+    
+     // FIXME: Find a way to do this with traits that doesn't require a copy of the HashMap template.
+    
+    template<typename T, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg>
+    class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> {
+        WTF_MAKE_FAST_ALLOCATED;
+    private:
+        typedef KeyTraitsArg KeyTraits;
+        typedef MappedTraitsArg MappedTraits;
+        typedef KeyValuePairHashTraits<KeyTraits, MappedTraits> ValueTraits;
+
+    public:
+        typedef typename KeyTraits::TraitType KeyType;
+        typedef T* RawKeyType;
+        typedef typename MappedTraits::TraitType MappedType;
+        typedef typename ValueTraits::TraitType ValueType;
+
+    private:
+        typedef typename MappedTraits::PassInType MappedPassInType;
+        typedef typename MappedTraits::PassOutType MappedPassOutType;
+        typedef typename MappedTraits::PeekType MappedPeekType;
+
+        typedef typename ReferenceTypeMaker<MappedPassInType>::ReferenceType MappedPassInReferenceType;
+        
+        typedef HashArg HashFunctions;
+
+        typedef HashTable<KeyType, ValueType, KeyValuePairKeyExtractor<ValueType>,
+            HashFunctions, ValueTraits, KeyTraits> HashTableType;
+
+        typedef HashMapTranslator<ValueTraits, HashFunctions>
+            Translator;
+
+    public:
+        typedef HashTableIteratorAdapter<HashTableType, ValueType> iterator;
+        typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator;
+        typedef typename HashTableType::AddResult AddResult;
+
+        void swap(HashMap&);
+
+        int size() const;
+        int capacity() const;
+        bool isEmpty() const;
+
+        // iterators iterate over pairs of keys and values
+        iterator begin();
+        iterator end();
+        const_iterator begin() const;
+        const_iterator end() const;
+
+        iterator find(const KeyType&);
+        iterator find(RawKeyType);
+        const_iterator find(const KeyType&) const;
+        const_iterator find(RawKeyType) const;
+        bool contains(const KeyType&) const;
+        bool contains(RawKeyType) const;
+        MappedPeekType get(const KeyType&) const;
+        MappedPeekType get(RawKeyType) const;
+        MappedPeekType inlineGet(RawKeyType) const;
+
+        // replaces value but not key if key is already present
+        // return value is a pair of the iterator to the key location, 
+        // and a boolean that's true if a new value was actually added
+        AddResult set(const KeyType&, MappedPassInType);
+        AddResult set(RawKeyType, MappedPassInType);
+
+        // does nothing if key is already present
+        // return value is a pair of the iterator to the key location, 
+        // and a boolean that's true if a new value was actually added
+        AddResult add(const KeyType&, MappedPassInType);
+        AddResult add(RawKeyType, MappedPassInType);
+
+        void remove(const KeyType&);
+        void remove(RawKeyType);
+        void remove(iterator);
+        void clear();
+
+        MappedPassOutType take(const KeyType&); // efficient combination of get with remove
+        MappedPassOutType take(RawKeyType); // efficient combination of get with remove
+
+    private:
+        AddResult inlineAdd(const KeyType&, MappedPassInReferenceType);
+        AddResult inlineAdd(RawKeyType, MappedPassInReferenceType);
+
+        HashTableType m_impl;
+    };
+    
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void HashMap<RefPtr<T>, U, V, W, X>::swap(HashMap& other)
+    {
+        m_impl.swap(other.m_impl); 
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline int HashMap<RefPtr<T>, U, V, W, X>::size() const
+    {
+        return m_impl.size(); 
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline int HashMap<RefPtr<T>, U, V, W, X>::capacity() const
+    { 
+        return m_impl.capacity(); 
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline bool HashMap<RefPtr<T>, U, V, W, X>::isEmpty() const
+    {
+        return m_impl.isEmpty();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::begin()
+    {
+        return m_impl.begin();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::end()
+    {
+        return m_impl.end();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::begin() const
+    {
+        return m_impl.begin();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::end() const
+    {
+        return m_impl.end();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key)
+    {
+        return m_impl.find(key);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key)
+    {
+        return m_impl.template find<Translator>(key);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key) const
+    {
+        return m_impl.find(key);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key) const
+    {
+        return m_impl.template find<Translator>(key);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(const KeyType& key) const
+    {
+        return m_impl.contains(key);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(RawKeyType key) const
+    {
+        return m_impl.template contains<Translator>(key);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<RefPtr<T>, U, V, W, X>::AddResult
+    HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(const KeyType& key, MappedPassInReferenceType mapped) 
+    {
+        return m_impl.template add<Translator>(key, mapped);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline typename HashMap<RefPtr<T>, U, V, W, X>::AddResult
+    HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(RawKeyType key, MappedPassInReferenceType mapped) 
+    {
+        return m_impl.template add<Translator>(key, mapped);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    typename HashMap<RefPtr<T>, U, V, W, X>::AddResult
+    HashMap<RefPtr<T>, U, V, W, X>::set(const KeyType& key, MappedPassInType mapped) 
+    {
+        AddResult result = inlineAdd(key, mapped);
+        if (!result.isNewEntry) {
+            // The inlineAdd call above found an existing hash table entry; we need to set the mapped value.
+            MappedTraits::store(mapped, result.iterator->value);
+        }
+        return result;
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    typename HashMap<RefPtr<T>, U, V, W, X>::AddResult
+    HashMap<RefPtr<T>, U, V, W, X>::set(RawKeyType key, MappedPassInType mapped) 
+    {
+        AddResult result = inlineAdd(key, mapped);
+        if (!result.isNewEntry) {
+            // The inlineAdd call above found an existing hash table entry; we need to set the mapped value.
+            MappedTraits::store(mapped, result.iterator->value);
+        }
+        return result;
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    typename HashMap<RefPtr<T>, U, V, W, X>::AddResult
+    HashMap<RefPtr<T>, U, V, W, X>::add(const KeyType& key, MappedPassInType mapped)
+    {
+        return inlineAdd(key, mapped);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    typename HashMap<RefPtr<T>, U, V, W, X>::AddResult
+    HashMap<RefPtr<T>, U, V, W, X>::add(RawKeyType key, MappedPassInType mapped)
+    {
+        return inlineAdd(key, mapped);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename MappedTraits>
+    typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedPeekType
+    HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(const KeyType& key) const
+    {
+        ValueType* entry = const_cast<HashTableType&>(m_impl).lookup(key);
+        if (!entry)
+            return MappedTraits::peek(MappedTraits::emptyValue());
+        return MappedTraits::peek(entry->value);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename MappedTraits>
+    typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedPeekType
+    inline HashMap<RefPtr<T>, U, V, W, MappedTraits>::inlineGet(RawKeyType key) const
+    {
+        ValueType* entry = const_cast<HashTableType&>(m_impl).template lookup<Translator>(key);
+        if (!entry)
+            return MappedTraits::peek(MappedTraits::emptyValue());
+        return MappedTraits::peek(entry->value);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename MappedTraits>
+    typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedPeekType
+    HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(RawKeyType key) const
+    {
+        return inlineGet(key);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void HashMap<RefPtr<T>, U, V, W, X>::remove(iterator it)
+    {
+        if (it.m_impl == m_impl.end())
+            return;
+        m_impl.internalCheckTableConsistency();
+        m_impl.removeWithoutEntryConsistencyCheck(it.m_impl);
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void HashMap<RefPtr<T>, U, V, W, X>::remove(const KeyType& key)
+    {
+        remove(find(key));
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void HashMap<RefPtr<T>, U, V, W, X>::remove(RawKeyType key)
+    {
+        remove(find(key));
+    }
+
+    template<typename T, typename U, typename V, typename W, typename X>
+    inline void HashMap<RefPtr<T>, U, V, W, X>::clear()
+    {
+        m_impl.clear();
+    }
+
+    template<typename T, typename U, typename V, typename W, typename MappedTraits>
+    typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedPassOutType
+    HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(const KeyType& key)
+    {
+        iterator it = find(key);
+        if (it == end())
+            return MappedTraits::passOut(MappedTraits::emptyValue());
+        MappedPassOutType result = MappedTraits::passOut(it->value);
+        remove(it);
+        return result;
+    }
+
+    template<typename T, typename U, typename V, typename W, typename MappedTraits>
+    typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedPassOutType
+    HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(RawKeyType key)
+    {
+        iterator it = find(key);
+        if (it == end())
+            return MappedTraits::passOut(MappedTraits::emptyValue());
+        MappedPassOutType result = MappedTraits::passOut(it->value);
+        remove(it);
+        return result;
+    }
+
+} // namespace WTF
+
+#endif // RefPtrHashMap_h
diff --git a/Source/WTF/wtf/RetainPtr.h b/Source/WTF/wtf/RetainPtr.h
new file mode 100644
index 0000000..71391fd
--- /dev/null
+++ b/Source/WTF/wtf/RetainPtr.h
@@ -0,0 +1,309 @@
+/*
+ *  Copyright (C) 2005, 2006, 2007, 2008, 2010 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 RetainPtr_h
+#define RetainPtr_h
+
+#include <wtf/HashTraits.h>
+#include <wtf/NullPtr.h>
+#include <wtf/TypeTraits.h>
+#include <algorithm>
+
+#if USE(CF)
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
+#ifdef __OBJC__
+#import <Foundation/Foundation.h>
+#endif
+
+#ifndef CF_RELEASES_ARGUMENT
+#define CF_RELEASES_ARGUMENT
+#endif
+
+#ifndef NS_RELEASES_ARGUMENT
+#define NS_RELEASES_ARGUMENT
+#endif
+
+namespace WTF {
+
+    // Unlike most most of our smart pointers, RetainPtr can take either the pointer type or the pointed-to type,
+    // so both RetainPtr<NSDictionary> and RetainPtr<CFDictionaryRef> will work.
+
+    enum AdoptCFTag { AdoptCF };
+    enum AdoptNSTag { AdoptNS };
+    
+#ifdef __OBJC__
+    inline void adoptNSReference(id ptr)
+    {
+        if (ptr) {
+            CFRetain(ptr);
+            [ptr release];
+        }
+    }
+#endif
+
+    template<typename T> class RetainPtr {
+    public:
+        typedef typename RemovePointer<T>::Type ValueType;
+        typedef ValueType* PtrType;
+
+        RetainPtr() : m_ptr(0) {}
+        RetainPtr(PtrType ptr) : m_ptr(ptr) { if (ptr) CFRetain(ptr); }
+
+        RetainPtr(AdoptCFTag, PtrType ptr) : m_ptr(ptr) { }
+        RetainPtr(AdoptNSTag, PtrType ptr) : m_ptr(ptr) { adoptNSReference(ptr); }
+        
+        RetainPtr(const RetainPtr& o) : m_ptr(o.m_ptr) { if (PtrType ptr = m_ptr) CFRetain(ptr); }
+
+#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+        RetainPtr(RetainPtr&& o) : m_ptr(o.leakRef()) { }
+#endif
+
+        // Hash table deleted values, which are only constructed and never copied or destroyed.
+        RetainPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
+        bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
+        
+        ~RetainPtr() { if (PtrType ptr = m_ptr) CFRelease(ptr); }
+        
+        template<typename U> RetainPtr(const RetainPtr<U>&);
+
+        void clear();
+        PtrType leakRef() WARN_UNUSED_RETURN;
+
+        PtrType get() const { return m_ptr; }
+        PtrType operator->() const { return m_ptr; }
+#if COMPILER_SUPPORTS(CXX_EXPLICIT_CONVERSIONS)
+        explicit operator PtrType() const { return m_ptr; }
+#endif
+
+        bool operator!() const { return !m_ptr; }
+    
+        // This conversion operator allows implicit conversion to bool but not to other integer types.
+        typedef PtrType RetainPtr::*UnspecifiedBoolType;
+        operator UnspecifiedBoolType() const { return m_ptr ? &RetainPtr::m_ptr : 0; }
+        
+        RetainPtr& operator=(const RetainPtr&);
+        template<typename U> RetainPtr& operator=(const RetainPtr<U>&);
+        RetainPtr& operator=(PtrType);
+        template<typename U> RetainPtr& operator=(U*);
+
+#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+        RetainPtr& operator=(RetainPtr&&);
+        template<typename U> RetainPtr& operator=(RetainPtr<U>&&);
+#endif
+
+#if !COMPILER_SUPPORTS(CXX_NULLPTR)
+        RetainPtr& operator=(std::nullptr_t) { clear(); return *this; }
+#endif
+
+        void adoptCF(PtrType);
+        void adoptNS(PtrType);
+        
+        void swap(RetainPtr&);
+
+    private:
+        static PtrType hashTableDeletedValue() { return reinterpret_cast<PtrType>(-1); }
+
+        PtrType m_ptr;
+    };
+    
+    template<typename T> template<typename U> inline RetainPtr<T>::RetainPtr(const RetainPtr<U>& o)
+        : m_ptr(o.get())
+    {
+        if (PtrType ptr = m_ptr)
+            CFRetain(ptr);
+    }
+
+    template<typename T> inline void RetainPtr<T>::clear()
+    {
+        if (PtrType ptr = m_ptr) {
+            m_ptr = 0;
+            CFRelease(ptr);
+        }
+    }
+
+    template<typename T> inline typename RetainPtr<T>::PtrType RetainPtr<T>::leakRef()
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = 0;
+        return ptr;
+    }
+
+    template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(const RetainPtr<T>& o)
+    {
+        PtrType optr = o.get();
+        if (optr)
+            CFRetain(optr);
+        PtrType ptr = m_ptr;
+        m_ptr = optr;
+        if (ptr)
+            CFRelease(ptr);
+        return *this;
+    }
+    
+    template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(const RetainPtr<U>& o)
+    {
+        PtrType optr = o.get();
+        if (optr)
+            CFRetain(optr);
+        PtrType ptr = m_ptr;
+        m_ptr = optr;
+        if (ptr)
+            CFRelease(ptr);
+        return *this;
+    }
+
+    template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(PtrType optr)
+    {
+        if (optr)
+            CFRetain(optr);
+        PtrType ptr = m_ptr;
+        m_ptr = optr;
+        if (ptr)
+            CFRelease(ptr);
+        return *this;
+    }
+
+    template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(U* optr)
+    {
+        if (optr)
+            CFRetain(optr);
+        PtrType ptr = m_ptr;
+        m_ptr = optr;
+        if (ptr)
+            CFRelease(ptr);
+        return *this;
+    }
+
+#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+    template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(RetainPtr<T>&& o)
+    {
+        adoptCF(o.leakRef());
+        return *this;
+    }
+    
+    template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(RetainPtr<U>&& o)
+    {
+        adoptCF(o.leakRef());
+        return *this;
+    }
+#endif
+
+    template<typename T> inline void RetainPtr<T>::adoptCF(PtrType optr)
+    {
+        PtrType ptr = m_ptr;
+        m_ptr = optr;
+        if (ptr)
+            CFRelease(ptr);
+    }
+
+    template<typename T> inline void RetainPtr<T>::adoptNS(PtrType optr)
+    {
+        adoptNSReference(optr);
+        
+        PtrType ptr = m_ptr;
+        m_ptr = optr;
+        if (ptr)
+            CFRelease(ptr);
+    }
+
+    template<typename T> inline void RetainPtr<T>::swap(RetainPtr<T>& o)
+    {
+        std::swap(m_ptr, o.m_ptr);
+    }
+
+    template<typename T> inline void swap(RetainPtr<T>& a, RetainPtr<T>& b)
+    {
+        a.swap(b);
+    }
+
+    template<typename T, typename U> inline bool operator==(const RetainPtr<T>& a, const RetainPtr<U>& b)
+    { 
+        return a.get() == b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator==(const RetainPtr<T>& a, U* b)
+    { 
+        return a.get() == b; 
+    }
+    
+    template<typename T, typename U> inline bool operator==(T* a, const RetainPtr<U>& b) 
+    {
+        return a == b.get(); 
+    }
+    
+    template<typename T, typename U> inline bool operator!=(const RetainPtr<T>& a, const RetainPtr<U>& b)
+    { 
+        return a.get() != b.get(); 
+    }
+
+    template<typename T, typename U> inline bool operator!=(const RetainPtr<T>& a, U* b)
+    {
+        return a.get() != b; 
+    }
+
+    template<typename T, typename U> inline bool operator!=(T* a, const RetainPtr<U>& b)
+    { 
+        return a != b.get(); 
+    }
+
+    template<typename T> inline RetainPtr<T> adoptCF(T CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
+    template<typename T> inline RetainPtr<T> adoptCF(T o)
+    {
+        return RetainPtr<T>(AdoptCF, o);
+    }
+
+    template<typename T> inline RetainPtr<T> adoptNS(T NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
+    template<typename T> inline RetainPtr<T> adoptNS(T o)
+    {
+        return RetainPtr<T>(AdoptNS, o);
+    }
+
+    // Helper function for creating a RetainPtr using template argument deduction.
+    template<typename T> inline RetainPtr<T> retainPtr(T) WARN_UNUSED_RETURN;
+    template<typename T> inline RetainPtr<T> retainPtr(T o)
+    {
+        return RetainPtr<T>(o);
+    }
+
+    template<typename P> struct HashTraits<RetainPtr<P> > : SimpleClassHashTraits<RetainPtr<P> > { };
+    
+    template<typename P> struct PtrHash<RetainPtr<P> > : PtrHash<typename RetainPtr<P>::PtrType> {
+        using PtrHash<typename RetainPtr<P>::PtrType>::hash;
+        static unsigned hash(const RetainPtr<P>& key) { return hash(key.get()); }
+        using PtrHash<typename RetainPtr<P>::PtrType>::equal;
+        static bool equal(const RetainPtr<P>& a, const RetainPtr<P>& b) { return a == b; }
+        static bool equal(typename RetainPtr<P>::PtrType a, const RetainPtr<P>& b) { return a == b; }
+        static bool equal(const RetainPtr<P>& a, typename RetainPtr<P>::PtrType b) { return a == b; }
+    };
+    
+    template<typename P> struct DefaultHash<RetainPtr<P> > { typedef PtrHash<RetainPtr<P> > Hash; };
+
+} // namespace WTF
+
+using WTF::AdoptCF;
+using WTF::AdoptNS;
+using WTF::adoptCF;
+using WTF::adoptNS;
+using WTF::RetainPtr;
+using WTF::retainPtr;
+
+#endif // WTF_RetainPtr_h
diff --git a/Source/WTF/wtf/SHA1.cpp b/Source/WTF/wtf/SHA1.cpp
new file mode 100644
index 0000000..e76f6ac
--- /dev/null
+++ b/Source/WTF/wtf/SHA1.cpp
@@ -0,0 +1,219 @@
+/*
+ * 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.
+ *     * 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.
+ *     * 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.
+ */
+
+// A straightforward SHA-1 implementation based on RFC 3174.
+// http://www.ietf.org/rfc/rfc3174.txt
+// The names of functions and variables (such as "a", "b", and "f") follow notations in RFC 3174.
+
+#include "config.h"
+#include "SHA1.h"
+
+#include "Assertions.h"
+#ifndef NDEBUG
+#include "StringExtras.h"
+#include "text/CString.h"
+#endif
+
+namespace WTF {
+
+#ifdef NDEBUG
+static inline void testSHA1() { }
+#else
+static bool isTestSHA1Done;
+
+static void expectSHA1(CString input, int repeat, CString expected)
+{
+    SHA1 sha1;
+    for (int i = 0; i < repeat; ++i)
+        sha1.addBytes(reinterpret_cast<const uint8_t*>(input.data()), input.length());
+    Vector<uint8_t, 20> digest;
+    sha1.computeHash(digest);
+    char* buffer = 0;
+    CString actual = CString::newUninitialized(40, buffer);
+    for (size_t i = 0; i < 20; ++i) {
+        snprintf(buffer, 3, "%02X", digest.at(i));
+        buffer += 2;
+    }
+    ASSERT_WITH_MESSAGE(actual == expected, "input: %s, repeat: %d, actual: %s, expected: %s", input.data(), repeat, actual.data(), expected.data());
+}
+
+static void testSHA1()
+{
+    if (isTestSHA1Done)
+        return;
+    isTestSHA1Done = true;
+
+    // Examples taken from sample code in RFC 3174.
+    expectSHA1("abc", 1, "A9993E364706816ABA3E25717850C26C9CD0D89D");
+    expectSHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 1, "84983E441C3BD26EBAAE4AA1F95129E5E54670F1");
+    expectSHA1("a", 1000000, "34AA973CD4C4DAA4F61EEB2BDBAD27316534016F");
+    expectSHA1("0123456701234567012345670123456701234567012345670123456701234567", 10, "DEA356A2CDDD90C7A7ECEDC5EBB563934F460452");
+}
+#endif
+
+static inline uint32_t f(int t, uint32_t b, uint32_t c, uint32_t d)
+{
+    ASSERT(t >= 0 && t < 80);
+    if (t < 20)
+        return (b & c) | ((~b) & d);
+    if (t < 40)
+        return b ^ c ^ d;
+    if (t < 60)
+        return (b & c) | (b & d) | (c & d);
+    return b ^ c ^ d;
+}
+
+static inline uint32_t k(int t)
+{
+    ASSERT(t >= 0 && t < 80);
+    if (t < 20)
+        return 0x5a827999;
+    if (t < 40)
+        return 0x6ed9eba1;
+    if (t < 60)
+        return 0x8f1bbcdc;
+    return 0xca62c1d6;
+}
+
+static inline uint32_t rotateLeft(int n, uint32_t x)
+{
+    ASSERT(n >= 0 && n < 32);
+    return (x << n) | (x >> (32 - n));
+}
+
+SHA1::SHA1()
+{
+    // FIXME: Move unit tests somewhere outside the constructor. See bug 55853.
+    testSHA1();
+    reset();
+}
+
+void SHA1::addBytes(const uint8_t* input, size_t length)
+{
+    while (length--) {
+        ASSERT(m_cursor < 64);
+        m_buffer[m_cursor++] = *input++;
+        ++m_totalBytes;
+        if (m_cursor == 64)
+            processBlock();
+    }
+}
+
+void SHA1::computeHash(Vector<uint8_t, 20>& digest)
+{
+    finalize();
+
+    digest.clear();
+    digest.resize(20);
+    for (size_t i = 0; i < 5; ++i) {
+        // Treat hashValue as a big-endian value.
+        uint32_t hashValue = m_hash[i];
+        for (int j = 0; j < 4; ++j) {
+            digest[4 * i + (3 - j)] = hashValue & 0xFF;
+            hashValue >>= 8;
+        }
+    }
+
+    reset();
+}
+
+void SHA1::finalize()
+{
+    ASSERT(m_cursor < 64);
+    m_buffer[m_cursor++] = 0x80;
+    if (m_cursor > 56) {
+        // Pad out to next block.
+        while (m_cursor < 64)
+            m_buffer[m_cursor++] = 0x00;
+        processBlock();
+    }
+
+    for (size_t i = m_cursor; i < 56; ++i)
+        m_buffer[i] = 0x00;
+
+    // Write the length as a big-endian 64-bit value.
+    uint64_t bits = m_totalBytes * 8;
+    for (int i = 0; i < 8; ++i) {
+        m_buffer[56 + (7 - i)] = bits & 0xFF;
+        bits >>= 8;
+    }
+    m_cursor = 64;
+    processBlock();
+}
+
+void SHA1::processBlock()
+{
+    ASSERT(m_cursor == 64);
+
+    uint32_t w[80] = { 0 };
+    for (int t = 0; t < 16; ++t)
+        w[t] = (m_buffer[t * 4] << 24) | (m_buffer[t * 4 + 1] << 16) | (m_buffer[t * 4 + 2] << 8) | m_buffer[t * 4 + 3];
+    for (int t = 16; t < 80; ++t)
+        w[t] = rotateLeft(1, w[t - 3] ^ w[t - 8] ^ w[t - 14] ^ w[t - 16]);
+
+    uint32_t a = m_hash[0];
+    uint32_t b = m_hash[1];
+    uint32_t c = m_hash[2];
+    uint32_t d = m_hash[3];
+    uint32_t e = m_hash[4];
+
+    for (int t = 0; t < 80; ++t) {
+        uint32_t temp = rotateLeft(5, a) + f(t, b, c, d) + e + w[t] + k(t);
+        e = d;
+        d = c;
+        c = rotateLeft(30, b);
+        b = a;
+        a = temp;
+    }
+
+    m_hash[0] += a;
+    m_hash[1] += b;
+    m_hash[2] += c;
+    m_hash[3] += d;
+    m_hash[4] += e;
+
+    m_cursor = 0;
+}
+
+void SHA1::reset()
+{
+    m_cursor = 0;
+    m_totalBytes = 0;
+    m_hash[0] = 0x67452301;
+    m_hash[1] = 0xefcdab89;
+    m_hash[2] = 0x98badcfe;
+    m_hash[3] = 0x10325476;
+    m_hash[4] = 0xc3d2e1f0;
+
+    // Clear the buffer after use in case it's sensitive.
+    memset(m_buffer, 0, sizeof(m_buffer));
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/SHA1.h b/Source/WTF/wtf/SHA1.h
new file mode 100644
index 0000000..e8cc802
--- /dev/null
+++ b/Source/WTF/wtf/SHA1.h
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ *     * 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.
+ *     * 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_SHA1_h
+#define WTF_SHA1_h
+
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+class SHA1 {
+public:
+    WTF_EXPORT_PRIVATE SHA1();
+
+    void addBytes(const Vector<uint8_t>& input)
+    {
+        addBytes(input.data(), input.size());
+    }
+    WTF_EXPORT_PRIVATE void addBytes(const uint8_t* input, size_t length);
+
+    // computeHash has a side effect of resetting the state of the object.
+    WTF_EXPORT_PRIVATE void computeHash(Vector<uint8_t, 20>&);
+
+private:
+    void finalize();
+    void processBlock();
+    void reset();
+
+    uint8_t m_buffer[64];
+    size_t m_cursor; // Number of bytes filled in m_buffer (0-64).
+    uint64_t m_totalBytes; // Number of bytes added so far.
+    uint32_t m_hash[5];
+};
+
+} // namespace WTF
+
+using WTF::SHA1;
+
+#endif // WTF_SHA1_h
diff --git a/Source/WTF/wtf/SaturatedArithmetic.h b/Source/WTF/wtf/SaturatedArithmetic.h
new file mode 100644
index 0000000..cf9e8e1
--- /dev/null
+++ b/Source/WTF/wtf/SaturatedArithmetic.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2012, 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.
+ *     * 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.
+ *     * 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 SaturatedArithmetic_h
+#define SaturatedArithmetic_h
+
+#include <limits>
+#include <stdint.h>
+#include <stdlib.h>
+
+inline int32_t saturatedAddition(int32_t a, int32_t b)
+{
+    uint32_t ua = a;
+    uint32_t ub = b;
+    uint32_t result = ua + ub;
+
+    // Can only overflow if the signed bit of the two values match. If the signed
+    // bit of the result and one of the values differ it did overflow.
+    if (!((ua ^ ub) >> 31) & (result ^ ua) >> 31)
+        result = std::numeric_limits<int>::max() + (ua >> 31);
+
+    return result;
+}
+
+inline int32_t saturatedSubtraction(int32_t a, int32_t b)
+{
+    uint32_t ua = a;
+    uint32_t ub = b;
+    uint32_t result = ua - ub;
+
+    // Can only overflow if the signed bit of the two values do not match. If the
+    // signed bit of the result and the first value differ it did overflow.
+    if ((ua ^ ub) >> 31 & (result ^ ua) >> 31)
+        result = std::numeric_limits<int>::max() + (ua >> 31);
+
+    return result;
+}
+
+#endif // SaturatedArithmetic_h
diff --git a/Source/WTF/wtf/SegmentedVector.h b/Source/WTF/wtf/SegmentedVector.h
new file mode 100644
index 0000000..63d89d7
--- /dev/null
+++ b/Source/WTF/wtf/SegmentedVector.h
@@ -0,0 +1,263 @@
+/*
+ * Copyright (C) 2008 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef SegmentedVector_h
+#define SegmentedVector_h
+
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+    // An iterator for SegmentedVector. It supports only the pre ++ operator
+    template <typename T, size_t SegmentSize = 8, size_t InlineCapacity = 32> class SegmentedVector;
+    template <typename T, size_t SegmentSize = 8, size_t InlineCapacity = 32> class SegmentedVectorIterator {
+    private:
+        friend class SegmentedVector<T, SegmentSize, InlineCapacity>;
+    public:
+        typedef SegmentedVectorIterator<T, SegmentSize, InlineCapacity> Iterator;
+
+        ~SegmentedVectorIterator() { }
+
+        T& operator*() const { return m_vector.m_segments.at(m_segment)->at(m_index); }
+        T* operator->() const { return &m_vector.m_segments.at(m_segment)->at(m_index); }
+
+        // Only prefix ++ operator supported
+        Iterator& operator++()
+        {
+            ASSERT(m_index != SegmentSize);
+            ++m_index;
+            if (m_index >= m_vector.m_segments.at(m_segment)->size())  {
+                if (m_segment + 1 < m_vector.m_segments.size()) {
+                    ASSERT(m_vector.m_segments.at(m_segment)->size() > 0);
+                    ++m_segment;
+                    m_index = 0;
+                } else {
+                    // Points to the "end" symbol
+                    m_segment = 0;
+                    m_index = SegmentSize;
+                }
+            }
+            return *this;
+        }
+
+        bool operator==(const Iterator& other) const
+        {
+            return m_index == other.m_index && m_segment == other.m_segment && &m_vector == &other.m_vector;
+        }
+
+        bool operator!=(const Iterator& other) const
+        {
+            return m_index != other.m_index || m_segment != other.m_segment || &m_vector != &other.m_vector;
+        }
+
+        SegmentedVectorIterator& operator=(const SegmentedVectorIterator<T, SegmentSize, InlineCapacity>& other)
+        {
+            m_vector = other.m_vector;
+            m_segment = other.m_segment;
+            m_index = other.m_index;
+            return *this;
+        }
+
+    private:
+        SegmentedVectorIterator(SegmentedVector<T, SegmentSize, InlineCapacity>& vector, size_t segment, size_t index)
+            : m_vector(vector)
+            , m_segment(segment)
+            , m_index(index)
+        {
+        }
+
+        SegmentedVector<T, SegmentSize, InlineCapacity>& m_vector;
+        size_t m_segment;
+        size_t m_index;
+    };
+
+    // SegmentedVector is just like Vector, but it doesn't move the values
+    // stored in its buffer when it grows. Therefore, it is safe to keep
+    // pointers into a SegmentedVector. The default tuning values are
+    // optimized for segmented vectors that get large; you may want to use
+    // SegmentedVector<thingy, 1, 0> if you don't expect a lot of entries.
+    template <typename T, size_t SegmentSize, size_t InlineCapacity>
+    class SegmentedVector {
+        friend class SegmentedVectorIterator<T, SegmentSize, InlineCapacity>;
+    public:
+        typedef SegmentedVectorIterator<T, SegmentSize, InlineCapacity> Iterator;
+
+        SegmentedVector()
+            : m_size(0)
+        {
+            m_segments.append(&m_inlineSegment);
+        }
+
+        ~SegmentedVector()
+        {
+            deleteAllSegments();
+        }
+
+        size_t size() const { return m_size; }
+        bool isEmpty() const { return !size(); }
+
+        T& at(size_t index)
+        {
+            if (index < SegmentSize)
+                return m_inlineSegment[index];
+            return segmentFor(index)->at(subscriptFor(index));
+        }
+
+        T& operator[](size_t index)
+        {
+            return at(index);
+        }
+
+        T& last()
+        {
+            return at(size() - 1);
+        }
+
+        template <typename U> void append(const U& value)
+        {
+            ++m_size;
+
+            if (m_size <= SegmentSize) {
+                m_inlineSegment.uncheckedAppend(value);
+                return;
+            }
+
+            if (!segmentExistsFor(m_size - 1))
+                m_segments.append(new Segment);
+            segmentFor(m_size - 1)->uncheckedAppend(value);
+        }
+
+        T& alloc()
+        {
+            append<T>(T());
+            return last();
+        }
+
+        void removeLast()
+        {
+            if (m_size <= SegmentSize)
+                m_inlineSegment.removeLast();
+            else
+                segmentFor(m_size - 1)->removeLast();
+            --m_size;
+        }
+
+        void grow(size_t size)
+        {
+            ASSERT(size > m_size);
+            ensureSegmentsFor(size);
+            m_size = size;
+        }
+
+        void clear()
+        {
+            deleteAllSegments();
+            m_segments.resize(1);
+            m_inlineSegment.clear();
+            m_size = 0;
+        }
+
+        Iterator begin()
+        {
+            return Iterator(*this, 0, m_size ? 0 : SegmentSize);
+        }
+
+        Iterator end()
+        {
+            return Iterator(*this, 0, SegmentSize);
+        }
+        
+        void shrinkToFit()
+        {
+            m_segments.shrinkToFit();
+        }
+
+    private:
+        typedef Vector<T, SegmentSize> Segment;
+
+        void deleteAllSegments()
+        {
+            // Skip the first segment, because it's our inline segment, which was
+            // not created by new.
+            for (size_t i = 1; i < m_segments.size(); i++)
+                delete m_segments[i];
+        }
+
+        bool segmentExistsFor(size_t index)
+        {
+            return index / SegmentSize < m_segments.size();
+        }
+
+        Segment* segmentFor(size_t index)
+        {
+            return m_segments[index / SegmentSize];
+        }
+
+        size_t subscriptFor(size_t index)
+        {
+            return index % SegmentSize;
+        }
+
+        void ensureSegmentsFor(size_t size)
+        {
+            size_t segmentCount = m_size / SegmentSize;
+            if (m_size % SegmentSize)
+                ++segmentCount;
+            segmentCount = std::max<size_t>(segmentCount, 1); // We always have at least our inline segment.
+
+            size_t neededSegmentCount = size / SegmentSize;
+            if (size % SegmentSize)
+                ++neededSegmentCount;
+
+            // Fill up to N - 1 segments.
+            size_t end = neededSegmentCount - 1;
+            for (size_t i = segmentCount - 1; i < end; ++i)
+                ensureSegment(i, SegmentSize);
+
+            // Grow segment N to accomodate the remainder.
+            ensureSegment(end, subscriptFor(size - 1) + 1);
+        }
+
+        void ensureSegment(size_t segmentIndex, size_t size)
+        {
+            ASSERT(segmentIndex <= m_segments.size());
+            if (segmentIndex == m_segments.size())
+                m_segments.append(new Segment);
+            m_segments[segmentIndex]->grow(size);
+        }
+
+        size_t m_size;
+        Segment m_inlineSegment;
+        Vector<Segment*, InlineCapacity> m_segments;
+    };
+
+} // namespace WTF
+
+using WTF::SegmentedVector;
+
+#endif // SegmentedVector_h
diff --git a/Source/WTF/wtf/SentinelLinkedList.h b/Source/WTF/wtf/SentinelLinkedList.h
new file mode 100644
index 0000000..3943aa5
--- /dev/null
+++ b/Source/WTF/wtf/SentinelLinkedList.h
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+//    A SentinelLinkedList is a linked list with dummy head and tail sentinels,
+//    which allow for branch-less insertion and removal, and removal without a
+//    pointer to the list.
+//    
+//    Requires: Node is a concrete class with:
+//        Node(SentinelTag);
+//        void setPrev(Node*);
+//        Node* prev();
+//        void setNext(Node*);
+//        Node* next();
+
+#ifndef SentinelLinkedList_h
+#define SentinelLinkedList_h
+
+namespace WTF {
+
+enum SentinelTag { Sentinel };
+
+template<typename T>
+class BasicRawSentinelNode {
+public:
+    BasicRawSentinelNode(SentinelTag)
+        : m_next(0)
+        , m_prev(0)
+    {
+    }
+    
+    BasicRawSentinelNode()
+        : m_next(0)
+        , m_prev(0)
+    {
+    }
+    
+    void setPrev(BasicRawSentinelNode* prev) { m_prev = prev; }
+    void setNext(BasicRawSentinelNode* next) { m_next = next; }
+    
+    T* prev() { return static_cast<T*>(m_prev); }
+    T* next() { return static_cast<T*>(m_next); }
+    
+    bool isOnList() const
+    {
+        ASSERT(!!m_prev == !!m_next);
+        return !!m_prev;
+    }
+    
+    void remove();
+    
+private:
+    BasicRawSentinelNode* m_next;
+    BasicRawSentinelNode* m_prev;
+};
+
+template <typename T, typename RawNode = T> class SentinelLinkedList {
+public:
+    typedef T* iterator;
+
+    SentinelLinkedList();
+
+    void push(T*);
+    static void remove(T*);
+
+    iterator begin();
+    iterator end();
+    
+    bool isEmpty() { return begin() == end(); }
+
+private:
+    RawNode m_headSentinel;
+    RawNode m_tailSentinel;
+};
+
+template <typename T> void BasicRawSentinelNode<T>::remove()
+{
+    SentinelLinkedList<T, BasicRawSentinelNode<T> >::remove(static_cast<T*>(this));
+}
+
+template <typename T, typename RawNode> inline SentinelLinkedList<T, RawNode>::SentinelLinkedList()
+    : m_headSentinel(Sentinel)
+    , m_tailSentinel(Sentinel)
+{
+    m_headSentinel.setNext(&m_tailSentinel);
+    m_headSentinel.setPrev(0);
+
+    m_tailSentinel.setPrev(&m_headSentinel);
+    m_tailSentinel.setNext(0);
+}
+
+template <typename T, typename RawNode> inline typename SentinelLinkedList<T, RawNode>::iterator SentinelLinkedList<T, RawNode>::begin()
+{
+    return static_cast<T*>(m_headSentinel.next());
+}
+
+template <typename T, typename RawNode> inline typename SentinelLinkedList<T, RawNode>::iterator SentinelLinkedList<T, RawNode>::end()
+{
+    return static_cast<T*>(&m_tailSentinel);
+}
+
+template <typename T, typename RawNode> inline void SentinelLinkedList<T, RawNode>::push(T* node)
+{
+    ASSERT(node);
+    ASSERT(!node->prev());
+    ASSERT(!node->next());
+    
+    RawNode* prev = &m_headSentinel;
+    RawNode* next = m_headSentinel.next();
+
+    node->setPrev(prev);
+    node->setNext(next);
+
+    prev->setNext(node);
+    next->setPrev(node);
+}
+
+template <typename T, typename RawNode> inline void SentinelLinkedList<T, RawNode>::remove(T* node)
+{
+    ASSERT(node);
+    ASSERT(!!node->prev());
+    ASSERT(!!node->next());
+    
+    RawNode* prev = node->prev();
+    RawNode* next = node->next();
+
+    prev->setNext(next);
+    next->setPrev(prev);
+    
+    node->setPrev(0);
+    node->setNext(0);
+}
+
+}
+
+using WTF::BasicRawSentinelNode;
+using WTF::SentinelLinkedList;
+
+#endif
+
diff --git a/Source/WTF/wtf/SimpleStats.h b/Source/WTF/wtf/SimpleStats.h
new file mode 100644
index 0000000..45a8958
--- /dev/null
+++ b/Source/WTF/wtf/SimpleStats.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2012 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. ``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
+ * 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 SimpleStats_h
+#define SimpleStats_h
+
+#include <wtf/MathExtras.h>
+#include <wtf/StdLibExtras.h>
+
+namespace WTF {
+
+// Simple and cheap way of tracking statistics if you're not worried about chopping on
+// the sum of squares (i.e. the sum of squares is unlikely to exceed 2^52).
+class SimpleStats {
+public:
+    SimpleStats()
+        : m_count(0)
+        , m_sum(0)
+        , m_sumOfSquares(0)
+    {
+    }
+    
+    void add(double value)
+    {
+        m_count++;
+        m_sum += value;
+        m_sumOfSquares += value * value;
+    }
+    
+    bool operator!() const
+    {
+        return !m_count;
+    }
+    
+    double count() const
+    {
+        return m_count;
+    }
+    
+    double sum() const
+    {
+        return m_sum;
+    }
+    
+    double sumOfSquares() const
+    {
+        return m_sumOfSquares;
+    }
+    
+    double mean() const
+    {
+        return m_sum / m_count;
+    }
+    
+    // NB. This gives a biased variance as it divides by the number of samples rather
+    // than the degrees of freedom. This is fine once the count grows large, which in
+    // our case will happen rather quickly.
+    double variance() const
+    {
+        if (m_count < 2)
+            return 0;
+        
+        // Compute <x^2> - <x>^2
+        double secondMoment = m_sumOfSquares / m_count;
+        double firstMoment = m_sum / m_count;
+        
+        double result = secondMoment - firstMoment * firstMoment;
+        
+        // It's possible to get -epsilon. Protect against this and turn it into
+        // +0.
+        if (result <= 0)
+            return 0;
+        
+        return result;
+    }
+    
+    // NB. This gives a biased standard deviation. See above.
+    double standardDeviation() const
+    {
+        return sqrt(variance());
+    }
+    
+private:
+    double m_count;
+    double m_sum;
+    double m_sumOfSquares;
+};
+
+} // namespace WTF
+
+#endif // SimpleStats_h
+
diff --git a/Source/WTF/wtf/SinglyLinkedList.h b/Source/WTF/wtf/SinglyLinkedList.h
new file mode 100644
index 0000000..c00bf36
--- /dev/null
+++ b/Source/WTF/wtf/SinglyLinkedList.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+#ifndef SinglyLinkedList_h
+#define SinglyLinkedList_h
+
+namespace WTF {
+
+template <typename Node> class SinglyLinkedList {
+public:
+    SinglyLinkedList();
+    
+    bool isEmpty();
+
+    void push(Node*);
+    Node* pop();
+
+private:
+    Node* m_head;
+};
+
+template <typename Node> inline SinglyLinkedList<Node>::SinglyLinkedList()
+    : m_head(0)
+{
+}
+
+template <typename Node> inline bool SinglyLinkedList<Node>::isEmpty()
+{
+    return !m_head;
+}
+
+template <typename Node> inline void SinglyLinkedList<Node>::push(Node* node)
+{
+    ASSERT(node);
+    node->setNext(m_head);
+    m_head = node;
+}
+
+template <typename Node> inline Node* SinglyLinkedList<Node>::pop()
+{
+    Node* tmp = m_head;
+    m_head = m_head->next();
+    return tmp;
+}
+
+}
+
+using WTF::SinglyLinkedList;
+
+#endif
diff --git a/Source/WTF/wtf/SizeLimits.cpp b/Source/WTF/wtf/SizeLimits.cpp
new file mode 100644
index 0000000..95d9c2b
--- /dev/null
+++ b/Source/WTF/wtf/SizeLimits.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2010 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.
+ *     * 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.
+ *     * 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 <wtf/Assertions.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/ThreadRestrictionVerifier.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+#ifndef NDEBUG
+struct SameSizeAsRefCounted {
+    int a;
+    bool b;
+    bool c;
+    ThreadRestrictionVerifier d;
+    // The debug version may get bigger.
+};
+#else
+struct SameSizeAsRefCounted {
+    int a;
+    // Don't add anything here because this should stay small.
+};
+#endif
+
+COMPILE_ASSERT(sizeof(OwnPtr<int>) == sizeof(int*), OwnPtr_should_stay_small);
+COMPILE_ASSERT(sizeof(PassRefPtr<RefCounted<int> >) == sizeof(int*), PassRefPtr_should_stay_small);
+COMPILE_ASSERT(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), RefCounted_should_stay_small);
+COMPILE_ASSERT(sizeof(RefCountedCustomAllocated<int>) == sizeof(SameSizeAsRefCounted), RefCountedCustomAllocated_should_stay_small);
+COMPILE_ASSERT(sizeof(RefPtr<RefCounted<int> >) == sizeof(int*), RefPtr_should_stay_small);
+COMPILE_ASSERT(sizeof(Vector<int>) == 3 * sizeof(int*), Vector_should_stay_small);
+
+}
diff --git a/Source/WTF/wtf/Spectrum.h b/Source/WTF/wtf/Spectrum.h
new file mode 100644
index 0000000..3e6fa4a
--- /dev/null
+++ b/Source/WTF/wtf/Spectrum.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2011 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. ``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
+ * 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 Spectrum_h
+#define Spectrum_h
+
+#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
+#include <algorithm>
+
+namespace WTF {
+
+template<typename T>
+class Spectrum {
+public:
+    typedef typename HashMap<T, unsigned long>::iterator iterator;
+    typedef typename HashMap<T, unsigned long>::const_iterator const_iterator;
+    
+    Spectrum() { }
+    
+    void add(const T& key, unsigned long count = 1)
+    {
+        typename HashMap<T, unsigned long>::AddResult result = m_map.add(key, count);
+        if (!result.isNewEntry)
+            result.iterator->value += count;
+    }
+    
+    unsigned long get(const T& key) const
+    {
+        const_iterator iter = m_map.find(key);
+        if (iter == m_map.end())
+            return 0;
+        return iter->value;
+    }
+    
+    iterator begin() { return m_map.begin(); }
+    iterator end() { return m_map.end(); }
+    const_iterator begin() const { return m_map.begin(); }
+    const_iterator end() const { return m_map.end(); }
+    
+    struct KeyAndCount {
+        KeyAndCount() { }
+        
+        KeyAndCount(const T& key, unsigned long count)
+            : key(key)
+            , count(count)
+        {
+        }
+        
+        bool operator<(const KeyAndCount& other) const
+        {
+            if (count != other.count)
+                return count < other.count;
+            // This causes lower-ordered keys being returned first; this is really just
+            // here to make sure that the order is somewhat deterministic rather than being
+            // determined by hashing.
+            return key > other.key;
+        }
+
+        T key;
+        unsigned long count;
+    };
+    
+    // Returns a list ordered from lowest-count to highest-count.
+    Vector<KeyAndCount> buildList() const
+    {
+        Vector<KeyAndCount> list;
+        for (const_iterator iter = begin(); iter != end(); ++iter)
+            list.append(KeyAndCount(iter->key, iter->value));
+        
+        std::sort(list.begin(), list.end());
+        return list;
+    }
+    
+private:
+    HashMap<T, unsigned long> m_map;
+};
+
+} // namespace WTF
+
+using WTF::Spectrum;
+
+#endif // Spectrum_h
diff --git a/Source/WTF/wtf/StackBounds.cpp b/Source/WTF/wtf/StackBounds.cpp
new file mode 100644
index 0000000..a272ce3
--- /dev/null
+++ b/Source/WTF/wtf/StackBounds.cpp
@@ -0,0 +1,261 @@
+/*
+ *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ *  Copyright (C) 2007 Eric Seidel <eric@webkit.org>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#include "config.h"
+#include "StackBounds.h"
+
+#if OS(DARWIN)
+
+#include <mach/task.h>
+#include <mach/thread_act.h>
+#include <pthread.h>
+
+#elif OS(WINDOWS)
+
+#include <windows.h>
+
+#elif OS(SOLARIS)
+
+#include <thread.h>
+
+#elif OS(QNX)
+
+#include <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/procfs.h>
+
+#elif OS(UNIX)
+
+#include <pthread.h>
+#if HAVE(PTHREAD_NP_H)
+#include <pthread_np.h>
+#endif
+
+#endif
+
+namespace WTF {
+
+// Bug 26276 - Need a mechanism to determine stack extent
+//
+// These platforms should now be working correctly:
+//     DARWIN, QNX, UNIX
+// These platforms are not:
+//     WINDOWS, SOLARIS, OPENBSD, WINCE
+//
+// FIXME: remove this! - this code unsafely guesses at stack sizes!
+#if OS(WINDOWS) || OS(SOLARIS) || OS(OPENBSD)
+// Based on the current limit used by the JSC parser, guess the stack size.
+static const ptrdiff_t estimatedStackSize = 128 * sizeof(void*) * 1024;
+// This method assumes the stack is growing downwards.
+static void* estimateStackBound(void* origin)
+{
+    return static_cast<char*>(origin) - estimatedStackSize;
+}
+#endif
+
+#if OS(DARWIN)
+
+void StackBounds::initialize()
+{
+    pthread_t thread = pthread_self();
+    m_origin = pthread_get_stackaddr_np(thread);
+    m_bound = static_cast<char*>(m_origin) - pthread_get_stacksize_np(thread);
+}
+
+#elif OS(QNX)
+
+void StackBounds::initialize()
+{
+    void* stackBase = 0;
+    size_t stackSize = 0;
+
+    struct _debug_thread_info threadInfo;
+    memset(&threadInfo, 0, sizeof(threadInfo));
+    threadInfo.tid = pthread_self();
+    int fd = open("/proc/self", O_RDONLY);
+    if (fd == -1) {
+        LOG_ERROR("Unable to open /proc/self (errno: %d)", errno);
+        CRASH();
+    }
+    devctl(fd, DCMD_PROC_TIDSTATUS, &threadInfo, sizeof(threadInfo), 0);
+    close(fd);
+    stackBase = reinterpret_cast<void*>(threadInfo.stkbase);
+    stackSize = threadInfo.stksize;
+    ASSERT(stackBase);
+
+    m_bound = static_cast<char*>(stackBase) + 0x1000; // 4kb guard page
+    m_origin = static_cast<char*>(stackBase) + stackSize;
+}
+
+#elif OS(SOLARIS)
+
+void StackBounds::initialize()
+{
+    stack_t s;
+    thr_stksegment(&s);
+    m_origin = s.ss_sp;
+    m_bound = estimateStackBound(m_origin);
+}
+
+#elif OS(OPENBSD)
+
+void StackBounds::initialize()
+{
+    pthread_t thread = pthread_self();
+    stack_t stack;
+    pthread_stackseg_np(thread, &stack);
+    m_origin = stack.ss_sp;
+    m_bound = estimateStackBound(m_origin);
+}
+
+#elif OS(UNIX)
+
+void StackBounds::initialize()
+{
+    void* stackBase = 0;
+    size_t stackSize = 0;
+
+    pthread_t thread = pthread_self();
+    pthread_attr_t sattr;
+    pthread_attr_init(&sattr);
+#if HAVE(PTHREAD_NP_H) || OS(NETBSD)
+    // e.g. on FreeBSD 5.4, neundorf@kde.org
+    pthread_attr_get_np(thread, &sattr);
+#else
+    // FIXME: this function is non-portable; other POSIX systems may have different np alternatives
+    pthread_getattr_np(thread, &sattr);
+#endif
+    int rc = pthread_attr_getstack(&sattr, &stackBase, &stackSize);
+    (void)rc; // FIXME: Deal with error code somehow? Seems fatal.
+    ASSERT(stackBase);
+    pthread_attr_destroy(&sattr);
+    m_bound = stackBase;
+    m_origin = static_cast<char*>(stackBase) + stackSize;
+}
+
+#elif OS(WINCE)
+
+static bool detectGrowingDownward(void* previousFrame)
+{
+    // Find the address of this stack frame by taking the address of a local variable.
+    int thisFrame;
+    return previousFrame > &thisFrame;
+}
+
+static inline bool isPageWritable(void* page)
+{
+    MEMORY_BASIC_INFORMATION memoryInformation;
+    DWORD result = VirtualQuery(page, &memoryInformation, sizeof(memoryInformation));
+
+    // return false on error, including ptr outside memory
+    if (result != sizeof(memoryInformation))
+        return false;
+
+    DWORD protect = memoryInformation.Protect & ~(PAGE_GUARD | PAGE_NOCACHE);
+    return protect == PAGE_READWRITE
+        || protect == PAGE_WRITECOPY
+        || protect == PAGE_EXECUTE_READWRITE
+        || protect == PAGE_EXECUTE_WRITECOPY;
+}
+
+static inline void* getLowerStackBound(char* currentPage, DWORD pageSize)
+{
+    while (currentPage > 0) {
+        // check for underflow
+        if (currentPage >= reinterpret_cast<char*>(pageSize))
+            currentPage -= pageSize;
+        else
+            currentPage = 0;
+
+        if (!isPageWritable(currentPage))
+            return currentPage + pageSize;
+    }
+
+    return 0;
+}
+
+static inline void* getUpperStackBound(char* currentPage, DWORD pageSize)
+{
+    do {
+        // guaranteed to complete because isPageWritable returns false at end of memory
+        currentPage += pageSize;
+    } while (isPageWritable(currentPage));
+
+    return currentPage - pageSize;
+}
+
+void StackBounds::initialize()
+{
+    // find the address of this stack frame by taking the address of a local variable
+    void* thisFrame = &thisFrame;
+    bool isGrowingDownward = detectGrowingDownward(thisFrame);
+
+    SYSTEM_INFO systemInfo;
+    GetSystemInfo(&systemInfo);
+    DWORD pageSize = systemInfo.dwPageSize;
+
+    // scan all of memory starting from this frame, and return the last writeable page found
+    char* currentPage = reinterpret_cast<char*>(reinterpret_cast<DWORD>(thisFrame) & ~(pageSize - 1));
+    void* lowerStackBound = getLowerStackBound(currentPage, pageSize);
+    void* upperStackBound = getUpperStackBound(currentPage, pageSize);
+
+    m_origin = isGrowingDownward ? upperStackBound : lowerStackBound;
+    m_bound = isGrowingDownward ? lowerStackBound : upperStackBound;
+}
+
+#elif OS(WINDOWS)
+
+void StackBounds::initialize()
+{
+#if CPU(X86) && COMPILER(MSVC)
+    // offset 0x18 from the FS segment register gives a pointer to
+    // the thread information block for the current thread
+    NT_TIB* pTib;
+    __asm {
+        MOV EAX, FS:[18h]
+        MOV pTib, EAX
+    }
+    m_origin = static_cast<void*>(pTib->StackBase);
+#elif CPU(X86) && COMPILER(GCC)
+    // offset 0x18 from the FS segment register gives a pointer to
+    // the thread information block for the current thread
+    NT_TIB* pTib;
+    asm ( "movl %%fs:0x18, %0\n"
+          : "=r" (pTib)
+        );
+    m_origin = static_cast<void*>(pTib->StackBase);
+#elif CPU(X86_64)
+    PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb());
+    m_origin = reinterpret_cast<void*>(pTib->StackBase);
+#else
+#error Need a way to get the stack bounds on this platform (Windows)
+#endif
+    // Looks like we should be able to get pTib->StackLimit
+    m_bound = estimateStackBound(m_origin);
+}
+
+#else
+#error Need a way to get the stack bounds on this platform
+#endif
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/StackBounds.h b/Source/WTF/wtf/StackBounds.h
new file mode 100644
index 0000000..185afec
--- /dev/null
+++ b/Source/WTF/wtf/StackBounds.h
@@ -0,0 +1,129 @@
+/*
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 StackBounds_h
+#define StackBounds_h
+
+namespace WTF {
+
+class StackBounds {
+    // isSafeToRecurse() / recursionLimit() tests (by default)
+    // that we are at least this far from the end of the stack.
+    //
+    // This 64k number was picked because a sampling of stack usage differences
+    // between consecutive entries into one of the Interpreter::execute...()
+    // functions was seen to be as high as 27k. Hence, 64k is chosen as a
+    // conservative availability value that is not too large but comfortably
+    // exceeds 27k with some buffer for error.
+    const static size_t s_defaultAvailabilityDelta = 64 * 1024;
+
+public:
+    StackBounds()
+        : m_origin(0)
+        , m_bound(0)
+    {
+    }
+
+    static StackBounds currentThreadStackBounds()
+    {
+        StackBounds bounds;
+        bounds.initialize();
+        bounds.checkConsistency();
+        return bounds;
+    }
+
+    void* origin() const
+    {
+        ASSERT(m_origin);
+        return m_origin;
+    }
+
+    void* current() const
+    {
+        checkConsistency();
+        void* currentPosition = &currentPosition;
+        return currentPosition;
+    }
+
+    size_t size() const
+    {
+        return isGrowingDownward()
+            ? static_cast<char*>(m_origin) - static_cast<char*>(m_bound)
+            : static_cast<char*>(m_bound) - static_cast<char*>(m_origin);
+    }
+
+    void* recursionLimit(size_t minAvailableDelta = s_defaultAvailabilityDelta) const
+    {
+        checkConsistency();
+        return isGrowingDownward()
+            ? static_cast<char*>(m_bound) + minAvailableDelta
+            : static_cast<char*>(m_bound) - minAvailableDelta;
+    }
+
+    bool isSafeToRecurse(size_t minAvailableDelta = s_defaultAvailabilityDelta) const
+    {
+        checkConsistency();
+        return isGrowingDownward()
+            ? current() >= recursionLimit(minAvailableDelta)
+            : current() <= recursionLimit(minAvailableDelta);
+    }
+
+private:
+    void initialize();
+
+
+    bool isGrowingDownward() const
+    {
+        ASSERT(m_origin && m_bound);
+#if OS(WINCE)
+        return m_origin > m_bound;
+#else
+        return true;
+#endif
+    }
+
+    void checkConsistency() const
+    {
+#if !ASSERT_DISABLED
+        void* currentPosition = &currentPosition;
+        ASSERT(m_origin != m_bound);
+        ASSERT(isGrowingDownward()
+            ? (currentPosition < m_origin && currentPosition > m_bound)
+            : (currentPosition > m_origin && currentPosition < m_bound));
+#endif
+    }
+
+    void* m_origin;
+    void* m_bound;
+
+    friend class StackStats;
+};
+
+} // namespace WTF
+
+using WTF::StackBounds;
+
+#endif
diff --git a/Source/WTF/wtf/StackStats.cpp b/Source/WTF/wtf/StackStats.cpp
new file mode 100644
index 0000000..0bc11ed
--- /dev/null
+++ b/Source/WTF/wtf/StackStats.cpp
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2012 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. ``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
+ * 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 "StackStats.h"
+
+#if ENABLE(STACK_STATS) 
+
+#include "Assertions.h"
+#include "DataLog.h"
+#include "WTFThreadData.h"
+
+// Define the following flag if you want to collect stats on every single
+// checkpoint. By default, we only log checkpoints that establish new
+// max values.
+
+// #define ENABLE_VERBOSE_STACK_STATS 1
+
+
+namespace WTF {
+
+// CheckPoint management:
+Mutex* StackStats::s_sharedLock = 0;
+StackStats::CheckPoint* StackStats::s_topCheckPoint = 0;
+StackStats::LayoutCheckPoint* StackStats::s_firstLayoutCheckPoint = 0;
+StackStats::LayoutCheckPoint* StackStats::s_topLayoutCheckPoint = 0;
+
+// High watermark stats:
+int StackStats::s_maxCheckPointDiff = 0;
+int StackStats::s_maxStackHeight = 0;
+int StackStats::s_maxReentryDepth = 0;
+
+int StackStats::s_maxLayoutCheckPointDiff = 0;
+int StackStats::s_maxTotalLayoutCheckPointDiff = 0;
+int StackStats::s_maxLayoutReentryDepth = 0;
+
+
+// Initializes locks and the log. Should only be called once.
+void StackStats::initialize()
+{
+    s_sharedLock = new Mutex();
+    dataLog(" === LOG new stack stats ========\n");
+}
+
+StackStats::PerThreadStats::PerThreadStats()
+{
+    const StackBounds& stack = wtfThreadData().stack();
+    m_reentryDepth = 0;
+    m_stackStart = (char*)stack.origin();
+    m_currentCheckPoint = 0;
+
+    dataLog(" === THREAD new stackStart %p ========\n", m_stackStart);
+}
+
+StackStats::CheckPoint::CheckPoint()
+{
+    MutexLocker locker(*StackStats::s_sharedLock);
+    WTFThreadData* threadData = const_cast<WTFThreadData*>(&wtfThreadData());
+    StackStats::PerThreadStats& t = threadData->stackStats();
+    const StackBounds& stack = threadData->stack();
+
+    bool isGrowingDownward = stack.isGrowingDownward();
+    bool needToLog = false;
+    char* current = reinterpret_cast<char*>(this);
+    char* last = reinterpret_cast<char*>(t.m_currentCheckPoint);
+
+    // If there was no previous checkpoint, measure from the start of the stack:
+    if (!last)
+        last = t.m_stackStart;
+
+    // Update the reentry depth stats:
+    t.m_reentryDepth++;
+    if (t.m_reentryDepth > StackStats::s_maxReentryDepth) {
+        StackStats::s_maxReentryDepth = t.m_reentryDepth;
+        needToLog = true;
+    }
+
+    // Update the stack height stats:
+    int height = t.m_stackStart - current;
+    if (!isGrowingDownward)
+        height = -height;
+    if (height > StackStats::s_maxStackHeight) {
+        StackStats::s_maxStackHeight = height;
+        needToLog = true;
+    }
+
+    // Update the checkpoint diff stats:
+    int diff = last - current;
+    if (!isGrowingDownward)
+        diff = -diff;
+    if (diff > StackStats::s_maxCheckPointDiff) {
+        StackStats::s_maxCheckPointDiff = diff;
+        needToLog = true;
+    }
+
+    // Push this checkpoint:
+    m_prev = t.m_currentCheckPoint;
+    t.m_currentCheckPoint = this;
+
+#if ENABLE(VERBOSE_STACK_STATS)
+    needToLog = true; // always log.
+#endif
+
+    // Log this checkpoint if needed:
+    if (needToLog)
+        dataLog(" CHECKPOINT %p diff %d/%.1fk/max %.1fk | reentry %d/max %d | height %.1fk/max %.1fk | stack %p size %.1fk\n",
+            this, diff, diff / 1024.0, StackStats::s_maxCheckPointDiff / 1024.0,
+            t.m_reentryDepth, StackStats::s_maxReentryDepth,
+            height / 1024.0, StackStats::s_maxStackHeight / 1024.0,
+            stack.origin(), stack.size() / 1024.0);
+}
+
+StackStats::CheckPoint::~CheckPoint()
+{
+    MutexLocker locker(*StackStats::s_sharedLock);
+    WTFThreadData* threadData = const_cast<WTFThreadData*>(&wtfThreadData());
+    StackStats::PerThreadStats& t = threadData->stackStats();
+
+    // Pop to previous checkpoint:
+    t.m_currentCheckPoint = m_prev;
+    --t.m_reentryDepth;
+
+    // Log this checkpoint if needed:
+#if ENABLE(VERBOSE_STACK_STATS)
+    if (!m_prev) {
+        const StackBounds& stack = threadData->stack();
+        bool isGrowingDownward = stack.isGrowingDownward();
+
+        char* current = reinterpret_cast<char*>(this);
+        int height = t.m_stackStart - current;
+
+        if (!isGrowingDownward)
+            height = -height;
+
+        dataLog(" POP to %p diff max %.1fk | reentry %d/%d max | height %.1fk/max %.1fk | stack %p size %.1fk)\n",
+            this, StackStats::s_maxCheckPointDiff / 1024.0,
+            t.m_reentryDepth, StackStats::s_maxReentryDepth,
+            height / 1024.0, StackStats::s_maxStackHeight / 1024.0,
+            stack.origin(), stack.size() / 1024.0);
+    }
+#endif
+}
+
+void StackStats::probe()
+{
+    MutexLocker locker(*StackStats::s_sharedLock);
+    WTFThreadData* threadData = const_cast<WTFThreadData*>(&wtfThreadData());
+    StackStats::PerThreadStats& t = threadData->stackStats();
+    const StackBounds& stack = threadData->stack();
+
+    bool isGrowingDownward = stack.isGrowingDownward();
+
+    bool needToLog = false;
+
+    int dummy;
+    char* current = reinterpret_cast<char*>(&dummy);
+    char* last = reinterpret_cast<char*>(t.m_currentCheckPoint);
+
+    // If there was no previous checkpoint, measure from the start of the stack:
+    if (!last)
+        last = t.m_stackStart;
+
+    // We did not reach another checkpoint yet. Hence, we do not touch the
+    // reentry stats.
+
+    // Update the stack height stats:
+    int height = t.m_stackStart - current;
+    if (!isGrowingDownward)
+        height = -height;
+    if (height > StackStats::s_maxStackHeight) {
+        StackStats::s_maxStackHeight = height;
+        needToLog = true;
+    }
+
+    // Update the checkpoint diff stats:
+    int diff = last - current;
+    if (!isGrowingDownward)
+        diff = -diff;
+    if (diff > StackStats::s_maxCheckPointDiff) {
+        StackStats::s_maxCheckPointDiff = diff;
+        needToLog = true;
+    }
+
+#if ENABLE(VERBOSE_STACK_STATS)
+    needToLog = true; // always log.
+#endif
+
+    if (needToLog)
+        dataLog(" PROBE %p diff %d/%.1fk/max %.1fk | reentry %d/max %d | height %.1fk/max %.1fk | stack %p size %.1fk\n",
+            current, diff, diff / 1024.0, StackStats::s_maxCheckPointDiff / 1024.0,
+            t.m_reentryDepth, StackStats::s_maxReentryDepth,
+            height / 1024.0, StackStats::s_maxStackHeight / 1024.0,
+            stack.origin(), stack.size() / 1024.0);
+}
+
+StackStats::LayoutCheckPoint::LayoutCheckPoint()
+{
+    // While a layout checkpoint is not necessarily a checkpoint where we
+    // we will do a recursion check, it is a convenient spot for doing a
+    // probe to measure the height of stack usage.
+    //
+    // We'll do this probe before we commence with the layout checkpoint.
+    // This is because the probe also locks the sharedLock. By calling the
+    // probe first, we can avoid re-entering the lock.
+    StackStats::probe();
+
+    MutexLocker locker(*StackStats::s_sharedLock);
+    WTFThreadData* threadData = const_cast<WTFThreadData*>(&wtfThreadData());
+    StackStats::PerThreadStats& t = threadData->stackStats();
+    const StackBounds& stack = threadData->stack();
+
+    bool isGrowingDownward = stack.isGrowingDownward();
+
+    // Push this checkpoint:
+    m_prev = StackStats::s_topLayoutCheckPoint;
+    if (m_prev)
+        m_depth = m_prev->m_depth + 1;
+    else {
+        StackStats::s_firstLayoutCheckPoint = this;
+        m_depth = 0;
+    }
+    StackStats::s_topLayoutCheckPoint = this;
+
+    // 
+    char* current = reinterpret_cast<char*>(this);
+    char* last = reinterpret_cast<char*>(m_prev);
+    char* root = reinterpret_cast<char*>(StackStats::s_firstLayoutCheckPoint);
+    bool needToLog = false;
+
+    int diff = last - current;
+    if (!last)
+        diff = 0;
+    int totalDiff = root - current;
+    if (!root)
+        totalDiff = 0;
+
+    // Update the stack height stats:
+    int height = t.m_stackStart - current;
+    if (!isGrowingDownward)
+        height = -height;
+    if (height > StackStats::s_maxStackHeight) {
+        StackStats::s_maxStackHeight = height;
+        needToLog = true;
+    }
+
+    // Update the layout checkpoint diff stats:
+    if (!isGrowingDownward)
+        diff = -diff;
+    if (diff > StackStats::s_maxLayoutCheckPointDiff) {
+        StackStats::s_maxLayoutCheckPointDiff = diff;
+        needToLog = true;
+    }
+
+    // Update the total layout checkpoint diff stats:
+    if (!isGrowingDownward)
+        totalDiff = -totalDiff;
+    if (totalDiff > StackStats::s_maxTotalLayoutCheckPointDiff) {
+        StackStats::s_maxTotalLayoutCheckPointDiff = totalDiff;
+        needToLog = true;
+    }
+
+#if ENABLE(VERBOSE_STACK_STATS)
+    needToLog = true; // always log.
+#endif
+
+    if (needToLog)
+        dataLog(" LAYOUT %p diff %d/%.1fk/max %.1fk | reentry %d/max %d | height %.1fk/max %.1fk | stack %p size %.1fk\n",
+            current, diff, diff / 1024.0, StackStats::s_maxLayoutCheckPointDiff / 1024.0,
+            m_depth, StackStats::s_maxLayoutReentryDepth,
+            totalDiff / 1024.0, StackStats::s_maxTotalLayoutCheckPointDiff / 1024.0,
+            stack.origin(), stack.size() / 1024.0);
+}
+
+StackStats::LayoutCheckPoint::~LayoutCheckPoint()
+{
+    MutexLocker locker(*StackStats::s_sharedLock);
+
+    // Pop to the previous layout checkpoint:
+    StackStats::s_topLayoutCheckPoint = m_prev;
+    if (!m_depth)
+        StackStats::s_firstLayoutCheckPoint = 0;
+}
+
+} // namespace WTF
+
+#endif // ENABLE(STACK_STATS)
+
diff --git a/Source/WTF/wtf/StackStats.h b/Source/WTF/wtf/StackStats.h
new file mode 100644
index 0000000..2635679
--- /dev/null
+++ b/Source/WTF/wtf/StackStats.h
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2012 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. ``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
+ * 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 StackStats_h
+#define StackStats_h
+
+#include "ExportMacros.h"
+#include "ThreadingPrimitives.h"
+
+
+// Define this flag to enable Stack stats collection. This feature is useful
+// for getting a sample of native stack usage sizes.
+//
+// Enabling this will cause stats to be collected and written to a log file at
+// various  instrumented points in the code. It will result in noticeable
+// performance loss. Hence, this should only be enable when you want to do
+// some stats location in your local build. This code is provided here as a
+// convenience for collecting that data. It is not meant to be enabled by
+// default on release or debug builds.
+
+// #define ENABLE_STACK_STATS 1
+
+
+namespace WTF {
+
+#if !ENABLE(STACK_STATS) 
+
+class StackStats {
+public:
+    // The CheckPoint class is for marking check points corresponding
+    // each location in code where a stack recursion check is being done.
+
+    class CheckPoint {
+    public:
+        CheckPoint() { }
+    };
+
+    class PerThreadStats {
+    public:
+        PerThreadStats() { }
+    };
+
+    class LayoutCheckPoint {
+    public:
+        LayoutCheckPoint() { }
+    };
+
+    static void initialize() { }
+    static void probe() { }
+};
+
+#else // ENABLE(STACK_STATS)
+
+class StackStats {
+public:
+    // The CheckPoint class is for marking check points corresponding
+    // each location in code where a stack recursion check is being done.
+
+    class CheckPoint {
+    public:
+        CheckPoint();
+        ~CheckPoint();
+    private:
+        CheckPoint* m_prev;
+    };
+
+    class PerThreadStats {
+    public:
+        PerThreadStats();
+
+    private:
+        int m_reentryDepth;
+        char* m_stackStart;
+        CheckPoint* m_currentCheckPoint;
+
+        friend class CheckPoint;
+        friend class StackStats;
+    };
+
+    class LayoutCheckPoint {
+    public:
+        WTF_EXPORT_PRIVATE LayoutCheckPoint();
+        WTF_EXPORT_PRIVATE ~LayoutCheckPoint();
+
+    private:
+        LayoutCheckPoint* m_prev;
+        int m_depth;
+    };
+
+    // Initializes locks and the log file. Should only be called once.
+    static void initialize();
+
+    // Used for probing the stack at places where we suspect to be high
+    // points of stack usage but are NOT check points where stack recursion
+    // is checked.
+    //
+    // The more places where we add this probe, the more accurate our
+    // stats data will be. However, adding too many probes will also
+    // result in unnecessary performance loss. So, only add these probes
+    // judiciously where appropriate.
+    static void probe();
+
+private:
+    // CheckPoint management:
+    static Mutex* s_sharedLock;
+    static CheckPoint* s_topCheckPoint;
+    static LayoutCheckPoint* s_firstLayoutCheckPoint;
+    static LayoutCheckPoint* s_topLayoutCheckPoint;
+
+    // High watermark stats:
+    static int s_maxCheckPointDiff;
+    static int s_maxStackHeight;
+    static int s_maxReentryDepth;
+
+    static int s_maxLayoutCheckPointDiff;
+    static int s_maxTotalLayoutCheckPointDiff;
+    static int s_maxLayoutReentryDepth;
+
+    friend class CheckPoint;
+    friend class LayoutCheckPoint;
+};
+
+#endif // ENABLE(STACK_STATS) 
+
+} // namespace WTF
+
+using WTF::StackStats;
+
+#endif // StackStats_h
diff --git a/Source/WTF/wtf/StaticConstructors.h b/Source/WTF/wtf/StaticConstructors.h
new file mode 100644
index 0000000..702c0ca
--- /dev/null
+++ b/Source/WTF/wtf/StaticConstructors.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2006 Apple Computer, 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.
+ *
+ */
+
+#ifndef StaticConstructors_h
+#define StaticConstructors_h
+
+// We need to avoid having static constructors. We achieve this
+// with two separate methods for GCC and MSVC. Both methods prevent the static
+// initializers from being registered and called on program startup. On GCC, we
+// declare the global objects with a different type that can be POD default
+// initialized by the linker/loader. On MSVC we use a special compiler feature
+// to have the CRT ignore our static initializers. The constructors will never
+// be called and the objects will be left uninitialized.
+//
+// With both of these approaches, we must define and explicitly call an init
+// routine that uses placement new to create the objects and overwrite the
+// uninitialized placeholders.
+//
+// This is not completely portable, but is what we have for now without
+// changing how a lot of code accesses these global objects.
+
+#ifdef SKIP_STATIC_CONSTRUCTORS_ON_MSVC
+// - Assume that all includes of this header want ALL of their static
+//   initializers ignored. This is currently the case. This means that if
+//   a .cc includes this header (or it somehow gets included), all static
+//   initializers after the include will not be executed.
+// - We do this with a pragma, so that all of the static initializer pointers
+//   go into our own section, and the CRT won't call them. Eventually it would
+//   be nice if the section was discarded, because we don't want the pointers.
+//   See: http://msdn.microsoft.com/en-us/library/7977wcck(VS.80).aspx
+#pragma warning(disable:4075)
+#pragma init_seg(".unwantedstaticinits")
+#endif
+
+#ifndef SKIP_STATIC_CONSTRUCTORS_ON_GCC
+    // Define an global in the normal way.
+#if COMPILER(MSVC7_OR_LOWER)
+#define DEFINE_GLOBAL(type, name) \
+    const type name;
+#else
+#define DEFINE_GLOBAL(type, name, ...) \
+    const type name;
+#endif
+
+#else
+// Define an correctly-sized array of pointers to avoid static initialization.
+// Use an array of pointers instead of an array of char in case there is some alignment issue.
+#if COMPILER(MSVC7_OR_LOWER)
+#define DEFINE_GLOBAL(type, name) \
+    void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)];
+#else
+#define DEFINE_GLOBAL(type, name, ...) \
+    void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)];
+#endif
+#endif
+
+#endif // StaticConstructors_h
diff --git a/Source/WTF/wtf/StdLibExtras.h b/Source/WTF/wtf/StdLibExtras.h
new file mode 100644
index 0000000..e66df2c
--- /dev/null
+++ b/Source/WTF/wtf/StdLibExtras.h
@@ -0,0 +1,320 @@
+/*
+ * Copyright (C) 2008 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. ``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
+ * 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_StdLibExtras_h
+#define WTF_StdLibExtras_h
+
+#include <wtf/Assertions.h>
+#include <wtf/CheckedArithmetic.h>
+
+// Use these to declare and define a static local variable (static T;) so that
+//  it is leaked so that its destructors are not called at exit. Using this
+//  macro also allows workarounds a compiler bug present in Apple's version of GCC 4.0.1.
+#ifndef DEFINE_STATIC_LOCAL
+#if COMPILER(GCC) && defined(__APPLE_CC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 1
+#define DEFINE_STATIC_LOCAL(type, name, arguments) \
+    static type* name##Ptr = new type arguments; \
+    type& name = *name##Ptr
+#else
+#define DEFINE_STATIC_LOCAL(type, name, arguments) \
+    static type& name = *new type arguments
+#endif
+#endif
+
+// Use this macro to declare and define a debug-only global variable that may have a
+// non-trivial constructor and destructor. When building with clang, this will suppress
+// warnings about global constructors and exit-time destructors.
+#ifndef NDEBUG
+#if COMPILER(CLANG)
+#define DEFINE_DEBUG_ONLY_GLOBAL(type, name, arguments) \
+    _Pragma("clang diagnostic push") \
+    _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") \
+    _Pragma("clang diagnostic ignored \"-Wexit-time-destructors\"") \
+    static type name arguments; \
+    _Pragma("clang diagnostic pop")
+#else
+#define DEFINE_DEBUG_ONLY_GLOBAL(type, name, arguments) \
+    static type name arguments;
+#endif // COMPILER(CLANG)
+#else
+#define DEFINE_DEBUG_ONLY_GLOBAL(type, name, arguments)
+#endif // NDEBUG
+
+// OBJECT_OFFSETOF: Like the C++ offsetof macro, but you can use it with classes.
+// The magic number 0x4000 is insignificant. We use it to avoid using NULL, since
+// NULL can cause compiler problems, especially in cases of multiple inheritance.
+#define OBJECT_OFFSETOF(class, field) (reinterpret_cast<ptrdiff_t>(&(reinterpret_cast<class*>(0x4000)->field)) - 0x4000)
+
+// STRINGIZE: Can convert any value to quoted string, even expandable macros
+#define STRINGIZE(exp) #exp
+#define STRINGIZE_VALUE_OF(exp) STRINGIZE(exp)
+
+/*
+ * The reinterpret_cast<Type1*>([pointer to Type2]) expressions - where
+ * sizeof(Type1) > sizeof(Type2) - cause the following warning on ARM with GCC:
+ * increases required alignment of target type.
+ *
+ * An implicit or an extra static_cast<void*> bypasses the warning.
+ * For more info see the following bugzilla entries:
+ * - https://bugs.webkit.org/show_bug.cgi?id=38045
+ * - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43976
+ */
+#if (CPU(ARM) || CPU(MIPS)) && COMPILER(GCC)
+template<typename Type>
+bool isPointerTypeAlignmentOkay(Type* ptr)
+{
+    return !(reinterpret_cast<intptr_t>(ptr) % __alignof__(Type));
+}
+
+template<typename TypePtr>
+TypePtr reinterpret_cast_ptr(void* ptr)
+{
+    ASSERT(isPointerTypeAlignmentOkay(reinterpret_cast<TypePtr>(ptr)));
+    return reinterpret_cast<TypePtr>(ptr);
+}
+
+template<typename TypePtr>
+TypePtr reinterpret_cast_ptr(const void* ptr)
+{
+    ASSERT(isPointerTypeAlignmentOkay(reinterpret_cast<TypePtr>(ptr)));
+    return reinterpret_cast<TypePtr>(ptr);
+}
+#else
+template<typename Type>
+bool isPointerTypeAlignmentOkay(Type*)
+{
+    return true;
+}
+#define reinterpret_cast_ptr reinterpret_cast
+#endif
+
+namespace WTF {
+
+static const size_t KB = 1024;
+static const size_t MB = 1024 * 1024;
+
+inline bool isPointerAligned(void* p)
+{
+    return !((intptr_t)(p) & (sizeof(char*) - 1));
+}
+
+inline bool is8ByteAligned(void* p)
+{
+    return !((uintptr_t)(p) & (sizeof(double) - 1));
+}
+
+/*
+ * C++'s idea of a reinterpret_cast lacks sufficient cojones.
+ */
+template<typename TO, typename FROM>
+inline TO bitwise_cast(FROM from)
+{
+    COMPILE_ASSERT(sizeof(TO) == sizeof(FROM), WTF_bitwise_cast_sizeof_casted_types_is_equal);
+    union {
+        FROM from;
+        TO to;
+    } u;
+    u.from = from;
+    return u.to;
+}
+
+template<typename To, typename From>
+inline To safeCast(From value)
+{
+    ASSERT(isInBounds<To>(value));
+    return static_cast<To>(value);
+}
+
+// Returns a count of the number of bits set in 'bits'.
+inline size_t bitCount(unsigned bits)
+{
+    bits = bits - ((bits >> 1) & 0x55555555);
+    bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
+    return (((bits + (bits >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
+}
+
+// Macro that returns a compile time constant with the length of an array, but gives an error if passed a non-array.
+template<typename T, size_t Size> char (&ArrayLengthHelperFunction(T (&)[Size]))[Size];
+// GCC needs some help to deduce a 0 length array.
+#if COMPILER(GCC)
+template<typename T> char (&ArrayLengthHelperFunction(T (&)[0]))[0];
+#endif
+#define WTF_ARRAY_LENGTH(array) sizeof(::WTF::ArrayLengthHelperFunction(array))
+
+// Efficient implementation that takes advantage of powers of two.
+inline size_t roundUpToMultipleOf(size_t divisor, size_t x)
+{
+    ASSERT(divisor && !(divisor & (divisor - 1)));
+    size_t remainderMask = divisor - 1;
+    return (x + remainderMask) & ~remainderMask;
+}
+template<size_t divisor> inline size_t roundUpToMultipleOf(size_t x)
+{
+    COMPILE_ASSERT(divisor && !(divisor & (divisor - 1)), divisor_is_a_power_of_two);
+    return roundUpToMultipleOf(divisor, x);
+}
+
+enum BinarySearchMode {
+    KeyMustBePresentInArray,
+    KeyMustNotBePresentInArray
+};
+
+// Binary search algorithm, calls extractKey on pre-sorted elements in array,
+// compares result with key (KeyTypes should be comparable with '--', '<', '>').
+template<typename ArrayElementType, typename KeyType, KeyType(*extractKey)(ArrayElementType*)>
+inline ArrayElementType* binarySearch(ArrayElementType* array, size_t size, KeyType key, BinarySearchMode mode = KeyMustBePresentInArray)
+{
+    // The array must contain at least one element (pre-condition, array does contain key).
+    // If the array contains only one element, no need to do the comparison.
+    while (size > 1) {
+        // Pick an element to check, half way through the array, and read the value.
+        int pos = (size - 1) >> 1;
+        KeyType val = extractKey(&array[pos]);
+
+        // If the key matches, success!
+        if (val == key)
+            return &array[pos];
+        // The item we are looking for is smaller than the item being check; reduce the value of 'size',
+        // chopping off the right hand half of the array.
+        else if (key < val)
+            size = pos;
+        // Discard all values in the left hand half of the array, up to and including the item at pos.
+        else {
+            size -= (pos + 1);
+            array += (pos + 1);
+        }
+
+        // In case of BinarySearchMode = KeyMustBePresentInArray 'size' should never reach zero.
+        if (mode == KeyMustBePresentInArray)
+            ASSERT(size);
+    }
+
+    // In case of BinarySearchMode = KeyMustBePresentInArray if we reach this point
+    // we've chopped down to one element, no need to check it matches
+    if (mode == KeyMustBePresentInArray) {
+        ASSERT(size == 1);
+        ASSERT(key == extractKey(&array[0]));
+    }
+
+    return &array[0];
+}
+
+// Modified binary search algorithm that uses a functor. Note that this is strictly
+// more powerful than the above, but results in somewhat less template specialization.
+// Hence, depending on inlining heuristics, it might be slower.
+template<typename ArrayElementType, typename KeyType, typename ExtractKey>
+inline ArrayElementType* binarySearchWithFunctor(ArrayElementType* array, size_t size, KeyType key, BinarySearchMode mode = KeyMustBePresentInArray, const ExtractKey& extractKey = ExtractKey())
+{
+    // The array must contain at least one element (pre-condition, array does contain key).
+    // If the array contains only one element, no need to do the comparison.
+    while (size > 1) {
+        // Pick an element to check, half way through the array, and read the value.
+        int pos = (size - 1) >> 1;
+        KeyType val = extractKey(&array[pos]);
+
+        // If the key matches, success!
+        if (val == key)
+            return &array[pos];
+        // The item we are looking for is smaller than the item being check; reduce the value of 'size',
+        // chopping off the right hand half of the array.
+        else if (key < val)
+            size = pos;
+        // Discard all values in the left hand half of the array, up to and including the item at pos.
+        else {
+            size -= (pos + 1);
+            array += (pos + 1);
+        }
+
+        // In case of BinarySearchMode = KeyMustBePresentInArray 'size' should never reach zero.
+        if (mode == KeyMustBePresentInArray)
+            ASSERT(size);
+    }
+
+    // In case of BinarySearchMode = KeyMustBePresentInArray if we reach this point
+    // we've chopped down to one element, no need to check it matches
+    if (mode == KeyMustBePresentInArray) {
+        ASSERT(size == 1);
+        ASSERT(key == extractKey(&array[0]));
+    }
+
+    return &array[0];
+}
+
+// Modified binarySearch() algorithm designed for array-like classes that support
+// operator[] but not operator+=. One example of a class that qualifies is
+// SegmentedVector.
+template<typename ArrayElementType, typename KeyType, KeyType(*extractKey)(ArrayElementType*), typename ArrayType>
+inline ArrayElementType* genericBinarySearch(ArrayType& array, size_t size, KeyType key)
+{
+    // The array must contain at least one element (pre-condition, array does conatin key).
+    // If the array only contains one element, no need to do the comparison.
+    size_t offset = 0;
+    while (size > 1) {
+        // Pick an element to check, half way through the array, and read the value.
+        int pos = (size - 1) >> 1;
+        KeyType val = extractKey(&array[offset + pos]);
+        
+        // If the key matches, success!
+        if (val == key)
+            return &array[offset + pos];
+        // The item we are looking for is smaller than the item being check; reduce the value of 'size',
+        // chopping off the right hand half of the array.
+        if (key < val)
+            size = pos;
+        // Discard all values in the left hand half of the array, up to and including the item at pos.
+        else {
+            size -= (pos + 1);
+            offset += (pos + 1);
+        }
+
+        // 'size' should never reach zero.
+        ASSERT(size);
+    }
+    
+    // If we reach this point we've chopped down to one element, no need to check it matches
+    ASSERT(size == 1);
+    ASSERT(key == extractKey(&array[offset]));
+    return &array[offset];
+}
+
+} // namespace WTF
+
+// This version of placement new omits a 0 check.
+enum NotNullTag { NotNull };
+inline void* operator new(size_t, NotNullTag, void* location)
+{
+    ASSERT(location);
+    return location;
+}
+
+using WTF::KB;
+using WTF::MB;
+using WTF::isPointerAligned;
+using WTF::is8ByteAligned;
+using WTF::binarySearch;
+using WTF::bitwise_cast;
+using WTF::safeCast;
+
+#endif // WTF_StdLibExtras_h
diff --git a/Source/WTF/wtf/StreamBuffer.h b/Source/WTF/wtf/StreamBuffer.h
new file mode 100644
index 0000000..e7d958f
--- /dev/null
+++ b/Source/WTF/wtf/StreamBuffer.h
@@ -0,0 +1,119 @@
+/*
+* Copyright (C) 2012 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.
+*     * 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.
+*     * 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_StreamBuffer_h
+#define WTF_StreamBuffer_h
+
+#include <wtf/Deque.h>
+#include <wtf/FixedArray.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WTF {
+
+template <typename T, size_t BlockSize> class StreamBuffer {
+private:
+    typedef Vector<T> Block;
+public:
+    StreamBuffer()
+        : m_size(0)
+        , m_readOffset(0)
+    {
+    }
+
+    ~StreamBuffer()
+    {
+    }
+
+    bool isEmpty() const { return !size(); }
+
+    void append(const T* data, size_t size)
+    {
+        if (!size)
+            return;
+
+        m_size += size;
+        while (size) {
+            if (!m_buffer.size() || m_buffer.last()->size() == BlockSize)
+                m_buffer.append(adoptPtr(new Block));
+            size_t appendSize = std::min(BlockSize - m_buffer.last()->size(), size);
+            m_buffer.last()->append(data, appendSize);
+            data += appendSize;
+            size -= appendSize;
+        }
+    }
+
+    // This function consume data in the fist block.
+    // Specified size must be less than over equal to firstBlockSize().
+    void consume(size_t size)
+    {
+        ASSERT(m_size >= size);
+        if (!m_size)
+            return;
+
+        ASSERT(m_buffer.size() > 0);
+        ASSERT(m_readOffset + size <= m_buffer.first()->size());
+        m_readOffset += size;
+        m_size -= size;
+        if (m_readOffset >= m_buffer.first()->size()) {
+            m_readOffset = 0;
+            m_buffer.removeFirst();
+        }
+    }
+
+    size_t size() const { return m_size; }
+
+    const T* firstBlockData() const
+    {
+        if (!m_size)
+            return 0;
+        ASSERT(m_buffer.size() > 0);
+        return &m_buffer.first()->data()[m_readOffset];
+    }
+
+    size_t firstBlockSize() const
+    {
+        if (!m_size)
+            return 0;
+        ASSERT(m_buffer.size() > 0);
+        return m_buffer.first()->size() - m_readOffset;
+    }
+
+private:
+    size_t m_size;
+    size_t m_readOffset;
+    Deque<OwnPtr<Block> > m_buffer;
+};
+
+} // namespace WTF
+
+using WTF::StreamBuffer;
+
+#endif // WTF_StreamBuffer_h
diff --git a/Source/WTF/wtf/StringExtras.cpp b/Source/WTF/wtf/StringExtras.cpp
new file mode 100644
index 0000000..1b96417
--- /dev/null
+++ b/Source/WTF/wtf/StringExtras.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009 Company 100, 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 COMPUTER, INC. ``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 COMPUTER, INC. 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"
+
+#if COMPILER(RVCT) && __ARMCC_VERSION < 400000
+
+#include "StringExtras.h"
+
+#include "ASCIICType.h"
+
+int strcasecmp(const char* s1, const char* s2)
+{
+    while (toASCIIUpper(*s1) == toASCIIUpper(*s2)) {
+        if (*s1 == '\0')
+            return 0;
+        s1++;
+        s2++;
+    }
+
+    return toASCIIUpper(*s1) - toASCIIUpper(*s2);
+}
+
+int strncasecmp(const char* s1, const char* s2, size_t len)
+{
+    while (len > 0 && toASCIIUpper(*s1) == toASCIIUpper(*s2)) {
+        if (*s1 == '\0')
+            return 0;
+        s1++;
+        s2++;
+        len--;
+    }
+
+    if (!len)
+        return 0;
+
+    return toASCIIUpper(*s1) - toASCIIUpper(*s2);
+}
+
+#endif
diff --git a/Source/WTF/wtf/StringExtras.h b/Source/WTF/wtf/StringExtras.h
new file mode 100644
index 0000000..371e33b
--- /dev/null
+++ b/Source/WTF/wtf/StringExtras.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2006, 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 COMPUTER, INC. ``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 COMPUTER, INC. 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_StringExtras_h
+#define WTF_StringExtras_h
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#if HAVE(STRINGS_H) 
+#include <strings.h> 
+#endif 
+
+#if COMPILER(MSVC)
+// FIXME: why a COMPILER check instead of OS? also, these should be HAVE checks
+
+inline int snprintf(char* buffer, size_t count, const char* format, ...) 
+{
+    int result;
+    va_list args;
+    va_start(args, format);
+    result = _vsnprintf(buffer, count, format, args);
+    va_end(args);
+
+    // In the case where the string entirely filled the buffer, _vsnprintf will not
+    // null-terminate it, but snprintf must.
+    if (count > 0)
+        buffer[count - 1] = '\0';
+
+    return result;
+}
+
+inline double wtf_vsnprintf(char* buffer, size_t count, const char* format, va_list args)
+{
+    int result = _vsnprintf(buffer, count, format, args);
+
+    // In the case where the string entirely filled the buffer, _vsnprintf will not
+    // null-terminate it, but vsnprintf must.
+    if (count > 0)
+        buffer[count - 1] = '\0';
+
+    return result;
+}
+
+// Work around a difference in Microsoft's implementation of vsnprintf, where 
+// vsnprintf does not null terminate the buffer. WebKit can rely on the null termination.
+#define vsnprintf(buffer, count, format, args) wtf_vsnprintf(buffer, count, format, args)
+
+#if OS(WINCE)
+
+inline int strnicmp(const char* string1, const char* string2, size_t count)
+{
+    return _strnicmp(string1, string2, count);
+}
+
+inline int stricmp(const char* string1, const char* string2)
+{
+    return _stricmp(string1, string2);
+}
+
+inline char* strdup(const char* strSource)
+{
+    return _strdup(strSource);
+}
+
+#endif
+
+inline int strncasecmp(const char* s1, const char* s2, size_t len)
+{
+    return _strnicmp(s1, s2, len);
+}
+
+inline int strcasecmp(const char* s1, const char* s2)
+{
+    return _stricmp(s1, s2);
+}
+
+#endif
+
+#if !HAVE(STRNSTR)
+
+inline char* strnstr(const char* buffer, const char* target, size_t bufferLength)
+{
+    size_t targetLength = strlen(target);
+    if (targetLength == 0)
+        return const_cast<char*>(buffer);
+    for (const char* start = buffer; *start && start + targetLength <= buffer + bufferLength; start++) {
+        if (*start == *target && strncmp(start + 1, target + 1, targetLength - 1) == 0)
+            return const_cast<char*>(start);
+    }
+    return 0;
+}
+
+#endif
+
+#if COMPILER(RVCT) && __ARMCC_VERSION < 400000
+
+int strcasecmp(const char* s1, const char* s2);
+int strncasecmp(const char* s1, const char* s2, size_t len);
+
+#endif
+
+#endif // WTF_StringExtras_h
diff --git a/Source/WTF/wtf/StringHasher.h b/Source/WTF/wtf/StringHasher.h
new file mode 100644
index 0000000..53b1b54
--- /dev/null
+++ b/Source/WTF/wtf/StringHasher.h
@@ -0,0 +1,253 @@
+/*
+ * Copyright (C) 2005, 2006, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+ *
+ * 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_StringHasher_h
+#define WTF_StringHasher_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WTF {
+
+// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
+static const unsigned stringHashingStartValue = 0x9e3779b9U;
+
+// Paul Hsieh's SuperFastHash
+// http://www.azillionmonkeys.com/qed/hash.html
+// char* data is interpreted as latin-encoded (zero extended to 16 bits).
+
+// NOTE: This class must stay in sync with the create_hash_table script in
+// JavaScriptCore and the CodeGeneratorJS.pm script in WebCore.
+class StringHasher {
+public:
+    static const unsigned flagCount = 8; // Save 8 bits for StringImpl to use as flags.
+
+    inline StringHasher()
+        : m_hash(stringHashingStartValue)
+        , m_hasPendingCharacter(false)
+        , m_pendingCharacter(0)
+    {
+    }
+
+    inline void addCharacters(UChar a, UChar b)
+    {
+        ASSERT(!m_hasPendingCharacter);
+        addCharactersToHash(a, b);
+    }
+
+    inline void addCharacter(UChar ch)
+    {
+        if (m_hasPendingCharacter) {
+            addCharactersToHash(m_pendingCharacter, ch);
+            m_hasPendingCharacter = false;
+            return;
+        }
+
+        m_pendingCharacter = ch;
+        m_hasPendingCharacter = true;
+    }
+
+    inline unsigned hashWithTop8BitsMasked() const
+    {
+        unsigned result = avalancheBits();
+
+        // Reserving space from the high bits for flags preserves most of the hash's
+        // value, since hash lookup typically masks out the high bits anyway.
+        result &= (1u << (sizeof(result) * 8 - flagCount)) - 1;
+
+        // This avoids ever returning a hash code of 0, since that is used to
+        // signal "hash not computed yet". Setting the high bit maintains
+        // reasonable fidelity to a hash code of 0 because it is likely to yield
+        // exactly 0 when hash lookup masks out the high bits.
+        if (!result)
+            result = 0x80000000 >> flagCount;
+
+        return result;
+    }
+
+    inline unsigned hash() const
+    {
+        unsigned result = avalancheBits();
+
+        // This avoids ever returning a hash code of 0, since that is used to
+        // signal "hash not computed yet". Setting the high bit maintains
+        // reasonable fidelity to a hash code of 0 because it is likely to yield
+        // exactly 0 when hash lookup masks out the high bits.
+        if (!result)
+            result = 0x80000000;
+
+        return result;
+    }
+
+    template<typename T, UChar Converter(T)> static inline unsigned computeHashAndMaskTop8Bits(const T* data, unsigned length)
+    {
+        StringHasher hasher;
+        bool rem = length & 1;
+        length >>= 1;
+
+        while (length--) {
+            hasher.addCharacters(Converter(data[0]), Converter(data[1]));
+            data += 2;
+        }
+
+        if (rem)
+            hasher.addCharacter(Converter(*data));
+
+        return hasher.hashWithTop8BitsMasked();
+    }
+
+    template<typename T, UChar Converter(T)> static inline unsigned computeHashAndMaskTop8Bits(const T* data)
+    {
+        StringHasher hasher;
+
+        while (true) {
+            UChar b0 = Converter(*data++);
+            if (!b0)
+                break;
+            UChar b1 = Converter(*data++);
+            if (!b1) {
+                hasher.addCharacter(b0);
+                break;
+            }
+
+            hasher.addCharacters(b0, b1);
+        }
+
+        return hasher.hashWithTop8BitsMasked();
+    }
+
+    template<typename T> static inline unsigned computeHashAndMaskTop8Bits(const T* data, unsigned length)
+    {
+        return computeHashAndMaskTop8Bits<T, defaultConverter>(data, length);
+    }
+
+    template<typename T> static inline unsigned computeHashAndMaskTop8Bits(const T* data)
+    {
+        return computeHashAndMaskTop8Bits<T, defaultConverter>(data);
+    }
+
+    template<typename T, UChar Converter(T)> static inline unsigned computeHash(const T* data, unsigned length)
+    {
+        StringHasher hasher;
+        bool rem = length & 1;
+        length >>= 1;
+
+        while (length--) {
+            hasher.addCharacters(Converter(data[0]), Converter(data[1]));
+            data += 2;
+        }
+
+        if (rem)
+            hasher.addCharacter(Converter(*data));
+
+        return hasher.hash();
+    }
+
+    template<typename T, UChar Converter(T)> static inline unsigned computeHash(const T* data)
+    {
+        StringHasher hasher;
+
+        while (true) {
+            UChar b0 = Converter(*data++);
+            if (!b0)
+                break;
+            UChar b1 = Converter(*data++);
+            if (!b1) {
+                hasher.addCharacter(b0);
+                break;
+            }
+
+            hasher.addCharacters(b0, b1);
+        }
+
+        return hasher.hash();
+    }
+
+    template<typename T> static inline unsigned computeHash(const T* data, unsigned length)
+    {
+        return computeHash<T, defaultConverter>(data, length);
+    }
+
+    template<typename T> static inline unsigned computeHash(const T* data)
+    {
+        return computeHash<T, defaultConverter>(data);
+    }
+
+    template<size_t length> static inline unsigned hashMemory(const void* data)
+    {
+        COMPILE_ASSERT(!(length % 4), length_must_be_a_multible_of_four);
+        return computeHashAndMaskTop8Bits<UChar>(static_cast<const UChar*>(data), length / sizeof(UChar));
+    }
+
+    static inline unsigned hashMemory(const void* data, unsigned size)
+    {
+        ASSERT(!(size % 2));
+        return computeHashAndMaskTop8Bits<UChar>(static_cast<const UChar*>(data), size / sizeof(UChar));
+    }
+
+private:
+    static inline UChar defaultConverter(UChar ch)
+    {
+        return ch;
+    }
+
+    static inline UChar defaultConverter(LChar ch)
+    {
+        return ch;
+    }
+
+    inline void addCharactersToHash(UChar a, UChar b)
+    {
+        m_hash += a;
+        unsigned tmp = (b << 11) ^ m_hash;
+        m_hash = (m_hash << 16) ^ tmp;
+        m_hash += m_hash >> 11;
+    }
+
+    inline unsigned avalancheBits() const
+    {
+        unsigned result = m_hash;
+
+        // Handle end case.
+        if (m_hasPendingCharacter) {
+            result += m_pendingCharacter;
+            result ^= result << 11;
+            result += result >> 17;
+        }
+
+        // Force "avalanching" of final 31 bits.
+        result ^= result << 3;
+        result += result >> 5;
+        result ^= result << 2;
+        result += result >> 15;
+        result ^= result << 10;
+
+        return result;
+    }
+
+    unsigned m_hash;
+    bool m_hasPendingCharacter;
+    UChar m_pendingCharacter;
+};
+
+} // namespace WTF
+
+using WTF::StringHasher;
+
+#endif // WTF_StringHasher_h
diff --git a/Source/WTF/wtf/TCPackedCache.h b/Source/WTF/wtf/TCPackedCache.h
new file mode 100644
index 0000000..0464f8f
--- /dev/null
+++ b/Source/WTF/wtf/TCPackedCache.h
@@ -0,0 +1,234 @@
+// Copyright (c) 2007, 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.
+//     * 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.
+//     * 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.
+
+// ---
+// Author: Geoff Pike
+//
+// This file provides a minimal cache that can hold a <key, value> pair
+// with little if any wasted space.  The types of the key and value
+// must be unsigned integral types or at least have unsigned semantics
+// for >>, casting, and similar operations.
+//
+// Synchronization is not provided.  However, the cache is implemented
+// as an array of cache entries whose type is chosen at compile time.
+// If a[i] is atomic on your hardware for the chosen array type then
+// raciness will not necessarily lead to bugginess.  The cache entries
+// must be large enough to hold a partial key and a value packed
+// together.  The partial keys are bit strings of length
+// kKeybits - kHashbits, and the values are bit strings of length kValuebits.
+//
+// In an effort to use minimal space, every cache entry represents
+// some <key, value> pair; the class provides no way to mark a cache
+// entry as empty or uninitialized.  In practice, you may want to have
+// reserved keys or values to get around this limitation.  For example, in
+// tcmalloc's PageID-to-sizeclass cache, a value of 0 is used as
+// "unknown sizeclass."
+//
+// Usage Considerations
+// --------------------
+//
+// kHashbits controls the size of the cache.  The best value for
+// kHashbits will of course depend on the application.  Perhaps try
+// tuning the value of kHashbits by measuring different values on your
+// favorite benchmark.  Also remember not to be a pig; other
+// programs that need resources may suffer if you are.
+//
+// The main uses for this class will be when performance is
+// critical and there's a convenient type to hold the cache's
+// entries.  As described above, the number of bits required
+// for a cache entry is (kKeybits - kHashbits) + kValuebits.  Suppose
+// kKeybits + kValuebits is 43.  Then it probably makes sense to
+// chose kHashbits >= 11 so that cache entries fit in a uint32.
+//
+// On the other hand, suppose kKeybits = kValuebits = 64.  Then
+// using this class may be less worthwhile.  You'll probably
+// be using 128 bits for each entry anyway, so maybe just pick
+// a hash function, H, and use an array indexed by H(key):
+//    void Put(K key, V value) { a_[H(key)] = pair<K, V>(key, value); }
+//    V GetOrDefault(K key, V default) { const pair<K, V> &p = a_[H(key)]; ... }
+//    etc.
+//
+// Further Details
+// ---------------
+//
+// For caches used only by one thread, the following is true:
+// 1. For a cache c,
+//      (c.Put(key, value), c.GetOrDefault(key, 0)) == value
+//    and
+//      (c.Put(key, value), <...>, c.GetOrDefault(key, 0)) == value
+//    if the elided code contains no c.Put calls.
+//
+// 2. Has(key) will return false if no <key, value> pair with that key
+//    has ever been Put.  However, a newly initialized cache will have
+//    some <key, value> pairs already present.  When you create a new
+//    cache, you must specify an "initial value."  The initialization
+//    procedure is equivalent to Clear(initial_value), which is
+//    equivalent to Put(k, initial_value) for all keys k from 0 to
+//    2^kHashbits - 1.
+//
+// 3. If key and key' differ then the only way Put(key, value) may
+//    cause Has(key') to change is that Has(key') may change from true to
+//    false. Furthermore, a Put() call that doesn't change Has(key')
+//    doesn't change GetOrDefault(key', ...) either.
+//
+// Implementation details:
+//
+// This is a direct-mapped cache with 2^kHashbits entries;
+// the hash function simply takes the low bits of the key.
+// So, we don't have to store the low bits of the key in the entries.
+// Instead, an entry is the high bits of a key and a value, packed
+// together.  E.g., a 20 bit key and a 7 bit value only require
+// a uint16 for each entry if kHashbits >= 11.
+//
+// Alternatives to this scheme will be added as needed.
+
+#ifndef TCMALLOC_PACKED_CACHE_INL_H__
+#define TCMALLOC_PACKED_CACHE_INL_H__
+
+#ifndef WTF_CHANGES
+#include "base/basictypes.h"  // for COMPILE_ASSERT
+#include "base/logging.h"     // for DCHECK
+#endif
+
+#ifndef DCHECK_EQ
+#define DCHECK_EQ(val1, val2) ASSERT((val1) == (val2))
+#endif
+
+// A safe way of doing "(1 << n) - 1" -- without worrying about overflow
+// Note this will all be resolved to a constant expression at compile-time
+#define N_ONES_(IntType, N)                                     \
+  ( (N) == 0 ? 0 : ((static_cast<IntType>(1) << ((N)-1))-1 +    \
+                    (static_cast<IntType>(1) << ((N)-1))) )
+
+// The types K and V provide upper bounds on the number of valid keys
+// and values, but we explicitly require the keys to be less than
+// 2^kKeybits and the values to be less than 2^kValuebits.  The size of
+// the table is controlled by kHashbits, and the type of each entry in
+// the cache is T.  See also the big comment at the top of the file.
+template <int kKeybits, typename T>
+class PackedCache {
+ public:
+  typedef uintptr_t K;
+  typedef size_t V;
+  static const size_t kHashbits = 12;
+  static const size_t kValuebits = 8;
+
+  explicit PackedCache(V initial_value) {
+    COMPILE_ASSERT(kKeybits <= sizeof(K) * 8, key_size);
+    COMPILE_ASSERT(kValuebits <= sizeof(V) * 8, value_size);
+    COMPILE_ASSERT(kHashbits <= kKeybits, hash_function);
+    COMPILE_ASSERT(kKeybits - kHashbits + kValuebits <= kTbits,
+                   entry_size_must_be_big_enough);
+    Clear(initial_value);
+  }
+
+  void Put(K key, V value) {
+    DCHECK_EQ(key, key & kKeyMask);
+    DCHECK_EQ(value, value & kValueMask);
+    array_[Hash(key)] = static_cast<T>(KeyToUpper(key) | value);
+  }
+
+  bool Has(K key) const {
+    DCHECK_EQ(key, key & kKeyMask);
+    return KeyMatch(array_[Hash(key)], key);
+  }
+
+  V GetOrDefault(K key, V default_value) const {
+    // As with other code in this class, we touch array_ as few times
+    // as we can.  Assuming entries are read atomically (e.g., their
+    // type is uintptr_t on most hardware) then certain races are
+    // harmless.
+    DCHECK_EQ(key, key & kKeyMask);
+    T entry = array_[Hash(key)];
+    return KeyMatch(entry, key) ? EntryToValue(entry) : default_value;
+  }
+
+  void Clear(V value) {
+    DCHECK_EQ(value, value & kValueMask);
+    for (int i = 0; i < 1 << kHashbits; i++) {
+      array_[i] = static_cast<T>(value);
+    }
+  }
+
+ private:
+  // We are going to pack a value and the upper part of a key into
+  // an entry of type T.  The UPPER type is for the upper part of a key,
+  // after the key has been masked and shifted for inclusion in an entry.
+  typedef T UPPER;
+
+  static V EntryToValue(T t) { return t & kValueMask; }
+
+  static UPPER EntryToUpper(T t) { return t & kUpperMask; }
+
+  // If v is a V and u is an UPPER then you can create an entry by
+  // doing u | v.  kHashbits determines where in a K to find the upper
+  // part of the key, and kValuebits determines where in the entry to put
+  // it.
+  static UPPER KeyToUpper(K k) {
+    const int shift = kHashbits - kValuebits;
+    // Assume kHashbits >= kValuebits. It would be easy to lift this assumption.
+    return static_cast<T>(k >> shift) & kUpperMask;
+  }
+
+  // This is roughly the inverse of KeyToUpper().  Some of the key has been
+  // thrown away, since KeyToUpper() masks off the low bits of the key.
+  static K UpperToPartialKey(UPPER u) {
+    DCHECK_EQ(u, u & kUpperMask);
+    const int shift = kHashbits - kValuebits;
+    // Assume kHashbits >= kValuebits. It would be easy to lift this assumption.
+    return static_cast<K>(u) << shift;
+  }
+
+  static size_t Hash(K key) {
+    return static_cast<size_t>(key) & N_ONES_(size_t, kHashbits);
+  }
+
+  // Does the entry's partial key match the relevant part of the given key?
+  static bool KeyMatch(T entry, K key) {
+    return ((KeyToUpper(key) ^ entry) & kUpperMask) == 0;
+  }
+
+  static const size_t kTbits = 8 * sizeof(T);
+  static const int kUpperbits = kKeybits - kHashbits;
+
+  // For masking a K.
+  static const K kKeyMask = N_ONES_(K, kKeybits);
+
+  // For masking a T.
+  static const T kUpperMask = N_ONES_(T, kUpperbits) << kValuebits;
+
+  // For masking a V or a T.
+  static const V kValueMask = N_ONES_(V, kValuebits);
+
+  T array_[1 << kHashbits];
+};
+
+#undef N_ONES_
+
+#endif  // TCMALLOC_PACKED_CACHE_INL_H__
diff --git a/Source/WTF/wtf/TCPageMap.h b/Source/WTF/wtf/TCPageMap.h
new file mode 100644
index 0000000..3107f6f
--- /dev/null
+++ b/Source/WTF/wtf/TCPageMap.h
@@ -0,0 +1,309 @@
+// Copyright (c) 2005, 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.
+//     * 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.
+//     * 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.
+
+// ---
+// Author: Sanjay Ghemawat <opensource@google.com>
+//
+// A data structure used by the caching malloc.  It maps from page# to
+// a pointer that contains info about that page.  We use two
+// representations: one for 32-bit addresses, and another for 64 bit
+// addresses.  Both representations provide the same interface.  The
+// first representation is implemented as a flat array, the seconds as
+// a three-level radix tree that strips away approximately 1/3rd of
+// the bits every time.
+//
+// The BITS parameter should be the number of bits required to hold
+// a page number.  E.g., with 32 bit pointers and 4K pages (i.e.,
+// page offset fits in lower 12 bits), BITS == 20.
+
+#ifndef TCMALLOC_PAGEMAP_H__
+#define TCMALLOC_PAGEMAP_H__
+
+#include <stdint.h>
+#include <string.h>
+#include <wtf/Assertions.h>
+
+// Single-level array
+template <int BITS>
+class TCMalloc_PageMap1 {
+ private:
+  void** array_;
+
+ public:
+  typedef uintptr_t Number;
+
+  void init(void* (*allocator)(size_t)) {
+    array_ = reinterpret_cast<void**>((*allocator)(sizeof(void*) << BITS));
+    memset(array_, 0, sizeof(void*) << BITS);
+  }
+
+  // Ensure that the map contains initialized entries "x .. x+n-1".
+  // Returns true if successful, false if we could not allocate memory.
+  bool Ensure(Number, size_t) {
+    // Nothing to do since flat array was allocate at start
+    return true;
+  }
+
+  void PreallocateMoreMemory() {}
+
+  // REQUIRES "k" is in range "[0,2^BITS-1]".
+  // REQUIRES "k" has been ensured before.
+  //
+  // Return the current value for KEY.  Returns "Value()" if not
+  // yet set.
+  void* get(Number k) const {
+    return array_[k];
+  }
+
+  // REQUIRES "k" is in range "[0,2^BITS-1]".
+  // REQUIRES "k" has been ensured before.
+  //
+  // Sets the value for KEY.
+  void set(Number k, void* v) {
+    array_[k] = v;
+  }
+};
+
+// Two-level radix tree
+template <int BITS>
+class TCMalloc_PageMap2 {
+ private:
+  // Put 32 entries in the root and (2^BITS)/32 entries in each leaf.
+  static const int ROOT_BITS = 5;
+  static const int ROOT_LENGTH = 1 << ROOT_BITS;
+
+  static const int LEAF_BITS = BITS - ROOT_BITS;
+  static const int LEAF_LENGTH = 1 << LEAF_BITS;
+
+  // Leaf node
+  struct Leaf {
+    void* values[LEAF_LENGTH];
+  };
+
+  Leaf* root_[ROOT_LENGTH];             // Pointers to 32 child nodes
+  void* (*allocator_)(size_t);          // Memory allocator
+
+ public:
+  typedef uintptr_t Number;
+
+  void init(void* (*allocator)(size_t)) {
+    allocator_ = allocator;
+    memset(root_, 0, sizeof(root_));
+  }
+
+  void* get(Number k) const {
+    ASSERT(k >> BITS == 0);
+    const Number i1 = k >> LEAF_BITS;
+    const Number i2 = k & (LEAF_LENGTH-1);
+    return root_[i1]->values[i2];
+  }
+
+  void set(Number k, void* v) {
+    ASSERT(k >> BITS == 0);
+    const Number i1 = k >> LEAF_BITS;
+    const Number i2 = k & (LEAF_LENGTH-1);
+    root_[i1]->values[i2] = v;
+  }
+
+  bool Ensure(Number start, size_t n) {
+    for (Number key = start; key <= start + n - 1; ) {
+      const Number i1 = key >> LEAF_BITS;
+
+      // Make 2nd level node if necessary
+      if (root_[i1] == NULL) {
+        Leaf* leaf = reinterpret_cast<Leaf*>((*allocator_)(sizeof(Leaf)));
+        if (leaf == NULL) return false;
+        memset(leaf, 0, sizeof(*leaf));
+        root_[i1] = leaf;
+      }
+
+      // Advance key past whatever is covered by this leaf node
+      key = ((key >> LEAF_BITS) + 1) << LEAF_BITS;
+    }
+    return true;
+  }
+
+  void PreallocateMoreMemory() {
+    // Allocate enough to keep track of all possible pages
+    Ensure(0, 1 << BITS);
+  }
+
+#ifdef WTF_CHANGES
+  template<class Visitor, class MemoryReader>
+  void visitValues(Visitor& visitor, const MemoryReader& reader)
+  {
+    for (int i = 0; i < ROOT_LENGTH; i++) {
+      if (!root_[i])
+        continue;
+
+      Leaf* l = reader(reinterpret_cast<Leaf*>(root_[i]));
+      for (int j = 0; j < LEAF_LENGTH; j += visitor.visit(l->values[j]))
+        ;
+    }
+  }
+
+  template<class Visitor, class MemoryReader>
+  void visitAllocations(Visitor& visitor, const MemoryReader&) {
+    for (int i = 0; i < ROOT_LENGTH; i++) {
+      if (root_[i])
+        visitor.visit(root_[i], sizeof(Leaf));
+    }
+  }
+#endif
+};
+
+// Three-level radix tree
+template <int BITS>
+class TCMalloc_PageMap3 {
+ private:
+  // How many bits should we consume at each interior level
+  static const int INTERIOR_BITS = (BITS + 2) / 3; // Round-up
+  static const int INTERIOR_LENGTH = 1 << INTERIOR_BITS;
+
+  // How many bits should we consume at leaf level
+  static const int LEAF_BITS = BITS - 2*INTERIOR_BITS;
+  static const int LEAF_LENGTH = 1 << LEAF_BITS;
+
+  // Interior node
+  struct Node {
+    Node* ptrs[INTERIOR_LENGTH];
+  };
+
+  // Leaf node
+  struct Leaf {
+    void* values[LEAF_LENGTH];
+  };
+
+  Node* root_;                          // Root of radix tree
+  void* (*allocator_)(size_t);          // Memory allocator
+
+  Node* NewNode() {
+    Node* result = reinterpret_cast<Node*>((*allocator_)(sizeof(Node)));
+    if (result != NULL) {
+      memset(result, 0, sizeof(*result));
+    }
+    return result;
+  }
+
+ public:
+  typedef uintptr_t Number;
+
+  void init(void* (*allocator)(size_t)) {
+    allocator_ = allocator;
+    root_ = NewNode();
+  }
+
+  void* get(Number k) const {
+    ASSERT(k >> BITS == 0);
+    const Number i1 = k >> (LEAF_BITS + INTERIOR_BITS);
+    const Number i2 = (k >> LEAF_BITS) & (INTERIOR_LENGTH-1);
+    const Number i3 = k & (LEAF_LENGTH-1);
+    return reinterpret_cast<Leaf*>(root_->ptrs[i1]->ptrs[i2])->values[i3];
+  }
+
+  void set(Number k, void* v) {
+    ASSERT(k >> BITS == 0);
+    const Number i1 = k >> (LEAF_BITS + INTERIOR_BITS);
+    const Number i2 = (k >> LEAF_BITS) & (INTERIOR_LENGTH-1);
+    const Number i3 = k & (LEAF_LENGTH-1);
+    reinterpret_cast<Leaf*>(root_->ptrs[i1]->ptrs[i2])->values[i3] = v;
+  }
+
+  bool Ensure(Number start, size_t n) {
+    for (Number key = start; key <= start + n - 1; ) {
+      const Number i1 = key >> (LEAF_BITS + INTERIOR_BITS);
+      const Number i2 = (key >> LEAF_BITS) & (INTERIOR_LENGTH-1);
+
+      // Make 2nd level node if necessary
+      if (root_->ptrs[i1] == NULL) {
+        Node* n = NewNode();
+        if (n == NULL) return false;
+        root_->ptrs[i1] = n;
+      }
+
+      // Make leaf node if necessary
+      if (root_->ptrs[i1]->ptrs[i2] == NULL) {
+        Leaf* leaf = reinterpret_cast<Leaf*>((*allocator_)(sizeof(Leaf)));
+        if (leaf == NULL) return false;
+        memset(leaf, 0, sizeof(*leaf));
+        root_->ptrs[i1]->ptrs[i2] = reinterpret_cast<Node*>(leaf);
+      }
+
+      // Advance key past whatever is covered by this leaf node
+      key = ((key >> LEAF_BITS) + 1) << LEAF_BITS;
+    }
+    return true;
+  }
+
+  void PreallocateMoreMemory() {
+  }
+
+#ifdef WTF_CHANGES
+  template<class Visitor, class MemoryReader>
+  void visitValues(Visitor& visitor, const MemoryReader& reader) {
+    Node* root = reader(root_);
+    for (int i = 0; i < INTERIOR_LENGTH; i++) {
+      if (!root->ptrs[i])
+        continue;
+
+      Node* n = reader(root->ptrs[i]);
+      for (int j = 0; j < INTERIOR_LENGTH; j++) {
+        if (!n->ptrs[j])
+          continue;
+
+        Leaf* l = reader(reinterpret_cast<Leaf*>(n->ptrs[j]));
+        for (int k = 0; k < LEAF_LENGTH; k += visitor.visit(l->values[k]))
+          ;
+      }
+    }
+  }
+
+  template<class Visitor, class MemoryReader>
+  void visitAllocations(Visitor& visitor, const MemoryReader& reader) {
+    visitor.visit(root_, sizeof(Node));
+
+    Node* root = reader(root_);
+    for (int i = 0; i < INTERIOR_LENGTH; i++) {
+      if (!root->ptrs[i])
+        continue;
+
+      visitor.visit(root->ptrs[i], sizeof(Node));
+      Node* n = reader(root->ptrs[i]);
+      for (int j = 0; j < INTERIOR_LENGTH; j++) {
+        if (!n->ptrs[j])
+          continue;
+
+        visitor.visit(n->ptrs[j], sizeof(Leaf));
+      }
+    }
+  }
+#endif
+};
+
+#endif  // TCMALLOC_PAGEMAP_H__
diff --git a/Source/WTF/wtf/TCSpinLock.h b/Source/WTF/wtf/TCSpinLock.h
new file mode 100644
index 0000000..d8eddcf
--- /dev/null
+++ b/Source/WTF/wtf/TCSpinLock.h
@@ -0,0 +1,133 @@
+// Copyright (c) 2005, 2006, Google Inc.
+// Copyright (c) 2010, Patrick Gansterer <paroga@paroga.com>
+// 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.
+//     * 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.
+//     * 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.
+
+// ---
+// Author: Sanjay Ghemawat <opensource@google.com>
+
+#ifndef TCMALLOC_INTERNAL_SPINLOCK_H__
+#define TCMALLOC_INTERNAL_SPINLOCK_H__
+
+#include <wtf/Atomics.h>
+#if OS(UNIX)
+#include <sched.h>
+#endif
+
+#if ENABLE(COMPARE_AND_SWAP)
+
+static void TCMalloc_SlowLock(unsigned* lockword);
+
+// The following is a struct so that it can be initialized at compile time
+struct TCMalloc_SpinLock {
+    void Lock() {
+      if (!WTF::weakCompareAndSwap(&lockword_, 0, 1))
+        TCMalloc_SlowLock(&lockword_);
+      WTF::memoryBarrierAfterLock();
+    }
+
+    void Unlock() {
+      WTF::memoryBarrierBeforeUnlock();
+      lockword_ = 0;
+    }
+
+    // Report if we think the lock can be held by this thread.
+    // When the lock is truly held by the invoking thread
+    // we will always return true.
+    // Indended to be used as CHECK(lock.IsHeld());
+    bool IsHeld() const {
+        return lockword_ != 0;
+    }
+
+    void Init() { lockword_ = 0; }
+    void Finalize() { }
+
+    unsigned lockword_;
+};
+
+#define SPINLOCK_INITIALIZER { 0 }
+
+static void TCMalloc_SlowLock(unsigned* lockword) {
+  do {
+#if OS(WINDOWS)
+    Sleep(0);
+#else
+    sched_yield();
+#endif
+  } while (!WTF::weakCompareAndSwap(lockword, 0, 1));
+}
+
+#else
+
+#include <pthread.h>
+
+// Portable version
+struct TCMalloc_SpinLock {
+  pthread_mutex_t private_lock_;
+
+  inline void Init() {
+    if (pthread_mutex_init(&private_lock_, NULL) != 0) CRASH();
+  }
+  inline void Finalize() {
+    if (pthread_mutex_destroy(&private_lock_) != 0) CRASH();
+  }
+  inline void Lock() {
+    if (pthread_mutex_lock(&private_lock_) != 0) CRASH();
+  }
+  inline void Unlock() {
+    if (pthread_mutex_unlock(&private_lock_) != 0) CRASH();
+  }
+  bool IsHeld() {
+    if (pthread_mutex_trylock(&private_lock_))
+      return true;
+
+    Unlock();
+    return false;
+  }
+};
+
+#define SPINLOCK_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
+
+#endif
+
+// Corresponding locker object that arranges to acquire a spinlock for
+// the duration of a C++ scope.
+class TCMalloc_SpinLockHolder {
+ private:
+  TCMalloc_SpinLock* lock_;
+ public:
+  inline explicit TCMalloc_SpinLockHolder(TCMalloc_SpinLock* l)
+    : lock_(l) { l->Lock(); }
+  inline ~TCMalloc_SpinLockHolder() { lock_->Unlock(); }
+};
+
+// Short-hands for convenient use by tcmalloc.cc
+typedef TCMalloc_SpinLock SpinLock;
+typedef TCMalloc_SpinLockHolder SpinLockHolder;
+
+#endif  // TCMALLOC_INTERNAL_SPINLOCK_H__
diff --git a/Source/WTF/wtf/TCSystemAlloc.cpp b/Source/WTF/wtf/TCSystemAlloc.cpp
new file mode 100644
index 0000000..f547085
--- /dev/null
+++ b/Source/WTF/wtf/TCSystemAlloc.cpp
@@ -0,0 +1,518 @@
+// Copyright (c) 2005, 2007, 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.
+//     * 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.
+//     * 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.
+
+// ---
+// Author: Sanjay Ghemawat
+
+#include "config.h"
+#if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC)
+#include "TCSystemAlloc.h"
+
+#include "Assertions.h"
+#include "TCSpinLock.h"
+#include "UnusedParam.h"
+#include "VMTags.h"
+#include <algorithm>
+#include <stdint.h>
+
+#if OS(WINDOWS)
+#include "windows.h"
+#else
+#include <errno.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#endif
+
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+using namespace std;
+
+// Structure for discovering alignment
+union MemoryAligner {
+  void*  p;
+  double d;
+  size_t s;
+};
+
+static SpinLock spinlock = SPINLOCK_INITIALIZER;
+
+// Page size is initialized on demand
+static size_t pagesize = 0;
+
+// Configuration parameters.
+//
+// if use_devmem is true, either use_sbrk or use_mmap must also be true.
+// For 2.2 kernels, it looks like the sbrk address space (500MBish) and
+// the mmap address space (1300MBish) are disjoint, so we need both allocators
+// to get as much virtual memory as possible.
+#ifndef WTF_CHANGES
+static bool use_devmem = false;
+static bool use_sbrk = false;
+#endif
+
+#if HAVE(MMAP)
+static bool use_mmap = true;
+#endif 
+
+#if HAVE(VIRTUALALLOC)
+static bool use_VirtualAlloc = true;
+#endif
+
+// Flags to keep us from retrying allocators that failed.
+static bool devmem_failure = false;
+static bool sbrk_failure = false;
+static bool mmap_failure = false;
+static bool VirtualAlloc_failure = false;
+
+#ifndef WTF_CHANGES
+DEFINE_int32(malloc_devmem_start, 0,
+             "Physical memory starting location in MB for /dev/mem allocation."
+             "  Setting this to 0 disables /dev/mem allocation");
+DEFINE_int32(malloc_devmem_limit, 0,
+             "Physical memory limit location in MB for /dev/mem allocation."
+             "  Setting this to 0 means no limit.");
+#else
+static const int32_t FLAGS_malloc_devmem_start = 0;
+static const int32_t FLAGS_malloc_devmem_limit = 0;
+#endif
+
+#ifndef WTF_CHANGES
+
+static void* TrySbrk(size_t size, size_t *actual_size, size_t alignment) {
+  size = ((size + alignment - 1) / alignment) * alignment;
+  
+  // could theoretically return the "extra" bytes here, but this
+  // is simple and correct.
+  if (actual_size) 
+    *actual_size = size;
+    
+  void* result = sbrk(size);
+  if (result == reinterpret_cast<void*>(-1)) {
+    sbrk_failure = true;
+    return NULL;
+  }
+
+  // Is it aligned?
+  uintptr_t ptr = reinterpret_cast<uintptr_t>(result);
+  if ((ptr & (alignment-1)) == 0)  return result;
+
+  // Try to get more memory for alignment
+  size_t extra = alignment - (ptr & (alignment-1));
+  void* r2 = sbrk(extra);
+  if (reinterpret_cast<uintptr_t>(r2) == (ptr + size)) {
+    // Contiguous with previous result
+    return reinterpret_cast<void*>(ptr + extra);
+  }
+
+  // Give up and ask for "size + alignment - 1" bytes so
+  // that we can find an aligned region within it.
+  result = sbrk(size + alignment - 1);
+  if (result == reinterpret_cast<void*>(-1)) {
+    sbrk_failure = true;
+    return NULL;
+  }
+  ptr = reinterpret_cast<uintptr_t>(result);
+  if ((ptr & (alignment-1)) != 0) {
+    ptr += alignment - (ptr & (alignment-1));
+  }
+  return reinterpret_cast<void*>(ptr);
+}
+
+#endif /* ifndef(WTF_CHANGES) */
+
+#if HAVE(MMAP)
+
+static void* TryMmap(size_t size, size_t *actual_size, size_t alignment) {
+  // Enforce page alignment
+  if (pagesize == 0) pagesize = getpagesize();
+  if (alignment < pagesize) alignment = pagesize;
+  size = ((size + alignment - 1) / alignment) * alignment;
+  
+  // could theoretically return the "extra" bytes here, but this
+  // is simple and correct.
+  if (actual_size) 
+    *actual_size = size;
+    
+  // Ask for extra memory if alignment > pagesize
+  size_t extra = 0;
+  if (alignment > pagesize) {
+    extra = alignment - pagesize;
+  }
+  void* result = mmap(NULL, size + extra,
+                      PROT_READ | PROT_WRITE,
+                      MAP_PRIVATE|MAP_ANONYMOUS,
+                      VM_TAG_FOR_TCMALLOC_MEMORY, 0);
+  if (result == reinterpret_cast<void*>(MAP_FAILED)) {
+    mmap_failure = true;
+    return NULL;
+  }
+
+  // Adjust the return memory so it is aligned
+  uintptr_t ptr = reinterpret_cast<uintptr_t>(result);
+  size_t adjust = 0;
+  if ((ptr & (alignment - 1)) != 0) {
+    adjust = alignment - (ptr & (alignment - 1));
+  }
+
+  // Return the unused memory to the system
+  if (adjust > 0) {
+    munmap(reinterpret_cast<void*>(ptr), adjust);
+  }
+  if (adjust < extra) {
+    munmap(reinterpret_cast<void*>(ptr + adjust + size), extra - adjust);
+  }
+
+  ptr += adjust;
+  return reinterpret_cast<void*>(ptr);
+}
+
+#endif /* HAVE(MMAP) */
+
+#if HAVE(VIRTUALALLOC)
+
+static void* TryVirtualAlloc(size_t size, size_t *actual_size, size_t alignment) {
+  // Enforce page alignment
+  if (pagesize == 0) {
+    SYSTEM_INFO system_info;
+    GetSystemInfo(&system_info);
+    pagesize = system_info.dwPageSize;
+  }
+
+  if (alignment < pagesize) alignment = pagesize;
+  size = ((size + alignment - 1) / alignment) * alignment;
+
+  // could theoretically return the "extra" bytes here, but this
+  // is simple and correct.
+  if (actual_size) 
+    *actual_size = size;
+    
+  // Ask for extra memory if alignment > pagesize
+  size_t extra = 0;
+  if (alignment > pagesize) {
+    extra = alignment - pagesize;
+  }
+  void* result = VirtualAlloc(NULL, size + extra,
+                              MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, 
+                              PAGE_READWRITE);
+
+  if (result == NULL) {
+    VirtualAlloc_failure = true;
+    return NULL;
+  }
+
+  // Adjust the return memory so it is aligned
+  uintptr_t ptr = reinterpret_cast<uintptr_t>(result);
+  size_t adjust = 0;
+  if ((ptr & (alignment - 1)) != 0) {
+    adjust = alignment - (ptr & (alignment - 1));
+  }
+
+  // Return the unused memory to the system - we'd like to release but the best we can do
+  // is decommit, since Windows only lets you free the whole allocation.
+  if (adjust > 0) {
+    VirtualFree(reinterpret_cast<void*>(ptr), adjust, MEM_DECOMMIT);
+  }
+  if (adjust < extra) {
+    VirtualFree(reinterpret_cast<void*>(ptr + adjust + size), extra-adjust, MEM_DECOMMIT);
+  }
+
+  ptr += adjust;
+  return reinterpret_cast<void*>(ptr);
+}
+
+#endif /* HAVE(MMAP) */
+
+#ifndef WTF_CHANGES
+static void* TryDevMem(size_t size, size_t *actual_size, size_t alignment) {
+  static bool initialized = false;
+  static off_t physmem_base;  // next physical memory address to allocate
+  static off_t physmem_limit; // maximum physical address allowed
+  static int physmem_fd;      // file descriptor for /dev/mem
+  
+  // Check if we should use /dev/mem allocation.  Note that it may take
+  // a while to get this flag initialized, so meanwhile we fall back to
+  // the next allocator.  (It looks like 7MB gets allocated before
+  // this flag gets initialized -khr.)
+  if (FLAGS_malloc_devmem_start == 0) {
+    // NOTE: not a devmem_failure - we'd like TCMalloc_SystemAlloc to
+    // try us again next time.
+    return NULL;
+  }
+  
+  if (!initialized) {
+    physmem_fd = open("/dev/mem", O_RDWR);
+    if (physmem_fd < 0) {
+      devmem_failure = true;
+      return NULL;
+    }
+    physmem_base = FLAGS_malloc_devmem_start*1024LL*1024LL;
+    physmem_limit = FLAGS_malloc_devmem_limit*1024LL*1024LL;
+    initialized = true;
+  }
+  
+  // Enforce page alignment
+  if (pagesize == 0) pagesize = getpagesize();
+  if (alignment < pagesize) alignment = pagesize;
+  size = ((size + alignment - 1) / alignment) * alignment;
+    
+  // could theoretically return the "extra" bytes here, but this
+  // is simple and correct.
+  if (actual_size)
+    *actual_size = size;
+    
+  // Ask for extra memory if alignment > pagesize
+  size_t extra = 0;
+  if (alignment > pagesize) {
+    extra = alignment - pagesize;
+  }
+  
+  // check to see if we have any memory left
+  if (physmem_limit != 0 && physmem_base + size + extra > physmem_limit) {
+    devmem_failure = true;
+    return NULL;
+  }
+  void *result = mmap(0, size + extra, PROT_READ | PROT_WRITE,
+                      MAP_SHARED, physmem_fd, physmem_base);
+  if (result == reinterpret_cast<void*>(MAP_FAILED)) {
+    devmem_failure = true;
+    return NULL;
+  }
+  uintptr_t ptr = reinterpret_cast<uintptr_t>(result);
+  
+  // Adjust the return memory so it is aligned
+  size_t adjust = 0;
+  if ((ptr & (alignment - 1)) != 0) {
+    adjust = alignment - (ptr & (alignment - 1));
+  }
+  
+  // Return the unused virtual memory to the system
+  if (adjust > 0) {
+    munmap(reinterpret_cast<void*>(ptr), adjust);
+  }
+  if (adjust < extra) {
+    munmap(reinterpret_cast<void*>(ptr + adjust + size), extra - adjust);
+  }
+  
+  ptr += adjust;
+  physmem_base += adjust + size;
+  
+  return reinterpret_cast<void*>(ptr);
+}
+#endif
+
+void* TCMalloc_SystemAlloc(size_t size, size_t *actual_size, size_t alignment) {
+  // Discard requests that overflow
+  if (size + alignment < size) return NULL;
+    
+  SpinLockHolder lock_holder(&spinlock);
+
+  // Enforce minimum alignment
+  if (alignment < sizeof(MemoryAligner)) alignment = sizeof(MemoryAligner);
+
+  // Try twice, once avoiding allocators that failed before, and once
+  // more trying all allocators even if they failed before.
+  for (int i = 0; i < 2; i++) {
+
+#ifndef WTF_CHANGES
+    if (use_devmem && !devmem_failure) {
+      void* result = TryDevMem(size, actual_size, alignment);
+      if (result != NULL) return result;
+    }
+    
+    if (use_sbrk && !sbrk_failure) {
+      void* result = TrySbrk(size, actual_size, alignment);
+      if (result != NULL) return result;
+    }
+#endif
+
+#if HAVE(MMAP)    
+    if (use_mmap && !mmap_failure) {
+      void* result = TryMmap(size, actual_size, alignment);
+      if (result != NULL) return result;
+    }
+#endif
+
+#if HAVE(VIRTUALALLOC)
+    if (use_VirtualAlloc && !VirtualAlloc_failure) {
+      void* result = TryVirtualAlloc(size, actual_size, alignment);
+      if (result != NULL) return result;
+    }
+#endif
+
+    // nothing worked - reset failure flags and try again
+    devmem_failure = false;
+    sbrk_failure = false;
+    mmap_failure = false;
+    VirtualAlloc_failure = false;
+  }
+  return NULL;
+}
+
+#if HAVE(MADV_FREE_REUSE)
+
+void TCMalloc_SystemRelease(void* start, size_t length)
+{
+    int madviseResult;
+
+    while ((madviseResult = madvise(start, length, MADV_FREE_REUSABLE)) == -1 && errno == EAGAIN) { }
+
+    // Although really advisory, if madvise fail, we want to know about it.
+    ASSERT_UNUSED(madviseResult, madviseResult != -1);
+}
+
+#elif HAVE(MADV_FREE) || HAVE(MADV_DONTNEED)
+
+void TCMalloc_SystemRelease(void* start, size_t length)
+{
+    // MADV_FREE clears the modified bit on pages, which allows
+    // them to be discarded immediately.
+#if HAVE(MADV_FREE)
+    const int advice = MADV_FREE;
+#else
+    const int advice = MADV_DONTNEED;
+#endif
+  if (FLAGS_malloc_devmem_start) {
+    // It's not safe to use MADV_DONTNEED if we've been mapping
+    // /dev/mem for heap memory
+    return;
+  }
+  if (pagesize == 0) pagesize = getpagesize();
+  const size_t pagemask = pagesize - 1;
+
+  size_t new_start = reinterpret_cast<size_t>(start);
+  size_t end = new_start + length;
+  size_t new_end = end;
+
+  // Round up the starting address and round down the ending address
+  // to be page aligned:
+  new_start = (new_start + pagesize - 1) & ~pagemask;
+  new_end = new_end & ~pagemask;
+
+  ASSERT((new_start & pagemask) == 0);
+  ASSERT((new_end & pagemask) == 0);
+  ASSERT(new_start >= reinterpret_cast<size_t>(start));
+  ASSERT(new_end <= end);
+
+  if (new_end > new_start) {
+    // Note -- ignoring most return codes, because if this fails it
+    // doesn't matter...
+    while (madvise(reinterpret_cast<char*>(new_start), new_end - new_start,
+                   advice) == -1 &&
+           errno == EAGAIN) {
+      // NOP
+    }
+  }
+}
+
+#elif HAVE(MMAP)
+
+void TCMalloc_SystemRelease(void* start, size_t length)
+{
+  void* newAddress = mmap(start, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
+  // If the mmap failed then that's ok, we just won't return the memory to the system.
+  ASSERT_UNUSED(newAddress, newAddress == start || newAddress == reinterpret_cast<void*>(MAP_FAILED));
+}
+
+#elif HAVE(VIRTUALALLOC)
+
+void TCMalloc_SystemRelease(void* start, size_t length)
+{
+    if (VirtualFree(start, length, MEM_DECOMMIT))
+        return;
+
+    // The decommit may fail if the memory region consists of allocations
+    // from more than one call to VirtualAlloc.  In this case, fall back to
+    // using VirtualQuery to retrieve the allocation boundaries and decommit
+    // them each individually.
+
+    char* ptr = static_cast<char*>(start);
+    char* end = ptr + length;
+    MEMORY_BASIC_INFORMATION info;
+    while (ptr < end) {
+        size_t resultSize = VirtualQuery(ptr, &info, sizeof(info));
+        ASSERT_UNUSED(resultSize, resultSize == sizeof(info));
+
+        size_t decommitSize = min<size_t>(info.RegionSize, end - ptr);
+        BOOL success = VirtualFree(ptr, decommitSize, MEM_DECOMMIT);
+        ASSERT_UNUSED(success, success);
+        ptr += decommitSize;
+    }
+}
+
+#else
+
+// Platforms that don't support returning memory use an empty inline version of TCMalloc_SystemRelease
+// declared in TCSystemAlloc.h
+
+#endif
+
+#if HAVE(MADV_FREE_REUSE)
+
+void TCMalloc_SystemCommit(void* start, size_t length)
+{
+    while (madvise(start, length, MADV_FREE_REUSE) == -1 && errno == EAGAIN) { }
+}
+
+#elif HAVE(VIRTUALALLOC)
+
+void TCMalloc_SystemCommit(void* start, size_t length)
+{
+    if (VirtualAlloc(start, length, MEM_COMMIT, PAGE_READWRITE) == start)
+        return;
+
+    // The commit may fail if the memory region consists of allocations
+    // from more than one call to VirtualAlloc.  In this case, fall back to
+    // using VirtualQuery to retrieve the allocation boundaries and commit them
+    // each individually.
+
+    char* ptr = static_cast<char*>(start);
+    char* end = ptr + length;
+    MEMORY_BASIC_INFORMATION info;
+    while (ptr < end) {
+        size_t resultSize = VirtualQuery(ptr, &info, sizeof(info));
+        ASSERT_UNUSED(resultSize, resultSize == sizeof(info));
+
+        size_t commitSize = min<size_t>(info.RegionSize, end - ptr);
+        void* newAddress = VirtualAlloc(ptr, commitSize, MEM_COMMIT, PAGE_READWRITE);
+        ASSERT_UNUSED(newAddress, newAddress == ptr);
+        ptr += commitSize;
+    }
+}
+
+#else
+
+// Platforms that don't need to explicitly commit memory use an empty inline version of TCMalloc_SystemCommit
+// declared in TCSystemAlloc.h
+
+#endif
+
+#endif // #if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC)
+
diff --git a/Source/WTF/wtf/TCSystemAlloc.h b/Source/WTF/wtf/TCSystemAlloc.h
new file mode 100644
index 0000000..1c67788
--- /dev/null
+++ b/Source/WTF/wtf/TCSystemAlloc.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2005, 2007, 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.
+//     * 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.
+//     * 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.
+
+// ---
+// Author: Sanjay Ghemawat
+//
+// Routine that uses sbrk/mmap to allocate memory from the system.
+// Useful for implementing malloc.
+
+#ifndef TCMALLOC_SYSTEM_ALLOC_H__
+#define TCMALLOC_SYSTEM_ALLOC_H__
+
+// REQUIRES: "alignment" is a power of two or "0" to indicate default alignment
+//
+// Allocate and return "N" bytes of zeroed memory.
+//
+// If actual_bytes is NULL then the returned memory is exactly the
+// requested size.  If actual bytes is non-NULL then the allocator
+// may optionally return more bytes than asked for (i.e. return an
+// entire "huge" page if a huge page allocator is in use).
+//
+// The returned pointer is a multiple of "alignment" if non-zero.
+//
+// Returns NULL when out of memory.
+extern void* TCMalloc_SystemAlloc(size_t bytes, size_t *actual_bytes,
+                                  size_t alignment = 0);
+
+// This call is a hint to the operating system that the pages
+// contained in the specified range of memory will not be used for a
+// while, and can be released for use by other processes or the OS.
+// Pages which are released in this way may be destroyed (zeroed) by
+// the OS.  The benefit of this function is that it frees memory for
+// use by the system, the cost is that the pages are faulted back into
+// the address space next time they are touched, which can impact
+// performance.  (Only pages fully covered by the memory region will
+// be released, partial pages will not.)
+extern void TCMalloc_SystemRelease(void* start, size_t length);
+
+extern void TCMalloc_SystemCommit(void* start, size_t length);
+
+#if !HAVE(MADV_FREE_REUSE) && !HAVE(MADV_DONTNEED) && !HAVE(MMAP) && !HAVE(VIRTUALALLOC)
+inline void TCMalloc_SystemRelease(void*, size_t) { }
+#endif
+
+#if !HAVE(VIRTUALALLOC) && !HAVE(MADV_FREE_REUSE)
+inline void TCMalloc_SystemCommit(void*, size_t) { }
+#endif
+
+#endif /* TCMALLOC_SYSTEM_ALLOC_H__ */
diff --git a/Source/WTF/wtf/TemporaryChange.h b/Source/WTF/wtf/TemporaryChange.h
new file mode 100644
index 0000000..95df172
--- /dev/null
+++ b/Source/WTF/wtf/TemporaryChange.h
@@ -0,0 +1,68 @@
+/*
+ * 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:
+ *
+ * 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 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 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.
+ */
+
+#ifndef TemporaryChange_h
+#define TemporaryChange_h
+
+#include <wtf/Noncopyable.h>
+
+namespace WTF {
+
+// TemporaryChange<> is useful for setting a variable to a new value only within a
+// particular scope. An TemporaryChange<> object changes a variable to its original
+// value upon destruction, making it an alternative to writing "var = false;"
+// or "var = oldVal;" at all of a block's exit points.
+//
+// This should be obvious, but note that an TemporaryChange<> instance should have a
+// shorter lifetime than its scopedVariable, to prevent invalid memory writes
+// when the TemporaryChange<> object is destroyed.
+
+template<typename T>
+class TemporaryChange {
+    WTF_MAKE_NONCOPYABLE(TemporaryChange);
+public:
+    TemporaryChange(T& scopedVariable, T newValue)
+        : m_scopedVariable(scopedVariable)
+        , m_originalValue(scopedVariable)
+    {
+        m_scopedVariable = newValue;
+    }
+
+    ~TemporaryChange()
+    {
+        m_scopedVariable = m_originalValue;
+    }
+
+
+private:
+    T& m_scopedVariable;
+    T m_originalValue;
+};
+
+}
+
+using WTF::TemporaryChange;
+
+#endif
diff --git a/Source/WTF/wtf/ThreadFunctionInvocation.h b/Source/WTF/wtf/ThreadFunctionInvocation.h
new file mode 100644
index 0000000..2d8599e
--- /dev/null
+++ b/Source/WTF/wtf/ThreadFunctionInvocation.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2007, 2008 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef ThreadFunctionInvocation_h
+#define ThreadFunctionInvocation_h
+
+namespace WTF {
+
+typedef void (*ThreadFunction)(void* argument);
+
+struct ThreadFunctionInvocation {
+    ThreadFunctionInvocation(ThreadFunction function, void* data)
+        : function(function)
+        , data(data)
+    {
+    }
+
+    ThreadFunction function;
+    void* data;
+};
+
+} // namespace WTF
+
+#endif // ThreadFunctionInvocation_h
diff --git a/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp b/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp
new file mode 100644
index 0000000..4ad20c8
--- /dev/null
+++ b/Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2009, 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.
+ *     * 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.
+ *     * 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"
+
+#if USE(PTHREADS)
+
+#include "ThreadIdentifierDataPthreads.h"
+
+#include "Threading.h"
+
+#if OS(ANDROID) || OS(HURD)
+// PTHREAD_KEYS_MAX is not defined in bionic nor in Hurd, so explicitly define it here.
+#define PTHREAD_KEYS_MAX 1024
+#else
+#include <limits.h>
+#endif
+
+namespace WTF {
+
+pthread_key_t ThreadIdentifierData::m_key = PTHREAD_KEYS_MAX;
+
+void threadDidExit(ThreadIdentifier);
+
+ThreadIdentifierData::~ThreadIdentifierData()
+{
+    threadDidExit(m_identifier);
+}
+
+void ThreadIdentifierData::initializeOnce()
+{
+    if (pthread_key_create(&m_key, destruct))
+        CRASH();
+}
+
+ThreadIdentifier ThreadIdentifierData::identifier()
+{
+    ASSERT(m_key != PTHREAD_KEYS_MAX);
+    ThreadIdentifierData* threadIdentifierData = static_cast<ThreadIdentifierData*>(pthread_getspecific(m_key));
+
+    return threadIdentifierData ? threadIdentifierData->m_identifier : 0;
+}
+
+void ThreadIdentifierData::initialize(ThreadIdentifier id)
+{
+    ASSERT(!identifier());
+    pthread_setspecific(m_key, new ThreadIdentifierData(id));
+}
+
+void ThreadIdentifierData::destruct(void* data)
+{
+    ThreadIdentifierData* threadIdentifierData = static_cast<ThreadIdentifierData*>(data);
+    ASSERT(threadIdentifierData);
+
+    if (threadIdentifierData->m_isDestroyedOnce) {
+        delete threadIdentifierData;
+        return;
+    }
+
+    threadIdentifierData->m_isDestroyedOnce = true;
+    // Re-setting the value for key causes another destruct() call after all other thread-specific destructors were called.
+    pthread_setspecific(m_key, threadIdentifierData);
+}
+
+} // namespace WTF
+
+#endif // USE(PTHREADS)
diff --git a/Source/WTF/wtf/ThreadIdentifierDataPthreads.h b/Source/WTF/wtf/ThreadIdentifierDataPthreads.h
new file mode 100644
index 0000000..84349a0
--- /dev/null
+++ b/Source/WTF/wtf/ThreadIdentifierDataPthreads.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2009 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.
+ *     * 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.
+ *     * 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 ThreadIdentifierDataPthreads_h
+#define ThreadIdentifierDataPthreads_h
+
+#include <wtf/Threading.h>
+
+namespace WTF {
+
+// Holds ThreadIdentifier in the thread-specific storage and employs pthreads-specific 2-pass destruction to reliably remove
+// ThreadIdentifier from threadMap. It assumes regular ThreadSpecific types don't use multiple-pass destruction.
+class ThreadIdentifierData {
+    WTF_MAKE_NONCOPYABLE(ThreadIdentifierData);
+public:
+    ~ThreadIdentifierData();
+
+    // One time initialization for this class as a whole.
+    // This method must be called before initialize() and it is not thread-safe.
+    static void initializeOnce();
+
+    // Creates and puts an instance of ThreadIdentifierData into thread-specific storage.
+    static void initialize(ThreadIdentifier identifier);
+
+    // Returns 0 if thread-specific storage was not initialized.
+    static ThreadIdentifier identifier();
+
+private:
+    ThreadIdentifierData(ThreadIdentifier identifier)
+        : m_identifier(identifier)
+        , m_isDestroyedOnce(false)
+    {
+    }
+
+    // This thread-specific destructor is called 2 times when thread terminates:
+    // - first, when all the other thread-specific destructors are called, it simply remembers it was 'destroyed once'
+    // and re-sets itself into the thread-specific slot to make Pthreads to call it again later.
+    // - second, after all thread-specific destructors were invoked, it gets called again - this time, we remove the
+    // ThreadIdentifier from the threadMap, completing the cleanup.
+    static void destruct(void* data);
+
+    ThreadIdentifier m_identifier;
+    bool m_isDestroyedOnce;
+    static pthread_key_t m_key;
+};
+
+} // namespace WTF
+
+#endif // ThreadIdentifierDataPthreads_h
+
+
diff --git a/Source/WTF/wtf/ThreadRestrictionVerifier.h b/Source/WTF/wtf/ThreadRestrictionVerifier.h
new file mode 100644
index 0000000..cff49d3
--- /dev/null
+++ b/Source/WTF/wtf/ThreadRestrictionVerifier.h
@@ -0,0 +1,209 @@
+/*
+ * 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.
+ *     * 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.
+ *     * 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 ThreadRestrictionVerifier_h
+#define ThreadRestrictionVerifier_h
+
+#include <wtf/Assertions.h>
+#include <wtf/Threading.h>
+#include <wtf/ThreadingPrimitives.h>
+
+#if HAVE(DISPATCH_H)
+#include <dispatch/dispatch.h>
+#endif
+
+#ifndef NDEBUG
+
+namespace WTF {
+
+// Verifies that a class is used in a way that respects its lack of thread-safety.
+// The default mode is to verify that the object will only be used on a single thread. The
+// thread gets captured when setShared(true) is called.
+// The mode may be changed by calling useMutexMode (or turnOffVerification).
+#if !USE(JSC) // This verifier is completely wrong for JavaScript implementations that use threads
+class ThreadRestrictionVerifier {
+public:
+    ThreadRestrictionVerifier()
+        : m_mode(SingleThreadVerificationMode)
+        , m_shared(false)
+        , m_owningThread(0)
+        , m_mutex(0)
+#if HAVE(DISPATCH_H)
+        , m_owningQueue(0)
+#endif
+    {
+    }
+
+#if HAVE(DISPATCH_H)
+    ~ThreadRestrictionVerifier()
+    {
+        if (m_owningQueue)
+            dispatch_release(m_owningQueue);
+    }
+#endif
+
+    void setMutexMode(Mutex& mutex)
+    {
+        m_mode = MutexVerificationMode;
+        m_mutex = &mutex;
+    }
+
+#if HAVE(DISPATCH_H)
+    void setDispatchQueueMode(dispatch_queue_t queue)
+    {
+        m_mode = SingleDispatchQueueVerificationMode;
+        m_owningQueue = queue;
+        dispatch_retain(m_owningQueue);
+    }
+#endif
+
+    void turnOffVerification()
+    {
+        m_mode = NoVerificationMode;
+    }
+
+    // Indicates that the object may (or may not) be owned by more than one place.
+    void setShared(bool shared)
+    {
+#if !ASSERT_DISABLED
+        bool previouslyShared = m_shared;
+#endif
+        m_shared = shared;
+
+        if (!m_shared)
+            return;
+
+        switch (m_mode) {
+        case SingleThreadVerificationMode:
+            ASSERT(shared != previouslyShared);
+            // Capture the current thread to verify that subsequent ref/deref happen on this thread.
+            m_owningThread = currentThread();
+            return;
+
+#if HAVE(DISPATCH_H)
+        case SingleDispatchQueueVerificationMode:
+#endif
+        case MutexVerificationMode:
+        case NoVerificationMode:
+            return;
+        }
+        ASSERT_NOT_REACHED();
+    }
+
+    // Is it OK to use the object at this moment on the current thread?
+    bool isSafeToUse() const
+    {
+        if (!m_shared)
+            return true;
+
+        switch (m_mode) {
+        case SingleThreadVerificationMode:
+            return m_owningThread == currentThread();
+
+        case MutexVerificationMode:
+            if (!m_mutex->tryLock())
+                return true;
+            m_mutex->unlock();
+            return false;
+
+#if HAVE(DISPATCH_H)
+        case SingleDispatchQueueVerificationMode:
+            return m_owningQueue == dispatch_get_current_queue();
+#endif
+
+        case NoVerificationMode:
+            return true;
+        }
+        ASSERT_NOT_REACHED();
+        return true;
+    }
+
+private:
+    enum VerificationMode {
+        SingleThreadVerificationMode,
+        MutexVerificationMode,
+        NoVerificationMode,
+#if HAVE(DISPATCH_H)
+        SingleDispatchQueueVerificationMode,
+#endif
+    };
+
+    VerificationMode m_mode;
+    bool m_shared;
+
+    // Used by SingleThreadVerificationMode
+    ThreadIdentifier m_owningThread;
+
+    // Used by MutexVerificationMode.
+    Mutex* m_mutex;
+
+#if HAVE(DISPATCH_H)
+    // Used by SingleDispatchQueueVerificationMode.
+    dispatch_queue_t m_owningQueue;
+#endif
+};
+#else // !USE(JSC) => so the JSC case
+class ThreadRestrictionVerifier {
+public:
+    ThreadRestrictionVerifier()
+    {
+    }
+
+    void setMutexMode(Mutex&)
+    {
+    }
+
+#if HAVE(DISPATCH_H)
+    void setDispatchQueueMode(dispatch_queue_t)
+    {
+    }
+#endif
+
+    void turnOffVerification()
+    {
+    }
+
+    // Indicates that the object may (or may not) be owned by more than one place.
+    void setShared(bool)
+    {
+    }
+
+    // Is it OK to use the object at this moment on the current thread?
+    bool isSafeToUse() const
+    {
+        return true;
+    }
+};
+#endif
+
+}
+
+#endif
+#endif
diff --git a/Source/WTF/wtf/ThreadSafeRefCounted.h b/Source/WTF/wtf/ThreadSafeRefCounted.h
new file mode 100644
index 0000000..44035e5
--- /dev/null
+++ b/Source/WTF/wtf/ThreadSafeRefCounted.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ *
+ *
+ * Note: The implementations of InterlockedIncrement and InterlockedDecrement are based
+ * on atomic_increment and atomic_exchange_and_add from the Boost C++ Library. The license
+ * is virtually identical to the Apple license above but is included here for completeness.
+ *
+ * Boost Software License - Version 1.0 - August 17th, 2003
+ * 
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation covered by
+ * this license (the "Software") to use, reproduce, display, distribute,
+ * execute, and transmit the Software, and to prepare derivative works of the
+ * Software, and to permit third-parties to whom the Software is furnished to
+ * do so, all subject to the following:
+ * 
+ * The copyright notices in the Software and this entire statement, including
+ * the above license grant, this restriction and the following disclaimer,
+ * must be included in all copies of the Software, in whole or in part, and
+ * all derivative works of the Software, unless such copies or derivative
+ * works are solely in the form of machine-executable object code generated by
+ * a source language processor.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef ThreadSafeRefCounted_h
+#define ThreadSafeRefCounted_h
+
+#include <wtf/Platform.h>
+
+#include <wtf/Atomics.h>
+#include <wtf/DynamicAnnotations.h>
+#include <wtf/ThreadingPrimitives.h>
+
+namespace WTF {
+
+class ThreadSafeRefCountedBase {
+    WTF_MAKE_NONCOPYABLE(ThreadSafeRefCountedBase);
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    ThreadSafeRefCountedBase(int initialRefCount = 1)
+        : m_refCount(initialRefCount)
+    {
+    }
+
+    void ref()
+    {
+#if USE(LOCKFREE_THREADSAFEREFCOUNTED)
+        atomicIncrement(&m_refCount);
+#else
+        MutexLocker locker(m_mutex);
+        ++m_refCount;
+#endif
+    }
+
+    bool hasOneRef()
+    {
+        return refCount() == 1;
+    }
+
+    int refCount() const
+    {
+#if !USE(LOCKFREE_THREADSAFEREFCOUNTED)
+        MutexLocker locker(m_mutex);
+#endif
+        return static_cast<int const volatile &>(m_refCount);
+    }
+
+protected:
+    // Returns whether the pointer should be freed or not.
+    bool derefBase()
+    {
+#if USE(LOCKFREE_THREADSAFEREFCOUNTED)
+        WTF_ANNOTATE_HAPPENS_BEFORE(&m_refCount);
+        if (atomicDecrement(&m_refCount) <= 0) {
+            WTF_ANNOTATE_HAPPENS_AFTER(&m_refCount);
+            return true;
+        }
+#else
+        int refCount;
+        {
+            MutexLocker locker(m_mutex);
+            --m_refCount;
+            refCount = m_refCount;
+        }
+        if (refCount <= 0)
+            return true;
+#endif
+        return false;
+    }
+
+private:
+    int m_refCount;
+#if !USE(LOCKFREE_THREADSAFEREFCOUNTED)
+    mutable Mutex m_mutex;
+#endif
+};
+
+template<class T> class ThreadSafeRefCounted : public ThreadSafeRefCountedBase {
+public:
+    void deref()
+    {
+        if (derefBase())
+            delete static_cast<T*>(this);
+    }
+
+protected:
+    ThreadSafeRefCounted()
+    {
+    }
+};
+
+} // namespace WTF
+
+using WTF::ThreadSafeRefCounted;
+
+#endif // ThreadSafeRefCounted_h
diff --git a/Source/WTF/wtf/ThreadSpecific.h b/Source/WTF/wtf/ThreadSpecific.h
new file mode 100644
index 0000000..4ebece0
--- /dev/null
+++ b/Source/WTF/wtf/ThreadSpecific.h
@@ -0,0 +1,278 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Jian Li <jianli@chromium.org>
+ * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
+ *
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+/* Thread local storage is implemented by using either pthread API or Windows
+ * native API. There is subtle semantic discrepancy for the cleanup function
+ * implementation as noted below:
+ *   @ In pthread implementation, the destructor function will be called
+ *     repeatedly if there is still non-NULL value associated with the function.
+ *   @ In Windows native implementation, the destructor function will be called
+ *     only once.
+ * This semantic discrepancy does not impose any problem because nowhere in
+ * WebKit the repeated call bahavior is utilized.
+ */
+
+#ifndef WTF_ThreadSpecific_h
+#define WTF_ThreadSpecific_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/StdLibExtras.h>
+
+#if USE(PTHREADS)
+#include <pthread.h>
+#elif OS(WINDOWS)
+#include <windows.h>
+#endif
+
+namespace WTF {
+
+#if OS(WINDOWS)
+// ThreadSpecificThreadExit should be called each time when a thread is detached.
+// This is done automatically for threads created with WTF::createThread.
+void ThreadSpecificThreadExit();
+#endif
+
+template<typename T> class ThreadSpecific {
+    WTF_MAKE_NONCOPYABLE(ThreadSpecific);
+public:
+    ThreadSpecific();
+    bool isSet(); // Useful as a fast check to see if this thread has set this value.
+    T* operator->();
+    operator T*();
+    T& operator*();
+
+private:
+#if OS(WINDOWS)
+    friend void ThreadSpecificThreadExit();
+#endif
+
+    // Not implemented. It's technically possible to destroy a thread specific key, but one would need
+    // to make sure that all values have been destroyed already (usually, that all threads that used it
+    // have exited). It's unlikely that any user of this call will be in that situation - and having
+    // a destructor defined can be confusing, given that it has such strong pre-requisites to work correctly.
+    ~ThreadSpecific();
+
+    T* get();
+    void set(T*);
+    void static destroy(void* ptr);
+
+    struct Data {
+        WTF_MAKE_NONCOPYABLE(Data);
+    public:
+        Data(T* value, ThreadSpecific<T>* owner) : value(value), owner(owner) {}
+
+        T* value;
+        ThreadSpecific<T>* owner;
+#if OS(WINDOWS)
+        void (*destructor)(void*);
+#endif
+    };
+
+#if USE(PTHREADS)
+    pthread_key_t m_key;
+#elif OS(WINDOWS)
+    int m_index;
+#endif
+};
+
+#if USE(PTHREADS)
+
+typedef pthread_key_t ThreadSpecificKey;
+
+inline void threadSpecificKeyCreate(ThreadSpecificKey* key, void (*destructor)(void *))
+{
+    int error = pthread_key_create(key, destructor);
+    if (error)
+        CRASH();
+}
+
+inline void threadSpecificKeyDelete(ThreadSpecificKey key)
+{
+    int error = pthread_key_delete(key);
+    if (error)
+        CRASH();
+}
+
+inline void threadSpecificSet(ThreadSpecificKey key, void* value)
+{
+    pthread_setspecific(key, value);
+}
+
+inline void* threadSpecificGet(ThreadSpecificKey key)
+{
+    return pthread_getspecific(key);
+}
+
+template<typename T>
+inline ThreadSpecific<T>::ThreadSpecific()
+{
+    int error = pthread_key_create(&m_key, destroy);
+    if (error)
+        CRASH();
+}
+
+template<typename T>
+inline T* ThreadSpecific<T>::get()
+{
+    Data* data = static_cast<Data*>(pthread_getspecific(m_key));
+    return data ? data->value : 0;
+}
+
+template<typename T>
+inline void ThreadSpecific<T>::set(T* ptr)
+{
+    ASSERT(!get());
+    pthread_setspecific(m_key, new Data(ptr, this));
+}
+
+#elif OS(WINDOWS)
+
+// TLS_OUT_OF_INDEXES is not defined on WinCE.
+#ifndef TLS_OUT_OF_INDEXES
+#define TLS_OUT_OF_INDEXES 0xffffffff
+#endif
+
+// The maximum number of TLS keys that can be created. For simplification, we assume that:
+// 1) Once the instance of ThreadSpecific<> is created, it will not be destructed until the program dies.
+// 2) We do not need to hold many instances of ThreadSpecific<> data. This fixed number should be far enough.
+const int kMaxTlsKeySize = 256;
+
+WTF_EXPORT_PRIVATE long& tlsKeyCount();
+WTF_EXPORT_PRIVATE DWORD* tlsKeys();
+
+class PlatformThreadSpecificKey;
+typedef PlatformThreadSpecificKey* ThreadSpecificKey;
+
+void threadSpecificKeyCreate(ThreadSpecificKey*, void (*)(void *));
+void threadSpecificKeyDelete(ThreadSpecificKey);
+void threadSpecificSet(ThreadSpecificKey, void*);
+void* threadSpecificGet(ThreadSpecificKey);
+
+template<typename T>
+inline ThreadSpecific<T>::ThreadSpecific()
+    : m_index(-1)
+{
+    DWORD tlsKey = TlsAlloc();
+    if (tlsKey == TLS_OUT_OF_INDEXES)
+        CRASH();
+
+    m_index = InterlockedIncrement(&tlsKeyCount()) - 1;
+    if (m_index >= kMaxTlsKeySize)
+        CRASH();
+    tlsKeys()[m_index] = tlsKey;
+}
+
+template<typename T>
+inline ThreadSpecific<T>::~ThreadSpecific()
+{
+    // Does not invoke destructor functions. They will be called from ThreadSpecificThreadExit when the thread is detached.
+    TlsFree(tlsKeys()[m_index]);
+}
+
+template<typename T>
+inline T* ThreadSpecific<T>::get()
+{
+    Data* data = static_cast<Data*>(TlsGetValue(tlsKeys()[m_index]));
+    return data ? data->value : 0;
+}
+
+template<typename T>
+inline void ThreadSpecific<T>::set(T* ptr)
+{
+    ASSERT(!get());
+    Data* data = new Data(ptr, this);
+    data->destructor = &ThreadSpecific<T>::destroy;
+    TlsSetValue(tlsKeys()[m_index], data);
+}
+
+#else
+#error ThreadSpecific is not implemented for this platform.
+#endif
+
+template<typename T>
+inline void ThreadSpecific<T>::destroy(void* ptr)
+{
+    Data* data = static_cast<Data*>(ptr);
+
+#if USE(PTHREADS)
+    // We want get() to keep working while data destructor works, because it can be called indirectly by the destructor.
+    // Some pthreads implementations zero out the pointer before calling destroy(), so we temporarily reset it.
+    pthread_setspecific(data->owner->m_key, ptr);
+#endif
+
+    data->value->~T();
+    fastFree(data->value);
+
+#if USE(PTHREADS)
+    pthread_setspecific(data->owner->m_key, 0);
+#elif OS(WINDOWS)
+    TlsSetValue(tlsKeys()[data->owner->m_index], 0);
+#else
+#error ThreadSpecific is not implemented for this platform.
+#endif
+
+    delete data;
+}
+
+template<typename T>
+inline bool ThreadSpecific<T>::isSet()
+{
+    return !!get();
+}
+
+template<typename T>
+inline ThreadSpecific<T>::operator T*()
+{
+    T* ptr = static_cast<T*>(get());
+    if (!ptr) {
+        // Set up thread-specific value's memory pointer before invoking constructor, in case any function it calls
+        // needs to access the value, to avoid recursion.
+        ptr = static_cast<T*>(fastZeroedMalloc(sizeof(T)));
+        set(ptr);
+        new (NotNull, ptr) T;
+    }
+    return ptr;
+}
+
+template<typename T>
+inline T* ThreadSpecific<T>::operator->()
+{
+    return operator T*();
+}
+
+template<typename T>
+inline T& ThreadSpecific<T>::operator*()
+{
+    return *operator T*();
+}
+
+} // namespace WTF
+
+#endif // WTF_ThreadSpecific_h
diff --git a/Source/WTF/wtf/ThreadSpecificWin.cpp b/Source/WTF/wtf/ThreadSpecificWin.cpp
new file mode 100644
index 0000000..d0f60ac
--- /dev/null
+++ b/Source/WTF/wtf/ThreadSpecificWin.cpp
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2009 Jian Li <jianli@chromium.org>
+ * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
+ *
+ * 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 "ThreadSpecific.h"
+
+#include "StdLibExtras.h"
+#include "ThreadingPrimitives.h"
+#include <wtf/DoublyLinkedList.h>
+
+#if !USE(PTHREADS)
+
+namespace WTF {
+
+static DoublyLinkedList<PlatformThreadSpecificKey>& destructorsList()
+{
+    DEFINE_STATIC_LOCAL(DoublyLinkedList<PlatformThreadSpecificKey>, staticList, ());
+    return staticList;
+}
+
+static Mutex& destructorsMutex()
+{
+    DEFINE_STATIC_LOCAL(Mutex, staticMutex, ());
+    return staticMutex;
+}
+
+class PlatformThreadSpecificKey : public DoublyLinkedListNode<PlatformThreadSpecificKey> {
+public:
+    friend class DoublyLinkedListNode<PlatformThreadSpecificKey>;
+
+    PlatformThreadSpecificKey(void (*destructor)(void *))
+        : m_destructor(destructor)
+    {
+        m_tlsKey = TlsAlloc();
+        if (m_tlsKey == TLS_OUT_OF_INDEXES)
+            CRASH();
+    }
+
+    ~PlatformThreadSpecificKey()
+    {
+        TlsFree(m_tlsKey);
+    }
+
+    void setValue(void* data) { TlsSetValue(m_tlsKey, data); }
+    void* value() { return TlsGetValue(m_tlsKey); }
+
+    void callDestructor()
+    {
+       if (void* data = value())
+            m_destructor(data);
+    }
+
+private:
+    void (*m_destructor)(void *);
+    DWORD m_tlsKey;
+    PlatformThreadSpecificKey* m_prev;
+    PlatformThreadSpecificKey* m_next;
+};
+
+long& tlsKeyCount()
+{
+    static long count;
+    return count;
+}
+
+DWORD* tlsKeys()
+{
+    static DWORD keys[kMaxTlsKeySize];
+    return keys;
+}
+
+void threadSpecificKeyCreate(ThreadSpecificKey* key, void (*destructor)(void *))
+{
+    *key = new PlatformThreadSpecificKey(destructor);
+
+    MutexLocker locker(destructorsMutex());
+    destructorsList().push(*key);
+}
+
+void threadSpecificKeyDelete(ThreadSpecificKey key)
+{
+    MutexLocker locker(destructorsMutex());
+    destructorsList().remove(key);
+    delete key;
+}
+
+void threadSpecificSet(ThreadSpecificKey key, void* data)
+{
+    key->setValue(data);
+}
+
+void* threadSpecificGet(ThreadSpecificKey key)
+{
+    return key->value();
+}
+
+void ThreadSpecificThreadExit()
+{
+    for (long i = 0; i < tlsKeyCount(); i++) {
+        // The layout of ThreadSpecific<T>::Data does not depend on T. So we are safe to do the static cast to ThreadSpecific<int> in order to access its data member.
+        ThreadSpecific<int>::Data* data = static_cast<ThreadSpecific<int>::Data*>(TlsGetValue(tlsKeys()[i]));
+        if (data)
+            data->destructor(data);
+    }
+
+    MutexLocker locker(destructorsMutex());
+    PlatformThreadSpecificKey* key = destructorsList().head();
+    while (key) {
+        PlatformThreadSpecificKey* nextKey = key->next();
+        key->callDestructor();
+        key = nextKey;
+    }
+}
+
+} // namespace WTF
+
+#endif // !USE(PTHREADS)
diff --git a/Source/WTF/wtf/Threading.cpp b/Source/WTF/wtf/Threading.cpp
new file mode 100644
index 0000000..8d658e9
--- /dev/null
+++ b/Source/WTF/wtf/Threading.cpp
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 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 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 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 "config.h"
+#include "Threading.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+#include <string.h>
+
+namespace WTF {
+
+struct NewThreadContext {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    NewThreadContext(ThreadFunction entryPoint, void* data, const char* name)
+        : entryPoint(entryPoint)
+        , data(data)
+        , name(name)
+    {
+    }
+
+    ThreadFunction entryPoint;
+    void* data;
+    const char* name;
+
+    Mutex creationMutex;
+};
+
+static void threadEntryPoint(void* contextData)
+{
+    NewThreadContext* context = reinterpret_cast<NewThreadContext*>(contextData);
+
+    // Block until our creating thread has completed any extra setup work, including
+    // establishing ThreadIdentifier.
+    {
+        MutexLocker locker(context->creationMutex);
+    }
+
+    initializeCurrentThreadInternal(context->name);
+
+    // Grab the info that we need out of the context, then deallocate it.
+    ThreadFunction entryPoint = context->entryPoint;
+    void* data = context->data;
+    delete context;
+
+    entryPoint(data);
+}
+
+ThreadIdentifier createThread(ThreadFunction entryPoint, void* data, const char* name)
+{
+    // Visual Studio has a 31-character limit on thread names. Longer names will
+    // be truncated silently, but we'd like callers to know about the limit.
+#if !LOG_DISABLED
+    if (strlen(name) > 31)
+        LOG_ERROR("Thread name \"%s\" is longer than 31 characters and will be truncated by Visual Studio", name);
+#endif
+
+    NewThreadContext* context = new NewThreadContext(entryPoint, data, name);
+
+    // Prevent the thread body from executing until we've established the thread identifier.
+    MutexLocker locker(context->creationMutex);
+
+    return createThreadInternal(threadEntryPoint, context, name);
+}
+
+#if PLATFORM(MAC) || PLATFORM(WIN)
+
+// For ABI compatibility with Safari on Mac / Windows: Safari uses the private
+// createThread() and waitForThreadCompletion() functions directly and we need
+// to keep the old ABI compatibility until it's been rebuilt.
+
+typedef void* (*ThreadFunctionWithReturnValue)(void* argument);
+
+WTF_EXPORT_PRIVATE ThreadIdentifier createThread(ThreadFunctionWithReturnValue entryPoint, void* data, const char* name);
+
+struct ThreadFunctionWithReturnValueInvocation {
+    ThreadFunctionWithReturnValueInvocation(ThreadFunctionWithReturnValue function, void* data)
+        : function(function)
+        , data(data)
+    {
+    }
+
+    ThreadFunctionWithReturnValue function;
+    void* data;
+};
+
+static void compatEntryPoint(void* param)
+{
+    // Balanced by .leakPtr() in createThread.
+    OwnPtr<ThreadFunctionWithReturnValueInvocation> invocation = adoptPtr(static_cast<ThreadFunctionWithReturnValueInvocation*>(param));
+    invocation->function(invocation->data);
+}
+
+ThreadIdentifier createThread(ThreadFunctionWithReturnValue entryPoint, void* data, const char* name)
+{
+    OwnPtr<ThreadFunctionWithReturnValueInvocation> invocation = adoptPtr(new ThreadFunctionWithReturnValueInvocation(entryPoint, data));
+
+    // Balanced by adoptPtr() in compatEntryPoint.
+    return createThread(compatEntryPoint, invocation.leakPtr(), name);
+}
+
+WTF_EXPORT_PRIVATE int waitForThreadCompletion(ThreadIdentifier, void**);
+
+int waitForThreadCompletion(ThreadIdentifier threadID, void**)
+{
+    return waitForThreadCompletion(threadID);
+}
+
+// This function is deprecated but needs to be kept around for backward
+// compatibility. Use the 3-argument version of createThread above.
+
+WTF_EXPORT_PRIVATE ThreadIdentifier createThread(ThreadFunctionWithReturnValue entryPoint, void* data);
+
+ThreadIdentifier createThread(ThreadFunctionWithReturnValue entryPoint, void* data)
+{
+    OwnPtr<ThreadFunctionWithReturnValueInvocation> invocation = adoptPtr(new ThreadFunctionWithReturnValueInvocation(entryPoint, data));
+
+    // Balanced by adoptPtr() in compatEntryPoint.
+    return createThread(compatEntryPoint, invocation.leakPtr(), 0);
+}
+#endif
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/Threading.h b/Source/WTF/wtf/Threading.h
new file mode 100644
index 0000000..3e558fc
--- /dev/null
+++ b/Source/WTF/wtf/Threading.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ *
+ *
+ * Note: The implementations of InterlockedIncrement and InterlockedDecrement are based
+ * on atomic_increment and atomic_exchange_and_add from the Boost C++ Library. The license
+ * is virtually identical to the Apple license above but is included here for completeness.
+ *
+ * Boost Software License - Version 1.0 - August 17th, 2003
+ * 
+ * Permission is hereby granted, free of charge, to any person or organization
+ * obtaining a copy of the software and accompanying documentation covered by
+ * this license (the "Software") to use, reproduce, display, distribute,
+ * execute, and transmit the Software, and to prepare derivative works of the
+ * Software, and to permit third-parties to whom the Software is furnished to
+ * do so, all subject to the following:
+ * 
+ * The copyright notices in the Software and this entire statement, including
+ * the above license grant, this restriction and the following disclaimer,
+ * must be included in all copies of the Software, in whole or in part, and
+ * all derivative works of the Software, unless such copies or derivative
+ * works are solely in the form of machine-executable object code generated by
+ * a source language processor.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef Threading_h
+#define Threading_h
+
+#include <wtf/Platform.h>
+
+#include <stdint.h>
+#include <wtf/Assertions.h>
+#include <wtf/Atomics.h>
+#include <wtf/Locker.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/ThreadSafeRefCounted.h>
+#include <wtf/ThreadingPrimitives.h>
+
+// For portability, we do not use thread-safe statics natively supported by some compilers (e.g. gcc).
+#define AtomicallyInitializedStatic(T, name) \
+    WTF::lockAtomicallyInitializedStaticMutex(); \
+    static T name; \
+    WTF::unlockAtomicallyInitializedStaticMutex();
+
+namespace WTF {
+
+typedef uint32_t ThreadIdentifier;
+typedef void (*ThreadFunction)(void* argument);
+
+// This function must be called from the main thread. It is safe to call it repeatedly.
+// Darwin is an exception to this rule: it is OK to call it from any thread, the only 
+// requirement is that the calls are not reentrant.
+WTF_EXPORT_PRIVATE void initializeThreading();
+
+// Returns 0 if thread creation failed.
+// The thread name must be a literal since on some platforms it's passed in to the thread.
+WTF_EXPORT_PRIVATE ThreadIdentifier createThread(ThreadFunction, void*, const char* threadName);
+
+// Internal platform-specific createThread implementation.
+ThreadIdentifier createThreadInternal(ThreadFunction, void*, const char* threadName);
+
+// Called in the thread during initialization.
+// Helpful for platforms where the thread name must be set from within the thread.
+void initializeCurrentThreadInternal(const char* threadName);
+
+WTF_EXPORT_PRIVATE ThreadIdentifier currentThread();
+WTF_EXPORT_PRIVATE int waitForThreadCompletion(ThreadIdentifier);
+WTF_EXPORT_PRIVATE void detachThread(ThreadIdentifier);
+
+WTF_EXPORT_PRIVATE void yield();
+
+WTF_EXPORT_PRIVATE void lockAtomicallyInitializedStaticMutex();
+WTF_EXPORT_PRIVATE void unlockAtomicallyInitializedStaticMutex();
+
+} // namespace WTF
+
+using WTF::ThreadIdentifier;
+using WTF::createThread;
+using WTF::currentThread;
+using WTF::detachThread;
+using WTF::waitForThreadCompletion;
+using WTF::yield;
+
+#endif // Threading_h
diff --git a/Source/WTF/wtf/ThreadingNone.cpp b/Source/WTF/wtf/ThreadingNone.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/WTF/wtf/ThreadingNone.cpp
diff --git a/Source/WTF/wtf/ThreadingPrimitives.h b/Source/WTF/wtf/ThreadingPrimitives.h
new file mode 100644
index 0000000..ab7dc36
--- /dev/null
+++ b/Source/WTF/wtf/ThreadingPrimitives.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ *
+ */
+
+#ifndef ThreadingPrimitives_h
+#define ThreadingPrimitives_h
+
+#include <wtf/Platform.h>
+
+#include <wtf/Assertions.h>
+#include <wtf/FastAllocBase.h>
+#include <wtf/Locker.h>
+#include <wtf/Noncopyable.h>
+
+#if OS(WINDOWS)
+#include <windows.h>
+#endif
+
+#if USE(PTHREADS)
+#include <pthread.h>
+#endif
+
+namespace WTF {
+
+#if USE(PTHREADS)
+typedef pthread_mutex_t PlatformMutex;
+#if HAVE(PTHREAD_RWLOCK)
+typedef pthread_rwlock_t PlatformReadWriteLock;
+#else
+typedef void* PlatformReadWriteLock;
+#endif
+typedef pthread_cond_t PlatformCondition;
+#elif OS(WINDOWS)
+struct PlatformMutex {
+    CRITICAL_SECTION m_internalMutex;
+    size_t m_recursionCount;
+};
+typedef void* PlatformReadWriteLock; // FIXME: Implement.
+struct PlatformCondition {
+    size_t m_waitersGone;
+    size_t m_waitersBlocked;
+    size_t m_waitersToUnblock; 
+    HANDLE m_blockLock;
+    HANDLE m_blockQueue;
+    HANDLE m_unblockLock;
+
+    bool timedWait(PlatformMutex&, DWORD durationMilliseconds);
+    void signal(bool unblockAll);
+};
+#else
+typedef void* PlatformMutex;
+typedef void* PlatformReadWriteLock;
+typedef void* PlatformCondition;
+#endif
+    
+class Mutex {
+    WTF_MAKE_NONCOPYABLE(Mutex); WTF_MAKE_FAST_ALLOCATED;
+public:
+    WTF_EXPORT_PRIVATE Mutex();
+    WTF_EXPORT_PRIVATE ~Mutex();
+
+    WTF_EXPORT_PRIVATE void lock();
+    WTF_EXPORT_PRIVATE bool tryLock();
+    WTF_EXPORT_PRIVATE void unlock();
+
+public:
+    PlatformMutex& impl() { return m_mutex; }
+private:
+    PlatformMutex m_mutex;
+};
+
+typedef Locker<Mutex> MutexLocker;
+
+class MutexTryLocker {
+    WTF_MAKE_NONCOPYABLE(MutexTryLocker);
+public:
+    MutexTryLocker(Mutex& mutex) : m_mutex(mutex), m_locked(mutex.tryLock()) { }
+    ~MutexTryLocker()
+    {
+        if (m_locked)
+            m_mutex.unlock();
+    }
+
+    bool locked() const { return m_locked; }
+
+private:
+    Mutex& m_mutex;
+    bool m_locked;
+};
+
+class ReadWriteLock {
+    WTF_MAKE_NONCOPYABLE(ReadWriteLock);
+public:
+    ReadWriteLock();
+    ~ReadWriteLock();
+
+    void readLock();
+    bool tryReadLock();
+
+    void writeLock();
+    bool tryWriteLock();
+    
+    void unlock();
+
+private:
+    PlatformReadWriteLock m_readWriteLock;
+};
+
+class ThreadCondition {
+    WTF_MAKE_NONCOPYABLE(ThreadCondition);
+public:
+    WTF_EXPORT_PRIVATE ThreadCondition();
+    WTF_EXPORT_PRIVATE ~ThreadCondition();
+    
+    WTF_EXPORT_PRIVATE void wait(Mutex& mutex);
+    // Returns true if the condition was signaled before absoluteTime, false if the absoluteTime was reached or is in the past.
+    // The absoluteTime is in seconds, starting on January 1, 1970. The time is assumed to use the same time zone as WTF::currentTime().
+    WTF_EXPORT_PRIVATE bool timedWait(Mutex&, double absoluteTime);
+    WTF_EXPORT_PRIVATE void signal();
+    WTF_EXPORT_PRIVATE void broadcast();
+    
+private:
+    PlatformCondition m_condition;
+};
+
+#if OS(WINDOWS)
+// The absoluteTime is in seconds, starting on January 1, 1970. The time is assumed to use the same time zone as WTF::currentTime().
+// Returns an interval in milliseconds suitable for passing to one of the Win32 wait functions (e.g., ::WaitForSingleObject).
+WTF_EXPORT_PRIVATE DWORD absoluteTimeToWaitTimeoutInterval(double absoluteTime);
+#endif
+
+} // namespace WTF
+
+using WTF::Mutex;
+using WTF::MutexLocker;
+using WTF::MutexTryLocker;
+using WTF::ThreadCondition;
+
+#if OS(WINDOWS)
+using WTF::absoluteTimeToWaitTimeoutInterval;
+#endif
+
+#endif // ThreadingPrimitives_h
diff --git a/Source/WTF/wtf/ThreadingPthreads.cpp b/Source/WTF/wtf/ThreadingPthreads.cpp
new file mode 100644
index 0000000..1dd84f0
--- /dev/null
+++ b/Source/WTF/wtf/ThreadingPthreads.cpp
@@ -0,0 +1,473 @@
+/*
+ * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ * Copyright (C) 2011 Research In Motion Limited. 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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 "config.h"
+#include "Threading.h"
+
+#if USE(PTHREADS)
+
+#include "CurrentTime.h"
+#include "DateMath.h"
+#include "dtoa.h"
+#include "dtoa/cached-powers.h"
+#include "HashMap.h"
+#include "RandomNumberSeed.h"
+#include "StackStats.h"
+#include "StdLibExtras.h"
+#include "ThreadFunctionInvocation.h"
+#include "ThreadIdentifierDataPthreads.h"
+#include "ThreadSpecific.h"
+#include "UnusedParam.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/WTFThreadData.h>
+#include <errno.h>
+
+#if !COMPILER(MSVC)
+#include <limits.h>
+#include <sched.h>
+#include <sys/time.h>
+#endif
+
+#if OS(MAC_OS_X) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
+#include <objc/objc-auto.h>
+#endif
+
+namespace WTF {
+
+class PthreadState {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    enum JoinableState {
+        Joinable, // The default thread state. The thread can be joined on.
+
+        Joined, // Somebody waited on this thread to exit and this thread finally exited. This state is here because there can be a 
+                // period of time between when the thread exits (which causes pthread_join to return and the remainder of waitOnThreadCompletion to run) 
+                // and when threadDidExit is called. We need threadDidExit to take charge and delete the thread data since there's 
+                // nobody else to pick up the slack in this case (since waitOnThreadCompletion has already returned).
+
+        Detached // The thread has been detached and can no longer be joined on. At this point, the thread must take care of cleaning up after itself.
+    };
+
+    // Currently all threads created by WTF start out as joinable. 
+    PthreadState(pthread_t handle)
+        : m_joinableState(Joinable)
+        , m_didExit(false)
+        , m_pthreadHandle(handle)
+    {
+    }
+
+    JoinableState joinableState() { return m_joinableState; }
+    pthread_t pthreadHandle() { return m_pthreadHandle; }
+    void didBecomeDetached() { m_joinableState = Detached; }
+    void didExit() { m_didExit = true; }
+    void didJoin() { m_joinableState = Joined; }
+    bool hasExited() { return m_didExit; }
+
+private:
+    JoinableState m_joinableState;
+    bool m_didExit;
+    pthread_t m_pthreadHandle;
+};
+
+typedef HashMap<ThreadIdentifier, OwnPtr<PthreadState> > ThreadMap;
+
+static Mutex* atomicallyInitializedStaticMutex;
+
+void unsafeThreadWasDetached(ThreadIdentifier);
+void threadDidExit(ThreadIdentifier);
+void threadWasJoined(ThreadIdentifier);
+
+static Mutex& threadMapMutex()
+{
+    DEFINE_STATIC_LOCAL(Mutex, mutex, ());
+    return mutex;
+}
+
+#if OS(QNX) && CPU(ARM_THUMB2)
+static void enableIEEE754Denormal()
+{
+    // Clear the ARM_VFP_FPSCR_FZ flag in FPSCR.
+    unsigned fpscr;
+    asm volatile("vmrs %0, fpscr" : "=r"(fpscr));
+    fpscr &= ~0x01000000u;
+    asm volatile("vmsr fpscr, %0" : : "r"(fpscr));
+}
+#endif
+
+void initializeThreading()
+{
+    if (atomicallyInitializedStaticMutex)
+        return;
+
+#if OS(QNX) && CPU(ARM_THUMB2)
+    enableIEEE754Denormal();
+#endif
+
+    WTF::double_conversion::initialize();
+    // StringImpl::empty() does not construct its static string in a threadsafe fashion,
+    // so ensure it has been initialized from here.
+    StringImpl::empty();
+    atomicallyInitializedStaticMutex = new Mutex;
+    threadMapMutex();
+    initializeRandomNumberGenerator();
+    ThreadIdentifierData::initializeOnce();
+    StackStats::initialize();
+    wtfThreadData();
+    s_dtoaP5Mutex = new Mutex;
+    initializeDates();
+}
+
+void lockAtomicallyInitializedStaticMutex()
+{
+    ASSERT(atomicallyInitializedStaticMutex);
+    atomicallyInitializedStaticMutex->lock();
+}
+
+void unlockAtomicallyInitializedStaticMutex()
+{
+    atomicallyInitializedStaticMutex->unlock();
+}
+
+static ThreadMap& threadMap()
+{
+    DEFINE_STATIC_LOCAL(ThreadMap, map, ());
+    return map;
+}
+
+static ThreadIdentifier identifierByPthreadHandle(const pthread_t& pthreadHandle)
+{
+    MutexLocker locker(threadMapMutex());
+
+    ThreadMap::iterator i = threadMap().begin();
+    for (; i != threadMap().end(); ++i) {
+        if (pthread_equal(i->value->pthreadHandle(), pthreadHandle) && !i->value->hasExited())
+            return i->key;
+    }
+
+    return 0;
+}
+
+static ThreadIdentifier establishIdentifierForPthreadHandle(const pthread_t& pthreadHandle)
+{
+    ASSERT(!identifierByPthreadHandle(pthreadHandle));
+    MutexLocker locker(threadMapMutex());
+    static ThreadIdentifier identifierCount = 1;
+    threadMap().add(identifierCount, adoptPtr(new PthreadState(pthreadHandle)));
+    return identifierCount++;
+}
+
+static pthread_t pthreadHandleForIdentifierWithLockAlreadyHeld(ThreadIdentifier id)
+{
+    return threadMap().get(id)->pthreadHandle();
+}
+
+static void* wtfThreadEntryPoint(void* param)
+{
+    // Balanced by .leakPtr() in createThreadInternal.
+    OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(static_cast<ThreadFunctionInvocation*>(param));
+    invocation->function(invocation->data);
+    return 0;
+}
+
+ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char*)
+{
+    OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(new ThreadFunctionInvocation(entryPoint, data));
+    pthread_t threadHandle;
+    if (pthread_create(&threadHandle, 0, wtfThreadEntryPoint, invocation.get())) {
+        LOG_ERROR("Failed to create pthread at entry point %p with data %p", wtfThreadEntryPoint, invocation.get());
+        return 0;
+    }
+
+    // Balanced by adoptPtr() in wtfThreadEntryPoint.
+    ThreadFunctionInvocation* leakedInvocation = invocation.leakPtr();
+    UNUSED_PARAM(leakedInvocation);
+
+    return establishIdentifierForPthreadHandle(threadHandle);
+}
+
+void initializeCurrentThreadInternal(const char* threadName)
+{
+#if HAVE(PTHREAD_SETNAME_NP)
+    pthread_setname_np(threadName);
+#elif OS(QNX)
+    pthread_setname_np(pthread_self(), threadName);
+#else
+    UNUSED_PARAM(threadName);
+#endif
+
+#if OS(MAC_OS_X) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
+    // All threads that potentially use APIs above the BSD layer must be registered with the Objective-C
+    // garbage collector in case API implementations use garbage-collected memory.
+    objc_registerThreadWithCollector();
+#endif
+
+#if OS(QNX) && CPU(ARM_THUMB2)
+    enableIEEE754Denormal();
+#endif
+
+    ThreadIdentifier id = identifierByPthreadHandle(pthread_self());
+    ASSERT(id);
+    ThreadIdentifierData::initialize(id);
+}
+
+int waitForThreadCompletion(ThreadIdentifier threadID)
+{
+    pthread_t pthreadHandle;
+    ASSERT(threadID);
+
+    {
+        // We don't want to lock across the call to join, since that can block our thread and cause deadlock.
+        MutexLocker locker(threadMapMutex());
+        pthreadHandle = pthreadHandleForIdentifierWithLockAlreadyHeld(threadID);
+        ASSERT(pthreadHandle);
+    }
+
+    int joinResult = pthread_join(pthreadHandle, 0);
+
+    if (joinResult == EDEADLK)
+        LOG_ERROR("ThreadIdentifier %u was found to be deadlocked trying to quit", threadID);
+    else if (joinResult)
+        LOG_ERROR("ThreadIdentifier %u was unable to be joined.\n", threadID);
+
+    MutexLocker locker(threadMapMutex());
+    PthreadState* state = threadMap().get(threadID);
+    ASSERT(state);
+    ASSERT(state->joinableState() == PthreadState::Joinable);
+
+    // The thread has already exited, so clean up after it.
+    if (state->hasExited())
+        threadMap().remove(threadID);
+    // The thread hasn't exited yet, so don't clean anything up. Just signal that we've already joined on it so that it will clean up after itself.
+    else
+        state->didJoin();
+
+    return joinResult;
+}
+
+void detachThread(ThreadIdentifier threadID)
+{
+    ASSERT(threadID);
+
+    MutexLocker locker(threadMapMutex());
+    pthread_t pthreadHandle = pthreadHandleForIdentifierWithLockAlreadyHeld(threadID);
+    ASSERT(pthreadHandle);
+
+    int detachResult = pthread_detach(pthreadHandle);
+    if (detachResult)
+        LOG_ERROR("ThreadIdentifier %u was unable to be detached\n", threadID);
+
+    PthreadState* state = threadMap().get(threadID);
+    ASSERT(state);
+    if (state->hasExited())
+        threadMap().remove(threadID);
+    else
+        threadMap().get(threadID)->didBecomeDetached();
+}
+
+void threadDidExit(ThreadIdentifier threadID)
+{
+    MutexLocker locker(threadMapMutex());
+    PthreadState* state = threadMap().get(threadID);
+    ASSERT(state);
+    
+    state->didExit();
+
+    if (state->joinableState() != PthreadState::Joinable)
+        threadMap().remove(threadID);
+}
+
+void yield()
+{
+    sched_yield();
+}
+
+ThreadIdentifier currentThread()
+{
+    ThreadIdentifier id = ThreadIdentifierData::identifier();
+    if (id)
+        return id;
+
+    // Not a WTF-created thread, ThreadIdentifier is not established yet.
+    id = establishIdentifierForPthreadHandle(pthread_self());
+    ThreadIdentifierData::initialize(id);
+    return id;
+}
+
+Mutex::Mutex()
+{
+    pthread_mutexattr_t attr;
+    pthread_mutexattr_init(&attr);
+    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
+
+    int result = pthread_mutex_init(&m_mutex, &attr);
+    ASSERT_UNUSED(result, !result);
+
+    pthread_mutexattr_destroy(&attr);
+}
+
+Mutex::~Mutex()
+{
+    int result = pthread_mutex_destroy(&m_mutex);
+    ASSERT_UNUSED(result, !result);
+}
+
+void Mutex::lock()
+{
+    int result = pthread_mutex_lock(&m_mutex);
+    ASSERT_UNUSED(result, !result);
+}
+
+bool Mutex::tryLock()
+{
+    int result = pthread_mutex_trylock(&m_mutex);
+
+    if (result == 0)
+        return true;
+    if (result == EBUSY)
+        return false;
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+void Mutex::unlock()
+{
+    int result = pthread_mutex_unlock(&m_mutex);
+    ASSERT_UNUSED(result, !result);
+}
+
+#if HAVE(PTHREAD_RWLOCK)
+ReadWriteLock::ReadWriteLock()
+{
+    pthread_rwlock_init(&m_readWriteLock, NULL);
+}
+
+ReadWriteLock::~ReadWriteLock()
+{
+    pthread_rwlock_destroy(&m_readWriteLock);
+}
+
+void ReadWriteLock::readLock()
+{
+    int result = pthread_rwlock_rdlock(&m_readWriteLock);
+    ASSERT_UNUSED(result, !result);
+}
+
+bool ReadWriteLock::tryReadLock()
+{
+    int result = pthread_rwlock_tryrdlock(&m_readWriteLock);
+
+    if (result == 0)
+        return true;
+    if (result == EBUSY || result == EAGAIN)
+        return false;
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+void ReadWriteLock::writeLock()
+{
+    int result = pthread_rwlock_wrlock(&m_readWriteLock);
+    ASSERT_UNUSED(result, !result);
+}
+
+bool ReadWriteLock::tryWriteLock()
+{
+    int result = pthread_rwlock_trywrlock(&m_readWriteLock);
+
+    if (result == 0)
+        return true;
+    if (result == EBUSY || result == EAGAIN)
+        return false;
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
+void ReadWriteLock::unlock()
+{
+    int result = pthread_rwlock_unlock(&m_readWriteLock);
+    ASSERT_UNUSED(result, !result);
+}
+#endif  // HAVE(PTHREAD_RWLOCK)
+
+ThreadCondition::ThreadCondition()
+{ 
+    pthread_cond_init(&m_condition, NULL);
+}
+
+ThreadCondition::~ThreadCondition()
+{
+    pthread_cond_destroy(&m_condition);
+}
+    
+void ThreadCondition::wait(Mutex& mutex)
+{
+    int result = pthread_cond_wait(&m_condition, &mutex.impl());
+    ASSERT_UNUSED(result, !result);
+}
+
+bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime)
+{
+    if (absoluteTime < currentTime())
+        return false;
+
+    if (absoluteTime > INT_MAX) {
+        wait(mutex);
+        return true;
+    }
+
+    int timeSeconds = static_cast<int>(absoluteTime);
+    int timeNanoseconds = static_cast<int>((absoluteTime - timeSeconds) * 1E9);
+
+    timespec targetTime;
+    targetTime.tv_sec = timeSeconds;
+    targetTime.tv_nsec = timeNanoseconds;
+
+    return pthread_cond_timedwait(&m_condition, &mutex.impl(), &targetTime) == 0;
+}
+
+void ThreadCondition::signal()
+{
+    int result = pthread_cond_signal(&m_condition);
+    ASSERT_UNUSED(result, !result);
+}
+
+void ThreadCondition::broadcast()
+{
+    int result = pthread_cond_broadcast(&m_condition);
+    ASSERT_UNUSED(result, !result);
+}
+
+} // namespace WTF
+
+#endif // USE(PTHREADS)
diff --git a/Source/WTF/wtf/ThreadingWin.cpp b/Source/WTF/wtf/ThreadingWin.cpp
new file mode 100644
index 0000000..d33973d
--- /dev/null
+++ b/Source/WTF/wtf/ThreadingWin.cpp
@@ -0,0 +1,517 @@
+/*
+ * 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
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+/*
+ * There are numerous academic and practical works on how to implement pthread_cond_wait/pthread_cond_signal/pthread_cond_broadcast
+ * functions on Win32. Here is one example: http://www.cs.wustl.edu/~schmidt/win32-cv-1.html which is widely credited as a 'starting point'
+ * of modern attempts. There are several more or less proven implementations, one in Boost C++ library (http://www.boost.org) and another
+ * in pthreads-win32 (http://sourceware.org/pthreads-win32/).
+ *
+ * The number of articles and discussions is the evidence of significant difficulties in implementing these primitives correctly.
+ * The brief search of revisions, ChangeLog entries, discussions in comp.programming.threads and other places clearly documents
+ * numerous pitfalls and performance problems the authors had to overcome to arrive to the suitable implementations.
+ * Optimally, WebKit would use one of those supported/tested libraries directly. To roll out our own implementation is impractical,
+ * if even for the lack of sufficient testing. However, a faithful reproduction of the code from one of the popular supported
+ * libraries seems to be a good compromise.
+ *
+ * The early Boost implementation (http://www.boxbackup.org/trac/browser/box/nick/win/lib/win32/boost_1_32_0/libs/thread/src/condition.cpp?rev=30)
+ * is identical to pthreads-win32 (http://sourceware.org/cgi-bin/cvsweb.cgi/pthreads/pthread_cond_wait.c?rev=1.10&content-type=text/x-cvsweb-markup&cvsroot=pthreads-win32).
+ * Current Boost uses yet another (although seemingly equivalent) algorithm which came from their 'thread rewrite' effort.
+ *
+ * This file includes timedWait/signal/broadcast implementations translated to WebKit coding style from the latest algorithm by
+ * Alexander Terekhov and Louis Thomas, as captured here: http://sourceware.org/cgi-bin/cvsweb.cgi/pthreads/pthread_cond_wait.c?rev=1.10&content-type=text/x-cvsweb-markup&cvsroot=pthreads-win32
+ * It replaces the implementation of their previous algorithm, also documented in the same source above.
+ * The naming and comments are left very close to original to enable easy cross-check.
+ *
+ * The corresponding Pthreads-win32 License is included below, and CONTRIBUTORS file which it refers to is added to
+ * source directory (as CONTRIBUTORS.pthreads-win32).
+ */
+
+/*
+ *      Pthreads-win32 - POSIX Threads Library for Win32
+ *      Copyright(C) 1998 John E. Bossom
+ *      Copyright(C) 1999,2005 Pthreads-win32 contributors
+ *
+ *      Contact Email: rpj@callisto.canberra.edu.au
+ *
+ *      The current list of contributors is contained
+ *      in the file CONTRIBUTORS included with the source
+ *      code distribution. The list can also be seen at the
+ *      following World Wide Web location:
+ *      http://sources.redhat.com/pthreads-win32/contributors.html
+ *
+ *      This library is free software; you can redistribute it and/or
+ *      modify it under the terms of the GNU Lesser 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
+ *      Lesser General Public License for more details.
+ *
+ *      You should have received a copy of the GNU Lesser General Public
+ *      License along with this library in the file COPYING.LIB;
+ *      if not, write to the Free Software Foundation, Inc.,
+ *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include "config.h"
+#include "Threading.h"
+#include "DateMath.h"
+#include "dtoa.h"
+#include "dtoa/cached-powers.h"
+
+#include "MainThread.h"
+#include "ThreadFunctionInvocation.h"
+#include <windows.h>
+#include <wtf/CurrentTime.h>
+#include <wtf/HashMap.h>
+#include <wtf/MathExtras.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RandomNumberSeed.h>
+#include <wtf/WTFThreadData.h>
+
+#if !USE(PTHREADS) && OS(WINDOWS)
+#include "ThreadSpecific.h"
+#endif
+
+#if !OS(WINCE)
+#include <process.h>
+#endif
+
+#if HAVE(ERRNO_H)
+#include <errno.h>
+#endif
+
+namespace WTF {
+
+// MS_VC_EXCEPTION, THREADNAME_INFO, and setThreadNameInternal all come from <http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx>.
+static const DWORD MS_VC_EXCEPTION = 0x406D1388;
+
+#pragma pack(push, 8)
+typedef struct tagTHREADNAME_INFO {
+    DWORD dwType; // must be 0x1000
+    LPCSTR szName; // pointer to name (in user addr space)
+    DWORD dwThreadID; // thread ID (-1=caller thread)
+    DWORD dwFlags; // reserved for future use, must be zero
+} THREADNAME_INFO;
+#pragma pack(pop)
+
+void initializeCurrentThreadInternal(const char* szThreadName)
+{
+#if COMPILER(MINGW)
+    // FIXME: Implement thread name setting with MingW.
+    UNUSED_PARAM(szThreadName);
+#else
+    THREADNAME_INFO info;
+    info.dwType = 0x1000;
+    info.szName = szThreadName;
+    info.dwThreadID = GetCurrentThreadId();
+    info.dwFlags = 0;
+
+    __try {
+        RaiseException(MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), reinterpret_cast<ULONG_PTR*>(&info));
+    } __except (EXCEPTION_CONTINUE_EXECUTION) {
+    }
+#endif
+}
+
+static Mutex* atomicallyInitializedStaticMutex;
+
+void lockAtomicallyInitializedStaticMutex()
+{
+    ASSERT(atomicallyInitializedStaticMutex);
+    atomicallyInitializedStaticMutex->lock();
+}
+
+void unlockAtomicallyInitializedStaticMutex()
+{
+    atomicallyInitializedStaticMutex->unlock();
+}
+
+static Mutex& threadMapMutex()
+{
+    static Mutex mutex;
+    return mutex;
+}
+
+void initializeThreading()
+{
+    if (atomicallyInitializedStaticMutex)
+        return;
+
+    WTF::double_conversion::initialize();
+    // StringImpl::empty() does not construct its static string in a threadsafe fashion,
+    // so ensure it has been initialized from here.
+    StringImpl::empty();
+    atomicallyInitializedStaticMutex = new Mutex;
+    threadMapMutex();
+    initializeRandomNumberGenerator();
+    wtfThreadData();
+    s_dtoaP5Mutex = new Mutex;
+    initializeDates();
+}
+
+static HashMap<DWORD, HANDLE>& threadMap()
+{
+    static HashMap<DWORD, HANDLE> map;
+    return map;
+}
+
+static void storeThreadHandleByIdentifier(DWORD threadID, HANDLE threadHandle)
+{
+    MutexLocker locker(threadMapMutex());
+    ASSERT(!threadMap().contains(threadID));
+    threadMap().add(threadID, threadHandle);
+}
+
+static HANDLE threadHandleForIdentifier(ThreadIdentifier id)
+{
+    MutexLocker locker(threadMapMutex());
+    return threadMap().get(id);
+}
+
+static void clearThreadHandleForIdentifier(ThreadIdentifier id)
+{
+    MutexLocker locker(threadMapMutex());
+    ASSERT(threadMap().contains(id));
+    threadMap().remove(id);
+}
+
+static unsigned __stdcall wtfThreadEntryPoint(void* param)
+{
+    OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(static_cast<ThreadFunctionInvocation*>(param));
+    invocation->function(invocation->data);
+
+#if !USE(PTHREADS) && OS(WINDOWS)
+    // Do the TLS cleanup.
+    ThreadSpecificThreadExit();
+#endif
+
+    return 0;
+}
+
+ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char* threadName)
+{
+    unsigned threadIdentifier = 0;
+    ThreadIdentifier threadID = 0;
+    OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(new ThreadFunctionInvocation(entryPoint, data));
+#if OS(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.get(), 0, (LPDWORD)&threadIdentifier);
+#else
+    HANDLE threadHandle = reinterpret_cast<HANDLE>(_beginthreadex(0, 0, wtfThreadEntryPoint, invocation.get(), 0, &threadIdentifier));
+#endif
+    if (!threadHandle) {
+#if OS(WINCE)
+        LOG_ERROR("Failed to create thread at entry point %p with data %p: %ld", entryPoint, data, ::GetLastError());
+#elif !HAVE(ERRNO_H)
+        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;
+    }
+
+    // The thread will take ownership of invocation.
+    ThreadFunctionInvocation* leakedInvocation = invocation.leakPtr();
+    UNUSED_PARAM(leakedInvocation);
+
+    threadID = static_cast<ThreadIdentifier>(threadIdentifier);
+    storeThreadHandleByIdentifier(threadIdentifier, threadHandle);
+
+    return threadID;
+}
+
+int waitForThreadCompletion(ThreadIdentifier threadID)
+{
+    ASSERT(threadID);
+    
+    HANDLE threadHandle = threadHandleForIdentifier(threadID);
+    if (!threadHandle)
+        LOG_ERROR("ThreadIdentifier %u did not correspond to an active thread when trying to quit", threadID);
+ 
+    DWORD joinResult = WaitForSingleObject(threadHandle, INFINITE);
+    if (joinResult == WAIT_FAILED)
+        LOG_ERROR("ThreadIdentifier %u was found to be deadlocked trying to quit", threadID);
+
+    CloseHandle(threadHandle);
+    clearThreadHandleForIdentifier(threadID);
+
+    return joinResult;
+}
+
+void detachThread(ThreadIdentifier threadID)
+{
+    ASSERT(threadID);
+
+    HANDLE threadHandle = threadHandleForIdentifier(threadID);
+    if (threadHandle)
+        CloseHandle(threadHandle);
+    clearThreadHandleForIdentifier(threadID);
+}
+
+void yield()
+{
+    ::Sleep(1);
+}
+
+ThreadIdentifier currentThread()
+{
+    return static_cast<ThreadIdentifier>(GetCurrentThreadId());
+}
+
+Mutex::Mutex()
+{
+    m_mutex.m_recursionCount = 0;
+    InitializeCriticalSection(&m_mutex.m_internalMutex);
+}
+
+Mutex::~Mutex()
+{
+    DeleteCriticalSection(&m_mutex.m_internalMutex);
+}
+
+void Mutex::lock()
+{
+    EnterCriticalSection(&m_mutex.m_internalMutex);
+    ++m_mutex.m_recursionCount;
+}
+    
+bool Mutex::tryLock()
+{
+    // This method is modeled after the behavior of pthread_mutex_trylock,
+    // which will return an error if the lock is already owned by the
+    // current thread.  Since the primitive Win32 'TryEnterCriticalSection'
+    // treats this as a successful case, it changes the behavior of several
+    // tests in WebKit that check to see if the current thread already
+    // owned this mutex (see e.g., IconDatabase::getOrCreateIconRecord)
+    DWORD result = TryEnterCriticalSection(&m_mutex.m_internalMutex);
+    
+    if (result != 0) {       // We got the lock
+        // If this thread already had the lock, we must unlock and
+        // return false so that we mimic the behavior of POSIX's
+        // pthread_mutex_trylock:
+        if (m_mutex.m_recursionCount > 0) {
+            LeaveCriticalSection(&m_mutex.m_internalMutex);
+            return false;
+        }
+
+        ++m_mutex.m_recursionCount;
+        return true;
+    }
+
+    return false;
+}
+
+void Mutex::unlock()
+{
+    ASSERT(m_mutex.m_recursionCount);
+    --m_mutex.m_recursionCount;
+    LeaveCriticalSection(&m_mutex.m_internalMutex);
+}
+
+bool PlatformCondition::timedWait(PlatformMutex& mutex, DWORD durationMilliseconds)
+{
+    // Enter the wait state.
+    DWORD res = WaitForSingleObject(m_blockLock, INFINITE);
+    ASSERT_UNUSED(res, res == WAIT_OBJECT_0);
+    ++m_waitersBlocked;
+    res = ReleaseSemaphore(m_blockLock, 1, 0);
+    ASSERT_UNUSED(res, res);
+
+    --mutex.m_recursionCount;
+    LeaveCriticalSection(&mutex.m_internalMutex);
+
+    // Main wait - use timeout.
+    bool timedOut = (WaitForSingleObject(m_blockQueue, durationMilliseconds) == WAIT_TIMEOUT);
+
+    res = WaitForSingleObject(m_unblockLock, INFINITE);
+    ASSERT_UNUSED(res, res == WAIT_OBJECT_0);
+
+    int signalsLeft = m_waitersToUnblock;
+
+    if (m_waitersToUnblock)
+        --m_waitersToUnblock;
+    else if (++m_waitersGone == (INT_MAX / 2)) { // timeout/canceled or spurious semaphore
+        // timeout or spurious wakeup occured, normalize the m_waitersGone count
+        // this may occur if many calls to wait with a timeout are made and
+        // no call to notify_* is made
+        res = WaitForSingleObject(m_blockLock, INFINITE);
+        ASSERT_UNUSED(res, res == WAIT_OBJECT_0);
+        m_waitersBlocked -= m_waitersGone;
+        res = ReleaseSemaphore(m_blockLock, 1, 0);
+        ASSERT_UNUSED(res, res);
+        m_waitersGone = 0;
+    }
+
+    res = ReleaseMutex(m_unblockLock);
+    ASSERT_UNUSED(res, res);
+
+    if (signalsLeft == 1) {
+        res = ReleaseSemaphore(m_blockLock, 1, 0); // Open the gate.
+        ASSERT_UNUSED(res, res);
+    }
+
+    EnterCriticalSection (&mutex.m_internalMutex);
+    ++mutex.m_recursionCount;
+
+    return !timedOut;
+}
+
+void PlatformCondition::signal(bool unblockAll)
+{
+    unsigned signalsToIssue = 0;
+
+    DWORD res = WaitForSingleObject(m_unblockLock, INFINITE);
+    ASSERT_UNUSED(res, res == WAIT_OBJECT_0);
+
+    if (m_waitersToUnblock) { // the gate is already closed
+        if (!m_waitersBlocked) { // no-op
+            res = ReleaseMutex(m_unblockLock);
+            ASSERT_UNUSED(res, res);
+            return;
+        }
+
+        if (unblockAll) {
+            signalsToIssue = m_waitersBlocked;
+            m_waitersToUnblock += m_waitersBlocked;
+            m_waitersBlocked = 0;
+        } else {
+            signalsToIssue = 1;
+            ++m_waitersToUnblock;
+            --m_waitersBlocked;
+        }
+    } else if (m_waitersBlocked > m_waitersGone) {
+        res = WaitForSingleObject(m_blockLock, INFINITE); // Close the gate.
+        ASSERT_UNUSED(res, res == WAIT_OBJECT_0);
+        if (m_waitersGone != 0) {
+            m_waitersBlocked -= m_waitersGone;
+            m_waitersGone = 0;
+        }
+        if (unblockAll) {
+            signalsToIssue = m_waitersBlocked;
+            m_waitersToUnblock = m_waitersBlocked;
+            m_waitersBlocked = 0;
+        } else {
+            signalsToIssue = 1;
+            m_waitersToUnblock = 1;
+            --m_waitersBlocked;
+        }
+    } else { // No-op.
+        res = ReleaseMutex(m_unblockLock);
+        ASSERT_UNUSED(res, res);
+        return;
+    }
+
+    res = ReleaseMutex(m_unblockLock);
+    ASSERT_UNUSED(res, res);
+
+    if (signalsToIssue) {
+        res = ReleaseSemaphore(m_blockQueue, signalsToIssue, 0);
+        ASSERT_UNUSED(res, res);
+    }
+}
+
+static const long MaxSemaphoreCount = static_cast<long>(~0UL >> 1);
+
+ThreadCondition::ThreadCondition()
+{
+    m_condition.m_waitersGone = 0;
+    m_condition.m_waitersBlocked = 0;
+    m_condition.m_waitersToUnblock = 0;
+    m_condition.m_blockLock = CreateSemaphore(0, 1, 1, 0);
+    m_condition.m_blockQueue = CreateSemaphore(0, 0, MaxSemaphoreCount, 0);
+    m_condition.m_unblockLock = CreateMutex(0, 0, 0);
+
+    if (!m_condition.m_blockLock || !m_condition.m_blockQueue || !m_condition.m_unblockLock) {
+        if (m_condition.m_blockLock)
+            CloseHandle(m_condition.m_blockLock);
+        if (m_condition.m_blockQueue)
+            CloseHandle(m_condition.m_blockQueue);
+        if (m_condition.m_unblockLock)
+            CloseHandle(m_condition.m_unblockLock);
+    }
+}
+
+ThreadCondition::~ThreadCondition()
+{
+    CloseHandle(m_condition.m_blockLock);
+    CloseHandle(m_condition.m_blockQueue);
+    CloseHandle(m_condition.m_unblockLock);
+}
+
+void ThreadCondition::wait(Mutex& mutex)
+{
+    m_condition.timedWait(mutex.impl(), INFINITE);
+}
+
+bool ThreadCondition::timedWait(Mutex& mutex, double absoluteTime)
+{
+    DWORD interval = absoluteTimeToWaitTimeoutInterval(absoluteTime);
+
+    if (!interval) {
+        // Consider the wait to have timed out, even if our condition has already been signaled, to
+        // match the pthreads implementation.
+        return false;
+    }
+
+    return m_condition.timedWait(mutex.impl(), interval);
+}
+
+void ThreadCondition::signal()
+{
+    m_condition.signal(false); // Unblock only 1 thread.
+}
+
+void ThreadCondition::broadcast()
+{
+    m_condition.signal(true); // Unblock all threads.
+}
+
+DWORD absoluteTimeToWaitTimeoutInterval(double absoluteTime)
+{
+    double currentTime = WTF::currentTime();
+
+    // Time is in the past - return immediately.
+    if (absoluteTime < currentTime)
+        return 0;
+
+    // Time is too far in the future (and would overflow unsigned long) - wait forever.
+    if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0)
+        return INFINITE;
+
+    return static_cast<DWORD>((absoluteTime - currentTime) * 1000.0);
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/TypeTraits.cpp b/Source/WTF/wtf/TypeTraits.cpp
new file mode 100644
index 0000000..7cea256
--- /dev/null
+++ b/Source/WTF/wtf/TypeTraits.cpp
@@ -0,0 +1,155 @@
+ /*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2010 Google 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.
+ *
+ */
+
+#include "config.h"
+#include "TypeTraits.h"
+
+#include "Assertions.h"
+
+namespace WTF {
+
+COMPILE_ASSERT(IsInteger<bool>::value, WTF_IsInteger_bool_true);
+COMPILE_ASSERT(IsInteger<char>::value, WTF_IsInteger_char_true);
+COMPILE_ASSERT(IsInteger<signed char>::value, WTF_IsInteger_signed_char_true);
+COMPILE_ASSERT(IsInteger<unsigned char>::value, WTF_IsInteger_unsigned_char_true);
+COMPILE_ASSERT(IsInteger<short>::value, WTF_IsInteger_short_true);
+COMPILE_ASSERT(IsInteger<unsigned short>::value, WTF_IsInteger_unsigned_short_true);
+COMPILE_ASSERT(IsInteger<int>::value, WTF_IsInteger_int_true);
+COMPILE_ASSERT(IsInteger<unsigned int>::value, WTF_IsInteger_unsigned_int_true);
+COMPILE_ASSERT(IsInteger<long>::value, WTF_IsInteger_long_true);
+COMPILE_ASSERT(IsInteger<unsigned long>::value, WTF_IsInteger_unsigned_long_true);
+COMPILE_ASSERT(IsInteger<long long>::value, WTF_IsInteger_long_long_true);
+COMPILE_ASSERT(IsInteger<unsigned long long>::value, WTF_IsInteger_unsigned_long_long_true);
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+COMPILE_ASSERT(IsInteger<wchar_t>::value, WTF_IsInteger_wchar_t_true);
+#endif
+COMPILE_ASSERT(!IsInteger<char*>::value, WTF_IsInteger_char_pointer_false);
+COMPILE_ASSERT(!IsInteger<const char*>::value, WTF_IsInteger_const_char_pointer_false);
+COMPILE_ASSERT(!IsInteger<volatile char*>::value, WTF_IsInteger_volatile_char_pointer_false);
+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);
+COMPILE_ASSERT(IsPod<unsigned char>::value, WTF_IsPod_unsigned_char_true);
+COMPILE_ASSERT(IsPod<short>::value, WTF_IsPod_short_true);
+COMPILE_ASSERT(IsPod<unsigned short>::value, WTF_IsPod_unsigned_short_true);
+COMPILE_ASSERT(IsPod<int>::value, WTF_IsPod_int_true);
+COMPILE_ASSERT(IsPod<unsigned int>::value, WTF_IsPod_unsigned_int_true);
+COMPILE_ASSERT(IsPod<long>::value, WTF_IsPod_long_true);
+COMPILE_ASSERT(IsPod<unsigned long>::value, WTF_IsPod_unsigned_long_true);
+COMPILE_ASSERT(IsPod<long long>::value, WTF_IsPod_long_long_true);
+COMPILE_ASSERT(IsPod<unsigned long long>::value, WTF_IsPod_unsigned_long_long_true);
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+COMPILE_ASSERT(IsPod<wchar_t>::value, WTF_IsPod_wchar_t_true);
+#endif
+COMPILE_ASSERT(IsPod<char*>::value, WTF_IsPod_char_pointer_true);
+COMPILE_ASSERT(IsPod<const char*>::value, WTF_IsPod_const_char_pointer_true);
+COMPILE_ASSERT(IsPod<volatile char*>::value, WTF_IsPod_volatile_char_pointer_true);
+COMPILE_ASSERT(IsPod<double>::value, WTF_IsPod_double_true);
+COMPILE_ASSERT(IsPod<long double>::value, WTF_IsPod_long_double_true);
+COMPILE_ASSERT(IsPod<float>::value, WTF_IsPod_float_true);
+COMPILE_ASSERT(!IsPod<IsPod<bool> >::value, WTF_IsPod_struct_false);
+
+enum IsConvertibleToIntegerCheck { };
+COMPILE_ASSERT(IsConvertibleToInteger<IsConvertibleToIntegerCheck>::value, WTF_IsConvertibleToInteger_enum_true);
+COMPILE_ASSERT(IsConvertibleToInteger<bool>::value, WTF_IsConvertibleToInteger_bool_true);
+COMPILE_ASSERT(IsConvertibleToInteger<char>::value, WTF_IsConvertibleToInteger_char_true);
+COMPILE_ASSERT(IsConvertibleToInteger<signed char>::value, WTF_IsConvertibleToInteger_signed_char_true);
+COMPILE_ASSERT(IsConvertibleToInteger<unsigned char>::value, WTF_IsConvertibleToInteger_unsigned_char_true);
+COMPILE_ASSERT(IsConvertibleToInteger<short>::value, WTF_IsConvertibleToInteger_short_true);
+COMPILE_ASSERT(IsConvertibleToInteger<unsigned short>::value, WTF_IsConvertibleToInteger_unsigned_short_true);
+COMPILE_ASSERT(IsConvertibleToInteger<int>::value, WTF_IsConvertibleToInteger_int_true);
+COMPILE_ASSERT(IsConvertibleToInteger<unsigned int>::value, WTF_IsConvertibleToInteger_unsigned_int_true);
+COMPILE_ASSERT(IsConvertibleToInteger<long>::value, WTF_IsConvertibleToInteger_long_true);
+COMPILE_ASSERT(IsConvertibleToInteger<unsigned long>::value, WTF_IsConvertibleToInteger_unsigned_long_true);
+COMPILE_ASSERT(IsConvertibleToInteger<long long>::value, WTF_IsConvertibleToInteger_long_long_true);
+COMPILE_ASSERT(IsConvertibleToInteger<unsigned long long>::value, WTF_IsConvertibleToInteger_unsigned_long_long_true);
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+COMPILE_ASSERT(IsConvertibleToInteger<wchar_t>::value, WTF_IsConvertibleToInteger_wchar_t_true);
+#endif
+COMPILE_ASSERT(IsConvertibleToInteger<double>::value, WTF_IsConvertibleToInteger_double_true);
+COMPILE_ASSERT(IsConvertibleToInteger<long double>::value, WTF_IsConvertibleToInteger_long_double_true);
+COMPILE_ASSERT(IsConvertibleToInteger<float>::value, WTF_IsConvertibleToInteger_float_true);
+COMPILE_ASSERT(!IsConvertibleToInteger<char*>::value, WTF_IsConvertibleToInteger_char_pointer_false);
+COMPILE_ASSERT(!IsConvertibleToInteger<const char*>::value, WTF_IsConvertibleToInteger_const_char_pointer_false);
+COMPILE_ASSERT(!IsConvertibleToInteger<volatile char*>::value, WTF_IsConvertibleToInteger_volatile_char_pointer_false);
+COMPILE_ASSERT(!IsConvertibleToInteger<IsConvertibleToInteger<bool> >::value, WTF_IsConvertibleToInteger_struct_false);
+
+COMPILE_ASSERT((IsSameType<bool, bool>::value), WTF_IsSameType_bool_true);
+COMPILE_ASSERT((IsSameType<int*, int*>::value), WTF_IsSameType_int_pointer_true);
+COMPILE_ASSERT((!IsSameType<int, int*>::value), WTF_IsSameType_int_int_pointer_false);
+COMPILE_ASSERT((!IsSameType<bool, const bool>::value), WTF_IsSameType_const_change_false);
+COMPILE_ASSERT((!IsSameType<bool, volatile bool>::value), WTF_IsSameType_volatile_change_false);
+
+template <typename T>
+class TestBaseClass {
+};
+
+class TestDerivedClass : public TestBaseClass<int> {
+};
+
+COMPILE_ASSERT((IsSubclass<TestDerivedClass, TestBaseClass<int> >::value), WTF_Test_IsSubclass_Derived_From_Base);
+COMPILE_ASSERT((!IsSubclass<TestBaseClass<int>, TestDerivedClass>::value), WTF_Test_IsSubclass_Base_From_Derived);
+COMPILE_ASSERT((IsSubclassOfTemplate<TestDerivedClass, TestBaseClass>::value), WTF_Test_IsSubclassOfTemplate_Base_From_Derived);
+COMPILE_ASSERT((IsSameType<RemoveTemplate<TestBaseClass<int>, TestBaseClass>::Type, int>::value), WTF_Test_RemoveTemplate);
+COMPILE_ASSERT((IsSameType<RemoveTemplate<int, TestBaseClass>::Type, int>::value), WTF_Test_RemoveTemplate_WithoutTemplate);
+
+
+COMPILE_ASSERT((IsSameType<bool, RemoveConst<const bool>::Type>::value), WTF_test_RemoveConst_const_bool);
+COMPILE_ASSERT((!IsSameType<bool, RemoveConst<volatile bool>::Type>::value), WTF_test_RemoveConst_volatile_bool);
+
+COMPILE_ASSERT((IsSameType<bool, RemoveVolatile<bool>::Type>::value), WTF_test_RemoveVolatile_bool);
+COMPILE_ASSERT((!IsSameType<bool, RemoveVolatile<const bool>::Type>::value), WTF_test_RemoveVolatile_const_bool);
+COMPILE_ASSERT((IsSameType<bool, RemoveVolatile<volatile bool>::Type>::value), WTF_test_RemoveVolatile_volatile_bool);
+
+COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<bool>::Type>::value), WTF_test_RemoveConstVolatile_bool);
+COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<const bool>::Type>::value), WTF_test_RemoveConstVolatile_const_bool);
+COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<volatile bool>::Type>::value), WTF_test_RemoveConstVolatile_volatile_bool);
+COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<const volatile bool>::Type>::value), WTF_test_RemoveConstVolatile_const_volatile_bool);
+
+COMPILE_ASSERT((IsSameType<int, RemovePointer<int>::Type>::value), WTF_Test_RemovePointer_int);
+COMPILE_ASSERT((IsSameType<int, RemovePointer<int*>::Type>::value), WTF_Test_RemovePointer_int_pointer);
+COMPILE_ASSERT((!IsSameType<int, RemovePointer<int**>::Type>::value), WTF_Test_RemovePointer_int_pointer_pointer);
+
+COMPILE_ASSERT((IsSameType<int, RemoveReference<int>::Type>::value), WTF_Test_RemoveReference_int);
+COMPILE_ASSERT((IsSameType<int, RemoveReference<int&>::Type>::value), WTF_Test_RemoveReference_int_reference);
+
+
+typedef int IntArray[];
+typedef int IntArraySized[4];
+
+COMPILE_ASSERT((IsArray<IntArray>::value), WTF_Test_IsArray_int_array);
+COMPILE_ASSERT((IsArray<IntArraySized>::value), WTF_Test_IsArray_int_sized_array);
+
+COMPILE_ASSERT((IsSameType<int, RemoveExtent<IntArray>::Type>::value), WTF_Test_RemoveExtent_int_array);
+COMPILE_ASSERT((IsSameType<int, RemoveExtent<IntArraySized>::Type>::value), WTF_Test_RemoveReference_int_sized_array);
+
+COMPILE_ASSERT((IsSameType<int*, DecayArray<IntArray>::Type>::value), WTF_Test_DecayArray_int_array);
+COMPILE_ASSERT((IsSameType<int*, DecayArray<IntArraySized>::Type>::value), WTF_Test_DecayArray_int_sized_array);
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/TypeTraits.h b/Source/WTF/wtf/TypeTraits.h
new file mode 100644
index 0000000..b9e46bc
--- /dev/null
+++ b/Source/WTF/wtf/TypeTraits.h
@@ -0,0 +1,261 @@
+ /*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2010 Google 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 TypeTraits_h
+#define TypeTraits_h
+
+#include <wtf/Platform.h>
+
+#if (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
+#include <type_traits>
+#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+#include <tr1/memory>
+#endif
+#endif
+
+namespace WTF {
+
+    // The following are provided in this file:
+    //
+    //   Conditional<Predicate, If, Then>::Type
+    //
+    //   IsInteger<T>::value
+    //   IsPod<T>::value, see the definition for a note about its limitations
+    //   IsConvertibleToInteger<T>::value
+    //
+    //   IsArray<T>::value
+    //
+    //   IsSameType<T, U>::value
+    //
+    //   RemovePointer<T>::Type
+    //   RemoveReference<T>::Type
+    //   RemoveConst<T>::Type
+    //   RemoveVolatile<T>::Type
+    //   RemoveConstVolatile<T>::Type
+    //   RemoveExtent<T>::Type
+    //
+    //   DecayArray<T>::Type
+    //
+    //   COMPILE_ASSERT's in TypeTraits.cpp illustrate their usage and what they do.
+
+    template <bool Predicate, class If, class Then> struct Conditional  { typedef If Type; };
+    template <class If, class Then> struct Conditional<false, If, Then> { typedef Then Type; };
+
+    template<typename T> struct IsInteger           { static const bool value = false; };
+    template<> struct IsInteger<bool>               { static const bool value = true; };
+    template<> struct IsInteger<char>               { static const bool value = true; };
+    template<> struct IsInteger<signed char>        { static const bool value = true; };
+    template<> struct IsInteger<unsigned char>      { static const bool value = true; };
+    template<> struct IsInteger<short>              { static const bool value = true; };
+    template<> struct IsInteger<unsigned short>     { static const bool value = true; };
+    template<> struct IsInteger<int>                { static const bool value = true; };
+    template<> struct IsInteger<unsigned int>       { static const bool value = true; };
+    template<> struct IsInteger<long>               { static const bool value = true; };
+    template<> struct IsInteger<unsigned long>      { static const bool value = true; };
+    template<> struct IsInteger<long long>          { static const bool value = true; };
+    template<> struct IsInteger<unsigned long long> { static const bool value = true; };
+#if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
+    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 = IsArithmetic<T>::value; };
+    template <typename P> struct IsPod<P*>       { static const bool value = true; };
+
+    template<typename T> class IsConvertibleToInteger {
+        // Avoid "possible loss of data" warning when using Microsoft's C++ compiler
+        // by not converting int's to doubles.
+        template<bool performCheck, typename U> class IsConvertibleToDouble;
+        template<typename U> class IsConvertibleToDouble<false, U> {
+        public:
+            static const bool value = false;
+        };
+
+        template<typename U> class IsConvertibleToDouble<true, U> {
+            typedef char YesType;
+            struct NoType {
+                char padding[8];
+            };
+
+            static YesType floatCheck(long double);
+            static NoType floatCheck(...);
+            static T& t;
+        public:
+            static const bool value = sizeof(floatCheck(t)) == sizeof(YesType);
+        };
+
+    public:
+        static const bool value = IsInteger<T>::value || IsConvertibleToDouble<!IsInteger<T>::value, T>::value;
+    };
+
+
+    template <class T> struct IsArray {
+        static const bool value = false;
+    };
+
+    template <class T> struct IsArray<T[]> {
+        static const bool value = true;
+    };
+
+    template <class T, size_t N> struct IsArray<T[N]> {
+        static const bool value = true;
+    };
+
+
+    template <typename T, typename U> struct IsSameType {
+        static const bool value = false;
+    };
+
+    template <typename T> struct IsSameType<T, T> {
+        static const bool value = true;
+    };
+
+    template <typename T, typename U> class IsSubclass {
+        typedef char YesType;
+        struct NoType {
+            char padding[8];
+        };
+
+        static YesType subclassCheck(U*);
+        static NoType subclassCheck(...);
+        static T* t;
+    public:
+        static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
+    };
+
+    template <typename T, template<class V> class U> class IsSubclassOfTemplate {
+        typedef char YesType;
+        struct NoType {
+            char padding[8];
+        };
+
+        template<typename W> static YesType subclassCheck(U<W>*);
+        static NoType subclassCheck(...);
+        static T* t;
+    public:
+        static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
+    };
+
+    template <typename T, template <class V> class OuterTemplate> struct RemoveTemplate {
+        typedef T Type;
+    };
+
+    template <typename T, template <class V> class OuterTemplate> struct RemoveTemplate<OuterTemplate<T>, OuterTemplate> {
+        typedef T Type;
+    };
+
+    template <typename T> struct RemoveConst {
+        typedef T Type;
+    };
+
+    template <typename T> struct RemoveConst<const T> {
+        typedef T Type;
+    };
+
+    template <typename T> struct RemoveVolatile {
+        typedef T Type;
+    };
+
+    template <typename T> struct RemoveVolatile<volatile T> {
+        typedef T Type;
+    };
+
+    template <typename T> struct RemoveConstVolatile {
+        typedef typename RemoveVolatile<typename RemoveConst<T>::Type>::Type Type;
+    };
+
+    template <typename T> struct RemovePointer {
+        typedef T Type;
+    };
+
+    template <typename T> struct RemovePointer<T*> {
+        typedef T Type;
+    };
+
+    template <typename T> struct RemoveReference {
+        typedef T Type;
+    };
+
+    template <typename T> struct RemoveReference<T&> {
+        typedef T Type;
+    };
+
+    template <typename T> struct RemoveExtent {
+        typedef T Type;
+    };
+
+    template <typename T> struct RemoveExtent<T[]> {
+        typedef T Type;
+    };
+
+    template <typename T, size_t N> struct RemoveExtent<T[N]> {
+        typedef T Type;
+    };
+
+    template <class T> struct DecayArray {
+        typedef typename RemoveReference<T>::Type U;
+    public:
+        typedef typename Conditional<
+            IsArray<U>::value,
+            typename RemoveExtent<U>::Type*,
+            typename RemoveConstVolatile<U>::Type
+        >::Type Type;
+    };
+
+#if COMPILER(CLANG) || GCC_VERSION_AT_LEAST(4, 6, 0) || (defined(_MSC_VER) && (_MSC_VER >= 1400) && (_MSC_VER < 1600) && !defined(__INTEL_COMPILER))
+    // VC8 (VS2005) and later has __has_trivial_constructor and __has_trivial_destructor,
+    // but the implementation returns false for built-in types. We add the extra IsPod condition to 
+    // work around this.
+    template <typename T> struct HasTrivialConstructor {
+        static const bool value = __has_trivial_constructor(T) || IsPod<RemoveConstVolatile<T> >::value;
+    };
+    template <typename T> struct HasTrivialDestructor {
+        static const bool value = __has_trivial_destructor(T) || IsPod<RemoveConstVolatile<T> >::value;
+    };
+#elif (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
+    // GCC's libstdc++ 20070724 and later supports C++ TR1 type_traits in the std namespace.
+    // VC10 (VS2010) and later support C++ TR1 type_traits in the std::tr1 namespace.
+    template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { };
+    template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { };
+#else
+    // For compilers that don't support detection of trivial constructors and destructors in classes, 
+    // we use a template that returns true for any POD type that IsPod can detect (see IsPod caveats above), 
+    // but false for all other types (which includes all classes). This will give false negatives, which can hurt 
+    // performance, but avoids false positives, which would result in incorrect behavior.
+    template <typename T> struct HasTrivialConstructor {
+        static const bool value = IsPod<RemoveConstVolatile<T> >::value;
+    };
+    template <typename T> struct HasTrivialDestructor {
+        static const bool value = IsPod<RemoveConstVolatile<T> >::value;
+    };
+#endif
+
+} // namespace WTF
+
+#endif // TypeTraits_h
diff --git a/Source/WTF/wtf/TypedArrayBase.h b/Source/WTF/wtf/TypedArrayBase.h
new file mode 100644
index 0000000..6d2a0f2
--- /dev/null
+++ b/Source/WTF/wtf/TypedArrayBase.h
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2010, 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:
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 TypedArrayBase_h
+#define TypedArrayBase_h
+
+#include <wtf/ArrayBuffer.h>
+#include <wtf/ArrayBufferView.h>
+
+namespace WTF {
+
+template <typename T>
+class TypedArrayBase : public ArrayBufferView {
+  public:
+    T* data() const { return static_cast<T*>(baseAddress()); }
+
+    bool set(TypedArrayBase<T>* array, unsigned offset)
+    {
+        return setImpl(array, offset * sizeof(T));
+    }
+
+    bool setRange(const T* data, size_t dataLength, unsigned offset)
+    {
+        return setRangeImpl(reinterpret_cast<const char*>(data), dataLength * sizeof(T), offset * sizeof(T));
+    }
+
+    bool zeroRange(unsigned offset, size_t length)
+    {
+        return zeroRangeImpl(offset * sizeof(T), length * sizeof(T));
+    }
+
+    // Overridden from ArrayBufferView. This must be public because of
+    // rules about inheritance of members in template classes, and
+    // because it is accessed via pointers to subclasses.
+    unsigned length() const
+    {
+        return m_length;
+    }
+
+    virtual unsigned byteLength() const
+    {
+        return m_length * sizeof(T);
+    }
+
+    // Invoked by the indexed getter. Does not perform range checks; caller
+    // is responsible for doing so and returning undefined as necessary.
+    T item(unsigned index) const
+    {
+        ASSERT(index < TypedArrayBase<T>::m_length);
+        return TypedArrayBase<T>::data()[index];
+    }
+
+    bool checkInboundData(unsigned offset, unsigned pos) const
+    {
+        return (offset <= m_length
+            && offset + pos <= m_length
+            // check overflow
+            && offset + pos >= offset);
+    }
+
+protected:
+    TypedArrayBase(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+        : ArrayBufferView(buffer, byteOffset)
+        , m_length(length)
+    {
+    }
+
+    template <class Subclass>
+    static PassRefPtr<Subclass> create(unsigned length)
+    {
+        RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(length, sizeof(T));
+        if (!buffer.get())
+            return 0;
+        return create<Subclass>(buffer, 0, length);
+    }
+
+    template <class Subclass>
+    static PassRefPtr<Subclass> create(const T* array, unsigned length)
+    {
+        RefPtr<Subclass> a = create<Subclass>(length);
+        if (a)
+            for (unsigned i = 0; i < length; ++i)
+                a->set(i, array[i]);
+        return a;
+    }
+
+    template <class Subclass>
+    static PassRefPtr<Subclass> create(PassRefPtr<ArrayBuffer> buffer,
+                                       unsigned byteOffset,
+                                       unsigned length)
+    {
+        RefPtr<ArrayBuffer> buf(buffer);
+        if (!verifySubRange<T>(buf, byteOffset, length))
+            return 0;
+
+        return adoptRef(new Subclass(buf, byteOffset, length));
+    }
+
+    template <class Subclass>
+    static PassRefPtr<Subclass> createUninitialized(unsigned length)
+    {
+        RefPtr<ArrayBuffer> buffer = ArrayBuffer::createUninitialized(length, sizeof(T));
+        if (!buffer.get())
+            return 0;
+        return create<Subclass>(buffer, 0, length);
+    }
+
+    template <class Subclass>
+    PassRefPtr<Subclass> subarrayImpl(int start, int end) const
+    {
+        unsigned offset, length;
+        calculateOffsetAndLength(start, end, m_length, &offset, &length);
+        clampOffsetAndNumElements<T>(buffer(), m_byteOffset, &offset, &length);
+        return create<Subclass>(buffer(), offset, length);
+    }
+
+    virtual void neuter()
+    {
+        ArrayBufferView::neuter();
+        m_length = 0;
+    }
+
+    // We do not want to have to access this via a virtual function in subclasses,
+    // which is why it is protected rather than private.
+    unsigned m_length;
+};
+
+} // namespace WTF
+
+using WTF::TypedArrayBase;
+
+#endif // TypedArrayBase_h
diff --git a/Source/WTF/wtf/Uint16Array.h b/Source/WTF/wtf/Uint16Array.h
new file mode 100644
index 0000000..1444693
--- /dev/null
+++ b/Source/WTF/wtf/Uint16Array.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 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:
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 Uint16Array_h
+#define Uint16Array_h
+
+#include <wtf/IntegralTypedArrayBase.h>
+
+namespace WTF {
+
+class ArrayBuffer;
+
+class Uint16Array : public IntegralTypedArrayBase<unsigned short> {
+public:
+    static inline PassRefPtr<Uint16Array> create(unsigned length);
+    static inline PassRefPtr<Uint16Array> create(const unsigned short* array, unsigned length);
+    static inline PassRefPtr<Uint16Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+
+    // Should only be used when it is known the entire array will be filled. Do
+    // not return these results directly to JavaScript without filling first.
+    static inline PassRefPtr<Uint16Array> createUninitialized(unsigned length);
+
+    // Can’t use "using" here due to a bug in the RVCT compiler.
+    bool set(TypedArrayBase<unsigned short>* array, unsigned offset) { return TypedArrayBase<unsigned short>::set(array, offset); }
+    void set(unsigned index, double value) { IntegralTypedArrayBase<unsigned short>::set(index, value); }
+
+    inline PassRefPtr<Uint16Array> subarray(int start) const;
+    inline PassRefPtr<Uint16Array> subarray(int start, int end) const;
+
+    virtual ViewType getType() const
+    {
+        return TypeUint16;
+    }
+
+private:
+    inline Uint16Array(PassRefPtr<ArrayBuffer>,
+                            unsigned byteOffset,
+                            unsigned length);
+    // Make constructor visible to superclass.
+    friend class TypedArrayBase<unsigned short>;
+};
+
+PassRefPtr<Uint16Array> Uint16Array::create(unsigned length)
+{
+    return TypedArrayBase<unsigned short>::create<Uint16Array>(length);
+}
+
+PassRefPtr<Uint16Array> Uint16Array::create(const unsigned short* array, unsigned length)
+{
+    return TypedArrayBase<unsigned short>::create<Uint16Array>(array, length);
+}
+
+PassRefPtr<Uint16Array> Uint16Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+{
+    return TypedArrayBase<unsigned short>::create<Uint16Array>(buffer, byteOffset, length);
+}
+
+PassRefPtr<Uint16Array> Uint16Array::createUninitialized(unsigned length)
+{
+    return TypedArrayBase<unsigned short>::createUninitialized<Uint16Array>(length);
+}
+
+Uint16Array::Uint16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+    : IntegralTypedArrayBase<unsigned short>(buffer, byteOffset, length)
+{
+}
+
+PassRefPtr<Uint16Array> Uint16Array::subarray(int start) const
+{
+    return subarray(start, length());
+}
+
+PassRefPtr<Uint16Array> Uint16Array::subarray(int start, int end) const
+{
+    return subarrayImpl<Uint16Array>(start, end);
+}
+
+} // namespace WTF
+
+using WTF::Uint16Array;
+
+#endif // Uint16Array_h
diff --git a/Source/WTF/wtf/Uint32Array.h b/Source/WTF/wtf/Uint32Array.h
new file mode 100644
index 0000000..1e5b028
--- /dev/null
+++ b/Source/WTF/wtf/Uint32Array.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 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:
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 Uint32Array_h
+#define Uint32Array_h
+
+#include <wtf/IntegralTypedArrayBase.h>
+
+namespace WTF {
+
+class ArrayBuffer;
+
+class Uint32Array : public IntegralTypedArrayBase<unsigned int> {
+public:
+    static inline PassRefPtr<Uint32Array> create(unsigned length);
+    static inline PassRefPtr<Uint32Array> create(const unsigned int* array, unsigned length);
+    static inline PassRefPtr<Uint32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+
+    // Should only be used when it is known the entire array will be filled. Do
+    // not return these results directly to JavaScript without filling first.
+    static inline PassRefPtr<Uint32Array> createUninitialized(unsigned length);
+
+    // Can’t use "using" here due to a bug in the RVCT compiler.
+    bool set(TypedArrayBase<unsigned int>* array, unsigned offset) { return TypedArrayBase<unsigned int>::set(array, offset); }
+    void set(unsigned index, double value) { IntegralTypedArrayBase<unsigned int>::set(index, value); }
+
+    inline PassRefPtr<Uint32Array> subarray(int start) const;
+    inline PassRefPtr<Uint32Array> subarray(int start, int end) const;
+
+    virtual ViewType getType() const
+    {
+        return TypeUint32;
+    }
+
+private:
+    inline Uint32Array(PassRefPtr<ArrayBuffer>,
+                          unsigned byteOffset,
+                          unsigned length);
+    // Make constructor visible to superclass.
+    friend class TypedArrayBase<unsigned int>;
+};
+
+PassRefPtr<Uint32Array> Uint32Array::create(unsigned length)
+{
+    return TypedArrayBase<unsigned int>::create<Uint32Array>(length);
+}
+
+PassRefPtr<Uint32Array> Uint32Array::create(const unsigned int* array, unsigned length)
+{
+    return TypedArrayBase<unsigned int>::create<Uint32Array>(array, length);
+}
+
+PassRefPtr<Uint32Array> Uint32Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+{
+    return TypedArrayBase<unsigned int>::create<Uint32Array>(buffer, byteOffset, length);
+}
+
+PassRefPtr<Uint32Array> Uint32Array::createUninitialized(unsigned length)
+{
+    return TypedArrayBase<unsigned int>::createUninitialized<Uint32Array>(length);
+}
+
+Uint32Array::Uint32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+    : IntegralTypedArrayBase<unsigned int>(buffer, byteOffset, length)
+{
+}
+
+PassRefPtr<Uint32Array> Uint32Array::subarray(int start) const
+{
+    return subarray(start, length());
+}
+
+PassRefPtr<Uint32Array> Uint32Array::subarray(int start, int end) const
+{
+    return subarrayImpl<Uint32Array>(start, end);
+}
+
+} // namespace WTF
+
+using WTF::Uint32Array;
+
+#endif // Uint32Array_h
diff --git a/Source/WTF/wtf/Uint8Array.h b/Source/WTF/wtf/Uint8Array.h
new file mode 100644
index 0000000..a23d1eb
--- /dev/null
+++ b/Source/WTF/wtf/Uint8Array.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 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:
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 Uint8Array_h
+#define Uint8Array_h
+
+#include <wtf/IntegralTypedArrayBase.h>
+
+namespace WTF {
+
+class ArrayBuffer;
+
+class Uint8Array : public IntegralTypedArrayBase<unsigned char> {
+public:
+    static inline PassRefPtr<Uint8Array> create(unsigned length);
+    static inline PassRefPtr<Uint8Array> create(const unsigned char* array, unsigned length);
+    static inline PassRefPtr<Uint8Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+
+    // Should only be used when it is known the entire array will be filled. Do
+    // not return these results directly to JavaScript without filling first.
+    static inline PassRefPtr<Uint8Array> createUninitialized(unsigned length);
+
+    // Can’t use "using" here due to a bug in the RVCT compiler.
+    bool set(TypedArrayBase<unsigned char>* array, unsigned offset) { return TypedArrayBase<unsigned char>::set(array, offset); }
+    void set(unsigned index, double value) { IntegralTypedArrayBase<unsigned char>::set(index, value); }
+
+    inline PassRefPtr<Uint8Array> subarray(int start) const;
+    inline PassRefPtr<Uint8Array> subarray(int start, int end) const;
+
+    virtual ViewType getType() const
+    {
+        return TypeUint8;
+    }
+
+protected:
+    inline Uint8Array(PassRefPtr<ArrayBuffer>,
+                           unsigned byteOffset,
+                           unsigned length);
+    // Make constructor visible to superclass.
+    friend class TypedArrayBase<unsigned char>;
+};
+
+PassRefPtr<Uint8Array> Uint8Array::create(unsigned length)
+{
+    return TypedArrayBase<unsigned char>::create<Uint8Array>(length);
+}
+
+PassRefPtr<Uint8Array> Uint8Array::create(const unsigned char* array, unsigned length)
+{
+    return TypedArrayBase<unsigned char>::create<Uint8Array>(array, length);
+}
+
+PassRefPtr<Uint8Array> Uint8Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+{
+    return TypedArrayBase<unsigned char>::create<Uint8Array>(buffer, byteOffset, length);
+}
+
+PassRefPtr<Uint8Array> Uint8Array::createUninitialized(unsigned length)
+{
+    return TypedArrayBase<unsigned char>::createUninitialized<Uint8Array>(length);
+}
+
+Uint8Array::Uint8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+: IntegralTypedArrayBase<unsigned char>(buffer, byteOffset, length)
+{
+}
+
+PassRefPtr<Uint8Array> Uint8Array::subarray(int start) const
+{
+    return subarray(start, length());
+}
+
+PassRefPtr<Uint8Array> Uint8Array::subarray(int start, int end) const
+{
+    return subarrayImpl<Uint8Array>(start, end);
+}
+
+} // namespace WTF
+
+using WTF::Uint8Array;
+
+#endif // Uint8Array_h
diff --git a/Source/WTF/wtf/Uint8ClampedArray.h b/Source/WTF/wtf/Uint8ClampedArray.h
new file mode 100644
index 0000000..f3d92ac
--- /dev/null
+++ b/Source/WTF/wtf/Uint8ClampedArray.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 Uint8ClampedArray_h
+#define Uint8ClampedArray_h
+
+#include <wtf/Platform.h>
+
+#include <wtf/Uint8Array.h>
+#include <wtf/MathExtras.h>
+
+namespace WTF {
+
+class Uint8ClampedArray : public Uint8Array {
+public:
+    static inline PassRefPtr<Uint8ClampedArray> create(unsigned length);
+    static inline PassRefPtr<Uint8ClampedArray> create(const unsigned char* array, unsigned length);
+    static inline PassRefPtr<Uint8ClampedArray> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+
+    // Should only be used when it is known the entire array will be filled. Do
+    // not return these results directly to JavaScript without filling first.
+    static inline PassRefPtr<Uint8ClampedArray> createUninitialized(unsigned length);
+
+    // It's only needed to potentially call this method if the array
+    // was created uninitialized -- the default initialization paths
+    // zero the allocated memory.
+    inline void zeroFill();
+
+    // Can’t use "using" here due to a bug in the RVCT compiler.
+    bool set(TypedArrayBase<unsigned char>* array, unsigned offset) { return TypedArrayBase<unsigned char>::set(array, offset); }
+    inline void set(unsigned index, double value);
+
+    inline PassRefPtr<Uint8ClampedArray> subarray(int start) const;
+    inline PassRefPtr<Uint8ClampedArray> subarray(int start, int end) const;
+
+    virtual ViewType getType() const
+    {
+        return TypeUint8Clamped;
+    }
+
+private:
+    inline Uint8ClampedArray(PassRefPtr<ArrayBuffer>,
+                             unsigned byteOffset,
+                             unsigned length);
+    // Make constructor visible to superclass.
+    friend class TypedArrayBase<unsigned char>;
+};
+
+PassRefPtr<Uint8ClampedArray> Uint8ClampedArray::create(unsigned length)
+{
+    return TypedArrayBase<unsigned char>::create<Uint8ClampedArray>(length);
+}
+
+PassRefPtr<Uint8ClampedArray> Uint8ClampedArray::create(const unsigned char* array, unsigned length)
+{
+    return TypedArrayBase<unsigned char>::create<Uint8ClampedArray>(array, length);
+}
+
+PassRefPtr<Uint8ClampedArray> Uint8ClampedArray::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+{
+    return TypedArrayBase<unsigned char>::create<Uint8ClampedArray>(buffer, byteOffset, length);
+}
+
+PassRefPtr<Uint8ClampedArray> Uint8ClampedArray::createUninitialized(unsigned length)
+{
+    return TypedArrayBase<unsigned char>::createUninitialized<Uint8ClampedArray>(length);
+}
+
+void Uint8ClampedArray::zeroFill()
+{
+    zeroRange(0, length());
+}
+
+void Uint8ClampedArray::set(unsigned index, double value)
+{
+    if (index >= m_length)
+        return;
+    if (isnan(value) || value < 0)
+        value = 0;
+    else if (value > 255)
+        value = 255;
+    data()[index] = static_cast<unsigned char>(lrint(value));
+}
+
+Uint8ClampedArray::Uint8ClampedArray(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
+: Uint8Array(buffer, byteOffset, length)
+{
+}
+
+PassRefPtr<Uint8ClampedArray> Uint8ClampedArray::subarray(int start) const
+{
+    return subarray(start, length());
+}
+
+PassRefPtr<Uint8ClampedArray> Uint8ClampedArray::subarray(int start, int end) const
+{
+    return subarrayImpl<Uint8ClampedArray>(start, end);
+}
+
+} // namespace WTF
+
+using WTF::Uint8ClampedArray;
+
+#endif // Uint8ClampedArray_h
diff --git a/Source/WTF/wtf/UnionFind.h b/Source/WTF/wtf/UnionFind.h
new file mode 100644
index 0000000..81aca2d
--- /dev/null
+++ b/Source/WTF/wtf/UnionFind.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2011 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. ``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
+ * 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 UnionFind_h
+#define UnionFind_h
+
+#include <wtf/Assertions.h>
+
+namespace WTF {
+
+// A UnionFind class can be used to compute disjoint sets using the
+// disjoint-set forest data structure. Each UnionFind instance is a
+// node in the forest. Typically you use it by using UnionFind as a
+// superclass:
+//
+// class MemberOfSet : public UnionFind<MemberOfSet> { ... }
+//
+// Calling x->find() gives you a MemberOfSet* that represents the
+// disjoint set that x belongs to. Calling x->unify(y) unifies x's
+// set with y's set, and ensures that:
+//
+// x->find() == y->find()
+//
+// and that:
+//
+// a->find() == b->find()
+//
+// for any a, b if prior to the call to x->unify(y), we would have
+// had:
+//
+// a->find() == x
+// b->find() == y
+//
+// This implementation is almost amortized O(1), but could be worse
+// in unlikely pathological cases. It favors having a non-recursive
+// single pass implementation of unify() and find() over ensuring the
+// theoretical O(InverseAckermann[n]) amortized bound, which is much
+// closer to amortized O(1).
+
+template<typename T>
+class UnionFind {
+public:
+    UnionFind()
+        : m_parent(0)
+    {
+    }
+    
+    bool isRoot() const
+    {
+        bool result = !m_parent;
+        ASSERT(result == (const_cast<UnionFind<T>*>(this)->find() == this));
+        return result;
+    }
+    
+    T* find()
+    {
+        T* result = static_cast<T*>(this);
+        T* next = result->m_parent;
+        while (next) {
+            result = next;
+            next = result->m_parent;
+        }
+        ASSERT(result);
+        if (result != this)
+            m_parent = result;
+        return result;
+    }
+    
+    void unify(T* other)
+    {
+        T* a = static_cast<T*>(this)->find();
+        T* b = other->find();
+        
+        ASSERT(!a->m_parent);
+        ASSERT(!b->m_parent);
+        
+        if (a == b)
+            return;
+        
+        a->m_parent = b;
+    }
+private:
+    T* m_parent;
+};
+
+} // namespace WTF
+
+using WTF::UnionFind;
+
+#endif // UnionFind_h
diff --git a/Source/WTF/wtf/UnusedParam.h b/Source/WTF/wtf/UnusedParam.h
new file mode 100644
index 0000000..31d70e7
--- /dev/null
+++ b/Source/WTF/wtf/UnusedParam.h
@@ -0,0 +1,44 @@
+/*
+ *  Copyright (C) 2006 Apple Computer, 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.
+ *
+ */
+
+#ifndef WTF_UnusedParam_h
+#define WTF_UnusedParam_h
+
+#include <wtf/Platform.h>
+
+#if COMPILER(INTEL) && !OS(WINDOWS) || COMPILER(RVCT)
+template<typename T>
+inline void unusedParam(T& x) { (void)x; }
+#define UNUSED_PARAM(variable) unusedParam(variable)
+#else
+#define UNUSED_PARAM(variable) (void)variable
+#endif
+
+/* This is to keep the compiler from complaining when for local labels are
+   declared but not referenced. For example, this can happen with code that
+   works with auto-generated code.
+*/
+#if COMPILER(MSVC)
+#define UNUSED_LABEL(label) if (false) goto label
+#else
+#define UNUSED_LABEL(label) UNUSED_PARAM(&& label)
+#endif
+
+#endif /* WTF_UnusedParam_h */
diff --git a/Source/WTF/wtf/VMTags.h b/Source/WTF/wtf/VMTags.h
new file mode 100644
index 0000000..117bc37
--- /dev/null
+++ b/Source/WTF/wtf/VMTags.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 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. ``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
+ * 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 VMTags_h
+#define VMTags_h
+
+// On Mac OS X, the VM subsystem allows tagging memory requested from mmap and vm_map
+// in order to aid tools that inspect system memory use. 
+#if OS(DARWIN)
+
+#include <mach/vm_statistics.h>
+
+#if defined(VM_MEMORY_TCMALLOC)
+#define VM_TAG_FOR_TCMALLOC_MEMORY VM_MAKE_TAG(VM_MEMORY_TCMALLOC)
+#else
+#define VM_TAG_FOR_TCMALLOC_MEMORY VM_MAKE_TAG(53)
+#endif // defined(VM_MEMORY_TCMALLOC)
+
+#if defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
+#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
+#else
+#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY VM_MAKE_TAG(64)
+#endif // defined(VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR)
+
+#if defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+#define VM_TAG_FOR_REGISTERFILE_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+#else
+#define VM_TAG_FOR_REGISTERFILE_MEMORY VM_MAKE_TAG(65)
+#endif // defined(VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE)
+
+#if defined(VM_MEMORY_JAVASCRIPT_CORE)
+#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(VM_MEMORY_JAVASCRIPT_CORE)
+#else
+#define VM_TAG_FOR_COLLECTOR_MEMORY VM_MAKE_TAG(63)
+#endif // defined(VM_MEMORY_JAVASCRIPT_CORE)
+
+#if defined(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
+#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY VM_MAKE_TAG(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
+#else
+#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY VM_MAKE_TAG(69)
+#endif // defined(VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS)
+
+#else // OS(DARWIN)
+
+#define VM_TAG_FOR_TCMALLOC_MEMORY -1
+#define VM_TAG_FOR_COLLECTOR_MEMORY -1
+#define VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY -1
+#define VM_TAG_FOR_REGISTERFILE_MEMORY -1
+#define VM_TAG_FOR_WEBCORE_PURGEABLE_MEMORY -1
+
+#endif // OS(DARWIN)
+
+#endif // VMTags_h
diff --git a/Source/WTF/wtf/ValueCheck.h b/Source/WTF/wtf/ValueCheck.h
new file mode 100644
index 0000000..2a86eb0
--- /dev/null
+++ b/Source/WTF/wtf/ValueCheck.h
@@ -0,0 +1,53 @@
+/*
+ * 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. ``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
+ * 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 ValueCheck_h
+#define ValueCheck_h
+
+#include <wtf/FastMalloc.h>
+
+namespace WTF {
+
+template<typename T> struct ValueCheck {
+    typedef T TraitType;
+    static void checkConsistency(const T&) { }
+};
+
+#if !ASSERT_DISABLED
+template<typename P> struct ValueCheck<P*> {
+    typedef P* TraitType;
+    static void checkConsistency(const P* p)
+    {
+        if (!p)
+            return;
+        ASSERT(fastMallocSize(p));
+        ValueCheck<P>::checkConsistency(*p);
+    }
+};
+#endif
+
+}
+
+#endif // ValueCheck_h
diff --git a/Source/WTF/wtf/Vector.h b/Source/WTF/wtf/Vector.h
new file mode 100644
index 0000000..d2dedef
--- /dev/null
+++ b/Source/WTF/wtf/Vector.h
@@ -0,0 +1,1202 @@
+/*
+ *  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_Vector_h
+#define WTF_Vector_h
+
+#include <wtf/Alignment.h>
+#include <wtf/FastAllocBase.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/NotFound.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/UnusedParam.h>
+#include <wtf/ValueCheck.h>
+#include <wtf/VectorTraits.h>
+#include <limits>
+#include <utility>
+
+namespace WTF {
+
+    template <bool needsDestruction, typename T>
+    struct VectorDestructor;
+
+    template<typename T>
+    struct VectorDestructor<false, T>
+    {
+        static void destruct(T*, T*) {}
+    };
+
+    template<typename T>
+    struct VectorDestructor<true, T>
+    {
+        static void destruct(T* begin, T* end) 
+        {
+            for (T* cur = begin; cur != end; ++cur)
+                cur->~T();
+        }
+    };
+
+    template <bool needsInitialization, bool canInitializeWithMemset, typename T>
+    struct VectorInitializer;
+
+    template<bool ignore, typename T>
+    struct VectorInitializer<false, ignore, T>
+    {
+        static void initialize(T*, T*) {}
+    };
+
+    template<typename T>
+    struct VectorInitializer<true, false, T>
+    {
+        static void initialize(T* begin, T* end) 
+        {
+            for (T* cur = begin; cur != end; ++cur)
+                new (NotNull, cur) T;
+        }
+    };
+
+    template<typename T>
+    struct VectorInitializer<true, true, T>
+    {
+        static void initialize(T* begin, T* end) 
+        {
+            memset(begin, 0, reinterpret_cast<char*>(end) - reinterpret_cast<char*>(begin));
+        }
+    };
+
+    template <bool canMoveWithMemcpy, typename T>
+    struct VectorMover;
+
+    template<typename T>
+    struct VectorMover<false, T>
+    {
+        static void move(const T* src, const T* srcEnd, T* dst)
+        {
+            while (src != srcEnd) {
+                new (NotNull, 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;
+            }
+        }
+        static void moveOverlapping(const T* src, const T* srcEnd, T* dst)
+        {
+            if (src > dst)
+                move(src, srcEnd, dst);
+            else {
+                T* dstEnd = dst + (srcEnd - src);
+                while (src != srcEnd) {
+                    --srcEnd;
+                    --dstEnd;
+                    new (NotNull, dstEnd) T(*srcEnd);
+                    srcEnd->~T();
+                }
+            }
+        }
+    };
+
+    template<typename T>
+    struct VectorMover<true, T>
+    {
+        static void move(const T* src, const T* srcEnd, T* dst) 
+        {
+            memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src));
+        }
+        static void moveOverlapping(const T* src, const T* srcEnd, T* dst) 
+        {
+            memmove(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src));
+        }
+    };
+
+    template <bool canCopyWithMemcpy, typename T>
+    struct VectorCopier;
+
+    template<typename T>
+    struct VectorCopier<false, T>
+    {
+        static void uninitializedCopy(const T* src, const T* srcEnd, T* dst) 
+        {
+            while (src != srcEnd) {
+                new (NotNull, dst) T(*src);
+                ++dst;
+                ++src;
+            }
+        }
+    };
+
+    template<typename T>
+    struct VectorCopier<true, T>
+    {
+        static void uninitializedCopy(const T* src, const T* srcEnd, T* dst) 
+        {
+            memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src));
+        }
+    };
+
+    template <bool canFillWithMemset, typename T>
+    struct VectorFiller;
+
+    template<typename T>
+    struct VectorFiller<false, T>
+    {
+        static void uninitializedFill(T* dst, T* dstEnd, const T& val) 
+        {
+            while (dst != dstEnd) {
+                new (NotNull, dst) T(val);
+                ++dst;
+            }
+        }
+    };
+
+    template<typename T>
+    struct VectorFiller<true, T>
+    {
+        static void uninitializedFill(T* dst, T* dstEnd, const T& val) 
+        {
+            ASSERT(sizeof(T) == sizeof(char));
+#if COMPILER(GCC) && defined(_FORTIFY_SOURCE)
+            if (!__builtin_constant_p(dstEnd - dst) || (!(dstEnd - dst)))
+#endif
+                memset(dst, val, dstEnd - dst);
+        }
+    };
+    
+    template<bool canCompareWithMemcmp, typename T>
+    struct VectorComparer;
+    
+    template<typename T>
+    struct VectorComparer<false, T>
+    {
+        static bool compare(const T* a, const T* b, size_t size)
+        {
+            for (size_t i = 0; i < size; ++i)
+                if (!(a[i] == b[i]))
+                    return false;
+            return true;
+        }
+    };
+
+    template<typename T>
+    struct VectorComparer<true, T>
+    {
+        static bool compare(const T* a, const T* b, size_t size)
+        {
+            return memcmp(a, b, sizeof(T) * size) == 0;
+        }
+    };
+    
+    template<typename T>
+    struct VectorTypeOperations
+    {
+        static void destruct(T* begin, T* end)
+        {
+            VectorDestructor<VectorTraits<T>::needsDestruction, T>::destruct(begin, end);
+        }
+
+        static void initialize(T* begin, T* end)
+        {
+            VectorInitializer<VectorTraits<T>::needsInitialization, VectorTraits<T>::canInitializeWithMemset, T>::initialize(begin, end);
+        }
+
+        static void move(const T* src, const T* srcEnd, T* dst)
+        {
+            VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::move(src, srcEnd, dst);
+        }
+
+        static void moveOverlapping(const T* src, const T* srcEnd, T* dst)
+        {
+            VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::moveOverlapping(src, srcEnd, dst);
+        }
+
+        static void uninitializedCopy(const T* src, const T* srcEnd, T* dst)
+        {
+            VectorCopier<VectorTraits<T>::canCopyWithMemcpy, T>::uninitializedCopy(src, srcEnd, dst);
+        }
+
+        static void uninitializedFill(T* dst, T* dstEnd, const T& val)
+        {
+            VectorFiller<VectorTraits<T>::canFillWithMemset, T>::uninitializedFill(dst, dstEnd, val);
+        }
+        
+        static bool compare(const T* a, const T* b, size_t size)
+        {
+            return VectorComparer<VectorTraits<T>::canCompareWithMemcmp, T>::compare(a, b, size);
+        }
+    };
+
+    template<typename T>
+    class VectorBufferBase {
+        WTF_MAKE_NONCOPYABLE(VectorBufferBase);
+    public:
+        void allocateBuffer(size_t newCapacity)
+        {
+            ASSERT(newCapacity);
+            m_capacity = newCapacity;
+            if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
+                CRASH();
+            m_buffer = static_cast<T*>(fastMalloc(newCapacity * sizeof(T)));
+        }
+
+        bool tryAllocateBuffer(size_t newCapacity)
+        {
+            ASSERT(newCapacity);
+            if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
+                return false;
+
+            T* newBuffer;
+            if (tryFastMalloc(newCapacity * sizeof(T)).getValue(newBuffer)) {
+                m_capacity = newCapacity;
+                m_buffer = newBuffer;
+                return true;
+            }
+            return false;
+        }
+
+        bool shouldReallocateBuffer(size_t newCapacity) const
+        {
+            return VectorTraits<T>::canMoveWithMemcpy && m_capacity && newCapacity;
+        }
+
+        void reallocateBuffer(size_t newCapacity)
+        {
+            ASSERT(shouldReallocateBuffer(newCapacity));
+            m_capacity = newCapacity;
+            if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
+                CRASH();
+            m_buffer = static_cast<T*>(fastRealloc(m_buffer, newCapacity * sizeof(T)));
+        }
+
+        void deallocateBuffer(T* bufferToDeallocate)
+        {
+            if (!bufferToDeallocate)
+                return;
+            
+            if (m_buffer == bufferToDeallocate) {
+                m_buffer = 0;
+                m_capacity = 0;
+            }
+
+            fastFree(bufferToDeallocate);
+        }
+
+        T* buffer() { return m_buffer; }
+        const T* buffer() const { return m_buffer; }
+        size_t capacity() const { return m_capacity; }
+
+        T* releaseBuffer()
+        {
+            T* buffer = m_buffer;
+            m_buffer = 0;
+            m_capacity = 0;
+            return buffer;
+        }
+
+    protected:
+        VectorBufferBase()
+            : m_buffer(0)
+            , m_capacity(0)
+        {
+        }
+
+        VectorBufferBase(T* buffer, size_t capacity)
+            : m_buffer(buffer)
+            , m_capacity(capacity)
+        {
+        }
+
+        ~VectorBufferBase()
+        {
+            // FIXME: It would be nice to find a way to ASSERT that m_buffer hasn't leaked here.
+        }
+
+        T* m_buffer;
+        size_t m_capacity;
+    };
+
+    template<typename T, size_t inlineCapacity>
+    class VectorBuffer;
+
+    template<typename T>
+    class VectorBuffer<T, 0> : private VectorBufferBase<T> {
+    private:
+        typedef VectorBufferBase<T> Base;
+    public:
+        VectorBuffer()
+        {
+        }
+
+        VectorBuffer(size_t capacity)
+        {
+            // Calling malloc(0) might take a lock and may actually do an
+            // allocation on some systems.
+            if (capacity)
+                allocateBuffer(capacity);
+        }
+
+        ~VectorBuffer()
+        {
+            deallocateBuffer(buffer());
+        }
+        
+        void swap(VectorBuffer<T, 0>& other)
+        {
+            std::swap(m_buffer, other.m_buffer);
+            std::swap(m_capacity, other.m_capacity);
+        }
+        
+        void restoreInlineBufferIfNeeded() { }
+
+        using Base::allocateBuffer;
+        using Base::tryAllocateBuffer;
+        using Base::shouldReallocateBuffer;
+        using Base::reallocateBuffer;
+        using Base::deallocateBuffer;
+
+        using Base::buffer;
+        using Base::capacity;
+
+        using Base::releaseBuffer;
+    private:
+        using Base::m_buffer;
+        using Base::m_capacity;
+    };
+
+    template<typename T, size_t inlineCapacity>
+    class VectorBuffer : private VectorBufferBase<T> {
+        WTF_MAKE_NONCOPYABLE(VectorBuffer);
+    private:
+        typedef VectorBufferBase<T> Base;
+    public:
+        VectorBuffer()
+            : Base(inlineBuffer(), inlineCapacity)
+        {
+        }
+
+        VectorBuffer(size_t capacity)
+            : Base(inlineBuffer(), inlineCapacity)
+        {
+            if (capacity > inlineCapacity)
+                Base::allocateBuffer(capacity);
+        }
+
+        ~VectorBuffer()
+        {
+            deallocateBuffer(buffer());
+        }
+
+        void allocateBuffer(size_t newCapacity)
+        {
+            // FIXME: This should ASSERT(!m_buffer) to catch misuse/leaks.
+            if (newCapacity > inlineCapacity)
+                Base::allocateBuffer(newCapacity);
+            else {
+                m_buffer = inlineBuffer();
+                m_capacity = inlineCapacity;
+            }
+        }
+
+        bool tryAllocateBuffer(size_t newCapacity)
+        {
+            if (newCapacity > inlineCapacity)
+                return Base::tryAllocateBuffer(newCapacity);
+            m_buffer = inlineBuffer();
+            m_capacity = inlineCapacity;
+            return true;
+        }
+
+        void deallocateBuffer(T* bufferToDeallocate)
+        {
+            if (bufferToDeallocate == inlineBuffer())
+                return;
+            Base::deallocateBuffer(bufferToDeallocate);
+        }
+
+        bool shouldReallocateBuffer(size_t newCapacity) const
+        {
+            // We cannot reallocate the inline buffer.
+            return Base::shouldReallocateBuffer(newCapacity) && std::min(m_capacity, newCapacity) > inlineCapacity;
+        }
+
+        void reallocateBuffer(size_t newCapacity)
+        {
+            ASSERT(shouldReallocateBuffer(newCapacity));
+            Base::reallocateBuffer(newCapacity);
+        }
+
+        void swap(VectorBuffer<T, inlineCapacity>& other)
+        {
+            if (buffer() == inlineBuffer() && other.buffer() == other.inlineBuffer()) {
+                WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
+                std::swap(m_capacity, other.m_capacity);
+            } else if (buffer() == inlineBuffer()) {
+                m_buffer = other.m_buffer;
+                other.m_buffer = other.inlineBuffer();
+                WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
+                std::swap(m_capacity, other.m_capacity);
+            } else if (other.buffer() == other.inlineBuffer()) {
+                other.m_buffer = m_buffer;
+                m_buffer = inlineBuffer();
+                WTF::swap(m_inlineBuffer, other.m_inlineBuffer);
+                std::swap(m_capacity, other.m_capacity);
+            } else {
+                std::swap(m_buffer, other.m_buffer);
+                std::swap(m_capacity, other.m_capacity);
+            }
+        }
+
+        void restoreInlineBufferIfNeeded()
+        {
+            if (m_buffer)
+                return;
+            m_buffer = inlineBuffer();
+            m_capacity = inlineCapacity;
+        }
+
+        using Base::buffer;
+        using Base::capacity;
+
+        T* releaseBuffer()
+        {
+            if (buffer() == inlineBuffer())
+                return 0;
+            return Base::releaseBuffer();
+        }
+
+    private:
+        using Base::m_buffer;
+        using Base::m_capacity;
+
+        static const size_t m_inlineBufferSize = inlineCapacity * sizeof(T);
+        T* inlineBuffer() { return reinterpret_cast_ptr<T*>(m_inlineBuffer.buffer); }
+        const T* inlineBuffer() const { return reinterpret_cast_ptr<const T*>(m_inlineBuffer.buffer); }
+
+        AlignedBuffer<m_inlineBufferSize, WTF_ALIGN_OF(T)> m_inlineBuffer;
+    };
+
+    template<typename T, size_t inlineCapacity = 0>
+    class Vector {
+        WTF_MAKE_FAST_ALLOCATED;
+    private:
+        typedef VectorBuffer<T, inlineCapacity> Buffer;
+        typedef VectorTypeOperations<T> TypeOperations;
+
+    public:
+        typedef T ValueType;
+
+        typedef T* iterator;
+        typedef const T* const_iterator;
+        typedef std::reverse_iterator<iterator> reverse_iterator;
+        typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+        Vector() 
+            : m_size(0)
+        {
+        }
+        
+        explicit Vector(size_t size) 
+            : m_size(size)
+            , m_buffer(size)
+        {
+            if (begin())
+                TypeOperations::initialize(begin(), end());
+        }
+
+        ~Vector()
+        {
+            if (m_size)
+                shrink(0);
+        }
+
+        Vector(const Vector&);
+        template<size_t otherCapacity> 
+        Vector(const Vector<T, otherCapacity>&);
+
+        Vector& operator=(const Vector&);
+        template<size_t otherCapacity> 
+        Vector& operator=(const Vector<T, otherCapacity>&);
+
+#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+        Vector(Vector&&);
+        Vector& operator=(Vector&&);
+#endif
+
+        size_t size() const { return m_size; }
+        size_t capacity() const { return m_buffer.capacity(); }
+        bool isEmpty() const { return !size(); }
+
+        T& at(size_t i) 
+        { 
+            ASSERT(i < size());
+            return m_buffer.buffer()[i]; 
+        }
+        const T& at(size_t i) const 
+        {
+            ASSERT(i < size());
+            return m_buffer.buffer()[i]; 
+        }
+
+        T& operator[](size_t i) { return at(i); }
+        const T& operator[](size_t i) const { return at(i); }
+
+        T* data() { return m_buffer.buffer(); }
+        const T* data() const { return m_buffer.buffer(); }
+        T** dataSlot() { return m_buffer.bufferSlot(); }
+
+        iterator begin() { return data(); }
+        iterator end() { return begin() + m_size; }
+        const_iterator begin() const { return data(); }
+        const_iterator end() const { return begin() + m_size; }
+
+        reverse_iterator rbegin() { return reverse_iterator(end()); }
+        reverse_iterator rend() { return reverse_iterator(begin()); }
+        const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+        const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+
+        T& first() { return at(0); }
+        const T& first() const { return at(0); }
+        T& last() { return at(size() - 1); }
+        const T& last() const { return at(size() - 1); }
+
+        template<typename U> bool contains(const U&) const;
+        template<typename U> size_t find(const U&) const;
+        template<typename U> size_t reverseFind(const U&) const;
+
+        void shrink(size_t size);
+        void grow(size_t size);
+        void resize(size_t size);
+        void reserveCapacity(size_t newCapacity);
+        bool tryReserveCapacity(size_t newCapacity);
+        void reserveInitialCapacity(size_t initialCapacity);
+        void shrinkCapacity(size_t newCapacity);
+        void shrinkToFit() { shrinkCapacity(size()); }
+
+        void clear() { shrinkCapacity(0); }
+
+        template<typename U> void append(const U*, size_t);
+        template<typename U> void append(const U&);
+        template<typename U> void uncheckedAppend(const U& val);
+        template<size_t otherCapacity> void append(const Vector<T, otherCapacity>&);
+        template<typename U, size_t otherCapacity> void appendVector(const Vector<U, otherCapacity>&);
+        template<typename U> bool tryAppend(const U*, size_t);
+
+        template<typename U> void insert(size_t position, const U*, size_t);
+        template<typename U> void insert(size_t position, const U&);
+        template<typename U, size_t c> void insert(size_t position, const Vector<U, c>&);
+
+        template<typename U> void prepend(const U*, size_t);
+        template<typename U> void prepend(const U&);
+        template<typename U, size_t c> void prepend(const Vector<U, c>&);
+
+        void remove(size_t position);
+        void remove(size_t position, size_t length);
+
+        void removeLast() 
+        {
+            ASSERT(!isEmpty());
+            shrink(size() - 1); 
+        }
+
+        Vector(size_t size, const T& val)
+            : m_size(size)
+            , m_buffer(size)
+        {
+            if (begin())
+                TypeOperations::uninitializedFill(begin(), end(), val);
+        }
+
+        void fill(const T&, size_t);
+        void fill(const T& val) { fill(val, size()); }
+
+        template<typename Iterator> void appendRange(Iterator start, Iterator end);
+
+        T* releaseBuffer();
+
+        void swap(Vector<T, inlineCapacity>& other)
+        {
+            std::swap(m_size, other.m_size);
+            m_buffer.swap(other.m_buffer);
+        }
+
+        void reverse();
+
+        void checkConsistency();
+
+    private:
+        void expandCapacity(size_t newMinCapacity);
+        const T* expandCapacity(size_t newMinCapacity, const T*);
+        bool tryExpandCapacity(size_t newMinCapacity);
+        const T* tryExpandCapacity(size_t newMinCapacity, const T*);
+        template<typename U> U* expandCapacity(size_t newMinCapacity, U*); 
+        template<typename U> void appendSlowCase(const U&);
+
+        size_t m_size;
+        Buffer m_buffer;
+    };
+
+    template<typename T, size_t inlineCapacity>
+    Vector<T, inlineCapacity>::Vector(const Vector& other)
+        : m_size(other.size())
+        , m_buffer(other.capacity())
+    {
+        if (begin())
+            TypeOperations::uninitializedCopy(other.begin(), other.end(), begin());
+    }
+
+    template<typename T, size_t inlineCapacity>
+    template<size_t otherCapacity> 
+    Vector<T, inlineCapacity>::Vector(const Vector<T, otherCapacity>& other)
+        : m_size(other.size())
+        , m_buffer(other.capacity())
+    {
+        if (begin())
+            TypeOperations::uninitializedCopy(other.begin(), other.end(), begin());
+    }
+
+    template<typename T, size_t inlineCapacity>
+    Vector<T, inlineCapacity>& Vector<T, inlineCapacity>::operator=(const Vector<T, inlineCapacity>& other)
+    {
+        if (&other == this)
+            return *this;
+        
+        if (size() > other.size())
+            shrink(other.size());
+        else if (other.size() > capacity()) {
+            clear();
+            reserveCapacity(other.size());
+            if (!begin())
+                return *this;
+        }
+        
+// Works around an assert in VS2010. See https://connect.microsoft.com/VisualStudio/feedback/details/558044/std-copy-should-not-check-dest-when-first-last
+#if COMPILER(MSVC) && defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL
+        if (!begin())
+            return *this;
+#endif
+
+        std::copy(other.begin(), other.begin() + size(), begin());
+        TypeOperations::uninitializedCopy(other.begin() + size(), other.end(), end());
+        m_size = other.size();
+
+        return *this;
+    }
+
+    inline bool typelessPointersAreEqual(const void* a, const void* b) { return a == b; }
+
+    template<typename T, size_t inlineCapacity>
+    template<size_t otherCapacity> 
+    Vector<T, inlineCapacity>& Vector<T, inlineCapacity>::operator=(const Vector<T, otherCapacity>& other)
+    {
+        // If the inline capacities match, we should call the more specific
+        // template.  If the inline capacities don't match, the two objects
+        // shouldn't be allocated the same address.
+        ASSERT(!typelessPointersAreEqual(&other, this));
+
+        if (size() > other.size())
+            shrink(other.size());
+        else if (other.size() > capacity()) {
+            clear();
+            reserveCapacity(other.size());
+            if (!begin())
+                return *this;
+        }
+        
+// Works around an assert in VS2010. See https://connect.microsoft.com/VisualStudio/feedback/details/558044/std-copy-should-not-check-dest-when-first-last
+#if COMPILER(MSVC) && defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL
+        if (!begin())
+            return *this;
+#endif
+
+        std::copy(other.begin(), other.begin() + size(), begin());
+        TypeOperations::uninitializedCopy(other.begin() + size(), other.end(), end());
+        m_size = other.size();
+
+        return *this;
+    }
+
+#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+    template<typename T, size_t inlineCapacity>
+    Vector<T, inlineCapacity>::Vector(Vector<T, inlineCapacity>&& other)
+        : m_size(0)
+    {
+        // It's a little weird to implement a move constructor using swap but this way we
+        // don't have to add a move constructor to VectorBuffer.
+        swap(other);
+    }
+
+    template<typename T, size_t inlineCapacity>
+    Vector<T, inlineCapacity>& Vector<T, inlineCapacity>::operator=(Vector<T, inlineCapacity>&& other)
+    {
+        swap(other);
+        return *this;
+    }
+#endif
+
+    template<typename T, size_t inlineCapacity>
+    template<typename U>
+    bool Vector<T, inlineCapacity>::contains(const U& value) const
+    {
+        return find(value) != notFound;
+    }
+ 
+    template<typename T, size_t inlineCapacity>
+    template<typename U>
+    size_t Vector<T, inlineCapacity>::find(const U& value) const
+    {
+        for (size_t i = 0; i < size(); ++i) {
+            if (at(i) == value)
+                return i;
+        }
+        return notFound;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    template<typename U>
+    size_t Vector<T, inlineCapacity>::reverseFind(const U& value) const
+    {
+        for (size_t i = 1; i <= size(); ++i) {
+            const size_t index = size() - i;
+            if (at(index) == value)
+                return index;
+        }
+        return notFound;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void Vector<T, inlineCapacity>::fill(const T& val, size_t newSize)
+    {
+        if (size() > newSize)
+            shrink(newSize);
+        else if (newSize > capacity()) {
+            clear();
+            reserveCapacity(newSize);
+            if (!begin())
+                return;
+        }
+        
+        std::fill(begin(), end(), val);
+        TypeOperations::uninitializedFill(end(), begin() + newSize, val);
+        m_size = newSize;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    template<typename Iterator>
+    void Vector<T, inlineCapacity>::appendRange(Iterator start, Iterator end)
+    {
+        for (Iterator it = start; it != end; ++it)
+            append(*it);
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void Vector<T, inlineCapacity>::expandCapacity(size_t newMinCapacity)
+    {
+        reserveCapacity(std::max(newMinCapacity, std::max(static_cast<size_t>(16), capacity() + capacity() / 4 + 1)));
+    }
+    
+    template<typename T, size_t inlineCapacity>
+    const T* Vector<T, inlineCapacity>::expandCapacity(size_t newMinCapacity, const T* ptr)
+    {
+        if (ptr < begin() || ptr >= end()) {
+            expandCapacity(newMinCapacity);
+            return ptr;
+        }
+        size_t index = ptr - begin();
+        expandCapacity(newMinCapacity);
+        return begin() + index;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    bool Vector<T, inlineCapacity>::tryExpandCapacity(size_t newMinCapacity)
+    {
+        return tryReserveCapacity(std::max(newMinCapacity, std::max(static_cast<size_t>(16), capacity() + capacity() / 4 + 1)));
+    }
+    
+    template<typename T, size_t inlineCapacity>
+    const T* Vector<T, inlineCapacity>::tryExpandCapacity(size_t newMinCapacity, const T* ptr)
+    {
+        if (ptr < begin() || ptr >= end()) {
+            if (!tryExpandCapacity(newMinCapacity))
+                return 0;
+            return ptr;
+        }
+        size_t index = ptr - begin();
+        if (!tryExpandCapacity(newMinCapacity))
+            return 0;
+        return begin() + index;
+    }
+
+    template<typename T, size_t inlineCapacity> template<typename U>
+    inline U* Vector<T, inlineCapacity>::expandCapacity(size_t newMinCapacity, U* ptr)
+    {
+        expandCapacity(newMinCapacity);
+        return ptr;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Vector<T, inlineCapacity>::resize(size_t size)
+    {
+        if (size <= m_size)
+            TypeOperations::destruct(begin() + size, end());
+        else {
+            if (size > capacity())
+                expandCapacity(size);
+            if (begin())
+                TypeOperations::initialize(end(), begin() + size);
+        }
+        
+        m_size = size;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void Vector<T, inlineCapacity>::shrink(size_t size)
+    {
+        ASSERT(size <= m_size);
+        TypeOperations::destruct(begin() + size, end());
+        m_size = size;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void Vector<T, inlineCapacity>::grow(size_t size)
+    {
+        ASSERT(size >= m_size);
+        if (size > capacity())
+            expandCapacity(size);
+        if (begin())
+            TypeOperations::initialize(end(), begin() + size);
+        m_size = size;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void Vector<T, inlineCapacity>::reserveCapacity(size_t newCapacity)
+    {
+        if (newCapacity <= capacity())
+            return;
+        T* oldBuffer = begin();
+        T* oldEnd = end();
+        m_buffer.allocateBuffer(newCapacity);
+        if (begin())
+            TypeOperations::move(oldBuffer, oldEnd, begin());
+        m_buffer.deallocateBuffer(oldBuffer);
+    }
+    
+    template<typename T, size_t inlineCapacity>
+    bool Vector<T, inlineCapacity>::tryReserveCapacity(size_t newCapacity)
+    {
+        if (newCapacity <= capacity())
+            return true;
+        T* oldBuffer = begin();
+        T* oldEnd = end();
+        if (!m_buffer.tryAllocateBuffer(newCapacity))
+            return false;
+        ASSERT(begin());
+        TypeOperations::move(oldBuffer, oldEnd, begin());
+        m_buffer.deallocateBuffer(oldBuffer);
+        return true;
+    }
+    
+    template<typename T, size_t inlineCapacity>
+    inline void Vector<T, inlineCapacity>::reserveInitialCapacity(size_t initialCapacity)
+    {
+        ASSERT(!m_size);
+        ASSERT(capacity() == inlineCapacity);
+        if (initialCapacity > inlineCapacity)
+            m_buffer.allocateBuffer(initialCapacity);
+    }
+    
+    template<typename T, size_t inlineCapacity>
+    void Vector<T, inlineCapacity>::shrinkCapacity(size_t newCapacity)
+    {
+        if (newCapacity >= capacity())
+            return;
+
+        if (newCapacity < size()) 
+            shrink(newCapacity);
+
+        T* oldBuffer = begin();
+        if (newCapacity > 0) {
+            if (m_buffer.shouldReallocateBuffer(newCapacity)) {
+                m_buffer.reallocateBuffer(newCapacity);
+                return;
+            }
+
+            T* oldEnd = end();
+            m_buffer.allocateBuffer(newCapacity);
+            if (begin() != oldBuffer)
+                TypeOperations::move(oldBuffer, oldEnd, begin());
+        }
+
+        m_buffer.deallocateBuffer(oldBuffer);
+        m_buffer.restoreInlineBufferIfNeeded();
+    }
+
+    // Templatizing these is better than just letting the conversion happen implicitly,
+    // because for instance it allows a PassRefPtr to be appended to a RefPtr vector
+    // without refcount thrash.
+
+    template<typename T, size_t inlineCapacity> template<typename U>
+    void Vector<T, inlineCapacity>::append(const U* data, size_t dataSize)
+    {
+        size_t newSize = m_size + dataSize;
+        if (newSize > capacity()) {
+            data = expandCapacity(newSize, data);
+            if (!begin())
+                return;
+        }
+        if (newSize < m_size)
+            CRASH();
+        T* dest = end();
+        for (size_t i = 0; i < dataSize; ++i)
+            new (NotNull, &dest[i]) T(data[i]);
+        m_size = newSize;
+    }
+
+    template<typename T, size_t inlineCapacity> template<typename U>
+    bool Vector<T, inlineCapacity>::tryAppend(const U* data, size_t dataSize)
+    {
+        size_t newSize = m_size + dataSize;
+        if (newSize > capacity()) {
+            data = tryExpandCapacity(newSize, data);
+            if (!data)
+                return false;
+            ASSERT(begin());
+        }
+        if (newSize < m_size)
+            return false;
+        T* dest = end();
+        for (size_t i = 0; i < dataSize; ++i)
+            new (NotNull, &dest[i]) T(data[i]);
+        m_size = newSize;
+        return true;
+    }
+
+    template<typename T, size_t inlineCapacity> template<typename U>
+    ALWAYS_INLINE void Vector<T, inlineCapacity>::append(const U& val)
+    {
+        if (size() != capacity()) {
+            new (NotNull, end()) T(val);
+            ++m_size;
+            return;
+        }
+
+        appendSlowCase(val);
+    }
+
+    template<typename T, size_t inlineCapacity> template<typename U>
+    void Vector<T, inlineCapacity>::appendSlowCase(const U& val)
+    {
+        ASSERT(size() == capacity());
+
+        const U* ptr = &val;
+        ptr = expandCapacity(size() + 1, ptr);
+        if (!begin())
+            return;
+
+        new (NotNull, end()) T(*ptr);
+        ++m_size;
+    }
+
+    // This version of append saves a branch in the case where you know that the
+    // vector's capacity is large enough for the append to succeed.
+
+    template<typename T, size_t inlineCapacity> template<typename U>
+    inline void Vector<T, inlineCapacity>::uncheckedAppend(const U& val)
+    {
+        ASSERT(size() < capacity());
+        const U* ptr = &val;
+        new (NotNull, end()) T(*ptr);
+        ++m_size;
+    }
+
+    // This method should not be called append, a better name would be appendElements.
+    // It could also be eliminated entirely, and call sites could just use
+    // appendRange(val.begin(), val.end()).
+    template<typename T, size_t inlineCapacity> template<size_t otherCapacity>
+    inline void Vector<T, inlineCapacity>::append(const Vector<T, otherCapacity>& val)
+    {
+        append(val.begin(), val.size());
+    }
+
+    template<typename T, size_t inlineCapacity> template<typename U, size_t otherCapacity>
+    inline void Vector<T, inlineCapacity>::appendVector(const Vector<U, otherCapacity>& val)
+    {
+        append(val.begin(), val.size());
+    }
+
+    template<typename T, size_t inlineCapacity> template<typename U>
+    void Vector<T, inlineCapacity>::insert(size_t position, const U* data, size_t dataSize)
+    {
+        ASSERT(position <= size());
+        size_t newSize = m_size + dataSize;
+        if (newSize > capacity()) {
+            data = expandCapacity(newSize, data);
+            if (!begin())
+                return;
+        }
+        if (newSize < m_size)
+            CRASH();
+        T* spot = begin() + position;
+        TypeOperations::moveOverlapping(spot, end(), spot + dataSize);
+        for (size_t i = 0; i < dataSize; ++i)
+            new (NotNull, &spot[i]) T(data[i]);
+        m_size = newSize;
+    }
+     
+    template<typename T, size_t inlineCapacity> template<typename U>
+    inline void Vector<T, inlineCapacity>::insert(size_t position, const U& val)
+    {
+        ASSERT(position <= size());
+        const U* data = &val;
+        if (size() == capacity()) {
+            data = expandCapacity(size() + 1, data);
+            if (!begin())
+                return;
+        }
+        T* spot = begin() + position;
+        TypeOperations::moveOverlapping(spot, end(), spot + 1);
+        new (NotNull, spot) T(*data);
+        ++m_size;
+    }
+   
+    template<typename T, size_t inlineCapacity> template<typename U, size_t c>
+    inline void Vector<T, inlineCapacity>::insert(size_t position, const Vector<U, c>& val)
+    {
+        insert(position, val.begin(), val.size());
+    }
+
+    template<typename T, size_t inlineCapacity> template<typename U>
+    void Vector<T, inlineCapacity>::prepend(const U* data, size_t dataSize)
+    {
+        insert(0, data, dataSize);
+    }
+
+    template<typename T, size_t inlineCapacity> template<typename U>
+    inline void Vector<T, inlineCapacity>::prepend(const U& val)
+    {
+        insert(0, val);
+    }
+   
+    template<typename T, size_t inlineCapacity> template<typename U, size_t c>
+    inline void Vector<T, inlineCapacity>::prepend(const Vector<U, c>& val)
+    {
+        insert(0, val.begin(), val.size());
+    }
+    
+    template<typename T, size_t inlineCapacity>
+    inline void Vector<T, inlineCapacity>::remove(size_t position)
+    {
+        ASSERT(position < size());
+        T* spot = begin() + position;
+        spot->~T();
+        TypeOperations::moveOverlapping(spot + 1, end(), spot);
+        --m_size;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Vector<T, inlineCapacity>::remove(size_t position, size_t length)
+    {
+        ASSERT(position <= size());
+        ASSERT(position + length <= size());
+        T* beginSpot = begin() + position;
+        T* endSpot = beginSpot + length;
+        TypeOperations::destruct(beginSpot, endSpot); 
+        TypeOperations::moveOverlapping(endSpot, end(), beginSpot);
+        m_size -= length;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Vector<T, inlineCapacity>::reverse()
+    {
+        for (size_t i = 0; i < m_size / 2; ++i)
+            std::swap(at(i), at(m_size - 1 - i));
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline T* Vector<T, inlineCapacity>::releaseBuffer()
+    {
+        T* buffer = m_buffer.releaseBuffer();
+        if (inlineCapacity && !buffer && m_size) {
+            // If the vector had some data, but no buffer to release,
+            // that means it was using the inline buffer. In that case,
+            // we create a brand new buffer so the caller always gets one.
+            size_t bytes = m_size * sizeof(T);
+            buffer = static_cast<T*>(fastMalloc(bytes));
+            memcpy(buffer, data(), bytes);
+        }
+        m_size = 0;
+        return buffer;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void Vector<T, inlineCapacity>::checkConsistency()
+    {
+#if !ASSERT_DISABLED
+        for (size_t i = 0; i < size(); ++i)
+            ValueCheck<T>::checkConsistency(at(i));
+#endif
+    }
+
+    template<typename T, size_t inlineCapacity>
+    void deleteAllValues(const Vector<T, inlineCapacity>& collection)
+    {
+        typedef typename Vector<T, inlineCapacity>::const_iterator iterator;
+        iterator end = collection.end();
+        for (iterator it = collection.begin(); it != end; ++it)
+            delete *it;
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline void swap(Vector<T, inlineCapacity>& a, Vector<T, inlineCapacity>& b)
+    {
+        a.swap(b);
+    }
+
+    template<typename T, size_t inlineCapacity>
+    bool operator==(const Vector<T, inlineCapacity>& a, const Vector<T, inlineCapacity>& b)
+    {
+        if (a.size() != b.size())
+            return false;
+
+        return VectorTypeOperations<T>::compare(a.data(), b.data(), a.size());
+    }
+
+    template<typename T, size_t inlineCapacity>
+    inline bool operator!=(const Vector<T, inlineCapacity>& a, const Vector<T, inlineCapacity>& b)
+    {
+        return !(a == b);
+    }
+
+#if !ASSERT_DISABLED
+    template<typename T> struct ValueCheck<Vector<T> > {
+        typedef Vector<T> TraitType;
+        static void checkConsistency(const Vector<T>& v)
+        {
+            v.checkConsistency();
+        }
+    };
+#endif
+
+} // namespace WTF
+
+using WTF::Vector;
+
+#endif // WTF_Vector_h
diff --git a/Source/WTF/wtf/VectorTraits.h b/Source/WTF/wtf/VectorTraits.h
new file mode 100644
index 0000000..6782250
--- /dev/null
+++ b/Source/WTF/wtf/VectorTraits.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 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_VectorTraits_h
+#define WTF_VectorTraits_h
+
+#include <wtf/OwnPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/TypeTraits.h>
+#include <utility>
+#include <memory>
+
+using std::pair;
+
+namespace WTF {
+
+    class AtomicString;
+
+    template<bool isPod, typename T>
+    struct VectorTraitsBase;
+
+    template<typename T>
+    struct VectorTraitsBase<false, T>
+    {
+        static const bool needsDestruction = true;
+        static const bool needsInitialization = true;
+        static const bool canInitializeWithMemset = false;
+        static const bool canMoveWithMemcpy = false;
+        static const bool canCopyWithMemcpy = false;
+        static const bool canFillWithMemset = false;
+        static const bool canCompareWithMemcmp = false;
+    };
+
+    template<typename T>
+    struct VectorTraitsBase<true, T>
+    {
+        static const bool needsDestruction = false;
+        static const bool needsInitialization = false;
+        static const bool canInitializeWithMemset = false;
+        static const bool canMoveWithMemcpy = true;
+        static const bool canCopyWithMemcpy = true;
+        static const bool canFillWithMemset = sizeof(T) == sizeof(char);
+        static const bool canCompareWithMemcmp = true;
+    };
+
+    template<typename T>
+    struct VectorTraits : VectorTraitsBase<IsPod<T>::value, T> { };
+
+    struct SimpleClassVectorTraits : VectorTraitsBase<false, void>
+    {
+        static const bool canInitializeWithMemset = true;
+        static const bool canMoveWithMemcpy = true;
+        static const bool canCompareWithMemcmp = true;
+    };
+
+    // we know OwnPtr and RefPtr are simple enough that initializing to 0 and moving with memcpy
+    // (and then not destructing the original) will totally work
+    template<typename P>
+    struct VectorTraits<RefPtr<P> > : SimpleClassVectorTraits { };
+
+    template<typename P>
+    struct VectorTraits<OwnPtr<P> > : SimpleClassVectorTraits { };
+
+    template<>
+    struct VectorTraits<AtomicString> : SimpleClassVectorTraits { };
+
+    template<typename First, typename Second>
+    struct VectorTraits<pair<First, Second> >
+    {
+        typedef VectorTraits<First> FirstTraits;
+        typedef VectorTraits<Second> SecondTraits;
+
+        static const bool needsDestruction = FirstTraits::needsDestruction || SecondTraits::needsDestruction;
+        static const bool needsInitialization = FirstTraits::needsInitialization || SecondTraits::needsInitialization;
+        static const bool canInitializeWithMemset = FirstTraits::canInitializeWithMemset && SecondTraits::canInitializeWithMemset;
+        static const bool canMoveWithMemcpy = FirstTraits::canMoveWithMemcpy && SecondTraits::canMoveWithMemcpy;
+        static const bool canCopyWithMemcpy = FirstTraits::canCopyWithMemcpy && SecondTraits::canCopyWithMemcpy;
+        static const bool canFillWithMemset = false;
+        static const bool canCompareWithMemcmp = FirstTraits::canCompareWithMemcmp && SecondTraits::canCompareWithMemcmp;
+    };
+
+} // namespace WTF
+
+using WTF::VectorTraits;
+using WTF::SimpleClassVectorTraits;
+
+#endif // WTF_VectorTraits_h
diff --git a/Source/WTF/wtf/WTFThreadData.cpp b/Source/WTF/wtf/WTFThreadData.cpp
new file mode 100644
index 0000000..7d90748
--- /dev/null
+++ b/Source/WTF/wtf/WTFThreadData.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2008, 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 "WTFThreadData.h"
+
+namespace WTF {
+
+ThreadSpecific<WTFThreadData>* WTFThreadData::staticData;
+
+WTFThreadData::WTFThreadData()
+    : m_atomicStringTable(0)
+    , m_atomicStringTableDestructor(0)
+#if USE(JSC)
+    , m_defaultIdentifierTable(new JSC::IdentifierTable())
+    , m_currentIdentifierTable(m_defaultIdentifierTable)
+    , m_stackBounds(StackBounds::currentThreadStackBounds())
+#if ENABLE(STACK_STATS)
+    , m_stackStats()
+#endif
+#endif // USE(JSC)
+{
+}
+
+WTFThreadData::~WTFThreadData()
+{
+    if (m_atomicStringTableDestructor)
+        m_atomicStringTableDestructor(m_atomicStringTable);
+#if USE(JSC)
+    delete m_defaultIdentifierTable;
+#endif
+}
+
+} // namespace WTF
+
+#if USE(JSC)
+namespace JSC {
+
+IdentifierTable::~IdentifierTable()
+{
+    HashSet<StringImpl*>::iterator end = m_table.end();
+    for (HashSet<StringImpl*>::iterator iter = m_table.begin(); iter != end; ++iter)
+        (*iter)->setIsIdentifier(false);
+}
+
+HashSet<StringImpl*>::AddResult IdentifierTable::add(StringImpl* value)
+{
+    HashSet<StringImpl*>::AddResult result = m_table.add(value);
+    (*result.iterator)->setIsIdentifier(true);
+    return result;
+}
+
+} // namespace JSC
+#endif
+
diff --git a/Source/WTF/wtf/WTFThreadData.h b/Source/WTF/wtf/WTFThreadData.h
new file mode 100644
index 0000000..9c2a5db
--- /dev/null
+++ b/Source/WTF/wtf/WTFThreadData.h
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2008 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 WTFThreadData_h
+#define WTFThreadData_h
+
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/StackBounds.h>
+#include <wtf/StackStats.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/ThreadSpecific.h>
+#include <wtf/Threading.h>
+
+#if USE(JSC)
+// FIXME: This is a temporary layering violation while we move more string code to WTF.
+namespace JSC {
+
+typedef HashMap<const char*, RefPtr<StringImpl>, PtrHash<const char*> > LiteralIdentifierTable;
+
+class IdentifierTable {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    ~IdentifierTable();
+
+    HashSet<StringImpl*>::AddResult add(StringImpl* value);
+    template<typename U, typename V>
+    HashSet<StringImpl*>::AddResult add(U value);
+
+    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; }
+
+private:
+    HashSet<StringImpl*> m_table;
+    LiteralIdentifierTable m_literalTable;
+};
+
+}
+#endif
+
+namespace WTF {
+
+class AtomicStringTable;
+
+typedef void (*AtomicStringTableDestructor)(AtomicStringTable*);
+
+class WTFThreadData {
+    WTF_MAKE_NONCOPYABLE(WTFThreadData);
+public:
+    WTF_EXPORT_PRIVATE WTFThreadData();
+    WTF_EXPORT_PRIVATE ~WTFThreadData();
+
+    AtomicStringTable* atomicStringTable()
+    {
+        return m_atomicStringTable;
+    }
+
+#if USE(JSC)
+    JSC::IdentifierTable* currentIdentifierTable()
+    {
+        return m_currentIdentifierTable;
+    }
+
+    JSC::IdentifierTable* setCurrentIdentifierTable(JSC::IdentifierTable* identifierTable)
+    {
+        JSC::IdentifierTable* oldIdentifierTable = m_currentIdentifierTable;
+        m_currentIdentifierTable = identifierTable;
+        return oldIdentifierTable;
+    }
+
+    void resetCurrentIdentifierTable()
+    {
+        m_currentIdentifierTable = m_defaultIdentifierTable;
+    }
+
+    const StackBounds& stack() const
+    {
+        return m_stackBounds;
+    }
+
+#if ENABLE(STACK_STATS)
+    StackStats::PerThreadStats& stackStats()
+    {
+        return m_stackStats;
+    }
+#endif
+#endif // USE(JSC)
+
+private:
+    AtomicStringTable* m_atomicStringTable;
+    AtomicStringTableDestructor m_atomicStringTableDestructor;
+
+#if USE(JSC)
+    JSC::IdentifierTable* m_defaultIdentifierTable;
+    JSC::IdentifierTable* m_currentIdentifierTable;
+    StackBounds m_stackBounds;
+#if ENABLE(STACK_STATS)
+    StackStats::PerThreadStats m_stackStats;
+#endif
+#endif // USE(JSC)
+
+    static WTF_EXPORTDATA ThreadSpecific<WTFThreadData>* staticData;
+    friend WTFThreadData& wtfThreadData();
+    friend class AtomicStringTable;
+};
+
+inline WTFThreadData& wtfThreadData()
+{
+    // WRT WebCore:
+    //    WTFThreadData is used on main thread before it could possibly be used
+    //    on secondary ones, so there is no need for synchronization here.
+    // WRT JavaScriptCore:
+    //    wtfThreadData() is initially called from initializeThreading(), ensuring
+    //    this is initially called in a pthread_once locked context.
+    if (!WTFThreadData::staticData)
+        WTFThreadData::staticData = new ThreadSpecific<WTFThreadData>;
+    return **WTFThreadData::staticData;
+}
+
+} // namespace WTF
+
+using WTF::WTFThreadData;
+using WTF::wtfThreadData;
+
+#endif // WTFThreadData_h
diff --git a/Source/WTF/wtf/blackberry/MainThreadBlackBerry.cpp b/Source/WTF/wtf/blackberry/MainThreadBlackBerry.cpp
new file mode 100644
index 0000000..ec7a364
--- /dev/null
+++ b/Source/WTF/wtf/blackberry/MainThreadBlackBerry.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2009, 2010, 2011 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "MainThread.h"
+
+#include <BlackBerryPlatformExecutableMessage.h>
+#include <BlackBerryPlatformMessageClient.h>
+
+namespace WTF {
+
+void initializeMainThreadPlatform()
+{
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+    BlackBerry::Platform::webKitThreadMessageClient()->dispatchMessage(BlackBerry::Platform::createFunctionCallMessage(dispatchFunctionsFromMainThread));
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/chromium/ChromiumThreading.h b/Source/WTF/wtf/chromium/ChromiumThreading.h
new file mode 100644
index 0000000..3938621
--- /dev/null
+++ b/Source/WTF/wtf/chromium/ChromiumThreading.h
@@ -0,0 +1,44 @@
+/*
+* Copyright (C) 2009 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.
+*     * 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.
+*     * 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 ChromiumThreading_h
+#define ChromiumThreading_h
+
+namespace WTF {
+
+// An interface to the embedding layer, which provides threading support.
+class ChromiumThreading {
+public:
+    static void callOnMainThread(void (*func)(void*), void* context);
+};
+
+} // namespace WTF
+
+#endif // ChromiumThreading_h
diff --git a/Source/WTF/wtf/chromium/MainThreadChromium.cpp b/Source/WTF/wtf/chromium/MainThreadChromium.cpp
new file mode 100644
index 0000000..9e6592b
--- /dev/null
+++ b/Source/WTF/wtf/chromium/MainThreadChromium.cpp
@@ -0,0 +1,73 @@
+/*
+* Copyright (C) 2009 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.
+*     * 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.
+*     * 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 "MainThread.h"
+
+#include "Assertions.h"
+#include "ChromiumThreading.h"
+#include "Threading.h"
+
+namespace WTF {
+
+static ThreadIdentifier mainThreadIdentifier;
+
+void initializeMainThread()
+{
+    static bool initializedMainThread;
+    if (initializedMainThread)
+        return;
+    initializedMainThread = true;
+
+    mainThreadIdentifier = currentThread();
+}
+
+void callOnMainThread(MainThreadFunction* function, void* context)
+{
+    ChromiumThreading::callOnMainThread(function, context);
+}
+
+void callOnMainThreadAndWait(MainThreadFunction*, void*)
+{
+    ASSERT_NOT_REACHED();
+}
+
+void setMainThreadCallbacksPaused(bool)
+{
+    ASSERT_NOT_REACHED();
+}
+
+bool isMainThread()
+{
+    return currentThread() == mainThreadIdentifier;
+}
+
+} // namespace WTF
+
diff --git a/Source/WTF/wtf/dtoa.cpp b/Source/WTF/wtf/dtoa.cpp
new file mode 100644
index 0000000..cf1bc2c
--- /dev/null
+++ b/Source/WTF/wtf/dtoa.cpp
@@ -0,0 +1,1314 @@
+/****************************************************************
+ *
+ * The author of this software is David M. Gay.
+ *
+ * Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
+ * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose without fee is hereby granted, provided that this entire notice
+ * is included in all copies of any software which is or includes a copy
+ * or modification of this software and in all copies of the supporting
+ * documentation for such software.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+ *
+ ***************************************************************/
+
+/* Please send bug reports to David M. Gay (dmg at acm dot org,
+ * with " at " changed at "@" and " dot " changed to ".").    */
+
+/* On a machine with IEEE extended-precision registers, it is
+ * necessary to specify double-precision (53-bit) rounding precision
+ * before invoking strtod or dtoa.  If the machine uses (the equivalent
+ * of) Intel 80x87 arithmetic, the call
+ *    _control87(PC_53, MCW_PC);
+ * does this with many compilers.  Whether this or another call is
+ * appropriate depends on the compiler; for this to work, it may be
+ * necessary to #include "float.h" or another system-dependent header
+ * file.
+ */
+
+#include "config.h"
+#include "dtoa.h"
+
+#include <stdio.h>
+#include <wtf/AlwaysInline.h>
+#include <wtf/MathExtras.h>
+#include <wtf/Threading.h>
+#include <wtf/Vector.h>
+
+#if COMPILER(MSVC)
+#pragma warning(disable: 4244)
+#pragma warning(disable: 4245)
+#pragma warning(disable: 4554)
+#endif
+
+namespace WTF {
+
+Mutex* s_dtoaP5Mutex;
+
+typedef union {
+    double d;
+    uint32_t L[2];
+} U;
+
+#if CPU(BIG_ENDIAN) || CPU(MIDDLE_ENDIAN)
+#define word0(x) (x)->L[0]
+#define word1(x) (x)->L[1]
+#else
+#define word0(x) (x)->L[1]
+#define word1(x) (x)->L[0]
+#endif
+#define dval(x) (x)->d
+
+/* The following definition of Storeinc is appropriate for MIPS processors.
+ * An alternative that might be better on some machines is
+ *  *p++ = high << 16 | low & 0xffff;
+ */
+static ALWAYS_INLINE uint32_t* storeInc(uint32_t* p, uint16_t high, uint16_t low)
+{
+    uint16_t* p16 = reinterpret_cast<uint16_t*>(p);
+#if CPU(BIG_ENDIAN)
+    p16[0] = high;
+    p16[1] = low;
+#else
+    p16[1] = high;
+    p16[0] = low;
+#endif
+    return p + 1;
+}
+
+#define Exp_shift  20
+#define Exp_shift1 20
+#define Exp_msk1    0x100000
+#define Exp_msk11   0x100000
+#define Exp_mask  0x7ff00000
+#define P 53
+#define Bias 1023
+#define Emin (-1022)
+#define Exp_1  0x3ff00000
+#define Exp_11 0x3ff00000
+#define Ebits 11
+#define Frac_mask  0xfffff
+#define Frac_mask1 0xfffff
+#define Ten_pmax 22
+#define Bletch 0x10
+#define Bndry_mask  0xfffff
+#define Bndry_mask1 0xfffff
+#define LSB 1
+#define Sign_bit 0x80000000
+#define Log2P 1
+#define Tiny0 0
+#define Tiny1 1
+#define Quick_max 14
+#define Int_max 14
+
+#define rounded_product(a, b) a *= b
+#define rounded_quotient(a, b) a /= b
+
+#define Big0 (Frac_mask1 | Exp_msk1 * (DBL_MAX_EXP + Bias - 1))
+#define Big1 0xffffffff
+
+#if CPU(PPC64) || CPU(X86_64)
+// FIXME: should we enable this on all 64-bit CPUs?
+// 64-bit emulation provided by the compiler is likely to be slower than dtoa own code on 32-bit hardware.
+#define USE_LONG_LONG
+#endif
+
+struct BigInt {
+    BigInt() : sign(0) { }
+    int sign;
+
+    void clear()
+    {
+        sign = 0;
+        m_words.clear();
+    }
+
+    size_t size() const
+    {
+        return m_words.size();
+    }
+
+    void resize(size_t s)
+    {
+        m_words.resize(s);
+    }
+
+    uint32_t* words()
+    {
+        return m_words.data();
+    }
+
+    const uint32_t* words() const
+    {
+        return m_words.data();
+    }
+
+    void append(uint32_t w)
+    {
+        m_words.append(w);
+    }
+
+    Vector<uint32_t, 16> m_words;
+};
+
+static void multadd(BigInt& b, int m, int a)    /* multiply by m and add a */
+{
+#ifdef USE_LONG_LONG
+    unsigned long long carry;
+#else
+    uint32_t carry;
+#endif
+
+    int wds = b.size();
+    uint32_t* x = b.words();
+    int i = 0;
+    carry = a;
+    do {
+#ifdef USE_LONG_LONG
+        unsigned long long y = *x * (unsigned long long)m + carry;
+        carry = y >> 32;
+        *x++ = (uint32_t)y & 0xffffffffUL;
+#else
+        uint32_t xi = *x;
+        uint32_t y = (xi & 0xffff) * m + carry;
+        uint32_t z = (xi >> 16) * m + (y >> 16);
+        carry = z >> 16;
+        *x++ = (z << 16) + (y & 0xffff);
+#endif
+    } while (++i < wds);
+
+    if (carry)
+        b.append((uint32_t)carry);
+}
+
+static int hi0bits(uint32_t x)
+{
+    int k = 0;
+
+    if (!(x & 0xffff0000)) {
+        k = 16;
+        x <<= 16;
+    }
+    if (!(x & 0xff000000)) {
+        k += 8;
+        x <<= 8;
+    }
+    if (!(x & 0xf0000000)) {
+        k += 4;
+        x <<= 4;
+    }
+    if (!(x & 0xc0000000)) {
+        k += 2;
+        x <<= 2;
+    }
+    if (!(x & 0x80000000)) {
+        k++;
+        if (!(x & 0x40000000))
+            return 32;
+    }
+    return k;
+}
+
+static int lo0bits(uint32_t* y)
+{
+    int k;
+    uint32_t x = *y;
+
+    if (x & 7) {
+        if (x & 1)
+            return 0;
+        if (x & 2) {
+            *y = x >> 1;
+            return 1;
+        }
+        *y = x >> 2;
+        return 2;
+    }
+    k = 0;
+    if (!(x & 0xffff)) {
+        k = 16;
+        x >>= 16;
+    }
+    if (!(x & 0xff)) {
+        k += 8;
+        x >>= 8;
+    }
+    if (!(x & 0xf)) {
+        k += 4;
+        x >>= 4;
+    }
+    if (!(x & 0x3)) {
+        k += 2;
+        x >>= 2;
+    }
+    if (!(x & 1)) {
+        k++;
+        x >>= 1;
+        if (!x)
+            return 32;
+    }
+    *y = x;
+    return k;
+}
+
+static void i2b(BigInt& b, int i)
+{
+    b.sign = 0;
+    b.resize(1);
+    b.words()[0] = i;
+}
+
+static void mult(BigInt& aRef, const BigInt& bRef)
+{
+    const BigInt* a = &aRef;
+    const BigInt* b = &bRef;
+    BigInt c;
+    int wa, wb, wc;
+    const uint32_t* x = 0;
+    const uint32_t* xa;
+    const uint32_t* xb;
+    const uint32_t* xae;
+    const uint32_t* xbe;
+    uint32_t* xc;
+    uint32_t* xc0;
+    uint32_t y;
+#ifdef USE_LONG_LONG
+    unsigned long long carry, z;
+#else
+    uint32_t carry, z;
+#endif
+
+    if (a->size() < b->size()) {
+        const BigInt* tmp = a;
+        a = b;
+        b = tmp;
+    }
+
+    wa = a->size();
+    wb = b->size();
+    wc = wa + wb;
+    c.resize(wc);
+
+    for (xc = c.words(), xa = xc + wc; xc < xa; xc++)
+        *xc = 0;
+    xa = a->words();
+    xae = xa + wa;
+    xb = b->words();
+    xbe = xb + wb;
+    xc0 = c.words();
+#ifdef USE_LONG_LONG
+    for (; xb < xbe; xc0++) {
+        if ((y = *xb++)) {
+            x = xa;
+            xc = xc0;
+            carry = 0;
+            do {
+                z = *x++ * (unsigned long long)y + *xc + carry;
+                carry = z >> 32;
+                *xc++ = (uint32_t)z & 0xffffffffUL;
+            } while (x < xae);
+            *xc = (uint32_t)carry;
+        }
+    }
+#else
+    for (; xb < xbe; xb++, xc0++) {
+        if ((y = *xb & 0xffff)) {
+            x = xa;
+            xc = xc0;
+            carry = 0;
+            do {
+                z = (*x & 0xffff) * y + (*xc & 0xffff) + carry;
+                carry = z >> 16;
+                uint32_t z2 = (*x++ >> 16) * y + (*xc >> 16) + carry;
+                carry = z2 >> 16;
+                xc = storeInc(xc, z2, z);
+            } while (x < xae);
+            *xc = carry;
+        }
+        if ((y = *xb >> 16)) {
+            x = xa;
+            xc = xc0;
+            carry = 0;
+            uint32_t z2 = *xc;
+            do {
+                z = (*x & 0xffff) * y + (*xc >> 16) + carry;
+                carry = z >> 16;
+                xc = storeInc(xc, z, z2);
+                z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry;
+                carry = z2 >> 16;
+            } while (x < xae);
+            *xc = z2;
+        }
+    }
+#endif
+    for (xc0 = c.words(), xc = xc0 + wc; wc > 0 && !*--xc; --wc) { }
+    c.resize(wc);
+    aRef = c;
+}
+
+struct P5Node {
+    WTF_MAKE_NONCOPYABLE(P5Node); WTF_MAKE_FAST_ALLOCATED;
+public:
+    P5Node() { }
+    BigInt val;
+    P5Node* next;
+};
+
+static P5Node* p5s;
+static int p5sCount;
+
+static ALWAYS_INLINE void pow5mult(BigInt& b, int k)
+{
+    static int p05[3] = { 5, 25, 125 };
+
+    if (int i = k & 3)
+        multadd(b, p05[i - 1], 0);
+
+    if (!(k >>= 2))
+        return;
+
+    s_dtoaP5Mutex->lock();
+    P5Node* p5 = p5s;
+
+    if (!p5) {
+        /* first time */
+        p5 = new P5Node;
+        i2b(p5->val, 625);
+        p5->next = 0;
+        p5s = p5;
+        p5sCount = 1;
+    }
+
+    int p5sCountLocal = p5sCount;
+    s_dtoaP5Mutex->unlock();
+    int p5sUsed = 0;
+
+    for (;;) {
+        if (k & 1)
+            mult(b, p5->val);
+
+        if (!(k >>= 1))
+            break;
+
+        if (++p5sUsed == p5sCountLocal) {
+            s_dtoaP5Mutex->lock();
+            if (p5sUsed == p5sCount) {
+                ASSERT(!p5->next);
+                p5->next = new P5Node;
+                p5->next->next = 0;
+                p5->next->val = p5->val;
+                mult(p5->next->val, p5->next->val);
+                ++p5sCount;
+            }
+
+            p5sCountLocal = p5sCount;
+            s_dtoaP5Mutex->unlock();
+        }
+        p5 = p5->next;
+    }
+}
+
+static ALWAYS_INLINE void lshift(BigInt& b, int k)
+{
+    int n = k >> 5;
+
+    int origSize = b.size();
+    int n1 = n + origSize + 1;
+
+    if (k &= 0x1f)
+        b.resize(b.size() + n + 1);
+    else
+        b.resize(b.size() + n);
+
+    const uint32_t* srcStart = b.words();
+    uint32_t* dstStart = b.words();
+    const uint32_t* src = srcStart + origSize - 1;
+    uint32_t* dst = dstStart + n1 - 1;
+    if (k) {
+        uint32_t hiSubword = 0;
+        int s = 32 - k;
+        for (; src >= srcStart; --src) {
+            *dst-- = hiSubword | *src >> s;
+            hiSubword = *src << k;
+        }
+        *dst = hiSubword;
+        ASSERT(dst == dstStart + n);
+
+        b.resize(origSize + n + !!b.words()[n1 - 1]);
+    }
+    else {
+        do {
+            *--dst = *src--;
+        } while (src >= srcStart);
+    }
+    for (dst = dstStart + n; dst != dstStart; )
+        *--dst = 0;
+
+    ASSERT(b.size() <= 1 || b.words()[b.size() - 1]);
+}
+
+static int cmp(const BigInt& a, const BigInt& b)
+{
+    const uint32_t *xa, *xa0, *xb, *xb0;
+    int i, j;
+
+    i = a.size();
+    j = b.size();
+    ASSERT(i <= 1 || a.words()[i - 1]);
+    ASSERT(j <= 1 || b.words()[j - 1]);
+    if (i -= j)
+        return i;
+    xa0 = a.words();
+    xa = xa0 + j;
+    xb0 = b.words();
+    xb = xb0 + j;
+    for (;;) {
+        if (*--xa != *--xb)
+            return *xa < *xb ? -1 : 1;
+        if (xa <= xa0)
+            break;
+    }
+    return 0;
+}
+
+static ALWAYS_INLINE void diff(BigInt& c, const BigInt& aRef, const BigInt& bRef)
+{
+    const BigInt* a = &aRef;
+    const BigInt* b = &bRef;
+    int i, wa, wb;
+    uint32_t* xc;
+
+    i = cmp(*a, *b);
+    if (!i) {
+        c.sign = 0;
+        c.resize(1);
+        c.words()[0] = 0;
+        return;
+    }
+    if (i < 0) {
+        const BigInt* tmp = a;
+        a = b;
+        b = tmp;
+        i = 1;
+    } else
+        i = 0;
+
+    wa = a->size();
+    const uint32_t* xa = a->words();
+    const uint32_t* xae = xa + wa;
+    wb = b->size();
+    const uint32_t* xb = b->words();
+    const uint32_t* xbe = xb + wb;
+
+    c.resize(wa);
+    c.sign = i;
+    xc = c.words();
+#ifdef USE_LONG_LONG
+    unsigned long long borrow = 0;
+    do {
+        unsigned long long y = (unsigned long long)*xa++ - *xb++ - borrow;
+        borrow = y >> 32 & (uint32_t)1;
+        *xc++ = (uint32_t)y & 0xffffffffUL;
+    } while (xb < xbe);
+    while (xa < xae) {
+        unsigned long long y = *xa++ - borrow;
+        borrow = y >> 32 & (uint32_t)1;
+        *xc++ = (uint32_t)y & 0xffffffffUL;
+    }
+#else
+    uint32_t borrow = 0;
+    do {
+        uint32_t y = (*xa & 0xffff) - (*xb & 0xffff) - borrow;
+        borrow = (y & 0x10000) >> 16;
+        uint32_t z = (*xa++ >> 16) - (*xb++ >> 16) - borrow;
+        borrow = (z & 0x10000) >> 16;
+        xc = storeInc(xc, z, y);
+    } while (xb < xbe);
+    while (xa < xae) {
+        uint32_t y = (*xa & 0xffff) - borrow;
+        borrow = (y & 0x10000) >> 16;
+        uint32_t z = (*xa++ >> 16) - borrow;
+        borrow = (z & 0x10000) >> 16;
+        xc = storeInc(xc, z, y);
+    }
+#endif
+    while (!*--xc)
+        wa--;
+    c.resize(wa);
+}
+
+static ALWAYS_INLINE void d2b(BigInt& b, U* d, int* e, int* bits)
+{
+    int de, k;
+    uint32_t* x;
+    uint32_t y, z;
+    int i;
+#define d0 word0(d)
+#define d1 word1(d)
+
+    b.sign = 0;
+    b.resize(1);
+    x = b.words();
+
+    z = d0 & Frac_mask;
+    d0 &= 0x7fffffff;    /* clear sign bit, which we ignore */
+    if ((de = (int)(d0 >> Exp_shift)))
+        z |= Exp_msk1;
+    if ((y = d1)) {
+        if ((k = lo0bits(&y))) {
+            x[0] = y | (z << (32 - k));
+            z >>= k;
+        } else
+            x[0] = y;
+        if (z) {
+            b.resize(2);
+            x[1] = z;
+        }
+
+        i = b.size();
+    } else {
+        k = lo0bits(&z);
+        x[0] = z;
+        i = 1;
+        b.resize(1);
+        k += 32;
+    }
+    if (de) {
+        *e = de - Bias - (P - 1) + k;
+        *bits = P - k;
+    } else {
+        *e = 0 - Bias - (P - 1) + 1 + k;
+        *bits = (32 * i) - hi0bits(x[i - 1]);
+    }
+}
+#undef d0
+#undef d1
+
+static const double tens[] = {
+    1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
+    1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
+    1e20, 1e21, 1e22
+};
+
+static const double bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 };
+static const double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128,
+    9007199254740992. * 9007199254740992.e-256
+    /* = 2^106 * 1e-256 */
+};
+
+/* The factor of 2^53 in tinytens[4] helps us avoid setting the underflow */
+/* flag unnecessarily.  It leads to a song and dance at the end of strtod. */
+#define Scale_Bit 0x10
+#define n_bigtens 5
+
+static ALWAYS_INLINE int quorem(BigInt& b, BigInt& S)
+{
+    size_t n;
+    uint32_t* bx;
+    uint32_t* bxe;
+    uint32_t q;
+    uint32_t* sx;
+    uint32_t* sxe;
+#ifdef USE_LONG_LONG
+    unsigned long long borrow, carry, y, ys;
+#else
+    uint32_t borrow, carry, y, ys;
+    uint32_t si, z, zs;
+#endif
+    ASSERT(b.size() <= 1 || b.words()[b.size() - 1]);
+    ASSERT(S.size() <= 1 || S.words()[S.size() - 1]);
+
+    n = S.size();
+    ASSERT_WITH_MESSAGE(b.size() <= n, "oversize b in quorem");
+    if (b.size() < n)
+        return 0;
+    sx = S.words();
+    sxe = sx + --n;
+    bx = b.words();
+    bxe = bx + n;
+    q = *bxe / (*sxe + 1);    /* ensure q <= true quotient */
+    ASSERT_WITH_MESSAGE(q <= 9, "oversized quotient in quorem");
+    if (q) {
+        borrow = 0;
+        carry = 0;
+        do {
+#ifdef USE_LONG_LONG
+            ys = *sx++ * (unsigned long long)q + carry;
+            carry = ys >> 32;
+            y = *bx - (ys & 0xffffffffUL) - borrow;
+            borrow = y >> 32 & (uint32_t)1;
+            *bx++ = (uint32_t)y & 0xffffffffUL;
+#else
+            si = *sx++;
+            ys = (si & 0xffff) * q + carry;
+            zs = (si >> 16) * q + (ys >> 16);
+            carry = zs >> 16;
+            y = (*bx & 0xffff) - (ys & 0xffff) - borrow;
+            borrow = (y & 0x10000) >> 16;
+            z = (*bx >> 16) - (zs & 0xffff) - borrow;
+            borrow = (z & 0x10000) >> 16;
+            bx = storeInc(bx, z, y);
+#endif
+        } while (sx <= sxe);
+        if (!*bxe) {
+            bx = b.words();
+            while (--bxe > bx && !*bxe)
+                --n;
+            b.resize(n);
+        }
+    }
+    if (cmp(b, S) >= 0) {
+        q++;
+        borrow = 0;
+        carry = 0;
+        bx = b.words();
+        sx = S.words();
+        do {
+#ifdef USE_LONG_LONG
+            ys = *sx++ + carry;
+            carry = ys >> 32;
+            y = *bx - (ys & 0xffffffffUL) - borrow;
+            borrow = y >> 32 & (uint32_t)1;
+            *bx++ = (uint32_t)y & 0xffffffffUL;
+#else
+            si = *sx++;
+            ys = (si & 0xffff) + carry;
+            zs = (si >> 16) + (ys >> 16);
+            carry = zs >> 16;
+            y = (*bx & 0xffff) - (ys & 0xffff) - borrow;
+            borrow = (y & 0x10000) >> 16;
+            z = (*bx >> 16) - (zs & 0xffff) - borrow;
+            borrow = (z & 0x10000) >> 16;
+            bx = storeInc(bx, z, y);
+#endif
+        } while (sx <= sxe);
+        bx = b.words();
+        bxe = bx + n;
+        if (!*bxe) {
+            while (--bxe > bx && !*bxe)
+                --n;
+            b.resize(n);
+        }
+    }
+    return q;
+}
+
+/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string.
+ *
+ * Inspired by "How to Print Floating-Point Numbers Accurately" by
+ * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126].
+ *
+ * Modifications:
+ *    1. Rather than iterating, we use a simple numeric overestimate
+ *       to determine k = floor(log10(d)).  We scale relevant
+ *       quantities using O(log2(k)) rather than O(k) multiplications.
+ *    2. For some modes > 2 (corresponding to ecvt and fcvt), we don't
+ *       try to generate digits strictly left to right.  Instead, we
+ *       compute with fewer bits and propagate the carry if necessary
+ *       when rounding the final digit up.  This is often faster.
+ *    3. Under the assumption that input will be rounded nearest,
+ *       mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22.
+ *       That is, we allow equality in stopping tests when the
+ *       round-nearest rule will give the same floating-point value
+ *       as would satisfaction of the stopping test with strict
+ *       inequality.
+ *    4. We remove common factors of powers of 2 from relevant
+ *       quantities.
+ *    5. When converting floating-point integers less than 1e16,
+ *       we use floating-point arithmetic rather than resorting
+ *       to multiple-precision integers.
+ *    6. When asked to produce fewer than 15 digits, we first try
+ *       to get by with floating-point arithmetic; we resort to
+ *       multiple-precision integer arithmetic only if we cannot
+ *       guarantee that the floating-point calculation has given
+ *       the correctly rounded result.  For k requested digits and
+ *       "uniformly" distributed input, the probability is
+ *       something like 10^(k-15) that we must resort to the int32_t
+ *       calculation.
+ *
+ * Note: 'leftright' translates to 'generate shortest possible string'.
+ */
+template<bool roundingNone, bool roundingSignificantFigures, bool roundingDecimalPlaces, bool leftright>
+void dtoa(DtoaBuffer result, double dd, int ndigits, bool& signOut, int& exponentOut, unsigned& precisionOut)
+{
+    // Exactly one rounding mode must be specified.
+    ASSERT(roundingNone + roundingSignificantFigures + roundingDecimalPlaces == 1);
+    // roundingNone only allowed (only sensible?) with leftright set.
+    ASSERT(!roundingNone || leftright);
+
+    ASSERT(isfinite(dd));
+
+    int bbits, b2, b5, be, dig, i, ieps, ilim = 0, ilim0, ilim1 = 0,
+        j, j1, k, k0, k_check, m2, m5, s2, s5,
+        spec_case;
+    int32_t L;
+    int denorm;
+    uint32_t x;
+    BigInt b, delta, mlo, mhi, S;
+    U d2, eps, u;
+    double ds;
+    char* s;
+    char* s0;
+
+    u.d = dd;
+
+    /* Infinity or NaN */
+    ASSERT((word0(&u) & Exp_mask) != Exp_mask);
+
+    // JavaScript toString conversion treats -0 as 0.
+    if (!dval(&u)) {
+        signOut = false;
+        exponentOut = 0;
+        precisionOut = 1;
+        result[0] = '0';
+        result[1] = '\0';
+        return;
+    }
+
+    if (word0(&u) & Sign_bit) {
+        signOut = true;
+        word0(&u) &= ~Sign_bit; // clear sign bit
+    } else
+        signOut = false;
+
+    d2b(b, &u, &be, &bbits);
+    if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask >> Exp_shift1)))) {
+        dval(&d2) = dval(&u);
+        word0(&d2) &= Frac_mask1;
+        word0(&d2) |= Exp_11;
+
+        /* log(x)    ~=~ log(1.5) + (x-1.5)/1.5
+         * log10(x)     =  log(x) / log(10)
+         *        ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10))
+         * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2)
+         *
+         * This suggests computing an approximation k to log10(d) by
+         *
+         * k = (i - Bias)*0.301029995663981
+         *    + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 );
+         *
+         * We want k to be too large rather than too small.
+         * The error in the first-order Taylor series approximation
+         * is in our favor, so we just round up the constant enough
+         * to compensate for any error in the multiplication of
+         * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077,
+         * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14,
+         * adding 1e-13 to the constant term more than suffices.
+         * Hence we adjust the constant term to 0.1760912590558.
+         * (We could get a more accurate k by invoking log10,
+         *  but this is probably not worthwhile.)
+         */
+
+        i -= Bias;
+        denorm = 0;
+    } else {
+        /* d is denormalized */
+
+        i = bbits + be + (Bias + (P - 1) - 1);
+        x = (i > 32) ? (word0(&u) << (64 - i)) | (word1(&u) >> (i - 32))
+                : word1(&u) << (32 - i);
+        dval(&d2) = x;
+        word0(&d2) -= 31 * Exp_msk1; /* adjust exponent */
+        i -= (Bias + (P - 1) - 1) + 1;
+        denorm = 1;
+    }
+    ds = (dval(&d2) - 1.5) * 0.289529654602168 + 0.1760912590558 + (i * 0.301029995663981);
+    k = (int)ds;
+    if (ds < 0. && ds != k)
+        k--;    /* want k = floor(ds) */
+    k_check = 1;
+    if (k >= 0 && k <= Ten_pmax) {
+        if (dval(&u) < tens[k])
+            k--;
+        k_check = 0;
+    }
+    j = bbits - i - 1;
+    if (j >= 0) {
+        b2 = 0;
+        s2 = j;
+    } else {
+        b2 = -j;
+        s2 = 0;
+    }
+    if (k >= 0) {
+        b5 = 0;
+        s5 = k;
+        s2 += k;
+    } else {
+        b2 -= k;
+        b5 = -k;
+        s5 = 0;
+    }
+
+    if (roundingNone) {
+        ilim = ilim1 = -1;
+        i = 18;
+        ndigits = 0;
+    }
+    if (roundingSignificantFigures) {
+        if (ndigits <= 0)
+            ndigits = 1;
+        ilim = ilim1 = i = ndigits;
+    }
+    if (roundingDecimalPlaces) {
+        i = ndigits + k + 1;
+        ilim = i;
+        ilim1 = i - 1;
+        if (i <= 0)
+            i = 1;
+    }
+
+    s = s0 = result;
+
+    if (ilim >= 0 && ilim <= Quick_max) {
+        /* Try to get by with floating-point arithmetic. */
+
+        i = 0;
+        dval(&d2) = dval(&u);
+        k0 = k;
+        ilim0 = ilim;
+        ieps = 2; /* conservative */
+        if (k > 0) {
+            ds = tens[k & 0xf];
+            j = k >> 4;
+            if (j & Bletch) {
+                /* prevent overflows */
+                j &= Bletch - 1;
+                dval(&u) /= bigtens[n_bigtens - 1];
+                ieps++;
+            }
+            for (; j; j >>= 1, i++) {
+                if (j & 1) {
+                    ieps++;
+                    ds *= bigtens[i];
+                }
+            }
+            dval(&u) /= ds;
+        } else if ((j1 = -k)) {
+            dval(&u) *= tens[j1 & 0xf];
+            for (j = j1 >> 4; j; j >>= 1, i++) {
+                if (j & 1) {
+                    ieps++;
+                    dval(&u) *= bigtens[i];
+                }
+            }
+        }
+        if (k_check && dval(&u) < 1. && ilim > 0) {
+            if (ilim1 <= 0)
+                goto fastFailed;
+            ilim = ilim1;
+            k--;
+            dval(&u) *= 10.;
+            ieps++;
+        }
+        dval(&eps) = (ieps * dval(&u)) + 7.;
+        word0(&eps) -= (P - 1) * Exp_msk1;
+        if (!ilim) {
+            S.clear();
+            mhi.clear();
+            dval(&u) -= 5.;
+            if (dval(&u) > dval(&eps))
+                goto oneDigit;
+            if (dval(&u) < -dval(&eps))
+                goto noDigits;
+            goto fastFailed;
+        }
+        if (leftright) {
+            /* Use Steele & White method of only
+             * generating digits needed.
+             */
+            dval(&eps) = (0.5 / tens[ilim - 1]) - dval(&eps);
+            for (i = 0;;) {
+                L = (long int)dval(&u);
+                dval(&u) -= L;
+                *s++ = '0' + (int)L;
+                if (dval(&u) < dval(&eps))
+                    goto ret;
+                if (1. - dval(&u) < dval(&eps))
+                    goto bumpUp;
+                if (++i >= ilim)
+                    break;
+                dval(&eps) *= 10.;
+                dval(&u) *= 10.;
+            }
+        } else {
+            /* Generate ilim digits, then fix them up. */
+            dval(&eps) *= tens[ilim - 1];
+            for (i = 1;; i++, dval(&u) *= 10.) {
+                L = (int32_t)(dval(&u));
+                if (!(dval(&u) -= L))
+                    ilim = i;
+                *s++ = '0' + (int)L;
+                if (i == ilim) {
+                    if (dval(&u) > 0.5 + dval(&eps))
+                        goto bumpUp;
+                    if (dval(&u) < 0.5 - dval(&eps)) {
+                        while (*--s == '0') { }
+                        s++;
+                        goto ret;
+                    }
+                    break;
+                }
+            }
+        }
+fastFailed:
+        s = s0;
+        dval(&u) = dval(&d2);
+        k = k0;
+        ilim = ilim0;
+    }
+
+    /* Do we have a "small" integer? */
+
+    if (be >= 0 && k <= Int_max) {
+        /* Yes. */
+        ds = tens[k];
+        if (ndigits < 0 && ilim <= 0) {
+            S.clear();
+            mhi.clear();
+            if (ilim < 0 || dval(&u) <= 5 * ds)
+                goto noDigits;
+            goto oneDigit;
+        }
+        for (i = 1;; i++, dval(&u) *= 10.) {
+            L = (int32_t)(dval(&u) / ds);
+            dval(&u) -= L * ds;
+            *s++ = '0' + (int)L;
+            if (!dval(&u)) {
+                break;
+            }
+            if (i == ilim) {
+                dval(&u) += dval(&u);
+                if (dval(&u) > ds || (dval(&u) == ds && (L & 1))) {
+bumpUp:
+                    while (*--s == '9')
+                        if (s == s0) {
+                            k++;
+                            *s = '0';
+                            break;
+                        }
+                    ++*s++;
+                }
+                break;
+            }
+        }
+        goto ret;
+    }
+
+    m2 = b2;
+    m5 = b5;
+    mhi.clear();
+    mlo.clear();
+    if (leftright) {
+        i = denorm ? be + (Bias + (P - 1) - 1 + 1) : 1 + P - bbits;
+        b2 += i;
+        s2 += i;
+        i2b(mhi, 1);
+    }
+    if (m2 > 0 && s2 > 0) {
+        i = m2 < s2 ? m2 : s2;
+        b2 -= i;
+        m2 -= i;
+        s2 -= i;
+    }
+    if (b5 > 0) {
+        if (leftright) {
+            if (m5 > 0) {
+                pow5mult(mhi, m5);
+                mult(b, mhi);
+            }
+            if ((j = b5 - m5))
+                pow5mult(b, j);
+        } else
+            pow5mult(b, b5);
+    }
+    i2b(S, 1);
+    if (s5 > 0)
+        pow5mult(S, s5);
+
+    /* Check for special case that d is a normalized power of 2. */
+
+    spec_case = 0;
+    if ((roundingNone || leftright) && (!word1(&u) && !(word0(&u) & Bndry_mask) && word0(&u) & (Exp_mask & ~Exp_msk1))) {
+        /* The special case */
+        b2 += Log2P;
+        s2 += Log2P;
+        spec_case = 1;
+    }
+
+    /* Arrange for convenient computation of quotients:
+     * shift left if necessary so divisor has 4 leading 0 bits.
+     *
+     * Perhaps we should just compute leading 28 bits of S once
+     * and for all and pass them and a shift to quorem, so it
+     * can do shifts and ors to compute the numerator for q.
+     */
+    if ((i = ((s5 ? 32 - hi0bits(S.words()[S.size() - 1]) : 1) + s2) & 0x1f))
+        i = 32 - i;
+    if (i > 4) {
+        i -= 4;
+        b2 += i;
+        m2 += i;
+        s2 += i;
+    } else if (i < 4) {
+        i += 28;
+        b2 += i;
+        m2 += i;
+        s2 += i;
+    }
+    if (b2 > 0)
+        lshift(b, b2);
+    if (s2 > 0)
+        lshift(S, s2);
+    if (k_check) {
+        if (cmp(b, S) < 0) {
+            k--;
+            multadd(b, 10, 0);    /* we botched the k estimate */
+            if (leftright)
+                multadd(mhi, 10, 0);
+            ilim = ilim1;
+        }
+    }
+    if (ilim <= 0 && roundingDecimalPlaces) {
+        if (ilim < 0)
+            goto noDigits;
+        multadd(S, 5, 0);
+        // For IEEE-754 unbiased rounding this check should be <=, such that 0.5 would flush to zero.
+        if (cmp(b, S) < 0)
+            goto noDigits;
+        goto oneDigit;
+    }
+    if (leftright) {
+        if (m2 > 0)
+            lshift(mhi, m2);
+
+        /* Compute mlo -- check for special case
+         * that d is a normalized power of 2.
+         */
+
+        mlo = mhi;
+        if (spec_case)
+            lshift(mhi, Log2P);
+
+        for (i = 1;;i++) {
+            dig = quorem(b, S) + '0';
+            /* Do we yet have the shortest decimal string
+             * that will round to d?
+             */
+            j = cmp(b, mlo);
+            diff(delta, S, mhi);
+            j1 = delta.sign ? 1 : cmp(b, delta);
+#ifdef DTOA_ROUND_BIASED
+            if (j < 0 || !j) {
+#else
+            // FIXME: ECMA-262 specifies that equidistant results round away from
+            // zero, which probably means we shouldn't be on the unbiased code path
+            // (the (word1(&u) & 1) clause is looking highly suspicious). I haven't
+            // yet understood this code well enough to make the call, but we should
+            // probably be enabling DTOA_ROUND_BIASED. I think the interesting corner
+            // case to understand is probably "Math.pow(0.5, 24).toString()".
+            // I believe this value is interesting because I think it is precisely
+            // representable in binary floating point, and its decimal representation
+            // has a single digit that Steele & White reduction can remove, with the
+            // value 5 (thus equidistant from the next numbers above and below).
+            // We produce the correct answer using either codepath, and I don't as
+            // yet understand why. :-)
+            if (!j1 && !(word1(&u) & 1)) {
+                if (dig == '9')
+                    goto round9up;
+                if (j > 0)
+                    dig++;
+                *s++ = dig;
+                goto ret;
+            }
+            if (j < 0 || (!j && !(word1(&u) & 1))) {
+#endif
+                if ((b.words()[0] || b.size() > 1) && (j1 > 0)) {
+                    lshift(b, 1);
+                    j1 = cmp(b, S);
+                    // For IEEE-754 round-to-even, this check should be (j1 > 0 || (!j1 && (dig & 1))),
+                    // but ECMA-262 specifies that equidistant values (e.g. (.5).toFixed()) should
+                    // be rounded away from zero.
+                    if (j1 >= 0) {
+                        if (dig == '9')
+                            goto round9up;
+                        dig++;
+                    }
+                }
+                *s++ = dig;
+                goto ret;
+            }
+            if (j1 > 0) {
+                if (dig == '9') { /* possible if i == 1 */
+round9up:
+                    *s++ = '9';
+                    goto roundoff;
+                }
+                *s++ = dig + 1;
+                goto ret;
+            }
+            *s++ = dig;
+            if (i == ilim)
+                break;
+            multadd(b, 10, 0);
+            multadd(mlo, 10, 0);
+            multadd(mhi, 10, 0);
+        }
+    } else {
+        for (i = 1;; i++) {
+            *s++ = dig = quorem(b, S) + '0';
+            if (!b.words()[0] && b.size() <= 1)
+                goto ret;
+            if (i >= ilim)
+                break;
+            multadd(b, 10, 0);
+        }
+    }
+
+    /* Round off last digit */
+
+    lshift(b, 1);
+    j = cmp(b, S);
+    // For IEEE-754 round-to-even, this check should be (j > 0 || (!j && (dig & 1))),
+    // but ECMA-262 specifies that equidistant values (e.g. (.5).toFixed()) should
+    // be rounded away from zero.
+    if (j >= 0) {
+roundoff:
+        while (*--s == '9')
+            if (s == s0) {
+                k++;
+                *s++ = '1';
+                goto ret;
+            }
+        ++*s++;
+    } else {
+        while (*--s == '0') { }
+        s++;
+    }
+    goto ret;
+noDigits:
+    exponentOut = 0;
+    precisionOut = 1;
+    result[0] = '0';
+    result[1] = '\0';
+    return;
+oneDigit:
+    *s++ = '1';
+    k++;
+    goto ret;
+ret:
+    ASSERT(s > result);
+    *s = 0;
+    exponentOut = k;
+    precisionOut = s - result;
+}
+
+void dtoa(DtoaBuffer result, double dd, bool& sign, int& exponent, unsigned& precision)
+{
+    // flags are roundingNone, leftright.
+    dtoa<true, false, false, true>(result, dd, 0, sign, exponent, precision);
+}
+
+void dtoaRoundSF(DtoaBuffer result, double dd, int ndigits, bool& sign, int& exponent, unsigned& precision)
+{
+    // flag is roundingSignificantFigures.
+    dtoa<false, true, false, false>(result, dd, ndigits, sign, exponent, precision);
+}
+
+void dtoaRoundDP(DtoaBuffer result, double dd, int ndigits, bool& sign, int& exponent, unsigned& precision)
+{
+    // flag is roundingDecimalPlaces.
+    dtoa<false, false, true, false>(result, dd, ndigits, sign, exponent, precision);
+}
+
+const char* numberToString(double d, NumberToStringBuffer buffer)
+{
+    double_conversion::StringBuilder builder(buffer, NumberToStringBufferLength);
+    const double_conversion::DoubleToStringConverter& converter = double_conversion::DoubleToStringConverter::EcmaScriptConverter();
+    converter.ToShortest(d, &builder);
+    return builder.Finalize();
+}
+
+static inline const char* formatStringTruncatingTrailingZerosIfNeeded(NumberToStringBuffer buffer, double_conversion::StringBuilder& builder)
+{
+    size_t length = builder.position();
+    size_t decimalPointPosition = 0;
+    for (; decimalPointPosition < length; ++decimalPointPosition) {
+        if (buffer[decimalPointPosition] == '.')
+            break;
+    }
+
+    // No decimal seperator found, early exit.
+    if (decimalPointPosition == length)
+        return builder.Finalize();
+
+    size_t truncatedLength = length - 1;
+    for (; truncatedLength > decimalPointPosition; --truncatedLength) {
+        if (buffer[truncatedLength] != '0')
+            break;
+    }
+
+    // No trailing zeros found to strip.
+    if (truncatedLength == length - 1)
+        return builder.Finalize();
+
+    // If we removed all trailing zeros, remove the decimal point as well.
+    if (truncatedLength == decimalPointPosition) {
+        ASSERT(truncatedLength > 0);
+        --truncatedLength;
+    }
+
+    // Truncate the StringBuilder, and return the final result.
+    builder.SetPosition(truncatedLength + 1);
+    return builder.Finalize();
+}
+
+const char* numberToFixedPrecisionString(double d, unsigned significantFigures, NumberToStringBuffer buffer, bool truncateTrailingZeros)
+{
+    // Mimic String::format("%.[precision]g", ...), but use dtoas rounding facilities.
+    // "g": Signed value printed in f or e format, whichever is more compact for the given value and precision.
+    // The e format is used only when the exponent of the value is less than –4 or greater than or equal to the
+    // precision argument. Trailing zeros are truncated, and the decimal point appears only if one or more digits follow it.
+    // "precision": The precision specifies the maximum number of significant digits printed.
+    double_conversion::StringBuilder builder(buffer, NumberToStringBufferLength);
+    const double_conversion::DoubleToStringConverter& converter = double_conversion::DoubleToStringConverter::EcmaScriptConverter();
+    converter.ToPrecision(d, significantFigures, &builder);
+    if (!truncateTrailingZeros)
+        return builder.Finalize();
+    return formatStringTruncatingTrailingZerosIfNeeded(buffer, builder);
+}
+
+const char* numberToFixedWidthString(double d, unsigned decimalPlaces, NumberToStringBuffer buffer)
+{
+    // Mimic String::format("%.[precision]f", ...), but use dtoas rounding facilities.
+    // "f": Signed value having the form [ – ]dddd.dddd, where dddd is one or more decimal digits.
+    // The number of digits before the decimal point depends on the magnitude of the number, and
+    // the number of digits after the decimal point depends on the requested precision.
+    // "precision": The precision value specifies the number of digits after the decimal point.
+    // If a decimal point appears, at least one digit appears before it.
+    // The value is rounded to the appropriate number of digits.    
+    double_conversion::StringBuilder builder(buffer, NumberToStringBufferLength);
+    const double_conversion::DoubleToStringConverter& converter = double_conversion::DoubleToStringConverter::EcmaScriptConverter();
+    converter.ToFixed(d, decimalPlaces, &builder);
+    return builder.Finalize();
+}
+
+namespace Internal {
+
+double parseDoubleFromLongString(const UChar* string, size_t length, size_t& parsedLength)
+{
+    Vector<LChar> conversionBuffer(length);
+    for (size_t i = 0; i < length; ++i)
+        conversionBuffer[i] = isASCII(string[i]) ? string[i] : 0;
+    return parseDouble(conversionBuffer.data(), length, parsedLength);
+}
+
+} // namespace Internal
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/dtoa.h b/Source/WTF/wtf/dtoa.h
new file mode 100644
index 0000000..39b8f48
--- /dev/null
+++ b/Source/WTF/wtf/dtoa.h
@@ -0,0 +1,81 @@
+/*
+ *  Copyright (C) 2003, 2008, 2012 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_dtoa_h
+#define WTF_dtoa_h
+
+#include <wtf/ASCIICType.h>
+#include <wtf/dtoa/double-conversion.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WTF {
+
+class Mutex;
+
+extern Mutex* s_dtoaP5Mutex;
+
+typedef char DtoaBuffer[80];
+
+WTF_EXPORT_PRIVATE void dtoa(DtoaBuffer result, double dd, bool& sign, int& exponent, unsigned& precision);
+WTF_EXPORT_PRIVATE void dtoaRoundSF(DtoaBuffer result, double dd, int ndigits, bool& sign, int& exponent, unsigned& precision);
+WTF_EXPORT_PRIVATE void dtoaRoundDP(DtoaBuffer result, double dd, int ndigits, bool& sign, int& exponent, unsigned& precision);
+
+// Size = 80 for sizeof(DtoaBuffer) + some sign bits, decimal point, 'e', exponent digits.
+const unsigned NumberToStringBufferLength = 96;
+typedef char NumberToStringBuffer[NumberToStringBufferLength];
+typedef LChar NumberToLStringBuffer[NumberToStringBufferLength];
+
+WTF_EXPORT_PRIVATE const char* numberToString(double, NumberToStringBuffer);
+WTF_EXPORT_PRIVATE const char* numberToFixedPrecisionString(double, unsigned significantFigures, NumberToStringBuffer, bool truncateTrailingZeros = false);
+WTF_EXPORT_PRIVATE const char* numberToFixedWidthString(double, unsigned decimalPlaces, NumberToStringBuffer);
+
+double parseDouble(const LChar* string, size_t length, size_t& parsedLength);
+double parseDouble(const UChar* string, size_t length, size_t& parsedLength);
+
+namespace Internal {
+    WTF_EXPORT_PRIVATE double parseDoubleFromLongString(const UChar* string, size_t length, size_t& parsedLength);
+}
+
+inline double parseDouble(const LChar* string, size_t length, size_t& parsedLength)
+{
+    return double_conversion::StringToDoubleConverter::StringToDouble(reinterpret_cast<const char*>(string), length, &parsedLength);
+}
+
+inline double parseDouble(const UChar* string, size_t length, size_t& parsedLength)
+{
+    const size_t conversionBufferSize = 64;
+    if (length > conversionBufferSize)
+        return Internal::parseDoubleFromLongString(string, length, parsedLength);
+    LChar conversionBuffer[conversionBufferSize];
+    for (int i = 0; i < static_cast<int>(length); ++i)
+        conversionBuffer[i] = isASCII(string[i]) ? string[i] : 0;
+    return parseDouble(conversionBuffer, length, parsedLength);
+}
+    
+} // namespace WTF
+
+using WTF::NumberToStringBuffer;
+using WTF::NumberToLStringBuffer;
+using WTF::numberToString;
+using WTF::numberToFixedPrecisionString;
+using WTF::numberToFixedWidthString;
+using WTF::parseDouble;
+
+#endif // WTF_dtoa_h
diff --git a/Source/WTF/wtf/dtoa/COPYING b/Source/WTF/wtf/dtoa/COPYING
new file mode 100644
index 0000000..933718a
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/COPYING
@@ -0,0 +1,26 @@
+Copyright 2006-2011, the V8 project authors. 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.
+    * 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.
+    * 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.
diff --git a/Source/WTF/wtf/dtoa/LICENSE b/Source/WTF/wtf/dtoa/LICENSE
new file mode 100644
index 0000000..933718a
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/LICENSE
@@ -0,0 +1,26 @@
+Copyright 2006-2011, the V8 project authors. 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.
+    * 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.
+    * 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.
diff --git a/Source/WTF/wtf/dtoa/README b/Source/WTF/wtf/dtoa/README
new file mode 100644
index 0000000..f186b42
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/README
@@ -0,0 +1,11 @@
+http://code.google.com/p/double-conversion
+
+This project (double-conversion) provides binary-decimal and decimal-binary
+routines for IEEE doubles.
+
+The library consists of efficient conversion routines that have been extracted
+from the V8 JavaScript engine. The code has been refactored and improved so that
+it can be used more easily in other projects.
+
+There is extensive documentation in src/double-conversion.h. Other examples can
+be found in test/cctest/test-conversions.cc.
diff --git a/Source/WTF/wtf/dtoa/bignum-dtoa.cc b/Source/WTF/wtf/dtoa/bignum-dtoa.cc
new file mode 100644
index 0000000..38be56c
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/bignum-dtoa.cc
@@ -0,0 +1,659 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 <math.h>
+
+#include "bignum-dtoa.h"
+
+#include "bignum.h"
+#include "double.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    static int NormalizedExponent(uint64_t significand, int exponent) {
+        ASSERT(significand != 0);
+        while ((significand & Double::kHiddenBit) == 0) {
+            significand = significand << 1;
+            exponent = exponent - 1;
+        }
+        return exponent;
+    }
+    
+    
+    // Forward declarations:
+    // Returns an estimation of k such that 10^(k-1) <= v < 10^k.
+    static int EstimatePower(int exponent);
+    // Computes v / 10^estimated_power exactly, as a ratio of two bignums, numerator
+    // and denominator.
+    static void InitialScaledStartValues(double v,
+                                         int estimated_power,
+                                         bool need_boundary_deltas,
+                                         Bignum* numerator,
+                                         Bignum* denominator,
+                                         Bignum* delta_minus,
+                                         Bignum* delta_plus);
+    // Multiplies numerator/denominator so that its values lies in the range 1-10.
+    // Returns decimal_point s.t.
+    //  v = numerator'/denominator' * 10^(decimal_point-1)
+    //     where numerator' and denominator' are the values of numerator and
+    //     denominator after the call to this function.
+    static void FixupMultiply10(int estimated_power, bool is_even,
+                                int* decimal_point,
+                                Bignum* numerator, Bignum* denominator,
+                                Bignum* delta_minus, Bignum* delta_plus);
+    // Generates digits from the left to the right and stops when the generated
+    // digits yield the shortest decimal representation of v.
+    static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
+                                       Bignum* delta_minus, Bignum* delta_plus,
+                                       bool is_even,
+                                       Vector<char> buffer, int* length);
+    // Generates 'requested_digits' after the decimal point.
+    static void BignumToFixed(int requested_digits, int* decimal_point,
+                              Bignum* numerator, Bignum* denominator,
+                              Vector<char>(buffer), int* length);
+    // Generates 'count' digits of numerator/denominator.
+    // Once 'count' digits have been produced rounds the result depending on the
+    // remainder (remainders of exactly .5 round upwards). Might update the
+    // decimal_point when rounding up (for example for 0.9999).
+    static void GenerateCountedDigits(int count, int* decimal_point,
+                                      Bignum* numerator, Bignum* denominator,
+                                      Vector<char>(buffer), int* length);
+    
+    
+    void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits,
+                    Vector<char> buffer, int* length, int* decimal_point) {
+        ASSERT(v > 0);
+        ASSERT(!Double(v).IsSpecial());
+        uint64_t significand = Double(v).Significand();
+        bool is_even = (significand & 1) == 0;
+        int exponent = Double(v).Exponent();
+        int normalized_exponent = NormalizedExponent(significand, exponent);
+        // estimated_power might be too low by 1.
+        int estimated_power = EstimatePower(normalized_exponent);
+        
+        // Shortcut for Fixed.
+        // The requested digits correspond to the digits after the point. If the
+        // number is much too small, then there is no need in trying to get any
+        // digits.
+        if (mode == BIGNUM_DTOA_FIXED && -estimated_power - 1 > requested_digits) {
+            buffer[0] = '\0';
+            *length = 0;
+            // Set decimal-point to -requested_digits. This is what Gay does.
+            // Note that it should not have any effect anyways since the string is
+            // empty.
+            *decimal_point = -requested_digits;
+            return;
+        }
+        
+        Bignum numerator;
+        Bignum denominator;
+        Bignum delta_minus;
+        Bignum delta_plus;
+        // Make sure the bignum can grow large enough. The smallest double equals
+        // 4e-324. In this case the denominator needs fewer than 324*4 binary digits.
+        // The maximum double is 1.7976931348623157e308 which needs fewer than
+        // 308*4 binary digits.
+        ASSERT(Bignum::kMaxSignificantBits >= 324*4);
+        bool need_boundary_deltas = (mode == BIGNUM_DTOA_SHORTEST);
+        InitialScaledStartValues(v, estimated_power, need_boundary_deltas,
+                                 &numerator, &denominator,
+                                 &delta_minus, &delta_plus);
+        // We now have v = (numerator / denominator) * 10^estimated_power.
+        FixupMultiply10(estimated_power, is_even, decimal_point,
+                        &numerator, &denominator,
+                        &delta_minus, &delta_plus);
+        // We now have v = (numerator / denominator) * 10^(decimal_point-1), and
+        //  1 <= (numerator + delta_plus) / denominator < 10
+        switch (mode) {
+            case BIGNUM_DTOA_SHORTEST:
+                GenerateShortestDigits(&numerator, &denominator,
+                                       &delta_minus, &delta_plus,
+                                       is_even, buffer, length);
+                break;
+            case BIGNUM_DTOA_FIXED:
+                BignumToFixed(requested_digits, decimal_point,
+                              &numerator, &denominator,
+                              buffer, length);
+                break;
+            case BIGNUM_DTOA_PRECISION:
+                GenerateCountedDigits(requested_digits, decimal_point,
+                                      &numerator, &denominator,
+                                      buffer, length);
+                break;
+            default:
+                UNREACHABLE();
+        }
+        buffer[*length] = '\0';
+    }
+    
+    
+    // The procedure starts generating digits from the left to the right and stops
+    // when the generated digits yield the shortest decimal representation of v. A
+    // decimal representation of v is a number lying closer to v than to any other
+    // double, so it converts to v when read.
+    //
+    // This is true if d, the decimal representation, is between m- and m+, the
+    // upper and lower boundaries. d must be strictly between them if !is_even.
+    //           m- := (numerator - delta_minus) / denominator
+    //           m+ := (numerator + delta_plus) / denominator
+    //
+    // Precondition: 0 <= (numerator+delta_plus) / denominator < 10.
+    //   If 1 <= (numerator+delta_plus) / denominator < 10 then no leading 0 digit
+    //   will be produced. This should be the standard precondition.
+    static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
+                                       Bignum* delta_minus, Bignum* delta_plus,
+                                       bool is_even,
+                                       Vector<char> buffer, int* length) {
+        // Small optimization: if delta_minus and delta_plus are the same just reuse
+        // one of the two bignums.
+        if (Bignum::Equal(*delta_minus, *delta_plus)) {
+            delta_plus = delta_minus;
+        }
+        *length = 0;
+        while (true) {
+            uint16_t digit;
+            digit = numerator->DivideModuloIntBignum(*denominator);
+            ASSERT(digit <= 9);  // digit is a uint16_t and therefore always positive.
+            // digit = numerator / denominator (integer division).
+            // numerator = numerator % denominator.
+            buffer[(*length)++] = digit + '0';
+            
+            // Can we stop already?
+            // If the remainder of the division is less than the distance to the lower
+            // boundary we can stop. In this case we simply round down (discarding the
+            // remainder).
+            // Similarly we test if we can round up (using the upper boundary).
+            bool in_delta_room_minus;
+            bool in_delta_room_plus;
+            if (is_even) {
+                in_delta_room_minus = Bignum::LessEqual(*numerator, *delta_minus);
+            } else {
+                in_delta_room_minus = Bignum::Less(*numerator, *delta_minus);
+            }
+            if (is_even) {
+                in_delta_room_plus =
+                Bignum::PlusCompare(*numerator, *delta_plus, *denominator) >= 0;
+            } else {
+                in_delta_room_plus =
+                Bignum::PlusCompare(*numerator, *delta_plus, *denominator) > 0;
+            }
+            if (!in_delta_room_minus && !in_delta_room_plus) {
+                // Prepare for next iteration.
+                numerator->Times10();
+                delta_minus->Times10();
+                // We optimized delta_plus to be equal to delta_minus (if they share the
+                // same value). So don't multiply delta_plus if they point to the same
+                // object.
+                if (delta_minus != delta_plus) {
+                    delta_plus->Times10();
+                }
+            } else if (in_delta_room_minus && in_delta_room_plus) {
+                // Let's see if 2*numerator < denominator.
+                // If yes, then the next digit would be < 5 and we can round down.
+                int compare = Bignum::PlusCompare(*numerator, *numerator, *denominator);
+                if (compare < 0) {
+                    // Remaining digits are less than .5. -> Round down (== do nothing).
+                } else if (compare > 0) {
+                    // Remaining digits are more than .5 of denominator. -> Round up.
+                    // Note that the last digit could not be a '9' as otherwise the whole
+                    // loop would have stopped earlier.
+                    // We still have an assert here in case the preconditions were not
+                    // satisfied.
+                    ASSERT(buffer[(*length) - 1] != '9');
+                    buffer[(*length) - 1]++;
+                } else {
+                    // Halfway case.
+                    // TODO(floitsch): need a way to solve half-way cases.
+                    //   For now let's round towards even (since this is what Gay seems to
+                    //   do).
+                    
+                    if ((buffer[(*length) - 1] - '0') % 2 == 0) {
+                        // Round down => Do nothing.
+                    } else {
+                        ASSERT(buffer[(*length) - 1] != '9');
+                        buffer[(*length) - 1]++;
+                    }
+                }
+                return;
+            } else if (in_delta_room_minus) {
+                // Round down (== do nothing).
+                return;
+            } else {  // in_delta_room_plus
+                // Round up.
+                // Note again that the last digit could not be '9' since this would have
+                // stopped the loop earlier.
+                // We still have an ASSERT here, in case the preconditions were not
+                // satisfied.
+                ASSERT(buffer[(*length) -1] != '9');
+                buffer[(*length) - 1]++;
+                return;
+            }
+        }
+    }
+    
+    
+    // Let v = numerator / denominator < 10.
+    // Then we generate 'count' digits of d = x.xxxxx... (without the decimal point)
+    // from left to right. Once 'count' digits have been produced we decide wether
+    // to round up or down. Remainders of exactly .5 round upwards. Numbers such
+    // as 9.999999 propagate a carry all the way, and change the
+    // exponent (decimal_point), when rounding upwards.
+    static void GenerateCountedDigits(int count, int* decimal_point,
+                                      Bignum* numerator, Bignum* denominator,
+                                      Vector<char>(buffer), int* length) {
+        ASSERT(count >= 0);
+        for (int i = 0; i < count - 1; ++i) {
+            uint16_t digit;
+            digit = numerator->DivideModuloIntBignum(*denominator);
+            ASSERT(digit <= 9);  // digit is a uint16_t and therefore always positive.
+            // digit = numerator / denominator (integer division).
+            // numerator = numerator % denominator.
+            buffer[i] = digit + '0';
+            // Prepare for next iteration.
+            numerator->Times10();
+        }
+        // Generate the last digit.
+        uint16_t digit;
+        digit = numerator->DivideModuloIntBignum(*denominator);
+        if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) {
+            digit++;
+        }
+        buffer[count - 1] = digit + '0';
+        // Correct bad digits (in case we had a sequence of '9's). Propagate the
+        // carry until we hat a non-'9' or til we reach the first digit.
+        for (int i = count - 1; i > 0; --i) {
+            if (buffer[i] != '0' + 10) break;
+            buffer[i] = '0';
+            buffer[i - 1]++;
+        }
+        if (buffer[0] == '0' + 10) {
+            // Propagate a carry past the top place.
+            buffer[0] = '1';
+            (*decimal_point)++;
+        }
+        *length = count;
+    }
+    
+    
+    // Generates 'requested_digits' after the decimal point. It might omit
+    // trailing '0's. If the input number is too small then no digits at all are
+    // generated (ex.: 2 fixed digits for 0.00001).
+    //
+    // Input verifies:  1 <= (numerator + delta) / denominator < 10.
+    static void BignumToFixed(int requested_digits, int* decimal_point,
+                              Bignum* numerator, Bignum* denominator,
+                              Vector<char>(buffer), int* length) {
+        // Note that we have to look at more than just the requested_digits, since
+        // a number could be rounded up. Example: v=0.5 with requested_digits=0.
+        // Even though the power of v equals 0 we can't just stop here.
+        if (-(*decimal_point) > requested_digits) {
+            // The number is definitively too small.
+            // Ex: 0.001 with requested_digits == 1.
+            // Set decimal-point to -requested_digits. This is what Gay does.
+            // Note that it should not have any effect anyways since the string is
+            // empty.
+            *decimal_point = -requested_digits;
+            *length = 0;
+            return;
+        } else if (-(*decimal_point) == requested_digits) {
+            // We only need to verify if the number rounds down or up.
+            // Ex: 0.04 and 0.06 with requested_digits == 1.
+            ASSERT(*decimal_point == -requested_digits);
+            // Initially the fraction lies in range (1, 10]. Multiply the denominator
+            // by 10 so that we can compare more easily.
+            denominator->Times10();
+            if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) {
+                // If the fraction is >= 0.5 then we have to include the rounded
+                // digit.
+                buffer[0] = '1';
+                *length = 1;
+                (*decimal_point)++;
+            } else {
+                // Note that we caught most of similar cases earlier.
+                *length = 0;
+            }
+            return;
+        } else {
+            // The requested digits correspond to the digits after the point.
+            // The variable 'needed_digits' includes the digits before the point.
+            int needed_digits = (*decimal_point) + requested_digits;
+            GenerateCountedDigits(needed_digits, decimal_point,
+                                  numerator, denominator,
+                                  buffer, length);
+        }
+    }
+    
+    
+    // Returns an estimation of k such that 10^(k-1) <= v < 10^k where
+    // v = f * 2^exponent and 2^52 <= f < 2^53.
+    // v is hence a normalized double with the given exponent. The output is an
+    // approximation for the exponent of the decimal approimation .digits * 10^k.
+    //
+    // The result might undershoot by 1 in which case 10^k <= v < 10^k+1.
+    // Note: this property holds for v's upper boundary m+ too.
+    //    10^k <= m+ < 10^k+1.
+    //   (see explanation below).
+    //
+    // Examples:
+    //  EstimatePower(0)   => 16
+    //  EstimatePower(-52) => 0
+    //
+    // Note: e >= 0 => EstimatedPower(e) > 0. No similar claim can be made for e<0.
+    static int EstimatePower(int exponent) {
+        // This function estimates log10 of v where v = f*2^e (with e == exponent).
+        // Note that 10^floor(log10(v)) <= v, but v <= 10^ceil(log10(v)).
+        // Note that f is bounded by its container size. Let p = 53 (the double's
+        // significand size). Then 2^(p-1) <= f < 2^p.
+        //
+        // Given that log10(v) == log2(v)/log2(10) and e+(len(f)-1) is quite close
+        // to log2(v) the function is simplified to (e+(len(f)-1)/log2(10)).
+        // The computed number undershoots by less than 0.631 (when we compute log3
+        // and not log10).
+        //
+        // Optimization: since we only need an approximated result this computation
+        // can be performed on 64 bit integers. On x86/x64 architecture the speedup is
+        // not really measurable, though.
+        //
+        // Since we want to avoid overshooting we decrement by 1e10 so that
+        // floating-point imprecisions don't affect us.
+        //
+        // Explanation for v's boundary m+: the computation takes advantage of
+        // the fact that 2^(p-1) <= f < 2^p. Boundaries still satisfy this requirement
+        // (even for denormals where the delta can be much more important).
+        
+        const double k1Log10 = 0.30102999566398114;  // 1/lg(10)
+        
+        // For doubles len(f) == 53 (don't forget the hidden bit).
+        const int kSignificandSize = 53;
+        double estimate = ceil((exponent + kSignificandSize - 1) * k1Log10 - 1e-10);
+        return static_cast<int>(estimate);
+    }
+    
+    
+    // See comments for InitialScaledStartValues.
+    static void InitialScaledStartValuesPositiveExponent(
+                                                         double v, int estimated_power, bool need_boundary_deltas,
+                                                         Bignum* numerator, Bignum* denominator,
+                                                         Bignum* delta_minus, Bignum* delta_plus) {
+        // A positive exponent implies a positive power.
+        ASSERT(estimated_power >= 0);
+        // Since the estimated_power is positive we simply multiply the denominator
+        // by 10^estimated_power.
+        
+        // numerator = v.
+        numerator->AssignUInt64(Double(v).Significand());
+        numerator->ShiftLeft(Double(v).Exponent());
+        // denominator = 10^estimated_power.
+        denominator->AssignPowerUInt16(10, estimated_power);
+        
+        if (need_boundary_deltas) {
+            // Introduce a common denominator so that the deltas to the boundaries are
+            // integers.
+            denominator->ShiftLeft(1);
+            numerator->ShiftLeft(1);
+            // Let v = f * 2^e, then m+ - v = 1/2 * 2^e; With the common
+            // denominator (of 2) delta_plus equals 2^e.
+            delta_plus->AssignUInt16(1);
+            delta_plus->ShiftLeft(Double(v).Exponent());
+            // Same for delta_minus (with adjustments below if f == 2^p-1).
+            delta_minus->AssignUInt16(1);
+            delta_minus->ShiftLeft(Double(v).Exponent());
+            
+            // If the significand (without the hidden bit) is 0, then the lower
+            // boundary is closer than just half a ulp (unit in the last place).
+            // There is only one exception: if the next lower number is a denormal then
+            // the distance is 1 ulp. This cannot be the case for exponent >= 0 (but we
+            // have to test it in the other function where exponent < 0).
+            uint64_t v_bits = Double(v).AsUint64();
+            if ((v_bits & Double::kSignificandMask) == 0) {
+                // The lower boundary is closer at half the distance of "normal" numbers.
+                // Increase the common denominator and adapt all but the delta_minus.
+                denominator->ShiftLeft(1);  // *2
+                numerator->ShiftLeft(1);    // *2
+                delta_plus->ShiftLeft(1);   // *2
+            }
+        }
+    }
+    
+    
+    // See comments for InitialScaledStartValues
+    static void InitialScaledStartValuesNegativeExponentPositivePower(
+                                                                      double v, int estimated_power, bool need_boundary_deltas,
+                                                                      Bignum* numerator, Bignum* denominator,
+                                                                      Bignum* delta_minus, Bignum* delta_plus) {
+        uint64_t significand = Double(v).Significand();
+        int exponent = Double(v).Exponent();
+        // v = f * 2^e with e < 0, and with estimated_power >= 0.
+        // This means that e is close to 0 (have a look at how estimated_power is
+        // computed).
+        
+        // numerator = significand
+        //  since v = significand * 2^exponent this is equivalent to
+        //  numerator = v * / 2^-exponent
+        numerator->AssignUInt64(significand);
+        // denominator = 10^estimated_power * 2^-exponent (with exponent < 0)
+        denominator->AssignPowerUInt16(10, estimated_power);
+        denominator->ShiftLeft(-exponent);
+        
+        if (need_boundary_deltas) {
+            // Introduce a common denominator so that the deltas to the boundaries are
+            // integers.
+            denominator->ShiftLeft(1);
+            numerator->ShiftLeft(1);
+            // Let v = f * 2^e, then m+ - v = 1/2 * 2^e; With the common
+            // denominator (of 2) delta_plus equals 2^e.
+            // Given that the denominator already includes v's exponent the distance
+            // to the boundaries is simply 1.
+            delta_plus->AssignUInt16(1);
+            // Same for delta_minus (with adjustments below if f == 2^p-1).
+            delta_minus->AssignUInt16(1);
+            
+            // If the significand (without the hidden bit) is 0, then the lower
+            // boundary is closer than just one ulp (unit in the last place).
+            // There is only one exception: if the next lower number is a denormal
+            // then the distance is 1 ulp. Since the exponent is close to zero
+            // (otherwise estimated_power would have been negative) this cannot happen
+            // here either.
+            uint64_t v_bits = Double(v).AsUint64();
+            if ((v_bits & Double::kSignificandMask) == 0) {
+                // The lower boundary is closer at half the distance of "normal" numbers.
+                // Increase the denominator and adapt all but the delta_minus.
+                denominator->ShiftLeft(1);  // *2
+                numerator->ShiftLeft(1);    // *2
+                delta_plus->ShiftLeft(1);   // *2
+            }
+        }
+    }
+    
+    
+    // See comments for InitialScaledStartValues
+    static void InitialScaledStartValuesNegativeExponentNegativePower(
+                                                                      double v, int estimated_power, bool need_boundary_deltas,
+                                                                      Bignum* numerator, Bignum* denominator,
+                                                                      Bignum* delta_minus, Bignum* delta_plus) {
+        const uint64_t kMinimalNormalizedExponent =
+        UINT64_2PART_C(0x00100000, 00000000);
+        uint64_t significand = Double(v).Significand();
+        int exponent = Double(v).Exponent();
+        // Instead of multiplying the denominator with 10^estimated_power we
+        // multiply all values (numerator and deltas) by 10^-estimated_power.
+        
+        // Use numerator as temporary container for power_ten.
+        Bignum* power_ten = numerator;
+        power_ten->AssignPowerUInt16(10, -estimated_power);
+        
+        if (need_boundary_deltas) {
+            // Since power_ten == numerator we must make a copy of 10^estimated_power
+            // before we complete the computation of the numerator.
+            // delta_plus = delta_minus = 10^estimated_power
+            delta_plus->AssignBignum(*power_ten);
+            delta_minus->AssignBignum(*power_ten);
+        }
+        
+        // numerator = significand * 2 * 10^-estimated_power
+        //  since v = significand * 2^exponent this is equivalent to
+        // numerator = v * 10^-estimated_power * 2 * 2^-exponent.
+        // Remember: numerator has been abused as power_ten. So no need to assign it
+        //  to itself.
+        ASSERT(numerator == power_ten);
+        numerator->MultiplyByUInt64(significand);
+        
+        // denominator = 2 * 2^-exponent with exponent < 0.
+        denominator->AssignUInt16(1);
+        denominator->ShiftLeft(-exponent);
+        
+        if (need_boundary_deltas) {
+            // Introduce a common denominator so that the deltas to the boundaries are
+            // integers.
+            numerator->ShiftLeft(1);
+            denominator->ShiftLeft(1);
+            // With this shift the boundaries have their correct value, since
+            // delta_plus = 10^-estimated_power, and
+            // delta_minus = 10^-estimated_power.
+            // These assignments have been done earlier.
+            
+            // The special case where the lower boundary is twice as close.
+            // This time we have to look out for the exception too.
+            uint64_t v_bits = Double(v).AsUint64();
+            if ((v_bits & Double::kSignificandMask) == 0 &&
+                // The only exception where a significand == 0 has its boundaries at
+                // "normal" distances:
+                (v_bits & Double::kExponentMask) != kMinimalNormalizedExponent) {
+                numerator->ShiftLeft(1);    // *2
+                denominator->ShiftLeft(1);  // *2
+                delta_plus->ShiftLeft(1);   // *2
+            }
+        }
+    }
+    
+    
+    // Let v = significand * 2^exponent.
+    // Computes v / 10^estimated_power exactly, as a ratio of two bignums, numerator
+    // and denominator. The functions GenerateShortestDigits and
+    // GenerateCountedDigits will then convert this ratio to its decimal
+    // representation d, with the required accuracy.
+    // Then d * 10^estimated_power is the representation of v.
+    // (Note: the fraction and the estimated_power might get adjusted before
+    // generating the decimal representation.)
+    //
+    // The initial start values consist of:
+    //  - a scaled numerator: s.t. numerator/denominator == v / 10^estimated_power.
+    //  - a scaled (common) denominator.
+    //  optionally (used by GenerateShortestDigits to decide if it has the shortest
+    //  decimal converting back to v):
+    //  - v - m-: the distance to the lower boundary.
+    //  - m+ - v: the distance to the upper boundary.
+    //
+    // v, m+, m-, and therefore v - m- and m+ - v all share the same denominator.
+    //
+    // Let ep == estimated_power, then the returned values will satisfy:
+    //  v / 10^ep = numerator / denominator.
+    //  v's boundarys m- and m+:
+    //    m- / 10^ep == v / 10^ep - delta_minus / denominator
+    //    m+ / 10^ep == v / 10^ep + delta_plus / denominator
+    //  Or in other words:
+    //    m- == v - delta_minus * 10^ep / denominator;
+    //    m+ == v + delta_plus * 10^ep / denominator;
+    //
+    // Since 10^(k-1) <= v < 10^k    (with k == estimated_power)
+    //  or       10^k <= v < 10^(k+1)
+    //  we then have 0.1 <= numerator/denominator < 1
+    //           or    1 <= numerator/denominator < 10
+    //
+    // It is then easy to kickstart the digit-generation routine.
+    //
+    // The boundary-deltas are only filled if need_boundary_deltas is set.
+    static void InitialScaledStartValues(double v,
+                                         int estimated_power,
+                                         bool need_boundary_deltas,
+                                         Bignum* numerator,
+                                         Bignum* denominator,
+                                         Bignum* delta_minus,
+                                         Bignum* delta_plus) {
+        if (Double(v).Exponent() >= 0) {
+            InitialScaledStartValuesPositiveExponent(
+                                                     v, estimated_power, need_boundary_deltas,
+                                                     numerator, denominator, delta_minus, delta_plus);
+        } else if (estimated_power >= 0) {
+            InitialScaledStartValuesNegativeExponentPositivePower(
+                                                                  v, estimated_power, need_boundary_deltas,
+                                                                  numerator, denominator, delta_minus, delta_plus);
+        } else {
+            InitialScaledStartValuesNegativeExponentNegativePower(
+                                                                  v, estimated_power, need_boundary_deltas,
+                                                                  numerator, denominator, delta_minus, delta_plus);
+        }
+    }
+    
+    
+    // This routine multiplies numerator/denominator so that its values lies in the
+    // range 1-10. That is after a call to this function we have:
+    //    1 <= (numerator + delta_plus) /denominator < 10.
+    // Let numerator the input before modification and numerator' the argument
+    // after modification, then the output-parameter decimal_point is such that
+    //  numerator / denominator * 10^estimated_power ==
+    //    numerator' / denominator' * 10^(decimal_point - 1)
+    // In some cases estimated_power was too low, and this is already the case. We
+    // then simply adjust the power so that 10^(k-1) <= v < 10^k (with k ==
+    // estimated_power) but do not touch the numerator or denominator.
+    // Otherwise the routine multiplies the numerator and the deltas by 10.
+    static void FixupMultiply10(int estimated_power, bool is_even,
+                                int* decimal_point,
+                                Bignum* numerator, Bignum* denominator,
+                                Bignum* delta_minus, Bignum* delta_plus) {
+        bool in_range;
+        if (is_even) {
+            // For IEEE doubles half-way cases (in decimal system numbers ending with 5)
+            // are rounded to the closest floating-point number with even significand.
+            in_range = Bignum::PlusCompare(*numerator, *delta_plus, *denominator) >= 0;
+        } else {
+            in_range = Bignum::PlusCompare(*numerator, *delta_plus, *denominator) > 0;
+        }
+        if (in_range) {
+            // Since numerator + delta_plus >= denominator we already have
+            // 1 <= numerator/denominator < 10. Simply update the estimated_power.
+            *decimal_point = estimated_power + 1;
+        } else {
+            *decimal_point = estimated_power;
+            numerator->Times10();
+            if (Bignum::Equal(*delta_minus, *delta_plus)) {
+                delta_minus->Times10();
+                delta_plus->AssignBignum(*delta_minus);
+            } else {
+                delta_minus->Times10();
+                delta_plus->Times10();
+            }
+        }
+    }
+    
+}  // namespace double_conversion
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/dtoa/bignum-dtoa.h b/Source/WTF/wtf/dtoa/bignum-dtoa.h
new file mode 100644
index 0000000..0761687
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/bignum-dtoa.h
@@ -0,0 +1,86 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 DOUBLE_CONVERSION_BIGNUM_DTOA_H_
+#define DOUBLE_CONVERSION_BIGNUM_DTOA_H_
+
+#include "utils.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    enum BignumDtoaMode {
+        // Return the shortest correct representation.
+        // For example the output of 0.299999999999999988897 is (the less accurate but
+        // correct) 0.3.
+        BIGNUM_DTOA_SHORTEST,
+        // Return a fixed number of digits after the decimal point.
+        // For instance fixed(0.1, 4) becomes 0.1000
+        // If the input number is big, the output will be big.
+        BIGNUM_DTOA_FIXED,
+        // Return a fixed number of digits, no matter what the exponent is.
+        BIGNUM_DTOA_PRECISION
+    };
+    
+    // Converts the given double 'v' to ascii.
+    // The result should be interpreted as buffer * 10^(point-length).
+    // The buffer will be null-terminated.
+    //
+    // The input v must be > 0 and different from NaN, and Infinity.
+    //
+    // The output depends on the given mode:
+    //  - SHORTEST: produce the least amount of digits for which the internal
+    //   identity requirement is still satisfied. If the digits are printed
+    //   (together with the correct exponent) then reading this number will give
+    //   'v' again. The buffer will choose the representation that is closest to
+    //   'v'. If there are two at the same distance, than the number is round up.
+    //   In this mode the 'requested_digits' parameter is ignored.
+    //  - FIXED: produces digits necessary to print a given number with
+    //   'requested_digits' digits after the decimal point. The produced digits
+    //   might be too short in which case the caller has to fill the gaps with '0's.
+    //   Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2.
+    //   Halfway cases are rounded up. The call toFixed(0.15, 2) thus returns
+    //     buffer="2", point=0.
+    //   Note: the length of the returned buffer has no meaning wrt the significance
+    //   of its digits. That is, just because it contains '0's does not mean that
+    //   any other digit would not satisfy the internal identity requirement.
+    //  - PRECISION: produces 'requested_digits' where the first digit is not '0'.
+    //   Even though the length of produced digits usually equals
+    //   'requested_digits', the function is allowed to return fewer digits, in
+    //   which case the caller has to fill the missing digits with '0's.
+    //   Halfway cases are again rounded up.
+    // 'BignumDtoa' expects the given buffer to be big enough to hold all digits
+    // and a terminating null-character.
+    void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits,
+                    Vector<char> buffer, int* length, int* point);
+    
+}  // namespace double_conversion
+
+} // namespace WTF
+
+#endif  // DOUBLE_CONVERSION_BIGNUM_DTOA_H_
diff --git a/Source/WTF/wtf/dtoa/bignum.cc b/Source/WTF/wtf/dtoa/bignum.cc
new file mode 100644
index 0000000..46a900a
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/bignum.cc
@@ -0,0 +1,770 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 "bignum.h"
+#include "utils.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    Bignum::Bignum()
+    : bigits_(bigits_buffer_, kBigitCapacity), used_digits_(0), exponent_(0) {
+        for (int i = 0; i < kBigitCapacity; ++i) {
+            bigits_[i] = 0;
+        }
+    }
+    
+    
+    template<typename S>
+    static int BitSize(S value) {
+        return 8 * sizeof(value);
+    }
+    
+    // Guaranteed to lie in one Bigit.
+    void Bignum::AssignUInt16(uint16_t value) {
+        ASSERT(kBigitSize >= BitSize(value));
+        Zero();
+        if (value == 0) return;
+        
+        EnsureCapacity(1);
+        bigits_[0] = value;
+        used_digits_ = 1;
+    }
+    
+    
+    void Bignum::AssignUInt64(uint64_t value) {
+        const int kUInt64Size = 64;
+        
+        Zero();
+        if (value == 0) return;
+        
+        int needed_bigits = kUInt64Size / kBigitSize + 1;
+        EnsureCapacity(needed_bigits);
+        for (int i = 0; i < needed_bigits; ++i) {
+            bigits_[i] = (uint32_t)value & kBigitMask;
+            value = value >> kBigitSize;
+        }
+        used_digits_ = needed_bigits;
+        Clamp();
+    }
+    
+    
+    void Bignum::AssignBignum(const Bignum& other) {
+        exponent_ = other.exponent_;
+        for (int i = 0; i < other.used_digits_; ++i) {
+            bigits_[i] = other.bigits_[i];
+        }
+        // Clear the excess digits (if there were any).
+        for (int i = other.used_digits_; i < used_digits_; ++i) {
+            bigits_[i] = 0;
+        }
+        used_digits_ = other.used_digits_;
+    }
+    
+    
+    static uint64_t ReadUInt64(Vector<const char> buffer,
+                               int from,
+                               int digits_to_read) {
+        uint64_t result = 0;
+        for (int i = from; i < from + digits_to_read; ++i) {
+            int digit = buffer[i] - '0';
+            ASSERT(0 <= digit && digit <= 9);
+            result = result * 10 + digit;
+        }
+        return result;
+    }
+    
+    
+    void Bignum::AssignDecimalString(Vector<const char> value) {
+        // 2^64 = 18446744073709551616 > 10^19
+        const int kMaxUint64DecimalDigits = 19;
+        Zero();
+        int length = value.length();
+        int pos = 0;
+        // Let's just say that each digit needs 4 bits.
+        while (length >= kMaxUint64DecimalDigits) {
+            uint64_t digits = ReadUInt64(value, pos, kMaxUint64DecimalDigits);
+            pos += kMaxUint64DecimalDigits;
+            length -= kMaxUint64DecimalDigits;
+            MultiplyByPowerOfTen(kMaxUint64DecimalDigits);
+            AddUInt64(digits);
+        }
+        uint64_t digits = ReadUInt64(value, pos, length);
+        MultiplyByPowerOfTen(length);
+        AddUInt64(digits);
+        Clamp();
+    }
+    
+    
+    static int HexCharValue(char c) {
+        if ('0' <= c && c <= '9') return c - '0';
+        if ('a' <= c && c <= 'f') return 10 + c - 'a';
+        if ('A' <= c && c <= 'F') return 10 + c - 'A';
+        UNREACHABLE();
+        return 0;  // To make compiler happy.
+    }
+    
+    
+    void Bignum::AssignHexString(Vector<const char> value) {
+        Zero();
+        int length = value.length();
+        
+        int needed_bigits = length * 4 / kBigitSize + 1;
+        EnsureCapacity(needed_bigits);
+        int string_index = length - 1;
+        for (int i = 0; i < needed_bigits - 1; ++i) {
+            // These bigits are guaranteed to be "full".
+            Chunk current_bigit = 0;
+            for (int j = 0; j < kBigitSize / 4; j++) {
+                current_bigit += HexCharValue(value[string_index--]) << (j * 4);
+            }
+            bigits_[i] = current_bigit;
+        }
+        used_digits_ = needed_bigits - 1;
+        
+        Chunk most_significant_bigit = 0;  // Could be = 0;
+        for (int j = 0; j <= string_index; ++j) {
+            most_significant_bigit <<= 4;
+            most_significant_bigit += HexCharValue(value[j]);
+        }
+        if (most_significant_bigit != 0) {
+            bigits_[used_digits_] = most_significant_bigit;
+            used_digits_++;
+        }
+        Clamp();
+    }
+    
+    
+    void Bignum::AddUInt64(uint64_t operand) {
+        if (operand == 0) return;
+        Bignum other;
+        other.AssignUInt64(operand);
+        AddBignum(other);
+    }
+    
+    
+    void Bignum::AddBignum(const Bignum& other) {
+        ASSERT(IsClamped());
+        ASSERT(other.IsClamped());
+        
+        // If this has a greater exponent than other append zero-bigits to this.
+        // After this call exponent_ <= other.exponent_.
+        Align(other);
+        
+        // There are two possibilities:
+        //   aaaaaaaaaaa 0000  (where the 0s represent a's exponent)
+        //     bbbbb 00000000
+        //   ----------------
+        //   ccccccccccc 0000
+        // or
+        //    aaaaaaaaaa 0000
+        //  bbbbbbbbb 0000000
+        //  -----------------
+        //  cccccccccccc 0000
+        // In both cases we might need a carry bigit.
+        
+        EnsureCapacity(1 + Max(BigitLength(), other.BigitLength()) - exponent_);
+        Chunk carry = 0;
+        int bigit_pos = other.exponent_ - exponent_;
+        ASSERT(bigit_pos >= 0);
+        for (int i = 0; i < other.used_digits_; ++i) {
+            Chunk sum = bigits_[bigit_pos] + other.bigits_[i] + carry;
+            bigits_[bigit_pos] = sum & kBigitMask;
+            carry = sum >> kBigitSize;
+            bigit_pos++;
+        }
+        
+        while (carry != 0) {
+            Chunk sum = bigits_[bigit_pos] + carry;
+            bigits_[bigit_pos] = sum & kBigitMask;
+            carry = sum >> kBigitSize;
+            bigit_pos++;
+        }
+        used_digits_ = Max(bigit_pos, used_digits_);
+        ASSERT(IsClamped());
+    }
+    
+    
+    void Bignum::SubtractBignum(const Bignum& other) {
+        ASSERT(IsClamped());
+        ASSERT(other.IsClamped());
+        // We require this to be bigger than other.
+        ASSERT(LessEqual(other, *this));
+        
+        Align(other);
+        
+        int offset = other.exponent_ - exponent_;
+        Chunk borrow = 0;
+        int i;
+        for (i = 0; i < other.used_digits_; ++i) {
+            ASSERT((borrow == 0) || (borrow == 1));
+            Chunk difference = bigits_[i + offset] - other.bigits_[i] - borrow;
+            bigits_[i + offset] = difference & kBigitMask;
+            borrow = difference >> (kChunkSize - 1);
+        }
+        while (borrow != 0) {
+            Chunk difference = bigits_[i + offset] - borrow;
+            bigits_[i + offset] = difference & kBigitMask;
+            borrow = difference >> (kChunkSize - 1);
+            ++i;
+        }
+        Clamp();
+    }
+    
+    
+    void Bignum::ShiftLeft(int shift_amount) {
+        if (used_digits_ == 0) return;
+        exponent_ += shift_amount / kBigitSize;
+        int local_shift = shift_amount % kBigitSize;
+        EnsureCapacity(used_digits_ + 1);
+        BigitsShiftLeft(local_shift);
+    }
+    
+    
+    void Bignum::MultiplyByUInt32(uint32_t factor) {
+        if (factor == 1) return;
+        if (factor == 0) {
+            Zero();
+            return;
+        }
+        if (used_digits_ == 0) return;
+        
+        // The product of a bigit with the factor is of size kBigitSize + 32.
+        // Assert that this number + 1 (for the carry) fits into double chunk.
+        ASSERT(kDoubleChunkSize >= kBigitSize + 32 + 1);
+        DoubleChunk carry = 0;
+        for (int i = 0; i < used_digits_; ++i) {
+            DoubleChunk product = static_cast<DoubleChunk>(factor) * bigits_[i] + carry;
+            bigits_[i] = static_cast<Chunk>(product & kBigitMask);
+            carry = (product >> kBigitSize);
+        }
+        while (carry != 0) {
+            EnsureCapacity(used_digits_ + 1);
+            bigits_[used_digits_] = (uint32_t)carry & kBigitMask;
+            used_digits_++;
+            carry >>= kBigitSize;
+        }
+    }
+    
+    
+    void Bignum::MultiplyByUInt64(uint64_t factor) {
+        if (factor == 1) return;
+        if (factor == 0) {
+            Zero();
+            return;
+        }
+        ASSERT(kBigitSize < 32);
+        uint64_t carry = 0;
+        uint64_t low = factor & 0xFFFFFFFF;
+        uint64_t high = factor >> 32;
+        for (int i = 0; i < used_digits_; ++i) {
+            uint64_t product_low = low * bigits_[i];
+            uint64_t product_high = high * bigits_[i];
+            uint64_t tmp = (carry & kBigitMask) + product_low;
+            bigits_[i] = (uint32_t)tmp & kBigitMask;
+            carry = (carry >> kBigitSize) + (tmp >> kBigitSize) +
+            (product_high << (32 - kBigitSize));
+        }
+        while (carry != 0) {
+            EnsureCapacity(used_digits_ + 1);
+            bigits_[used_digits_] = (uint32_t)carry & kBigitMask;
+            used_digits_++;
+            carry >>= kBigitSize;
+        }
+    }
+    
+    
+    void Bignum::MultiplyByPowerOfTen(int exponent) {
+        const uint64_t kFive27 = UINT64_2PART_C(0x6765c793, fa10079d);
+        const uint16_t kFive1 = 5;
+        const uint16_t kFive2 = kFive1 * 5;
+        const uint16_t kFive3 = kFive2 * 5;
+        const uint16_t kFive4 = kFive3 * 5;
+        const uint16_t kFive5 = kFive4 * 5;
+        const uint16_t kFive6 = kFive5 * 5;
+        const uint32_t kFive7 = kFive6 * 5;
+        const uint32_t kFive8 = kFive7 * 5;
+        const uint32_t kFive9 = kFive8 * 5;
+        const uint32_t kFive10 = kFive9 * 5;
+        const uint32_t kFive11 = kFive10 * 5;
+        const uint32_t kFive12 = kFive11 * 5;
+        const uint32_t kFive13 = kFive12 * 5;
+        const uint32_t kFive1_to_12[] =
+        { kFive1, kFive2, kFive3, kFive4, kFive5, kFive6,
+            kFive7, kFive8, kFive9, kFive10, kFive11, kFive12 };
+        
+        ASSERT(exponent >= 0);
+        if (exponent == 0) return;
+        if (used_digits_ == 0) return;
+        
+        // We shift by exponent at the end just before returning.
+        int remaining_exponent = exponent;
+        while (remaining_exponent >= 27) {
+            MultiplyByUInt64(kFive27);
+            remaining_exponent -= 27;
+        }
+        while (remaining_exponent >= 13) {
+            MultiplyByUInt32(kFive13);
+            remaining_exponent -= 13;
+        }
+        if (remaining_exponent > 0) {
+            MultiplyByUInt32(kFive1_to_12[remaining_exponent - 1]);
+        }
+        ShiftLeft(exponent);
+    }
+    
+    
+    void Bignum::Square() {
+        ASSERT(IsClamped());
+        int product_length = 2 * used_digits_;
+        EnsureCapacity(product_length);
+        
+        // Comba multiplication: compute each column separately.
+        // Example: r = a2a1a0 * b2b1b0.
+        //    r =  1    * a0b0 +
+        //        10    * (a1b0 + a0b1) +
+        //        100   * (a2b0 + a1b1 + a0b2) +
+        //        1000  * (a2b1 + a1b2) +
+        //        10000 * a2b2
+        //
+        // In the worst case we have to accumulate nb-digits products of digit*digit.
+        //
+        // Assert that the additional number of bits in a DoubleChunk are enough to
+        // sum up used_digits of Bigit*Bigit.
+        if ((1 << (2 * (kChunkSize - kBigitSize))) <= used_digits_) {
+            UNIMPLEMENTED();
+        }
+        DoubleChunk accumulator = 0;
+        // First shift the digits so we don't overwrite them.
+        int copy_offset = used_digits_;
+        for (int i = 0; i < used_digits_; ++i) {
+            bigits_[copy_offset + i] = bigits_[i];
+        }
+        // We have two loops to avoid some 'if's in the loop.
+        for (int i = 0; i < used_digits_; ++i) {
+            // Process temporary digit i with power i.
+            // The sum of the two indices must be equal to i.
+            int bigit_index1 = i;
+            int bigit_index2 = 0;
+            // Sum all of the sub-products.
+            while (bigit_index1 >= 0) {
+                Chunk chunk1 = bigits_[copy_offset + bigit_index1];
+                Chunk chunk2 = bigits_[copy_offset + bigit_index2];
+                accumulator += static_cast<DoubleChunk>(chunk1) * chunk2;
+                bigit_index1--;
+                bigit_index2++;
+            }
+            bigits_[i] = static_cast<Chunk>(accumulator) & kBigitMask;
+            accumulator >>= kBigitSize;
+        }
+        for (int i = used_digits_; i < product_length; ++i) {
+            int bigit_index1 = used_digits_ - 1;
+            int bigit_index2 = i - bigit_index1;
+            // Invariant: sum of both indices is again equal to i.
+            // Inner loop runs 0 times on last iteration, emptying accumulator.
+            while (bigit_index2 < used_digits_) {
+                Chunk chunk1 = bigits_[copy_offset + bigit_index1];
+                Chunk chunk2 = bigits_[copy_offset + bigit_index2];
+                accumulator += static_cast<DoubleChunk>(chunk1) * chunk2;
+                bigit_index1--;
+                bigit_index2++;
+            }
+            // The overwritten bigits_[i] will never be read in further loop iterations,
+            // because bigit_index1 and bigit_index2 are always greater
+            // than i - used_digits_.
+            bigits_[i] = static_cast<Chunk>(accumulator) & kBigitMask;
+            accumulator >>= kBigitSize;
+        }
+        // Since the result was guaranteed to lie inside the number the
+        // accumulator must be 0 now.
+        ASSERT(accumulator == 0);
+        
+        // Don't forget to update the used_digits and the exponent.
+        used_digits_ = product_length;
+        exponent_ *= 2;
+        Clamp();
+    }
+    
+    
+    void Bignum::AssignPowerUInt16(uint16_t base, int power_exponent) {
+        ASSERT(base != 0);
+        ASSERT(power_exponent >= 0);
+        if (power_exponent == 0) {
+            AssignUInt16(1);
+            return;
+        }
+        Zero();
+        int shifts = 0;
+        // We expect base to be in range 2-32, and most often to be 10.
+        // It does not make much sense to implement different algorithms for counting
+        // the bits.
+        while ((base & 1) == 0) {
+            base >>= 1;
+            shifts++;
+        }
+        int bit_size = 0;
+        int tmp_base = base;
+        while (tmp_base != 0) {
+            tmp_base >>= 1;
+            bit_size++;
+        }
+        int final_size = bit_size * power_exponent;
+        // 1 extra bigit for the shifting, and one for rounded final_size.
+        EnsureCapacity(final_size / kBigitSize + 2);
+        
+        // Left to Right exponentiation.
+        int mask = 1;
+        while (power_exponent >= mask) mask <<= 1;
+        
+        // The mask is now pointing to the bit above the most significant 1-bit of
+        // power_exponent.
+        // Get rid of first 1-bit;
+        mask >>= 2;
+        uint64_t this_value = base;
+        
+        bool delayed_multipliciation = false;
+        const uint64_t max_32bits = 0xFFFFFFFF;
+        while (mask != 0 && this_value <= max_32bits) {
+            this_value = this_value * this_value;
+            // Verify that there is enough space in this_value to perform the
+            // multiplication.  The first bit_size bits must be 0.
+            if ((power_exponent & mask) != 0) {
+                uint64_t base_bits_mask =
+                ~((static_cast<uint64_t>(1) << (64 - bit_size)) - 1);
+                bool high_bits_zero = (this_value & base_bits_mask) == 0;
+                if (high_bits_zero) {
+                    this_value *= base;
+                } else {
+                    delayed_multipliciation = true;
+                }
+            }
+            mask >>= 1;
+        }
+        AssignUInt64(this_value);
+        if (delayed_multipliciation) {
+            MultiplyByUInt32(base);
+        }
+        
+        // Now do the same thing as a bignum.
+        while (mask != 0) {
+            Square();
+            if ((power_exponent & mask) != 0) {
+                MultiplyByUInt32(base);
+            }
+            mask >>= 1;
+        }
+        
+        // And finally add the saved shifts.
+        ShiftLeft(shifts * power_exponent);
+    }
+    
+    
+    // Precondition: this/other < 16bit.
+    uint16_t Bignum::DivideModuloIntBignum(const Bignum& other) {
+        ASSERT(IsClamped());
+        ASSERT(other.IsClamped());
+        ASSERT(other.used_digits_ > 0);
+        
+        // Easy case: if we have less digits than the divisor than the result is 0.
+        // Note: this handles the case where this == 0, too.
+        if (BigitLength() < other.BigitLength()) {
+            return 0;
+        }
+        
+        Align(other);
+        
+        uint16_t result = 0;
+        
+        // Start by removing multiples of 'other' until both numbers have the same
+        // number of digits.
+        while (BigitLength() > other.BigitLength()) {
+            // This naive approach is extremely inefficient if the this divided other
+            // might be big. This function is implemented for doubleToString where
+            // the result should be small (less than 10).
+            ASSERT(other.bigits_[other.used_digits_ - 1] >= ((1 << kBigitSize) / 16));
+            // Remove the multiples of the first digit.
+            // Example this = 23 and other equals 9. -> Remove 2 multiples.
+            result += bigits_[used_digits_ - 1];
+            SubtractTimes(other, bigits_[used_digits_ - 1]);
+        }
+        
+        ASSERT(BigitLength() == other.BigitLength());
+        
+        // Both bignums are at the same length now.
+        // Since other has more than 0 digits we know that the access to
+        // bigits_[used_digits_ - 1] is safe.
+        Chunk this_bigit = bigits_[used_digits_ - 1];
+        Chunk other_bigit = other.bigits_[other.used_digits_ - 1];
+        
+        if (other.used_digits_ == 1) {
+            // Shortcut for easy (and common) case.
+            int quotient = this_bigit / other_bigit;
+            bigits_[used_digits_ - 1] = this_bigit - other_bigit * quotient;
+            result += quotient;
+            Clamp();
+            return result;
+        }
+        
+        int division_estimate = this_bigit / (other_bigit + 1);
+        result += division_estimate;
+        SubtractTimes(other, division_estimate);
+        
+        if (other_bigit * (division_estimate + 1) > this_bigit) {
+            // No need to even try to subtract. Even if other's remaining digits were 0
+            // another subtraction would be too much.
+            return result;
+        }
+        
+        while (LessEqual(other, *this)) {
+            SubtractBignum(other);
+            result++;
+        }
+        return result;
+    }
+    
+    
+    template<typename S>
+    static int SizeInHexChars(S number) {
+        ASSERT(number > 0);
+        int result = 0;
+        while (number != 0) {
+            number >>= 4;
+            result++;
+        }
+        return result;
+    }
+    
+    
+    static char HexCharOfValue(int value) {
+        ASSERT(0 <= value && value <= 16);
+        if (value < 10) return value + '0';
+        return value - 10 + 'A';
+    }
+    
+    
+    bool Bignum::ToHexString(char* buffer, int buffer_size) const {
+        ASSERT(IsClamped());
+        // Each bigit must be printable as separate hex-character.
+        ASSERT(kBigitSize % 4 == 0);
+        const int kHexCharsPerBigit = kBigitSize / 4;
+        
+        if (used_digits_ == 0) {
+            if (buffer_size < 2) return false;
+            buffer[0] = '0';
+            buffer[1] = '\0';
+            return true;
+        }
+        // We add 1 for the terminating '\0' character.
+        int needed_chars = (BigitLength() - 1) * kHexCharsPerBigit +
+        SizeInHexChars(bigits_[used_digits_ - 1]) + 1;
+        if (needed_chars > buffer_size) return false;
+        int string_index = needed_chars - 1;
+        buffer[string_index--] = '\0';
+        for (int i = 0; i < exponent_; ++i) {
+            for (int j = 0; j < kHexCharsPerBigit; ++j) {
+                buffer[string_index--] = '0';
+            }
+        }
+        for (int i = 0; i < used_digits_ - 1; ++i) {
+            Chunk current_bigit = bigits_[i];
+            for (int j = 0; j < kHexCharsPerBigit; ++j) {
+                buffer[string_index--] = HexCharOfValue(current_bigit & 0xF);
+                current_bigit >>= 4;
+            }
+        }
+        // And finally the last bigit.
+        Chunk most_significant_bigit = bigits_[used_digits_ - 1];
+        while (most_significant_bigit != 0) {
+            buffer[string_index--] = HexCharOfValue(most_significant_bigit & 0xF);
+            most_significant_bigit >>= 4;
+        }
+        return true;
+    }
+    
+    
+    Bignum::Chunk Bignum::BigitAt(int index) const {
+        if (index >= BigitLength()) return 0;
+        if (index < exponent_) return 0;
+        return bigits_[index - exponent_];
+    }
+    
+    
+    int Bignum::Compare(const Bignum& a, const Bignum& b) {
+        ASSERT(a.IsClamped());
+        ASSERT(b.IsClamped());
+        int bigit_length_a = a.BigitLength();
+        int bigit_length_b = b.BigitLength();
+        if (bigit_length_a < bigit_length_b) return -1;
+        if (bigit_length_a > bigit_length_b) return +1;
+        for (int i = bigit_length_a - 1; i >= Min(a.exponent_, b.exponent_); --i) {
+            Chunk bigit_a = a.BigitAt(i);
+            Chunk bigit_b = b.BigitAt(i);
+            if (bigit_a < bigit_b) return -1;
+            if (bigit_a > bigit_b) return +1;
+            // Otherwise they are equal up to this digit. Try the next digit.
+        }
+        return 0;
+    }
+    
+    
+    int Bignum::PlusCompare(const Bignum& a, const Bignum& b, const Bignum& c) {
+        ASSERT(a.IsClamped());
+        ASSERT(b.IsClamped());
+        ASSERT(c.IsClamped());
+        if (a.BigitLength() < b.BigitLength()) {
+            return PlusCompare(b, a, c);
+        }
+        if (a.BigitLength() + 1 < c.BigitLength()) return -1;
+        if (a.BigitLength() > c.BigitLength()) return +1;
+        // The exponent encodes 0-bigits. So if there are more 0-digits in 'a' than
+        // 'b' has digits, then the bigit-length of 'a'+'b' must be equal to the one
+        // of 'a'.
+        if (a.exponent_ >= b.BigitLength() && a.BigitLength() < c.BigitLength()) {
+            return -1;
+        }
+        
+        Chunk borrow = 0;
+        // Starting at min_exponent all digits are == 0. So no need to compare them.
+        int min_exponent = Min(Min(a.exponent_, b.exponent_), c.exponent_);
+        for (int i = c.BigitLength() - 1; i >= min_exponent; --i) {
+            Chunk chunk_a = a.BigitAt(i);
+            Chunk chunk_b = b.BigitAt(i);
+            Chunk chunk_c = c.BigitAt(i);
+            Chunk sum = chunk_a + chunk_b;
+            if (sum > chunk_c + borrow) {
+                return +1;
+            } else {
+                borrow = chunk_c + borrow - sum;
+                if (borrow > 1) return -1;
+                borrow <<= kBigitSize;
+            }
+        }
+        if (borrow == 0) return 0;
+        return -1;
+    }
+    
+    
+    void Bignum::Clamp() {
+        while (used_digits_ > 0 && bigits_[used_digits_ - 1] == 0) {
+            used_digits_--;
+        }
+        if (used_digits_ == 0) {
+            // Zero.
+            exponent_ = 0;
+        }
+    }
+    
+    
+    bool Bignum::IsClamped() const {
+        return used_digits_ == 0 || bigits_[used_digits_ - 1] != 0;
+    }
+    
+    
+    void Bignum::Zero() {
+        for (int i = 0; i < used_digits_; ++i) {
+            bigits_[i] = 0;
+        }
+        used_digits_ = 0;
+        exponent_ = 0;
+    }
+    
+    
+    void Bignum::Align(const Bignum& other) {
+        if (exponent_ > other.exponent_) {
+            // If "X" represents a "hidden" digit (by the exponent) then we are in the
+            // following case (a == this, b == other):
+            // a:  aaaaaaXXXX   or a:   aaaaaXXX
+            // b:     bbbbbbX      b: bbbbbbbbXX
+            // We replace some of the hidden digits (X) of a with 0 digits.
+            // a:  aaaaaa000X   or a:   aaaaa0XX
+            int zero_digits = exponent_ - other.exponent_;
+            EnsureCapacity(used_digits_ + zero_digits);
+            for (int i = used_digits_ - 1; i >= 0; --i) {
+                bigits_[i + zero_digits] = bigits_[i];
+            }
+            for (int i = 0; i < zero_digits; ++i) {
+                bigits_[i] = 0;
+            }
+            used_digits_ += zero_digits;
+            exponent_ -= zero_digits;
+            ASSERT(used_digits_ >= 0);
+            ASSERT(exponent_ >= 0);
+        }
+    }
+    
+    
+    void Bignum::BigitsShiftLeft(int shift_amount) {
+        ASSERT(shift_amount < kBigitSize);
+        ASSERT(shift_amount >= 0);
+        Chunk carry = 0;
+        for (int i = 0; i < used_digits_; ++i) {
+            Chunk new_carry = bigits_[i] >> (kBigitSize - shift_amount);
+            bigits_[i] = ((bigits_[i] << shift_amount) + carry) & kBigitMask;
+            carry = new_carry;
+        }
+        if (carry != 0) {
+            bigits_[used_digits_] = carry;
+            used_digits_++;
+        }
+    }
+    
+    
+    void Bignum::SubtractTimes(const Bignum& other, int factor) {
+        ASSERT(exponent_ <= other.exponent_);
+        if (factor < 3) {
+            for (int i = 0; i < factor; ++i) {
+                SubtractBignum(other);
+            }
+            return;
+        }
+        Chunk borrow = 0;
+        int exponent_diff = other.exponent_ - exponent_;
+        for (int i = 0; i < other.used_digits_; ++i) {
+            DoubleChunk product = static_cast<DoubleChunk>(factor) * other.bigits_[i];
+            DoubleChunk remove = borrow + product;
+            Chunk difference = bigits_[i + exponent_diff] - ((uint32_t)remove & kBigitMask);
+            bigits_[i + exponent_diff] = difference & kBigitMask;
+            borrow = static_cast<Chunk>((difference >> (kChunkSize - 1)) +
+                                        (remove >> kBigitSize));
+        }
+        for (int i = other.used_digits_ + exponent_diff; i < used_digits_; ++i) {
+            if (borrow == 0) return;
+            Chunk difference = bigits_[i] - borrow;
+            bigits_[i] = difference & kBigitMask;
+            borrow = difference >> (kChunkSize - 1);
+            ++i;
+        }
+        Clamp();
+    }
+    
+    
+}  // namespace double_conversion
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/dtoa/bignum.h b/Source/WTF/wtf/dtoa/bignum.h
new file mode 100644
index 0000000..1a75058
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/bignum.h
@@ -0,0 +1,145 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 DOUBLE_CONVERSION_BIGNUM_H_
+#define DOUBLE_CONVERSION_BIGNUM_H_
+
+#include "utils.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    class Bignum {
+    public:
+        // 3584 = 128 * 28. We can represent 2^3584 > 10^1000 accurately.
+        // This bignum can encode much bigger numbers, since it contains an
+        // exponent.
+        static const int kMaxSignificantBits = 3584;
+        
+        Bignum();
+        void AssignUInt16(uint16_t value);
+        void AssignUInt64(uint64_t value);
+        void AssignBignum(const Bignum& other);
+        
+        void AssignDecimalString(Vector<const char> value);
+        void AssignHexString(Vector<const char> value);
+        
+        void AssignPowerUInt16(uint16_t base, int exponent);
+        
+        void AddUInt16(uint16_t operand);
+        void AddUInt64(uint64_t operand);
+        void AddBignum(const Bignum& other);
+        // Precondition: this >= other.
+        void SubtractBignum(const Bignum& other);
+        
+        void Square();
+        void ShiftLeft(int shift_amount);
+        void MultiplyByUInt32(uint32_t factor);
+        void MultiplyByUInt64(uint64_t factor);
+        void MultiplyByPowerOfTen(int exponent);
+        void Times10() { return MultiplyByUInt32(10); }
+        // Pseudocode:
+        //  int result = this / other;
+        //  this = this % other;
+        // In the worst case this function is in O(this/other).
+        uint16_t DivideModuloIntBignum(const Bignum& other);
+        
+        bool ToHexString(char* buffer, int buffer_size) const;
+        
+        static int Compare(const Bignum& a, const Bignum& b);
+        static bool Equal(const Bignum& a, const Bignum& b) {
+            return Compare(a, b) == 0;
+        }
+        static bool LessEqual(const Bignum& a, const Bignum& b) {
+            return Compare(a, b) <= 0;
+        }
+        static bool Less(const Bignum& a, const Bignum& b) {
+            return Compare(a, b) < 0;
+        }
+        // Returns Compare(a + b, c);
+        static int PlusCompare(const Bignum& a, const Bignum& b, const Bignum& c);
+        // Returns a + b == c
+        static bool PlusEqual(const Bignum& a, const Bignum& b, const Bignum& c) {
+            return PlusCompare(a, b, c) == 0;
+        }
+        // Returns a + b <= c
+        static bool PlusLessEqual(const Bignum& a, const Bignum& b, const Bignum& c) {
+            return PlusCompare(a, b, c) <= 0;
+        }
+        // Returns a + b < c
+        static bool PlusLess(const Bignum& a, const Bignum& b, const Bignum& c) {
+            return PlusCompare(a, b, c) < 0;
+        }
+    private:
+        typedef uint32_t Chunk;
+        typedef uint64_t DoubleChunk;
+        
+        static const int kChunkSize = sizeof(Chunk) * 8;
+        static const int kDoubleChunkSize = sizeof(DoubleChunk) * 8;
+        // With bigit size of 28 we loose some bits, but a double still fits easily
+        // into two chunks, and more importantly we can use the Comba multiplication.
+        static const int kBigitSize = 28;
+        static const Chunk kBigitMask = (1 << kBigitSize) - 1;
+        // Every instance allocates kBigitLength chunks on the stack. Bignums cannot
+        // grow. There are no checks if the stack-allocated space is sufficient.
+        static const int kBigitCapacity = kMaxSignificantBits / kBigitSize;
+        
+        void EnsureCapacity(int size) {
+            if (size > kBigitCapacity) {
+                UNREACHABLE();
+            }
+        }
+        void Align(const Bignum& other);
+        void Clamp();
+        bool IsClamped() const;
+        void Zero();
+        // Requires this to have enough capacity (no tests done).
+        // Updates used_digits_ if necessary.
+        // shift_amount must be < kBigitSize.
+        void BigitsShiftLeft(int shift_amount);
+        // BigitLength includes the "hidden" digits encoded in the exponent.
+        int BigitLength() const { return used_digits_ + exponent_; }
+        Chunk BigitAt(int index) const;
+        void SubtractTimes(const Bignum& other, int factor);
+        
+        Chunk bigits_buffer_[kBigitCapacity];
+        // A vector backed by bigits_buffer_. This way accesses to the array are
+        // checked for out-of-bounds errors.
+        Vector<Chunk> bigits_;
+        int used_digits_;
+        // The Bignum's value equals value(bigits_) * 2^(exponent_ * kBigitSize).
+        int exponent_;
+        
+        DISALLOW_COPY_AND_ASSIGN(Bignum);
+    };
+    
+}  // namespace double_conversion
+
+} // namespace WTF
+
+#endif  // DOUBLE_CONVERSION_BIGNUM_H_
diff --git a/Source/WTF/wtf/dtoa/cached-powers.cc b/Source/WTF/wtf/dtoa/cached-powers.cc
new file mode 100644
index 0000000..54cb7ca
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/cached-powers.cc
@@ -0,0 +1,193 @@
+// Copyright 2006-2008 the V8 project authors. 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.
+//     * 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.
+//     * 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 <stdarg.h>
+#include <limits.h>
+#include <math.h>
+
+#include "UnusedParam.h"
+#include "utils.h"
+#include "cached-powers.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    struct CachedPower {
+        uint64_t significand;
+        int16_t binary_exponent;
+        int16_t decimal_exponent;
+    };
+    
+    static int kCachedPowersLength = 1;
+    static int kCachedPowersOffset = 1;
+    static const double kD_1_LOG2_10 = 0.30102999566398114;  //  1 / lg(10)
+    static CachedPower* kCachedPowers = 0;
+    
+    int PowersOfTenCache::kDecimalExponentDistance = 1;
+    int PowersOfTenCache::kMinDecimalExponent = 1;
+    int PowersOfTenCache::kMaxDecimalExponent = 1;
+    
+    void initialize() {
+        if (kCachedPowers)
+            return;
+        static CachedPower cachedPowers[] = {
+            {UINT64_2PART_C(0xfa8fd5a0, 081c0288), -1220, -348},
+            {UINT64_2PART_C(0xbaaee17f, a23ebf76), -1193, -340},
+            {UINT64_2PART_C(0x8b16fb20, 3055ac76), -1166, -332},
+            {UINT64_2PART_C(0xcf42894a, 5dce35ea), -1140, -324},
+            {UINT64_2PART_C(0x9a6bb0aa, 55653b2d), -1113, -316},
+            {UINT64_2PART_C(0xe61acf03, 3d1a45df), -1087, -308},
+            {UINT64_2PART_C(0xab70fe17, c79ac6ca), -1060, -300},
+            {UINT64_2PART_C(0xff77b1fc, bebcdc4f), -1034, -292},
+            {UINT64_2PART_C(0xbe5691ef, 416bd60c), -1007, -284},
+            {UINT64_2PART_C(0x8dd01fad, 907ffc3c), -980, -276},
+            {UINT64_2PART_C(0xd3515c28, 31559a83), -954, -268},
+            {UINT64_2PART_C(0x9d71ac8f, ada6c9b5), -927, -260},
+            {UINT64_2PART_C(0xea9c2277, 23ee8bcb), -901, -252},
+            {UINT64_2PART_C(0xaecc4991, 4078536d), -874, -244},
+            {UINT64_2PART_C(0x823c1279, 5db6ce57), -847, -236},
+            {UINT64_2PART_C(0xc2109436, 4dfb5637), -821, -228},
+            {UINT64_2PART_C(0x9096ea6f, 3848984f), -794, -220},
+            {UINT64_2PART_C(0xd77485cb, 25823ac7), -768, -212},
+            {UINT64_2PART_C(0xa086cfcd, 97bf97f4), -741, -204},
+            {UINT64_2PART_C(0xef340a98, 172aace5), -715, -196},
+            {UINT64_2PART_C(0xb23867fb, 2a35b28e), -688, -188},
+            {UINT64_2PART_C(0x84c8d4df, d2c63f3b), -661, -180},
+            {UINT64_2PART_C(0xc5dd4427, 1ad3cdba), -635, -172},
+            {UINT64_2PART_C(0x936b9fce, bb25c996), -608, -164},
+            {UINT64_2PART_C(0xdbac6c24, 7d62a584), -582, -156},
+            {UINT64_2PART_C(0xa3ab6658, 0d5fdaf6), -555, -148},
+            {UINT64_2PART_C(0xf3e2f893, dec3f126), -529, -140},
+            {UINT64_2PART_C(0xb5b5ada8, aaff80b8), -502, -132},
+            {UINT64_2PART_C(0x87625f05, 6c7c4a8b), -475, -124},
+            {UINT64_2PART_C(0xc9bcff60, 34c13053), -449, -116},
+            {UINT64_2PART_C(0x964e858c, 91ba2655), -422, -108},
+            {UINT64_2PART_C(0xdff97724, 70297ebd), -396, -100},
+            {UINT64_2PART_C(0xa6dfbd9f, b8e5b88f), -369, -92},
+            {UINT64_2PART_C(0xf8a95fcf, 88747d94), -343, -84},
+            {UINT64_2PART_C(0xb9447093, 8fa89bcf), -316, -76},
+            {UINT64_2PART_C(0x8a08f0f8, bf0f156b), -289, -68},
+            {UINT64_2PART_C(0xcdb02555, 653131b6), -263, -60},
+            {UINT64_2PART_C(0x993fe2c6, d07b7fac), -236, -52},
+            {UINT64_2PART_C(0xe45c10c4, 2a2b3b06), -210, -44},
+            {UINT64_2PART_C(0xaa242499, 697392d3), -183, -36},
+            {UINT64_2PART_C(0xfd87b5f2, 8300ca0e), -157, -28},
+            {UINT64_2PART_C(0xbce50864, 92111aeb), -130, -20},
+            {UINT64_2PART_C(0x8cbccc09, 6f5088cc), -103, -12},
+            {UINT64_2PART_C(0xd1b71758, e219652c), -77, -4},
+            {UINT64_2PART_C(0x9c400000, 00000000), -50, 4},
+            {UINT64_2PART_C(0xe8d4a510, 00000000), -24, 12},
+            {UINT64_2PART_C(0xad78ebc5, ac620000), 3, 20},
+            {UINT64_2PART_C(0x813f3978, f8940984), 30, 28},
+            {UINT64_2PART_C(0xc097ce7b, c90715b3), 56, 36},
+            {UINT64_2PART_C(0x8f7e32ce, 7bea5c70), 83, 44},
+            {UINT64_2PART_C(0xd5d238a4, abe98068), 109, 52},
+            {UINT64_2PART_C(0x9f4f2726, 179a2245), 136, 60},
+            {UINT64_2PART_C(0xed63a231, d4c4fb27), 162, 68},
+            {UINT64_2PART_C(0xb0de6538, 8cc8ada8), 189, 76},
+            {UINT64_2PART_C(0x83c7088e, 1aab65db), 216, 84},
+            {UINT64_2PART_C(0xc45d1df9, 42711d9a), 242, 92},
+            {UINT64_2PART_C(0x924d692c, a61be758), 269, 100},
+            {UINT64_2PART_C(0xda01ee64, 1a708dea), 295, 108},
+            {UINT64_2PART_C(0xa26da399, 9aef774a), 322, 116},
+            {UINT64_2PART_C(0xf209787b, b47d6b85), 348, 124},
+            {UINT64_2PART_C(0xb454e4a1, 79dd1877), 375, 132},
+            {UINT64_2PART_C(0x865b8692, 5b9bc5c2), 402, 140},
+            {UINT64_2PART_C(0xc83553c5, c8965d3d), 428, 148},
+            {UINT64_2PART_C(0x952ab45c, fa97a0b3), 455, 156},
+            {UINT64_2PART_C(0xde469fbd, 99a05fe3), 481, 164},
+            {UINT64_2PART_C(0xa59bc234, db398c25), 508, 172},
+            {UINT64_2PART_C(0xf6c69a72, a3989f5c), 534, 180},
+            {UINT64_2PART_C(0xb7dcbf53, 54e9bece), 561, 188},
+            {UINT64_2PART_C(0x88fcf317, f22241e2), 588, 196},
+            {UINT64_2PART_C(0xcc20ce9b, d35c78a5), 614, 204},
+            {UINT64_2PART_C(0x98165af3, 7b2153df), 641, 212},
+            {UINT64_2PART_C(0xe2a0b5dc, 971f303a), 667, 220},
+            {UINT64_2PART_C(0xa8d9d153, 5ce3b396), 694, 228},
+            {UINT64_2PART_C(0xfb9b7cd9, a4a7443c), 720, 236},
+            {UINT64_2PART_C(0xbb764c4c, a7a44410), 747, 244},
+            {UINT64_2PART_C(0x8bab8eef, b6409c1a), 774, 252},
+            {UINT64_2PART_C(0xd01fef10, a657842c), 800, 260},
+            {UINT64_2PART_C(0x9b10a4e5, e9913129), 827, 268},
+            {UINT64_2PART_C(0xe7109bfb, a19c0c9d), 853, 276},
+            {UINT64_2PART_C(0xac2820d9, 623bf429), 880, 284},
+            {UINT64_2PART_C(0x80444b5e, 7aa7cf85), 907, 292},
+            {UINT64_2PART_C(0xbf21e440, 03acdd2d), 933, 300},
+            {UINT64_2PART_C(0x8e679c2f, 5e44ff8f), 960, 308},
+            {UINT64_2PART_C(0xd433179d, 9c8cb841), 986, 316},
+            {UINT64_2PART_C(0x9e19db92, b4e31ba9), 1013, 324},
+            {UINT64_2PART_C(0xeb96bf6e, badf77d9), 1039, 332},
+            {UINT64_2PART_C(0xaf87023b, 9bf0ee6b), 1066, 340},
+        };
+        kCachedPowers = cachedPowers;
+        kCachedPowersLength = ARRAY_SIZE(cachedPowers);
+        kCachedPowersOffset = -cachedPowers[0].decimal_exponent;
+        PowersOfTenCache::kDecimalExponentDistance = kCachedPowers[1].decimal_exponent - kCachedPowers[0].decimal_exponent;
+        PowersOfTenCache::kMinDecimalExponent = kCachedPowers[0].decimal_exponent;
+        PowersOfTenCache::kMaxDecimalExponent = kCachedPowers[kCachedPowersLength - 1].decimal_exponent;
+    }
+    
+    void PowersOfTenCache::GetCachedPowerForBinaryExponentRange(
+                                                                int min_exponent,
+                                                                int max_exponent,
+                                                                DiyFp* power,
+                                                                int* decimal_exponent) {
+        UNUSED_PARAM(max_exponent);
+        int kQ = DiyFp::kSignificandSize;
+        double k = ceil((min_exponent + kQ - 1) * kD_1_LOG2_10);
+        int foo = kCachedPowersOffset;
+        int index =
+        (foo + static_cast<int>(k) - 1) / kDecimalExponentDistance + 1;
+        ASSERT(0 <= index && index < kCachedPowersLength);
+        CachedPower cached_power = kCachedPowers[index];
+        ASSERT(min_exponent <= cached_power.binary_exponent);
+        ASSERT(cached_power.binary_exponent <= max_exponent);
+        *decimal_exponent = cached_power.decimal_exponent;
+        *power = DiyFp(cached_power.significand, cached_power.binary_exponent);
+    }
+    
+    
+    void PowersOfTenCache::GetCachedPowerForDecimalExponent(int requested_exponent,
+                                                            DiyFp* power,
+                                                            int* found_exponent) {
+        ASSERT(kMinDecimalExponent <= requested_exponent);
+        ASSERT(requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance);
+        int index =
+        (requested_exponent + kCachedPowersOffset) / kDecimalExponentDistance;
+        CachedPower cached_power = kCachedPowers[index];
+        *power = DiyFp(cached_power.significand, cached_power.binary_exponent);
+        *found_exponent = cached_power.decimal_exponent;
+        ASSERT(*found_exponent <= requested_exponent);
+        ASSERT(requested_exponent < *found_exponent + kDecimalExponentDistance);
+    }
+    
+}  // namespace double_conversion
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/dtoa/cached-powers.h b/Source/WTF/wtf/dtoa/cached-powers.h
new file mode 100644
index 0000000..cbc04d4
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/cached-powers.h
@@ -0,0 +1,72 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 DOUBLE_CONVERSION_CACHED_POWERS_H_
+#define DOUBLE_CONVERSION_CACHED_POWERS_H_
+
+#include "diy-fp.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    class PowersOfTenCache {
+    public:
+        
+        // Not all powers of ten are cached. The decimal exponent of two neighboring
+        // cached numbers will differ by kDecimalExponentDistance.
+        static int kDecimalExponentDistance;
+        
+        static int kMinDecimalExponent;
+        static int kMaxDecimalExponent;
+        
+        // Returns a cached power-of-ten with a binary exponent in the range
+        // [min_exponent; max_exponent] (boundaries included).
+        static void GetCachedPowerForBinaryExponentRange(int min_exponent,
+                                                         int max_exponent,
+                                                         DiyFp* power,
+                                                         int* decimal_exponent);
+        
+        // Returns a cached power of ten x ~= 10^k such that
+        //   k <= decimal_exponent < k + kCachedPowersDecimalDistance.
+        // The given decimal_exponent must satisfy
+        //   kMinDecimalExponent <= requested_exponent, and
+        //   requested_exponent < kMaxDecimalExponent + kDecimalExponentDistance.
+        static void GetCachedPowerForDecimalExponent(int requested_exponent,
+                                                     DiyFp* power,
+                                                     int* found_exponent);
+    };
+    
+    // Initializes the table of cached powers used by the dtoa algorithm.
+    // This needs to be called when JSC is being initialized.
+    void initialize();
+    
+}  // namespace double_conversion
+
+} // namespace WTF
+
+#endif  // DOUBLE_CONVERSION_CACHED_POWERS_H_
diff --git a/Source/WTF/wtf/dtoa/diy-fp.cc b/Source/WTF/wtf/dtoa/diy-fp.cc
new file mode 100644
index 0000000..c023359
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/diy-fp.cc
@@ -0,0 +1,62 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 "diy-fp.h"
+#include "utils.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    void DiyFp::Multiply(const DiyFp& other) {
+        // Simply "emulates" a 128 bit multiplication.
+        // However: the resulting number only contains 64 bits. The least
+        // significant 64 bits are only used for rounding the most significant 64
+        // bits.
+        const uint64_t kM32 = 0xFFFFFFFFU;
+        uint64_t a = f_ >> 32;
+        uint64_t b = f_ & kM32;
+        uint64_t c = other.f_ >> 32;
+        uint64_t d = other.f_ & kM32;
+        uint64_t ac = a * c;
+        uint64_t bc = b * c;
+        uint64_t ad = a * d;
+        uint64_t bd = b * d;
+        uint64_t tmp = (bd >> 32) + (ad & kM32) + (bc & kM32);
+        // By adding 1U << 31 to tmp we round the final result.
+        // Halfway cases will be round up.
+        tmp += 1U << 31;
+        uint64_t result_f = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32);
+        e_ += other.e_ + 64;
+        f_ = result_f;
+    }
+    
+}  // namespace double_conversion
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/dtoa/diy-fp.h b/Source/WTF/wtf/dtoa/diy-fp.h
new file mode 100644
index 0000000..e843100
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/diy-fp.h
@@ -0,0 +1,122 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 DOUBLE_CONVERSION_DIY_FP_H_
+#define DOUBLE_CONVERSION_DIY_FP_H_
+
+#include "utils.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    // This "Do It Yourself Floating Point" class implements a floating-point number
+    // with a uint64 significand and an int exponent. Normalized DiyFp numbers will
+    // have the most significant bit of the significand set.
+    // Multiplication and Subtraction do not normalize their results.
+    // DiyFp are not designed to contain special doubles (NaN and Infinity).
+    class DiyFp {
+    public:
+        static const int kSignificandSize = 64;
+        
+        DiyFp() : f_(0), e_(0) {}
+        DiyFp(uint64_t f, int e) : f_(f), e_(e) {}
+        
+        // this = this - other.
+        // The exponents of both numbers must be the same and the significand of this
+        // must be bigger than the significand of other.
+        // The result will not be normalized.
+        void Subtract(const DiyFp& other) {
+            ASSERT(e_ == other.e_);
+            ASSERT(f_ >= other.f_);
+            f_ -= other.f_;
+        }
+        
+        // Returns a - b.
+        // The exponents of both numbers must be the same and this must be bigger
+        // than other. The result will not be normalized.
+        static DiyFp Minus(const DiyFp& a, const DiyFp& b) {
+            DiyFp result = a;
+            result.Subtract(b);
+            return result;
+        }
+        
+        
+        // this = this * other.
+        void Multiply(const DiyFp& other);
+        
+        // returns a * b;
+        static DiyFp Times(const DiyFp& a, const DiyFp& b) {
+            DiyFp result = a;
+            result.Multiply(b);
+            return result;
+        }
+        
+        void Normalize() {
+            ASSERT(f_ != 0);
+            uint64_t f = f_;
+            int e = e_;
+            
+            // This method is mainly called for normalizing boundaries. In general
+            // boundaries need to be shifted by 10 bits. We thus optimize for this case.
+            const uint64_t k10MSBits = UINT64_2PART_C(0xFFC00000, 00000000);
+            while ((f & k10MSBits) == 0) {
+                f <<= 10;
+                e -= 10;
+            }
+            while ((f & kUint64MSB) == 0) {
+                f <<= 1;
+                e--;
+            }
+            f_ = f;
+            e_ = e;
+        }
+        
+        static DiyFp Normalize(const DiyFp& a) {
+            DiyFp result = a;
+            result.Normalize();
+            return result;
+        }
+        
+        uint64_t f() const { return f_; }
+        int e() const { return e_; }
+        
+        void set_f(uint64_t new_value) { f_ = new_value; }
+        void set_e(int new_value) { e_ = new_value; }
+        
+    private:
+        static const uint64_t kUint64MSB = UINT64_2PART_C(0x80000000, 00000000);
+        
+        uint64_t f_;
+        int e_;
+    };
+    
+}  // namespace double_conversion
+
+} // namespace WTF
+
+#endif  // DOUBLE_CONVERSION_DIY_FP_H_
diff --git a/Source/WTF/wtf/dtoa/double-conversion.cc b/Source/WTF/wtf/dtoa/double-conversion.cc
new file mode 100644
index 0000000..c46dba9
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/double-conversion.cc
@@ -0,0 +1,606 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 <limits.h>
+#include <math.h>
+
+#include "double-conversion.h"
+
+#include "bignum-dtoa.h"
+#include "double.h"
+#include "fast-dtoa.h"
+#include "fixed-dtoa.h"
+#include "strtod.h"
+#include "utils.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    const DoubleToStringConverter& DoubleToStringConverter::EcmaScriptConverter() {
+        int flags = UNIQUE_ZERO | EMIT_POSITIVE_EXPONENT_SIGN;
+        static DoubleToStringConverter converter(flags,
+                                                 "Infinity",
+                                                 "NaN",
+                                                 'e',
+                                                 -6, 21,
+                                                 6, 0);
+        return converter;
+    }
+    
+    
+    bool DoubleToStringConverter::HandleSpecialValues(
+                                                      double value,
+                                                      StringBuilder* result_builder) const {
+        Double double_inspect(value);
+        if (double_inspect.IsInfinite()) {
+            if (infinity_symbol_ == NULL) return false;
+            if (value < 0) {
+                result_builder->AddCharacter('-');
+            }
+            result_builder->AddString(infinity_symbol_);
+            return true;
+        }
+        if (double_inspect.IsNan()) {
+            if (nan_symbol_ == NULL) return false;
+            result_builder->AddString(nan_symbol_);
+            return true;
+        }
+        return false;
+    }
+    
+    
+    void DoubleToStringConverter::CreateExponentialRepresentation(
+                                                                  const char* decimal_digits,
+                                                                  int length,
+                                                                  int exponent,
+                                                                  StringBuilder* result_builder) const {
+        ASSERT(length != 0);
+        result_builder->AddCharacter(decimal_digits[0]);
+        if (length != 1) {
+            result_builder->AddCharacter('.');
+            result_builder->AddSubstring(&decimal_digits[1], length-1);
+        }
+        result_builder->AddCharacter(exponent_character_);
+        if (exponent < 0) {
+            result_builder->AddCharacter('-');
+            exponent = -exponent;
+        } else {
+            if ((flags_ & EMIT_POSITIVE_EXPONENT_SIGN) != 0) {
+                result_builder->AddCharacter('+');
+            }
+        }
+        if (exponent == 0) {
+            result_builder->AddCharacter('0');
+            return;
+        }
+        ASSERT(exponent < 1e4);
+        const int kMaxExponentLength = 5;
+        char buffer[kMaxExponentLength + 1];
+        int first_char_pos = kMaxExponentLength;
+        buffer[first_char_pos] = '\0';
+        while (exponent > 0) {
+            buffer[--first_char_pos] = '0' + (exponent % 10);
+            exponent /= 10;
+        }
+        result_builder->AddSubstring(&buffer[first_char_pos],
+                                     kMaxExponentLength - first_char_pos);
+    }
+    
+    
+    void DoubleToStringConverter::CreateDecimalRepresentation(
+                                                              const char* decimal_digits,
+                                                              int length,
+                                                              int decimal_point,
+                                                              int digits_after_point,
+                                                              StringBuilder* result_builder) const {
+        // Create a representation that is padded with zeros if needed.
+        if (decimal_point <= 0) {
+            // "0.00000decimal_rep".
+            result_builder->AddCharacter('0');
+            if (digits_after_point > 0) {
+                result_builder->AddCharacter('.');
+                result_builder->AddPadding('0', -decimal_point);
+                ASSERT(length <= digits_after_point - (-decimal_point));
+                result_builder->AddSubstring(decimal_digits, length);
+                int remaining_digits = digits_after_point - (-decimal_point) - length;
+                result_builder->AddPadding('0', remaining_digits);
+            }
+        } else if (decimal_point >= length) {
+            // "decimal_rep0000.00000" or "decimal_rep.0000"
+            result_builder->AddSubstring(decimal_digits, length);
+            result_builder->AddPadding('0', decimal_point - length);
+            if (digits_after_point > 0) {
+                result_builder->AddCharacter('.');
+                result_builder->AddPadding('0', digits_after_point);
+            }
+        } else {
+            // "decima.l_rep000"
+            ASSERT(digits_after_point > 0);
+            result_builder->AddSubstring(decimal_digits, decimal_point);
+            result_builder->AddCharacter('.');
+            ASSERT(length - decimal_point <= digits_after_point);
+            result_builder->AddSubstring(&decimal_digits[decimal_point],
+                                         length - decimal_point);
+            int remaining_digits = digits_after_point - (length - decimal_point);
+            result_builder->AddPadding('0', remaining_digits);
+        }
+        if (digits_after_point == 0) {
+            if ((flags_ & EMIT_TRAILING_DECIMAL_POINT) != 0) {
+                result_builder->AddCharacter('.');
+            }
+            if ((flags_ & EMIT_TRAILING_ZERO_AFTER_POINT) != 0) {
+                result_builder->AddCharacter('0');
+            }
+        }
+    }
+    
+    
+    bool DoubleToStringConverter::ToShortest(double value,
+                                             StringBuilder* result_builder) const {
+        if (Double(value).IsSpecial()) {
+            return HandleSpecialValues(value, result_builder);
+        }
+        
+        int decimal_point;
+        bool sign;
+        const int kDecimalRepCapacity = kBase10MaximalLength + 1;
+        char decimal_rep[kDecimalRepCapacity];
+        int decimal_rep_length;
+        
+        DoubleToAscii(value, SHORTEST, 0, decimal_rep, kDecimalRepCapacity,
+                      &sign, &decimal_rep_length, &decimal_point);
+        
+        bool unique_zero = (flags_ & UNIQUE_ZERO) != 0;
+        if (sign && (value != 0.0 || !unique_zero)) {
+            result_builder->AddCharacter('-');
+        }
+        
+        int exponent = decimal_point - 1;
+        if ((decimal_in_shortest_low_ <= exponent) &&
+            (exponent < decimal_in_shortest_high_)) {
+            CreateDecimalRepresentation(decimal_rep, decimal_rep_length,
+                                        decimal_point,
+                                        Max(0, decimal_rep_length - decimal_point),
+                                        result_builder);
+        } else {
+            CreateExponentialRepresentation(decimal_rep, decimal_rep_length, exponent,
+                                            result_builder);
+        }
+        return true;
+    }
+    
+    
+    bool DoubleToStringConverter::ToFixed(double value,
+                                          int requested_digits,
+                                          StringBuilder* result_builder) const {
+        ASSERT(kMaxFixedDigitsBeforePoint == 60);
+        const double kFirstNonFixed = 1e60;
+        
+        if (Double(value).IsSpecial()) {
+            return HandleSpecialValues(value, result_builder);
+        }
+        
+        if (requested_digits > kMaxFixedDigitsAfterPoint) return false;
+        if (value >= kFirstNonFixed || value <= -kFirstNonFixed) return false;
+        
+        // Find a sufficiently precise decimal representation of n.
+        int decimal_point;
+        bool sign;
+        // Add space for the '\0' byte.
+        const int kDecimalRepCapacity =
+        kMaxFixedDigitsBeforePoint + kMaxFixedDigitsAfterPoint + 1;
+        char decimal_rep[kDecimalRepCapacity];
+        int decimal_rep_length;
+        DoubleToAscii(value, FIXED, requested_digits,
+                      decimal_rep, kDecimalRepCapacity,
+                      &sign, &decimal_rep_length, &decimal_point);
+        
+        bool unique_zero = ((flags_ & UNIQUE_ZERO) != 0);
+        if (sign && (value != 0.0 || !unique_zero)) {
+            result_builder->AddCharacter('-');
+        }
+        
+        CreateDecimalRepresentation(decimal_rep, decimal_rep_length, decimal_point,
+                                    requested_digits, result_builder);
+        return true;
+    }
+    
+    
+    bool DoubleToStringConverter::ToExponential(
+                                                double value,
+                                                int requested_digits,
+                                                StringBuilder* result_builder) const {
+        if (Double(value).IsSpecial()) {
+            return HandleSpecialValues(value, result_builder);
+        }
+        
+        if (requested_digits < -1) return false;
+        if (requested_digits > kMaxExponentialDigits) return false;
+        
+        int decimal_point;
+        bool sign;
+        // Add space for digit before the decimal point and the '\0' character.
+        const int kDecimalRepCapacity = kMaxExponentialDigits + 2;
+        ASSERT(kDecimalRepCapacity > kBase10MaximalLength);
+        char decimal_rep[kDecimalRepCapacity];
+        int decimal_rep_length;
+        
+        if (requested_digits == -1) {
+            DoubleToAscii(value, SHORTEST, 0,
+                          decimal_rep, kDecimalRepCapacity,
+                          &sign, &decimal_rep_length, &decimal_point);
+        } else {
+            DoubleToAscii(value, PRECISION, requested_digits + 1,
+                          decimal_rep, kDecimalRepCapacity,
+                          &sign, &decimal_rep_length, &decimal_point);
+            ASSERT(decimal_rep_length <= requested_digits + 1);
+            
+            for (int i = decimal_rep_length; i < requested_digits + 1; ++i) {
+                decimal_rep[i] = '0';
+            }
+            decimal_rep_length = requested_digits + 1;
+        }
+        
+        bool unique_zero = ((flags_ & UNIQUE_ZERO) != 0);
+        if (sign && (value != 0.0 || !unique_zero)) {
+            result_builder->AddCharacter('-');
+        }
+        
+        int exponent = decimal_point - 1;
+        CreateExponentialRepresentation(decimal_rep,
+                                        decimal_rep_length,
+                                        exponent,
+                                        result_builder);
+        return true;
+    }
+    
+    
+    bool DoubleToStringConverter::ToPrecision(double value,
+                                              int precision,
+                                              StringBuilder* result_builder) const {
+        if (Double(value).IsSpecial()) {
+            return HandleSpecialValues(value, result_builder);
+        }
+        
+        if (precision < kMinPrecisionDigits || precision > kMaxPrecisionDigits) {
+            return false;
+        }
+        
+        // Find a sufficiently precise decimal representation of n.
+        int decimal_point;
+        bool sign;
+        // Add one for the terminating null character.
+        const int kDecimalRepCapacity = kMaxPrecisionDigits + 1;
+        char decimal_rep[kDecimalRepCapacity];
+        int decimal_rep_length;
+        
+        DoubleToAscii(value, PRECISION, precision,
+                      decimal_rep, kDecimalRepCapacity,
+                      &sign, &decimal_rep_length, &decimal_point);
+        ASSERT(decimal_rep_length <= precision);
+        
+        bool unique_zero = ((flags_ & UNIQUE_ZERO) != 0);
+        if (sign && (value != 0.0 || !unique_zero)) {
+            result_builder->AddCharacter('-');
+        }
+        
+        // The exponent if we print the number as x.xxeyyy. That is with the
+        // decimal point after the first digit.
+        int exponent = decimal_point - 1;
+        
+        int extra_zero = ((flags_ & EMIT_TRAILING_ZERO_AFTER_POINT) != 0) ? 1 : 0;
+        if ((-decimal_point + 1 > max_leading_padding_zeroes_in_precision_mode_) ||
+            (decimal_point - precision + extra_zero >
+             max_trailing_padding_zeroes_in_precision_mode_)) {
+                // Fill buffer to contain 'precision' digits.
+                // Usually the buffer is already at the correct length, but 'DoubleToAscii'
+                // is allowed to return less characters.
+                for (int i = decimal_rep_length; i < precision; ++i) {
+                    decimal_rep[i] = '0';
+                }
+                
+                CreateExponentialRepresentation(decimal_rep,
+                                                precision,
+                                                exponent,
+                                                result_builder);
+            } else {
+                CreateDecimalRepresentation(decimal_rep, decimal_rep_length, decimal_point,
+                                            Max(0, precision - decimal_point),
+                                            result_builder);
+            }
+        return true;
+    }
+    
+    
+    static BignumDtoaMode DtoaToBignumDtoaMode(
+                                               DoubleToStringConverter::DtoaMode dtoa_mode) {
+        switch (dtoa_mode) {
+            case DoubleToStringConverter::SHORTEST:  return BIGNUM_DTOA_SHORTEST;
+            case DoubleToStringConverter::FIXED:     return BIGNUM_DTOA_FIXED;
+            case DoubleToStringConverter::PRECISION: return BIGNUM_DTOA_PRECISION;
+            default:
+                UNREACHABLE();
+                return BIGNUM_DTOA_SHORTEST;  // To silence compiler.
+        }
+    }
+    
+    
+    void DoubleToStringConverter::DoubleToAscii(double v,
+                                                DtoaMode mode,
+                                                int requested_digits,
+                                                char* buffer,
+                                                int buffer_length,
+                                                bool* sign,
+                                                int* length,
+                                                int* point) {
+        Vector<char> vector(buffer, buffer_length);
+        ASSERT(!Double(v).IsSpecial());
+        ASSERT(mode == SHORTEST || requested_digits >= 0);
+        
+        if (Double(v).Sign() < 0) {
+            *sign = true;
+            v = -v;
+        } else {
+            *sign = false;
+        }
+        
+        if (mode == PRECISION && requested_digits == 0) {
+            vector[0] = '\0';
+            *length = 0;
+            return;
+        }
+        
+        if (v == 0) {
+            vector[0] = '0';
+            vector[1] = '\0';
+            *length = 1;
+            *point = 1;
+            return;
+        }
+        
+        bool fast_worked;
+        switch (mode) {
+            case SHORTEST:
+                fast_worked = FastDtoa(v, FAST_DTOA_SHORTEST, 0, vector, length, point);
+                break;
+            case FIXED:
+                fast_worked = FastFixedDtoa(v, requested_digits, vector, length, point);
+                break;
+            case PRECISION:
+                fast_worked = FastDtoa(v, FAST_DTOA_PRECISION, requested_digits,
+                                       vector, length, point);
+                break;
+            default:
+                UNREACHABLE();
+                fast_worked = false;
+        }
+        if (fast_worked) return;
+        
+        // If the fast dtoa didn't succeed use the slower bignum version.
+        BignumDtoaMode bignum_mode = DtoaToBignumDtoaMode(mode);
+        BignumDtoa(v, bignum_mode, requested_digits, vector, length, point);
+        vector[*length] = '\0';
+    }
+    
+    
+    // Maximum number of significant digits in decimal representation.
+    // The longest possible double in decimal representation is
+    // (2^53 - 1) * 2 ^ -1074 that is (2 ^ 53 - 1) * 5 ^ 1074 / 10 ^ 1074
+    // (768 digits). If we parse a number whose first digits are equal to a
+    // mean of 2 adjacent doubles (that could have up to 769 digits) the result
+    // must be rounded to the bigger one unless the tail consists of zeros, so
+    // we don't need to preserve all the digits.
+    const int kMaxSignificantDigits = 772;
+    
+    
+    static double SignedZero(bool sign) {
+        return sign ? -0.0 : 0.0;
+    }
+    
+    
+    double StringToDoubleConverter::StringToDouble(
+                                                   const char* input,
+                                                   size_t length,
+                                                   size_t* processed_characters_count) {
+        const char* current = input;
+        const char* end = input + length;
+        
+        *processed_characters_count = 0;
+        
+        // To make sure that iterator dereferencing is valid the following
+        // convention is used:
+        // 1. Each '++current' statement is followed by check for equality to 'end'.
+        // 3. If 'current' becomes equal to 'end' the function returns or goes to
+        // 'parsing_done'.
+        // 4. 'current' is not dereferenced after the 'parsing_done' label.
+        // 5. Code before 'parsing_done' may rely on 'current != end'.
+        if (current == end) return 0.0;
+        
+        // The longest form of simplified number is: "-<significant digits>.1eXXX\0".
+        const int kBufferSize = kMaxSignificantDigits + 10;
+        char buffer[kBufferSize];  // NOLINT: size is known at compile time.
+        int buffer_pos = 0;
+        
+        // Exponent will be adjusted if insignificant digits of the integer part
+        // or insignificant leading zeros of the fractional part are dropped.
+        int exponent = 0;
+        int significant_digits = 0;
+        int insignificant_digits = 0;
+        bool nonzero_digit_dropped = false;
+        bool sign = false;
+        
+        if (*current == '+' || *current == '-') {
+            sign = (*current == '-');
+            ++current;
+            if (current == end) return 0.0;
+        }
+        
+        bool leading_zero = false;
+        if (*current == '0') {
+            ++current;
+            if (current == end) {
+                *processed_characters_count = current - input;
+                return SignedZero(sign);
+            }
+            
+            leading_zero = true;
+            
+            // Ignore leading zeros in the integer part.
+            while (*current == '0') {
+                ++current;
+                if (current == end) {
+                    *processed_characters_count = current - input;
+                    return SignedZero(sign);
+                }
+            }
+        }
+        
+        // Copy significant digits of the integer part (if any) to the buffer.
+        while (*current >= '0' && *current <= '9') {
+            if (significant_digits < kMaxSignificantDigits) {
+                ASSERT(buffer_pos < kBufferSize);
+                buffer[buffer_pos++] = static_cast<char>(*current);
+                significant_digits++;
+            } else {
+                insignificant_digits++;  // Move the digit into the exponential part.
+                nonzero_digit_dropped = nonzero_digit_dropped || *current != '0';
+            }
+            ++current;
+            if (current == end) goto parsing_done;
+        }
+        
+        if (*current == '.') {
+            ++current;
+            if (current == end) {
+                if (significant_digits == 0 && !leading_zero) {
+                    return 0.0;
+                } else {
+                    goto parsing_done;
+                }
+            }
+            
+            if (significant_digits == 0) {
+                // Integer part consists of 0 or is absent. Significant digits start after
+                // leading zeros (if any).
+                while (*current == '0') {
+                    ++current;
+                    if (current == end) {
+                        *processed_characters_count = current - input;
+                        return SignedZero(sign);
+                    }
+                    exponent--;  // Move this 0 into the exponent.
+                }
+            }
+
+            // There is a fractional part.
+            while (*current >= '0' && *current <= '9') {
+                if (significant_digits < kMaxSignificantDigits) {
+                    ASSERT(buffer_pos < kBufferSize);
+                    buffer[buffer_pos++] = static_cast<char>(*current);
+                    significant_digits++;
+                    exponent--;
+                } else {
+                    // Ignore insignificant digits in the fractional part.
+                    nonzero_digit_dropped = nonzero_digit_dropped || *current != '0';
+                }
+                ++current;
+                if (current == end) goto parsing_done;
+            }
+        }
+        
+        if (!leading_zero && exponent == 0 && significant_digits == 0) {
+            // If leading_zeros is true then the string contains zeros.
+            // If exponent < 0 then string was [+-]\.0*...
+            // If significant_digits != 0 the string is not equal to 0.
+            // Otherwise there are no digits in the string.
+            return 0.0;
+        }
+        
+        // Parse exponential part.
+        if (*current == 'e' || *current == 'E') {
+            ++current;
+            if (current == end) {
+                --current;
+                goto parsing_done;
+            }
+            char sign = 0;
+            if (*current == '+' || *current == '-') {
+                sign = static_cast<char>(*current);
+                ++current;
+                if (current == end) {
+                    current -= 2;
+                    goto parsing_done;
+                }
+            }
+            
+            if (*current < '0' || *current > '9') {
+                if (sign)
+                    --current;
+                --current;
+                goto parsing_done;
+            }
+            
+            const int max_exponent = INT_MAX / 2;
+            ASSERT(-max_exponent / 2 <= exponent && exponent <= max_exponent / 2);
+            int num = 0;
+            do {
+                // Check overflow.
+                int digit = *current - '0';
+                if (num >= max_exponent / 10
+                    && !(num == max_exponent / 10 && digit <= max_exponent % 10)) {
+                    num = max_exponent;
+                } else {
+                    num = num * 10 + digit;
+                }
+                ++current;
+            } while (current != end && *current >= '0' && *current <= '9');
+            
+            exponent += (sign == '-' ? -num : num);
+        }
+        
+    parsing_done:
+        exponent += insignificant_digits;
+        
+        if (nonzero_digit_dropped) {
+            buffer[buffer_pos++] = '1';
+            exponent--;
+        }
+        
+        ASSERT(buffer_pos < kBufferSize);
+        buffer[buffer_pos] = '\0';
+        
+        double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent);
+        *processed_characters_count = current - input;
+        return sign? -converted: converted;
+    }
+    
+}  // namespace double_conversion
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/dtoa/double-conversion.h b/Source/WTF/wtf/dtoa/double-conversion.h
new file mode 100644
index 0000000..eb26e87
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/double-conversion.h
@@ -0,0 +1,377 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
+#define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
+
+#include <wtf/dtoa/utils.h>
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    class DoubleToStringConverter {
+    public:
+        // When calling ToFixed with a double > 10^kMaxFixedDigitsBeforePoint
+        // or a requested_digits parameter > kMaxFixedDigitsAfterPoint then the
+        // function returns false.
+        static const int kMaxFixedDigitsBeforePoint = 60;
+        static const int kMaxFixedDigitsAfterPoint = 60;
+        
+        // When calling ToExponential with a requested_digits
+        // parameter > kMaxExponentialDigits then the function returns false.
+        static const int kMaxExponentialDigits = 120;
+        
+        // When calling ToPrecision with a requested_digits
+        // parameter < kMinPrecisionDigits or requested_digits > kMaxPrecisionDigits
+        // then the function returns false.
+        static const int kMinPrecisionDigits = 1;
+        static const int kMaxPrecisionDigits = 120;
+        
+        enum Flags {
+            NO_FLAGS = 0,
+            EMIT_POSITIVE_EXPONENT_SIGN = 1,
+            EMIT_TRAILING_DECIMAL_POINT = 2,
+            EMIT_TRAILING_ZERO_AFTER_POINT = 4,
+            UNIQUE_ZERO = 8
+        };
+        
+        // Flags should be a bit-or combination of the possible Flags-enum.
+        //  - NO_FLAGS: no special flags.
+        //  - EMIT_POSITIVE_EXPONENT_SIGN: when the number is converted into exponent
+        //    form, emits a '+' for positive exponents. Example: 1.2e+2.
+        //  - EMIT_TRAILING_DECIMAL_POINT: when the input number is an integer and is
+        //    converted into decimal format then a trailing decimal point is appended.
+        //    Example: 2345.0 is converted to "2345.".
+        //  - EMIT_TRAILING_ZERO_AFTER_POINT: in addition to a trailing decimal point
+        //    emits a trailing '0'-character. This flag requires the
+        //    EXMIT_TRAILING_DECIMAL_POINT flag.
+        //    Example: 2345.0 is converted to "2345.0".
+        //  - UNIQUE_ZERO: "-0.0" is converted to "0.0".
+        //
+        // Infinity symbol and nan_symbol provide the string representation for these
+        // special values. If the string is NULL and the special value is encountered
+        // then the conversion functions return false.
+        //
+        // The exponent_character is used in exponential representations. It is
+        // usually 'e' or 'E'.
+        //
+        // When converting to the shortest representation the converter will
+        // represent input numbers in decimal format if they are in the interval
+        // [10^decimal_in_shortest_low; 10^decimal_in_shortest_high[
+        //    (lower boundary included, greater boundary excluded).
+        // Example: with decimal_in_shortest_low = -6 and
+        //               decimal_in_shortest_high = 21:
+        //   ToShortest(0.000001)  -> "0.000001"
+        //   ToShortest(0.0000001) -> "1e-7"
+        //   ToShortest(111111111111111111111.0)  -> "111111111111111110000"
+        //   ToShortest(100000000000000000000.0)  -> "100000000000000000000"
+        //   ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21"
+        //
+        // When converting to precision mode the converter may add
+        // max_leading_padding_zeroes before returning the number in exponential
+        // format.
+        // Example with max_leading_padding_zeroes_in_precision_mode = 6.
+        //   ToPrecision(0.0000012345, 2) -> "0.0000012"
+        //   ToPrecision(0.00000012345, 2) -> "1.2e-7"
+        // Similarily the converter may add up to
+        // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid
+        // returning an exponential representation. A zero added by the
+        // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit.
+        // Examples for max_trailing_padding_zeroes_in_precision_mode = 1:
+        //   ToPrecision(230.0, 2) -> "230"
+        //   ToPrecision(230.0, 2) -> "230."  with EMIT_TRAILING_DECIMAL_POINT.
+        //   ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT.
+        DoubleToStringConverter(int flags,
+                                const char* infinity_symbol,
+                                const char* nan_symbol,
+                                char exponent_character,
+                                int decimal_in_shortest_low,
+                                int decimal_in_shortest_high,
+                                int max_leading_padding_zeroes_in_precision_mode,
+                                int max_trailing_padding_zeroes_in_precision_mode)
+        : flags_(flags),
+        infinity_symbol_(infinity_symbol),
+        nan_symbol_(nan_symbol),
+        exponent_character_(exponent_character),
+        decimal_in_shortest_low_(decimal_in_shortest_low),
+        decimal_in_shortest_high_(decimal_in_shortest_high),
+        max_leading_padding_zeroes_in_precision_mode_(
+                                                      max_leading_padding_zeroes_in_precision_mode),
+        max_trailing_padding_zeroes_in_precision_mode_(
+                                                       max_trailing_padding_zeroes_in_precision_mode) {
+            // When 'trailing zero after the point' is set, then 'trailing point'
+            // must be set too.
+            ASSERT(((flags & EMIT_TRAILING_DECIMAL_POINT) != 0) ||
+                   !((flags & EMIT_TRAILING_ZERO_AFTER_POINT) != 0));
+        }
+        
+        // Returns a converter following the EcmaScript specification.
+        static const DoubleToStringConverter& EcmaScriptConverter();
+        
+        // Computes the shortest string of digits that correctly represent the input
+        // number. Depending on decimal_in_shortest_low and decimal_in_shortest_high
+        // (see constructor) it then either returns a decimal representation, or an
+        // exponential representation.
+        // Example with decimal_in_shortest_low = -6,
+        //              decimal_in_shortest_high = 21,
+        //              EMIT_POSITIVE_EXPONENT_SIGN activated, and
+        //              EMIT_TRAILING_DECIMAL_POINT deactived:
+        //   ToShortest(0.000001)  -> "0.000001"
+        //   ToShortest(0.0000001) -> "1e-7"
+        //   ToShortest(111111111111111111111.0)  -> "111111111111111110000"
+        //   ToShortest(100000000000000000000.0)  -> "100000000000000000000"
+        //   ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21"
+        //
+        // Note: the conversion may round the output if the returned string
+        // is accurate enough to uniquely identify the input-number.
+        // For example the most precise representation of the double 9e59 equals
+        // "899999999999999918767229449717619953810131273674690656206848", but
+        // the converter will return the shorter (but still correct) "9e59".
+        //
+        // Returns true if the conversion succeeds. The conversion always succeeds
+        // except when the input value is special and no infinity_symbol or
+        // nan_symbol has been given to the constructor.
+        bool ToShortest(double value, StringBuilder* result_builder) const;
+        
+        
+        // Computes a decimal representation with a fixed number of digits after the
+        // decimal point. The last emitted digit is rounded.
+        //
+        // Examples:
+        //   ToFixed(3.12, 1) -> "3.1"
+        //   ToFixed(3.1415, 3) -> "3.142"
+        //   ToFixed(1234.56789, 4) -> "1234.5679"
+        //   ToFixed(1.23, 5) -> "1.23000"
+        //   ToFixed(0.1, 4) -> "0.1000"
+        //   ToFixed(1e30, 2) -> "1000000000000000019884624838656.00"
+        //   ToFixed(0.1, 30) -> "0.100000000000000005551115123126"
+        //   ToFixed(0.1, 17) -> "0.10000000000000001"
+        //
+        // If requested_digits equals 0, then the tail of the result depends on
+        // the EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT.
+        // Examples, for requested_digits == 0,
+        //   let EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT be
+        //    - false and false: then 123.45 -> 123
+        //                             0.678 -> 1
+        //    - true and false: then 123.45 -> 123.
+        //                            0.678 -> 1.
+        //    - true and true: then 123.45 -> 123.0
+        //                           0.678 -> 1.0
+        //
+        // Returns true if the conversion succeeds. The conversion always succeeds
+        // except for the following cases:
+        //   - the input value is special and no infinity_symbol or nan_symbol has
+        //     been provided to the constructor,
+        //   - 'value' > 10^kMaxFixedDigitsBeforePoint, or
+        //   - 'requested_digits' > kMaxFixedDigitsAfterPoint.
+        // The last two conditions imply that the result will never contain more than
+        // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters
+        // (one additional character for the sign, and one for the decimal point).
+        bool ToFixed(double value,
+                     int requested_digits,
+                     StringBuilder* result_builder) const;
+        
+        // Computes a representation in exponential format with requested_digits
+        // after the decimal point. The last emitted digit is rounded.
+        // If requested_digits equals -1, then the shortest exponential representation
+        // is computed.
+        //
+        // Examples with EMIT_POSITIVE_EXPONENT_SIGN deactivated, and
+        //               exponent_character set to 'e'.
+        //   ToExponential(3.12, 1) -> "3.1e0"
+        //   ToExponential(5.0, 3) -> "5.000e0"
+        //   ToExponential(0.001, 2) -> "1.00e-3"
+        //   ToExponential(3.1415, -1) -> "3.1415e0"
+        //   ToExponential(3.1415, 4) -> "3.1415e0"
+        //   ToExponential(3.1415, 3) -> "3.142e0"
+        //   ToExponential(123456789000000, 3) -> "1.235e14"
+        //   ToExponential(1000000000000000019884624838656.0, -1) -> "1e30"
+        //   ToExponential(1000000000000000019884624838656.0, 32) ->
+        //                     "1.00000000000000001988462483865600e30"
+        //   ToExponential(1234, 0) -> "1e3"
+        //
+        // Returns true if the conversion succeeds. The conversion always succeeds
+        // except for the following cases:
+        //   - the input value is special and no infinity_symbol or nan_symbol has
+        //     been provided to the constructor,
+        //   - 'requested_digits' > kMaxExponentialDigits.
+        // The last condition implies that the result will never contain more than
+        // kMaxExponentialDigits + 8 characters (the sign, the digit before the
+        // decimal point, the decimal point, the exponent character, the
+        // exponent's sign, and at most 3 exponent digits).
+        bool ToExponential(double value,
+                           int requested_digits,
+                           StringBuilder* result_builder) const;
+        
+        // Computes 'precision' leading digits of the given 'value' and returns them
+        // either in exponential or decimal format, depending on
+        // max_{leading|trailing}_padding_zeroes_in_precision_mode (given to the
+        // constructor).
+        // The last computed digit is rounded.
+        //
+        // Example with max_leading_padding_zeroes_in_precision_mode = 6.
+        //   ToPrecision(0.0000012345, 2) -> "0.0000012"
+        //   ToPrecision(0.00000012345, 2) -> "1.2e-7"
+        // Similarily the converter may add up to
+        // max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid
+        // returning an exponential representation. A zero added by the
+        // EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit.
+        // Examples for max_trailing_padding_zeroes_in_precision_mode = 1:
+        //   ToPrecision(230.0, 2) -> "230"
+        //   ToPrecision(230.0, 2) -> "230."  with EMIT_TRAILING_DECIMAL_POINT.
+        //   ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT.
+        // Examples for max_trailing_padding_zeroes_in_precision_mode = 3, and no
+        //    EMIT_TRAILING_ZERO_AFTER_POINT:
+        //   ToPrecision(123450.0, 6) -> "123450"
+        //   ToPrecision(123450.0, 5) -> "123450"
+        //   ToPrecision(123450.0, 4) -> "123500"
+        //   ToPrecision(123450.0, 3) -> "123000"
+        //   ToPrecision(123450.0, 2) -> "1.2e5"
+        //
+        // Returns true if the conversion succeeds. The conversion always succeeds
+        // except for the following cases:
+        //   - the input value is special and no infinity_symbol or nan_symbol has
+        //     been provided to the constructor,
+        //   - precision < kMinPericisionDigits
+        //   - precision > kMaxPrecisionDigits
+        // The last condition implies that the result will never contain more than
+        // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the
+        // exponent character, the exponent's sign, and at most 3 exponent digits).
+        bool ToPrecision(double value,
+                         int precision,
+                         StringBuilder* result_builder) const;
+        
+        enum DtoaMode {
+            // Produce the shortest correct representation.
+            // For example the output of 0.299999999999999988897 is (the less accurate
+            // but correct) 0.3.
+            SHORTEST,
+            // Produce a fixed number of digits after the decimal point.
+            // For instance fixed(0.1, 4) becomes 0.1000
+            // If the input number is big, the output will be big.
+            FIXED,
+            // Fixed number of digits (independent of the decimal point).
+            PRECISION
+        };
+        
+        // The maximal number of digits that are needed to emit a double in base 10.
+        // A higher precision can be achieved by using more digits, but the shortest
+        // accurate representation of any double will never use more digits than
+        // kBase10MaximalLength.
+        // Note that DoubleToAscii null-terminates its input. So the given buffer
+        // should be at least kBase10MaximalLength + 1 characters long.
+        static const int kBase10MaximalLength = 17;
+        
+        // Converts the given double 'v' to ascii.
+        // The result should be interpreted as buffer * 10^(point-length).
+        //
+        // The output depends on the given mode:
+        //  - SHORTEST: produce the least amount of digits for which the internal
+        //   identity requirement is still satisfied. If the digits are printed
+        //   (together with the correct exponent) then reading this number will give
+        //   'v' again. The buffer will choose the representation that is closest to
+        //   'v'. If there are two at the same distance, than the one farther away
+        //   from 0 is chosen (halfway cases - ending with 5 - are rounded up).
+        //   In this mode the 'requested_digits' parameter is ignored.
+        //  - FIXED: produces digits necessary to print a given number with
+        //   'requested_digits' digits after the decimal point. The produced digits
+        //   might be too short in which case the caller has to fill the remainder
+        //   with '0's.
+        //   Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2.
+        //   Halfway cases are rounded towards +/-Infinity (away from 0). The call
+        //   toFixed(0.15, 2) thus returns buffer="2", point=0.
+        //   The returned buffer may contain digits that would be truncated from the
+        //   shortest representation of the input.
+        //  - PRECISION: produces 'requested_digits' where the first digit is not '0'.
+        //   Even though the length of produced digits usually equals
+        //   'requested_digits', the function is allowed to return fewer digits, in
+        //   which case the caller has to fill the missing digits with '0's.
+        //   Halfway cases are again rounded away from 0.
+        // DoubleToAscii expects the given buffer to be big enough to hold all
+        // digits and a terminating null-character. In SHORTEST-mode it expects a
+        // buffer of at least kBase10MaximalLength + 1. In all other modes the
+        // requested_digits parameter (+ 1 for the null-character) limits the size of
+        // the output. The given length is only used in debug mode to ensure the
+        // buffer is big enough.
+        static void DoubleToAscii(double v,
+                                  DtoaMode mode,
+                                  int requested_digits,
+                                  char* buffer,
+                                  int buffer_length,
+                                  bool* sign,
+                                  int* length,
+                                  int* point);
+        
+    private:
+        // If the value is a special value (NaN or Infinity) constructs the
+        // corresponding string using the configured infinity/nan-symbol.
+        // If either of them is NULL or the value is not special then the
+        // function returns false.
+        bool HandleSpecialValues(double value, StringBuilder* result_builder) const;
+        // Constructs an exponential representation (i.e. 1.234e56).
+        // The given exponent assumes a decimal point after the first decimal digit.
+        void CreateExponentialRepresentation(const char* decimal_digits,
+                                             int length,
+                                             int exponent,
+                                             StringBuilder* result_builder) const;
+        // Creates a decimal representation (i.e 1234.5678).
+        void CreateDecimalRepresentation(const char* decimal_digits,
+                                         int length,
+                                         int decimal_point,
+                                         int digits_after_point,
+                                         StringBuilder* result_builder) const;
+        
+        const int flags_;
+        const char* const infinity_symbol_;
+        const char* const nan_symbol_;
+        const char exponent_character_;
+        const int decimal_in_shortest_low_;
+        const int decimal_in_shortest_high_;
+        const int max_leading_padding_zeroes_in_precision_mode_;
+        const int max_trailing_padding_zeroes_in_precision_mode_;
+        
+        DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter);
+    };
+    
+    
+    class StringToDoubleConverter {
+    public:
+        // Performs the conversion.
+        // The output parameter 'processed_characters_count' is set to the number
+        // of characters that have been processed to read the number.
+        WTF_EXPORT_PRIVATE static double StringToDouble(const char* buffer, size_t length, size_t* processed_characters_count);
+        
+    private:
+        DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter);
+    };
+    
+}  // namespace double_conversion
+
+} // namespace WTF
+
+#endif  // DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
diff --git a/Source/WTF/wtf/dtoa/double.h b/Source/WTF/wtf/dtoa/double.h
new file mode 100644
index 0000000..0544fdb
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/double.h
@@ -0,0 +1,249 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 DOUBLE_CONVERSION_DOUBLE_H_
+#define DOUBLE_CONVERSION_DOUBLE_H_
+
+#include "diy-fp.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    // We assume that doubles and uint64_t have the same endianness.
+    static uint64_t double_to_uint64(double d) { return BitCast<uint64_t>(d); }
+    static double uint64_to_double(uint64_t d64) { return BitCast<double>(d64); }
+    
+    // Helper functions for doubles.
+    class Double {
+    public:
+        static const uint64_t kSignMask = UINT64_2PART_C(0x80000000, 00000000);
+        static const uint64_t kExponentMask = UINT64_2PART_C(0x7FF00000, 00000000);
+        static const uint64_t kSignificandMask = UINT64_2PART_C(0x000FFFFF, FFFFFFFF);
+        static const uint64_t kHiddenBit = UINT64_2PART_C(0x00100000, 00000000);
+        static const int kPhysicalSignificandSize = 52;  // Excludes the hidden bit.
+        static const int kSignificandSize = 53;
+        
+        Double() : d64_(0) {}
+        explicit Double(double d) : d64_(double_to_uint64(d)) {}
+        explicit Double(uint64_t d64) : d64_(d64) {}
+        explicit Double(DiyFp diy_fp)
+        : d64_(DiyFpToUint64(diy_fp)) {}
+        
+        // The value encoded by this Double must be greater or equal to +0.0.
+        // It must not be special (infinity, or NaN).
+        DiyFp AsDiyFp() const {
+            ASSERT(Sign() > 0);
+            ASSERT(!IsSpecial());
+            return DiyFp(Significand(), Exponent());
+        }
+        
+        // The value encoded by this Double must be strictly greater than 0.
+        DiyFp AsNormalizedDiyFp() const {
+            ASSERT(value() > 0.0);
+            uint64_t f = Significand();
+            int e = Exponent();
+            
+            // The current double could be a denormal.
+            while ((f & kHiddenBit) == 0) {
+                f <<= 1;
+                e--;
+            }
+            // Do the final shifts in one go.
+            f <<= DiyFp::kSignificandSize - kSignificandSize;
+            e -= DiyFp::kSignificandSize - kSignificandSize;
+            return DiyFp(f, e);
+        }
+        
+        // Returns the double's bit as uint64.
+        uint64_t AsUint64() const {
+            return d64_;
+        }
+        
+        // Returns the next greater double. Returns +infinity on input +infinity.
+        double NextDouble() const {
+            if (d64_ == kInfinity) return Double(kInfinity).value();
+            if (Sign() < 0 && Significand() == 0) {
+                // -0.0
+                return 0.0;
+            }
+            if (Sign() < 0) {
+                return Double(d64_ - 1).value();
+            } else {
+                return Double(d64_ + 1).value();
+            }
+        }
+        
+        int Exponent() const {
+            if (IsDenormal()) return kDenormalExponent;
+            
+            uint64_t d64 = AsUint64();
+            int biased_e =
+            static_cast<int>((d64 & kExponentMask) >> kPhysicalSignificandSize);
+            return biased_e - kExponentBias;
+        }
+        
+        uint64_t Significand() const {
+            uint64_t d64 = AsUint64();
+            uint64_t significand = d64 & kSignificandMask;
+            if (!IsDenormal()) {
+                return significand + kHiddenBit;
+            } else {
+                return significand;
+            }
+        }
+        
+        // Returns true if the double is a denormal.
+        bool IsDenormal() const {
+            uint64_t d64 = AsUint64();
+            return (d64 & kExponentMask) == 0;
+        }
+        
+        // We consider denormals not to be special.
+        // Hence only Infinity and NaN are special.
+        bool IsSpecial() const {
+            uint64_t d64 = AsUint64();
+            return (d64 & kExponentMask) == kExponentMask;
+        }
+        
+        bool IsNan() const {
+            uint64_t d64 = AsUint64();
+            return ((d64 & kExponentMask) == kExponentMask) &&
+            ((d64 & kSignificandMask) != 0);
+        }
+        
+        bool IsInfinite() const {
+            uint64_t d64 = AsUint64();
+            return ((d64 & kExponentMask) == kExponentMask) &&
+            ((d64 & kSignificandMask) == 0);
+        }
+        
+        int Sign() const {
+            uint64_t d64 = AsUint64();
+            return (d64 & kSignMask) == 0? 1: -1;
+        }
+        
+        // Precondition: the value encoded by this Double must be greater or equal
+        // than +0.0.
+        DiyFp UpperBoundary() const {
+            ASSERT(Sign() > 0);
+            return DiyFp(Significand() * 2 + 1, Exponent() - 1);
+        }
+        
+        // Computes the two boundaries of this.
+        // The bigger boundary (m_plus) is normalized. The lower boundary has the same
+        // exponent as m_plus.
+        // Precondition: the value encoded by this Double must be greater than 0.
+        void NormalizedBoundaries(DiyFp* out_m_minus, DiyFp* out_m_plus) const {
+            ASSERT(value() > 0.0);
+            DiyFp v = this->AsDiyFp();
+            bool significand_is_zero = (v.f() == kHiddenBit);
+            DiyFp m_plus = DiyFp::Normalize(DiyFp((v.f() << 1) + 1, v.e() - 1));
+            DiyFp m_minus;
+            if (significand_is_zero && v.e() != kDenormalExponent) {
+                // The boundary is closer. Think of v = 1000e10 and v- = 9999e9.
+                // Then the boundary (== (v - v-)/2) is not just at a distance of 1e9 but
+                // at a distance of 1e8.
+                // The only exception is for the smallest normal: the largest denormal is
+                // at the same distance as its successor.
+                // Note: denormals have the same exponent as the smallest normals.
+                m_minus = DiyFp((v.f() << 2) - 1, v.e() - 2);
+            } else {
+                m_minus = DiyFp((v.f() << 1) - 1, v.e() - 1);
+            }
+            m_minus.set_f(m_minus.f() << (m_minus.e() - m_plus.e()));
+            m_minus.set_e(m_plus.e());
+            *out_m_plus = m_plus;
+            *out_m_minus = m_minus;
+        }
+        
+        double value() const { return uint64_to_double(d64_); }
+        
+        // Returns the significand size for a given order of magnitude.
+        // If v = f*2^e with 2^p-1 <= f <= 2^p then p+e is v's order of magnitude.
+        // This function returns the number of significant binary digits v will have
+        // once it's encoded into a double. In almost all cases this is equal to
+        // kSignificandSize. The only exceptions are denormals. They start with
+        // leading zeroes and their effective significand-size is hence smaller.
+        static int SignificandSizeForOrderOfMagnitude(int order) {
+            if (order >= (kDenormalExponent + kSignificandSize)) {
+                return kSignificandSize;
+            }
+            if (order <= kDenormalExponent) return 0;
+            return order - kDenormalExponent;
+        }
+        
+        static double Infinity() {
+            return Double(kInfinity).value();
+        }
+        
+        static double NaN() {
+            return Double(kNaN).value();
+        }
+        
+    private:
+        static const int kExponentBias = 0x3FF + kPhysicalSignificandSize;
+        static const int kDenormalExponent = -kExponentBias + 1;
+        static const int kMaxExponent = 0x7FF - kExponentBias;
+        static const uint64_t kInfinity = UINT64_2PART_C(0x7FF00000, 00000000);
+        static const uint64_t kNaN = UINT64_2PART_C(0x7FF80000, 00000000);
+        
+        const uint64_t d64_;
+        
+        static uint64_t DiyFpToUint64(DiyFp diy_fp) {
+            uint64_t significand = diy_fp.f();
+            int exponent = diy_fp.e();
+            while (significand > kHiddenBit + kSignificandMask) {
+                significand >>= 1;
+                exponent++;
+            }
+            if (exponent >= kMaxExponent) {
+                return kInfinity;
+            }
+            if (exponent < kDenormalExponent) {
+                return 0;
+            }
+            while (exponent > kDenormalExponent && (significand & kHiddenBit) == 0) {
+                significand <<= 1;
+                exponent--;
+            }
+            uint64_t biased_exponent;
+            if (exponent == kDenormalExponent && (significand & kHiddenBit) == 0) {
+                biased_exponent = 0;
+            } else {
+                biased_exponent = static_cast<uint64_t>(exponent + kExponentBias);
+            }
+            return (significand & kSignificandMask) |
+            (biased_exponent << kPhysicalSignificandSize);
+        }
+    };
+    
+}  // namespace double_conversion
+
+} // namespace WTF
+
+#endif  // DOUBLE_CONVERSION_DOUBLE_H_
diff --git a/Source/WTF/wtf/dtoa/fast-dtoa.cc b/Source/WTF/wtf/dtoa/fast-dtoa.cc
new file mode 100644
index 0000000..9d98724
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/fast-dtoa.cc
@@ -0,0 +1,741 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 "fast-dtoa.h"
+
+#include "cached-powers.h"
+#include "diy-fp.h"
+#include "double.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    // The minimal and maximal target exponent define the range of w's binary
+    // exponent, where 'w' is the result of multiplying the input by a cached power
+    // of ten.
+    //
+    // A different range might be chosen on a different platform, to optimize digit
+    // generation, but a smaller range requires more powers of ten to be cached.
+    static const int kMinimalTargetExponent = -60;
+    static const int kMaximalTargetExponent = -32;
+    
+    
+    // Adjusts the last digit of the generated number, and screens out generated
+    // solutions that may be inaccurate. A solution may be inaccurate if it is
+    // outside the safe interval, or if we cannot prove that it is closer to the
+    // input than a neighboring representation of the same length.
+    //
+    // Input: * buffer containing the digits of too_high / 10^kappa
+    //        * the buffer's length
+    //        * distance_too_high_w == (too_high - w).f() * unit
+    //        * unsafe_interval == (too_high - too_low).f() * unit
+    //        * rest = (too_high - buffer * 10^kappa).f() * unit
+    //        * ten_kappa = 10^kappa * unit
+    //        * unit = the common multiplier
+    // Output: returns true if the buffer is guaranteed to contain the closest
+    //    representable number to the input.
+    //  Modifies the generated digits in the buffer to approach (round towards) w.
+    static bool RoundWeed(Vector<char> buffer,
+                          int length,
+                          uint64_t distance_too_high_w,
+                          uint64_t unsafe_interval,
+                          uint64_t rest,
+                          uint64_t ten_kappa,
+                          uint64_t unit) {
+        uint64_t small_distance = distance_too_high_w - unit;
+        uint64_t big_distance = distance_too_high_w + unit;
+        // Let w_low  = too_high - big_distance, and
+        //     w_high = too_high - small_distance.
+        // Note: w_low < w < w_high
+        //
+        // The real w (* unit) must lie somewhere inside the interval
+        // ]w_low; w_high[ (often written as "(w_low; w_high)")
+        
+        // Basically the buffer currently contains a number in the unsafe interval
+        // ]too_low; too_high[ with too_low < w < too_high
+        //
+        //  too_high - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+        //                     ^v 1 unit            ^      ^                 ^      ^
+        //  boundary_high ---------------------     .      .                 .      .
+        //                     ^v 1 unit            .      .                 .      .
+        //   - - - - - - - - - - - - - - - - - - -  +  - - + - - - - - -     .      .
+        //                                          .      .         ^       .      .
+        //                                          .  big_distance  .       .      .
+        //                                          .      .         .       .    rest
+        //                              small_distance     .         .       .      .
+        //                                          v      .         .       .      .
+        //  w_high - - - - - - - - - - - - - - - - - -     .         .       .      .
+        //                     ^v 1 unit                   .         .       .      .
+        //  w ----------------------------------------     .         .       .      .
+        //                     ^v 1 unit                   v         .       .      .
+        //  w_low  - - - - - - - - - - - - - - - - - - - - -         .       .      .
+        //                                                           .       .      v
+        //  buffer --------------------------------------------------+-------+--------
+        //                                                           .       .
+        //                                                  safe_interval    .
+        //                                                           v       .
+        //   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -     .
+        //                     ^v 1 unit                                     .
+        //  boundary_low -------------------------                     unsafe_interval
+        //                     ^v 1 unit                                     v
+        //  too_low  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+        //
+        //
+        // Note that the value of buffer could lie anywhere inside the range too_low
+        // to too_high.
+        //
+        // boundary_low, boundary_high and w are approximations of the real boundaries
+        // and v (the input number). They are guaranteed to be precise up to one unit.
+        // In fact the error is guaranteed to be strictly less than one unit.
+        //
+        // Anything that lies outside the unsafe interval is guaranteed not to round
+        // to v when read again.
+        // Anything that lies inside the safe interval is guaranteed to round to v
+        // when read again.
+        // If the number inside the buffer lies inside the unsafe interval but not
+        // inside the safe interval then we simply do not know and bail out (returning
+        // false).
+        //
+        // Similarly we have to take into account the imprecision of 'w' when finding
+        // the closest representation of 'w'. If we have two potential
+        // representations, and one is closer to both w_low and w_high, then we know
+        // it is closer to the actual value v.
+        //
+        // By generating the digits of too_high we got the largest (closest to
+        // too_high) buffer that is still in the unsafe interval. In the case where
+        // w_high < buffer < too_high we try to decrement the buffer.
+        // This way the buffer approaches (rounds towards) w.
+        // There are 3 conditions that stop the decrementation process:
+        //   1) the buffer is already below w_high
+        //   2) decrementing the buffer would make it leave the unsafe interval
+        //   3) decrementing the buffer would yield a number below w_high and farther
+        //      away than the current number. In other words:
+        //              (buffer{-1} < w_high) && w_high - buffer{-1} > buffer - w_high
+        // Instead of using the buffer directly we use its distance to too_high.
+        // Conceptually rest ~= too_high - buffer
+        // We need to do the following tests in this order to avoid over- and
+        // underflows.
+        ASSERT(rest <= unsafe_interval);
+        while (rest < small_distance &&  // Negated condition 1
+               unsafe_interval - rest >= ten_kappa &&  // Negated condition 2
+               (rest + ten_kappa < small_distance ||  // buffer{-1} > w_high
+                small_distance - rest >= rest + ten_kappa - small_distance)) {
+                   buffer[length - 1]--;
+                   rest += ten_kappa;
+               }
+        
+        // We have approached w+ as much as possible. We now test if approaching w-
+        // would require changing the buffer. If yes, then we have two possible
+        // representations close to w, but we cannot decide which one is closer.
+        if (rest < big_distance &&
+            unsafe_interval - rest >= ten_kappa &&
+            (rest + ten_kappa < big_distance ||
+             big_distance - rest > rest + ten_kappa - big_distance)) {
+                return false;
+            }
+        
+        // Weeding test.
+        //   The safe interval is [too_low + 2 ulp; too_high - 2 ulp]
+        //   Since too_low = too_high - unsafe_interval this is equivalent to
+        //      [too_high - unsafe_interval + 4 ulp; too_high - 2 ulp]
+        //   Conceptually we have: rest ~= too_high - buffer
+        return (2 * unit <= rest) && (rest <= unsafe_interval - 4 * unit);
+    }
+    
+    
+    // Rounds the buffer upwards if the result is closer to v by possibly adding
+    // 1 to the buffer. If the precision of the calculation is not sufficient to
+    // round correctly, return false.
+    // The rounding might shift the whole buffer in which case the kappa is
+    // adjusted. For example "99", kappa = 3 might become "10", kappa = 4.
+    //
+    // If 2*rest > ten_kappa then the buffer needs to be round up.
+    // rest can have an error of +/- 1 unit. This function accounts for the
+    // imprecision and returns false, if the rounding direction cannot be
+    // unambiguously determined.
+    //
+    // Precondition: rest < ten_kappa.
+    static bool RoundWeedCounted(Vector<char> buffer,
+                                 int length,
+                                 uint64_t rest,
+                                 uint64_t ten_kappa,
+                                 uint64_t unit,
+                                 int* kappa) {
+        ASSERT(rest < ten_kappa);
+        // The following tests are done in a specific order to avoid overflows. They
+        // will work correctly with any uint64 values of rest < ten_kappa and unit.
+        //
+        // If the unit is too big, then we don't know which way to round. For example
+        // a unit of 50 means that the real number lies within rest +/- 50. If
+        // 10^kappa == 40 then there is no way to tell which way to round.
+        if (unit >= ten_kappa) return false;
+        // Even if unit is just half the size of 10^kappa we are already completely
+        // lost. (And after the previous test we know that the expression will not
+        // over/underflow.)
+        if (ten_kappa - unit <= unit) return false;
+        // If 2 * (rest + unit) <= 10^kappa we can safely round down.
+        if ((ten_kappa - rest > rest) && (ten_kappa - 2 * rest >= 2 * unit)) {
+            return true;
+        }
+        // If 2 * (rest - unit) >= 10^kappa, then we can safely round up.
+        if ((rest > unit) && (ten_kappa - (rest - unit) <= (rest - unit))) {
+            // Increment the last digit recursively until we find a non '9' digit.
+            buffer[length - 1]++;
+            for (int i = length - 1; i > 0; --i) {
+                if (buffer[i] != '0' + 10) break;
+                buffer[i] = '0';
+                buffer[i - 1]++;
+            }
+            // If the first digit is now '0'+ 10 we had a buffer with all '9's. With the
+            // exception of the first digit all digits are now '0'. Simply switch the
+            // first digit to '1' and adjust the kappa. Example: "99" becomes "10" and
+            // the power (the kappa) is increased.
+            if (buffer[0] == '0' + 10) {
+                buffer[0] = '1';
+                (*kappa) += 1;
+            }
+            return true;
+        }
+        return false;
+    }
+    
+    
+    static const uint32_t kTen4 = 10000;
+    static const uint32_t kTen5 = 100000;
+    static const uint32_t kTen6 = 1000000;
+    static const uint32_t kTen7 = 10000000;
+    static const uint32_t kTen8 = 100000000;
+    static const uint32_t kTen9 = 1000000000;
+    
+    // Returns the biggest power of ten that is less than or equal to the given
+    // number. We furthermore receive the maximum number of bits 'number' has.
+    // If number_bits == 0 then 0^-1 is returned
+    // The number of bits must be <= 32.
+    // Precondition: number < (1 << (number_bits + 1)).
+    static void BiggestPowerTen(uint32_t number,
+                                int number_bits,
+                                uint32_t* power,
+                                int* exponent) {
+        ASSERT(number < (uint32_t)(1 << (number_bits + 1)));
+        
+        switch (number_bits) {
+            case 32:
+            case 31:
+            case 30:
+                if (kTen9 <= number) {
+                    *power = kTen9;
+                    *exponent = 9;
+                    break;
+                }  // else fallthrough
+            case 29:
+            case 28:
+            case 27:
+                if (kTen8 <= number) {
+                    *power = kTen8;
+                    *exponent = 8;
+                    break;
+                }  // else fallthrough
+            case 26:
+            case 25:
+            case 24:
+                if (kTen7 <= number) {
+                    *power = kTen7;
+                    *exponent = 7;
+                    break;
+                }  // else fallthrough
+            case 23:
+            case 22:
+            case 21:
+            case 20:
+                if (kTen6 <= number) {
+                    *power = kTen6;
+                    *exponent = 6;
+                    break;
+                }  // else fallthrough
+            case 19:
+            case 18:
+            case 17:
+                if (kTen5 <= number) {
+                    *power = kTen5;
+                    *exponent = 5;
+                    break;
+                }  // else fallthrough
+            case 16:
+            case 15:
+            case 14:
+                if (kTen4 <= number) {
+                    *power = kTen4;
+                    *exponent = 4;
+                    break;
+                }  // else fallthrough
+            case 13:
+            case 12:
+            case 11:
+            case 10:
+                if (1000 <= number) {
+                    *power = 1000;
+                    *exponent = 3;
+                    break;
+                }  // else fallthrough
+            case 9:
+            case 8:
+            case 7:
+                if (100 <= number) {
+                    *power = 100;
+                    *exponent = 2;
+                    break;
+                }  // else fallthrough
+            case 6:
+            case 5:
+            case 4:
+                if (10 <= number) {
+                    *power = 10;
+                    *exponent = 1;
+                    break;
+                }  // else fallthrough
+            case 3:
+            case 2:
+            case 1:
+                if (1 <= number) {
+                    *power = 1;
+                    *exponent = 0;
+                    break;
+                }  // else fallthrough
+            case 0:
+                *power = 0;
+                *exponent = -1;
+                break;
+            default:
+                // Following assignments are here to silence compiler warnings.
+                *power = 0;
+                *exponent = 0;
+                UNREACHABLE();
+        }
+    }
+    
+    
+    // Generates the digits of input number w.
+    // w is a floating-point number (DiyFp), consisting of a significand and an
+    // exponent. Its exponent is bounded by kMinimalTargetExponent and
+    // kMaximalTargetExponent.
+    //       Hence -60 <= w.e() <= -32.
+    //
+    // Returns false if it fails, in which case the generated digits in the buffer
+    // should not be used.
+    // Preconditions:
+    //  * low, w and high are correct up to 1 ulp (unit in the last place). That
+    //    is, their error must be less than a unit of their last digits.
+    //  * low.e() == w.e() == high.e()
+    //  * low < w < high, and taking into account their error: low~ <= high~
+    //  * kMinimalTargetExponent <= w.e() <= kMaximalTargetExponent
+    // Postconditions: returns false if procedure fails.
+    //   otherwise:
+    //     * buffer is not null-terminated, but len contains the number of digits.
+    //     * buffer contains the shortest possible decimal digit-sequence
+    //       such that LOW < buffer * 10^kappa < HIGH, where LOW and HIGH are the
+    //       correct values of low and high (without their error).
+    //     * if more than one decimal representation gives the minimal number of
+    //       decimal digits then the one closest to W (where W is the correct value
+    //       of w) is chosen.
+    // Remark: this procedure takes into account the imprecision of its input
+    //   numbers. If the precision is not enough to guarantee all the postconditions
+    //   then false is returned. This usually happens rarely (~0.5%).
+    //
+    // Say, for the sake of example, that
+    //   w.e() == -48, and w.f() == 0x1234567890abcdef
+    // w's value can be computed by w.f() * 2^w.e()
+    // We can obtain w's integral digits by simply shifting w.f() by -w.e().
+    //  -> w's integral part is 0x1234
+    //  w's fractional part is therefore 0x567890abcdef.
+    // Printing w's integral part is easy (simply print 0x1234 in decimal).
+    // In order to print its fraction we repeatedly multiply the fraction by 10 and
+    // get each digit. Example the first digit after the point would be computed by
+    //   (0x567890abcdef * 10) >> 48. -> 3
+    // The whole thing becomes slightly more complicated because we want to stop
+    // once we have enough digits. That is, once the digits inside the buffer
+    // represent 'w' we can stop. Everything inside the interval low - high
+    // represents w. However we have to pay attention to low, high and w's
+    // imprecision.
+    static bool DigitGen(DiyFp low,
+                         DiyFp w,
+                         DiyFp high,
+                         Vector<char> buffer,
+                         int* length,
+                         int* kappa) {
+        ASSERT(low.e() == w.e() && w.e() == high.e());
+        ASSERT(low.f() + 1 <= high.f() - 1);
+        ASSERT(kMinimalTargetExponent <= w.e() && w.e() <= kMaximalTargetExponent);
+        // low, w and high are imprecise, but by less than one ulp (unit in the last
+        // place).
+        // If we remove (resp. add) 1 ulp from low (resp. high) we are certain that
+        // the new numbers are outside of the interval we want the final
+        // representation to lie in.
+        // Inversely adding (resp. removing) 1 ulp from low (resp. high) would yield
+        // numbers that are certain to lie in the interval. We will use this fact
+        // later on.
+        // We will now start by generating the digits within the uncertain
+        // interval. Later we will weed out representations that lie outside the safe
+        // interval and thus _might_ lie outside the correct interval.
+        uint64_t unit = 1;
+        DiyFp too_low = DiyFp(low.f() - unit, low.e());
+        DiyFp too_high = DiyFp(high.f() + unit, high.e());
+        // too_low and too_high are guaranteed to lie outside the interval we want the
+        // generated number in.
+        DiyFp unsafe_interval = DiyFp::Minus(too_high, too_low);
+        // We now cut the input number into two parts: the integral digits and the
+        // fractionals. We will not write any decimal separator though, but adapt
+        // kappa instead.
+        // Reminder: we are currently computing the digits (stored inside the buffer)
+        // such that:   too_low < buffer * 10^kappa < too_high
+        // We use too_high for the digit_generation and stop as soon as possible.
+        // If we stop early we effectively round down.
+        DiyFp one = DiyFp(static_cast<uint64_t>(1) << -w.e(), w.e());
+        // Division by one is a shift.
+        uint32_t integrals = static_cast<uint32_t>(too_high.f() >> -one.e());
+        // Modulo by one is an and.
+        uint64_t fractionals = too_high.f() & (one.f() - 1);
+        uint32_t divisor;
+        int divisor_exponent;
+        BiggestPowerTen(integrals, DiyFp::kSignificandSize - (-one.e()),
+                        &divisor, &divisor_exponent);
+        *kappa = divisor_exponent + 1;
+        *length = 0;
+        // Loop invariant: buffer = too_high / 10^kappa  (integer division)
+        // The invariant holds for the first iteration: kappa has been initialized
+        // with the divisor exponent + 1. And the divisor is the biggest power of ten
+        // that is smaller than integrals.
+        while (*kappa > 0) {
+            int digit = integrals / divisor;
+            buffer[*length] = '0' + digit;
+            (*length)++;
+            integrals %= divisor;
+            (*kappa)--;
+            // Note that kappa now equals the exponent of the divisor and that the
+            // invariant thus holds again.
+            uint64_t rest =
+            (static_cast<uint64_t>(integrals) << -one.e()) + fractionals;
+            // Invariant: too_high = buffer * 10^kappa + DiyFp(rest, one.e())
+            // Reminder: unsafe_interval.e() == one.e()
+            if (rest < unsafe_interval.f()) {
+                // Rounding down (by not emitting the remaining digits) yields a number
+                // that lies within the unsafe interval.
+                return RoundWeed(buffer, *length, DiyFp::Minus(too_high, w).f(),
+                                 unsafe_interval.f(), rest,
+                                 static_cast<uint64_t>(divisor) << -one.e(), unit);
+            }
+            divisor /= 10;
+        }
+        
+        // The integrals have been generated. We are at the point of the decimal
+        // separator. In the following loop we simply multiply the remaining digits by
+        // 10 and divide by one. We just need to pay attention to multiply associated
+        // data (like the interval or 'unit'), too.
+        // Note that the multiplication by 10 does not overflow, because w.e >= -60
+        // and thus one.e >= -60.
+        ASSERT(one.e() >= -60);
+        ASSERT(fractionals < one.f());
+        ASSERT(UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF) / 10 >= one.f());
+        while (true) {
+            fractionals *= 10;
+            unit *= 10;
+            unsafe_interval.set_f(unsafe_interval.f() * 10);
+            // Integer division by one.
+            int digit = static_cast<int>(fractionals >> -one.e());
+            buffer[*length] = '0' + digit;
+            (*length)++;
+            fractionals &= one.f() - 1;  // Modulo by one.
+            (*kappa)--;
+            if (fractionals < unsafe_interval.f()) {
+                return RoundWeed(buffer, *length, DiyFp::Minus(too_high, w).f() * unit,
+                                 unsafe_interval.f(), fractionals, one.f(), unit);
+            }
+        }
+    }
+    
+    
+    
+    // Generates (at most) requested_digits digits of input number w.
+    // w is a floating-point number (DiyFp), consisting of a significand and an
+    // exponent. Its exponent is bounded by kMinimalTargetExponent and
+    // kMaximalTargetExponent.
+    //       Hence -60 <= w.e() <= -32.
+    //
+    // Returns false if it fails, in which case the generated digits in the buffer
+    // should not be used.
+    // Preconditions:
+    //  * w is correct up to 1 ulp (unit in the last place). That
+    //    is, its error must be strictly less than a unit of its last digit.
+    //  * kMinimalTargetExponent <= w.e() <= kMaximalTargetExponent
+    //
+    // Postconditions: returns false if procedure fails.
+    //   otherwise:
+    //     * buffer is not null-terminated, but length contains the number of
+    //       digits.
+    //     * the representation in buffer is the most precise representation of
+    //       requested_digits digits.
+    //     * buffer contains at most requested_digits digits of w. If there are less
+    //       than requested_digits digits then some trailing '0's have been removed.
+    //     * kappa is such that
+    //            w = buffer * 10^kappa + eps with |eps| < 10^kappa / 2.
+    //
+    // Remark: This procedure takes into account the imprecision of its input
+    //   numbers. If the precision is not enough to guarantee all the postconditions
+    //   then false is returned. This usually happens rarely, but the failure-rate
+    //   increases with higher requested_digits.
+    static bool DigitGenCounted(DiyFp w,
+                                int requested_digits,
+                                Vector<char> buffer,
+                                int* length,
+                                int* kappa) {
+        ASSERT(kMinimalTargetExponent <= w.e() && w.e() <= kMaximalTargetExponent);
+        ASSERT(kMinimalTargetExponent >= -60);
+        ASSERT(kMaximalTargetExponent <= -32);
+        // w is assumed to have an error less than 1 unit. Whenever w is scaled we
+        // also scale its error.
+        uint64_t w_error = 1;
+        // We cut the input number into two parts: the integral digits and the
+        // fractional digits. We don't emit any decimal separator, but adapt kappa
+        // instead. Example: instead of writing "1.2" we put "12" into the buffer and
+        // increase kappa by 1.
+        DiyFp one = DiyFp(static_cast<uint64_t>(1) << -w.e(), w.e());
+        // Division by one is a shift.
+        uint32_t integrals = static_cast<uint32_t>(w.f() >> -one.e());
+        // Modulo by one is an and.
+        uint64_t fractionals = w.f() & (one.f() - 1);
+        uint32_t divisor;
+        int divisor_exponent;
+        BiggestPowerTen(integrals, DiyFp::kSignificandSize - (-one.e()),
+                        &divisor, &divisor_exponent);
+        *kappa = divisor_exponent + 1;
+        *length = 0;
+        
+        // Loop invariant: buffer = w / 10^kappa  (integer division)
+        // The invariant holds for the first iteration: kappa has been initialized
+        // with the divisor exponent + 1. And the divisor is the biggest power of ten
+        // that is smaller than 'integrals'.
+        while (*kappa > 0) {
+            int digit = integrals / divisor;
+            buffer[*length] = '0' + digit;
+            (*length)++;
+            requested_digits--;
+            integrals %= divisor;
+            (*kappa)--;
+            // Note that kappa now equals the exponent of the divisor and that the
+            // invariant thus holds again.
+            if (requested_digits == 0) break;
+            divisor /= 10;
+        }
+        
+        if (requested_digits == 0) {
+            uint64_t rest =
+            (static_cast<uint64_t>(integrals) << -one.e()) + fractionals;
+            return RoundWeedCounted(buffer, *length, rest,
+                                    static_cast<uint64_t>(divisor) << -one.e(), w_error,
+                                    kappa);
+        }
+        
+        // The integrals have been generated. We are at the point of the decimal
+        // separator. In the following loop we simply multiply the remaining digits by
+        // 10 and divide by one. We just need to pay attention to multiply associated
+        // data (the 'unit'), too.
+        // Note that the multiplication by 10 does not overflow, because w.e >= -60
+        // and thus one.e >= -60.
+        ASSERT(one.e() >= -60);
+        ASSERT(fractionals < one.f());
+        ASSERT(UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF) / 10 >= one.f());
+        while (requested_digits > 0 && fractionals > w_error) {
+            fractionals *= 10;
+            w_error *= 10;
+            // Integer division by one.
+            int digit = static_cast<int>(fractionals >> -one.e());
+            buffer[*length] = '0' + digit;
+            (*length)++;
+            requested_digits--;
+            fractionals &= one.f() - 1;  // Modulo by one.
+            (*kappa)--;
+        }
+        if (requested_digits != 0) return false;
+        return RoundWeedCounted(buffer, *length, fractionals, one.f(), w_error,
+                                kappa);
+    }
+    
+    
+    // Provides a decimal representation of v.
+    // Returns true if it succeeds, otherwise the result cannot be trusted.
+    // There will be *length digits inside the buffer (not null-terminated).
+    // If the function returns true then
+    //        v == (double) (buffer * 10^decimal_exponent).
+    // The digits in the buffer are the shortest representation possible: no
+    // 0.09999999999999999 instead of 0.1. The shorter representation will even be
+    // chosen even if the longer one would be closer to v.
+    // The last digit will be closest to the actual v. That is, even if several
+    // digits might correctly yield 'v' when read again, the closest will be
+    // computed.
+    static bool Grisu3(double v,
+                       Vector<char> buffer,
+                       int* length,
+                       int* decimal_exponent) {
+        DiyFp w = Double(v).AsNormalizedDiyFp();
+        // boundary_minus and boundary_plus are the boundaries between v and its
+        // closest floating-point neighbors. Any number strictly between
+        // boundary_minus and boundary_plus will round to v when convert to a double.
+        // Grisu3 will never output representations that lie exactly on a boundary.
+        DiyFp boundary_minus, boundary_plus;
+        Double(v).NormalizedBoundaries(&boundary_minus, &boundary_plus);
+        ASSERT(boundary_plus.e() == w.e());
+        DiyFp ten_mk;  // Cached power of ten: 10^-k
+        int mk;        // -k
+        int ten_mk_minimal_binary_exponent =
+        kMinimalTargetExponent - (w.e() + DiyFp::kSignificandSize);
+        int ten_mk_maximal_binary_exponent =
+        kMaximalTargetExponent - (w.e() + DiyFp::kSignificandSize);
+        PowersOfTenCache::GetCachedPowerForBinaryExponentRange(
+                                                               ten_mk_minimal_binary_exponent,
+                                                               ten_mk_maximal_binary_exponent,
+                                                               &ten_mk, &mk);
+        ASSERT((kMinimalTargetExponent <= w.e() + ten_mk.e() +
+                DiyFp::kSignificandSize) &&
+               (kMaximalTargetExponent >= w.e() + ten_mk.e() +
+                DiyFp::kSignificandSize));
+        // Note that ten_mk is only an approximation of 10^-k. A DiyFp only contains a
+        // 64 bit significand and ten_mk is thus only precise up to 64 bits.
+        
+        // The DiyFp::Times procedure rounds its result, and ten_mk is approximated
+        // too. The variable scaled_w (as well as scaled_boundary_minus/plus) are now
+        // off by a small amount.
+        // In fact: scaled_w - w*10^k < 1ulp (unit in the last place) of scaled_w.
+        // In other words: let f = scaled_w.f() and e = scaled_w.e(), then
+        //           (f-1) * 2^e < w*10^k < (f+1) * 2^e
+        DiyFp scaled_w = DiyFp::Times(w, ten_mk);
+        ASSERT(scaled_w.e() ==
+               boundary_plus.e() + ten_mk.e() + DiyFp::kSignificandSize);
+        // In theory it would be possible to avoid some recomputations by computing
+        // the difference between w and boundary_minus/plus (a power of 2) and to
+        // compute scaled_boundary_minus/plus by subtracting/adding from
+        // scaled_w. However the code becomes much less readable and the speed
+        // enhancements are not terriffic.
+        DiyFp scaled_boundary_minus = DiyFp::Times(boundary_minus, ten_mk);
+        DiyFp scaled_boundary_plus  = DiyFp::Times(boundary_plus,  ten_mk);
+        
+        // DigitGen will generate the digits of scaled_w. Therefore we have
+        // v == (double) (scaled_w * 10^-mk).
+        // Set decimal_exponent == -mk and pass it to DigitGen. If scaled_w is not an
+        // integer than it will be updated. For instance if scaled_w == 1.23 then
+        // the buffer will be filled with "123" und the decimal_exponent will be
+        // decreased by 2.
+        int kappa;
+        bool result = DigitGen(scaled_boundary_minus, scaled_w, scaled_boundary_plus,
+                               buffer, length, &kappa);
+        *decimal_exponent = -mk + kappa;
+        return result;
+    }
+    
+    
+    // The "counted" version of grisu3 (see above) only generates requested_digits
+    // number of digits. This version does not generate the shortest representation,
+    // and with enough requested digits 0.1 will at some point print as 0.9999999...
+    // Grisu3 is too imprecise for real halfway cases (1.5 will not work) and
+    // therefore the rounding strategy for halfway cases is irrelevant.
+    static bool Grisu3Counted(double v,
+                              int requested_digits,
+                              Vector<char> buffer,
+                              int* length,
+                              int* decimal_exponent) {
+        DiyFp w = Double(v).AsNormalizedDiyFp();
+        DiyFp ten_mk;  // Cached power of ten: 10^-k
+        int mk;        // -k
+        int ten_mk_minimal_binary_exponent =
+        kMinimalTargetExponent - (w.e() + DiyFp::kSignificandSize);
+        int ten_mk_maximal_binary_exponent =
+        kMaximalTargetExponent - (w.e() + DiyFp::kSignificandSize);
+        PowersOfTenCache::GetCachedPowerForBinaryExponentRange(
+                                                               ten_mk_minimal_binary_exponent,
+                                                               ten_mk_maximal_binary_exponent,
+                                                               &ten_mk, &mk);
+        ASSERT((kMinimalTargetExponent <= w.e() + ten_mk.e() +
+                DiyFp::kSignificandSize) &&
+               (kMaximalTargetExponent >= w.e() + ten_mk.e() +
+                DiyFp::kSignificandSize));
+        // Note that ten_mk is only an approximation of 10^-k. A DiyFp only contains a
+        // 64 bit significand and ten_mk is thus only precise up to 64 bits.
+        
+        // The DiyFp::Times procedure rounds its result, and ten_mk is approximated
+        // too. The variable scaled_w (as well as scaled_boundary_minus/plus) are now
+        // off by a small amount.
+        // In fact: scaled_w - w*10^k < 1ulp (unit in the last place) of scaled_w.
+        // In other words: let f = scaled_w.f() and e = scaled_w.e(), then
+        //           (f-1) * 2^e < w*10^k < (f+1) * 2^e
+        DiyFp scaled_w = DiyFp::Times(w, ten_mk);
+        
+        // We now have (double) (scaled_w * 10^-mk).
+        // DigitGen will generate the first requested_digits digits of scaled_w and
+        // return together with a kappa such that scaled_w ~= buffer * 10^kappa. (It
+        // will not always be exactly the same since DigitGenCounted only produces a
+        // limited number of digits.)
+        int kappa;
+        bool result = DigitGenCounted(scaled_w, requested_digits,
+                                      buffer, length, &kappa);
+        *decimal_exponent = -mk + kappa;
+        return result;
+    }
+    
+    
+    bool FastDtoa(double v,
+                  FastDtoaMode mode,
+                  int requested_digits,
+                  Vector<char> buffer,
+                  int* length,
+                  int* decimal_point) {
+        ASSERT(v > 0);
+        ASSERT(!Double(v).IsSpecial());
+        
+        bool result = false;
+        int decimal_exponent = 0;
+        switch (mode) {
+            case FAST_DTOA_SHORTEST:
+                result = Grisu3(v, buffer, length, &decimal_exponent);
+                break;
+            case FAST_DTOA_PRECISION:
+                result = Grisu3Counted(v, requested_digits,
+                                       buffer, length, &decimal_exponent);
+                break;
+            default:
+                UNREACHABLE();
+        }
+        if (result) {
+            *decimal_point = *length + decimal_exponent;
+            buffer[*length] = '\0';
+        }
+        return result;
+    }
+    
+}  // namespace double_conversion
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/dtoa/fast-dtoa.h b/Source/WTF/wtf/dtoa/fast-dtoa.h
new file mode 100644
index 0000000..876a9f3
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/fast-dtoa.h
@@ -0,0 +1,88 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 DOUBLE_CONVERSION_FAST_DTOA_H_
+#define DOUBLE_CONVERSION_FAST_DTOA_H_
+
+#include "utils.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    enum FastDtoaMode {
+        // Computes the shortest representation of the given input. The returned
+        // result will be the most accurate number of this length. Longer
+        // representations might be more accurate.
+        FAST_DTOA_SHORTEST,
+        // Computes a representation where the precision (number of digits) is
+        // given as input. The precision is independent of the decimal point.
+        FAST_DTOA_PRECISION
+    };
+    
+    // FastDtoa will produce at most kFastDtoaMaximalLength digits. This does not
+    // include the terminating '\0' character.
+    static const int kFastDtoaMaximalLength = 17;
+    
+    // Provides a decimal representation of v.
+    // The result should be interpreted as buffer * 10^(point - length).
+    //
+    // Precondition:
+    //   * v must be a strictly positive finite double.
+    //
+    // Returns true if it succeeds, otherwise the result can not be trusted.
+    // There will be *length digits inside the buffer followed by a null terminator.
+    // If the function returns true and mode equals
+    //   - FAST_DTOA_SHORTEST, then
+    //     the parameter requested_digits is ignored.
+    //     The result satisfies
+    //         v == (double) (buffer * 10^(point - length)).
+    //     The digits in the buffer are the shortest representation possible. E.g.
+    //     if 0.099999999999 and 0.1 represent the same double then "1" is returned
+    //     with point = 0.
+    //     The last digit will be closest to the actual v. That is, even if several
+    //     digits might correctly yield 'v' when read again, the buffer will contain
+    //     the one closest to v.
+    //   - FAST_DTOA_PRECISION, then
+    //     the buffer contains requested_digits digits.
+    //     the difference v - (buffer * 10^(point-length)) is closest to zero for
+    //     all possible representations of requested_digits digits.
+    //     If there are two values that are equally close, then FastDtoa returns
+    //     false.
+    // For both modes the buffer must be large enough to hold the result.
+    bool FastDtoa(double d,
+                  FastDtoaMode mode,
+                  int requested_digits,
+                  Vector<char> buffer,
+                  int* length,
+                  int* decimal_point);
+    
+}  // namespace double_conversion
+
+} // namespace WTF
+
+#endif  // DOUBLE_CONVERSION_FAST_DTOA_H_
diff --git a/Source/WTF/wtf/dtoa/fixed-dtoa.cc b/Source/WTF/wtf/dtoa/fixed-dtoa.cc
new file mode 100644
index 0000000..40b7180
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/fixed-dtoa.cc
@@ -0,0 +1,410 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 <math.h>
+
+#include "UnusedParam.h"
+#include "fixed-dtoa.h"
+#include "double.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    // Represents a 128bit type. This class should be replaced by a native type on
+    // platforms that support 128bit integers.
+    class UInt128 {
+    public:
+        UInt128() : high_bits_(0), low_bits_(0) { }
+        UInt128(uint64_t high, uint64_t low) : high_bits_(high), low_bits_(low) { }
+        
+        void Multiply(uint32_t multiplicand) {
+            uint64_t accumulator;
+            
+            accumulator = (low_bits_ & kMask32) * multiplicand;
+            uint32_t part = static_cast<uint32_t>(accumulator & kMask32);
+            accumulator >>= 32;
+            accumulator = accumulator + (low_bits_ >> 32) * multiplicand;
+            low_bits_ = (accumulator << 32) + part;
+            accumulator >>= 32;
+            accumulator = accumulator + (high_bits_ & kMask32) * multiplicand;
+            part = static_cast<uint32_t>(accumulator & kMask32);
+            accumulator >>= 32;
+            accumulator = accumulator + (high_bits_ >> 32) * multiplicand;
+            high_bits_ = (accumulator << 32) + part;
+            ASSERT((accumulator >> 32) == 0);
+        }
+        
+        void Shift(int shift_amount) {
+            ASSERT(-64 <= shift_amount && shift_amount <= 64);
+            if (shift_amount == 0) {
+                return;
+            } else if (shift_amount == -64) {
+                high_bits_ = low_bits_;
+                low_bits_ = 0;
+            } else if (shift_amount == 64) {
+                low_bits_ = high_bits_;
+                high_bits_ = 0;
+            } else if (shift_amount <= 0) {
+                high_bits_ <<= -shift_amount;
+                high_bits_ += low_bits_ >> (64 + shift_amount);
+                low_bits_ <<= -shift_amount;
+            } else {
+                low_bits_ >>= shift_amount;
+                low_bits_ += high_bits_ << (64 - shift_amount);
+                high_bits_ >>= shift_amount;
+            }
+        }
+        
+        // Modifies *this to *this MOD (2^power).
+        // Returns *this DIV (2^power).
+        int DivModPowerOf2(int power) {
+            if (power >= 64) {
+                int result = static_cast<int>(high_bits_ >> (power - 64));
+                high_bits_ -= static_cast<uint64_t>(result) << (power - 64);
+                return result;
+            } else {
+                uint64_t part_low = low_bits_ >> power;
+                uint64_t part_high = high_bits_ << (64 - power);
+                int result = static_cast<int>(part_low + part_high);
+                high_bits_ = 0;
+                low_bits_ -= part_low << power;
+                return result;
+            }
+        }
+        
+        bool IsZero() const {
+            return high_bits_ == 0 && low_bits_ == 0;
+        }
+        
+        int BitAt(int position) {
+            if (position >= 64) {
+                return static_cast<int>(high_bits_ >> (position - 64)) & 1;
+            } else {
+                return static_cast<int>(low_bits_ >> position) & 1;
+            }
+        }
+        
+    private:
+        static const uint64_t kMask32 = 0xFFFFFFFF;
+        // Value == (high_bits_ << 64) + low_bits_
+        uint64_t high_bits_;
+        uint64_t low_bits_;
+    };
+    
+    
+    static const int kDoubleSignificandSize = 53;  // Includes the hidden bit.
+    
+    
+    static void FillDigits32FixedLength(uint32_t number, int requested_length,
+                                        Vector<char> buffer, int* length) {
+        for (int i = requested_length - 1; i >= 0; --i) {
+            buffer[(*length) + i] = '0' + number % 10;
+            number /= 10;
+        }
+        *length += requested_length;
+    }
+    
+    
+    static void FillDigits32(uint32_t number, Vector<char> buffer, int* length) {
+        int number_length = 0;
+        // We fill the digits in reverse order and exchange them afterwards.
+        while (number != 0) {
+            int digit = number % 10;
+            number /= 10;
+            buffer[(*length) + number_length] = '0' + digit;
+            number_length++;
+        }
+        // Exchange the digits.
+        int i = *length;
+        int j = *length + number_length - 1;
+        while (i < j) {
+            char tmp = buffer[i];
+            buffer[i] = buffer[j];
+            buffer[j] = tmp;
+            i++;
+            j--;
+        }
+        *length += number_length;
+    }
+    
+    
+    static void FillDigits64FixedLength(uint64_t number, int requested_length,
+                                        Vector<char> buffer, int* length) {
+        UNUSED_PARAM(requested_length);
+        const uint32_t kTen7 = 10000000;
+        // For efficiency cut the number into 3 uint32_t parts, and print those.
+        uint32_t part2 = static_cast<uint32_t>(number % kTen7);
+        number /= kTen7;
+        uint32_t part1 = static_cast<uint32_t>(number % kTen7);
+        uint32_t part0 = static_cast<uint32_t>(number / kTen7);
+        
+        FillDigits32FixedLength(part0, 3, buffer, length);
+        FillDigits32FixedLength(part1, 7, buffer, length);
+        FillDigits32FixedLength(part2, 7, buffer, length);
+    }
+    
+    
+    static void FillDigits64(uint64_t number, Vector<char> buffer, int* length) {
+        const uint32_t kTen7 = 10000000;
+        // For efficiency cut the number into 3 uint32_t parts, and print those.
+        uint32_t part2 = static_cast<uint32_t>(number % kTen7);
+        number /= kTen7;
+        uint32_t part1 = static_cast<uint32_t>(number % kTen7);
+        uint32_t part0 = static_cast<uint32_t>(number / kTen7);
+        
+        if (part0 != 0) {
+            FillDigits32(part0, buffer, length);
+            FillDigits32FixedLength(part1, 7, buffer, length);
+            FillDigits32FixedLength(part2, 7, buffer, length);
+        } else if (part1 != 0) {
+            FillDigits32(part1, buffer, length);
+            FillDigits32FixedLength(part2, 7, buffer, length);
+        } else {
+            FillDigits32(part2, buffer, length);
+        }
+    }
+    
+    
+    static void RoundUp(Vector<char> buffer, int* length, int* decimal_point) {
+        // An empty buffer represents 0.
+        if (*length == 0) {
+            buffer[0] = '1';
+            *decimal_point = 1;
+            *length = 1;
+            return;
+        }
+        // Round the last digit until we either have a digit that was not '9' or until
+        // we reached the first digit.
+        buffer[(*length) - 1]++;
+        for (int i = (*length) - 1; i > 0; --i) {
+            if (buffer[i] != '0' + 10) {
+                return;
+            }
+            buffer[i] = '0';
+            buffer[i - 1]++;
+        }
+        // If the first digit is now '0' + 10, we would need to set it to '0' and add
+        // a '1' in front. However we reach the first digit only if all following
+        // digits had been '9' before rounding up. Now all trailing digits are '0' and
+        // we simply switch the first digit to '1' and update the decimal-point
+        // (indicating that the point is now one digit to the right).
+        if (buffer[0] == '0' + 10) {
+            buffer[0] = '1';
+            (*decimal_point)++;
+        }
+    }
+    
+    
+    // The given fractionals number represents a fixed-point number with binary
+    // point at bit (-exponent).
+    // Preconditions:
+    //   -128 <= exponent <= 0.
+    //   0 <= fractionals * 2^exponent < 1
+    //   The buffer holds the result.
+    // The function will round its result. During the rounding-process digits not
+    // generated by this function might be updated, and the decimal-point variable
+    // might be updated. If this function generates the digits 99 and the buffer
+    // already contained "199" (thus yielding a buffer of "19999") then a
+    // rounding-up will change the contents of the buffer to "20000".
+    static void FillFractionals(uint64_t fractionals, int exponent,
+                                int fractional_count, Vector<char> buffer,
+                                int* length, int* decimal_point) {
+        ASSERT(-128 <= exponent && exponent <= 0);
+        // 'fractionals' is a fixed-point number, with binary point at bit
+        // (-exponent). Inside the function the non-converted remainder of fractionals
+        // is a fixed-point number, with binary point at bit 'point'.
+        if (-exponent <= 64) {
+            // One 64 bit number is sufficient.
+            ASSERT(fractionals >> 56 == 0);
+            int point = -exponent;
+            for (int i = 0; i < fractional_count; ++i) {
+                if (fractionals == 0) break;
+                // Instead of multiplying by 10 we multiply by 5 and adjust the point
+                // location. This way the fractionals variable will not overflow.
+                // Invariant at the beginning of the loop: fractionals < 2^point.
+                // Initially we have: point <= 64 and fractionals < 2^56
+                // After each iteration the point is decremented by one.
+                // Note that 5^3 = 125 < 128 = 2^7.
+                // Therefore three iterations of this loop will not overflow fractionals
+                // (even without the subtraction at the end of the loop body). At this
+                // time point will satisfy point <= 61 and therefore fractionals < 2^point
+                // and any further multiplication of fractionals by 5 will not overflow.
+                fractionals *= 5;
+                point--;
+                int digit = static_cast<int>(fractionals >> point);
+                buffer[*length] = '0' + digit;
+                (*length)++;
+                fractionals -= static_cast<uint64_t>(digit) << point;
+            }
+            // If the first bit after the point is set we have to round up.
+            if (((fractionals >> (point - 1)) & 1) == 1) {
+                RoundUp(buffer, length, decimal_point);
+            }
+        } else {  // We need 128 bits.
+            ASSERT(64 < -exponent && -exponent <= 128);
+            UInt128 fractionals128 = UInt128(fractionals, 0);
+            fractionals128.Shift(-exponent - 64);
+            int point = 128;
+            for (int i = 0; i < fractional_count; ++i) {
+                if (fractionals128.IsZero()) break;
+                // As before: instead of multiplying by 10 we multiply by 5 and adjust the
+                // point location.
+                // This multiplication will not overflow for the same reasons as before.
+                fractionals128.Multiply(5);
+                point--;
+                int digit = fractionals128.DivModPowerOf2(point);
+                buffer[*length] = '0' + digit;
+                (*length)++;
+            }
+            if (fractionals128.BitAt(point - 1) == 1) {
+                RoundUp(buffer, length, decimal_point);
+            }
+        }
+    }
+    
+    
+    // Removes leading and trailing zeros.
+    // If leading zeros are removed then the decimal point position is adjusted.
+    static void TrimZeros(Vector<char> buffer, int* length, int* decimal_point) {
+        while (*length > 0 && buffer[(*length) - 1] == '0') {
+            (*length)--;
+        }
+        int first_non_zero = 0;
+        while (first_non_zero < *length && buffer[first_non_zero] == '0') {
+            first_non_zero++;
+        }
+        if (first_non_zero != 0) {
+            for (int i = first_non_zero; i < *length; ++i) {
+                buffer[i - first_non_zero] = buffer[i];
+            }
+            *length -= first_non_zero;
+            *decimal_point -= first_non_zero;
+        }
+    }
+    
+    
+    bool FastFixedDtoa(double v,
+                       int fractional_count,
+                       Vector<char> buffer,
+                       int* length,
+                       int* decimal_point) {
+        const uint32_t kMaxUInt32 = 0xFFFFFFFF;
+        uint64_t significand = Double(v).Significand();
+        int exponent = Double(v).Exponent();
+        // v = significand * 2^exponent (with significand a 53bit integer).
+        // If the exponent is larger than 20 (i.e. we may have a 73bit number) then we
+        // don't know how to compute the representation. 2^73 ~= 9.5*10^21.
+        // If necessary this limit could probably be increased, but we don't need
+        // more.
+        if (exponent > 20) return false;
+        if (fractional_count > 20) return false;
+        *length = 0;
+        // At most kDoubleSignificandSize bits of the significand are non-zero.
+        // Given a 64 bit integer we have 11 0s followed by 53 potentially non-zero
+        // bits:  0..11*..0xxx..53*..xx
+        if (exponent + kDoubleSignificandSize > 64) {
+            // The exponent must be > 11.
+            //
+            // We know that v = significand * 2^exponent.
+            // And the exponent > 11.
+            // We simplify the task by dividing v by 10^17.
+            // The quotient delivers the first digits, and the remainder fits into a 64
+            // bit number.
+            // Dividing by 10^17 is equivalent to dividing by 5^17*2^17.
+            const uint64_t kFive17 = UINT64_2PART_C(0xB1, A2BC2EC5);  // 5^17
+            uint64_t divisor = kFive17;
+            int divisor_power = 17;
+            uint64_t dividend = significand;
+            uint32_t quotient;
+            uint64_t remainder;
+            // Let v = f * 2^e with f == significand and e == exponent.
+            // Then need q (quotient) and r (remainder) as follows:
+            //   v            = q * 10^17       + r
+            //   f * 2^e      = q * 10^17       + r
+            //   f * 2^e      = q * 5^17 * 2^17 + r
+            // If e > 17 then
+            //   f * 2^(e-17) = q * 5^17        + r/2^17
+            // else
+            //   f  = q * 5^17 * 2^(17-e) + r/2^e
+            if (exponent > divisor_power) {
+                // We only allow exponents of up to 20 and therefore (17 - e) <= 3
+                dividend <<= exponent - divisor_power;
+                quotient = static_cast<uint32_t>(dividend / divisor);
+                remainder = (dividend % divisor) << divisor_power;
+            } else {
+                divisor <<= divisor_power - exponent;
+                quotient = static_cast<uint32_t>(dividend / divisor);
+                remainder = (dividend % divisor) << exponent;
+            }
+            FillDigits32(quotient, buffer, length);
+            FillDigits64FixedLength(remainder, divisor_power, buffer, length);
+            *decimal_point = *length;
+        } else if (exponent >= 0) {
+            // 0 <= exponent <= 11
+            significand <<= exponent;
+            FillDigits64(significand, buffer, length);
+            *decimal_point = *length;
+        } else if (exponent > -kDoubleSignificandSize) {
+            // We have to cut the number.
+            uint64_t integrals = significand >> -exponent;
+            uint64_t fractionals = significand - (integrals << -exponent);
+            if (integrals > kMaxUInt32) {
+                FillDigits64(integrals, buffer, length);
+            } else {
+                FillDigits32(static_cast<uint32_t>(integrals), buffer, length);
+            }
+            *decimal_point = *length;
+            FillFractionals(fractionals, exponent, fractional_count,
+                            buffer, length, decimal_point);
+        } else if (exponent < -128) {
+            // This configuration (with at most 20 digits) means that all digits must be
+            // 0.
+            ASSERT(fractional_count <= 20);
+            buffer[0] = '\0';
+            *length = 0;
+            *decimal_point = -fractional_count;
+        } else {
+            *decimal_point = 0;
+            FillFractionals(significand, exponent, fractional_count,
+                            buffer, length, decimal_point);
+        }
+        TrimZeros(buffer, length, decimal_point);
+        buffer[*length] = '\0';
+        if ((*length) == 0) {
+            // The string is empty and the decimal_point thus has no importance. Mimick
+            // Gay's dtoa and and set it to -fractional_count.
+            *decimal_point = -fractional_count;
+        }
+        return true;
+    }
+    
+}  // namespace double_conversion
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/dtoa/fixed-dtoa.h b/Source/WTF/wtf/dtoa/fixed-dtoa.h
new file mode 100644
index 0000000..8c0adb7
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/fixed-dtoa.h
@@ -0,0 +1,60 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 DOUBLE_CONVERSION_FIXED_DTOA_H_
+#define DOUBLE_CONVERSION_FIXED_DTOA_H_
+
+#include "utils.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    // Produces digits necessary to print a given number with
+    // 'fractional_count' digits after the decimal point.
+    // The buffer must be big enough to hold the result plus one terminating null
+    // character.
+    //
+    // The produced digits might be too short in which case the caller has to fill
+    // the gaps with '0's.
+    // Example: FastFixedDtoa(0.001, 5, ...) is allowed to return buffer = "1", and
+    // decimal_point = -2.
+    // Halfway cases are rounded towards +/-Infinity (away from 0). The call
+    // FastFixedDtoa(0.15, 2, ...) thus returns buffer = "2", decimal_point = 0.
+    // The returned buffer may contain digits that would be truncated from the
+    // shortest representation of the input.
+    //
+    // This method only works for some parameters. If it can't handle the input it
+    // returns false. The output is null-terminated when the function succeeds.
+    bool FastFixedDtoa(double v, int fractional_count,
+                       Vector<char> buffer, int* length, int* decimal_point);
+    
+}  // namespace double_conversion
+
+} // namespace WTF
+
+#endif  // DOUBLE_CONVERSION_FIXED_DTOA_H_
diff --git a/Source/WTF/wtf/dtoa/strtod.cc b/Source/WTF/wtf/dtoa/strtod.cc
new file mode 100644
index 0000000..477e715
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/strtod.cc
@@ -0,0 +1,447 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 <stdarg.h>
+#include <limits.h>
+
+#include "strtod.h"
+#include "bignum.h"
+#include "cached-powers.h"
+#include "double.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    // 2^53 = 9007199254740992.
+    // Any integer with at most 15 decimal digits will hence fit into a double
+    // (which has a 53bit significand) without loss of precision.
+    static const int kMaxExactDoubleIntegerDecimalDigits = 15;
+    // 2^64 = 18446744073709551616 > 10^19
+    static const int kMaxUint64DecimalDigits = 19;
+    
+    // Max double: 1.7976931348623157 x 10^308
+    // Min non-zero double: 4.9406564584124654 x 10^-324
+    // Any x >= 10^309 is interpreted as +infinity.
+    // Any x <= 10^-324 is interpreted as 0.
+    // Note that 2.5e-324 (despite being smaller than the min double) will be read
+    // as non-zero (equal to the min non-zero double).
+    static const int kMaxDecimalPower = 309;
+    static const int kMinDecimalPower = -324;
+    
+    // 2^64 = 18446744073709551616
+    static const uint64_t kMaxUint64 = UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF);
+    
+    
+    static const double exact_powers_of_ten[] = {
+        1.0,  // 10^0
+        10.0,
+        100.0,
+        1000.0,
+        10000.0,
+        100000.0,
+        1000000.0,
+        10000000.0,
+        100000000.0,
+        1000000000.0,
+        10000000000.0,  // 10^10
+        100000000000.0,
+        1000000000000.0,
+        10000000000000.0,
+        100000000000000.0,
+        1000000000000000.0,
+        10000000000000000.0,
+        100000000000000000.0,
+        1000000000000000000.0,
+        10000000000000000000.0,
+        100000000000000000000.0,  // 10^20
+        1000000000000000000000.0,
+        // 10^22 = 0x21e19e0c9bab2400000 = 0x878678326eac9 * 2^22
+        10000000000000000000000.0
+    };
+    static const int kExactPowersOfTenSize = ARRAY_SIZE(exact_powers_of_ten);
+    
+    // Maximum number of significant digits in the decimal representation.
+    // In fact the value is 772 (see conversions.cc), but to give us some margin
+    // we round up to 780.
+    static const int kMaxSignificantDecimalDigits = 780;
+    
+    static Vector<const char> TrimLeadingZeros(Vector<const char> buffer) {
+        for (int i = 0; i < buffer.length(); i++) {
+            if (buffer[i] != '0') {
+                return buffer.SubVector(i, buffer.length());
+            }
+        }
+        return Vector<const char>(buffer.start(), 0);
+    }
+    
+    
+    static Vector<const char> TrimTrailingZeros(Vector<const char> buffer) {
+        for (int i = buffer.length() - 1; i >= 0; --i) {
+            if (buffer[i] != '0') {
+                return buffer.SubVector(0, i + 1);
+            }
+        }
+        return Vector<const char>(buffer.start(), 0);
+    }
+    
+    
+    static void TrimToMaxSignificantDigits(Vector<const char> buffer,
+                                           int exponent,
+                                           char* significant_buffer,
+                                           int* significant_exponent) {
+        for (int i = 0; i < kMaxSignificantDecimalDigits - 1; ++i) {
+            significant_buffer[i] = buffer[i];
+        }
+        // The input buffer has been trimmed. Therefore the last digit must be
+        // different from '0'.
+        ASSERT(buffer[buffer.length() - 1] != '0');
+        // Set the last digit to be non-zero. This is sufficient to guarantee
+        // correct rounding.
+        significant_buffer[kMaxSignificantDecimalDigits - 1] = '1';
+        *significant_exponent =
+        exponent + (buffer.length() - kMaxSignificantDecimalDigits);
+    }
+    
+    // Reads digits from the buffer and converts them to a uint64.
+    // Reads in as many digits as fit into a uint64.
+    // When the string starts with "1844674407370955161" no further digit is read.
+    // Since 2^64 = 18446744073709551616 it would still be possible read another
+    // digit if it was less or equal than 6, but this would complicate the code.
+    static uint64_t ReadUint64(Vector<const char> buffer,
+                               int* number_of_read_digits) {
+        uint64_t result = 0;
+        int i = 0;
+        while (i < buffer.length() && result <= (kMaxUint64 / 10 - 1)) {
+            int digit = buffer[i++] - '0';
+            ASSERT(0 <= digit && digit <= 9);
+            result = 10 * result + digit;
+        }
+        *number_of_read_digits = i;
+        return result;
+    }
+    
+    
+    // Reads a DiyFp from the buffer.
+    // The returned DiyFp is not necessarily normalized.
+    // If remaining_decimals is zero then the returned DiyFp is accurate.
+    // Otherwise it has been rounded and has error of at most 1/2 ulp.
+    static void ReadDiyFp(Vector<const char> buffer,
+                          DiyFp* result,
+                          int* remaining_decimals) {
+        int read_digits;
+        uint64_t significand = ReadUint64(buffer, &read_digits);
+        if (buffer.length() == read_digits) {
+            *result = DiyFp(significand, 0);
+            *remaining_decimals = 0;
+        } else {
+            // Round the significand.
+            if (buffer[read_digits] >= '5') {
+                significand++;
+            }
+            // Compute the binary exponent.
+            int exponent = 0;
+            *result = DiyFp(significand, exponent);
+            *remaining_decimals = buffer.length() - read_digits;
+        }
+    }
+    
+    
+    static bool DoubleStrtod(Vector<const char> trimmed,
+                             int exponent,
+                             double* result) {
+#if !defined(DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS)
+        // On x86 the floating-point stack can be 64 or 80 bits wide. If it is
+        // 80 bits wide (as is the case on Linux) then double-rounding occurs and the
+        // result is not accurate.
+        // We know that Windows32 uses 64 bits and is therefore accurate.
+        // Note that the ARM simulator is compiled for 32bits. It therefore exhibits
+        // the same problem.
+        return false;
+#endif
+        if (trimmed.length() <= kMaxExactDoubleIntegerDecimalDigits) {
+            int read_digits;
+            // The trimmed input fits into a double.
+            // If the 10^exponent (resp. 10^-exponent) fits into a double too then we
+            // can compute the result-double simply by multiplying (resp. dividing) the
+            // two numbers.
+            // This is possible because IEEE guarantees that floating-point operations
+            // return the best possible approximation.
+            if (exponent < 0 && -exponent < kExactPowersOfTenSize) {
+                // 10^-exponent fits into a double.
+                *result = static_cast<double>(ReadUint64(trimmed, &read_digits));
+                ASSERT(read_digits == trimmed.length());
+                *result /= exact_powers_of_ten[-exponent];
+                return true;
+            }
+            if (0 <= exponent && exponent < kExactPowersOfTenSize) {
+                // 10^exponent fits into a double.
+                *result = static_cast<double>(ReadUint64(trimmed, &read_digits));
+                ASSERT(read_digits == trimmed.length());
+                *result *= exact_powers_of_ten[exponent];
+                return true;
+            }
+            int remaining_digits =
+            kMaxExactDoubleIntegerDecimalDigits - trimmed.length();
+            if ((0 <= exponent) &&
+                (exponent - remaining_digits < kExactPowersOfTenSize)) {
+                // The trimmed string was short and we can multiply it with
+                // 10^remaining_digits. As a result the remaining exponent now fits
+                // into a double too.
+                *result = static_cast<double>(ReadUint64(trimmed, &read_digits));
+                ASSERT(read_digits == trimmed.length());
+                *result *= exact_powers_of_ten[remaining_digits];
+                *result *= exact_powers_of_ten[exponent - remaining_digits];
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    
+    // Returns 10^exponent as an exact DiyFp.
+    // The given exponent must be in the range [1; kDecimalExponentDistance[.
+    static DiyFp AdjustmentPowerOfTen(int exponent) {
+        ASSERT(0 < exponent);
+        ASSERT(exponent < PowersOfTenCache::kDecimalExponentDistance);
+        // Simply hardcode the remaining powers for the given decimal exponent
+        // distance.
+        ASSERT(PowersOfTenCache::kDecimalExponentDistance == 8);
+        switch (exponent) {
+            case 1: return DiyFp(UINT64_2PART_C(0xa0000000, 00000000), -60);
+            case 2: return DiyFp(UINT64_2PART_C(0xc8000000, 00000000), -57);
+            case 3: return DiyFp(UINT64_2PART_C(0xfa000000, 00000000), -54);
+            case 4: return DiyFp(UINT64_2PART_C(0x9c400000, 00000000), -50);
+            case 5: return DiyFp(UINT64_2PART_C(0xc3500000, 00000000), -47);
+            case 6: return DiyFp(UINT64_2PART_C(0xf4240000, 00000000), -44);
+            case 7: return DiyFp(UINT64_2PART_C(0x98968000, 00000000), -40);
+            default:
+                UNREACHABLE();
+                return DiyFp(0, 0);
+        }
+    }
+    
+    
+    // If the function returns true then the result is the correct double.
+    // Otherwise it is either the correct double or the double that is just below
+    // the correct double.
+    static bool DiyFpStrtod(Vector<const char> buffer,
+                            int exponent,
+                            double* result) {
+        DiyFp input;
+        int remaining_decimals;
+        ReadDiyFp(buffer, &input, &remaining_decimals);
+        // Since we may have dropped some digits the input is not accurate.
+        // If remaining_decimals is different than 0 than the error is at most
+        // .5 ulp (unit in the last place).
+        // We don't want to deal with fractions and therefore keep a common
+        // denominator.
+        const int kDenominatorLog = 3;
+        const int kDenominator = 1 << kDenominatorLog;
+        // Move the remaining decimals into the exponent.
+        exponent += remaining_decimals;
+        int error = (remaining_decimals == 0 ? 0 : kDenominator / 2);
+        
+        int old_e = input.e();
+        input.Normalize();
+        error <<= old_e - input.e();
+        
+        ASSERT(exponent <= PowersOfTenCache::kMaxDecimalExponent);
+        if (exponent < PowersOfTenCache::kMinDecimalExponent) {
+            *result = 0.0;
+            return true;
+        }
+        DiyFp cached_power;
+        int cached_decimal_exponent;
+        PowersOfTenCache::GetCachedPowerForDecimalExponent(exponent,
+                                                           &cached_power,
+                                                           &cached_decimal_exponent);
+        
+        if (cached_decimal_exponent != exponent) {
+            int adjustment_exponent = exponent - cached_decimal_exponent;
+            DiyFp adjustment_power = AdjustmentPowerOfTen(adjustment_exponent);
+            input.Multiply(adjustment_power);
+            if (kMaxUint64DecimalDigits - buffer.length() >= adjustment_exponent) {
+                // The product of input with the adjustment power fits into a 64 bit
+                // integer.
+                ASSERT(DiyFp::kSignificandSize == 64);
+            } else {
+                // The adjustment power is exact. There is hence only an error of 0.5.
+                error += kDenominator / 2;
+            }
+        }
+        
+        input.Multiply(cached_power);
+        // The error introduced by a multiplication of a*b equals
+        //   error_a + error_b + error_a*error_b/2^64 + 0.5
+        // Substituting a with 'input' and b with 'cached_power' we have
+        //   error_b = 0.5  (all cached powers have an error of less than 0.5 ulp),
+        //   error_ab = 0 or 1 / kDenominator > error_a*error_b/ 2^64
+        int error_b = kDenominator / 2;
+        int error_ab = (error == 0 ? 0 : 1);  // We round up to 1.
+        int fixed_error = kDenominator / 2;
+        error += error_b + error_ab + fixed_error;
+        
+        old_e = input.e();
+        input.Normalize();
+        error <<= old_e - input.e();
+        
+        // See if the double's significand changes if we add/subtract the error.
+        int order_of_magnitude = DiyFp::kSignificandSize + input.e();
+        int effective_significand_size =
+        Double::SignificandSizeForOrderOfMagnitude(order_of_magnitude);
+        int precision_digits_count =
+        DiyFp::kSignificandSize - effective_significand_size;
+        if (precision_digits_count + kDenominatorLog >= DiyFp::kSignificandSize) {
+            // This can only happen for very small denormals. In this case the
+            // half-way multiplied by the denominator exceeds the range of an uint64.
+            // Simply shift everything to the right.
+            int shift_amount = (precision_digits_count + kDenominatorLog) -
+            DiyFp::kSignificandSize + 1;
+            input.set_f(input.f() >> shift_amount);
+            input.set_e(input.e() + shift_amount);
+            // We add 1 for the lost precision of error, and kDenominator for
+            // the lost precision of input.f().
+            error = (error >> shift_amount) + 1 + kDenominator;
+            precision_digits_count -= shift_amount;
+        }
+        // We use uint64_ts now. This only works if the DiyFp uses uint64_ts too.
+        ASSERT(DiyFp::kSignificandSize == 64);
+        ASSERT(precision_digits_count < 64);
+        uint64_t one64 = 1;
+        uint64_t precision_bits_mask = (one64 << precision_digits_count) - 1;
+        uint64_t precision_bits = input.f() & precision_bits_mask;
+        uint64_t half_way = one64 << (precision_digits_count - 1);
+        precision_bits *= kDenominator;
+        half_way *= kDenominator;
+        DiyFp rounded_input(input.f() >> precision_digits_count,
+                            input.e() + precision_digits_count);
+        if (precision_bits >= half_way + error) {
+            rounded_input.set_f(rounded_input.f() + 1);
+        }
+        // If the last_bits are too close to the half-way case than we are too
+        // inaccurate and round down. In this case we return false so that we can
+        // fall back to a more precise algorithm.
+        
+        *result = Double(rounded_input).value();
+        if (half_way - error < precision_bits && precision_bits < half_way + error) {
+            // Too imprecise. The caller will have to fall back to a slower version.
+            // However the returned number is guaranteed to be either the correct
+            // double, or the next-lower double.
+            return false;
+        } else {
+            return true;
+        }
+    }
+    
+    
+    // Returns the correct double for the buffer*10^exponent.
+    // The variable guess should be a close guess that is either the correct double
+    // or its lower neighbor (the nearest double less than the correct one).
+    // Preconditions:
+    //   buffer.length() + exponent <= kMaxDecimalPower + 1
+    //   buffer.length() + exponent > kMinDecimalPower
+    //   buffer.length() <= kMaxDecimalSignificantDigits
+    static double BignumStrtod(Vector<const char> buffer,
+                               int exponent,
+                               double guess) {
+        if (guess == Double::Infinity()) {
+            return guess;
+        }
+        
+        DiyFp upper_boundary = Double(guess).UpperBoundary();
+        
+        ASSERT(buffer.length() + exponent <= kMaxDecimalPower + 1);
+        ASSERT(buffer.length() + exponent > kMinDecimalPower);
+        ASSERT(buffer.length() <= kMaxSignificantDecimalDigits);
+        // Make sure that the Bignum will be able to hold all our numbers.
+        // Our Bignum implementation has a separate field for exponents. Shifts will
+        // consume at most one bigit (< 64 bits).
+        // ln(10) == 3.3219...
+        ASSERT(((kMaxDecimalPower + 1) * 333 / 100) < Bignum::kMaxSignificantBits);
+        Bignum input;
+        Bignum boundary;
+        input.AssignDecimalString(buffer);
+        boundary.AssignUInt64(upper_boundary.f());
+        if (exponent >= 0) {
+            input.MultiplyByPowerOfTen(exponent);
+        } else {
+            boundary.MultiplyByPowerOfTen(-exponent);
+        }
+        if (upper_boundary.e() > 0) {
+            boundary.ShiftLeft(upper_boundary.e());
+        } else {
+            input.ShiftLeft(-upper_boundary.e());
+        }
+        int comparison = Bignum::Compare(input, boundary);
+        if (comparison < 0) {
+            return guess;
+        } else if (comparison > 0) {
+            return Double(guess).NextDouble();
+        } else if ((Double(guess).Significand() & 1) == 0) {
+            // Round towards even.
+            return guess;
+        } else {
+            return Double(guess).NextDouble();
+        }
+    }
+    
+    
+    double Strtod(Vector<const char> buffer, int exponent) {
+        Vector<const char> left_trimmed = TrimLeadingZeros(buffer);
+        Vector<const char> trimmed = TrimTrailingZeros(left_trimmed);
+        exponent += left_trimmed.length() - trimmed.length();
+        if (trimmed.length() == 0) return 0.0;
+        if (trimmed.length() > kMaxSignificantDecimalDigits) {
+            char significant_buffer[kMaxSignificantDecimalDigits];
+            int significant_exponent;
+            TrimToMaxSignificantDigits(trimmed, exponent,
+                                       significant_buffer, &significant_exponent);
+            return Strtod(Vector<const char>(significant_buffer,
+                                             kMaxSignificantDecimalDigits),
+                          significant_exponent);
+        }
+        if (exponent + trimmed.length() - 1 >= kMaxDecimalPower) {
+            return Double::Infinity();
+        }
+        if (exponent + trimmed.length() <= kMinDecimalPower) {
+            return 0.0;
+        }
+        
+        double guess;
+        if (DoubleStrtod(trimmed, exponent, &guess) ||
+            DiyFpStrtod(trimmed, exponent, &guess)) {
+            return guess;
+        }
+        return BignumStrtod(trimmed, exponent, guess);
+    }
+    
+}  // namespace double_conversion
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/dtoa/strtod.h b/Source/WTF/wtf/dtoa/strtod.h
new file mode 100644
index 0000000..8ed350a
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/strtod.h
@@ -0,0 +1,45 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 DOUBLE_CONVERSION_STRTOD_H_
+#define DOUBLE_CONVERSION_STRTOD_H_
+
+#include "utils.h"
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    // The buffer must only contain digits in the range [0-9]. It must not
+    // contain a dot or a sign. It must not start with '0', and must not be empty.
+    double Strtod(Vector<const char> buffer, int exponent);
+    
+}  // namespace double_conversion
+
+} // namespace WTF
+
+#endif  // DOUBLE_CONVERSION_STRTOD_H_
diff --git a/Source/WTF/wtf/dtoa/utils.h b/Source/WTF/wtf/dtoa/utils.h
new file mode 100644
index 0000000..da6e132
--- /dev/null
+++ b/Source/WTF/wtf/dtoa/utils.h
@@ -0,0 +1,310 @@
+// Copyright 2010 the V8 project authors. 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.
+//     * 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.
+//     * 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 DOUBLE_CONVERSION_UTILS_H_
+#define DOUBLE_CONVERSION_UTILS_H_
+
+#include <wtf/Assertions.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define UNIMPLEMENTED ASSERT_NOT_REACHED
+#define UNREACHABLE ASSERT_NOT_REACHED
+
+// Double operations detection based on target architecture.
+// Linux uses a 80bit wide floating point stack on x86. This induces double
+// rounding, which in turn leads to wrong results.
+// An easy way to test if the floating-point operations are correct is to
+// evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then
+// the result is equal to 89255e-22.
+// The best way to test this, is to create a division-function and to compare
+// the output of the division with the expected result. (Inlining must be
+// disabled.)
+// On Linux,x86 89255e-22 != Div_double(89255.0/1e22)
+#if defined(_M_X64) || defined(__x86_64__) || \
+defined(__ARMEL__) || \
+defined(_MIPS_ARCH_MIPS32R2)
+#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+#elif CPU(MIPS) || CPU(PPC) || CPU(PPC64) || OS(WINCE) || CPU(SH4) || CPU(S390) || CPU(S390X) || CPU(IA64) || CPU(SPARC) || CPU(ALPHA)
+#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+#elif defined(_M_IX86) || defined(__i386__)
+#if defined(_WIN32)
+// Windows uses a 64bit wide floating point stack.
+#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+#else
+#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
+#endif  // _WIN32
+#else
+#error Target architecture was not detected as supported by Double-Conversion.
+#endif
+
+
+#if defined(_WIN32) && !defined(__MINGW32__)
+
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef short int16_t;  // NOLINT
+typedef unsigned short uint16_t;  // NOLINT
+typedef int int32_t;
+typedef unsigned int uint32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+// intptr_t and friends are defined in crtdefs.h through stdio.h.
+
+#else
+
+#include <stdint.h>
+
+#endif
+
+// The following macro works on both 32 and 64-bit platforms.
+// Usage: instead of writing 0x1234567890123456
+//      write UINT64_2PART_C(0x12345678,90123456);
+#define UINT64_2PART_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u))
+
+
+// The expression ARRAY_SIZE(a) is a compile-time constant of type
+// size_t which represents the number of elements of the given
+// array. You should only use ARRAY_SIZE on statically allocated
+// arrays.
+#define ARRAY_SIZE(a)                                   \
+((sizeof(a) / sizeof(*(a))) /                         \
+static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
+
+// A macro to disallow the evil copy constructor and operator= functions
+// This should be used in the private: declarations for a class
+#define DISALLOW_COPY_AND_ASSIGN(TypeName)      \
+TypeName(const TypeName&);                    \
+void operator=(const TypeName&)
+
+// A macro to disallow all the implicit constructors, namely the
+// default constructor, copy constructor and operator= functions.
+//
+// This should be used in the private: declarations for a class
+// that wants to prevent anyone from instantiating it. This is
+// especially useful for classes containing only static methods.
+#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
+TypeName();                                    \
+DISALLOW_COPY_AND_ASSIGN(TypeName)
+
+namespace WTF {
+
+namespace double_conversion {
+    
+    static const int kCharSize = sizeof(char);
+    
+    // Returns the maximum of the two parameters.
+    template <typename T>
+    static T Max(T a, T b) {
+        return a < b ? b : a;
+    }
+    
+    
+    // Returns the minimum of the two parameters.
+    template <typename T>
+    static T Min(T a, T b) {
+        return a < b ? a : b;
+    }
+    
+    
+    inline int StrLength(const char* string) {
+        size_t length = strlen(string);
+        ASSERT(length == static_cast<size_t>(static_cast<int>(length)));
+        return static_cast<int>(length);
+    }
+    
+    // This is a simplified version of V8's Vector class.
+    template <typename T>
+    class Vector {
+    public:
+        Vector() : start_(NULL), length_(0) {}
+        Vector(T* data, int length) : start_(data), length_(length) {
+            ASSERT(length == 0 || (length > 0 && data != NULL));
+        }
+        
+        // Returns a vector using the same backing storage as this one,
+        // spanning from and including 'from', to but not including 'to'.
+        Vector<T> SubVector(int from, int to) {
+            ASSERT(to <= length_);
+            ASSERT(from < to);
+            ASSERT(0 <= from);
+            return Vector<T>(start() + from, to - from);
+        }
+        
+        // Returns the length of the vector.
+        int length() const { return length_; }
+        
+        // Returns whether or not the vector is empty.
+        bool is_empty() const { return length_ == 0; }
+        
+        // Returns the pointer to the start of the data in the vector.
+        T* start() const { return start_; }
+        
+        // Access individual vector elements - checks bounds in debug mode.
+        T& operator[](int index) const {
+            ASSERT(0 <= index && index < length_);
+            return start_[index];
+        }
+        
+        T& first() { return start_[0]; }
+        
+        T& last() { return start_[length_ - 1]; }
+        
+    private:
+        T* start_;
+        int length_;
+    };
+    
+    
+    // Helper class for building result strings in a character buffer. The
+    // purpose of the class is to use safe operations that checks the
+    // buffer bounds on all operations in debug mode.
+    class StringBuilder {
+    public:
+        StringBuilder(char* buffer, int size)
+        : buffer_(buffer, size), position_(0) { }
+        
+        ~StringBuilder() { if (!is_finalized()) Finalize(); }
+        
+        int size() const { return buffer_.length(); }
+        
+        // Get the current position in the builder.
+        int position() const {
+            ASSERT(!is_finalized());
+            return position_;
+        }
+         
+        // Set the current position in the builder.
+        void SetPosition(int position)
+        {
+            ASSERT(!is_finalized());
+            ASSERT(position < size());
+            position_ = position;
+        }
+        
+        // Reset the position.
+        void Reset() { position_ = 0; }
+        
+        // Add a single character to the builder. It is not allowed to add
+        // 0-characters; use the Finalize() method to terminate the string
+        // instead.
+        void AddCharacter(char c) {
+            ASSERT(c != '\0');
+            ASSERT(!is_finalized() && position_ < buffer_.length());
+            buffer_[position_++] = c;
+        }
+        
+        // Add an entire string to the builder. Uses strlen() internally to
+        // compute the length of the input string.
+        void AddString(const char* s) {
+            AddSubstring(s, StrLength(s));
+        }
+        
+        // Add the first 'n' characters of the given string 's' to the
+        // builder. The input string must have enough characters.
+        void AddSubstring(const char* s, int n) {
+            ASSERT(!is_finalized() && position_ + n < buffer_.length());
+            ASSERT(static_cast<size_t>(n) <= strlen(s));
+            memcpy(&buffer_[position_], s, n * kCharSize);
+            position_ += n;
+        }
+        
+        
+        // Add character padding to the builder. If count is non-positive,
+        // nothing is added to the builder.
+        void AddPadding(char c, int count) {
+            for (int i = 0; i < count; i++) {
+                AddCharacter(c);
+            }
+        }
+        
+        // Finalize the string by 0-terminating it and returning the buffer.
+        char* Finalize() {
+            ASSERT(!is_finalized() && position_ < buffer_.length());
+            buffer_[position_] = '\0';
+            // Make sure nobody managed to add a 0-character to the
+            // buffer while building the string.
+            ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_));
+            position_ = -1;
+            ASSERT(is_finalized());
+            return buffer_.start();
+        }
+        
+    private:
+        Vector<char> buffer_;
+        int position_;
+        
+        bool is_finalized() const { return position_ < 0; }
+        
+        DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder);
+    };
+    
+    // The type-based aliasing rule allows the compiler to assume that pointers of
+    // different types (for some definition of different) never alias each other.
+    // Thus the following code does not work:
+    //
+    // float f = foo();
+    // int fbits = *(int*)(&f);
+    //
+    // The compiler 'knows' that the int pointer can't refer to f since the types
+    // don't match, so the compiler may cache f in a register, leaving random data
+    // in fbits.  Using C++ style casts makes no difference, however a pointer to
+    // char data is assumed to alias any other pointer.  This is the 'memcpy
+    // exception'.
+    //
+    // Bit_cast uses the memcpy exception to move the bits from a variable of one
+    // type of a variable of another type.  Of course the end result is likely to
+    // be implementation dependent.  Most compilers (gcc-4.2 and MSVC 2005)
+    // will completely optimize BitCast away.
+    //
+    // There is an additional use for BitCast.
+    // Recent gccs will warn when they see casts that may result in breakage due to
+    // the type-based aliasing rule.  If you have checked that there is no breakage
+    // you can use BitCast to cast one pointer type to another.  This confuses gcc
+    // enough that it can no longer see that you have cast one pointer type to
+    // another thus avoiding the warning.
+    template <class Dest, class Source>
+    inline Dest BitCast(const Source& source) {
+        // Compile time assertion: sizeof(Dest) == sizeof(Source)
+        // A compile error here means your Dest and Source have different sizes.
+        typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
+        
+        Dest dest;
+        memcpy(&dest, &source, sizeof(dest));
+        return dest;
+    }
+    
+    template <class Dest, class Source>
+    inline Dest BitCast(Source* source) {
+        return BitCast<Dest>(reinterpret_cast<uintptr_t>(source));
+    }
+    
+}  // namespace double_conversion
+
+} // namespace WTF
+
+#endif  // DOUBLE_CONVERSION_UTILS_H_
diff --git a/Source/WTF/wtf/efl/MainThreadEfl.cpp b/Source/WTF/wtf/efl/MainThreadEfl.cpp
new file mode 100644
index 0000000..53adcb2
--- /dev/null
+++ b/Source/WTF/wtf/efl/MainThreadEfl.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ * Copyright (C) 2008 Diego Gonzalez
+ * Copyright (C) 2008 Kenneth Rohde Christiansen
+ * Copyright (C) 2009-2010 ProFUSION embedded systems
+ * Copyright (C) 2009-2010 Samsung Electronics
+ *
+ * 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.  Neither the name of Apple Inc. ("Apple") 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 APPLE 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 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 "config.h"
+#include "MainThread.h"
+
+#include <Ecore.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/StdLibExtras.h>
+
+namespace WTF {
+
+static OwnPtr<Ecore_Pipe>& pipeObject()
+{
+    DEFINE_STATIC_LOCAL(OwnPtr<Ecore_Pipe>, pipeObject, ());
+    return pipeObject;
+}
+
+static void monitorDispatchFunctions(void*, void*, unsigned int)
+{
+    dispatchFunctionsFromMainThread();
+}
+
+void initializeMainThreadPlatform()
+{
+    pipeObject() = adoptPtr(ecore_pipe_add(monitorDispatchFunctions, 0));
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+    ecore_pipe_write(pipeObject().get(), "", 0);
+}
+
+}
diff --git a/Source/WTF/wtf/efl/OwnPtrEfl.cpp b/Source/WTF/wtf/efl/OwnPtrEfl.cpp
new file mode 100644
index 0000000..59c8ad5
--- /dev/null
+++ b/Source/WTF/wtf/efl/OwnPtrEfl.cpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2011 ProFUSION embedded systems
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 "OwnPtr.h"
+
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Ecore_IMF.h>
+#include <Eina.h>
+#include <Evas.h>
+
+#if USE(ACCELERATED_COMPOSITING)
+#include <Evas_GL.h>
+#endif
+
+namespace WTF {
+
+void deleteOwnedPtr(Ecore_Evas* ptr)
+{
+    if (ptr)
+        ecore_evas_free(ptr);
+}
+
+void deleteOwnedPtr(Ecore_Pipe* ptr)
+{
+    if (ptr)
+        ecore_pipe_del(ptr);
+}
+
+void deleteOwnedPtr(Eina_Hash* ptr)
+{
+    if (ptr)
+        eina_hash_free(ptr);
+}
+
+void deleteOwnedPtr(Eina_Module* ptr)
+{
+    if (ptr)
+        eina_module_free(ptr); // If module wasn't unloaded, eina_module_free() calls eina_module_unload().
+}
+
+void deleteOwnedPtr(Ecore_Timer* ptr)
+{
+    if (ptr)
+        ecore_timer_del(ptr);
+}
+
+void deleteOwnedPtr(Ecore_IMF_Context* ptr)
+{
+    if (ptr)
+        ecore_imf_context_del(ptr);
+}
+
+#if USE(ACCELERATED_COMPOSITING)
+void deleteOwnedPtr(Evas_GL* ptr)
+{
+    if (ptr)
+        evas_gl_free(ptr);
+}
+#endif
+
+}
diff --git a/Source/WTF/wtf/efl/RefPtrEfl.cpp b/Source/WTF/wtf/efl/RefPtrEfl.cpp
new file mode 100644
index 0000000..f5335cc
--- /dev/null
+++ b/Source/WTF/wtf/efl/RefPtrEfl.cpp
@@ -0,0 +1,48 @@
+/*
+ *  Copyright (C) 2011 Samsung Electronics
+ *  Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "RefPtrEfl.h"
+
+#include <Evas.h>
+
+namespace WTF {
+
+template<> void refIfNotNull(Evas_Object* ptr)
+{
+    if (LIKELY(!!ptr))
+        evas_object_ref(ptr);
+}
+
+template<> void derefIfNotNull(Evas_Object* ptr)
+{
+    // Refcounting in Evas_Object is different that normal. The object is created
+    // with an external ref count of 0, but with one internal count of 1 which can
+    // only be removed by calling _del. Calling _del with an external ref count > 0,
+    // postposes deletion until it reaches 0.
+
+    if (LIKELY(!!ptr)) {
+        if (evas_object_ref_get(ptr) > 0)
+            evas_object_unref(ptr);
+        else
+            evas_object_del(ptr);
+    }
+}
+
+}
diff --git a/Source/WTF/wtf/efl/RefPtrEfl.h b/Source/WTF/wtf/efl/RefPtrEfl.h
new file mode 100644
index 0000000..4815284
--- /dev/null
+++ b/Source/WTF/wtf/efl/RefPtrEfl.h
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (C) 2011 Samsung Electronics
+ *
+ *  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 RefPtrEfl_h
+#define RefPtrEfl_h
+
+#include <wtf/RefPtr.h>
+
+typedef struct _Evas_Object Evas_Object;
+
+namespace WTF {
+
+template<> void refIfNotNull(Evas_Object* ptr);
+template<> void derefIfNotNull(Evas_Object* ptr);
+
+}
+
+#endif // RefPtrEfl_h
diff --git a/Source/WTF/wtf/gobject/GOwnPtr.cpp b/Source/WTF/wtf/gobject/GOwnPtr.cpp
new file mode 100644
index 0000000..dfe187d
--- /dev/null
+++ b/Source/WTF/wtf/gobject/GOwnPtr.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2008 Collabora Ltd.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "GOwnPtr.h"
+
+#if ENABLE(GLIB_SUPPORT)
+
+#include <gio/gio.h>
+#include <glib.h>
+
+namespace WTF {
+
+template <> void freeOwnedGPtr<GError>(GError* ptr)
+{
+    if (ptr)
+        g_error_free(ptr);
+}
+
+template <> void freeOwnedGPtr<GList>(GList* ptr)
+{
+    g_list_free(ptr);
+}
+
+template <> void freeOwnedGPtr<GSList>(GSList* ptr)
+{
+    g_slist_free(ptr);
+}
+
+template <> void freeOwnedGPtr<GPatternSpec>(GPatternSpec* ptr)
+{
+    if (ptr)
+        g_pattern_spec_free(ptr);
+}
+
+template <> void freeOwnedGPtr<GDir>(GDir* ptr)
+{
+    if (ptr)
+        g_dir_close(ptr);
+}
+
+template <> void freeOwnedGPtr<GTimer>(GTimer* ptr)
+{
+    if (ptr)
+        g_timer_destroy(ptr);
+}
+
+template <> void freeOwnedGPtr<GKeyFile>(GKeyFile* ptr)
+{
+    if (ptr)
+        g_key_file_free(ptr);
+}
+
+} // namespace WTF
+
+#endif // ENABLE(GLIB_SUPPORT)
diff --git a/Source/WTF/wtf/gobject/GOwnPtr.h b/Source/WTF/wtf/gobject/GOwnPtr.h
new file mode 100644
index 0000000..4b2dcb7
--- /dev/null
+++ b/Source/WTF/wtf/gobject/GOwnPtr.h
@@ -0,0 +1,144 @@
+/*
+ *  Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ *  Copyright (C) 2008 Collabora Ltd.
+ *
+ *  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 GOwnPtr_h
+#define GOwnPtr_h
+
+#if ENABLE(GLIB_SUPPORT)
+
+#include <algorithm>
+#include <wtf/Assertions.h>
+#include <wtf/Noncopyable.h>
+
+extern "C" void g_free(void*);
+
+namespace WTF {
+
+template <typename T> inline void freeOwnedGPtr(T* ptr);
+template<> void freeOwnedGPtr<GError>(GError*);
+template<> void freeOwnedGPtr<GList>(GList*);
+template<> void freeOwnedGPtr<GSList>(GSList*);
+template<> void freeOwnedGPtr<GPatternSpec>(GPatternSpec*);
+template<> void freeOwnedGPtr<GDir>(GDir*);
+template<> void freeOwnedGPtr<GTimer>(GTimer*);
+template<> void freeOwnedGPtr<GKeyFile>(GKeyFile*);
+
+template <typename T> class GOwnPtr {
+    WTF_MAKE_NONCOPYABLE(GOwnPtr);
+public:
+    explicit GOwnPtr(T* ptr = 0) : m_ptr(ptr) { }
+    ~GOwnPtr() { freeOwnedGPtr(m_ptr); }
+
+    T* get() const { return m_ptr; }
+    T* release()
+    {
+        T* ptr = m_ptr;
+        m_ptr = 0;
+        return ptr;
+    }
+
+    T*& outPtr()
+    {
+        ASSERT(!m_ptr);
+        return m_ptr;
+    }
+
+    void set(T* ptr)
+    {
+        ASSERT(!ptr || m_ptr != ptr);
+        freeOwnedGPtr(m_ptr);
+        m_ptr = ptr;
+    }
+
+    void clear()
+    {
+        T* ptr = m_ptr;
+        m_ptr = 0;
+        freeOwnedGPtr(ptr);
+    }
+
+    T& operator*() const
+    {
+        ASSERT(m_ptr);
+        return *m_ptr;
+    }
+
+    T* operator->() const
+    {
+        ASSERT(m_ptr);
+        return m_ptr;
+    }
+
+    bool operator!() const { return !m_ptr; }
+
+    // This conversion operator allows implicit conversion to bool but not to other integer types.
+    typedef T* GOwnPtr::*UnspecifiedBoolType;
+    operator UnspecifiedBoolType() const { return m_ptr ? &GOwnPtr::m_ptr : 0; }
+
+    void swap(GOwnPtr& o) { std::swap(m_ptr, o.m_ptr); }
+
+private:
+    T* m_ptr;
+};
+
+template <typename T> inline void swap(GOwnPtr<T>& a, GOwnPtr<T>& b)
+{
+    a.swap(b);
+}
+
+template <typename T, typename U> inline bool operator==(const GOwnPtr<T>& a, U* b)
+{ 
+    return a.get() == b; 
+}
+
+template <typename T, typename U> inline bool operator==(T* a, const GOwnPtr<U>& b) 
+{
+    return a == b.get(); 
+}
+
+template <typename T, typename U> inline bool operator!=(const GOwnPtr<T>& a, U* b)
+{
+    return a.get() != b; 
+}
+
+template <typename T, typename U> inline bool operator!=(T* a, const GOwnPtr<U>& b)
+{ 
+    return a != b.get(); 
+}
+
+template <typename T> inline typename GOwnPtr<T>::PtrType getPtr(const GOwnPtr<T>& p)
+{
+    return p.get();
+}
+
+template <typename T> inline void freeOwnedGPtr(T* ptr)
+{
+    g_free(ptr);
+}
+
+} // namespace WTF
+
+using WTF::GOwnPtr;
+
+#endif // ENABLE(GLIB_SUPPORT)
+
+#endif // GOwnPtr_h
+
diff --git a/Source/WTF/wtf/gobject/GRefPtr.cpp b/Source/WTF/wtf/gobject/GRefPtr.cpp
new file mode 100644
index 0000000..79e967c
--- /dev/null
+++ b/Source/WTF/wtf/gobject/GRefPtr.cpp
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2009 Martin Robinson
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "config.h"
+#include "GRefPtr.h"
+
+#if ENABLE(GLIB_SUPPORT)
+
+#include <glib.h>
+
+namespace WTF {
+
+template <> GHashTable* refGPtr(GHashTable* ptr)
+{
+    if (ptr)
+        g_hash_table_ref(ptr);
+    return ptr;
+}
+
+template <> void derefGPtr(GHashTable* ptr)
+{
+    g_hash_table_unref(ptr);
+}
+
+template <> GMainContext* refGPtr(GMainContext* ptr)
+{
+    if (ptr)
+        g_main_context_ref(ptr);
+    return ptr;
+}
+
+template <> void derefGPtr(GMainContext* ptr)
+{
+    if (ptr)
+        g_main_context_unref(ptr);
+}
+
+template <> GMainLoop* refGPtr(GMainLoop* ptr)
+{
+    if (ptr)
+        g_main_loop_ref(ptr);
+    return ptr;
+}
+
+template <> void derefGPtr(GMainLoop* ptr)
+{
+    if (ptr)
+        g_main_loop_unref(ptr);
+}
+
+#if GLIB_CHECK_VERSION(2, 32, 0)
+template <> GBytes* refGPtr(GBytes* ptr)
+{
+    if (ptr)
+        g_bytes_ref(ptr);
+    return ptr;
+}
+
+template <> void derefGPtr(GBytes* ptr)
+{
+    if (ptr)
+        g_bytes_unref(ptr);
+}
+
+# else
+
+typedef struct _GBytes {
+    bool fake;
+} GBytes;
+
+template <> GBytes* refGPtr(GBytes* ptr)
+{
+    return ptr;
+}
+
+template <> void derefGPtr(GBytes* ptr)
+{
+}
+
+#endif
+
+#if GLIB_CHECK_VERSION(2, 24, 0)
+template <> GVariant* refGPtr(GVariant* ptr)
+{
+    if (ptr)
+        g_variant_ref(ptr);
+    return ptr;
+}
+
+template <> void derefGPtr(GVariant* ptr)
+{
+    g_variant_unref(ptr);
+}
+
+#else
+
+// We do this so that we can avoid including the glib.h header in GRefPtr.h.
+typedef struct _GVariant {
+    bool fake;
+} GVariant; 
+
+template <> GVariant* refGPtr(GVariant* ptr)
+{
+    return ptr;
+}
+
+template <> void derefGPtr(GVariant* ptr)
+{
+}
+
+#endif
+
+template <> GSource* refGPtr(GSource* ptr)
+{
+    if (ptr)
+        g_source_ref(ptr);
+    return ptr;
+}
+
+template <> void derefGPtr(GSource* ptr)
+{
+    if (ptr)
+        g_source_unref(ptr);
+}
+
+template <> GPtrArray* refGPtr(GPtrArray* ptr)
+{
+    if (ptr)
+        g_ptr_array_ref(ptr);
+    return ptr;
+}
+
+template <> void derefGPtr(GPtrArray* ptr)
+{
+    if (ptr)
+        g_ptr_array_unref(ptr);
+}
+
+template <> GByteArray* refGPtr(GByteArray* ptr)
+{
+    if (ptr)
+        g_byte_array_ref(ptr);
+    return ptr;
+}
+
+template <> void derefGPtr(GByteArray* ptr)
+{
+    if (ptr)
+        g_byte_array_unref(ptr);
+}
+
+} // namespace WTF
+
+#endif // ENABLE(GLIB_SUPPORT)
diff --git a/Source/WTF/wtf/gobject/GRefPtr.h b/Source/WTF/wtf/gobject/GRefPtr.h
new file mode 100644
index 0000000..b0909b6
--- /dev/null
+++ b/Source/WTF/wtf/gobject/GRefPtr.h
@@ -0,0 +1,238 @@
+/*
+ *  Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *  Copyright (C) 2008 Collabora Ltd.
+ *  Copyright (C) 2009 Martin Robinson
+ *
+ *  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_GRefPtr_h
+#define WTF_GRefPtr_h
+
+#if ENABLE(GLIB_SUPPORT)
+
+#include <wtf/AlwaysInline.h>
+#include <wtf/RefPtr.h>
+#include <algorithm>
+
+extern "C" void g_object_unref(gpointer);
+extern "C" gpointer g_object_ref_sink(gpointer);
+
+namespace WTF {
+
+enum GRefPtrAdoptType { GRefPtrAdopt };
+template <typename T> inline T* refGPtr(T*);
+template <typename T> inline void derefGPtr(T*);
+template <typename T> class GRefPtr;
+template <typename T> GRefPtr<T> adoptGRef(T*);
+
+template <typename T> class GRefPtr {
+public:
+    GRefPtr() : m_ptr(0) { }
+
+    GRefPtr(T* ptr)
+        : m_ptr(ptr)
+    {
+        if (ptr)
+            refGPtr(ptr);
+    }
+
+    GRefPtr(const GRefPtr& o)
+        : m_ptr(o.m_ptr)
+    {
+        if (T* ptr = m_ptr)
+            refGPtr(ptr);
+    }
+
+    template <typename U> GRefPtr(const GRefPtr<U>& o)
+        : m_ptr(o.get())
+    {
+        if (T* ptr = m_ptr)
+            refGPtr(ptr);
+    }
+
+    ~GRefPtr()
+    {
+        if (T* ptr = m_ptr)
+            derefGPtr(ptr);
+    }
+
+    void clear()
+    {
+        T* ptr = m_ptr;
+        m_ptr = 0;
+        if (ptr)
+            derefGPtr(ptr);
+    }
+
+    T* leakRef() WARN_UNUSED_RETURN
+    {
+        T* ptr = m_ptr;
+        m_ptr = 0;
+        return ptr;
+    }
+
+    // Hash table deleted values, which are only constructed and never copied or destroyed.
+    GRefPtr(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; }
+
+    bool operator!() const { return !m_ptr; }
+
+    // This conversion operator allows implicit conversion to bool but not to other integer types.
+    typedef T* GRefPtr::*UnspecifiedBoolType;
+    operator UnspecifiedBoolType() const { return m_ptr ? &GRefPtr::m_ptr : 0; }
+
+    GRefPtr& operator=(const GRefPtr&);
+    GRefPtr& operator=(T*);
+    template <typename U> GRefPtr& operator=(const GRefPtr<U>&);
+
+    void swap(GRefPtr&);
+    friend GRefPtr adoptGRef<T>(T*);
+
+private:
+    static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
+    // Adopting constructor.
+    GRefPtr(T* ptr, GRefPtrAdoptType) : m_ptr(ptr) {}
+
+    T* m_ptr;
+};
+
+template <typename T> inline GRefPtr<T>& GRefPtr<T>::operator=(const GRefPtr<T>& o)
+{
+    T* optr = o.get();
+    if (optr)
+        refGPtr(optr);
+    T* ptr = m_ptr;
+    m_ptr = optr;
+    if (ptr)
+        derefGPtr(ptr);
+    return *this;
+}
+
+template <typename T> inline GRefPtr<T>& GRefPtr<T>::operator=(T* optr)
+{
+    T* ptr = m_ptr;
+    if (optr)
+        refGPtr(optr);
+    m_ptr = optr;
+    if (ptr)
+        derefGPtr(ptr);
+    return *this;
+}
+
+template <class T> inline void GRefPtr<T>::swap(GRefPtr<T>& o)
+{
+    std::swap(m_ptr, o.m_ptr);
+}
+
+template <class T> inline void swap(GRefPtr<T>& a, GRefPtr<T>& b)
+{
+    a.swap(b);
+}
+
+template <typename T, typename U> inline bool operator==(const GRefPtr<T>& a, const GRefPtr<U>& b)
+{
+    return a.get() == b.get();
+}
+
+template <typename T, typename U> inline bool operator==(const GRefPtr<T>& a, U* b)
+{
+    return a.get() == b;
+}
+
+template <typename T, typename U> inline bool operator==(T* a, const GRefPtr<U>& b)
+{
+    return a == b.get();
+}
+
+template <typename T, typename U> inline bool operator!=(const GRefPtr<T>& a, const GRefPtr<U>& b)
+{
+    return a.get() != b.get();
+}
+
+template <typename T, typename U> inline bool operator!=(const GRefPtr<T>& a, U* b)
+{
+    return a.get() != b;
+}
+
+template <typename T, typename U> inline bool operator!=(T* a, const GRefPtr<U>& b)
+{
+    return a != b.get();
+}
+
+template <typename T, typename U> inline GRefPtr<T> static_pointer_cast(const GRefPtr<U>& p)
+{
+    return GRefPtr<T>(static_cast<T*>(p.get()));
+}
+
+template <typename T, typename U> inline GRefPtr<T> const_pointer_cast(const GRefPtr<U>& p)
+{
+    return GRefPtr<T>(const_cast<T*>(p.get()));
+}
+
+template <typename T> inline T* getPtr(const GRefPtr<T>& p)
+{
+    return p.get();
+}
+
+template <typename T> GRefPtr<T> adoptGRef(T* p)
+{
+    return GRefPtr<T>(p, GRefPtrAdopt);
+}
+
+template <> GHashTable* refGPtr(GHashTable* ptr);
+template <> void derefGPtr(GHashTable* ptr);
+template <> GMainContext* refGPtr(GMainContext* ptr);
+template <> void derefGPtr(GMainContext* ptr);
+template <> GMainLoop* refGPtr(GMainLoop* ptr);
+template <> void derefGPtr(GMainLoop* ptr);
+template <> GVariant* refGPtr(GVariant* ptr);
+template <> void derefGPtr(GVariant* ptr);
+template <> GSource* refGPtr(GSource* ptr);
+template <> void derefGPtr(GSource* ptr);
+template <> GPtrArray* refGPtr(GPtrArray*);
+template <> void derefGPtr(GPtrArray*);
+template <> GByteArray* refGPtr(GByteArray*);
+template <> void derefGPtr(GByteArray*);
+template <> GBytes* refGPtr(GBytes*);
+template <> void derefGPtr(GBytes*);
+
+template <typename T> inline T* refGPtr(T* ptr)
+{
+    if (ptr)
+        g_object_ref_sink(ptr);
+    return ptr;
+}
+
+template <typename T> inline void derefGPtr(T* ptr)
+{
+    if (ptr)
+        g_object_unref(ptr);
+}
+
+} // namespace WTF
+
+using WTF::GRefPtr;
+using WTF::adoptGRef;
+
+#endif // ENABLE(GLIB_SUPPORT)
+
+#endif // WTF_GRefPtr_h
diff --git a/Source/WTF/wtf/gobject/GTypedefs.h b/Source/WTF/wtf/gobject/GTypedefs.h
new file mode 100644
index 0000000..64c3c58
--- /dev/null
+++ b/Source/WTF/wtf/gobject/GTypedefs.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2010 Igalia, S.L.
+ *
+ *  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 GtkTypedefs_h
+#define GtkTypedefs_h
+
+/* Vanilla C code does not seem to be able to handle forward-declaration typedefs. */
+#ifdef  __cplusplus
+
+typedef char gchar;
+typedef double gdouble;
+typedef float gfloat;
+typedef int gint;
+typedef gint gboolean;
+typedef long glong;
+typedef short gshort;
+typedef unsigned char guchar;
+typedef unsigned int guint;
+typedef unsigned long gulong;
+typedef unsigned short gushort;
+typedef void* gpointer;
+
+typedef struct _GAsyncResult GAsyncResult;
+typedef struct _GCancellable GCancellable;
+typedef struct _GCharsetConverter GCharsetConverter;
+typedef struct _GDir GDir;
+typedef struct _GdkAtom* GdkAtom;
+typedef struct _GdkCursor GdkCursor;
+typedef struct _GdkDragContext GdkDragContext;
+typedef struct _GdkEventConfigure GdkEventConfigure;
+typedef struct _GdkEventExpose GdkEventExpose;
+typedef struct _GdkPixbuf GdkPixbuf;
+typedef struct _GError GError;
+typedef struct _GFile GFile;
+typedef struct _GHashTable GHashTable;
+typedef struct _GInputStream GInputStream;
+typedef struct _GList GList;
+typedef struct _GMainContext GMainContext;
+typedef struct _GMainLoop GMainLoop;
+typedef struct _GPatternSpec GPatternSpec;
+typedef struct _GPollableOutputStream GPollableOutputStream;
+typedef struct _GSList GSList;
+typedef struct _GSocketClient GSocketClient;
+typedef struct _GSocketConnection GSocketConnection;
+typedef struct _GSource GSource;
+typedef struct _GVariant GVariant;
+typedef union _GdkEvent GdkEvent;
+typedef struct _GTimer GTimer;
+typedef struct _GKeyFile GKeyFile;
+typedef struct _GPtrArray GPtrArray;
+typedef struct _GByteArray GByteArray;
+typedef struct _GBytes GBytes;
+
+#if USE(CAIRO)
+typedef struct _cairo_surface cairo_surface_t;
+typedef struct _cairo_rectangle_int cairo_rectangle_int_t;
+#endif
+
+#if USE(CLUTTER)
+typedef struct _ClutterActor ClutterActor;
+typedef struct _GraphicsLayerActor GraphicsLayerActor;
+#endif
+
+#if PLATFORM(GTK)
+typedef struct _GtkAction GtkAction;
+typedef struct _GtkAdjustment GtkAdjustment;
+typedef struct _GtkBorder GtkBorder;
+typedef struct _GtkClipboard GtkClipboard;
+typedef struct _GtkContainer GtkContainer;
+typedef struct _GtkIconInfo GtkIconInfo;
+typedef struct _GtkMenu GtkMenu;
+typedef struct _GtkMenuItem GtkMenuItem;
+typedef struct _GtkObject GtkObject;
+typedef struct _GtkSelectionData GtkSelectionData;
+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;
+typedef struct _GdkDrawable GdkWindow;
+#else
+typedef struct _GdkWindow GdkWindow;
+typedef struct _GtkStyleContext GtkStyleContext;
+#endif
+
+#endif
+
+#endif
+#endif /* GtkTypedefs_h */
diff --git a/Source/WTF/wtf/gobject/GlibUtilities.cpp b/Source/WTF/wtf/gobject/GlibUtilities.cpp
new file mode 100644
index 0000000..1a2a8b1
--- /dev/null
+++ b/Source/WTF/wtf/gobject/GlibUtilities.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2010 Igalia, S.L.
+ *
+ *  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 "GlibUtilities.h"
+
+#if OS(WINDOWS)
+#include <windows.h>
+#include <wtf/text/WTFString.h>
+#else
+#include <limits.h>
+#include <unistd.h>
+#endif
+
+#if OS(LINUX)
+CString getCurrentExecutablePath()
+{
+    static char readLinkBuffer[PATH_MAX];
+    ssize_t result = readlink("/proc/self/exe", readLinkBuffer, PATH_MAX);
+    if (result == -1)
+        return CString();
+    return CString(readLinkBuffer, result);
+}
+#elif OS(UNIX)
+CString getCurrentExecutablePath()
+{
+    static char readLinkBuffer[PATH_MAX];
+    ssize_t result = readlink("/proc/curproc/file", readLinkBuffer, PATH_MAX);
+    if (result == -1)
+        return CString();
+    return CString(readLinkBuffer, result);
+}
+#elif OS(WINDOWS)
+CString getCurrentExecutablePath()
+{
+    static WCHAR buffer[MAX_PATH];
+    DWORD length = GetModuleFileNameW(0, buffer, MAX_PATH);
+    if (!length || (length == MAX_PATH && GetLastError() == ERROR_INSUFFICIENT_BUFFER))
+        return CString();
+
+    String path(buffer, length);
+    return path.utf8();
+}
+#endif
diff --git a/Source/WTF/wtf/gobject/GlibUtilities.h b/Source/WTF/wtf/gobject/GlibUtilities.h
new file mode 100644
index 0000000..ce10a05
--- /dev/null
+++ b/Source/WTF/wtf/gobject/GlibUtilities.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2010 Igalia, S.L.
+ *
+ *  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 GlibUtilities_h
+#define GlibUtilities_h
+
+#include <wtf/Assertions.h>
+#include <wtf/text/CString.h>
+
+CString getCurrentExecutablePath();
+
+#endif
diff --git a/Source/WTF/wtf/gtk/MainThreadGtk.cpp b/Source/WTF/wtf/gtk/MainThreadGtk.cpp
new file mode 100644
index 0000000..7624247
--- /dev/null
+++ b/Source/WTF/wtf/gtk/MainThreadGtk.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com)
+ *
+ * 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.  Neither the name of Apple Inc. ("Apple") 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 APPLE 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 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 "config.h"
+#include "MainThread.h"
+
+#include <glib.h>
+
+namespace WTF {
+
+void initializeMainThreadPlatform()
+{
+}
+
+static gboolean timeoutFired(gpointer)
+{
+    dispatchFunctionsFromMainThread();
+    return FALSE;
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+    g_timeout_add(0, timeoutFired, 0);
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/mac/MainThreadMac.mm b/Source/WTF/wtf/mac/MainThreadMac.mm
new file mode 100644
index 0000000..5a82f40
--- /dev/null
+++ b/Source/WTF/wtf/mac/MainThreadMac.mm
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2007, 2008 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+ 
+#import "config.h"
+#import "MainThread.h"
+
+#import <CoreFoundation/CoreFoundation.h>
+#import <Foundation/NSThread.h>
+#import <stdio.h>
+#import <wtf/Assertions.h>
+#import <wtf/HashSet.h>
+#import <wtf/Threading.h>
+
+@interface JSWTFMainThreadCaller : NSObject {
+}
+- (void)call;
+@end
+
+@implementation JSWTFMainThreadCaller
+
+- (void)call
+{
+    WTF::dispatchFunctionsFromMainThread();
+}
+
+@end // implementation JSWTFMainThreadCaller
+
+namespace WTF {
+
+static JSWTFMainThreadCaller* staticMainThreadCaller;
+static bool isTimerPosted; // This is only accessed on the 'main' thread.
+static bool mainThreadEstablishedAsPthreadMain;
+static pthread_t mainThreadPthread;
+static NSThread* mainThreadNSThread;
+
+void initializeMainThreadPlatform()
+{
+    ASSERT(!staticMainThreadCaller);
+    staticMainThreadCaller = [[JSWTFMainThreadCaller alloc] init];
+
+    mainThreadEstablishedAsPthreadMain = false;
+    mainThreadPthread = pthread_self();
+    mainThreadNSThread = [[NSThread currentThread] retain];
+    
+    initializeGCThreads();
+}
+
+void initializeMainThreadToProcessMainThreadPlatform()
+{
+    if (!pthread_main_np())
+        NSLog(@"WebKit Threading Violation - initial use of WebKit from a secondary thread.");
+
+    ASSERT(!staticMainThreadCaller);
+    staticMainThreadCaller = [[JSWTFMainThreadCaller alloc] init];
+
+    mainThreadEstablishedAsPthreadMain = true;
+    mainThreadPthread = 0;
+    mainThreadNSThread = nil;
+    
+    initializeGCThreads();
+}
+
+static void timerFired(CFRunLoopTimerRef timer, void*)
+{
+    CFRelease(timer);
+    isTimerPosted = false;
+    WTF::dispatchFunctionsFromMainThread();
+}
+
+static void postTimer()
+{
+    ASSERT(isMainThread());
+
+    if (isTimerPosted)
+        return;
+
+    isTimerPosted = true;
+    CFRunLoopAddTimer(CFRunLoopGetCurrent(), CFRunLoopTimerCreate(0, 0, 0, 0, 0, timerFired, 0), kCFRunLoopCommonModes);
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+    ASSERT(staticMainThreadCaller);
+
+    if (isMainThread()) {
+        postTimer();
+        return;
+    }
+
+    if (mainThreadEstablishedAsPthreadMain) {
+        ASSERT(!mainThreadNSThread);
+        [staticMainThreadCaller performSelectorOnMainThread:@selector(call) withObject:nil waitUntilDone:NO];
+        return;
+    }
+
+    ASSERT(mainThreadNSThread);
+    [staticMainThreadCaller performSelector:@selector(call) onThread:mainThreadNSThread withObject:nil waitUntilDone:NO];
+}
+
+bool isMainThread()
+{
+    if (mainThreadEstablishedAsPthreadMain) {
+        ASSERT(!mainThreadPthread);
+        return pthread_main_np();
+    }
+
+    ASSERT(mainThreadPthread);
+    return pthread_equal(pthread_self(), mainThreadPthread);
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/qt/MainThreadQt.cpp b/Source/WTF/wtf/qt/MainThreadQt.cpp
new file mode 100644
index 0000000..606a719
--- /dev/null
+++ b/Source/WTF/wtf/qt/MainThreadQt.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2007 Staikos Computing Services Inc.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2008 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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 "config.h"
+#include "MainThread.h"
+
+#include <QCoreApplication>
+#include <QEvent>
+#include <QObject>
+#include <QThread>
+
+namespace WTF {
+
+static int s_mainThreadInvokerEventType;
+
+class MainThreadInvoker : public QObject {
+    Q_OBJECT
+public:
+    MainThreadInvoker();
+    virtual bool event(QEvent*);
+};
+
+MainThreadInvoker::MainThreadInvoker()
+{
+    s_mainThreadInvokerEventType = QEvent::registerEventType();
+}
+
+bool MainThreadInvoker::event(QEvent* e)
+{
+    if (e->type() != s_mainThreadInvokerEventType)
+        return QObject::event(e);
+
+    dispatchFunctionsFromMainThread();
+    return true;
+}
+
+Q_GLOBAL_STATIC(MainThreadInvoker, webkit_main_thread_invoker)
+
+void initializeMainThreadPlatform()
+{
+    webkit_main_thread_invoker();
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+    QCoreApplication::postEvent(webkit_main_thread_invoker(), new QEvent(static_cast<QEvent::Type>(s_mainThreadInvokerEventType)));
+}
+
+} // namespace WTF
+
+#include "MainThreadQt.moc"
diff --git a/Source/WTF/wtf/qt/StringQt.cpp b/Source/WTF/wtf/qt/StringQt.cpp
new file mode 100644
index 0000000..4f1e939
--- /dev/null
+++ b/Source/WTF/wtf/qt/StringQt.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 <wtf/StdLibExtras.h>
+#include <wtf/text/WTFString.h>
+
+#include <QString>
+
+namespace WTF {
+
+// String conversions
+String::String(const QString& qstr)
+{
+    if (qstr.isNull())
+        return;
+    m_impl = StringImpl::adopt(const_cast<QString&>(qstr).data_ptr());
+}
+
+String::String(const QStringRef& ref)
+{
+    if (!ref.string())
+        return;
+    m_impl = StringImpl::create(reinterpret_cast_ptr<const UChar*>(ref.unicode()), ref.length());
+}
+
+String::operator QString() const
+{
+    if (!m_impl)
+        return QString();
+
+    if (QStringData* qStringData = m_impl->qStringData()) {
+        // The WTF string was adopted from a QString at some point, so we
+        // can just adopt the QStringData like a regular QString copy.
+        qStringData->ref.ref();
+        QStringDataPtr qStringDataPointer = { qStringData };
+        return QString(qStringDataPointer);
+    }
+
+    if (is8Bit() && !m_impl->has16BitShadow()) {
+        // Asking for characters() of an 8-bit string will make a 16-bit copy internally
+        // in WTF::String. Since we're going to copy the data to QStringData anyways, we
+        // can do the conversion ourselves and save one copy.
+        return QString::fromLatin1(reinterpret_cast<const char*>(characters8()), length());
+    }
+
+    return QString(reinterpret_cast<const QChar*>(characters()), length());
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/Source/WTF/wtf/text/ASCIIFastPath.h b/Source/WTF/wtf/text/ASCIIFastPath.h
new file mode 100644
index 0000000..fef892a
--- /dev/null
+++ b/Source/WTF/wtf/text/ASCIIFastPath.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 ASCIIFastPath_h
+#define ASCIIFastPath_h
+
+#if OS(DARWIN) && (CPU(X86) || CPU(X86_64))
+#include <emmintrin.h>
+#endif
+#include <stdint.h>
+#include <wtf/Alignment.h>
+#include <wtf/unicode/Unicode.h>
+
+namespace WTF {
+
+// Assuming that a pointer is the size of a "machine word", then
+// uintptr_t is an integer type that is also a machine word.
+typedef uintptr_t MachineWord;
+const uintptr_t machineWordAlignmentMask = sizeof(MachineWord) - 1;
+
+inline bool isAlignedToMachineWord(const void* pointer)
+{
+    return !(reinterpret_cast<uintptr_t>(pointer) & machineWordAlignmentMask);
+}
+
+template<typename T> inline T* alignToMachineWord(T* pointer)
+{
+    return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(pointer) & ~machineWordAlignmentMask);
+}
+
+template<size_t size, typename CharacterType> struct NonASCIIMask;
+template<> struct NonASCIIMask<4, UChar> {
+    static inline uint32_t value() { return 0xFF80FF80U; }
+};
+template<> struct NonASCIIMask<4, LChar> {
+    static inline uint32_t value() { return 0x80808080U; }
+};
+template<> struct NonASCIIMask<8, UChar> {
+    static inline uint64_t value() { return 0xFF80FF80FF80FF80ULL; }
+};
+template<> struct NonASCIIMask<8, LChar> {
+    static inline uint64_t value() { return 0x8080808080808080ULL; }
+};
+
+
+template<typename CharacterType>
+inline bool isAllASCII(MachineWord word)
+{
+    return !(word & NonASCIIMask<sizeof(MachineWord), CharacterType>::value());
+}
+
+// Note: This function assume the input is likely all ASCII, and
+// does not leave early if it is not the case.
+template<typename CharacterType>
+inline bool charactersAreAllASCII(const CharacterType* characters, size_t length)
+{
+    MachineWord allCharBits = 0;
+    const CharacterType* end = characters + length;
+
+    // Prologue: align the input.
+    while (!isAlignedToMachineWord(characters) && characters != end) {
+        allCharBits |= *characters;
+        ++characters;
+    }
+
+    // Compare the values of CPU word size.
+    const CharacterType* wordEnd = alignToMachineWord(end);
+    const size_t loopIncrement = sizeof(MachineWord) / sizeof(CharacterType);
+    while (characters < wordEnd) {
+        allCharBits |= *(reinterpret_cast<const MachineWord*>(characters));
+        characters += loopIncrement;
+    }
+
+    // Process the remaining bytes.
+    while (characters != end) {
+        allCharBits |= *characters;
+        ++characters;
+    }
+
+    MachineWord nonASCIIBitMask = NonASCIIMask<sizeof(MachineWord), CharacterType>::value();
+    return !(allCharBits & nonASCIIBitMask);
+}
+
+inline void copyLCharsFromUCharSource(LChar* destination, const UChar* source, size_t length)
+{
+#if OS(DARWIN) && (CPU(X86) || CPU(X86_64))
+    const uintptr_t memoryAccessSize = 16; // Memory accesses on 16 byte (128 bit) alignment
+    const uintptr_t memoryAccessMask = memoryAccessSize - 1;
+
+    size_t i = 0;
+    for (;i < length && !isAlignedTo<memoryAccessMask>(&source[i]); ++i) {
+        ASSERT(!(source[i] & 0xff00));
+        destination[i] = static_cast<LChar>(source[i]);
+    }
+
+    const uintptr_t sourceLoadSize = 32; // Process 32 bytes (16 UChars) each iteration
+    const unsigned ucharsPerLoop = sourceLoadSize / sizeof(UChar);
+    if (length > ucharsPerLoop) {
+        const unsigned endLength = length - ucharsPerLoop + 1;
+        for (; i < endLength; i += ucharsPerLoop) {
+#ifndef NDEBUG
+            for (unsigned checkIndex = 0; checkIndex < ucharsPerLoop; checkIndex++)
+                ASSERT(!(source[i+checkIndex] & 0xff00));
+#endif
+            __m128i first8UChars = _mm_load_si128(reinterpret_cast<const __m128i*>(&source[i]));
+            __m128i second8UChars = _mm_load_si128(reinterpret_cast<const __m128i*>(&source[i+8]));
+            __m128i packedChars = _mm_packus_epi16(first8UChars, second8UChars);
+            _mm_storeu_si128(reinterpret_cast<__m128i*>(&destination[i]), packedChars);
+        }
+    }
+
+    for (; i < length; ++i) {
+        ASSERT(!(source[i] & 0xff00));
+        destination[i] = static_cast<LChar>(source[i]);
+    }
+#elif COMPILER(GCC) && CPU(ARM_NEON) && !(PLATFORM(BIG_ENDIAN) || PLATFORM(MIDDLE_ENDIAN)) && defined(NDEBUG)
+    const LChar* const end = destination + length;
+    const uintptr_t memoryAccessSize = 8;
+
+    if (length >= (2 * memoryAccessSize) - 1) {
+        // Prefix: align dst on 64 bits.
+        const uintptr_t memoryAccessMask = memoryAccessSize - 1;
+        do {
+            *destination++ = static_cast<LChar>(*source++);
+        } while (!isAlignedTo<memoryAccessMask>(destination));
+
+        // Vector interleaved unpack, we only store the lower 8 bits.
+        const uintptr_t lengthLeft = end - destination;
+        const LChar* const simdEnd = end - (lengthLeft % memoryAccessSize);
+        do {
+            asm("vld2.8   { d0-d1 }, [%[SOURCE]] !\n\t"
+                "vst1.8   { d0 }, [%[DESTINATION],:64] !\n\t"
+                : [SOURCE]"+r" (source), [DESTINATION]"+r" (destination)
+                :
+                : "memory", "d0", "d1");
+        } while (destination != simdEnd);
+    }
+
+    while (destination != end)
+        *destination++ = static_cast<LChar>(*source++);
+#else
+    for (size_t i = 0; i < length; ++i) {
+        ASSERT(!(source[i] & 0xff00));
+        destination[i] = static_cast<LChar>(source[i]);
+    }
+#endif
+}
+
+} // namespace WTF
+
+#endif // ASCIIFastPath_h
diff --git a/Source/WTF/wtf/text/AtomicString.cpp b/Source/WTF/wtf/text/AtomicString.cpp
new file mode 100644
index 0000000..de21b8b
--- /dev/null
+++ b/Source/WTF/wtf/text/AtomicString.cpp
@@ -0,0 +1,458 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+ * Copyright (C) 2012 Google 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.
+ *
+ */
+
+#include "config.h"
+
+#include "AtomicString.h"
+
+#include "StringHash.h"
+#include <wtf/HashSet.h>
+#include <wtf/Threading.h>
+#include <wtf/WTFThreadData.h>
+#include <wtf/unicode/UTF8.h>
+
+namespace WTF {
+
+using namespace Unicode;
+
+COMPILE_ASSERT(sizeof(AtomicString) == sizeof(String), atomic_string_and_string_must_be_same_size);
+
+class AtomicStringTable {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    static AtomicStringTable* create()
+    {
+        AtomicStringTable* table = new AtomicStringTable;
+
+        WTFThreadData& data = wtfThreadData();
+        data.m_atomicStringTable = table;
+        data.m_atomicStringTableDestructor = AtomicStringTable::destroy;
+
+        return table;
+    }
+
+    HashSet<StringImpl*>& table()
+    {
+        return m_table;
+    }
+
+private:
+    static void destroy(AtomicStringTable* table)
+    {
+        HashSet<StringImpl*>::iterator end = table->m_table.end();
+        for (HashSet<StringImpl*>::iterator iter = table->m_table.begin(); iter != end; ++iter)
+            (*iter)->setIsAtomic(false);
+        delete table;
+    }
+
+    HashSet<StringImpl*> m_table;
+};
+
+static inline HashSet<StringImpl*>& stringTable()
+{
+    // Once possible we should make this non-lazy (constructed in WTFThreadData's constructor).
+    AtomicStringTable* table = wtfThreadData().atomicStringTable();
+    if (UNLIKELY(!table))
+        table = AtomicStringTable::create();
+    return table->table();
+}
+
+template<typename T, typename HashTranslator>
+static inline PassRefPtr<StringImpl> addToStringTable(const T& value)
+{
+    HashSet<StringImpl*>::AddResult addResult = stringTable().add<T, HashTranslator>(value);
+
+    // If the string is newly-translated, then we need to adopt it.
+    // The boolean in the pair tells us if that is so.
+    return addResult.isNewEntry ? adoptRef(*addResult.iterator) : *addResult.iterator;
+}
+
+struct CStringTranslator {
+    static unsigned hash(const LChar* c)
+    {
+        return StringHasher::computeHashAndMaskTop8Bits(c);
+    }
+
+    static inline bool equal(StringImpl* r, const LChar* s)
+    {
+        return WTF::equal(r, s);
+    }
+
+    static void translate(StringImpl*& location, const LChar* const& c, unsigned hash)
+    {
+        location = StringImpl::create(c).leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+PassRefPtr<StringImpl> AtomicString::add(const LChar* c)
+{
+    if (!c)
+        return 0;
+    if (!*c)
+        return StringImpl::empty();
+
+    return addToStringTable<const LChar*, CStringTranslator>(c);
+}
+
+template<typename CharacterType>
+struct HashTranslatorCharBuffer {
+    const CharacterType* s;
+    unsigned length;
+};
+
+typedef HashTranslatorCharBuffer<UChar> UCharBuffer;
+struct UCharBufferTranslator {
+    static unsigned hash(const UCharBuffer& buf)
+    {
+        return StringHasher::computeHashAndMaskTop8Bits(buf.s, buf.length);
+    }
+
+    static bool equal(StringImpl* const& str, const UCharBuffer& buf)
+    {
+        return WTF::equal(str, buf.s, buf.length);
+    }
+
+    static void translate(StringImpl*& location, const UCharBuffer& buf, unsigned hash)
+    {
+        location = StringImpl::create8BitIfPossible(buf.s, buf.length).leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+template<typename CharacterType>
+struct HashAndCharacters {
+    unsigned hash;
+    const CharacterType* characters;
+    unsigned length;
+};
+
+template<typename CharacterType>
+struct HashAndCharactersTranslator {
+    static unsigned hash(const HashAndCharacters<CharacterType>& buffer)
+    {
+        ASSERT(buffer.hash == StringHasher::computeHashAndMaskTop8Bits(buffer.characters, buffer.length));
+        return buffer.hash;
+    }
+
+    static bool equal(StringImpl* const& string, const HashAndCharacters<CharacterType>& buffer)
+    {
+        return WTF::equal(string, buffer.characters, buffer.length);
+    }
+
+    static void translate(StringImpl*& location, const HashAndCharacters<CharacterType>& buffer, unsigned hash)
+    {
+        location = StringImpl::create(buffer.characters, buffer.length).leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+struct HashAndUTF8Characters {
+    unsigned hash;
+    const char* characters;
+    unsigned length;
+    unsigned utf16Length;
+};
+
+struct HashAndUTF8CharactersTranslator {
+    static unsigned hash(const HashAndUTF8Characters& buffer)
+    {
+        return buffer.hash;
+    }
+
+    static bool equal(StringImpl* const& string, const HashAndUTF8Characters& buffer)
+    {
+        if (buffer.utf16Length != string->length())
+            return false;
+
+        // If buffer contains only ASCII characters UTF-8 and UTF16 length are the same.
+        if (buffer.utf16Length != buffer.length) {
+            const UChar* stringCharacters = string->characters();
+
+            return equalUTF16WithUTF8(stringCharacters, stringCharacters + string->length(), buffer.characters, buffer.characters + buffer.length);
+        }
+
+        if (string->is8Bit()) {
+            const LChar* stringCharacters = string->characters8();
+
+            for (unsigned i = 0; i < buffer.length; ++i) {
+                ASSERT(isASCII(buffer.characters[i]));
+                if (stringCharacters[i] != buffer.characters[i])
+                    return false;
+            }
+
+            return true;
+        }
+
+        const UChar* stringCharacters = string->characters16();
+
+        for (unsigned i = 0; i < buffer.length; ++i) {
+            ASSERT(isASCII(buffer.characters[i]));
+            if (stringCharacters[i] != buffer.characters[i])
+                return false;
+        }
+
+        return true;
+    }
+
+    static void translate(StringImpl*& location, const HashAndUTF8Characters& buffer, unsigned hash)
+    {
+        UChar* target;
+        RefPtr<StringImpl> newString = StringImpl::createUninitialized(buffer.utf16Length, target);
+
+        bool isAllASCII;
+        const char* source = buffer.characters;
+        if (convertUTF8ToUTF16(&source, source + buffer.length, &target, target + buffer.utf16Length, &isAllASCII) != conversionOK)
+            ASSERT_NOT_REACHED();
+
+        if (isAllASCII)
+            newString = StringImpl::create(buffer.characters, buffer.length);
+
+        location = newString.release().leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+PassRefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length)
+{
+    if (!s)
+        return 0;
+
+    if (!length)
+        return StringImpl::empty();
+    
+    UCharBuffer buffer = { s, length };
+    return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer);
+}
+
+PassRefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length, unsigned existingHash)
+{
+    ASSERT(s);
+    ASSERT(existingHash);
+
+    if (!length)
+        return StringImpl::empty();
+
+    HashAndCharacters<UChar> buffer = { existingHash, s, length };
+    return addToStringTable<HashAndCharacters<UChar>, HashAndCharactersTranslator<UChar> >(buffer);
+}
+
+PassRefPtr<StringImpl> AtomicString::add(const UChar* s)
+{
+    if (!s)
+        return 0;
+
+    unsigned length = 0;
+    while (s[length] != UChar(0))
+        length++;
+
+    if (!length)
+        return StringImpl::empty();
+
+    UCharBuffer buffer = { s, length };
+    return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer);
+}
+
+struct SubstringLocation {
+    StringImpl* baseString;
+    unsigned start;
+    unsigned length;
+};
+
+struct SubstringTranslator {
+    static unsigned hash(const SubstringLocation& buffer)
+    {
+        return StringHasher::computeHashAndMaskTop8Bits(buffer.baseString->characters() + buffer.start, buffer.length);
+    }
+
+    static bool equal(StringImpl* const& string, const SubstringLocation& buffer)
+    {
+        return WTF::equal(string, buffer.baseString->characters() + buffer.start, buffer.length);
+    }
+
+    static void translate(StringImpl*& location, const SubstringLocation& buffer, unsigned hash)
+    {
+        location = StringImpl::create(buffer.baseString, buffer.start, buffer.length).leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+PassRefPtr<StringImpl> AtomicString::add(StringImpl* baseString, unsigned start, unsigned length)
+{
+    if (!baseString)
+        return 0;
+
+    if (!length || start >= baseString->length())
+        return StringImpl::empty();
+
+    unsigned maxLength = baseString->length() - start;
+    if (length >= maxLength) {
+        if (!start)
+            return add(baseString);
+        length = maxLength;
+    }
+
+    SubstringLocation buffer = { baseString, start, length };
+    return addToStringTable<SubstringLocation, SubstringTranslator>(buffer);
+}
+    
+typedef HashTranslatorCharBuffer<LChar> LCharBuffer;
+struct LCharBufferTranslator {
+    static unsigned hash(const LCharBuffer& buf)
+    {
+        return StringHasher::computeHashAndMaskTop8Bits(buf.s, buf.length);
+    }
+
+    static bool equal(StringImpl* const& str, const LCharBuffer& buf)
+    {
+        return WTF::equal(str, buf.s, buf.length);
+    }
+
+    static void translate(StringImpl*& location, const LCharBuffer& buf, unsigned hash)
+    {
+        location = StringImpl::create(buf.s, buf.length).leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+typedef HashTranslatorCharBuffer<char> CharBuffer;
+struct CharBufferFromLiteralDataTranslator {
+    static unsigned hash(const CharBuffer& buf)
+    {
+        return StringHasher::computeHashAndMaskTop8Bits(reinterpret_cast<const LChar*>(buf.s), buf.length);
+    }
+
+    static bool equal(StringImpl* const& str, const CharBuffer& buf)
+    {
+        return WTF::equal(str, buf.s, buf.length);
+    }
+
+    static void translate(StringImpl*& location, const CharBuffer& buf, unsigned hash)
+    {
+        location = StringImpl::createFromLiteral(buf.s, buf.length).leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+PassRefPtr<StringImpl> AtomicString::add(const LChar* s, unsigned length)
+{
+    if (!s)
+        return 0;
+
+    if (!length)
+        return StringImpl::empty();
+
+    LCharBuffer buffer = { s, length };
+    return addToStringTable<LCharBuffer, LCharBufferTranslator>(buffer);
+}
+
+PassRefPtr<StringImpl> AtomicString::addFromLiteralData(const char* characters, unsigned length)
+{
+    ASSERT(characters);
+    ASSERT(length);
+
+    CharBuffer buffer = { characters, length };
+    return addToStringTable<CharBuffer, CharBufferFromLiteralDataTranslator>(buffer);
+}
+
+PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* r)
+{
+    if (!r->length())
+        return StringImpl::empty();
+
+    StringImpl* result = *stringTable().add(r).iterator;
+    if (result == r)
+        r->setIsAtomic(true);
+    return result;
+}
+
+template<typename CharacterType>
+static inline HashSet<StringImpl*>::iterator findString(const StringImpl* stringImpl)
+{
+    HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stringImpl->getCharacters<CharacterType>(), stringImpl->length() };
+    return stringTable().find<HashAndCharacters<CharacterType>, HashAndCharactersTranslator<CharacterType> >(buffer);
+}
+
+AtomicStringImpl* AtomicString::find(const StringImpl* stringImpl)
+{
+    ASSERT(stringImpl);
+    ASSERT(stringImpl->existingHash());
+
+    if (!stringImpl->length())
+        return static_cast<AtomicStringImpl*>(StringImpl::empty());
+
+    HashSet<StringImpl*>::iterator iterator;
+    if (stringImpl->is8Bit())
+        iterator = findString<LChar>(stringImpl);
+    else
+        iterator = findString<UChar>(stringImpl);
+    if (iterator == stringTable().end())
+        return 0;
+    return static_cast<AtomicStringImpl*>(*iterator);
+}
+
+void AtomicString::remove(StringImpl* r)
+{
+    stringTable().remove(r);
+}
+
+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;
+    return AtomicString(newImpl);
+}
+
+AtomicString AtomicString::fromUTF8Internal(const char* charactersStart, const char* charactersEnd)
+{
+    HashAndUTF8Characters buffer;
+    buffer.characters = charactersStart;
+    buffer.hash = calculateStringHashAndLengthFromUTF8MaskingTop8Bits(charactersStart, charactersEnd, buffer.length, buffer.utf16Length);
+
+    if (!buffer.hash)
+        return nullAtom;
+
+    AtomicString atomicString;
+    atomicString.m_string = addToStringTable<HashAndUTF8Characters, HashAndUTF8CharactersTranslator>(buffer);
+    return atomicString;
+}
+
+#ifndef NDEBUG
+void AtomicString::show() const
+{
+    m_string.show();
+}
+#endif
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/text/AtomicString.h b/Source/WTF/wtf/text/AtomicString.h
new file mode 100644
index 0000000..8aea585
--- /dev/null
+++ b/Source/WTF/wtf/text/AtomicString.h
@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 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 AtomicString_h
+#define AtomicString_h
+
+#include <wtf/text/AtomicStringImpl.h>
+#include <wtf/text/WTFString.h>
+
+// Define 'NO_IMPLICIT_ATOMICSTRING' before including this header,
+// to disallow (expensive) implicit String-->AtomicString conversions.
+#ifdef NO_IMPLICIT_ATOMICSTRING
+#define ATOMICSTRING_CONVERSION explicit
+#else
+#define ATOMICSTRING_CONVERSION
+#endif
+
+namespace WTF {
+
+struct AtomicStringHash;
+class MemoryObjectInfo;
+
+class AtomicString {
+public:
+    WTF_EXPORT_PRIVATE static void init();
+
+    AtomicString() { }
+    AtomicString(const LChar* s) : m_string(add(s)) { }
+    AtomicString(const char* s) : m_string(add(s)) { }
+    AtomicString(const LChar* s, unsigned length) : m_string(add(s, length)) { }
+    AtomicString(const UChar* s, unsigned length) : m_string(add(s, length)) { }
+    AtomicString(const UChar* s, unsigned length, unsigned existingHash) : m_string(add(s, length, existingHash)) { }
+    AtomicString(const UChar* s) : m_string(add(s)) { }
+    ATOMICSTRING_CONVERSION AtomicString(StringImpl* imp) : m_string(add(imp)) { }
+    AtomicString(AtomicStringImpl* imp) : m_string(imp) { }
+    ATOMICSTRING_CONVERSION AtomicString(const String& s) : m_string(add(s.impl())) { }
+    AtomicString(StringImpl* baseString, unsigned start, unsigned length) : m_string(add(baseString, start, length)) { }
+
+    enum ConstructFromLiteralTag { ConstructFromLiteral };
+    AtomicString(const char* characters, unsigned length, ConstructFromLiteralTag)
+        : m_string(addFromLiteralData(characters, length))
+    {
+    }
+    template<unsigned charactersCount>
+    ALWAYS_INLINE AtomicString(const char (&characters)[charactersCount], ConstructFromLiteralTag)
+        : m_string(addFromLiteralData(characters, charactersCount - 1))
+    {
+        COMPILE_ASSERT(charactersCount > 1, AtomicStringFromLiteralNotEmpty);
+        COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImpl)) / sizeof(LChar))), AtomicStringFromLiteralCannotOverflow);
+    }
+
+#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+    // We have to declare the copy constructor and copy assignment operator as well, otherwise
+    // they'll be implicitly deleted by adding the move constructor and move assignment operator.
+    // FIXME: Instead of explicitly casting to String&& here, we should use std::move, but that requires us to
+    // have a standard library that supports move semantics.
+    AtomicString(const AtomicString& other) : m_string(other.m_string) { }
+    AtomicString(AtomicString&& other) : m_string(static_cast<String&&>(other.m_string)) { }
+    AtomicString& operator=(const AtomicString& other) { m_string = other.m_string; return *this; }
+    AtomicString& operator=(AtomicString&& other) { m_string = static_cast<String&&>(other.m_string); return *this; }
+#endif
+
+    // Hash table deleted values, which are only constructed and never copied or destroyed.
+    AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDeletedValue) { }
+    bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedValue(); }
+
+    WTF_EXPORT_STRING_API static AtomicStringImpl* find(const StringImpl*);
+
+    operator const String&() const { return m_string; }
+    const String& string() const { return m_string; };
+
+    AtomicStringImpl* impl() const { return static_cast<AtomicStringImpl *>(m_string.impl()); }
+
+    bool is8Bit() const { return m_string.is8Bit(); }
+    const UChar* characters() const { return m_string.characters(); }
+    const LChar* characters8() const { return m_string.characters8(); }
+    const UChar* characters16() const { return m_string.characters16(); }
+    unsigned length() const { return m_string.length(); }
+    
+    UChar operator[](unsigned int i) const { return m_string[i]; }
+    
+    bool contains(UChar c) const { return m_string.contains(c); }
+    bool contains(const LChar* s, bool caseSensitive = true) const
+        { return m_string.contains(s, caseSensitive); }
+    bool contains(const String& s, bool caseSensitive = true) const
+        { return m_string.contains(s, caseSensitive); }
+
+    size_t find(UChar c, size_t start = 0) const { return m_string.find(c, start); }
+    size_t find(const LChar* s, size_t start = 0, bool caseSentitive = true) const
+        { return m_string.find(s, start, caseSentitive); }
+    size_t find(const String& s, size_t start = 0, bool caseSentitive = true) const
+        { return m_string.find(s, start, caseSentitive); }
+    
+    bool startsWith(const String& s, bool caseSensitive = true) const
+        { return m_string.startsWith(s, caseSensitive); }
+    bool startsWith(UChar character) const
+        { return m_string.startsWith(character); }
+    template<unsigned matchLength>
+    bool startsWith(const char (&prefix)[matchLength], bool caseSensitive = true) const
+        { return m_string.startsWith<matchLength>(prefix, caseSensitive); }
+
+    bool endsWith(const String& s, bool caseSensitive = true) const
+        { return m_string.endsWith(s, caseSensitive); }
+    bool endsWith(UChar character) const
+        { return m_string.endsWith(character); }
+    template<unsigned matchLength>
+    bool endsWith(const char (&prefix)[matchLength], bool caseSensitive = true) const
+        { return m_string.endsWith<matchLength>(prefix, caseSensitive); }
+    
+    WTF_EXPORT_STRING_API AtomicString lower() const;
+    AtomicString upper() const { return AtomicString(impl()->upper()); }
+    
+    int toInt(bool* ok = 0) const { return m_string.toInt(ok); }
+    double toDouble(bool* ok = 0) const { return m_string.toDouble(ok); }
+    float toFloat(bool* ok = 0) const { return m_string.toFloat(ok); }
+    bool percentage(int& p) const { return m_string.percentage(p); }
+
+    bool isNull() const { return m_string.isNull(); }
+    bool isEmpty() const { return m_string.isEmpty(); }
+
+    static void remove(StringImpl*);
+    
+#if USE(CF)
+    AtomicString(CFStringRef s) :  m_string(add(s)) { }
+#endif    
+#ifdef __OBJC__
+    AtomicString(NSString* s) : m_string(add((CFStringRef)s)) { }
+    operator NSString*() const { return m_string; }
+#endif
+#if PLATFORM(QT)
+    AtomicString(const QString& s) : m_string(add(String(s).impl())) { }
+    operator QString() const { return m_string; }
+#endif
+#if PLATFORM(BLACKBERRY)
+    AtomicString(const BlackBerry::Platform::String& s) : m_string(add(String(s).impl())) { }
+    operator BlackBerry::Platform::String() const { return m_string; }
+#endif
+
+    // AtomicString::fromUTF8 will return a null string if
+    // the input data contains invalid UTF-8 sequences.
+    static AtomicString fromUTF8(const char*, size_t);
+    static AtomicString fromUTF8(const char*);
+
+#ifndef NDEBUG
+    void show() const;
+#endif
+
+private:
+    // The explicit constructors with AtomicString::ConstructFromLiteral must be used for literals.
+    AtomicString(ASCIILiteral);
+
+    String m_string;
+    
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> add(const LChar*);
+    ALWAYS_INLINE static PassRefPtr<StringImpl> add(const char* s) { return add(reinterpret_cast<const LChar*>(s)); };
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> add(const LChar*, unsigned length);
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> add(const UChar*, unsigned length);
+    ALWAYS_INLINE static PassRefPtr<StringImpl> add(const char* s, unsigned length) { return add(reinterpret_cast<const LChar*>(s), length); };
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> add(const UChar*, unsigned length, unsigned existingHash);
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> add(const UChar*);
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> add(StringImpl*, unsigned offset, unsigned length);
+    ALWAYS_INLINE static PassRefPtr<StringImpl> add(StringImpl* r)
+    {
+        if (!r || r->isAtomic())
+            return r;
+        return addSlowCase(r);
+    }
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> addFromLiteralData(const char* characters, unsigned length);
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> addSlowCase(StringImpl*);
+#if USE(CF)
+    static PassRefPtr<StringImpl> add(CFStringRef);
+#endif
+
+    WTF_EXPORT_STRING_API static AtomicString fromUTF8Internal(const char*, const char*);
+};
+
+inline bool operator==(const AtomicString& a, const AtomicString& b) { return a.impl() == b.impl(); }
+bool operator==(const AtomicString&, const LChar*);
+inline bool operator==(const AtomicString& a, const char* b) { return WTF::equal(a.impl(), reinterpret_cast<const LChar*>(b)); }
+inline bool operator==(const AtomicString& a, const Vector<UChar>& b) { return a.impl() && equal(a.impl(), b.data(), b.size()); }    
+inline bool operator==(const AtomicString& a, const String& b) { return equal(a.impl(), b.impl()); }
+inline bool operator==(const LChar* a, const AtomicString& b) { return b == a; }
+inline bool operator==(const String& a, const AtomicString& b) { return equal(a.impl(), b.impl()); }
+inline bool operator==(const Vector<UChar>& a, const AtomicString& b) { return b == a; }
+
+inline bool operator!=(const AtomicString& a, const AtomicString& b) { return a.impl() != b.impl(); }
+inline bool operator!=(const AtomicString& a, const LChar* b) { return !(a == b); }
+inline bool operator!=(const AtomicString& a, const char* b) { return !(a == b); }
+inline bool operator!=(const AtomicString& a, const String& b) { return !equal(a.impl(), b.impl()); }
+inline bool operator!=(const AtomicString& a, const Vector<UChar>& b) { return !(a == b); }
+inline bool operator!=(const LChar* a, const AtomicString& b) { return !(b == a); }
+inline bool operator!=(const String& a, const AtomicString& b) { return !equal(a.impl(), b.impl()); }
+inline bool operator!=(const Vector<UChar>& a, const AtomicString& b) { return !(a == b); }
+
+inline bool equalIgnoringCase(const AtomicString& a, const AtomicString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+inline bool equalIgnoringCase(const AtomicString& a, const LChar* b) { return equalIgnoringCase(a.impl(), b); }
+inline bool equalIgnoringCase(const AtomicString& a, const char* b) { return equalIgnoringCase(a.impl(), reinterpret_cast<const LChar*>(b)); }
+inline bool equalIgnoringCase(const AtomicString& a, const String& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+inline bool equalIgnoringCase(const LChar* a, const AtomicString& b) { return equalIgnoringCase(a, b.impl()); }
+inline bool equalIgnoringCase(const char* a, const AtomicString& b) { return equalIgnoringCase(reinterpret_cast<const LChar*>(a), b.impl()); }
+inline bool equalIgnoringCase(const String& a, const AtomicString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+
+// Define external global variables for the commonly used atomic strings.
+// These are only usable from the main thread.
+#ifndef ATOMICSTRING_HIDE_GLOBALS
+extern const WTF_EXPORTDATA AtomicString nullAtom;
+extern const WTF_EXPORTDATA AtomicString emptyAtom;
+extern const WTF_EXPORTDATA AtomicString textAtom;
+extern const WTF_EXPORTDATA AtomicString commentAtom;
+extern const WTF_EXPORTDATA AtomicString starAtom;
+extern const WTF_EXPORTDATA AtomicString xmlAtom;
+extern const WTF_EXPORTDATA AtomicString xmlnsAtom;
+extern const WTF_EXPORTDATA AtomicString xlinkAtom;
+
+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;
+};
+
+} // namespace WTF
+
+#ifndef ATOMICSTRING_HIDE_GLOBALS
+using WTF::AtomicString;
+using WTF::nullAtom;
+using WTF::emptyAtom;
+using WTF::textAtom;
+using WTF::commentAtom;
+using WTF::starAtom;
+using WTF::xmlAtom;
+using WTF::xmlnsAtom;
+using WTF::xlinkAtom;
+#endif
+
+#include <wtf/text/StringConcatenate.h>
+#endif // AtomicString_h
diff --git a/Source/WTF/wtf/text/AtomicStringHash.h b/Source/WTF/wtf/text/AtomicStringHash.h
new file mode 100644
index 0000000..6130d94
--- /dev/null
+++ b/Source/WTF/wtf/text/AtomicStringHash.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2008 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef AtomicStringHash_h
+#define AtomicStringHash_h
+
+#include <wtf/text/AtomicString.h>
+#include <wtf/HashTraits.h>
+
+namespace WTF {
+
+    struct AtomicStringHash {
+        static unsigned hash(const AtomicString& key)
+        {
+            return key.impl()->existingHash();
+        }
+
+        static bool equal(const AtomicString& a, const AtomicString& b)
+        {
+            return a == b;
+        }
+
+        static const bool safeToCompareToEmptyOrDeleted = false;
+    };
+
+    // AtomicStringHash is the default hash for AtomicString
+    template<> struct HashTraits<WTF::AtomicString> : GenericHashTraits<WTF::AtomicString> {
+        static const bool emptyValueIsZero = true;
+        static void constructDeletedValue(WTF::AtomicString& slot) { new (NotNull, &slot) WTF::AtomicString(HashTableDeletedValue); }
+        static bool isDeletedValue(const WTF::AtomicString& slot) { return slot.isHashTableDeletedValue(); }
+    };
+
+}
+
+using WTF::AtomicStringHash;
+
+#endif
diff --git a/Source/WTF/wtf/text/AtomicStringImpl.h b/Source/WTF/wtf/text/AtomicStringImpl.h
new file mode 100644
index 0000000..0716275
--- /dev/null
+++ b/Source/WTF/wtf/text/AtomicStringImpl.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2006 Apple Computer, 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.
+ *
+ */
+
+#ifndef AtomicStringImpl_h
+#define AtomicStringImpl_h
+
+#include <wtf/text/StringImpl.h>
+
+namespace WTF {
+
+class AtomicStringImpl : public StringImpl
+{
+public:
+    AtomicStringImpl() : StringImpl(0) {}
+};
+
+}
+
+using WTF::AtomicStringImpl;
+
+#endif
diff --git a/Source/WTF/wtf/text/Base64.cpp b/Source/WTF/wtf/text/Base64.cpp
new file mode 100644
index 0000000..fafa3fa
--- /dev/null
+++ b/Source/WTF/wtf/text/Base64.cpp
@@ -0,0 +1,212 @@
+/*
+   Copyright (C) 2000-2001 Dawit Alemayehu <adawit@kde.org>
+   Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
+   Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+   Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License (LGPL)
+   version 2 as published by the Free Software Foundation.
+
+   This program 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 General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+   This code is based on the java implementation in HTTPClient
+   package by Ronald Tschalär Copyright (C) 1996-1999.
+*/
+
+#include "config.h"
+#include "Base64.h"
+
+#include <limits.h>
+#include <wtf/StringExtras.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+static const char base64EncMap[64] = {
+    0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+    0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
+    0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+    0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+    0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E,
+    0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
+    0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33,
+    0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F
+};
+
+static const char base64DecMap[128] = {
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x3F,
+    0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
+    0x3C, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
+    0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
+    0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+    0x17, 0x18, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20,
+    0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+    0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30,
+    0x31, 0x32, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+String base64Encode(const char* data, unsigned length, Base64EncodePolicy policy)
+{
+    Vector<char> result;
+    base64Encode(data, length, result, policy);
+    return String(result.data(), result.size());
+}
+
+void base64Encode(const char* data, unsigned len, Vector<char>& out, Base64EncodePolicy policy)
+{
+    out.clear();
+    if (!len)
+        return;
+
+    // If the input string is pathologically large, just return nothing.
+    // Note: Keep this in sync with the "outLength" computation below.
+    // Rather than being perfectly precise, this is a bit conservative.
+    const unsigned maxInputBufferSize = UINT_MAX / 77 * 76 / 4 * 3 - 2;
+    if (len > maxInputBufferSize)
+        return;
+
+    unsigned sidx = 0;
+    unsigned didx = 0;
+
+    unsigned outLength = ((len + 2) / 3) * 4;
+
+    // Deal with the 76 character per line limit specified in RFC 2045.
+    bool insertLFs = (policy == Base64InsertLFs && outLength > 76);
+    if (insertLFs)
+        outLength += ((outLength - 1) / 76);
+
+    int count = 0;
+    out.grow(outLength);
+
+    // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion
+    if (len > 1) {
+        while (sidx < len - 2) {
+            if (insertLFs) {
+                if (count && !(count % 76))
+                    out[didx++] = '\n';
+                count += 4;
+            }
+            out[didx++] = base64EncMap[(data[sidx] >> 2) & 077];
+            out[didx++] = base64EncMap[((data[sidx + 1] >> 4) & 017) | ((data[sidx] << 4) & 077)];
+            out[didx++] = base64EncMap[((data[sidx + 2] >> 6) & 003) | ((data[sidx + 1] << 2) & 077)];
+            out[didx++] = base64EncMap[data[sidx + 2] & 077];
+            sidx += 3;
+        }
+    }
+
+    if (sidx < len) {
+        if (insertLFs && (count > 0) && !(count % 76))
+           out[didx++] = '\n';
+
+        out[didx++] = base64EncMap[(data[sidx] >> 2) & 077];
+        if (sidx < len - 1) {
+            out[didx++] = base64EncMap[((data[sidx + 1] >> 4) & 017) | ((data[sidx] << 4) & 077)];
+            out[didx++] = base64EncMap[(data[sidx + 1] << 2) & 077];
+        } else
+            out[didx++] = base64EncMap[(data[sidx] << 4) & 077];
+    }
+
+    // Add padding
+    while (didx < out.size()) {
+        out[didx] = '=';
+        didx++;
+    }
+}
+
+bool base64Decode(const Vector<char>& in, Vector<char>& out, Base64DecodePolicy policy)
+{
+    out.clear();
+
+    // If the input string is pathologically large, just return nothing.
+    if (in.size() > UINT_MAX)
+        return false;
+
+    return base64Decode(in.data(), in.size(), out, policy);
+}
+
+template<typename T>
+static inline bool base64DecodeInternal(const T* data, unsigned len, Vector<char>& out, Base64DecodePolicy policy)
+{
+    out.clear();
+    if (!len)
+        return true;
+
+    out.grow(len);
+
+    bool sawEqualsSign = false;
+    unsigned outLength = 0;
+    for (unsigned idx = 0; idx < len; idx++) {
+        unsigned ch = data[idx];
+        if (ch == '=')
+            sawEqualsSign = true;
+        else if (('0' <= ch && ch <= '9') || ('A' <= ch && ch <= 'Z') || ('a' <= ch && ch <= 'z') || ch == '+' || ch == '/') {
+            if (sawEqualsSign)
+                return false;
+            out[outLength] = base64DecMap[ch];
+            outLength++;
+        } else if (policy == Base64FailOnInvalidCharacter || (policy == Base64IgnoreWhitespace && !isSpaceOrNewline(ch)))
+            return false;
+    }
+
+    if (!outLength)
+        return !sawEqualsSign;
+
+    // Valid data is (n * 4 + [0,2,3]) characters long.
+    if ((outLength % 4) == 1)
+        return false;
+    
+    // 4-byte to 3-byte conversion
+    outLength -= (outLength + 3) / 4;
+    if (!outLength)
+        return false;
+
+    unsigned sidx = 0;
+    unsigned didx = 0;
+    if (outLength > 1) {
+        while (didx < outLength - 2) {
+            out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx + 1] >> 4) & 003));
+            out[didx + 1] = (((out[sidx + 1] << 4) & 255) | ((out[sidx + 2] >> 2) & 017));
+            out[didx + 2] = (((out[sidx + 2] << 6) & 255) | (out[sidx + 3] & 077));
+            sidx += 4;
+            didx += 3;
+        }
+    }
+
+    if (didx < outLength)
+        out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx + 1] >> 4) & 003));
+
+    if (++didx < outLength)
+        out[didx] = (((out[sidx + 1] << 4) & 255) | ((out[sidx + 2] >> 2) & 017));
+
+    if (outLength < out.size())
+        out.shrink(outLength);
+
+    return true;
+}
+
+bool base64Decode(const char* data, unsigned len, Vector<char>& out, Base64DecodePolicy policy)
+{
+    return base64DecodeInternal<char>(data, len, out, policy);
+}
+
+bool base64Decode(const String& in, Vector<char>& out, Base64DecodePolicy policy)
+{
+    return base64DecodeInternal<UChar>(in.characters(), in.length(), out, policy);
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/text/Base64.h b/Source/WTF/wtf/text/Base64.h
new file mode 100644
index 0000000..5b0d4d8
--- /dev/null
+++ b/Source/WTF/wtf/text/Base64.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
+ * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 Base64_h
+#define Base64_h
+
+#include <wtf/Vector.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+enum Base64EncodePolicy {
+    Base64DoNotInsertLFs,
+    Base64InsertLFs
+};
+
+enum Base64DecodePolicy {
+    Base64FailOnInvalidCharacter,
+    Base64IgnoreWhitespace,
+    Base64IgnoreInvalidCharacters
+};
+
+WTF_EXPORT_PRIVATE void base64Encode(const char*, unsigned, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
+WTF_EXPORT_PRIVATE void base64Encode(const Vector<char>&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
+WTF_EXPORT_PRIVATE void base64Encode(const CString&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
+WTF_EXPORT_PRIVATE String base64Encode(const char*, unsigned, Base64EncodePolicy = Base64DoNotInsertLFs);
+WTF_EXPORT_PRIVATE String base64Encode(const Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs);
+WTF_EXPORT_PRIVATE String base64Encode(const CString&, Base64EncodePolicy = Base64DoNotInsertLFs);
+
+WTF_EXPORT_PRIVATE bool base64Decode(const String&, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter);
+WTF_EXPORT_PRIVATE bool base64Decode(const Vector<char>&, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter);
+WTF_EXPORT_PRIVATE bool base64Decode(const char*, unsigned, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter);
+
+inline void base64Encode(const Vector<char>& in, Vector<char>& out, Base64EncodePolicy policy)
+{
+    base64Encode(in.data(), in.size(), out, policy);
+}
+
+inline void base64Encode(const CString& in, Vector<char>& out, Base64EncodePolicy policy)
+{
+    base64Encode(in.data(), in.length(), out, policy);
+}
+
+inline String base64Encode(const Vector<char>& in, Base64EncodePolicy policy)
+{
+    return base64Encode(in.data(), in.size(), policy);
+}
+
+inline String base64Encode(const CString& in, Base64EncodePolicy policy)
+{
+    return base64Encode(in.data(), in.length(), policy);
+}
+
+} // namespace WTF
+
+using WTF::Base64EncodePolicy;
+using WTF::Base64DoNotInsertLFs;
+using WTF::Base64InsertLFs;
+using WTF::Base64DecodePolicy;
+using WTF::Base64FailOnInvalidCharacter;
+using WTF::Base64IgnoreWhitespace;
+using WTF::Base64IgnoreInvalidCharacters;
+using WTF::base64Encode;
+using WTF::base64Decode;
+
+#endif // Base64_h
diff --git a/Source/WTF/wtf/text/CString.cpp b/Source/WTF/wtf/text/CString.cpp
new file mode 100644
index 0000000..fe14855
--- /dev/null
+++ b/Source/WTF/wtf/text/CString.cpp
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2012 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 "CString.h"
+
+using namespace std;
+
+namespace WTF {
+
+PassRefPtr<CStringBuffer> CStringBuffer::createUninitialized(size_t length)
+{
+    if (length > (numeric_limits<size_t>::max() - sizeof(CStringBuffer)))
+        CRASH();
+
+    // CStringBuffer already has space for one character, we do not need to add +1 to the length
+    // to store the terminating zero.
+    size_t size = sizeof(CStringBuffer) + length;
+    CStringBuffer* stringBuffer = static_cast<CStringBuffer*>(fastMalloc(size));
+    return adoptRef(new (NotNull, stringBuffer) CStringBuffer(length));
+}
+
+CString::CString(const char* str)
+{
+    if (!str)
+        return;
+
+    init(str, strlen(str));
+}
+
+CString::CString(const char* str, size_t length)
+{
+    if (!str) {
+        ASSERT(!length);
+        return;
+    }
+
+    init(str, length);
+}
+
+void CString::init(const char* str, size_t length)
+{
+    ASSERT(str);
+
+    m_buffer = CStringBuffer::createUninitialized(length);
+    memcpy(m_buffer->mutableData(), str, length); 
+    m_buffer->mutableData()[length] = '\0';
+}
+
+char* CString::mutableData()
+{
+    copyBufferIfNeeded();
+    if (!m_buffer)
+        return 0;
+    return m_buffer->mutableData();
+}
+    
+CString CString::newUninitialized(size_t length, char*& characterBuffer)
+{
+    CString result;
+    result.m_buffer = CStringBuffer::createUninitialized(length);
+    char* bytes = result.m_buffer->mutableData();
+    bytes[length] = '\0';
+    characterBuffer = bytes;
+    return result;
+}
+
+void CString::copyBufferIfNeeded()
+{
+    if (!m_buffer || m_buffer->hasOneRef())
+        return;
+
+    RefPtr<CStringBuffer> buffer = m_buffer.release();
+    size_t length = buffer->length();
+    m_buffer = CStringBuffer::createUninitialized(length);
+    memcpy(m_buffer->mutableData(), buffer->data(), length + 1);
+}
+
+bool operator==(const CString& a, const CString& b)
+{
+    if (a.isNull() != b.isNull())
+        return false;
+    if (a.length() != b.length())
+        return false;
+    return !strncmp(a.data(), b.data(), min(a.length(), b.length()));
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/text/CString.h b/Source/WTF/wtf/text/CString.h
new file mode 100644
index 0000000..4d894b1
--- /dev/null
+++ b/Source/WTF/wtf/text/CString.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2012 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 CString_h
+#define CString_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+// CStringBuffer is the ref-counted storage class for the characters in a CString.
+// The data is implicitly allocated 1 character longer than length(), as it is zero-terminated.
+class CStringBuffer : public RefCounted<CStringBuffer> {
+public:
+    const char* data() { return m_data; }
+    size_t length() const { return m_length; }
+
+private:
+    friend class CString;
+
+    static PassRefPtr<CStringBuffer> createUninitialized(size_t length);
+
+    CStringBuffer(size_t length) : m_length(length) { }
+    char* mutableData() { return m_data; }
+
+    const size_t m_length;
+    char m_data[1];
+};
+
+// A container for a null-terminated char array supporting copy-on-write
+// assignment.  The contained char array may be null.
+class CString {
+public:
+    CString() { }
+    WTF_EXPORT_PRIVATE CString(const char*);
+    WTF_EXPORT_PRIVATE CString(const char*, size_t length);
+    CString(CStringBuffer* buffer) : m_buffer(buffer) { }
+    WTF_EXPORT_PRIVATE static CString newUninitialized(size_t length, char*& characterBuffer);
+
+    const char* data() const
+    {
+        return m_buffer ? m_buffer->data() : 0;
+    }
+    WTF_EXPORT_PRIVATE char* mutableData();
+    size_t length() const
+    {
+        return m_buffer ? m_buffer->length() : 0;
+    }
+
+    bool isNull() const { return !m_buffer; }
+
+    CStringBuffer* buffer() const { return m_buffer.get(); }
+
+private:
+    void copyBufferIfNeeded();
+    void init(const char*, size_t length);
+    RefPtr<CStringBuffer> m_buffer;
+};
+
+WTF_EXPORT_PRIVATE bool operator==(const CString& a, const CString& b);
+inline bool operator!=(const CString& a, const CString& b) { return !(a == b); }
+
+} // namespace WTF
+
+using WTF::CString;
+
+#endif // CString_h
diff --git a/Source/WTF/wtf/text/IntegerToStringConversion.h b/Source/WTF/wtf/text/IntegerToStringConversion.h
new file mode 100644
index 0000000..e1f5218
--- /dev/null
+++ b/Source/WTF/wtf/text/IntegerToStringConversion.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
+ *
+ * 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 IntegerToStringConversion_h
+#define IntegerToStringConversion_h
+
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/StringImpl.h>
+
+namespace WTF {
+
+enum PositiveOrNegativeNumber {
+    PositiveNumber,
+    NegativeNumber
+};
+
+template<typename T> struct ConversionTrait;
+
+template<> struct ConversionTrait<String> {
+    typedef PassRefPtr<StringImpl> ReturnType;
+    typedef void AdditionalArgumentType;
+    static inline ReturnType flush(LChar* characters, unsigned length, void*) { return StringImpl::create(characters, length); }
+};
+template<> struct ConversionTrait<StringBuilder> {
+    typedef void ReturnType;
+    typedef StringBuilder AdditionalArgumentType;
+    static inline ReturnType flush(LChar* characters, unsigned length, StringBuilder* stringBuilder) { stringBuilder->append(characters, length); }
+};
+
+template<typename T> struct UnsignedIntegerTrait;
+
+template<> struct UnsignedIntegerTrait<int> {
+    typedef unsigned int Type;
+};
+template<> struct UnsignedIntegerTrait<long> {
+    typedef unsigned long Type;
+};
+template<> struct UnsignedIntegerTrait<long long> {
+    typedef unsigned long long Type;
+};
+
+template<typename T, typename UnsignedIntegerType, PositiveOrNegativeNumber NumberType>
+static typename ConversionTrait<T>::ReturnType numberToStringImpl(UnsignedIntegerType number, typename ConversionTrait<T>::AdditionalArgumentType* additionalArgument)
+{
+    LChar buf[sizeof(UnsignedIntegerType) * 3 + 1];
+    LChar* end = buf + WTF_ARRAY_LENGTH(buf);
+    LChar* p = end;
+
+    do {
+        *--p = static_cast<LChar>((number % 10) + '0');
+        number /= 10;
+    } while (number);
+
+    if (NumberType == NegativeNumber)
+        *--p = '-';
+
+    return ConversionTrait<T>::flush(p, static_cast<unsigned>(end - p), additionalArgument);
+}
+
+template<typename T, typename SignedIntegerType>
+inline typename ConversionTrait<T>::ReturnType numberToStringSigned(SignedIntegerType number, typename ConversionTrait<T>::AdditionalArgumentType* additionalArgument = 0)
+{
+    if (number < 0)
+        return numberToStringImpl<T, typename UnsignedIntegerTrait<SignedIntegerType>::Type, NegativeNumber>(-number, additionalArgument);
+    return numberToStringImpl<T, typename UnsignedIntegerTrait<SignedIntegerType>::Type, PositiveNumber>(number, additionalArgument);
+}
+
+template<typename T, typename UnsignedIntegerType>
+inline typename ConversionTrait<T>::ReturnType numberToStringUnsigned(UnsignedIntegerType number, typename ConversionTrait<T>::AdditionalArgumentType* additionalArgument = 0)
+{
+    return numberToStringImpl<T, UnsignedIntegerType, PositiveNumber>(number, additionalArgument);
+}
+
+} // namespace WTF
+
+#endif // IntegerToStringConversion_h
diff --git a/Source/WTF/wtf/text/StringBuffer.h b/Source/WTF/wtf/text/StringBuffer.h
new file mode 100644
index 0000000..0f66113
--- /dev/null
+++ b/Source/WTF/wtf/text/StringBuffer.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2008, 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. 
+ * 3.  Neither the name of Apple Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef StringBuffer_h
+#define StringBuffer_h
+
+#include <wtf/Assertions.h>
+#include <wtf/unicode/Unicode.h>
+#include <limits>
+
+namespace WTF {
+
+template <typename CharType>
+class StringBuffer {
+    WTF_MAKE_NONCOPYABLE(StringBuffer);
+public:
+    explicit StringBuffer(unsigned length)
+        : m_length(length)
+    {
+        if (m_length > std::numeric_limits<unsigned>::max() / sizeof(CharType))
+            CRASH();
+        m_data = static_cast<CharType*>(fastMalloc(m_length * sizeof(CharType)));
+    }
+
+    ~StringBuffer()
+    {
+        fastFree(m_data);
+    }
+
+    void shrink(unsigned newLength)
+    {
+        ASSERT(newLength <= m_length);
+        m_length = newLength;
+    }
+
+    void resize(unsigned newLength)
+    {
+        if (newLength > m_length) {
+            if (newLength > std::numeric_limits<unsigned>::max() / sizeof(UChar))
+                CRASH();
+            m_data = static_cast<UChar*>(fastRealloc(m_data, newLength * sizeof(UChar)));
+        }
+        m_length = newLength;
+    }
+
+    unsigned length() const { return m_length; }
+    CharType* characters() { return m_data; }
+
+    CharType& operator[](unsigned i) { ASSERT(i < m_length); return m_data[i]; }
+
+    CharType* release() { CharType* data = m_data; m_data = 0; return data; }
+
+private:
+    unsigned m_length;
+    CharType* m_data;
+};
+
+} // namespace WTF
+
+using WTF::StringBuffer;
+
+#endif // StringBuffer_h
diff --git a/Source/WTF/wtf/text/StringBuilder.cpp b/Source/WTF/wtf/text/StringBuilder.cpp
new file mode 100644
index 0000000..c82ed2e
--- /dev/null
+++ b/Source/WTF/wtf/text/StringBuilder.cpp
@@ -0,0 +1,345 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 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:
+ * 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. ``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
+ * 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 "StringBuilder.h"
+
+#include "IntegerToStringConversion.h"
+#include "WTFString.h"
+
+namespace WTF {
+
+static const unsigned minimumCapacity = 16;
+
+void StringBuilder::reifyString() const
+{
+    // Check if the string already exists.
+    if (!m_string.isNull()) {
+        ASSERT(m_string.length() == m_length);
+        return;
+    }
+
+    // Check for empty.
+    if (!m_length) {
+        m_string = StringImpl::empty();
+        return;
+    }
+
+    // Must be valid in the buffer, take a substring (unless string fills the buffer).
+    ASSERT(m_buffer && m_length <= m_buffer->length());
+    m_string = (m_length == m_buffer->length())
+        ? m_buffer.get()
+        : StringImpl::create(m_buffer, 0, m_length);
+
+    if (m_buffer->has16BitShadow() && m_valid16BitShadowLength < m_length)
+        m_buffer->upconvertCharacters(m_valid16BitShadowLength, m_length);
+
+    m_valid16BitShadowLength = m_length;
+}
+
+void StringBuilder::resize(unsigned newSize)
+{
+    // Check newSize < m_length, hence m_length > 0.
+    ASSERT(newSize <= m_length);
+    if (newSize == m_length)
+        return;
+    ASSERT(m_length);
+
+    // If there is a buffer, we only need to duplicate it if it has more than one ref.
+    if (m_buffer) {
+        m_string = String(); // Clear the string to remove the reference to m_buffer if any before checking the reference count of m_buffer.
+        if (!m_buffer->hasOneRef()) {
+            if (m_buffer->is8Bit())
+                allocateBuffer(m_buffer->characters8(), m_buffer->length());
+            else
+                allocateBuffer(m_buffer->characters16(), m_buffer->length());
+        }
+        m_length = newSize;
+        return;
+    }
+
+    // Since m_length && !m_buffer, the string must be valid in m_string, and m_string.length() > 0.
+    ASSERT(!m_string.isEmpty());
+    ASSERT(m_length == m_string.length());
+    ASSERT(newSize < m_string.length());
+    m_length = newSize;
+    m_string = StringImpl::create(m_string.impl(), 0, newSize);
+}
+
+// Allocate a new 8 bit buffer, copying in currentCharacters (these may come from either m_string
+// or m_buffer, neither will be reassigned until the copy has completed).
+void StringBuilder::allocateBuffer(const LChar* currentCharacters, unsigned requiredLength)
+{
+    ASSERT(m_is8Bit);
+    // Copy the existing data into a new buffer, set result to point to the end of the existing data.
+    RefPtr<StringImpl> buffer = StringImpl::createUninitialized(requiredLength, m_bufferCharacters8);
+    memcpy(m_bufferCharacters8, currentCharacters, static_cast<size_t>(m_length) * sizeof(LChar)); // This can't overflow.
+    
+    // Update the builder state.
+    m_buffer = buffer.release();
+    m_string = String();
+}
+
+// Allocate a new 16 bit buffer, copying in currentCharacters (these may come from either m_string
+// or m_buffer,  neither will be reassigned until the copy has completed).
+void StringBuilder::allocateBuffer(const UChar* currentCharacters, unsigned requiredLength)
+{
+    ASSERT(!m_is8Bit);
+    // Copy the existing data into a new buffer, set result to point to the end of the existing data.
+    RefPtr<StringImpl> buffer = StringImpl::createUninitialized(requiredLength, m_bufferCharacters16);
+    memcpy(m_bufferCharacters16, currentCharacters, static_cast<size_t>(m_length) * sizeof(UChar)); // This can't overflow.
+    
+    // Update the builder state.
+    m_buffer = buffer.release();
+    m_string = String();
+}
+
+// Allocate a new 16 bit buffer, copying in currentCharacters (which is 8 bit and may come
+// from either m_string or m_buffer, neither will be reassigned until the copy has completed).
+void StringBuilder::allocateBufferUpConvert(const LChar* currentCharacters, unsigned requiredLength)
+{
+    ASSERT(m_is8Bit);
+    // Copy the existing data into a new buffer, set result to point to the end of the existing data.
+    RefPtr<StringImpl> buffer = StringImpl::createUninitialized(requiredLength, m_bufferCharacters16);
+    for (unsigned i = 0; i < m_length; i++)
+        m_bufferCharacters16[i] = currentCharacters[i];
+    
+    m_is8Bit = false;
+    
+    // Update the builder state.
+    m_buffer = buffer.release();
+    m_string = String();
+}
+
+template <>
+void StringBuilder::reallocateBuffer<LChar>(unsigned requiredLength)
+{
+    // If the buffer has only one ref (by this StringBuilder), reallocate it,
+    // otherwise fall back to "allocate and copy" method.
+    m_string = String();
+    
+    ASSERT(m_is8Bit);
+    ASSERT(m_buffer->is8Bit());
+    
+    if (m_buffer->hasOneRef())
+        m_buffer = StringImpl::reallocate(m_buffer.release(), requiredLength, m_bufferCharacters8);
+    else
+        allocateBuffer(m_buffer->characters8(), requiredLength);
+}
+
+template <>
+void StringBuilder::reallocateBuffer<UChar>(unsigned requiredLength)
+{
+    // If the buffer has only one ref (by this StringBuilder), reallocate it,
+    // otherwise fall back to "allocate and copy" method.
+    m_string = String();
+    
+    if (m_buffer->is8Bit())
+        allocateBufferUpConvert(m_buffer->characters8(), requiredLength);
+    else if (m_buffer->hasOneRef())
+        m_buffer = StringImpl::reallocate(m_buffer.release(), requiredLength, m_bufferCharacters16);
+    else
+        allocateBuffer(m_buffer->characters16(), requiredLength);
+}
+
+void StringBuilder::reserveCapacity(unsigned newCapacity)
+{
+    if (m_buffer) {
+        // If there is already a buffer, then grow if necessary.
+        if (newCapacity > m_buffer->length()) {
+            if (m_buffer->is8Bit())
+                reallocateBuffer<LChar>(newCapacity);
+            else
+                reallocateBuffer<UChar>(newCapacity);
+        }
+    } else {
+        // Grow the string, if necessary.
+        if (newCapacity > m_length) {
+            if (!m_length) {
+                LChar* nullPlaceholder = 0;
+                allocateBuffer(nullPlaceholder, newCapacity);
+            } else if (m_string.is8Bit())
+                allocateBuffer(m_string.characters8(), newCapacity);
+            else
+                allocateBuffer(m_string.characters16(), newCapacity);
+        }
+    }
+}
+
+// Make 'length' additional capacity be available in m_buffer, update m_string & m_length,
+// return a pointer to the newly allocated storage.
+template <typename CharType>
+ALWAYS_INLINE CharType* StringBuilder::appendUninitialized(unsigned length)
+{
+    ASSERT(length);
+
+    // Calculate the new size of the builder after appending.
+    unsigned requiredLength = length + m_length;
+    if (requiredLength < length)
+        CRASH();
+
+    if ((m_buffer) && (requiredLength <= m_buffer->length())) {
+        // If the buffer is valid it must be at least as long as the current builder contents!
+        ASSERT(m_buffer->length() >= m_length);
+        unsigned currentLength = m_length;
+        m_string = String();
+        m_length = requiredLength;
+        return getBufferCharacters<CharType>() + currentLength;
+    }
+    
+    return appendUninitializedSlow<CharType>(requiredLength);
+}
+
+// Make 'length' additional capacity be available in m_buffer, update m_string & m_length,
+// return a pointer to the newly allocated storage.
+template <typename CharType>
+CharType* StringBuilder::appendUninitializedSlow(unsigned requiredLength)
+{
+    ASSERT(requiredLength);
+
+    if (m_buffer) {
+        // If the buffer is valid it must be at least as long as the current builder contents!
+        ASSERT(m_buffer->length() >= m_length);
+        
+        reallocateBuffer<CharType>(std::max(requiredLength, std::max(minimumCapacity, m_buffer->length() * 2)));
+    } else {
+        ASSERT(m_string.length() == m_length);
+        allocateBuffer(m_length ? m_string.getCharacters<CharType>() : 0, std::max(requiredLength, std::max(minimumCapacity, m_length * 2)));
+    }
+    
+    CharType* result = getBufferCharacters<CharType>() + m_length;
+    m_length = requiredLength;
+    return result;
+}
+
+void StringBuilder::append(const UChar* characters, unsigned length)
+{
+    if (!length)
+        return;
+
+    ASSERT(characters);
+
+    if (m_is8Bit) {
+        if (length == 1 && !(*characters & ~0xff)) {
+            // Append as 8 bit character
+            LChar lChar = static_cast<LChar>(*characters);
+            append(&lChar, 1);
+            return;
+        }
+
+        // Calculate the new size of the builder after appending.
+        unsigned requiredLength = length + m_length;
+        if (requiredLength < length)
+            CRASH();
+        
+        if (m_buffer) {
+            // If the buffer is valid it must be at least as long as the current builder contents!
+            ASSERT(m_buffer->length() >= m_length);
+            
+            allocateBufferUpConvert(m_buffer->characters8(), requiredLength);
+        } else {
+            ASSERT(m_string.length() == m_length);
+            allocateBufferUpConvert(m_string.isNull() ? 0 : m_string.characters8(), std::max(requiredLength, std::max(minimumCapacity, m_length * 2)));
+        }
+
+        memcpy(m_bufferCharacters16 + m_length, characters, static_cast<size_t>(length) * sizeof(UChar));        
+        m_length = requiredLength;
+    } else
+        memcpy(appendUninitialized<UChar>(length), characters, static_cast<size_t>(length) * sizeof(UChar));
+}
+
+void StringBuilder::append(const LChar* characters, unsigned length)
+{
+    if (!length)
+        return;
+    ASSERT(characters);
+
+    if (m_is8Bit) {
+        LChar* dest = appendUninitialized<LChar>(length);
+        if (length > 8)
+            memcpy(dest, characters, static_cast<size_t>(length) * sizeof(LChar));
+        else {
+            const LChar* end = characters + length;
+            while (characters < end)
+                *(dest++) = *(characters++);
+        }
+    } else {
+        UChar* dest = appendUninitialized<UChar>(length);
+        const LChar* end = characters + length;
+        while (characters < end)
+            *(dest++) = *(characters++);
+    }
+}
+
+void StringBuilder::appendNumber(int number)
+{
+    numberToStringSigned<StringBuilder>(number, this);
+}
+
+void StringBuilder::appendNumber(unsigned int number)
+{
+    numberToStringUnsigned<StringBuilder>(number, this);
+}
+
+void StringBuilder::appendNumber(long number)
+{
+    numberToStringSigned<StringBuilder>(number, this);
+}
+
+void StringBuilder::appendNumber(unsigned long number)
+{
+    numberToStringUnsigned<StringBuilder>(number, this);
+}
+
+void StringBuilder::appendNumber(long long number)
+{
+    numberToStringSigned<StringBuilder>(number, this);
+}
+
+void StringBuilder::appendNumber(unsigned long long number)
+{
+    numberToStringUnsigned<StringBuilder>(number, this);
+}
+
+bool StringBuilder::canShrink() const
+{
+    // Only shrink the buffer if it's less than 80% full. Need to tune this heuristic!
+    return m_buffer && m_buffer->length() > (m_length + (m_length >> 2));
+}
+
+void StringBuilder::shrinkToFit()
+{
+    if (canShrink()) {
+        if (m_is8Bit)
+            reallocateBuffer<LChar>(m_length);
+        else
+            reallocateBuffer<UChar>(m_length);
+        m_string = m_buffer;
+        m_buffer = 0;
+    }
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/text/StringBuilder.h b/Source/WTF/wtf/text/StringBuilder.h
new file mode 100644
index 0000000..e65f8f3
--- /dev/null
+++ b/Source/WTF/wtf/text/StringBuilder.h
@@ -0,0 +1,357 @@
+/*
+ * Copyright (C) 2009, 2010, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 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:
+ * 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. ``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
+ * 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 StringBuilder_h
+#define StringBuilder_h
+
+#include <wtf/text/AtomicString.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+class StringBuilder {
+    // Disallow copying since it's expensive and we don't want code to do it by accident.
+    WTF_MAKE_NONCOPYABLE(StringBuilder);
+
+public:
+    StringBuilder()
+        : m_length(0)
+        , m_is8Bit(true)
+        , m_valid16BitShadowLength(0)
+        , m_bufferCharacters8(0)
+    {
+    }
+
+    WTF_EXPORT_PRIVATE void append(const UChar*, unsigned);
+    WTF_EXPORT_PRIVATE void append(const LChar*, unsigned);
+
+    ALWAYS_INLINE void append(const char* characters, unsigned length) { append(reinterpret_cast<const LChar*>(characters), length); }
+
+    void append(const String& string)
+    {
+        if (!string.length())
+            return;
+
+        // If we're appending to an empty string, and there is not a buffer (reserveCapacity has not been called)
+        // then just retain the string.
+        if (!m_length && !m_buffer) {
+            m_string = string;
+            m_length = string.length();
+            m_is8Bit = m_string.is8Bit();
+            return;
+        }
+
+        if (string.is8Bit())
+            append(string.characters8(), string.length());
+        else
+            append(string.characters16(), string.length());
+    }
+
+    void append(const StringBuilder& other)
+    {
+        if (!other.m_length)
+            return;
+
+        // If we're appending to an empty string, and there is not a buffer (reserveCapacity has not been called)
+        // then just retain the string.
+        if (!m_length && !m_buffer && !other.m_string.isNull()) {
+            m_string = other.m_string;
+            m_length = other.m_length;
+            return;
+        }
+
+        if (other.is8Bit())
+            append(other.characters8(), other.m_length);
+        else
+            append(other.characters16(), other.m_length);
+    }
+
+    void append(const String& string, unsigned offset, unsigned length)
+    {
+        if (!string.length())
+            return;
+
+        if ((offset + length) > string.length())
+            return;
+
+        if (string.is8Bit())
+            append(string.characters8() + offset, length);
+        else
+            append(string.characters16() + offset, length);
+    }
+
+    void append(const char* characters)
+    {
+        if (characters)
+            append(characters, strlen(characters));
+    }
+
+    void append(UChar c)
+    {
+        if (m_buffer && m_length < m_buffer->length() && m_string.isNull()) {
+            if (!m_is8Bit) {
+                m_bufferCharacters16[m_length++] = c;
+                return;
+            }
+
+            if (!(c & ~0xff)) {
+                m_bufferCharacters8[m_length++] = static_cast<LChar>(c);
+                return;
+            }
+        }
+        append(&c, 1);
+    }
+
+    void append(LChar c)
+    {
+        if (m_buffer && m_length < m_buffer->length() && m_string.isNull()) {
+            if (m_is8Bit)
+                m_bufferCharacters8[m_length++] = c;
+            else
+                m_bufferCharacters16[m_length++] = c;
+        } else
+            append(&c, 1);
+    }
+
+    void append(char c)
+    {
+        append(static_cast<LChar>(c));
+    }
+
+    template<unsigned charactersCount>
+    ALWAYS_INLINE void appendLiteral(const char (&characters)[charactersCount]) { append(characters, charactersCount - 1); }
+
+    WTF_EXPORT_PRIVATE void appendNumber(int);
+    WTF_EXPORT_PRIVATE void appendNumber(unsigned int);
+    WTF_EXPORT_PRIVATE void appendNumber(long);
+    WTF_EXPORT_PRIVATE void appendNumber(unsigned long);
+    WTF_EXPORT_PRIVATE void appendNumber(long long);
+    WTF_EXPORT_PRIVATE void appendNumber(unsigned long long);
+
+    String toString()
+    {
+        shrinkToFit();
+        if (m_string.isNull())
+            reifyString();
+        return m_string;
+    }
+
+    const String& toStringPreserveCapacity() const
+    {
+        if (m_string.isNull())
+            reifyString();
+        return m_string;
+    }
+
+    AtomicString toAtomicString() const
+    {
+        if (!m_length)
+            return AtomicString();
+
+        // If the buffer is sufficiently over-allocated, make a new AtomicString from a copy so its buffer is not so large.
+        if (canShrink()) {
+            if (is8Bit())
+                return AtomicString(characters8(), length());
+            return AtomicString(characters16(), length());            
+        }
+
+        if (!m_string.isNull())
+            return AtomicString(m_string);
+
+        ASSERT(m_buffer);
+        return AtomicString(m_buffer.get(), 0, m_length);
+    }
+
+    unsigned length() const
+    {
+        return m_length;
+    }
+
+    bool isEmpty() const { return !m_length; }
+
+    WTF_EXPORT_PRIVATE void reserveCapacity(unsigned newCapacity);
+
+    unsigned capacity() const
+    {
+        return m_buffer ? m_buffer->length() : m_length;
+    }
+
+    WTF_EXPORT_PRIVATE void resize(unsigned newSize);
+
+    WTF_EXPORT_PRIVATE bool canShrink() const;
+
+    WTF_EXPORT_PRIVATE void shrinkToFit();
+
+    UChar operator[](unsigned i) const
+    {
+        ASSERT(i < m_length);
+        if (m_is8Bit)
+            return characters8()[i];
+        return characters16()[i];
+    }
+
+    const LChar* characters8() const
+    {
+        ASSERT(m_is8Bit);
+        if (!m_length)
+            return 0;
+        if (!m_string.isNull())
+            return m_string.characters8();
+        ASSERT(m_buffer);
+        return m_buffer->characters8();
+    }
+
+    const UChar* characters16() const
+    {
+        ASSERT(!m_is8Bit);
+        if (!m_length)
+            return 0;
+        if (!m_string.isNull())
+            return m_string.characters16();
+        ASSERT(m_buffer);
+        return m_buffer->characters16();
+    }
+    
+    const UChar* characters() const
+    {
+        if (!m_length)
+            return 0;
+        if (!m_string.isNull())
+            return m_string.characters();
+        ASSERT(m_buffer);
+        if (m_buffer->has16BitShadow() && m_valid16BitShadowLength < m_length)
+            m_buffer->upconvertCharacters(m_valid16BitShadowLength, m_length);
+
+        m_valid16BitShadowLength = m_length;
+
+        return m_buffer->characters();
+    }
+    
+    bool is8Bit() const { return m_is8Bit; }
+
+    void clear()
+    {
+        m_length = 0;
+        m_string = String();
+        m_buffer = 0;
+        m_bufferCharacters8 = 0;
+        m_is8Bit = true;
+        m_valid16BitShadowLength = 0;
+    }
+
+    void swap(StringBuilder& stringBuilder)
+    {
+        std::swap(m_length, stringBuilder.m_length);
+        m_string.swap(stringBuilder.m_string);
+        m_buffer.swap(stringBuilder.m_buffer);
+        std::swap(m_is8Bit, stringBuilder.m_is8Bit);
+        std::swap(m_valid16BitShadowLength, stringBuilder.m_valid16BitShadowLength);
+        std::swap(m_bufferCharacters8, stringBuilder.m_bufferCharacters8);
+    }
+
+private:
+    void allocateBuffer(const LChar* currentCharacters, unsigned requiredLength);
+    void allocateBuffer(const UChar* currentCharacters, unsigned requiredLength);
+    void allocateBufferUpConvert(const LChar* currentCharacters, unsigned requiredLength);
+    template <typename CharType>
+    void reallocateBuffer(unsigned requiredLength);
+    template <typename CharType>
+    ALWAYS_INLINE CharType* appendUninitialized(unsigned length);
+    template <typename CharType>
+    CharType* appendUninitializedSlow(unsigned length);
+    template <typename CharType>
+    ALWAYS_INLINE CharType * getBufferCharacters();
+    WTF_EXPORT_PRIVATE void reifyString() const;
+
+    unsigned m_length;
+    mutable String m_string;
+    RefPtr<StringImpl> m_buffer;
+    bool m_is8Bit;
+    mutable unsigned m_valid16BitShadowLength;
+    union {
+        LChar* m_bufferCharacters8;
+        UChar* m_bufferCharacters16;
+    };
+};
+
+template <>
+ALWAYS_INLINE LChar* StringBuilder::getBufferCharacters<LChar>()
+{
+    ASSERT(m_is8Bit);
+    return m_bufferCharacters8;
+}
+
+template <>
+ALWAYS_INLINE UChar* StringBuilder::getBufferCharacters<UChar>()
+{
+    ASSERT(!m_is8Bit);
+    return m_bufferCharacters16;
+}    
+
+template <typename CharType>
+bool equal(const StringBuilder& s, const CharType* buffer, unsigned length)
+{
+    if (s.length() != length)
+        return false;
+
+    if (s.is8Bit())
+        return equal(s.characters8(), buffer, length);
+
+    return equal(s.characters16(), buffer, length);
+}
+
+template <typename StringType>
+bool equal(const StringBuilder& a, const StringType& b)
+{
+    if (a.length() != b.length())
+        return false;
+
+    if (!a.length())
+        return true;
+
+    if (a.is8Bit()) {
+        if (b.is8Bit())
+            return equal(a.characters8(), b.characters8(), a.length());
+        return equal(a.characters8(), b.characters16(), a.length());
+    }
+
+    if (b.is8Bit())
+        return equal(a.characters16(), b.characters8(), a.length());
+    return equal(a.characters16(), b.characters16(), a.length());
+}
+
+inline bool operator==(const StringBuilder& a, const StringBuilder& b) { return equal(a, b); }
+inline bool operator!=(const StringBuilder& a, const StringBuilder& b) { return !equal(a, b); }
+inline bool operator==(const StringBuilder& a, const String& b) { return equal(a, b); }
+inline bool operator!=(const StringBuilder& a, const String& b) { return !equal(a, b); }
+inline bool operator==(const String& a, const StringBuilder& b) { return equal(b, a); }
+inline bool operator!=(const String& a, const StringBuilder& b) { return !equal(b, a); }
+
+} // namespace WTF
+
+using WTF::StringBuilder;
+
+#endif // StringBuilder_h
diff --git a/Source/WTF/wtf/text/StringConcatenate.h b/Source/WTF/wtf/text/StringConcatenate.h
new file mode 100644
index 0000000..479ed8c
--- /dev/null
+++ b/Source/WTF/wtf/text/StringConcatenate.h
@@ -0,0 +1,964 @@
+/*
+ * 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. ``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
+ * 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 StringConcatenate_h
+#define StringConcatenate_h
+
+#ifndef WTFString_h
+#include <wtf/text/AtomicString.h>
+#endif
+
+// This macro is helpful for testing how many intermediate Strings are created while evaluating an
+// expression containing operator+.
+#ifndef WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING
+#define WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING() ((void)0)
+#endif
+
+namespace WTF {
+
+template<typename StringType>
+class StringTypeAdapter {
+};
+
+template<>
+class StringTypeAdapter<char> {
+public:
+    StringTypeAdapter<char>(char buffer)
+        : m_buffer(buffer)
+    {
+    }
+
+    unsigned length() { return 1; }
+
+    bool is8Bit() { return true; }
+
+    void writeTo(LChar* destination)
+    {
+        *destination = m_buffer;
+    }
+
+    void writeTo(UChar* destination) { *destination = m_buffer; }
+
+private:
+    unsigned char m_buffer;
+};
+
+template<>
+class StringTypeAdapter<LChar> {
+public:
+    StringTypeAdapter<LChar>(LChar buffer)
+        : m_buffer(buffer)
+    {
+    }
+
+    unsigned length() { return 1; }
+
+    bool is8Bit() { return true; }
+
+    void writeTo(LChar* destination)
+    {
+        *destination = m_buffer;
+    }
+
+    void writeTo(UChar* destination) { *destination = m_buffer; }
+
+private:
+    LChar m_buffer;
+};
+
+template<>
+class StringTypeAdapter<UChar> {
+public:
+    StringTypeAdapter<UChar>(UChar buffer)
+        : m_buffer(buffer)
+    {
+    }
+
+    unsigned length() { return 1; }
+
+    bool is8Bit() { return m_buffer <= 0xff; }
+
+    void writeTo(LChar* destination)
+    {
+        ASSERT(is8Bit());
+        *destination = static_cast<LChar>(m_buffer);
+    }
+
+    void writeTo(UChar* destination) { *destination = m_buffer; }
+
+private:
+    UChar m_buffer;
+};
+
+template<>
+class StringTypeAdapter<char*> {
+public:
+    StringTypeAdapter<char*>(char* buffer)
+        : m_buffer(buffer)
+        , m_length(strlen(buffer))
+    {
+    }
+
+    unsigned length() { return m_length; }
+
+    bool is8Bit() { return true; }
+
+    void writeTo(LChar* destination)
+    {
+        for (unsigned i = 0; i < m_length; ++i)
+            destination[i] = static_cast<LChar>(m_buffer[i]);
+    }
+
+    void writeTo(UChar* destination)
+    {
+        for (unsigned i = 0; i < m_length; ++i) {
+            unsigned char c = m_buffer[i];
+            destination[i] = c;
+        }
+    }
+
+private:
+    const char* m_buffer;
+    unsigned m_length;
+};
+
+template<>
+class StringTypeAdapter<LChar*> {
+public:
+    StringTypeAdapter<LChar*>(LChar* buffer)
+    : m_buffer(buffer)
+    , m_length(strlen(reinterpret_cast<char*>(buffer)))
+    {
+    }
+
+    unsigned length() { return m_length; }
+
+    bool is8Bit() { return true; }
+
+    void writeTo(LChar* destination)
+    {
+        memcpy(destination, m_buffer, m_length * sizeof(LChar));
+    }
+
+    void writeTo(UChar* destination)
+    {
+        for (unsigned i = 0; i < m_length; ++i)
+            destination[i] = m_buffer[i];
+    }
+
+private:
+    const LChar* m_buffer;
+    unsigned m_length;
+};
+
+template<>
+class StringTypeAdapter<const UChar*> {
+public:
+    StringTypeAdapter<const UChar*>(const UChar* buffer)
+        : m_buffer(buffer)
+    {
+        size_t len = 0;
+        while (m_buffer[len] != UChar(0))
+            len++;
+
+        if (len > std::numeric_limits<unsigned>::max())
+            CRASH();
+
+        m_length = len;
+    }
+
+    unsigned length() { return m_length; }
+
+    bool is8Bit() { return false; }
+
+    NO_RETURN_DUE_TO_CRASH void writeTo(LChar*)
+    {
+        CRASH();
+    }
+
+    void writeTo(UChar* destination)
+    {
+        memcpy(destination, m_buffer, m_length * sizeof(UChar));
+    }
+
+private:
+    const UChar* m_buffer;
+    unsigned m_length;
+};
+
+template<>
+class StringTypeAdapter<const char*> {
+public:
+    StringTypeAdapter<const char*>(const char* buffer)
+        : m_buffer(buffer)
+        , m_length(strlen(buffer))
+    {
+    }
+
+    unsigned length() { return m_length; }
+
+    bool is8Bit() { return true; }
+
+    void writeTo(LChar* destination)
+    {
+        memcpy(destination, m_buffer, static_cast<size_t>(m_length) * sizeof(LChar));
+    }
+
+    void writeTo(UChar* destination)
+    {
+        for (unsigned i = 0; i < m_length; ++i) {
+            unsigned char c = m_buffer[i];
+            destination[i] = c;
+        }
+    }
+
+private:
+    const char* m_buffer;
+    unsigned m_length;
+};
+
+template<>
+class StringTypeAdapter<const LChar*> {
+public:
+    StringTypeAdapter<const LChar*>(const LChar* buffer)
+        : m_buffer(buffer)
+        , m_length(strlen(reinterpret_cast<const char*>(buffer)))
+    {
+    }
+
+    unsigned length() { return m_length; }
+
+    bool is8Bit() { return true; }
+
+    void writeTo(LChar* destination)
+    {
+        memcpy(destination, m_buffer, static_cast<size_t>(m_length) * sizeof(LChar));
+    }
+
+    void writeTo(UChar* destination)
+    {
+        for (unsigned i = 0; i < m_length; ++i)
+            destination[i] = m_buffer[i];
+    }
+
+private:
+    const LChar* m_buffer;
+    unsigned m_length;
+};
+
+template<>
+class StringTypeAdapter<Vector<char> > {
+public:
+    StringTypeAdapter<Vector<char> >(const Vector<char>& buffer)
+        : m_buffer(buffer)
+    {
+    }
+
+    size_t length() { return m_buffer.size(); }
+
+    bool is8Bit() { return true; }
+
+    void writeTo(LChar* destination)
+    {
+        for (size_t i = 0; i < m_buffer.size(); ++i)
+            destination[i] = static_cast<unsigned char>(m_buffer[i]);
+    }
+
+    void writeTo(UChar* destination)
+    {
+        for (size_t i = 0; i < m_buffer.size(); ++i)
+            destination[i] = static_cast<unsigned char>(m_buffer[i]);
+    }
+
+private:
+    const Vector<char>& m_buffer;
+};
+
+template<>
+class StringTypeAdapter<Vector<LChar> > {
+public:
+    StringTypeAdapter<Vector<LChar> >(const Vector<LChar>& buffer)
+        : m_buffer(buffer)
+    {
+    }
+
+    size_t length() { return m_buffer.size(); }
+
+    bool is8Bit() { return true; }
+
+    void writeTo(LChar* destination)
+    {
+        for (size_t i = 0; i < m_buffer.size(); ++i)
+            destination[i] = m_buffer[i];
+    }
+
+    void writeTo(UChar* destination)
+    {
+        for (size_t i = 0; i < m_buffer.size(); ++i)
+            destination[i] = m_buffer[i];
+    }
+
+private:
+    const Vector<LChar>& m_buffer;
+};
+
+template<>
+class StringTypeAdapter<String> {
+public:
+    StringTypeAdapter<String>(const String& string)
+        : m_buffer(string)
+    {
+    }
+
+    unsigned length() { return m_buffer.length(); }
+
+    bool is8Bit() { return m_buffer.isNull() || m_buffer.is8Bit(); }
+
+    void writeTo(LChar* destination)
+    {
+        unsigned length = m_buffer.length();
+
+        ASSERT(is8Bit());
+        const LChar* data = m_buffer.characters8();
+        for (unsigned i = 0; i < length; ++i)
+            destination[i] = data[i];
+        
+        WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING();
+    }
+
+    void writeTo(UChar* destination)
+    {
+        unsigned length = m_buffer.length();
+
+        if (is8Bit()) {
+            const LChar* data = m_buffer.characters8();
+            for (unsigned i = 0; i < length; ++i)
+                destination[i] = data[i];
+        } else {
+            const UChar* data = m_buffer.characters16();
+            for (unsigned i = 0; i < length; ++i)
+                destination[i] = data[i];
+        }
+        
+        WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING();
+    }
+
+private:
+    const String& m_buffer;
+};
+
+template<>
+class StringTypeAdapter<AtomicString> {
+public:
+    StringTypeAdapter<AtomicString>(const AtomicString& string)
+        : m_adapter(string.string())
+    {
+    }
+
+    unsigned length() { return m_adapter.length(); }
+
+    bool is8Bit() { return m_adapter.is8Bit(); }
+
+    void writeTo(LChar* destination) { m_adapter.writeTo(destination); }
+    void writeTo(UChar* destination) { m_adapter.writeTo(destination); }
+
+private:
+    StringTypeAdapter<String> m_adapter;
+};
+
+inline void sumWithOverflow(unsigned& total, unsigned addend, bool& overflow)
+{
+    unsigned oldTotal = total;
+    total = oldTotal + addend;
+    if (total < oldTotal)
+        overflow = true;
+}
+
+template<typename StringType1, typename StringType2>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2)
+{
+    StringTypeAdapter<StringType1> adapter1(string1);
+    StringTypeAdapter<StringType2> adapter2(string2);
+
+    bool overflow = false;
+    unsigned length = adapter1.length();
+    sumWithOverflow(length, adapter2.length(), overflow);
+    if (overflow)
+        return 0;
+
+    if (adapter1.is8Bit() && adapter2.is8Bit()) {
+        LChar* buffer;
+        RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+        if (!resultImpl)
+            return 0;
+
+        LChar* result = buffer;
+        adapter1.writeTo(result);
+        result += adapter1.length();
+        adapter2.writeTo(result);
+
+        return resultImpl.release();
+    }
+
+    UChar* buffer;
+    RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+    if (!resultImpl)
+        return 0;
+
+    UChar* result = buffer;
+    adapter1.writeTo(result);
+    result += adapter1.length();
+    adapter2.writeTo(result);
+
+    return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3)
+{
+    StringTypeAdapter<StringType1> adapter1(string1);
+    StringTypeAdapter<StringType2> adapter2(string2);
+    StringTypeAdapter<StringType3> adapter3(string3);
+
+    bool overflow = false;
+    unsigned length = adapter1.length();
+    sumWithOverflow(length, adapter2.length(), overflow);
+    sumWithOverflow(length, adapter3.length(), overflow);
+    if (overflow)
+        return 0;
+
+    if (adapter1.is8Bit() && adapter2.is8Bit() && adapter3.is8Bit()) {
+        LChar* buffer;
+        RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+        if (!resultImpl)
+            return 0;
+
+        LChar* result = buffer;
+        adapter1.writeTo(result);
+        result += adapter1.length();
+        adapter2.writeTo(result);
+        result += adapter2.length();
+        adapter3.writeTo(result);
+
+        return resultImpl.release();
+    }
+
+    UChar* buffer = 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);
+
+    return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
+{
+    StringTypeAdapter<StringType1> adapter1(string1);
+    StringTypeAdapter<StringType2> adapter2(string2);
+    StringTypeAdapter<StringType3> adapter3(string3);
+    StringTypeAdapter<StringType4> adapter4(string4);
+
+    bool overflow = false;
+    unsigned length = adapter1.length();
+    sumWithOverflow(length, adapter2.length(), overflow);
+    sumWithOverflow(length, adapter3.length(), overflow);
+    sumWithOverflow(length, adapter4.length(), overflow);
+    if (overflow)
+        return 0;
+
+    if (adapter1.is8Bit() && adapter2.is8Bit() && adapter3.is8Bit() && adapter4.is8Bit()) {
+        LChar* buffer;
+        RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+        if (!resultImpl)
+            return 0;
+
+        LChar* result = buffer;
+        adapter1.writeTo(result);
+        result += adapter1.length();
+        adapter2.writeTo(result);
+        result += adapter2.length();
+        adapter3.writeTo(result);
+        result += adapter3.length();
+        adapter4.writeTo(result);
+
+        return resultImpl.release();
+    }
+
+    UChar* buffer;
+    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);
+
+    return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5)
+{
+    StringTypeAdapter<StringType1> adapter1(string1);
+    StringTypeAdapter<StringType2> adapter2(string2);
+    StringTypeAdapter<StringType3> adapter3(string3);
+    StringTypeAdapter<StringType4> adapter4(string4);
+    StringTypeAdapter<StringType5> adapter5(string5);
+
+    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);
+    if (overflow)
+        return 0;
+
+    if (adapter1.is8Bit() && adapter2.is8Bit() && adapter3.is8Bit() && adapter4.is8Bit() && adapter5.is8Bit()) {
+        LChar* buffer;
+        RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+        if (!resultImpl)
+            return 0;
+
+        LChar* 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);
+
+        return resultImpl.release();
+    }
+
+    UChar* buffer;
+    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);
+
+    return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6)
+{
+    StringTypeAdapter<StringType1> adapter1(string1);
+    StringTypeAdapter<StringType2> adapter2(string2);
+    StringTypeAdapter<StringType3> adapter3(string3);
+    StringTypeAdapter<StringType4> adapter4(string4);
+    StringTypeAdapter<StringType5> adapter5(string5);
+    StringTypeAdapter<StringType6> adapter6(string6);
+
+    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);
+    if (overflow)
+        return 0;
+
+    if (adapter1.is8Bit() && adapter2.is8Bit() && adapter3.is8Bit() && adapter4.is8Bit() && adapter5.is8Bit() && adapter6.is8Bit()) {
+        LChar* buffer;
+        RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+        if (!resultImpl)
+            return 0;
+
+        LChar* 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);
+
+        return resultImpl.release();        
+    }
+
+    UChar* buffer;
+    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);
+
+    return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7)
+{
+    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);
+
+    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);
+    if (overflow)
+        return 0;
+
+    if (adapter1.is8Bit() && adapter2.is8Bit() && adapter3.is8Bit() && adapter4.is8Bit() && adapter5.is8Bit() && adapter6.is8Bit()) {
+        LChar* buffer;
+        RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+        if (!resultImpl)
+            return 0;
+
+        LChar* 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);
+
+        return resultImpl.release();
+    }
+
+    UChar* buffer;
+    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);
+
+    return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4, typename StringType5, typename StringType6, typename StringType7, typename StringType8>
+PassRefPtr<StringImpl> tryMakeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4, StringType5 string5, StringType6 string6, StringType7 string7, StringType8 string8)
+{
+    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);
+
+    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);
+    if (overflow)
+        return 0;
+
+    if (adapter1.is8Bit() && adapter2.is8Bit() && adapter3.is8Bit() && adapter4.is8Bit() && adapter5.is8Bit() && adapter6.is8Bit() && adapter7.is8Bit() && adapter8.is8Bit()) {
+        LChar* buffer;
+        RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+        if (!resultImpl)
+            return 0;
+
+        LChar* 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);
+
+        return resultImpl.release();
+    }
+
+    UChar* buffer;
+    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);
+
+    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);
+
+    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;
+
+    if (adapter1.is8Bit() && adapter2.is8Bit() && adapter3.is8Bit() && adapter4.is8Bit() && adapter5.is8Bit() && adapter6.is8Bit() && adapter7.is8Bit() && adapter8.is8Bit() && adapter9.is8Bit()) {
+        LChar* buffer;
+        RefPtr<StringImpl> resultImpl = StringImpl::tryCreateUninitialized(length, buffer);
+        if (!resultImpl)
+            return 0;
+
+        LChar* 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();
+    }
+
+    UChar* buffer;
+    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)
+{
+    return String(string1);
+}
+
+template<typename StringType1, typename StringType2>
+String makeString(StringType1 string1, StringType2 string2)
+{
+    RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2);
+    if (!resultImpl)
+        CRASH();
+    return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3)
+{
+    RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3);
+    if (!resultImpl)
+        CRASH();
+    return resultImpl.release();
+}
+
+template<typename StringType1, typename StringType2, typename StringType3, typename StringType4>
+String makeString(StringType1 string1, StringType2 string2, StringType3 string3, StringType4 string4)
+{
+    RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4);
+    if (!resultImpl)
+        CRASH();
+    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)
+{
+    RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5);
+    if (!resultImpl)
+        CRASH();
+    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)
+{
+    RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6);
+    if (!resultImpl)
+        CRASH();
+    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)
+{
+    RefPtr<StringImpl> resultImpl = tryMakeString(string1, string2, string3, string4, string5, string6, string7);
+    if (!resultImpl)
+        CRASH();
+    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)
+{
+    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.release();
+}
+
+} // namespace WTF
+
+using WTF::makeString;
+
+#include <wtf/text/StringOperators.h>
+#endif
diff --git a/Source/WTF/wtf/text/StringHash.h b/Source/WTF/wtf/text/StringHash.h
new file mode 100644
index 0000000..1928716
--- /dev/null
+++ b/Source/WTF/wtf/text/StringHash.h
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2012 Apple Inc. All rights reserved
+ * Copyright (C) Research In Motion Limited 2009. 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 StringHash_h
+#define StringHash_h
+
+#include <wtf/text/AtomicString.h>
+#include <wtf/HashTraits.h>
+#include <wtf/StringHasher.h>
+
+namespace WTF {
+
+    inline bool HashTraits<String>::isEmptyValue(const String& value)
+    {
+        return value.isNull();
+    }
+
+    // The hash() functions on StringHash and CaseFoldingHash do not support
+    // null strings. get(), contains(), and add() on HashMap<String,..., StringHash>
+    // cause a null-pointer dereference when passed null strings.
+
+    // FIXME: We should really figure out a way to put the computeHash function that's
+    // currently a member function of StringImpl into this file so we can be a little
+    // closer to having all the nearly-identical hash functions in one place.
+
+    struct StringHash {
+        static unsigned hash(StringImpl* key) { return key->hash(); }
+        static bool equal(const StringImpl* a, const StringImpl* b)
+        {
+            if (a == b)
+                return true;
+            if (!a || !b)
+                return false;
+
+            unsigned aLength = a->length();
+            unsigned bLength = b->length();
+            if (aLength != bLength)
+                return false;
+
+            if (a->is8Bit()) {
+                if (b->is8Bit())
+                    return WTF::equal(a->characters8(), b->characters8(), aLength);
+
+                return WTF::equal(a->characters8(), b->characters16(), aLength);
+            }
+
+            if (b->is8Bit())
+                return WTF::equal(a->characters16(), b->characters8(), aLength);
+
+            return WTF::equal(a->characters16(), b->characters16(), aLength);
+        }
+
+        static unsigned hash(const RefPtr<StringImpl>& key) { return key->hash(); }
+        static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b)
+        {
+            return equal(a.get(), b.get());
+        }
+
+        static unsigned hash(const String& key) { return key.impl()->hash(); }
+        static bool equal(const String& a, const String& b)
+        {
+            return equal(a.impl(), b.impl());
+        }
+
+        static const bool safeToCompareToEmptyOrDeleted = false;
+    };
+
+    class CaseFoldingHash {
+    public:
+        template<typename T> static inline UChar foldCase(T ch)
+        {
+            return WTF::Unicode::foldCase(ch);
+        }
+
+        static unsigned hash(const UChar* data, unsigned length)
+        {
+            return StringHasher::computeHashAndMaskTop8Bits<UChar, foldCase<UChar> >(data, length);
+        }
+
+        static unsigned hash(StringImpl* str)
+        {
+            if (str->is8Bit())
+                return hash(str->characters8(), str->length());
+            return hash(str->characters16(), str->length());
+        }
+
+        static unsigned hash(const LChar* data, unsigned length)
+        {
+            return StringHasher::computeHashAndMaskTop8Bits<LChar, foldCase<LChar> >(data, length);
+        }
+
+        static inline unsigned hash(const char* data, unsigned length)
+        {
+            return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), length);
+        }
+        
+        static bool equal(const StringImpl* a, const StringImpl* b)
+        {
+            if (a == b)
+                return true;
+            if (!a || !b)
+                return false;
+            unsigned length = a->length();
+            if (length != b->length())
+                return false;
+
+            if (a->is8Bit()) {
+                if (b->is8Bit())
+                    return equalIgnoringCase(a->characters8(), b->characters8(), length);
+
+                return equalIgnoringCase(b->characters16(), a->characters8(), length);
+            }
+
+            if (b->is8Bit())
+                return equalIgnoringCase(a->characters16(), b->characters8(), length);
+
+            return equalIgnoringCase(a->characters16(), b->characters16(), length);
+        }
+
+        static unsigned hash(const RefPtr<StringImpl>& key) 
+        {
+            return hash(key.get());
+        }
+
+        static bool equal(const RefPtr<StringImpl>& a, const RefPtr<StringImpl>& b)
+        {
+            return equal(a.get(), b.get());
+        }
+
+        static unsigned hash(const String& key)
+        {
+            return hash(key.impl());
+        }
+        static unsigned hash(const AtomicString& key)
+        {
+            return hash(key.impl());
+        }
+        static bool equal(const String& a, const String& b)
+        {
+            return equal(a.impl(), b.impl());
+        }
+        static bool equal(const AtomicString& a, const AtomicString& b)
+        {
+            return (a == b) || equal(a.impl(), b.impl());
+        }
+
+        static const bool safeToCompareToEmptyOrDeleted = false;
+    };
+
+    // This hash can be used in cases where the key is a hash of a string, but we don't
+    // want to store the string. It's not really specific to string hashing, but all our
+    // current uses of it are for strings.
+    struct AlreadyHashed : IntHash<unsigned> {
+        static unsigned hash(unsigned key) { return key; }
+
+        // To use a hash value as a key for a hash table, we need to eliminate the
+        // "deleted" value, which is negative one. That could be done by changing
+        // the string hash function to never generate negative one, but this works
+        // and is still relatively efficient.
+        static unsigned avoidDeletedValue(unsigned hash)
+        {
+            ASSERT(hash);
+            unsigned newHash = hash | (!(hash + 1) << 31);
+            ASSERT(newHash);
+            ASSERT(newHash != 0xFFFFFFFF);
+            return newHash;
+        }
+    };
+
+}
+
+using WTF::AlreadyHashed;
+using WTF::CaseFoldingHash;
+using WTF::StringHash;
+
+#endif
diff --git a/Source/WTF/wtf/text/StringImpl.cpp b/Source/WTF/wtf/text/StringImpl.cpp
new file mode 100644
index 0000000..2ff3b5f
--- /dev/null
+++ b/Source/WTF/wtf/text/StringImpl.cpp
@@ -0,0 +1,1883 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2001 Dirk Mueller ( mueller@kde.org )
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
+ *
+ * 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 "StringImpl.h"
+
+#include "AtomicString.h"
+#include "StringBuffer.h"
+#include "StringHash.h"
+#include <wtf/StdLibExtras.h>
+#include <wtf/WTFThreadData.h>
+#include <wtf/unicode/CharacterNames.h>
+
+#ifdef STRING_STATS
+#include <wtf/DataLog.h>
+#endif
+
+using namespace std;
+
+namespace WTF {
+
+using namespace Unicode;
+
+COMPILE_ASSERT(sizeof(StringImpl) == 2 * sizeof(int) + 3 * sizeof(void*), StringImpl_should_stay_small);
+
+#ifdef STRING_STATS
+StringStats StringImpl::m_stringStats;
+
+unsigned StringStats::s_stringRemovesTillPrintStats = StringStats::s_printStringStatsFrequency;
+
+void StringStats::removeString(StringImpl* string)
+{
+    unsigned length = string->length();
+    bool isSubString = string->isSubString();
+
+    --m_totalNumberStrings;
+
+    if (string->has16BitShadow()) {
+        --m_numberUpconvertedStrings;
+        if (!isSubString)
+            m_totalUpconvertedData -= length;
+    }
+
+    if (string->is8Bit()) {
+        --m_number8BitStrings;
+        if (!isSubString)
+            m_total8BitData -= length;
+    } else {
+        --m_number16BitStrings;
+        if (!isSubString)
+            m_total16BitData -= length;
+    }
+
+    if (!--s_stringRemovesTillPrintStats) {
+        s_stringRemovesTillPrintStats = s_printStringStatsFrequency;
+        printStats();
+    }
+}
+
+void StringStats::printStats()
+{
+    dataLog("String stats for process id %d:\n", getpid());
+
+    unsigned long long totalNumberCharacters = m_total8BitData + m_total16BitData;
+    double percent8Bit = m_totalNumberStrings ? ((double)m_number8BitStrings * 100) / (double)m_totalNumberStrings : 0.0;
+    double average8bitLength = m_number8BitStrings ? (double)m_total8BitData / (double)m_number8BitStrings : 0.0;
+    dataLog("%8u (%5.2f%%) 8 bit        %12llu chars  %12llu bytes  avg length %6.1f\n", m_number8BitStrings, percent8Bit, m_total8BitData, m_total8BitData, average8bitLength);
+
+    double percent16Bit = m_totalNumberStrings ? ((double)m_number16BitStrings * 100) / (double)m_totalNumberStrings : 0.0;
+    double average16bitLength = m_number16BitStrings ? (double)m_total16BitData / (double)m_number16BitStrings : 0.0;
+    dataLog("%8u (%5.2f%%) 16 bit       %12llu chars  %12llu bytes  avg length %6.1f\n", m_number16BitStrings, percent16Bit, m_total16BitData, m_total16BitData * 2, average16bitLength);
+
+    double percentUpconverted = m_totalNumberStrings ? ((double)m_numberUpconvertedStrings * 100) / (double)m_number8BitStrings : 0.0;
+    double averageUpconvertedLength = m_numberUpconvertedStrings ? (double)m_totalUpconvertedData / (double)m_numberUpconvertedStrings : 0.0;
+    dataLog("%8u (%5.2f%%) upconverted  %12llu chars  %12llu bytes  avg length %6.1f\n", m_numberUpconvertedStrings, percentUpconverted, m_totalUpconvertedData, m_totalUpconvertedData * 2, averageUpconvertedLength);
+
+    double averageLength = m_totalNumberStrings ? (double)totalNumberCharacters / (double)m_totalNumberStrings : 0.0;
+    dataLog("%8u Total                 %12llu chars  %12llu bytes  avg length %6.1f\n", m_totalNumberStrings, totalNumberCharacters, m_total8BitData + (m_total16BitData + m_totalUpconvertedData) * 2, averageLength);
+}
+#endif
+
+
+StringImpl::~StringImpl()
+{
+    ASSERT(!isStatic());
+
+    STRING_STATS_REMOVE_STRING(this);
+
+    if (isAtomic())
+        AtomicString::remove(this);
+#if USE(JSC)
+    if (isIdentifier()) {
+        if (!wtfThreadData().currentIdentifierTable()->remove(this))
+            CRASH();
+    }
+#endif
+
+    BufferOwnership ownership = bufferOwnership();
+
+    if (has16BitShadow()) {
+        ASSERT(m_copyData16);
+        fastFree(m_copyData16);
+    }
+
+    if (ownership == BufferInternal)
+        return;
+    if (ownership == BufferOwned) {
+        // We use m_data8, but since it is a union with m_data16 this works either way.
+        ASSERT(m_data8);
+        fastFree(const_cast<LChar*>(m_data8));
+        return;
+    }
+#if PLATFORM(QT)
+    if (ownership == BufferAdoptedQString) {
+        if (!m_qStringData->ref.deref())
+            QStringData::deallocate(m_qStringData);
+        return;
+    }
+#endif
+
+    ASSERT(ownership == BufferSubstring);
+    ASSERT(m_substringBuffer);
+    m_substringBuffer->deref();
+}
+
+PassRefPtr<StringImpl> StringImpl::createFromLiteral(const char* characters, unsigned length)
+{
+    ASSERT(charactersAreAllASCII<LChar>(reinterpret_cast<const LChar*>(characters), length));
+    return adoptRef(new StringImpl(characters, length, ConstructFromLiteral));
+}
+
+PassRefPtr<StringImpl> StringImpl::createFromLiteral(const char* characters)
+{
+    size_t length = strlen(characters);
+    ASSERT(charactersAreAllASCII<LChar>(reinterpret_cast<const LChar*>(characters), length));
+    return adoptRef(new StringImpl(characters, length, ConstructFromLiteral));
+}
+
+PassRefPtr<StringImpl> StringImpl::createUninitialized(unsigned length, LChar*& data)
+{
+    if (!length) {
+        data = 0;
+        return empty();
+    }
+
+    // Allocate a single buffer large enough to contain the StringImpl
+    // struct as well as the data which it contains. This removes one
+    // heap allocation from this call.
+    if (length > ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / sizeof(LChar)))
+        CRASH();
+    size_t size = sizeof(StringImpl) + length * sizeof(LChar);
+    StringImpl* string = static_cast<StringImpl*>(fastMalloc(size));
+
+    data = reinterpret_cast<LChar*>(string + 1);
+    return adoptRef(new (NotNull, string) StringImpl(length, Force8BitConstructor));
+}
+
+PassRefPtr<StringImpl> StringImpl::createUninitialized(unsigned length, UChar*& data)
+{
+    if (!length) {
+        data = 0;
+        return empty();
+    }
+
+    // Allocate a single buffer large enough to contain the StringImpl
+    // struct as well as the data which it contains. This removes one 
+    // heap allocation from this call.
+    if (length > ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / sizeof(UChar)))
+        CRASH();
+    size_t size = sizeof(StringImpl) + length * sizeof(UChar);
+    StringImpl* string = static_cast<StringImpl*>(fastMalloc(size));
+
+    data = reinterpret_cast<UChar*>(string + 1);
+    return adoptRef(new (NotNull, string) StringImpl(length));
+}
+
+PassRefPtr<StringImpl> StringImpl::reallocate(PassRefPtr<StringImpl> originalString, unsigned length, LChar*& data)
+{
+    ASSERT(originalString->is8Bit());
+    ASSERT(originalString->hasOneRef());
+    ASSERT(originalString->bufferOwnership() == BufferInternal);
+
+    if (!length) {
+        data = 0;
+        return empty();
+    }
+
+    // Same as createUninitialized() except here we use fastRealloc.
+    if (length > ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / sizeof(LChar)))
+        CRASH();
+    size_t size = sizeof(StringImpl) + length * sizeof(LChar);
+    originalString->~StringImpl();
+    StringImpl* string = static_cast<StringImpl*>(fastRealloc(originalString.leakRef(), size));
+
+    data = reinterpret_cast<LChar*>(string + 1);
+    return adoptRef(new (NotNull, string) StringImpl(length, Force8BitConstructor));
+}
+
+PassRefPtr<StringImpl> StringImpl::reallocate(PassRefPtr<StringImpl> originalString, unsigned length, UChar*& data)
+{
+    ASSERT(!originalString->is8Bit());
+    ASSERT(originalString->hasOneRef());
+    ASSERT(originalString->bufferOwnership() == BufferInternal);
+
+    if (!length) {
+        data = 0;
+        return empty();
+    }
+
+    // Same as createUninitialized() except here we use fastRealloc.
+    if (length > ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / sizeof(UChar)))
+        CRASH();
+    size_t size = sizeof(StringImpl) + length * sizeof(UChar);
+    originalString->~StringImpl();
+    StringImpl* string = static_cast<StringImpl*>(fastRealloc(originalString.leakRef(), size));
+
+    data = reinterpret_cast<UChar*>(string + 1);
+    return adoptRef(new (NotNull, string) StringImpl(length));
+}
+
+PassRefPtr<StringImpl> StringImpl::create(const UChar* characters, unsigned length)
+{
+    if (!characters || !length)
+        return empty();
+
+    UChar* data;
+    RefPtr<StringImpl> string = createUninitialized(length, data);
+    memcpy(data, characters, length * sizeof(UChar));
+    return string.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::create(const LChar* characters, unsigned length)
+{
+    if (!characters || !length)
+        return empty();
+
+    LChar* data;
+    RefPtr<StringImpl> string = createUninitialized(length, data);
+    memcpy(data, characters, length * sizeof(LChar));
+    return string.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::create8BitIfPossible(const UChar* characters, unsigned length)
+{
+    if (!characters || !length)
+        return empty();
+
+    LChar* data;
+    RefPtr<StringImpl> string = createUninitialized(length, data);
+
+    for (size_t i = 0; i < length; ++i) {
+        if (characters[i] & 0xff00)
+            return create(characters, length);
+        data[i] = static_cast<LChar>(characters[i]);
+    }
+
+    return string.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::create(const LChar* string)
+{
+    if (!string)
+        return empty();
+    size_t length = strlen(reinterpret_cast<const char*>(string));
+    if (length > numeric_limits<unsigned>::max())
+        CRASH();
+    return create(string, length);
+}
+
+const UChar* StringImpl::getData16SlowCase() const
+{
+    if (has16BitShadow())
+        return m_copyData16;
+
+    if (bufferOwnership() == BufferSubstring) {
+        // If this is a substring, return a pointer into the parent string.
+        // TODO: Consider severing this string from the parent string
+        unsigned offset = m_data8 - m_substringBuffer->characters8();
+        return m_substringBuffer->characters() + offset;
+    }
+
+    STRING_STATS_ADD_UPCONVERTED_STRING(m_length);
+    
+    unsigned len = length();
+    if (hasTerminatingNullCharacter())
+        len++;
+
+    m_copyData16 = static_cast<UChar*>(fastMalloc(len * sizeof(UChar)));
+
+    m_hashAndFlags |= s_hashFlagHas16BitShadow;
+
+    upconvertCharacters(0, len);
+
+    return m_copyData16;
+}
+
+void StringImpl::upconvertCharacters(unsigned start, unsigned end) const
+{
+    ASSERT(is8Bit());
+    ASSERT(has16BitShadow());
+
+    for (size_t i = start; i < end; i++)
+        m_copyData16[i] = m_data8[i];
+}
+    
+
+bool StringImpl::containsOnlyWhitespace()
+{
+    // FIXME: The definition of whitespace here includes a number of characters
+    // that are not whitespace from the point of view of RenderText; I wonder if
+    // that's a problem in practice.
+    if (is8Bit()) {
+        for (unsigned i = 0; i < m_length; i++) {
+            UChar c = m_data8[i];
+            if (!isASCIISpace(c))
+                return false;
+        }
+
+        return true;
+    }
+
+    for (unsigned i = 0; i < m_length; i++) {
+        UChar c = m_data16[i];
+        if (!isASCIISpace(c))
+            return false;
+    }
+    return true;
+}
+
+PassRefPtr<StringImpl> StringImpl::substring(unsigned start, unsigned length)
+{
+    if (start >= m_length)
+        return empty();
+    unsigned maxLength = m_length - start;
+    if (length >= maxLength) {
+        if (!start)
+            return this;
+        length = maxLength;
+    }
+    if (is8Bit())
+        return create(m_data8 + start, length);
+
+    return create(m_data16 + start, length);
+}
+
+UChar32 StringImpl::characterStartingAt(unsigned i)
+{
+    if (is8Bit())
+        return m_data8[i];
+    if (U16_IS_SINGLE(m_data16[i]))
+        return m_data16[i];
+    if (i + 1 < m_length && U16_IS_LEAD(m_data16[i]) && U16_IS_TRAIL(m_data16[i + 1]))
+        return U16_GET_SUPPLEMENTARY(m_data16[i], m_data16[i + 1]);
+    return 0;
+}
+
+PassRefPtr<StringImpl> StringImpl::lower()
+{
+    // Note: This is a hot function in the Dromaeo benchmark, specifically the
+    // no-op code path up through the first 'return' statement.
+    
+    // First scan the string for uppercase and non-ASCII characters:
+    bool noUpper = true;
+    UChar ored = 0;
+    if (is8Bit()) {
+        const LChar* end = m_data8 + m_length;
+        for (const LChar* chp = m_data8; chp != end; chp++) {
+            if (UNLIKELY(isASCIIUpper(*chp)))
+                noUpper = false;
+            ored |= *chp;
+        }
+        // Nothing to do if the string is all ASCII with no uppercase.
+        if (noUpper && !(ored & ~0x7F))
+            return this;
+
+        if (m_length > static_cast<unsigned>(numeric_limits<int32_t>::max()))
+            CRASH();
+        int32_t length = m_length;
+
+        LChar* data8;
+        RefPtr<StringImpl> newImpl = createUninitialized(length, data8);
+
+        if (!(ored & ~0x7F)) {
+            for (int32_t i = 0; i < length; i++)
+                data8[i] = toASCIILower(m_data8[i]);
+
+            return newImpl.release();
+        }
+
+        // Do a slower implementation for cases that include non-ASCII Latin-1 characters.
+        for (int32_t i = 0; i < length; i++)
+            data8[i] = static_cast<LChar>(Unicode::toLower(m_data8[i]));
+
+        return newImpl.release();
+    }
+
+    const UChar *end = m_data16 + m_length;
+    for (const UChar* chp = m_data16; chp != end; chp++) {
+        if (UNLIKELY(isASCIIUpper(*chp)))
+            noUpper = false;
+        ored |= *chp;
+    }
+    // Nothing to do if the string is all ASCII with no uppercase.
+    if (noUpper && !(ored & ~0x7F))
+        return this;
+
+    if (m_length > static_cast<unsigned>(numeric_limits<int32_t>::max()))
+        CRASH();
+    int32_t length = m_length;
+
+    if (!(ored & ~0x7F)) {
+        UChar* data16;
+        RefPtr<StringImpl> newImpl = createUninitialized(m_length, data16);
+        
+        for (int32_t i = 0; i < length; i++) {
+            UChar c = m_data16[i];
+            data16[i] = toASCIILower(c);
+        }
+        return newImpl.release();
+    }
+    
+    // Do a slower implementation for cases that include non-ASCII characters.
+    UChar* data16;
+    RefPtr<StringImpl> newImpl = createUninitialized(m_length, data16);
+
+    bool error;
+    int32_t realLength = Unicode::toLower(data16, length, m_data16, m_length, &error);
+    if (!error && realLength == length)
+        return newImpl.release();
+
+    newImpl = createUninitialized(realLength, data16);
+    Unicode::toLower(data16, realLength, m_data16, m_length, &error);
+    if (error)
+        return this;
+    return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::upper()
+{
+    // This function could be optimized for no-op cases the way lower() is,
+    // but in empirical testing, few actual calls to upper() are no-ops, so
+    // it wouldn't be worth the extra time for pre-scanning.
+
+    if (m_length > static_cast<unsigned>(numeric_limits<int32_t>::max()))
+        CRASH();
+    int32_t length = m_length;
+
+    if (is8Bit()) {
+        LChar* data8;
+        RefPtr<StringImpl> newImpl = createUninitialized(m_length, data8);
+        
+        // Do a faster loop for the case where all the characters are ASCII.
+        LChar ored = 0;
+        for (int i = 0; i < length; i++) {
+            LChar c = m_data8[i];
+            ored |= c;
+            data8[i] = toASCIIUpper(c);
+        }
+        if (!(ored & ~0x7F))
+            return newImpl.release();
+
+        // Do a slower implementation for cases that include non-ASCII Latin-1 characters.
+        int numberSharpSCharacters = 0;
+
+        // There are two special cases.
+        //  1. latin-1 characters when converted to upper case are 16 bit characters.
+        //  2. Lower case sharp-S converts to "SS" (two characters)
+        for (int32_t i = 0; i < length; i++) {
+            LChar c = m_data8[i];
+            if (UNLIKELY(c == smallLetterSharpS))
+                numberSharpSCharacters++;
+            UChar upper = Unicode::toUpper(c);
+            if (UNLIKELY(upper > 0xff)) {
+                // Since this upper-cased character does not fit in an 8-bit string, we need to take the 16-bit path.
+                goto upconvert;
+            }
+            data8[i] = static_cast<LChar>(upper);
+        }
+
+        if (!numberSharpSCharacters)
+            return newImpl.release();
+
+        // We have numberSSCharacters sharp-s characters, but none of the other special characters.
+        newImpl = createUninitialized(m_length + numberSharpSCharacters, data8);
+
+        LChar* dest = data8;
+
+        for (int32_t i = 0; i < length; i++) {
+            LChar c = m_data8[i];
+            if (c == smallLetterSharpS) {
+                *dest++ = 'S';
+                *dest++ = 'S';
+            } else
+                *dest++ = static_cast<LChar>(Unicode::toUpper(c));
+        }
+
+        return newImpl.release();
+    }
+
+upconvert:
+    const UChar* source16 = characters();
+
+    UChar* data16;
+    RefPtr<StringImpl> newImpl = createUninitialized(m_length, data16);
+    
+    // Do a faster loop for the case where all the characters are ASCII.
+    UChar ored = 0;
+    for (int i = 0; i < length; i++) {
+        UChar c = source16[i];
+        ored |= c;
+        data16[i] = toASCIIUpper(c);
+    }
+    if (!(ored & ~0x7F))
+        return newImpl.release();
+
+    // Do a slower implementation for cases that include non-ASCII characters.
+    bool error;
+    newImpl = createUninitialized(m_length, data16);
+    int32_t realLength = Unicode::toUpper(data16, length, source16, m_length, &error);
+    if (!error && realLength == length)
+        return newImpl;
+    newImpl = createUninitialized(realLength, data16);
+    Unicode::toUpper(data16, realLength, source16, m_length, &error);
+    if (error)
+        return this;
+    return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::fill(UChar character)
+{
+    if (!m_length)
+        return this;
+
+    if (!(character & ~0x7F)) {
+        LChar* data;
+        RefPtr<StringImpl> newImpl = createUninitialized(m_length, data);
+        for (unsigned i = 0; i < m_length; ++i)
+            data[i] = character;
+        return newImpl.release();
+    }
+    UChar* data;
+    RefPtr<StringImpl> newImpl = createUninitialized(m_length, data);
+    for (unsigned i = 0; i < m_length; ++i)
+        data[i] = character;
+    return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::foldCase()
+{
+    if (m_length > static_cast<unsigned>(numeric_limits<int32_t>::max()))
+        CRASH();
+    int32_t length = m_length;
+
+    if (is8Bit()) {
+        // Do a faster loop for the case where all the characters are ASCII.
+        LChar* data;
+        RefPtr <StringImpl>newImpl = createUninitialized(m_length, data);
+        LChar ored = 0;
+
+        for (int32_t i = 0; i < length; i++) {
+            LChar c = m_data8[i];
+            data[i] = toASCIILower(c);
+            ored |= c;
+        }
+
+        if (!(ored & ~0x7F))
+            return newImpl.release();
+
+        // Do a slower implementation for cases that include non-ASCII Latin-1 characters.
+        for (int32_t i = 0; i < length; i++)
+            data[i] = static_cast<LChar>(Unicode::toLower(m_data8[i]));
+
+        return newImpl.release();
+    }
+
+    // Do a faster loop for the case where all the characters are ASCII.
+    UChar* data;
+    RefPtr<StringImpl> newImpl = createUninitialized(m_length, data);
+    UChar ored = 0;
+    for (int32_t i = 0; i < length; i++) {
+        UChar c = m_data16[i];
+        ored |= c;
+        data[i] = toASCIILower(c);
+    }
+    if (!(ored & ~0x7F))
+        return newImpl.release();
+
+    // Do a slower implementation for cases that include non-ASCII characters.
+    bool error;
+    int32_t realLength = Unicode::foldCase(data, length, m_data16, m_length, &error);
+    if (!error && realLength == length)
+        return newImpl.release();
+    newImpl = createUninitialized(realLength, data);
+    Unicode::foldCase(data, realLength, m_data16, m_length, &error);
+    if (error)
+        return this;
+    return newImpl.release();
+}
+
+template <class UCharPredicate>
+inline PassRefPtr<StringImpl> StringImpl::stripMatchedCharacters(UCharPredicate predicate)
+{
+    if (!m_length)
+        return empty();
+
+    unsigned start = 0;
+    unsigned end = m_length - 1;
+    
+    // skip white space from start
+    while (start <= end && predicate(is8Bit() ? m_data8[start] : m_data16[start]))
+        start++;
+    
+    // only white space
+    if (start > end) 
+        return empty();
+
+    // skip white space from end
+    while (end && predicate(is8Bit() ? m_data8[end] : m_data16[end]))
+        end--;
+
+    if (!start && end == m_length - 1)
+        return this;
+    if (is8Bit())
+        return create(m_data8 + start, end + 1 - start);
+    return create(m_data16 + start, end + 1 - start);
+}
+
+class UCharPredicate {
+public:
+    inline UCharPredicate(CharacterMatchFunctionPtr function): m_function(function) { }
+
+    inline bool operator()(UChar ch) const
+    {
+        return m_function(ch);
+    }
+
+private:
+    const CharacterMatchFunctionPtr m_function;
+};
+
+class SpaceOrNewlinePredicate {
+public:
+    inline bool operator()(UChar ch) const
+    {
+        return isSpaceOrNewline(ch);
+    }
+};
+
+PassRefPtr<StringImpl> StringImpl::stripWhiteSpace()
+{
+    return stripMatchedCharacters(SpaceOrNewlinePredicate());
+}
+
+PassRefPtr<StringImpl> StringImpl::stripWhiteSpace(IsWhiteSpaceFunctionPtr isWhiteSpace)
+{
+    return stripMatchedCharacters(UCharPredicate(isWhiteSpace));
+}
+
+template <typename CharType>
+ALWAYS_INLINE PassRefPtr<StringImpl> StringImpl::removeCharacters(const CharType* characters, CharacterMatchFunctionPtr findMatch)
+{
+    const CharType* from = characters;
+    const CharType* fromend = from + m_length;
+    
+    // Assume the common case will not remove any characters
+    while (from != fromend && !findMatch(*from))
+        from++;
+    if (from == fromend)
+        return this;
+    
+    StringBuffer<CharType> data(m_length);
+    CharType* to = data.characters();
+    unsigned outc = from - characters;
+    
+    if (outc)
+        memcpy(to, characters, outc * sizeof(CharType));
+
+    while (true) {
+        while (from != fromend && findMatch(*from))
+            from++;
+        while (from != fromend && !findMatch(*from))
+            to[outc++] = *from++;
+        if (from == fromend)
+            break;
+    }
+
+    data.shrink(outc);
+
+    return adopt(data);
+}
+
+PassRefPtr<StringImpl> StringImpl::removeCharacters(CharacterMatchFunctionPtr findMatch)
+{
+    if (is8Bit())
+        return removeCharacters(characters8(), findMatch);
+    return removeCharacters(characters16(), findMatch);
+}
+
+template <typename CharType, class UCharPredicate>
+inline PassRefPtr<StringImpl> StringImpl::simplifyMatchedCharactersToSpace(UCharPredicate predicate)
+{
+    StringBuffer<CharType> data(m_length);
+
+    const CharType* from = getCharacters<CharType>();
+    const CharType* fromend = from + m_length;
+    int outc = 0;
+    bool changedToSpace = false;
+    
+    CharType* to = data.characters();
+    
+    while (true) {
+        while (from != fromend && predicate(*from)) {
+            if (*from != ' ')
+                changedToSpace = true;
+            from++;
+        }
+        while (from != fromend && !predicate(*from))
+            to[outc++] = *from++;
+        if (from != fromend)
+            to[outc++] = ' ';
+        else
+            break;
+    }
+    
+    if (outc > 0 && to[outc - 1] == ' ')
+        outc--;
+    
+    if (static_cast<unsigned>(outc) == m_length && !changedToSpace)
+        return this;
+    
+    data.shrink(outc);
+    
+    return adopt(data);
+}
+
+PassRefPtr<StringImpl> StringImpl::simplifyWhiteSpace()
+{
+    if (is8Bit())
+        return StringImpl::simplifyMatchedCharactersToSpace<LChar>(SpaceOrNewlinePredicate());
+    return StringImpl::simplifyMatchedCharactersToSpace<UChar>(SpaceOrNewlinePredicate());
+}
+
+PassRefPtr<StringImpl> StringImpl::simplifyWhiteSpace(IsWhiteSpaceFunctionPtr isWhiteSpace)
+{
+    if (is8Bit())
+        return StringImpl::simplifyMatchedCharactersToSpace<LChar>(UCharPredicate(isWhiteSpace));
+    return StringImpl::simplifyMatchedCharactersToSpace<UChar>(UCharPredicate(isWhiteSpace));
+}
+
+int StringImpl::toIntStrict(bool* ok, int base)
+{
+    if (is8Bit())
+        return charactersToIntStrict(characters8(), m_length, ok, base);
+    return charactersToIntStrict(characters16(), m_length, ok, base);
+}
+
+unsigned StringImpl::toUIntStrict(bool* ok, int base)
+{
+    if (is8Bit())
+        return charactersToUIntStrict(characters8(), m_length, ok, base);
+    return charactersToUIntStrict(characters16(), m_length, ok, base);
+}
+
+int64_t StringImpl::toInt64Strict(bool* ok, int base)
+{
+    if (is8Bit())
+        return charactersToInt64Strict(characters8(), m_length, ok, base);
+    return charactersToInt64Strict(characters16(), m_length, ok, base);
+}
+
+uint64_t StringImpl::toUInt64Strict(bool* ok, int base)
+{
+    if (is8Bit())
+        return charactersToUInt64Strict(characters8(), m_length, ok, base);
+    return charactersToUInt64Strict(characters16(), m_length, ok, base);
+}
+
+intptr_t StringImpl::toIntPtrStrict(bool* ok, int base)
+{
+    if (is8Bit())
+        return charactersToIntPtrStrict(characters8(), m_length, ok, base);
+    return charactersToIntPtrStrict(characters16(), m_length, ok, base);
+}
+
+int StringImpl::toInt(bool* ok)
+{
+    if (is8Bit())
+        return charactersToInt(characters8(), m_length, ok);
+    return charactersToInt(characters16(), m_length, ok);
+}
+
+unsigned StringImpl::toUInt(bool* ok)
+{
+    if (is8Bit())
+        return charactersToUInt(characters8(), m_length, ok);
+    return charactersToUInt(characters16(), m_length, ok);
+}
+
+int64_t StringImpl::toInt64(bool* ok)
+{
+    if (is8Bit())
+        return charactersToInt64(characters8(), m_length, ok);
+    return charactersToInt64(characters16(), m_length, ok);
+}
+
+uint64_t StringImpl::toUInt64(bool* ok)
+{
+    if (is8Bit())
+        return charactersToUInt64(characters8(), m_length, ok);
+    return charactersToUInt64(characters16(), m_length, ok);
+}
+
+intptr_t StringImpl::toIntPtr(bool* ok)
+{
+    if (is8Bit())
+        return charactersToIntPtr(characters8(), m_length, ok);
+    return charactersToIntPtr(characters16(), m_length, ok);
+}
+
+double StringImpl::toDouble(bool* ok)
+{
+    if (is8Bit())
+        return charactersToDouble(characters8(), m_length, ok);
+    return charactersToDouble(characters16(), m_length, ok);
+}
+
+float StringImpl::toFloat(bool* ok)
+{
+    if (is8Bit())
+        return charactersToFloat(characters8(), m_length, ok);
+    return charactersToFloat(characters16(), m_length, ok);
+}
+
+bool equalIgnoringCase(const LChar* a, const LChar* b, unsigned length)
+{
+    while (length--) {
+        LChar bc = *b++;
+        if (foldCase(*a++) != foldCase(bc))
+            return false;
+    }
+    return true;
+}
+
+bool equalIgnoringCase(const UChar* a, const LChar* b, unsigned length)
+{
+    while (length--) {
+        LChar bc = *b++;
+        if (foldCase(*a++) != foldCase(bc))
+            return false;
+    }
+    return true;
+}
+
+size_t StringImpl::find(CharacterMatchFunctionPtr matchFunction, unsigned start)
+{
+    if (is8Bit())
+        return WTF::find(characters8(), m_length, matchFunction, start);
+    return WTF::find(characters16(), m_length, matchFunction, start);
+}
+
+size_t StringImpl::find(const LChar* matchString, unsigned index)
+{
+    // Check for null or empty string to match against
+    if (!matchString)
+        return notFound;
+    size_t matchStringLength = strlen(reinterpret_cast<const char*>(matchString));
+    if (matchStringLength > numeric_limits<unsigned>::max())
+        CRASH();
+    unsigned matchLength = matchStringLength;
+    if (!matchLength)
+        return min(index, length());
+
+    // Optimization 1: fast case for strings of length 1.
+    if (matchLength == 1)
+        return WTF::find(characters16(), length(), *matchString, index);
+
+    // Check index & matchLength are in range.
+    if (index > length())
+        return notFound;
+    unsigned searchLength = length() - index;
+    if (matchLength > searchLength)
+        return notFound;
+    // delta is the number of additional times to test; delta == 0 means test only once.
+    unsigned delta = searchLength - matchLength;
+
+    const UChar* searchCharacters = characters() + index;
+
+    // Optimization 2: keep a running hash of the strings,
+    // only call equal if the hashes match.
+    unsigned searchHash = 0;
+    unsigned matchHash = 0;
+    for (unsigned i = 0; i < matchLength; ++i) {
+        searchHash += searchCharacters[i];
+        matchHash += matchString[i];
+    }
+
+    unsigned i = 0;
+    // keep looping until we match
+    while (searchHash != matchHash || !equal(searchCharacters + i, matchString, matchLength)) {
+        if (i == delta)
+            return notFound;
+        searchHash += searchCharacters[i + matchLength];
+        searchHash -= searchCharacters[i];
+        ++i;
+    }
+    return index + i;
+}
+
+size_t StringImpl::findIgnoringCase(const LChar* matchString, unsigned index)
+{
+    // Check for null or empty string to match against
+    if (!matchString)
+        return notFound;
+    size_t matchStringLength = strlen(reinterpret_cast<const char*>(matchString));
+    if (matchStringLength > numeric_limits<unsigned>::max())
+        CRASH();
+    unsigned matchLength = matchStringLength;
+    if (!matchLength)
+        return min(index, length());
+
+    // Check index & matchLength are in range.
+    if (index > length())
+        return notFound;
+    unsigned searchLength = length() - index;
+    if (matchLength > searchLength)
+        return notFound;
+    // delta is the number of additional times to test; delta == 0 means test only once.
+    unsigned delta = searchLength - matchLength;
+
+    const UChar* searchCharacters = characters() + index;
+
+    unsigned i = 0;
+    // keep looping until we match
+    while (!equalIgnoringCase(searchCharacters + i, matchString, matchLength)) {
+        if (i == delta)
+            return notFound;
+        ++i;
+    }
+    return index + i;
+}
+
+template <typename SearchCharacterType, typename MatchCharacterType>
+ALWAYS_INLINE static size_t findInner(const SearchCharacterType* searchCharacters, const MatchCharacterType* matchCharacters, unsigned index, unsigned searchLength, unsigned matchLength)
+{
+    // Optimization: keep a running hash of the strings,
+    // only call equal() if the hashes match.
+
+    // delta is the number of additional times to test; delta == 0 means test only once.
+    unsigned delta = searchLength - matchLength;
+
+    unsigned searchHash = 0;
+    unsigned matchHash = 0;
+
+    for (unsigned i = 0; i < matchLength; ++i) {
+        searchHash += searchCharacters[i];
+        matchHash += matchCharacters[i];
+    }
+
+    unsigned i = 0;
+    // keep looping until we match
+    while (searchHash != matchHash || !equal(searchCharacters + i, matchCharacters, matchLength)) {
+        if (i == delta)
+            return notFound;
+        searchHash += searchCharacters[i + matchLength];
+        searchHash -= searchCharacters[i];
+        ++i;
+    }
+    return index + i;        
+}
+
+size_t StringImpl::find(StringImpl* matchString)
+{
+    // Check for null string to match against
+    if (UNLIKELY(!matchString))
+        return notFound;
+    unsigned matchLength = matchString->length();
+
+    // Optimization 1: fast case for strings of length 1.
+    if (matchLength == 1) {
+        if (is8Bit()) {
+            if (matchString->is8Bit())
+                return WTF::find(characters8(), length(), matchString->characters8()[0]);
+            return WTF::find(characters8(), length(), matchString->characters16()[0]);
+        }
+        if (matchString->is8Bit())
+            return WTF::find(characters16(), length(), matchString->characters8()[0]);
+        return WTF::find(characters16(), length(), matchString->characters16()[0]);
+    }
+
+    // Check matchLength is in range.
+    if (matchLength > length())
+        return notFound;
+
+    // Check for empty string to match against
+    if (UNLIKELY(!matchLength))
+        return 0;
+
+    if (is8Bit()) {
+        if (matchString->is8Bit())
+            return findInner(characters8(), matchString->characters8(), 0, length(), matchLength);
+        return findInner(characters8(), matchString->characters16(), 0, length(), matchLength);
+    }
+
+    if (matchString->is8Bit())
+        return findInner(characters16(), matchString->characters8(), 0, length(), matchLength);
+
+    return findInner(characters16(), matchString->characters16(), 0, length(), matchLength);
+}
+
+size_t StringImpl::find(StringImpl* matchString, unsigned index)
+{
+    // Check for null or empty string to match against
+    if (UNLIKELY(!matchString))
+        return notFound;
+
+    unsigned matchLength = matchString->length();
+
+    // Optimization 1: fast case for strings of length 1.
+    if (matchLength == 1) {
+        if (is8Bit())
+            return WTF::find(characters8(), length(), (*matchString)[0], index);
+        return WTF::find(characters16(), length(), (*matchString)[0], index);
+    }
+
+    if (UNLIKELY(!matchLength))
+        return min(index, length());
+
+    // Check index & matchLength are in range.
+    if (index > length())
+        return notFound;
+    unsigned searchLength = length() - index;
+    if (matchLength > searchLength)
+        return notFound;
+
+    if (is8Bit()) {
+        if (matchString->is8Bit())
+            return findInner(characters8() + index, matchString->characters8(), index, searchLength, matchLength);
+        return findInner(characters8() + index, matchString->characters16(), index, searchLength, matchLength);
+    }
+
+    if (matchString->is8Bit())
+        return findInner(characters16() + index, matchString->characters8(), index, searchLength, matchLength);
+
+    return findInner(characters16() + index, matchString->characters16(), index, searchLength, matchLength);
+}
+
+template <typename SearchCharacterType, typename MatchCharacterType>
+ALWAYS_INLINE static size_t findIgnoringCaseInner(const SearchCharacterType* searchCharacters, const MatchCharacterType* matchCharacters, unsigned index, unsigned searchLength, unsigned matchLength)
+{
+    // delta is the number of additional times to test; delta == 0 means test only once.
+    unsigned delta = searchLength - matchLength;
+
+    unsigned i = 0;
+    // keep looping until we match
+    while (!equalIgnoringCase(searchCharacters + i, matchCharacters, matchLength)) {
+        if (i == delta)
+            return notFound;
+        ++i;
+    }
+    return index + i;
+}
+
+size_t StringImpl::findIgnoringCase(StringImpl* matchString, unsigned index)
+{
+    // Check for null or empty string to match against
+    if (!matchString)
+        return notFound;
+    unsigned matchLength = matchString->length();
+    if (!matchLength)
+        return min(index, length());
+
+    // Check index & matchLength are in range.
+    if (index > length())
+        return notFound;
+    unsigned searchLength = length() - index;
+    if (matchLength > searchLength)
+        return notFound;
+
+    if (is8Bit()) {
+        if (matchString->is8Bit())
+            return findIgnoringCaseInner(characters8() + index, matchString->characters8(), index, searchLength, matchLength);
+        return findIgnoringCaseInner(characters8() + index, matchString->characters16(), index, searchLength, matchLength);
+    }
+
+    if (matchString->is8Bit())
+        return findIgnoringCaseInner(characters16() + index, matchString->characters8(), index, searchLength, matchLength);
+
+    return findIgnoringCaseInner(characters16() + index, matchString->characters16(), index, searchLength, matchLength);
+}
+
+size_t StringImpl::reverseFind(UChar c, unsigned index)
+{
+    if (is8Bit())
+        return WTF::reverseFind(characters8(), m_length, c, index);
+    return WTF::reverseFind(characters16(), m_length, c, index);
+}
+
+template <typename SearchCharacterType, typename MatchCharacterType>
+ALWAYS_INLINE static size_t reverseFindInner(const SearchCharacterType* searchCharacters, const MatchCharacterType* matchCharacters, unsigned index, unsigned length, unsigned matchLength)
+{
+    // Optimization: keep a running hash of the strings,
+    // only call equal if the hashes match.
+
+    // delta is the number of additional times to test; delta == 0 means test only once.
+    unsigned delta = min(index, length - matchLength);
+    
+    unsigned searchHash = 0;
+    unsigned matchHash = 0;
+    for (unsigned i = 0; i < matchLength; ++i) {
+        searchHash += searchCharacters[delta + i];
+        matchHash += matchCharacters[i];
+    }
+
+    // keep looping until we match
+    while (searchHash != matchHash || !equal(searchCharacters + delta, matchCharacters, matchLength)) {
+        if (!delta)
+            return notFound;
+        delta--;
+        searchHash -= searchCharacters[delta + matchLength];
+        searchHash += searchCharacters[delta];
+    }
+    return delta;
+}
+
+size_t StringImpl::reverseFind(StringImpl* matchString, unsigned index)
+{
+    // Check for null or empty string to match against
+    if (!matchString)
+        return notFound;
+    unsigned matchLength = matchString->length();
+    unsigned ourLength = length();
+    if (!matchLength)
+        return min(index, ourLength);
+
+    // Optimization 1: fast case for strings of length 1.
+    if (matchLength == 1) {
+        if (is8Bit())
+            return WTF::reverseFind(characters8(), ourLength, (*matchString)[0], index);
+        return WTF::reverseFind(characters16(), ourLength, (*matchString)[0], index);
+    }
+
+    // Check index & matchLength are in range.
+    if (matchLength > ourLength)
+        return notFound;
+
+    if (is8Bit()) {
+        if (matchString->is8Bit())
+            return reverseFindInner(characters8(), matchString->characters8(), index, ourLength, matchLength);
+        return reverseFindInner(characters8(), matchString->characters16(), index, ourLength, matchLength);
+    }
+    
+    if (matchString->is8Bit())
+        return reverseFindInner(characters16(), matchString->characters8(), index, ourLength, matchLength);
+
+    return reverseFindInner(characters16(), matchString->characters16(), index, ourLength, matchLength);
+}
+
+template <typename SearchCharacterType, typename MatchCharacterType>
+ALWAYS_INLINE static size_t reverseFindIgnoringCaseInner(const SearchCharacterType* searchCharacters, const MatchCharacterType* matchCharacters, unsigned index, unsigned length, unsigned matchLength)
+{
+    // delta is the number of additional times to test; delta == 0 means test only once.
+    unsigned delta = min(index, length - matchLength);
+
+    // keep looping until we match
+    while (!equalIgnoringCase(searchCharacters + delta, matchCharacters, matchLength)) {
+        if (!delta)
+            return notFound;
+        delta--;
+    }
+    return delta;
+}
+
+size_t StringImpl::reverseFindIgnoringCase(StringImpl* matchString, unsigned index)
+{
+    // Check for null or empty string to match against
+    if (!matchString)
+        return notFound;
+    unsigned matchLength = matchString->length();
+    unsigned ourLength = length();
+    if (!matchLength)
+        return min(index, ourLength);
+
+    // Check index & matchLength are in range.
+    if (matchLength > ourLength)
+        return notFound;
+
+    if (is8Bit()) {
+        if (matchString->is8Bit())
+            return reverseFindIgnoringCaseInner(characters8(), matchString->characters8(), index, ourLength, matchLength);
+        return reverseFindIgnoringCaseInner(characters8(), matchString->characters16(), index, ourLength, matchLength);
+    }
+
+    if (matchString->is8Bit())
+        return reverseFindIgnoringCaseInner(characters16(), matchString->characters8(), index, ourLength, matchLength);
+
+    return reverseFindIgnoringCaseInner(characters16(), matchString->characters16(), index, ourLength, matchLength);
+}
+
+ALWAYS_INLINE static bool equalInner(const StringImpl* stringImpl, unsigned startOffset, const char* matchString, unsigned matchLength, bool caseSensitive)
+{
+    ASSERT(stringImpl);
+    ASSERT(matchLength <= stringImpl->length());
+    ASSERT(startOffset + matchLength <= stringImpl->length());
+
+    if (caseSensitive) {
+        if (stringImpl->is8Bit())
+            return equal(stringImpl->characters8() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
+        return equal(stringImpl->characters16() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
+    }
+    if (stringImpl->is8Bit())
+        return equalIgnoringCase(stringImpl->characters8() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
+    return equalIgnoringCase(stringImpl->characters16() + startOffset, reinterpret_cast<const LChar*>(matchString), matchLength);
+}
+
+bool StringImpl::startsWith(UChar character) const
+{
+    return m_length && (*this)[0] == character;
+}
+
+bool StringImpl::startsWith(const char* matchString, unsigned matchLength, bool caseSensitive) const
+{
+    ASSERT(matchLength);
+    if (matchLength > length())
+        return false;
+    return equalInner(this, 0, matchString, matchLength, caseSensitive);
+}
+
+bool StringImpl::endsWith(StringImpl* matchString, bool caseSensitive)
+{
+    ASSERT(matchString);
+    if (m_length >= matchString->m_length) {
+        unsigned start = m_length - matchString->m_length;
+        return (caseSensitive ? find(matchString, start) : findIgnoringCase(matchString, start)) == start;
+    }
+    return false;
+}
+
+bool StringImpl::endsWith(UChar character) const
+{
+    return m_length && (*this)[m_length - 1] == character;
+}
+
+bool StringImpl::endsWith(const char* matchString, unsigned matchLength, bool caseSensitive) const
+{
+    ASSERT(matchLength);
+    if (matchLength > length())
+        return false;
+    unsigned startOffset = length() - matchLength;
+    return equalInner(this, startOffset, matchString, matchLength, caseSensitive);
+}
+
+PassRefPtr<StringImpl> StringImpl::replace(UChar oldC, UChar newC)
+{
+    if (oldC == newC)
+        return this;
+    unsigned i;
+    for (i = 0; i != m_length; ++i) {
+        UChar c = is8Bit() ? m_data8[i] : m_data16[i];
+        if (c == oldC)
+            break;
+    }
+    if (i == m_length)
+        return this;
+
+    if (is8Bit()) {
+        if (oldC > 0xff)
+            // Looking for a 16 bit char in an 8 bit string, we're done.
+            return this;
+
+        if (newC <= 0xff) {
+            LChar* data;
+            LChar oldChar = static_cast<LChar>(oldC);
+            LChar newChar = static_cast<LChar>(newC);
+
+            RefPtr<StringImpl> newImpl = createUninitialized(m_length, data);
+
+            for (i = 0; i != m_length; ++i) {
+                LChar ch = m_data8[i];
+                if (ch == oldChar)
+                    ch = newChar;
+                data[i] = ch;
+            }
+            return newImpl.release();
+        }
+
+        // There is the possibility we need to up convert from 8 to 16 bit,
+        // create a 16 bit string for the result.
+        UChar* data;
+        RefPtr<StringImpl> newImpl = createUninitialized(m_length, data);
+
+        for (i = 0; i != m_length; ++i) {
+            UChar ch = m_data8[i];
+            if (ch == oldC)
+                ch = newC;
+            data[i] = ch;
+        }
+
+        return newImpl.release();
+    }
+
+    UChar* data;
+    RefPtr<StringImpl> newImpl = createUninitialized(m_length, data);
+
+    for (i = 0; i != m_length; ++i) {
+        UChar ch = m_data16[i];
+        if (ch == oldC)
+            ch = newC;
+        data[i] = ch;
+    }
+    return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::replace(unsigned position, unsigned lengthToReplace, StringImpl* str)
+{
+    position = min(position, length());
+    lengthToReplace = min(lengthToReplace, length() - position);
+    unsigned lengthToInsert = str ? str->length() : 0;
+    if (!lengthToReplace && !lengthToInsert)
+        return this;
+
+    if ((length() - lengthToReplace) >= (numeric_limits<unsigned>::max() - lengthToInsert))
+        CRASH();
+
+    if (is8Bit() && (!str || str->is8Bit())) {
+        LChar* data;
+        RefPtr<StringImpl> newImpl =
+        createUninitialized(length() - lengthToReplace + lengthToInsert, data);
+        memcpy(data, m_data8, position * sizeof(LChar));
+        if (str)
+            memcpy(data + position, str->m_data8, lengthToInsert * sizeof(LChar));
+        memcpy(data + position + lengthToInsert, m_data8 + position + lengthToReplace,
+               (length() - position - lengthToReplace) * sizeof(LChar));
+        return newImpl.release();
+    }
+    UChar* data;
+    RefPtr<StringImpl> newImpl =
+        createUninitialized(length() - lengthToReplace + lengthToInsert, data);
+    if (is8Bit())
+        for (unsigned i = 0; i < position; i++)
+            data[i] = m_data8[i];
+    else
+        memcpy(data, m_data16, position * sizeof(UChar));
+    if (str) {
+        if (str->is8Bit())
+            for (unsigned i = 0; i < lengthToInsert; i++)
+                data[i + position] = str->m_data8[i];
+        else
+            memcpy(data + position, str->m_data16, lengthToInsert * sizeof(UChar));
+    }
+    if (is8Bit()) {
+        for (unsigned i = 0; i < length() - position - lengthToReplace; i++)
+            data[i + position + lengthToInsert] = m_data8[i + position + lengthToReplace];
+    } else {
+        memcpy(data + position + lengthToInsert, characters() + position + lengthToReplace,
+            (length() - position - lengthToReplace) * sizeof(UChar));
+    }
+    return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::replace(UChar pattern, StringImpl* replacement)
+{
+    if (!replacement)
+        return this;
+
+    if (replacement->is8Bit())
+        return replace(pattern, replacement->m_data8, replacement->length());
+
+    return replace(pattern, replacement->m_data16, replacement->length());
+}
+
+PassRefPtr<StringImpl> StringImpl::replace(UChar pattern, const LChar* replacement, unsigned repStrLength)
+{
+    ASSERT(replacement);
+
+    size_t srcSegmentStart = 0;
+    unsigned matchCount = 0;
+
+    // Count the matches.
+    while ((srcSegmentStart = find(pattern, srcSegmentStart)) != notFound) {
+        ++matchCount;
+        ++srcSegmentStart;
+    }
+
+    // If we have 0 matches then we don't have to do any more work.
+    if (!matchCount)
+        return this;
+
+    if (repStrLength && matchCount > numeric_limits<unsigned>::max() / repStrLength)
+        CRASH();
+
+    unsigned replaceSize = matchCount * repStrLength;
+    unsigned newSize = m_length - matchCount;
+    if (newSize >= (numeric_limits<unsigned>::max() - replaceSize))
+        CRASH();
+
+    newSize += replaceSize;
+
+    // Construct the new data.
+    size_t srcSegmentEnd;
+    unsigned srcSegmentLength;
+    srcSegmentStart = 0;
+    unsigned dstOffset = 0;
+
+    if (is8Bit()) {
+        LChar* data;
+        RefPtr<StringImpl> newImpl = createUninitialized(newSize, data);
+
+        while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != notFound) {
+            srcSegmentLength = srcSegmentEnd - srcSegmentStart;
+            memcpy(data + dstOffset, m_data8 + srcSegmentStart, srcSegmentLength * sizeof(LChar));
+            dstOffset += srcSegmentLength;
+            memcpy(data + dstOffset, replacement, repStrLength * sizeof(LChar));
+            dstOffset += repStrLength;
+            srcSegmentStart = srcSegmentEnd + 1;
+        }
+
+        srcSegmentLength = m_length - srcSegmentStart;
+        memcpy(data + dstOffset, m_data8 + srcSegmentStart, srcSegmentLength * sizeof(LChar));
+
+        ASSERT(dstOffset + srcSegmentLength == newImpl->length());
+
+        return newImpl.release();
+    }
+
+    UChar* data;
+    RefPtr<StringImpl> newImpl = createUninitialized(newSize, data);
+
+    while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != notFound) {
+        srcSegmentLength = srcSegmentEnd - srcSegmentStart;
+        memcpy(data + dstOffset, m_data16 + srcSegmentStart, srcSegmentLength * sizeof(UChar));
+
+        dstOffset += srcSegmentLength;
+        for (unsigned i = 0; i < repStrLength; ++i)
+            data[i + dstOffset] = replacement[i];
+
+        dstOffset += repStrLength;
+        srcSegmentStart = srcSegmentEnd + 1;
+    }
+
+    srcSegmentLength = m_length - srcSegmentStart;
+    memcpy(data + dstOffset, m_data16 + srcSegmentStart, srcSegmentLength * sizeof(UChar));
+
+    ASSERT(dstOffset + srcSegmentLength == newImpl->length());
+
+    return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::replace(UChar pattern, const UChar* replacement, unsigned repStrLength)
+{
+    ASSERT(replacement);
+
+    size_t srcSegmentStart = 0;
+    unsigned matchCount = 0;
+
+    // Count the matches.
+    while ((srcSegmentStart = find(pattern, srcSegmentStart)) != notFound) {
+        ++matchCount;
+        ++srcSegmentStart;
+    }
+
+    // If we have 0 matches then we don't have to do any more work.
+    if (!matchCount)
+        return this;
+
+    if (repStrLength && matchCount > numeric_limits<unsigned>::max() / repStrLength)
+        CRASH();
+
+    unsigned replaceSize = matchCount * repStrLength;
+    unsigned newSize = m_length - matchCount;
+    if (newSize >= (numeric_limits<unsigned>::max() - replaceSize))
+        CRASH();
+
+    newSize += replaceSize;
+
+    // Construct the new data.
+    size_t srcSegmentEnd;
+    unsigned srcSegmentLength;
+    srcSegmentStart = 0;
+    unsigned dstOffset = 0;
+
+    if (is8Bit()) {
+        UChar* data;
+        RefPtr<StringImpl> newImpl = createUninitialized(newSize, data);
+
+        while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != notFound) {
+            srcSegmentLength = srcSegmentEnd - srcSegmentStart;
+            for (unsigned i = 0; i < srcSegmentLength; ++i)
+                data[i + dstOffset] = m_data8[i + srcSegmentStart];
+
+            dstOffset += srcSegmentLength;
+            memcpy(data + dstOffset, replacement, repStrLength * sizeof(UChar));
+
+            dstOffset += repStrLength;
+            srcSegmentStart = srcSegmentEnd + 1;
+        }
+
+        srcSegmentLength = m_length - srcSegmentStart;
+        for (unsigned i = 0; i < srcSegmentLength; ++i)
+            data[i + dstOffset] = m_data8[i + srcSegmentStart];
+
+        ASSERT(dstOffset + srcSegmentLength == newImpl->length());
+
+        return newImpl.release();
+    }
+
+    UChar* data;
+    RefPtr<StringImpl> newImpl = createUninitialized(newSize, data);
+
+    while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != notFound) {
+        srcSegmentLength = srcSegmentEnd - srcSegmentStart;
+        memcpy(data + dstOffset, m_data16 + srcSegmentStart, srcSegmentLength * sizeof(UChar));
+
+        dstOffset += srcSegmentLength;
+        memcpy(data + dstOffset, replacement, repStrLength * sizeof(UChar));
+
+        dstOffset += repStrLength;
+        srcSegmentStart = srcSegmentEnd + 1;
+    }
+
+    srcSegmentLength = m_length - srcSegmentStart;
+    memcpy(data + dstOffset, m_data16 + srcSegmentStart, srcSegmentLength * sizeof(UChar));
+
+    ASSERT(dstOffset + srcSegmentLength == newImpl->length());
+
+    return newImpl.release();
+}
+
+PassRefPtr<StringImpl> StringImpl::replace(StringImpl* pattern, StringImpl* replacement)
+{
+    if (!pattern || !replacement)
+        return this;
+
+    unsigned patternLength = pattern->length();
+    if (!patternLength)
+        return this;
+        
+    unsigned repStrLength = replacement->length();
+    size_t srcSegmentStart = 0;
+    unsigned matchCount = 0;
+    
+    // Count the matches.
+    while ((srcSegmentStart = find(pattern, srcSegmentStart)) != notFound) {
+        ++matchCount;
+        srcSegmentStart += patternLength;
+    }
+    
+    // If we have 0 matches, we don't have to do any more work
+    if (!matchCount)
+        return this;
+    
+    unsigned newSize = m_length - matchCount * patternLength;
+    if (repStrLength && matchCount > numeric_limits<unsigned>::max() / repStrLength)
+        CRASH();
+
+    if (newSize > (numeric_limits<unsigned>::max() - matchCount * repStrLength))
+        CRASH();
+
+    newSize += matchCount * repStrLength;
+
+    
+    // Construct the new data
+    size_t srcSegmentEnd;
+    unsigned srcSegmentLength;
+    srcSegmentStart = 0;
+    unsigned dstOffset = 0;
+    bool srcIs8Bit = is8Bit();
+    bool replacementIs8Bit = replacement->is8Bit();
+    
+    // There are 4 cases:
+    // 1. This and replacement are both 8 bit.
+    // 2. This and replacement are both 16 bit.
+    // 3. This is 8 bit and replacement is 16 bit.
+    // 4. This is 16 bit and replacement is 8 bit.
+    if (srcIs8Bit && replacementIs8Bit) {
+        // Case 1
+        LChar* data;
+        RefPtr<StringImpl> newImpl = createUninitialized(newSize, data);
+        while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != notFound) {
+            srcSegmentLength = srcSegmentEnd - srcSegmentStart;
+            memcpy(data + dstOffset, m_data8 + srcSegmentStart, srcSegmentLength * sizeof(LChar));
+            dstOffset += srcSegmentLength;
+            memcpy(data + dstOffset, replacement->m_data8, repStrLength * sizeof(LChar));
+            dstOffset += repStrLength;
+            srcSegmentStart = srcSegmentEnd + patternLength;
+        }
+
+        srcSegmentLength = m_length - srcSegmentStart;
+        memcpy(data + dstOffset, m_data8 + srcSegmentStart, srcSegmentLength * sizeof(LChar));
+
+        ASSERT(dstOffset + srcSegmentLength == newImpl->length());
+
+        return newImpl.release();
+    }
+
+    UChar* data;
+    RefPtr<StringImpl> newImpl = createUninitialized(newSize, data);
+    while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != notFound) {
+        srcSegmentLength = srcSegmentEnd - srcSegmentStart;
+        if (srcIs8Bit) {
+            // Case 3.
+            for (unsigned i = 0; i < srcSegmentLength; i++)
+                data[i + dstOffset] = m_data8[i + srcSegmentStart];
+        } else {
+            // Case 2 & 4.
+            memcpy(data + dstOffset, m_data16 + srcSegmentStart, srcSegmentLength * sizeof(UChar));
+        }
+        dstOffset += srcSegmentLength;
+        if (replacementIs8Bit) {
+            // Cases 2 & 3.
+            for (unsigned i = 0; i < repStrLength; i++)
+                data[i + dstOffset] = replacement->m_data8[i];
+        } else {
+            // Case 4
+            memcpy(data + dstOffset, replacement->m_data16, repStrLength * sizeof(UChar));
+        }
+        dstOffset += repStrLength;
+        srcSegmentStart = srcSegmentEnd + patternLength;
+    }
+
+    srcSegmentLength = m_length - srcSegmentStart;
+    if (srcIs8Bit) {
+        // Case 3.
+        for (unsigned i = 0; i < srcSegmentLength; i++)
+            data[i + dstOffset] = m_data8[i + srcSegmentStart];
+    } else {
+        // Cases 2 & 4.
+        memcpy(data + dstOffset, m_data16 + srcSegmentStart, srcSegmentLength * sizeof(UChar));
+    }
+
+    ASSERT(dstOffset + srcSegmentLength == newImpl->length());
+
+    return newImpl.release();
+}
+
+bool equal(const StringImpl* a, const StringImpl* b)
+{
+    return StringHash::equal(a, b);
+}
+
+bool equal(const StringImpl* a, const LChar* b, unsigned length)
+{
+    if (!a)
+        return !b;
+    if (!b)
+        return !a;
+
+    if (length != a->length())
+        return false;
+
+    if (a->is8Bit())
+        return equal(a->characters8(), b, length);
+    return equal(a->characters16(), b, length);
+}
+
+bool equal(const StringImpl* a, const LChar* b)
+{
+    if (!a)
+        return !b;
+    if (!b)
+        return !a;
+
+    unsigned length = a->length();
+
+    if (a->is8Bit()) {
+        const LChar* aPtr = a->characters8();
+        for (unsigned i = 0; i != length; ++i) {
+            LChar bc = b[i];
+            LChar ac = aPtr[i];
+            if (!bc)
+                return false;
+            if (ac != bc)
+                return false;
+        }
+
+        return !b[length];
+    }
+
+    const UChar* aPtr = a->characters16();
+    for (unsigned i = 0; i != length; ++i) {
+        LChar bc = b[i];
+        if (!bc)
+            return false;
+        if (aPtr[i] != bc)
+            return false;
+    }
+
+    return !b[length];
+}
+
+bool equal(const StringImpl* a, const UChar* b, unsigned length)
+{
+    if (!a)
+        return !b;
+    if (!b)
+        return false;
+
+    if (a->length() != length)
+        return false;
+    if (a->is8Bit())
+        return equal(a->characters8(), b, length);
+    return equal(a->characters16(), b, length);
+}
+
+bool equalIgnoringCase(StringImpl* a, StringImpl* b)
+{
+    return CaseFoldingHash::equal(a, b);
+}
+
+bool equalIgnoringCase(StringImpl* a, const LChar* b)
+{
+    if (!a)
+        return !b;
+    if (!b)
+        return !a;
+
+    unsigned length = a->length();
+
+    // Do a faster loop for the case where all the characters are ASCII.
+    UChar ored = 0;
+    bool equal = true;
+    if (a->is8Bit()) {
+        const LChar* as = a->characters8();
+        for (unsigned i = 0; i != length; ++i) {
+            LChar bc = b[i];
+            if (!bc)
+                return false;
+            UChar ac = as[i];
+            ored |= ac;
+            equal = equal && (toASCIILower(ac) == toASCIILower(bc));
+        }
+        
+        // Do a slower implementation for cases that include non-ASCII characters.
+        if (ored & ~0x7F) {
+            equal = true;
+            for (unsigned i = 0; i != length; ++i)
+                equal = equal && (foldCase(as[i]) == foldCase(b[i]));
+        }
+        
+        return equal && !b[length];        
+    }
+
+    const UChar* as = a->characters16();
+    for (unsigned i = 0; i != length; ++i) {
+        LChar bc = b[i];
+        if (!bc)
+            return false;
+        UChar ac = as[i];
+        ored |= ac;
+        equal = equal && (toASCIILower(ac) == toASCIILower(bc));
+    }
+
+    // Do a slower implementation for cases that include non-ASCII characters.
+    if (ored & ~0x7F) {
+        equal = true;
+        for (unsigned i = 0; i != length; ++i) {
+            equal = equal && (foldCase(as[i]) == foldCase(b[i]));
+        }
+    }
+
+    return equal && !b[length];
+}
+
+bool equalIgnoringNullity(StringImpl* a, StringImpl* b)
+{
+    if (StringHash::equal(a, b))
+        return true;
+    if (!a && b && !b->length())
+        return true;
+    if (!b && a && !a->length())
+        return true;
+
+    return false;
+}
+
+WTF::Unicode::Direction StringImpl::defaultWritingDirection(bool* hasStrongDirectionality)
+{
+    for (unsigned i = 0; i < m_length; ++i) {
+        WTF::Unicode::Direction charDirection = WTF::Unicode::direction(is8Bit() ? m_data8[i] : m_data16[i]);
+        if (charDirection == WTF::Unicode::LeftToRight) {
+            if (hasStrongDirectionality)
+                *hasStrongDirectionality = true;
+            return WTF::Unicode::LeftToRight;
+        }
+        if (charDirection == WTF::Unicode::RightToLeft || charDirection == WTF::Unicode::RightToLeftArabic) {
+            if (hasStrongDirectionality)
+                *hasStrongDirectionality = true;
+            return WTF::Unicode::RightToLeft;
+        }
+    }
+    if (hasStrongDirectionality)
+        *hasStrongDirectionality = false;
+    return WTF::Unicode::LeftToRight;
+}
+
+PassRefPtr<StringImpl> StringImpl::adopt(StringBuffer<LChar>& buffer)
+{
+unsigned length = buffer.length();
+if (!length)
+    return empty();
+return adoptRef(new StringImpl(buffer.release(), length));
+}
+
+PassRefPtr<StringImpl> StringImpl::adopt(StringBuffer<UChar>& buffer)
+{
+    unsigned length = buffer.length();
+    if (!length)
+        return empty();
+    return adoptRef(new StringImpl(buffer.release(), length));
+}
+
+#if PLATFORM(QT)
+PassRefPtr<StringImpl> StringImpl::adopt(QStringData* qStringData)
+{
+    ASSERT(qStringData);
+
+    if (!qStringData->size)
+        return empty();
+
+    return adoptRef(new StringImpl(qStringData, ConstructAdoptedQString));
+}
+#endif
+
+PassRefPtr<StringImpl> StringImpl::createWithTerminatingNullCharacter(const StringImpl& string)
+{
+    // Use createUninitialized instead of 'new StringImpl' so that the string and its buffer
+    // get allocated in a single memory block.
+    unsigned length = string.m_length;
+    if (length >= numeric_limits<unsigned>::max())
+        CRASH();
+    RefPtr<StringImpl> terminatedString;
+    if (string.is8Bit()) {
+        LChar* data;
+        terminatedString = createUninitialized(length + 1, data);
+        memcpy(data, string.m_data8, length * sizeof(LChar));
+        data[length] = 0;
+    } else {
+        UChar* data;
+        terminatedString = createUninitialized(length + 1, data);
+        memcpy(data, string.m_data16, length * sizeof(UChar));
+        data[length] = 0;
+    }
+    terminatedString->m_length--;
+    terminatedString->m_hashAndFlags = (string.m_hashAndFlags & (~s_flagMask | s_hashFlag8BitBuffer)) | s_hashFlagHasTerminatingNullCharacter;
+    return terminatedString.release();
+}
+
+size_t StringImpl::sizeInBytes() const
+{
+    // FIXME: support substrings
+    size_t size = length();
+    if (is8Bit()) {
+        if (has16BitShadow()) {
+            size += 2 * size;
+            if (hasTerminatingNullCharacter())
+                size += 2;
+        }
+    } else
+        size *= 2;
+    return size + sizeof(*this);
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/text/StringImpl.h b/Source/WTF/wtf/text/StringImpl.h
new file mode 100644
index 0000000..53104f8
--- /dev/null
+++ b/Source/WTF/wtf/text/StringImpl.h
@@ -0,0 +1,1153 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google 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 StringImpl_h
+#define StringImpl_h
+
+#include <limits.h>
+#include <wtf/ASCIICType.h>
+#include <wtf/Forward.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/StringHasher.h>
+#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
+
+#if PLATFORM(QT)
+#include <QString>
+#endif
+
+#if USE(CF)
+typedef const struct __CFString * CFStringRef;
+#endif
+
+#ifdef __OBJC__
+@class NSString;
+#endif
+
+#if PLATFORM(BLACKBERRY)
+#include <BlackBerryPlatformString.h>
+#endif
+
+// FIXME: This is a temporary layering violation while we move string code to WTF.
+// Landing the file moves in one patch, will follow on with patches to change the namespaces.
+namespace JSC {
+struct IdentifierASCIIStringTranslator;
+namespace LLInt { class Data; }
+class LLIntOffsetsExtractor;
+template <typename T> struct IdentifierCharBufferTranslator;
+struct IdentifierLCharFromUCharTranslator;
+}
+
+namespace WTF {
+
+struct CStringTranslator;
+template<typename CharacterType> struct HashAndCharactersTranslator;
+struct HashAndUTF8CharactersTranslator;
+struct LCharBufferTranslator;
+struct CharBufferFromLiteralDataTranslator;
+class MemoryObjectInfo;
+struct SubstringTranslator;
+struct UCharBufferTranslator;
+template<typename> class RetainPtr;
+
+enum TextCaseSensitivity { TextCaseSensitive, TextCaseInsensitive };
+
+typedef bool (*CharacterMatchFunctionPtr)(UChar);
+typedef bool (*IsWhiteSpaceFunctionPtr)(UChar);
+
+// Define STRING_STATS to turn on run time statistics of string sizes and memory usage
+#undef STRING_STATS
+
+#ifdef STRING_STATS
+struct StringStats {
+    inline void add8BitString(unsigned length, bool isSubString = false)
+    {
+        ++m_totalNumberStrings;
+        ++m_number8BitStrings;
+        if (!isSubString)
+            m_total8BitData += length;
+    }
+
+    inline void add16BitString(unsigned length, bool isSubString = false)
+    {
+        ++m_totalNumberStrings;
+        ++m_number16BitStrings;
+        if (!isSubString)
+            m_total16BitData += length;
+    }
+
+    inline void addUpconvertedString(unsigned length)
+    {
+        ++m_numberUpconvertedStrings;
+        m_totalUpconvertedData += length;
+    }
+
+    void removeString(StringImpl*);
+    void printStats();
+
+    static const unsigned s_printStringStatsFrequency = 5000;
+    static unsigned s_stringRemovesTillPrintStats;
+
+    unsigned m_totalNumberStrings;
+    unsigned m_number8BitStrings;
+    unsigned m_number16BitStrings;
+    unsigned m_numberUpconvertedStrings;
+    unsigned long long m_total8BitData;
+    unsigned long long m_total16BitData;
+    unsigned long long m_totalUpconvertedData;
+};
+
+#define STRING_STATS_ADD_8BIT_STRING(length) StringImpl::stringStats().add8BitString(length)
+#define STRING_STATS_ADD_8BIT_STRING2(length, isSubString) StringImpl::stringStats().add8BitString(length, isSubString)
+#define STRING_STATS_ADD_16BIT_STRING(length) StringImpl::stringStats().add16BitString(length)
+#define STRING_STATS_ADD_16BIT_STRING2(length, isSubString) StringImpl::stringStats().add16BitString(length, isSubString)
+#define STRING_STATS_ADD_UPCONVERTED_STRING(length) StringImpl::stringStats().addUpconvertedString(length)
+#define STRING_STATS_REMOVE_STRING(string) StringImpl::stringStats().removeString(string)
+#else
+#define STRING_STATS_ADD_8BIT_STRING(length) ((void)0)
+#define STRING_STATS_ADD_8BIT_STRING2(length, isSubString) ((void)0)
+#define STRING_STATS_ADD_16BIT_STRING(length) ((void)0)
+#define STRING_STATS_ADD_16BIT_STRING2(length, isSubString) ((void)0)
+#define STRING_STATS_ADD_UPCONVERTED_STRING(length) ((void)0)
+#define STRING_STATS_REMOVE_STRING(string) ((void)0)
+#endif
+
+class StringImpl {
+    WTF_MAKE_NONCOPYABLE(StringImpl); WTF_MAKE_FAST_ALLOCATED;
+    friend struct JSC::IdentifierASCIIStringTranslator;
+    friend struct JSC::IdentifierCharBufferTranslator<LChar>;
+    friend struct JSC::IdentifierCharBufferTranslator<UChar>;
+    friend struct JSC::IdentifierLCharFromUCharTranslator;
+    friend struct WTF::CStringTranslator;
+    template<typename CharacterType> friend struct WTF::HashAndCharactersTranslator;
+    friend struct WTF::HashAndUTF8CharactersTranslator;
+    friend struct WTF::CharBufferFromLiteralDataTranslator;
+    friend struct WTF::LCharBufferTranslator;
+    friend struct WTF::SubstringTranslator;
+    friend struct WTF::UCharBufferTranslator;
+    friend class AtomicStringImpl;
+    friend class JSC::LLInt::Data;
+    friend class JSC::LLIntOffsetsExtractor;
+    
+private:
+    enum BufferOwnership {
+        BufferInternal,
+        BufferOwned,
+        BufferSubstring,
+#if PLATFORM(QT)
+        BufferAdoptedQString
+#endif
+        // NOTE: Adding more ownership types needs to extend m_hashAndFlags as we're at capacity
+    };
+
+    // Used to construct static strings, which have an special refCount that can never hit zero.
+    // This means that the static string will never be destroyed, which is important because
+    // static strings will be shared across threads & ref-counted in a non-threadsafe manner.
+    enum ConstructStaticStringTag { ConstructStaticString };
+    StringImpl(const UChar* characters, unsigned length, ConstructStaticStringTag)
+        : m_refCount(s_refCountFlagIsStaticString)
+        , m_length(length)
+        , m_data16(characters)
+        , m_buffer(0)
+        , m_hashAndFlags(s_hashFlagIsIdentifier | BufferOwned)
+    {
+        // Ensure that the hash is computed so that AtomicStringHash can call existingHash()
+        // with impunity. The empty string is special because it is never entered into
+        // AtomicString's HashKey, but still needs to compare correctly.
+        STRING_STATS_ADD_16BIT_STRING(m_length);
+
+        hash();
+    }
+
+    // Used to construct static strings, which have an special refCount that can never hit zero.
+    // This means that the static string will never be destroyed, which is important because
+    // static strings will be shared across threads & ref-counted in a non-threadsafe manner.
+    StringImpl(const LChar* characters, unsigned length, ConstructStaticStringTag)
+        : m_refCount(s_refCountFlagIsStaticString)
+        , m_length(length)
+        , m_data8(characters)
+        , m_buffer(0)
+        , m_hashAndFlags(s_hashFlag8BitBuffer | s_hashFlagIsIdentifier | BufferOwned)
+    {
+        // Ensure that the hash is computed so that AtomicStringHash can call existingHash()
+        // with impunity. The empty string is special because it is never entered into
+        // AtomicString's HashKey, but still needs to compare correctly.
+        STRING_STATS_ADD_8BIT_STRING(m_length);
+
+        hash();
+    }
+
+    // FIXME: there has to be a less hacky way to do this.
+    enum Force8Bit { Force8BitConstructor };
+    // Create a normal 8-bit string with internal storage (BufferInternal)
+    StringImpl(unsigned length, Force8Bit)
+        : m_refCount(s_refCountIncrement)
+        , m_length(length)
+        , m_data8(reinterpret_cast<const LChar*>(this + 1))
+        , m_buffer(0)
+        , m_hashAndFlags(s_hashFlag8BitBuffer | BufferInternal)
+    {
+        ASSERT(m_data8);
+        ASSERT(m_length);
+
+        STRING_STATS_ADD_8BIT_STRING(m_length);
+    }
+
+    // Create a normal 16-bit string with internal storage (BufferInternal)
+    StringImpl(unsigned length)
+        : m_refCount(s_refCountIncrement)
+        , m_length(length)
+        , m_data16(reinterpret_cast<const UChar*>(this + 1))
+        , m_buffer(0)
+        , m_hashAndFlags(BufferInternal)
+    {
+        ASSERT(m_data16);
+        ASSERT(m_length);
+
+        STRING_STATS_ADD_16BIT_STRING(m_length);
+    }
+
+    // Create a StringImpl adopting ownership of the provided buffer (BufferOwned)
+    StringImpl(const LChar* characters, unsigned length)
+        : m_refCount(s_refCountIncrement)
+        , m_length(length)
+        , m_data8(characters)
+        , m_buffer(0)
+        , m_hashAndFlags(s_hashFlag8BitBuffer | BufferOwned)
+    {
+        ASSERT(m_data8);
+        ASSERT(m_length);
+
+        STRING_STATS_ADD_8BIT_STRING(m_length);
+    }
+
+    enum ConstructFromLiteralTag { ConstructFromLiteral };
+    StringImpl(const char* characters, unsigned length, ConstructFromLiteralTag)
+        : m_refCount(s_refCountIncrement)
+        , m_length(length)
+        , m_data8(reinterpret_cast<const LChar*>(characters))
+        , m_buffer(0)
+        , m_hashAndFlags(s_hashFlag8BitBuffer | BufferInternal | s_hashFlagHasTerminatingNullCharacter)
+    {
+        ASSERT(m_data8);
+        ASSERT(m_length);
+        ASSERT(!characters[length]);
+
+        STRING_STATS_ADD_8BIT_STRING(0);
+    }
+
+    // Create a StringImpl adopting ownership of the provided buffer (BufferOwned)
+    StringImpl(const UChar* characters, unsigned length)
+        : m_refCount(s_refCountIncrement)
+        , m_length(length)
+        , m_data16(characters)
+        , m_buffer(0)
+        , m_hashAndFlags(BufferOwned)
+    {
+        ASSERT(m_data16);
+        ASSERT(m_length);
+
+        STRING_STATS_ADD_16BIT_STRING(m_length);
+    }
+
+    // Used to create new strings that are a substring of an existing 8-bit StringImpl (BufferSubstring)
+    StringImpl(const LChar* characters, unsigned length, PassRefPtr<StringImpl> base)
+        : m_refCount(s_refCountIncrement)
+        , m_length(length)
+        , m_data8(characters)
+        , m_substringBuffer(base.leakRef())
+        , m_hashAndFlags(s_hashFlag8BitBuffer | BufferSubstring)
+    {
+        ASSERT(is8Bit());
+        ASSERT(m_data8);
+        ASSERT(m_length);
+        ASSERT(m_substringBuffer->bufferOwnership() != BufferSubstring);
+
+        STRING_STATS_ADD_8BIT_STRING2(m_length, true);
+    }
+
+    // Used to create new strings that are a substring of an existing 16-bit StringImpl (BufferSubstring)
+    StringImpl(const UChar* characters, unsigned length, PassRefPtr<StringImpl> base)
+        : m_refCount(s_refCountIncrement)
+        , m_length(length)
+        , m_data16(characters)
+        , m_substringBuffer(base.leakRef())
+        , m_hashAndFlags(BufferSubstring)
+    {
+        ASSERT(!is8Bit());
+        ASSERT(m_data16);
+        ASSERT(m_length);
+        ASSERT(m_substringBuffer->bufferOwnership() != BufferSubstring);
+
+        STRING_STATS_ADD_16BIT_STRING2(m_length, true);
+    }
+
+    enum CreateEmptyUnique_T { CreateEmptyUnique };
+    StringImpl(CreateEmptyUnique_T)
+        : m_refCount(s_refCountIncrement)
+        , m_length(0)
+        , m_data16(reinterpret_cast<const UChar*>(1))
+        , m_buffer(0)
+    {
+        ASSERT(m_data16);
+        // Set the hash early, so that all empty unique StringImpls have a hash,
+        // and don't use the normal hashing algorithm - the unique nature of these
+        // keys means that we don't need them to match any other string (in fact,
+        // that's exactly the oposite of what we want!), and teh normal hash would
+        // lead to lots of conflicts.
+        unsigned hash = reinterpret_cast<uintptr_t>(this);
+        hash <<= s_flagCount;
+        if (!hash)
+            hash = 1 << s_flagCount;
+        m_hashAndFlags = hash | BufferInternal;
+
+        STRING_STATS_ADD_16BIT_STRING(m_length);
+    }
+
+#if PLATFORM(QT)
+    // Used to create new strings that adopt an existing QString's data
+    enum ConstructAdoptedQStringTag { ConstructAdoptedQString };
+    StringImpl(QStringData* qStringData, ConstructAdoptedQStringTag)
+        : m_refCount(s_refCountIncrement)
+        , m_length(qStringData->size)
+        , m_data16(0)
+        , m_qStringData(qStringData)
+        , m_hashAndFlags(BufferAdoptedQString)
+    {
+        ASSERT(m_length);
+
+        // We ref the string-data to ensure it will be valid for the lifetime of
+        // this string. We then deref it in the destructor, so that the string
+        // data can eventually be freed.
+        m_qStringData->ref.ref();
+
+        // Now that we have a ref we can safely reference the string data
+        m_data16 = reinterpret_cast_ptr<const UChar*>(qStringData->data());
+        ASSERT(m_data16);
+
+        STRING_STATS_ADD_16BIT_STRING(m_length);
+    }
+#endif
+
+public:
+    WTF_EXPORT_STRING_API ~StringImpl();
+
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> create(const UChar*, unsigned length);
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> create(const LChar*, unsigned length);
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> create8BitIfPossible(const UChar*, unsigned length);
+    ALWAYS_INLINE static PassRefPtr<StringImpl> create(const char* s, unsigned length) { return create(reinterpret_cast<const LChar*>(s), length); }
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> create(const LChar*);
+    ALWAYS_INLINE static PassRefPtr<StringImpl> create(const char* s) { return create(reinterpret_cast<const LChar*>(s)); }
+
+    static ALWAYS_INLINE PassRefPtr<StringImpl> create8(PassRefPtr<StringImpl> rep, unsigned offset, unsigned length)
+    {
+        ASSERT(rep);
+        ASSERT(length <= rep->length());
+
+        if (!length)
+            return empty();
+
+        ASSERT(rep->is8Bit());
+        StringImpl* ownerRep = (rep->bufferOwnership() == BufferSubstring) ? rep->m_substringBuffer : rep.get();
+        return adoptRef(new StringImpl(rep->m_data8 + offset, length, ownerRep));
+    }
+
+    static ALWAYS_INLINE PassRefPtr<StringImpl> create(PassRefPtr<StringImpl> rep, unsigned offset, unsigned length)
+    {
+        ASSERT(rep);
+        ASSERT(length <= rep->length());
+
+        if (!length)
+            return empty();
+
+        StringImpl* ownerRep = (rep->bufferOwnership() == BufferSubstring) ? rep->m_substringBuffer : rep.get();
+        if (rep->is8Bit())
+            return adoptRef(new StringImpl(rep->m_data8 + offset, length, ownerRep));
+        return adoptRef(new StringImpl(rep->m_data16 + offset, length, ownerRep));
+    }
+
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> createFromLiteral(const char* characters, unsigned length);
+    template<unsigned charactersCount>
+    ALWAYS_INLINE static PassRefPtr<StringImpl> createFromLiteral(const char (&characters)[charactersCount])
+    {
+        COMPILE_ASSERT(charactersCount > 1, StringImplFromLiteralNotEmpty);
+        COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImpl)) / sizeof(LChar))), StringImplFromLiteralCannotOverflow);
+
+        return createFromLiteral(characters, charactersCount - 1);
+    }
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> createFromLiteral(const char* characters);
+
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> createUninitialized(unsigned length, LChar*& data);
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> createUninitialized(unsigned length, UChar*& data);
+    template <typename T> static ALWAYS_INLINE PassRefPtr<StringImpl> tryCreateUninitialized(unsigned length, T*& output)
+    {
+        if (!length) {
+            output = 0;
+            return empty();
+        }
+
+        if (length > ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / sizeof(T))) {
+            output = 0;
+            return 0;
+        }
+        StringImpl* resultImpl;
+        if (!tryFastMalloc(sizeof(T) * length + sizeof(StringImpl)).getValue(resultImpl)) {
+            output = 0;
+            return 0;
+        }
+        output = reinterpret_cast<T*>(resultImpl + 1);
+
+        if (sizeof(T) == sizeof(char))
+            return adoptRef(new (NotNull, resultImpl) StringImpl(length, Force8BitConstructor));
+
+        return adoptRef(new (NotNull, resultImpl) StringImpl(length));
+    }
+
+    static PassRefPtr<StringImpl> createEmptyUnique()
+    {
+        return adoptRef(new StringImpl(CreateEmptyUnique));
+    }
+
+    // Reallocate the StringImpl. The originalString must be only owned by the PassRefPtr,
+    // and the buffer ownership must be BufferInternal. Just like the input pointer of realloc(),
+    // the originalString can't be used after this function.
+    static PassRefPtr<StringImpl> reallocate(PassRefPtr<StringImpl> originalString, unsigned length, LChar*& data);
+    static PassRefPtr<StringImpl> reallocate(PassRefPtr<StringImpl> originalString, unsigned length, UChar*& data);
+
+    static unsigned flagsOffset() { return OBJECT_OFFSETOF(StringImpl, m_hashAndFlags); }
+    static unsigned flagIs8Bit() { return s_hashFlag8BitBuffer; }
+    static unsigned dataOffset() { return OBJECT_OFFSETOF(StringImpl, m_data8); }
+    static PassRefPtr<StringImpl> createWithTerminatingNullCharacter(const StringImpl&);
+
+    template<typename CharType, size_t inlineCapacity>
+    static PassRefPtr<StringImpl> adopt(Vector<CharType, inlineCapacity>& vector)
+    {
+        if (size_t size = vector.size()) {
+            ASSERT(vector.data());
+            if (size > std::numeric_limits<unsigned>::max())
+                CRASH();
+            return adoptRef(new StringImpl(vector.releaseBuffer(), size));
+        }
+        return empty();
+    }
+
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> adopt(StringBuffer<UChar>&);
+    WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> adopt(StringBuffer<LChar>&);
+
+#if PLATFORM(QT)
+    static PassRefPtr<StringImpl> adopt(QStringData*);
+#endif
+
+    unsigned length() const { return m_length; }
+    bool is8Bit() const { return m_hashAndFlags & s_hashFlag8BitBuffer; }
+    bool hasInternalBuffer() const { return bufferOwnership() == BufferInternal; }
+    bool hasOwnedBuffer() const { return bufferOwnership() == BufferOwned; }
+    StringImpl* baseString() const { return bufferOwnership() == BufferSubstring ? m_substringBuffer : 0; }
+
+    // FIXME: Remove all unnecessary usages of characters()
+    ALWAYS_INLINE const LChar* characters8() const { ASSERT(is8Bit()); return m_data8; }
+    ALWAYS_INLINE const UChar* characters16() const { ASSERT(!is8Bit()); return m_data16; }
+    ALWAYS_INLINE const UChar* characters() const
+    {
+        if (!is8Bit())
+            return m_data16;
+
+        return getData16SlowCase();
+    }
+
+    template <typename CharType>
+    ALWAYS_INLINE const CharType * getCharacters() const;
+
+    size_t cost()
+    {
+        // For substrings, return the cost of the base string.
+        if (bufferOwnership() == BufferSubstring)
+            return m_substringBuffer->cost();
+
+        if (m_hashAndFlags & s_hashFlagDidReportCost)
+            return 0;
+
+        m_hashAndFlags |= s_hashFlagDidReportCost;
+        return m_length;
+    }
+
+    WTF_EXPORT_STRING_API size_t sizeInBytes() const;
+
+    bool has16BitShadow() const { return m_hashAndFlags & s_hashFlagHas16BitShadow; }
+    WTF_EXPORT_STRING_API void upconvertCharacters(unsigned, unsigned) const;
+    bool isIdentifier() const { return m_hashAndFlags & s_hashFlagIsIdentifier; }
+    void setIsIdentifier(bool isIdentifier)
+    {
+        ASSERT(!isStatic());
+        if (isIdentifier)
+            m_hashAndFlags |= s_hashFlagIsIdentifier;
+        else
+            m_hashAndFlags &= ~s_hashFlagIsIdentifier;
+    }
+
+    bool isEmptyUnique() const
+    {
+        return !length() && !isStatic();
+    }
+
+    bool hasTerminatingNullCharacter() const { return m_hashAndFlags & s_hashFlagHasTerminatingNullCharacter; }
+
+    bool isAtomic() const { return m_hashAndFlags & s_hashFlagIsAtomic; }
+    void setIsAtomic(bool isIdentifier)
+    {
+        ASSERT(!isStatic());
+        if (isIdentifier)
+            m_hashAndFlags |= s_hashFlagIsAtomic;
+        else
+            m_hashAndFlags &= ~s_hashFlagIsAtomic;
+    }
+
+#ifdef STRING_STATS
+    bool isSubString() const { return  bufferOwnership() == BufferSubstring; }
+#endif
+
+#if PLATFORM(QT)
+    QStringData* qStringData() { return bufferOwnership() == BufferAdoptedQString ? m_qStringData : 0; }
+#endif
+
+private:
+    // The high bits of 'hash' are always empty, but we prefer to store our flags
+    // in the low bits because it makes them slightly more efficient to access.
+    // So, we shift left and right when setting and getting our hash code.
+    void setHash(unsigned hash) const
+    {
+        ASSERT(!hasHash());
+        // Multiple clients assume that StringHasher is the canonical string hash function.
+        ASSERT(hash == (is8Bit() ? StringHasher::computeHashAndMaskTop8Bits(m_data8, m_length) : StringHasher::computeHashAndMaskTop8Bits(m_data16, m_length)));
+        ASSERT(!(hash & (s_flagMask << (8 * sizeof(hash) - s_flagCount)))); // Verify that enough high bits are empty.
+        
+        hash <<= s_flagCount;
+        ASSERT(!(hash & m_hashAndFlags)); // Verify that enough low bits are empty after shift.
+        ASSERT(hash); // Verify that 0 is a valid sentinel hash value.
+
+        m_hashAndFlags |= hash; // Store hash with flags in low bits.
+    }
+
+    unsigned rawHash() const
+    {
+        return m_hashAndFlags >> s_flagCount;
+    }
+
+public:
+    bool hasHash() const
+    {
+        return rawHash() != 0;
+    }
+
+    unsigned existingHash() const
+    {
+        ASSERT(hasHash());
+        return rawHash();
+    }
+
+    unsigned hash() const
+    {
+        if (hasHash())
+            return existingHash();
+        return hashSlowCase();
+    }
+
+    inline bool hasOneRef() const
+    {
+        return m_refCount == s_refCountIncrement;
+    }
+
+    inline void ref()
+    {
+        m_refCount += s_refCountIncrement;
+    }
+
+    inline void deref()
+    {
+        if (m_refCount == s_refCountIncrement) {
+            delete this;
+            return;
+        }
+
+        m_refCount -= s_refCountIncrement;
+    }
+
+    WTF_EXPORT_PRIVATE static StringImpl* empty();
+
+    // FIXME: Does this really belong in StringImpl?
+    template <typename T> static void copyChars(T* destination, const T* source, unsigned numCharacters)
+    {
+        if (numCharacters == 1) {
+            *destination = *source;
+            return;
+        }
+
+        if (numCharacters <= s_copyCharsInlineCutOff) {
+            unsigned i = 0;
+#if (CPU(X86) || CPU(X86_64))
+            const unsigned charsPerInt = sizeof(uint32_t) / sizeof(T);
+
+            if (numCharacters > charsPerInt) {
+                unsigned stopCount = numCharacters & ~(charsPerInt - 1);
+
+                const uint32_t* srcCharacters = reinterpret_cast<const uint32_t*>(source);
+                uint32_t* destCharacters = reinterpret_cast<uint32_t*>(destination);
+                for (unsigned j = 0; i < stopCount; i += charsPerInt, ++j)
+                    destCharacters[j] = srcCharacters[j];
+            }
+#endif
+            for (; i < numCharacters; ++i)
+                destination[i] = source[i];
+        } else
+            memcpy(destination, source, numCharacters * sizeof(T));
+    }
+
+    ALWAYS_INLINE static void copyChars(UChar* destination, const LChar* source, unsigned numCharacters)
+    {
+        for (unsigned i = 0; i < numCharacters; ++i)
+            destination[i] = source[i];
+    }
+
+    // Some string features, like refcounting and the atomicity flag, are not
+    // thread-safe. We achieve thread safety by isolation, giving each thread
+    // its own copy of the string.
+    PassRefPtr<StringImpl> isolatedCopy() const;
+
+    WTF_EXPORT_STRING_API PassRefPtr<StringImpl> substring(unsigned pos, unsigned len = UINT_MAX);
+
+    UChar operator[](unsigned i) const
+    {
+        ASSERT(i < m_length);
+        if (is8Bit())
+            return m_data8[i];
+        return m_data16[i];
+    }
+    WTF_EXPORT_STRING_API UChar32 characterStartingAt(unsigned);
+
+    WTF_EXPORT_STRING_API bool containsOnlyWhitespace();
+
+    int toIntStrict(bool* ok = 0, int base = 10);
+    unsigned toUIntStrict(bool* ok = 0, int base = 10);
+    int64_t toInt64Strict(bool* ok = 0, int base = 10);
+    uint64_t toUInt64Strict(bool* ok = 0, int base = 10);
+    intptr_t toIntPtrStrict(bool* ok = 0, int base = 10);
+
+    WTF_EXPORT_STRING_API int toInt(bool* ok = 0); // ignores trailing garbage
+    unsigned toUInt(bool* ok = 0); // ignores trailing garbage
+    int64_t toInt64(bool* ok = 0); // ignores trailing garbage
+    uint64_t toUInt64(bool* ok = 0); // ignores trailing garbage
+    intptr_t toIntPtr(bool* ok = 0); // ignores trailing garbage
+
+    // FIXME: Like the strict functions above, these give false for "ok" when there is trailing garbage.
+    // Like the non-strict functions above, these return the value when there is trailing garbage.
+    // It would be better if these were more consistent with the above functions instead.
+    double toDouble(bool* ok = 0);
+    float toFloat(bool* ok = 0);
+
+    WTF_EXPORT_STRING_API PassRefPtr<StringImpl> lower();
+    WTF_EXPORT_STRING_API PassRefPtr<StringImpl> upper();
+
+    WTF_EXPORT_STRING_API PassRefPtr<StringImpl> fill(UChar);
+    // FIXME: Do we need fill(char) or can we just do the right thing if UChar is ASCII?
+    PassRefPtr<StringImpl> foldCase();
+
+    PassRefPtr<StringImpl> stripWhiteSpace();
+    PassRefPtr<StringImpl> stripWhiteSpace(IsWhiteSpaceFunctionPtr);
+    WTF_EXPORT_STRING_API PassRefPtr<StringImpl> simplifyWhiteSpace();
+    PassRefPtr<StringImpl> simplifyWhiteSpace(IsWhiteSpaceFunctionPtr);
+
+    PassRefPtr<StringImpl> removeCharacters(CharacterMatchFunctionPtr);
+    template <typename CharType>
+    ALWAYS_INLINE PassRefPtr<StringImpl> removeCharacters(const CharType* characters, CharacterMatchFunctionPtr);
+
+    size_t find(LChar character, unsigned start = 0);
+    size_t find(char character, unsigned start = 0);
+    size_t find(UChar character, unsigned start = 0);
+    WTF_EXPORT_STRING_API size_t find(CharacterMatchFunctionPtr, unsigned index = 0);
+    size_t find(const LChar*, unsigned index = 0);
+    ALWAYS_INLINE size_t find(const char* s, unsigned index = 0) { return find(reinterpret_cast<const LChar*>(s), index); };
+    WTF_EXPORT_STRING_API size_t find(StringImpl*);
+    WTF_EXPORT_STRING_API size_t find(StringImpl*, unsigned index);
+    size_t findIgnoringCase(const LChar*, unsigned index = 0);
+    ALWAYS_INLINE size_t findIgnoringCase(const char* s, unsigned index = 0) { return findIgnoringCase(reinterpret_cast<const LChar*>(s), index); };
+    WTF_EXPORT_STRING_API size_t findIgnoringCase(StringImpl*, unsigned index = 0);
+
+    WTF_EXPORT_STRING_API size_t reverseFind(UChar, unsigned index = UINT_MAX);
+    WTF_EXPORT_STRING_API size_t reverseFind(StringImpl*, unsigned index = UINT_MAX);
+    WTF_EXPORT_STRING_API size_t reverseFindIgnoringCase(StringImpl*, unsigned index = UINT_MAX);
+
+    bool startsWith(StringImpl* str, bool caseSensitive = true) { return (caseSensitive ? reverseFind(str, 0) : reverseFindIgnoringCase(str, 0)) == 0; }
+    WTF_EXPORT_STRING_API bool startsWith(UChar) const;
+    WTF_EXPORT_STRING_API bool startsWith(const char*, unsigned matchLength, bool caseSensitive) const;
+    template<unsigned matchLength>
+    bool startsWith(const char (&prefix)[matchLength], bool caseSensitive = true) const { return startsWith(prefix, matchLength - 1, caseSensitive); };
+
+    WTF_EXPORT_STRING_API bool endsWith(StringImpl*, bool caseSensitive = true);
+    WTF_EXPORT_STRING_API bool endsWith(UChar) const;
+    WTF_EXPORT_STRING_API bool endsWith(const char*, unsigned matchLength, bool caseSensitive) const;
+    template<unsigned matchLength>
+    bool endsWith(const char (&prefix)[matchLength], bool caseSensitive = true) const { return endsWith(prefix, matchLength - 1, caseSensitive); }
+
+    WTF_EXPORT_STRING_API PassRefPtr<StringImpl> replace(UChar, UChar);
+    WTF_EXPORT_STRING_API PassRefPtr<StringImpl> replace(UChar, StringImpl*);
+    ALWAYS_INLINE PassRefPtr<StringImpl> replace(UChar pattern, const char* replacement, unsigned replacementLength) { return replace(pattern, reinterpret_cast<const LChar*>(replacement), replacementLength); }
+    WTF_EXPORT_STRING_API PassRefPtr<StringImpl> replace(UChar, const LChar*, unsigned replacementLength);
+    PassRefPtr<StringImpl> replace(UChar, const UChar*, unsigned replacementLength);
+    WTF_EXPORT_STRING_API PassRefPtr<StringImpl> replace(StringImpl*, StringImpl*);
+    WTF_EXPORT_STRING_API PassRefPtr<StringImpl> replace(unsigned index, unsigned len, StringImpl*);
+
+    WTF_EXPORT_STRING_API WTF::Unicode::Direction defaultWritingDirection(bool* hasStrongDirectionality = 0);
+
+#if USE(CF)
+    RetainPtr<CFStringRef> createCFString();
+#endif
+#ifdef __OBJC__
+    operator NSString*();
+#endif
+
+#ifdef STRING_STATS
+    ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; }
+#endif
+
+private:
+    // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings.
+    static const unsigned s_copyCharsInlineCutOff = 20;
+
+    BufferOwnership bufferOwnership() const { return static_cast<BufferOwnership>(m_hashAndFlags & s_hashMaskBufferOwnership); }
+    bool isStatic() const { return m_refCount & s_refCountFlagIsStaticString; }
+    template <class UCharPredicate> PassRefPtr<StringImpl> stripMatchedCharacters(UCharPredicate);
+    template <typename CharType, class UCharPredicate> PassRefPtr<StringImpl> simplifyMatchedCharactersToSpace(UCharPredicate);
+    WTF_EXPORT_STRING_API NEVER_INLINE const UChar* getData16SlowCase() const;
+    WTF_EXPORT_PRIVATE NEVER_INLINE unsigned hashSlowCase() const;
+
+    // The bottom bit in the ref count indicates a static (immortal) string.
+    static const unsigned s_refCountFlagIsStaticString = 0x1;
+    static const unsigned s_refCountIncrement = 0x2; // This allows us to ref / deref without disturbing the static string flag.
+
+    // The bottom 8 bits in the hash are flags.
+    static const unsigned s_flagCount = 8;
+    static const unsigned s_flagMask = (1u << s_flagCount) - 1;
+    COMPILE_ASSERT(s_flagCount == StringHasher::flagCount, StringHasher_reserves_enough_bits_for_StringImpl_flags);
+
+    static const unsigned s_hashFlagHas16BitShadow = 1u << 7;
+    static const unsigned s_hashFlag8BitBuffer = 1u << 6;
+    static const unsigned s_hashFlagHasTerminatingNullCharacter = 1u << 5;
+    static const unsigned s_hashFlagIsAtomic = 1u << 4;
+    static const unsigned s_hashFlagDidReportCost = 1u << 3;
+    static const unsigned s_hashFlagIsIdentifier = 1u << 2;
+    static const unsigned s_hashMaskBufferOwnership = 1u | (1u << 1);
+
+#ifdef STRING_STATS
+    WTF_EXPORTDATA static StringStats m_stringStats;
+#endif
+    unsigned m_refCount;
+    unsigned m_length;
+    union {
+        const LChar* m_data8;
+        const UChar* m_data16;
+    };
+    union {
+        void* m_buffer;
+        StringImpl* m_substringBuffer;
+        mutable UChar* m_copyData16;
+#if PLATFORM(QT)
+        QStringData* m_qStringData;
+#endif
+    };
+    mutable unsigned m_hashAndFlags;
+};
+
+template <>
+ALWAYS_INLINE const LChar* StringImpl::getCharacters<LChar>() const { return characters8(); }
+
+template <>
+ALWAYS_INLINE const UChar* StringImpl::getCharacters<UChar>() const { return characters(); }
+
+WTF_EXPORT_STRING_API bool equal(const StringImpl*, const StringImpl*);
+WTF_EXPORT_STRING_API bool equal(const StringImpl*, const LChar*);
+inline bool equal(const StringImpl* a, const char* b) { return equal(a, reinterpret_cast<const LChar*>(b)); }
+WTF_EXPORT_STRING_API bool equal(const StringImpl*, const LChar*, unsigned);
+inline bool equal(const StringImpl* a, const char* b, unsigned length) { return equal(a, reinterpret_cast<const LChar*>(b), length); }
+inline bool equal(const LChar* a, StringImpl* b) { return equal(b, a); }
+inline bool equal(const char* a, StringImpl* b) { return equal(b, reinterpret_cast<const LChar*>(a)); }
+WTF_EXPORT_STRING_API bool equal(const StringImpl*, const UChar*, unsigned);
+
+// Do comparisons 8 or 4 bytes-at-a-time on architectures where it's safe.
+#if CPU(X86_64)
+ALWAYS_INLINE bool equal(const LChar* a, const LChar* b, unsigned length)
+{
+    unsigned dwordLength = length >> 3;
+
+    if (dwordLength) {
+        const uint64_t* aDWordCharacters = reinterpret_cast<const uint64_t*>(a);
+        const uint64_t* bDWordCharacters = reinterpret_cast<const uint64_t*>(b);
+
+        for (unsigned i = 0; i != dwordLength; ++i) {
+            if (*aDWordCharacters++ != *bDWordCharacters++)
+                return false;
+        }
+
+        a = reinterpret_cast<const LChar*>(aDWordCharacters);
+        b = reinterpret_cast<const LChar*>(bDWordCharacters);
+    }
+
+    if (length & 4) {
+        if (*reinterpret_cast<const uint32_t*>(a) != *reinterpret_cast<const uint32_t*>(b))
+            return false;
+
+        a += 4;
+        b += 4;
+    }
+
+    if (length & 2) {
+        if (*reinterpret_cast<const uint16_t*>(a) != *reinterpret_cast<const uint16_t*>(b))
+            return false;
+
+        a += 2;
+        b += 2;
+    }
+
+    if (length & 1 && (*a != *b))
+        return false;
+
+    return true;
+}
+
+ALWAYS_INLINE bool equal(const UChar* a, const UChar* b, unsigned length)
+{
+    unsigned dwordLength = length >> 2;
+    
+    if (dwordLength) {
+        const uint64_t* aDWordCharacters = reinterpret_cast<const uint64_t*>(a);
+        const uint64_t* bDWordCharacters = reinterpret_cast<const uint64_t*>(b);
+
+        for (unsigned i = 0; i != dwordLength; ++i) {
+            if (*aDWordCharacters++ != *bDWordCharacters++)
+                return false;
+        }
+
+        a = reinterpret_cast<const UChar*>(aDWordCharacters);
+        b = reinterpret_cast<const UChar*>(bDWordCharacters);
+    }
+
+    if (length & 2) {
+        if (*reinterpret_cast<const uint32_t*>(a) != *reinterpret_cast<const uint32_t*>(b))
+            return false;
+
+        a += 2;
+        b += 2;
+    }
+
+    if (length & 1 && (*a != *b))
+        return false;
+
+    return true;
+}
+#elif CPU(X86)
+ALWAYS_INLINE bool equal(const LChar* a, const LChar* b, unsigned length)
+{
+    const uint32_t* aCharacters = reinterpret_cast<const uint32_t*>(a);
+    const uint32_t* bCharacters = reinterpret_cast<const uint32_t*>(b);
+
+    unsigned wordLength = length >> 2;
+    for (unsigned i = 0; i != wordLength; ++i) {
+        if (*aCharacters++ != *bCharacters++)
+            return false;
+    }
+
+    length &= 3;
+
+    if (length) {
+        const LChar* aRemainder = reinterpret_cast<const LChar*>(aCharacters);
+        const LChar* bRemainder = reinterpret_cast<const LChar*>(bCharacters);
+        
+        for (unsigned i = 0; i <  length; ++i) {
+            if (aRemainder[i] != bRemainder[i])
+                return false;
+        }
+    }
+
+    return true;
+}
+
+ALWAYS_INLINE bool equal(const UChar* a, const UChar* b, unsigned length)
+{
+    const uint32_t* aCharacters = reinterpret_cast<const uint32_t*>(a);
+    const uint32_t* bCharacters = reinterpret_cast<const uint32_t*>(b);
+    
+    unsigned wordLength = length >> 1;
+    for (unsigned i = 0; i != wordLength; ++i) {
+        if (*aCharacters++ != *bCharacters++)
+            return false;
+    }
+    
+    if (length & 1 && *reinterpret_cast<const UChar*>(aCharacters) != *reinterpret_cast<const UChar*>(bCharacters))
+        return false;
+    
+    return true;
+}
+#else
+ALWAYS_INLINE bool equal(const LChar* a, const LChar* b, unsigned length)
+{
+    for (unsigned i = 0; i != length; ++i) {
+        if (a[i] != b[i])
+            return false;
+    }
+
+    return true;
+}
+
+ALWAYS_INLINE bool equal(const UChar* a, const UChar* b, unsigned length)
+{
+    for (unsigned i = 0; i != length; ++i) {
+        if (a[i] != b[i])
+            return false;
+    }
+
+    return true;
+}
+#endif
+
+ALWAYS_INLINE bool equal(const LChar* a, const UChar* b, unsigned length)
+{
+    for (unsigned i = 0; i != length; ++i) {
+        if (a[i] != b[i])
+            return false;
+    }
+
+    return true;
+}
+
+ALWAYS_INLINE bool equal(const UChar* a, const LChar* b, unsigned length)
+{
+    for (unsigned i = 0; i != length; ++i) {
+        if (a[i] != b[i])
+            return false;
+    }
+
+    return true;
+}
+
+WTF_EXPORT_STRING_API bool equalIgnoringCase(StringImpl*, StringImpl*);
+WTF_EXPORT_STRING_API bool equalIgnoringCase(StringImpl*, const LChar*);
+inline bool equalIgnoringCase(const LChar* a, StringImpl* b) { return equalIgnoringCase(b, a); }
+WTF_EXPORT_STRING_API bool equalIgnoringCase(const LChar*, const LChar*, unsigned);
+WTF_EXPORT_STRING_API bool equalIgnoringCase(const UChar*, const LChar*, unsigned);
+inline bool equalIgnoringCase(const UChar* a, const char* b, unsigned length) { return equalIgnoringCase(a, reinterpret_cast<const LChar*>(b), length); }
+inline bool equalIgnoringCase(const LChar* a, const UChar* b, unsigned length) { return equalIgnoringCase(b, a, length); }
+inline bool equalIgnoringCase(const char* a, const UChar* b, unsigned length) { return equalIgnoringCase(b, reinterpret_cast<const LChar*>(a), length); }
+inline bool equalIgnoringCase(const char* a, const LChar* b, unsigned length) { return equalIgnoringCase(b, reinterpret_cast<const LChar*>(a), length); }
+inline bool equalIgnoringCase(const UChar* a, const UChar* b, int length)
+{
+    ASSERT(length >= 0);
+    return !Unicode::umemcasecmp(a, b, length);
+}
+
+WTF_EXPORT_STRING_API bool equalIgnoringNullity(StringImpl*, StringImpl*);
+
+template<typename CharacterType>
+inline size_t find(const CharacterType* characters, unsigned length, CharacterType matchCharacter, unsigned index = 0)
+{
+    while (index < length) {
+        if (characters[index] == matchCharacter)
+            return index;
+        ++index;
+    }
+    return notFound;
+}
+
+ALWAYS_INLINE size_t find(const UChar* characters, unsigned length, LChar matchCharacter, unsigned index = 0)
+{
+    return find(characters, length, static_cast<UChar>(matchCharacter), index);
+}
+
+inline size_t find(const LChar* characters, unsigned length, UChar matchCharacter, unsigned index = 0)
+{
+    if (matchCharacter & ~0xFF)
+        return notFound;
+    return find(characters, length, static_cast<LChar>(matchCharacter), index);
+}
+
+inline size_t find(const LChar* characters, unsigned length, CharacterMatchFunctionPtr matchFunction, unsigned index = 0)
+{
+    while (index < length) {
+        if (matchFunction(characters[index]))
+            return index;
+        ++index;
+    }
+    return notFound;
+}
+
+inline size_t find(const UChar* characters, unsigned length, CharacterMatchFunctionPtr matchFunction, unsigned index = 0)
+{
+    while (index < length) {
+        if (matchFunction(characters[index]))
+            return index;
+        ++index;
+    }
+    return notFound;
+}
+
+template <typename CharacterType>
+inline size_t reverseFind(const CharacterType* characters, unsigned length, CharacterType matchCharacter, unsigned index = UINT_MAX)
+{
+    if (!length)
+        return notFound;
+    if (index >= length)
+        index = length - 1;
+    while (characters[index] != matchCharacter) {
+        if (!index--)
+            return notFound;
+    }
+    return index;
+}
+
+ALWAYS_INLINE size_t reverseFind(const UChar* characters, unsigned length, LChar matchCharacter, unsigned index = UINT_MAX)
+{
+    return reverseFind(characters, length, static_cast<UChar>(matchCharacter), index);
+}
+
+inline size_t reverseFind(const LChar* characters, unsigned length, UChar matchCharacter, unsigned index = UINT_MAX)
+{
+    if (matchCharacter & ~0xFF)
+        return notFound;
+    return reverseFind(characters, length, static_cast<LChar>(matchCharacter), index);
+}
+
+inline size_t StringImpl::find(LChar character, unsigned start)
+{
+    if (is8Bit())
+        return WTF::find(characters8(), m_length, character, start);
+    return WTF::find(characters16(), m_length, character, start);
+}
+
+ALWAYS_INLINE size_t StringImpl::find(char character, unsigned start)
+{
+    return find(static_cast<LChar>(character), start);
+}
+
+inline size_t StringImpl::find(UChar character, unsigned start)
+{
+    if (is8Bit())
+        return WTF::find(characters8(), m_length, character, start);
+    return WTF::find(characters16(), m_length, character, start);
+}
+
+template<size_t inlineCapacity>
+bool equalIgnoringNullity(const Vector<UChar, inlineCapacity>& a, StringImpl* b)
+{
+    if (!b)
+        return !a.size();
+    if (a.size() != b->length())
+        return false;
+    return !memcmp(a.data(), b->characters(), b->length() * sizeof(UChar));
+}
+
+template<typename CharacterType1, typename CharacterType2>
+static inline int codePointCompare(unsigned l1, unsigned l2, const CharacterType1* c1, const CharacterType2* c2)
+{
+    const unsigned lmin = l1 < l2 ? l1 : l2;
+    unsigned pos = 0;
+    while (pos < lmin && *c1 == *c2) {
+        c1++;
+        c2++;
+        pos++;
+    }
+
+    if (pos < lmin)
+        return (c1[0] > c2[0]) ? 1 : -1;
+
+    if (l1 == l2)
+        return 0;
+
+    return (l1 > l2) ? 1 : -1;
+}
+
+static inline int codePointCompare8(const StringImpl* string1, const StringImpl* string2)
+{
+    return codePointCompare(string1->length(), string2->length(), string1->characters8(), string2->characters8());
+}
+
+static inline int codePointCompare16(const StringImpl* string1, const StringImpl* string2)
+{
+    return codePointCompare(string1->length(), string2->length(), string1->characters16(), string2->characters16());
+}
+
+static inline int codePointCompare8To16(const StringImpl* string1, const StringImpl* string2)
+{
+    return codePointCompare(string1->length(), string2->length(), string1->characters8(), string2->characters16());
+}
+
+static inline int codePointCompare(const StringImpl* string1, const StringImpl* string2)
+{
+    if (!string1)
+        return (string2 && string2->length()) ? -1 : 0;
+
+    if (!string2)
+        return string1->length() ? 1 : 0;
+
+    bool string1Is8Bit = string1->is8Bit();
+    bool string2Is8Bit = string2->is8Bit();
+    if (string1Is8Bit) {
+        if (string2Is8Bit)
+            return codePointCompare8(string1, string2);
+        return codePointCompare8To16(string1, string2);
+    }
+    if (string2Is8Bit)
+        return -codePointCompare8To16(string2, string1);
+    return codePointCompare16(string1, string2);
+}
+
+static inline bool isSpaceOrNewline(UChar c)
+{
+    // Use isASCIISpace() for basic Latin-1.
+    // This will include newlines, which aren't included in Unicode DirWS.
+    return c <= 0x7F ? WTF::isASCIISpace(c) : WTF::Unicode::direction(c) == WTF::Unicode::WhiteSpaceNeutral;
+}
+
+inline PassRefPtr<StringImpl> StringImpl::isolatedCopy() const
+{
+    if (is8Bit())
+        return create(m_data8, m_length);
+    return create(m_data16, m_length);
+}
+
+struct StringHash;
+
+// StringHash is the default hash for StringImpl* and RefPtr<StringImpl>
+template<typename T> struct DefaultHash;
+template<> struct DefaultHash<StringImpl*> {
+    typedef StringHash Hash;
+};
+template<> struct DefaultHash<RefPtr<StringImpl> > {
+    typedef StringHash Hash;
+};
+
+}
+
+using WTF::StringImpl;
+using WTF::equal;
+using WTF::TextCaseSensitivity;
+using WTF::TextCaseSensitive;
+using WTF::TextCaseInsensitive;
+
+#endif
diff --git a/Source/WTF/wtf/text/StringOperators.h b/Source/WTF/wtf/text/StringOperators.h
new file mode 100644
index 0000000..9e1637b
--- /dev/null
+++ b/Source/WTF/wtf/text/StringOperators.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) Research In Motion Limited 2011. 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 StringOperators_h
+#define StringOperators_h
+
+namespace WTF {
+
+template<typename StringType1, typename StringType2>
+class StringAppend {
+public:
+    StringAppend(StringType1 string1, StringType2 string2)
+        : m_string1(string1)
+        , m_string2(string2)
+    {
+    }
+
+    operator String() const
+    {
+        RefPtr<StringImpl> resultImpl = tryMakeString(m_string1, m_string2);
+        if (!resultImpl)
+            CRASH();
+        return resultImpl.release();
+    }
+
+    operator AtomicString() const
+    {
+        return operator String();
+    }
+
+    bool is8Bit()
+    {
+        StringTypeAdapter<StringType1> adapter1(m_string1);
+        StringTypeAdapter<StringType2> adapter2(m_string2);
+        return adapter1.is8Bit() && adapter2.is8Bit();
+    }
+
+    void writeTo(LChar* destination)
+    {
+        ASSERT(is8Bit());
+        StringTypeAdapter<StringType1> adapter1(m_string1);
+        StringTypeAdapter<StringType2> adapter2(m_string2);
+        adapter1.writeTo(destination);
+        adapter2.writeTo(destination + adapter1.length());
+    }
+
+    void writeTo(UChar* destination)
+    {
+        StringTypeAdapter<StringType1> adapter1(m_string1);
+        StringTypeAdapter<StringType2> adapter2(m_string2);
+        adapter1.writeTo(destination);
+        adapter2.writeTo(destination + adapter1.length());
+    }
+
+    unsigned length()
+    {
+        StringTypeAdapter<StringType1> adapter1(m_string1);
+        StringTypeAdapter<StringType2> adapter2(m_string2);
+        return adapter1.length() + adapter2.length();
+    }    
+
+private:
+    StringType1 m_string1;
+    StringType2 m_string2;
+};
+
+template<typename StringType1, typename StringType2>
+class StringTypeAdapter<StringAppend<StringType1, StringType2> > {
+public:
+    StringTypeAdapter<StringAppend<StringType1, StringType2> >(StringAppend<StringType1, StringType2>& buffer)
+        : m_buffer(buffer)
+    {
+    }
+
+    unsigned length() { return m_buffer.length(); }
+
+    bool is8Bit() { return m_buffer.is8Bit(); }
+
+    void writeTo(LChar* destination) { m_buffer.writeTo(destination); }
+    void writeTo(UChar* destination) { m_buffer.writeTo(destination); }
+
+private:
+    StringAppend<StringType1, StringType2>& m_buffer;
+};
+
+inline StringAppend<const char*, String> operator+(const char* string1, const String& string2)
+{
+    return StringAppend<const char*, String>(string1, string2);
+}
+
+inline StringAppend<const char*, AtomicString> operator+(const char* string1, const AtomicString& string2)
+{
+    return StringAppend<const char*, AtomicString>(string1, string2);
+}
+
+template<typename U, typename V>
+StringAppend<const char*, StringAppend<U, V> > operator+(const char* string1, const StringAppend<U, V>& string2)
+{
+    return StringAppend<const char*, StringAppend<U, V> >(string1, string2);
+}
+
+inline StringAppend<const UChar*, String> operator+(const UChar* string1, const String& string2)
+{
+    return StringAppend<const UChar*, String>(string1, string2);
+}
+
+inline StringAppend<const UChar*, AtomicString> operator+(const UChar* string1, const AtomicString& string2)
+{
+    return StringAppend<const UChar*, AtomicString>(string1, string2);
+}
+
+template<typename U, typename V>
+StringAppend<const UChar*, StringAppend<U, V> > operator+(const UChar* string1, const StringAppend<U, V>& string2)
+{
+    return StringAppend<const UChar*, StringAppend<U, V> >(string1, string2);
+}
+
+template<typename T>
+StringAppend<String, T> operator+(const String& string1, T string2)
+{
+    return StringAppend<String, T>(string1, string2);
+}
+
+template<typename U, typename V, typename W>
+StringAppend<StringAppend<U, V>, W> operator+(const StringAppend<U, V>& string1, W string2)
+{
+    return StringAppend<StringAppend<U, V>, W>(string1, string2);
+}
+
+} // namespace WTF
+
+#endif // StringOperators_h
diff --git a/Source/WTF/wtf/text/StringStatics.cpp b/Source/WTF/wtf/text/StringStatics.cpp
new file mode 100644
index 0000000..2e1b955
--- /dev/null
+++ b/Source/WTF/wtf/text/StringStatics.cpp
@@ -0,0 +1,94 @@
+/*
+ * 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. ``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
+ * 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"
+
+#ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC
+#define ATOMICSTRING_HIDE_GLOBALS 1
+#endif
+
+#include "AtomicString.h"
+#include "DynamicAnnotations.h"
+#include "MainThread.h"
+#include "StaticConstructors.h"
+#include "StringImpl.h"
+
+namespace WTF {
+
+StringImpl* StringImpl::empty()
+{
+    // FIXME: This works around a bug in our port of PCRE, that a regular expression
+    // run on the empty string may still perform a read from the first element, and
+    // as such we need this to be a valid pointer. No code should ever be reading
+    // from a zero length string, so this should be able to be a non-null pointer
+    // into the zero-page.
+    // Replace this with 'reinterpret_cast<UChar*>(static_cast<intptr_t>(1))' once
+    // PCRE goes away.
+    static LChar emptyLCharData = 0;
+    DEFINE_STATIC_LOCAL(StringImpl, emptyString, (&emptyLCharData, 0, ConstructStaticString));
+    WTF_ANNOTATE_BENIGN_RACE(&emptyString, "Benign race on StringImpl::emptyString reference counter");
+    return &emptyString;
+}
+
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, nullAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, emptyAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, textAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, commentAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, starAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlnsAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xlinkAtom)
+
+NEVER_INLINE unsigned StringImpl::hashSlowCase() const
+{
+    if (is8Bit())
+        setHash(StringHasher::computeHashAndMaskTop8Bits(m_data8, m_length));
+    else
+        setHash(StringHasher::computeHashAndMaskTop8Bits(m_data16, m_length));
+    return existingHash();
+}
+
+void AtomicString::init()
+{
+    static bool initialized;
+    if (!initialized) {
+        // Initialization is not thread safe, so this function must be called from the main thread first.
+        ASSERT(isMainThread());
+
+        // Use placement new to initialize the globals.
+        new (NotNull, (void*)&nullAtom) AtomicString;
+        new (NotNull, (void*)&emptyAtom) AtomicString("");
+        new (NotNull, (void*)&textAtom) AtomicString("#text", AtomicString::ConstructFromLiteral);
+        new (NotNull, (void*)&commentAtom) AtomicString("#comment", AtomicString::ConstructFromLiteral);
+        new (NotNull, (void*)&starAtom) AtomicString("*", AtomicString::ConstructFromLiteral);
+        new (NotNull, (void*)&xmlAtom) AtomicString("xml", AtomicString::ConstructFromLiteral);
+        new (NotNull, (void*)&xmlnsAtom) AtomicString("xmlns", AtomicString::ConstructFromLiteral);
+        new (NotNull, (void*)&xlinkAtom) AtomicString("xlink", AtomicString::ConstructFromLiteral);
+
+        initialized = true;
+    }
+}
+
+}
diff --git a/Source/WTF/wtf/text/TextPosition.h b/Source/WTF/wtf/text/TextPosition.h
new file mode 100644
index 0000000..be49c15
--- /dev/null
+++ b/Source/WTF/wtf/text/TextPosition.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2010, 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:
+ * 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.
+ */
+
+#ifndef TextPosition_h
+#define TextPosition_h
+
+#include <wtf/Assertions.h>
+
+namespace WTF {
+
+// An abstract number of element in a sequence. The sequence has a first element.
+// This type should be used instead of integer because 2 contradicting traditions can
+// call a first element '0' or '1' which makes integer type ambiguous.
+class OrdinalNumber {
+public:
+    static OrdinalNumber fromZeroBasedInt(int zeroBasedInt) { return OrdinalNumber(zeroBasedInt); }
+    static OrdinalNumber fromOneBasedInt(int oneBasedInt) { return OrdinalNumber(oneBasedInt - 1); }
+    OrdinalNumber() : m_zeroBasedValue(0) { }
+
+    int zeroBasedInt() const { return m_zeroBasedValue; }
+    int oneBasedInt() const { return m_zeroBasedValue + 1; }
+
+    bool operator==(OrdinalNumber other) { return m_zeroBasedValue == other.m_zeroBasedValue; }
+    bool operator!=(OrdinalNumber other) { return !((*this) == other); }
+
+    static OrdinalNumber first() { return OrdinalNumber(0); }
+    static OrdinalNumber beforeFirst() { return OrdinalNumber(-1); }
+
+private:
+    OrdinalNumber(int zeroBasedInt) : m_zeroBasedValue(zeroBasedInt) { }
+    int m_zeroBasedValue;
+};
+
+
+// TextPosition structure specifies coordinates within an text resource. It is used mostly
+// for saving script source position.
+class TextPosition {
+public:
+    TextPosition(OrdinalNumber line, OrdinalNumber column)
+        : m_line(line)
+        , m_column(column)
+    {
+    }
+    TextPosition() { }
+    bool operator==(const TextPosition& other) { return m_line == other.m_line && m_column == other.m_column; }
+    bool operator!=(const TextPosition& other) { return !((*this) == other); }
+
+    // A 'minimum' value of position, used as a default value.
+    static TextPosition minimumPosition() { return TextPosition(OrdinalNumber::first(), OrdinalNumber::first()); }
+
+    // A value with line value less than a minimum; used as an impossible position.
+    static TextPosition belowRangePosition() { return TextPosition(OrdinalNumber::beforeFirst(), OrdinalNumber::beforeFirst()); }
+
+    OrdinalNumber m_line;
+    OrdinalNumber m_column;
+};
+
+}
+
+using WTF::OrdinalNumber;
+
+using WTF::TextPosition;
+
+#endif // TextPosition_h
diff --git a/Source/WTF/wtf/text/WTFString.cpp b/Source/WTF/wtf/text/WTFString.cpp
new file mode 100644
index 0000000..0379164
--- /dev/null
+++ b/Source/WTF/wtf/text/WTFString.cpp
@@ -0,0 +1,1235 @@
+/*
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-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 "WTFString.h"
+
+#include "IntegerToStringConversion.h"
+#include <stdarg.h>
+#include <wtf/ASCIICType.h>
+#include <wtf/DataLog.h>
+#include <wtf/HexNumber.h>
+#include <wtf/MathExtras.h>
+#include <wtf/text/CString.h>
+#include <wtf/StringExtras.h>
+#include <wtf/Vector.h>
+#include <wtf/dtoa.h>
+#include <wtf/unicode/CharacterNames.h>
+#include <wtf/unicode/UTF8.h>
+#include <wtf/unicode/Unicode.h>
+
+using namespace std;
+
+namespace WTF {
+
+using namespace Unicode;
+using namespace std;
+
+// Construct a string with UTF-16 data.
+String::String(const UChar* characters, unsigned length)
+    : m_impl(characters ? StringImpl::create(characters, length) : 0)
+{
+}
+
+// Construct a string with UTF-16 data, from a null-terminated source.
+String::String(const UChar* str)
+{
+    if (!str)
+        return;
+        
+    size_t len = 0;
+    while (str[len] != UChar(0))
+        len++;
+
+    if (len > numeric_limits<unsigned>::max())
+        CRASH();
+    
+    m_impl = StringImpl::create(str, len);
+}
+
+// Construct a string with latin1 data.
+String::String(const LChar* characters, unsigned length)
+    : m_impl(characters ? StringImpl::create(characters, length) : 0)
+{
+}
+
+String::String(const char* characters, unsigned length)
+    : m_impl(characters ? StringImpl::create(reinterpret_cast<const LChar*>(characters), length) : 0)
+{
+}
+
+// Construct a string with latin1 data, from a null-terminated source.
+String::String(const LChar* characters)
+    : m_impl(characters ? StringImpl::create(characters) : 0)
+{
+}
+
+String::String(const char* characters)
+    : m_impl(characters ? StringImpl::create(reinterpret_cast<const LChar*>(characters)) : 0)
+{
+}
+
+String::String(ASCIILiteral characters)
+    : m_impl(StringImpl::createFromLiteral(characters))
+{
+}
+
+void String::append(const String& str)
+{
+    if (str.isEmpty())
+       return;
+
+    // FIXME: This is extremely inefficient. So much so that we might want to take this
+    // out of String's API. We can make it better by optimizing the case where exactly
+    // one String is pointing at this StringImpl, but even then it's going to require a
+    // call to fastMalloc every single time.
+    if (str.m_impl) {
+        if (m_impl) {
+            UChar* data;
+            if (str.length() > numeric_limits<unsigned>::max() - m_impl->length())
+                CRASH();
+            RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(m_impl->length() + str.length(), data);
+            memcpy(data, m_impl->characters(), m_impl->length() * sizeof(UChar));
+            memcpy(data + m_impl->length(), str.characters(), str.length() * sizeof(UChar));
+            m_impl = newImpl.release();
+        } else
+            m_impl = str.m_impl;
+    }
+}
+
+void String::append(LChar c)
+{
+    // FIXME: This is extremely inefficient. So much so that we might want to take this
+    // out of String's API. We can make it better by optimizing the case where exactly
+    // one String is pointing at this StringImpl, but even then it's going to require a
+    // call to fastMalloc every single time.
+    if (m_impl) {
+        UChar* data;
+        if (m_impl->length() >= numeric_limits<unsigned>::max())
+            CRASH();
+        RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(m_impl->length() + 1, data);
+        memcpy(data, m_impl->characters(), m_impl->length() * sizeof(UChar));
+        data[m_impl->length()] = c;
+        m_impl = newImpl.release();
+    } else
+        m_impl = StringImpl::create(&c, 1);
+}
+
+void String::append(UChar c)
+{
+    // FIXME: This is extremely inefficient. So much so that we might want to take this
+    // out of String's API. We can make it better by optimizing the case where exactly
+    // one String is pointing at this StringImpl, but even then it's going to require a
+    // call to fastMalloc every single time.
+    if (m_impl) {
+        UChar* data;
+        if (m_impl->length() >= numeric_limits<unsigned>::max())
+            CRASH();
+        RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(m_impl->length() + 1, data);
+        memcpy(data, m_impl->characters(), m_impl->length() * sizeof(UChar));
+        data[m_impl->length()] = c;
+        m_impl = newImpl.release();
+    } else
+        m_impl = StringImpl::create(&c, 1);
+}
+
+int codePointCompare(const String& a, const String& b)
+{
+    return codePointCompare(a.impl(), b.impl());
+}
+
+void String::insert(const String& str, unsigned pos)
+{
+    if (str.isEmpty()) {
+        if (str.isNull())
+            return;
+        if (isNull())
+            m_impl = str.impl();
+        return;
+    }
+    insert(str.characters(), str.length(), pos);
+}
+
+void String::append(const LChar* charactersToAppend, unsigned lengthToAppend)
+{
+    if (!m_impl) {
+        if (!charactersToAppend)
+            return;
+        m_impl = StringImpl::create(charactersToAppend, lengthToAppend);
+        return;
+    }
+
+    if (!lengthToAppend)
+        return;
+
+    ASSERT(charactersToAppend);
+
+    unsigned strLength = m_impl->length();
+
+    if (m_impl->is8Bit()) {
+        if (lengthToAppend > numeric_limits<unsigned>::max() - strLength)
+            CRASH();
+        LChar* data;
+        RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(strLength + lengthToAppend, data);
+        StringImpl::copyChars(data, m_impl->characters8(), strLength);
+        StringImpl::copyChars(data + strLength, charactersToAppend, lengthToAppend);
+        m_impl = newImpl.release();
+        return;
+    }
+
+    if (lengthToAppend > numeric_limits<unsigned>::max() - strLength)
+        CRASH();
+    UChar* data;
+    RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(length() + lengthToAppend, data);
+    StringImpl::copyChars(data, m_impl->characters16(), strLength);
+    StringImpl::copyChars(data + strLength, charactersToAppend, lengthToAppend);
+    m_impl = newImpl.release();
+}
+
+void String::append(const UChar* charactersToAppend, unsigned lengthToAppend)
+{
+    if (!m_impl) {
+        if (!charactersToAppend)
+            return;
+        m_impl = StringImpl::create(charactersToAppend, lengthToAppend);
+        return;
+    }
+
+    if (!lengthToAppend)
+        return;
+
+    unsigned strLength = m_impl->length();
+    
+    ASSERT(charactersToAppend);
+    if (lengthToAppend > numeric_limits<unsigned>::max() - strLength)
+        CRASH();
+    UChar* data;
+    RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(strLength + lengthToAppend, data);
+    if (m_impl->is8Bit())
+        StringImpl::copyChars(data, characters8(), strLength);
+    else
+        StringImpl::copyChars(data, characters16(), strLength);
+    StringImpl::copyChars(data + strLength, charactersToAppend, lengthToAppend);
+    m_impl = newImpl.release();
+}
+
+
+void String::insert(const UChar* charactersToInsert, unsigned lengthToInsert, unsigned position)
+{
+    if (position >= length()) {
+        append(charactersToInsert, lengthToInsert);
+        return;
+    }
+
+    ASSERT(m_impl);
+
+    if (!lengthToInsert)
+        return;
+
+    ASSERT(charactersToInsert);
+    UChar* data;
+    if (lengthToInsert > numeric_limits<unsigned>::max() - length())
+        CRASH();
+    RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(length() + lengthToInsert, data);
+    memcpy(data, characters(), position * sizeof(UChar));
+    memcpy(data + position, charactersToInsert, lengthToInsert * sizeof(UChar));
+    memcpy(data + position + lengthToInsert, characters() + position, (length() - position) * sizeof(UChar));
+    m_impl = newImpl.release();
+}
+
+UChar32 String::characterStartingAt(unsigned i) const
+{
+    if (!m_impl || i >= m_impl->length())
+        return 0;
+    return m_impl->characterStartingAt(i);
+}
+
+void String::truncate(unsigned position)
+{
+    if (position >= length())
+        return;
+    UChar* data;
+    RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(position, data);
+    memcpy(data, characters(), position * sizeof(UChar));
+    m_impl = newImpl.release();
+}
+
+template <typename CharacterType>
+inline void String::removeInternal(const CharacterType* characters, unsigned position, int lengthToRemove)
+{
+    CharacterType* data;
+    RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(length() - lengthToRemove, data);
+    memcpy(data, characters, position * sizeof(CharacterType));
+    memcpy(data + position, characters + position + lengthToRemove,
+        (length() - lengthToRemove - position) * sizeof(CharacterType));
+
+    m_impl = newImpl.release();
+}
+
+void String::remove(unsigned position, int lengthToRemove)
+{
+    if (lengthToRemove <= 0)
+        return;
+    if (position >= length())
+        return;
+    if (static_cast<unsigned>(lengthToRemove) > length() - position)
+        lengthToRemove = length() - position;
+
+    if (is8Bit()) {
+        removeInternal(characters8(), position, lengthToRemove);
+
+        return;
+    }
+
+    removeInternal(characters16(), position, lengthToRemove);
+}
+
+String String::substring(unsigned pos, unsigned len) const
+{
+    if (!m_impl) 
+        return String();
+    return m_impl->substring(pos, len);
+}
+
+String String::substringSharingImpl(unsigned offset, unsigned length) const
+{
+    // FIXME: We used to check against a limit of Heap::minExtraCost / sizeof(UChar).
+
+    unsigned stringLength = this->length();
+    offset = min(offset, stringLength);
+    length = min(length, stringLength - offset);
+
+    if (!offset && length == stringLength)
+        return *this;
+    return String(StringImpl::create(m_impl, offset, length));
+}
+
+String String::lower() const
+{
+    if (!m_impl)
+        return String();
+    return m_impl->lower();
+}
+
+String String::upper() const
+{
+    if (!m_impl)
+        return String();
+    return m_impl->upper();
+}
+
+String String::stripWhiteSpace() const
+{
+    if (!m_impl)
+        return String();
+    return m_impl->stripWhiteSpace();
+}
+
+String String::stripWhiteSpace(IsWhiteSpaceFunctionPtr isWhiteSpace) const
+{
+    if (!m_impl)
+        return String();
+    return m_impl->stripWhiteSpace(isWhiteSpace);
+}
+
+String String::simplifyWhiteSpace() const
+{
+    if (!m_impl)
+        return String();
+    return m_impl->simplifyWhiteSpace();
+}
+
+String String::simplifyWhiteSpace(IsWhiteSpaceFunctionPtr isWhiteSpace) const
+{
+    if (!m_impl)
+        return String();
+    return m_impl->simplifyWhiteSpace(isWhiteSpace);
+}
+
+String String::removeCharacters(CharacterMatchFunctionPtr findMatch) const
+{
+    if (!m_impl)
+        return String();
+    return m_impl->removeCharacters(findMatch);
+}
+
+String String::foldCase() const
+{
+    if (!m_impl)
+        return String();
+    return m_impl->foldCase();
+}
+
+bool String::percentage(int& result) const
+{
+    if (!m_impl || !m_impl->length())
+        return false;
+
+    if ((*m_impl)[m_impl->length() - 1] != '%')
+       return false;
+
+    result = charactersToIntStrict(m_impl->characters(), m_impl->length() - 1);
+    return true;
+}
+
+const UChar* String::charactersWithNullTermination()
+{
+    if (!m_impl)
+        return 0;
+    if (m_impl->hasTerminatingNullCharacter())
+        return m_impl->characters();
+    m_impl = StringImpl::createWithTerminatingNullCharacter(*m_impl);
+    return m_impl->characters();
+}
+
+String String::format(const char *format, ...)
+{
+#if PLATFORM(QT)
+    // Use QString::vsprintf to avoid the locale dependent formatting of vsnprintf.
+    // https://bugs.webkit.org/show_bug.cgi?id=18994
+    va_list args;
+    va_start(args, format);
+
+    QString buffer;
+    buffer.vsprintf(format, args);
+
+    va_end(args);
+
+    QByteArray ba = buffer.toUtf8();
+    return StringImpl::create(reinterpret_cast<const LChar*>(ba.constData()), ba.length());
+
+#elif OS(WINCE)
+    va_list args;
+    va_start(args, format);
+
+    Vector<char, 256> buffer;
+
+    int bufferSize = 256;
+    buffer.resize(bufferSize);
+    for (;;) {
+        int written = vsnprintf(buffer.data(), bufferSize, format, args);
+        va_end(args);
+
+        if (written == 0)
+            return String("");
+        if (written > 0)
+            return StringImpl::create(reinterpret_cast<const LChar*>(buffer.data()), written);
+        
+        bufferSize <<= 1;
+        buffer.resize(bufferSize);
+        va_start(args, format);
+    }
+
+#else
+    va_list args;
+    va_start(args, format);
+
+    Vector<char, 256> buffer;
+
+    // Do the format once to get the length.
+#if COMPILER(MSVC)
+    int result = _vscprintf(format, args);
+#else
+    char ch;
+    int result = vsnprintf(&ch, 1, format, args);
+    // We need to call va_end() and then va_start() again here, as the
+    // contents of args is undefined after the call to vsnprintf
+    // according to http://man.cx/snprintf(3)
+    //
+    // Not calling va_end/va_start here happens to work on lots of
+    // systems, but fails e.g. on 64bit Linux.
+    va_end(args);
+    va_start(args, format);
+#endif
+
+    if (result == 0)
+        return String("");
+    if (result < 0)
+        return String();
+    unsigned len = result;
+    buffer.grow(len + 1);
+    
+    // Now do the formatting again, guaranteed to fit.
+    vsnprintf(buffer.data(), buffer.size(), format, args);
+
+    va_end(args);
+    
+    return StringImpl::create(reinterpret_cast<const LChar*>(buffer.data()), len);
+#endif
+}
+
+String String::number(int number)
+{
+    return numberToStringSigned<String>(number);
+}
+
+String String::number(unsigned int number)
+{
+    return numberToStringUnsigned<String>(number);
+}
+
+String String::number(long number)
+{
+    return numberToStringSigned<String>(number);
+}
+
+String String::number(unsigned long number)
+{
+    return numberToStringUnsigned<String>(number);
+}
+
+String String::number(long long number)
+{
+    return numberToStringSigned<String>(number);
+}
+
+String String::number(unsigned long long number)
+{
+    return numberToStringUnsigned<String>(number);
+}
+
+String String::number(double number, unsigned precision, TrailingZerosTruncatingPolicy trailingZerosTruncatingPolicy)
+{
+    NumberToStringBuffer buffer;
+    return String(numberToFixedPrecisionString(number, precision, buffer, trailingZerosTruncatingPolicy == TruncateTrailingZeros));
+}
+
+String String::numberToStringECMAScript(double number)
+{
+    NumberToStringBuffer buffer;
+    return String(numberToString(number, buffer));
+}
+
+String String::numberToStringFixedWidth(double number, unsigned decimalPlaces)
+{
+    NumberToStringBuffer buffer;
+    return String(numberToFixedWidthString(number, decimalPlaces, buffer));
+}
+
+int String::toIntStrict(bool* ok, int base) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0;
+    }
+    return m_impl->toIntStrict(ok, base);
+}
+
+unsigned String::toUIntStrict(bool* ok, int base) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0;
+    }
+    return m_impl->toUIntStrict(ok, base);
+}
+
+int64_t String::toInt64Strict(bool* ok, int base) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0;
+    }
+    return m_impl->toInt64Strict(ok, base);
+}
+
+uint64_t String::toUInt64Strict(bool* ok, int base) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0;
+    }
+    return m_impl->toUInt64Strict(ok, base);
+}
+
+intptr_t String::toIntPtrStrict(bool* ok, int base) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0;
+    }
+    return m_impl->toIntPtrStrict(ok, base);
+}
+
+int String::toInt(bool* ok) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0;
+    }
+    return m_impl->toInt(ok);
+}
+
+unsigned String::toUInt(bool* ok) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0;
+    }
+    return m_impl->toUInt(ok);
+}
+
+int64_t String::toInt64(bool* ok) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0;
+    }
+    return m_impl->toInt64(ok);
+}
+
+uint64_t String::toUInt64(bool* ok) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0;
+    }
+    return m_impl->toUInt64(ok);
+}
+
+intptr_t String::toIntPtr(bool* ok) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0;
+    }
+    return m_impl->toIntPtr(ok);
+}
+
+double String::toDouble(bool* ok) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0.0;
+    }
+    return m_impl->toDouble(ok);
+}
+
+float String::toFloat(bool* ok) const
+{
+    if (!m_impl) {
+        if (ok)
+            *ok = false;
+        return 0.0f;
+    }
+    return m_impl->toFloat(ok);
+}
+
+String String::isolatedCopy() const
+{
+    if (!m_impl)
+        return String();
+    return m_impl->isolatedCopy();
+}
+
+void String::split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const
+{
+    result.clear();
+
+    unsigned startPos = 0;
+    size_t endPos;
+    while ((endPos = find(separator, startPos)) != notFound) {
+        if (allowEmptyEntries || startPos != endPos)
+            result.append(substring(startPos, endPos - startPos));
+        startPos = endPos + separator.length();
+    }
+    if (allowEmptyEntries || startPos != length())
+        result.append(substring(startPos));
+}
+
+void String::split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const
+{
+    result.clear();
+
+    unsigned startPos = 0;
+    size_t endPos;
+    while ((endPos = find(separator, startPos)) != notFound) {
+        if (allowEmptyEntries || startPos != endPos)
+            result.append(substring(startPos, endPos - startPos));
+        startPos = endPos + 1;
+    }
+    if (allowEmptyEntries || startPos != length())
+        result.append(substring(startPos));
+}
+
+CString String::ascii() const
+{
+    // Printable ASCII characters 32..127 and the null character are
+    // preserved, characters outside of this range are converted to '?'.
+
+    unsigned length = this->length();
+    if (!length) { 
+        char* characterBuffer;
+        return CString::newUninitialized(length, characterBuffer);
+    }
+
+    if (this->is8Bit()) {
+        const LChar* characters = this->characters8();
+
+        char* characterBuffer;
+        CString result = CString::newUninitialized(length, characterBuffer);
+
+        for (unsigned i = 0; i < length; ++i) {
+            LChar ch = characters[i];
+            characterBuffer[i] = ch && (ch < 0x20 || ch > 0x7f) ? '?' : ch;
+        }
+
+        return result;        
+    }
+
+    const UChar* characters = this->characters16();
+
+    char* characterBuffer;
+    CString result = CString::newUninitialized(length, characterBuffer);
+
+    for (unsigned i = 0; i < length; ++i) {
+        UChar ch = characters[i];
+        characterBuffer[i] = ch && (ch < 0x20 || ch > 0x7f) ? '?' : ch;
+    }
+
+    return result;
+}
+
+CString String::latin1() const
+{
+    // Basic Latin1 (ISO) encoding - Unicode characters 0..255 are
+    // preserved, characters outside of this range are converted to '?'.
+
+    unsigned length = this->length();
+
+    if (!length)
+        return CString("", 0);
+
+    if (is8Bit())
+        return CString(reinterpret_cast<const char*>(this->characters8()), length);
+
+    const UChar* characters = this->characters16();
+
+    char* characterBuffer;
+    CString result = CString::newUninitialized(length, characterBuffer);
+
+    for (unsigned i = 0; i < length; ++i) {
+        UChar ch = characters[i];
+        characterBuffer[i] = ch > 0xff ? '?' : ch;
+    }
+
+    return result;
+}
+
+// Helper to write a three-byte UTF-8 code point to the buffer, caller must check room is available.
+static inline void putUTF8Triple(char*& buffer, UChar ch)
+{
+    ASSERT(ch >= 0x0800);
+    *buffer++ = static_cast<char>(((ch >> 12) & 0x0F) | 0xE0);
+    *buffer++ = static_cast<char>(((ch >> 6) & 0x3F) | 0x80);
+    *buffer++ = static_cast<char>((ch & 0x3F) | 0x80);
+}
+
+CString String::utf8(ConversionMode mode) const
+{
+    unsigned length = this->length();
+
+    if (!length)
+        return CString("", 0);
+
+    // Allocate a buffer big enough to hold all the characters
+    // (an individual UTF-16 UChar can only expand to 3 UTF-8 bytes).
+    // Optimization ideas, if we find this function is hot:
+    //  * We could speculatively create a CStringBuffer to contain 'length' 
+    //    characters, and resize if necessary (i.e. if the buffer contains
+    //    non-ascii characters). (Alternatively, scan the buffer first for
+    //    ascii characters, so we know this will be sufficient).
+    //  * We could allocate a CStringBuffer with an appropriate size to
+    //    have a good chance of being able to write the string into the
+    //    buffer without reallocing (say, 1.5 x length).
+    if (length > numeric_limits<unsigned>::max() / 3)
+        return CString();
+    Vector<char, 1024> bufferVector(length * 3);
+
+    char* buffer = bufferVector.data();
+
+    if (is8Bit()) {
+        const LChar* characters = this->characters8();
+
+        ConversionResult result = convertLatin1ToUTF8(&characters, characters + length, &buffer, buffer + bufferVector.size());
+        ASSERT_UNUSED(result, result != targetExhausted); // (length * 3) should be sufficient for any conversion
+    } else {
+        const UChar* characters = this->characters16();
+
+        if (mode == StrictConversionReplacingUnpairedSurrogatesWithFFFD) {
+            const UChar* charactersEnd = characters + length;
+            char* bufferEnd = buffer + bufferVector.size();
+            while (characters < charactersEnd) {
+                // Use strict conversion to detect unpaired surrogates.
+                ConversionResult result = convertUTF16ToUTF8(&characters, charactersEnd, &buffer, bufferEnd, true);
+                ASSERT(result != targetExhausted);
+                // Conversion fails when there is an unpaired surrogate.
+                // Put replacement character (U+FFFD) instead of the unpaired surrogate.
+                if (result != conversionOK) {
+                    ASSERT((0xD800 <= *characters && *characters <= 0xDFFF));
+                    // There should be room left, since one UChar hasn't been converted.
+                    ASSERT((buffer + 3) <= bufferEnd);
+                    putUTF8Triple(buffer, replacementCharacter);
+                    ++characters;
+                }
+            }
+        } else {
+            bool strict = mode == StrictConversion;
+            ConversionResult result = convertUTF16ToUTF8(&characters, characters + length, &buffer, buffer + bufferVector.size(), strict);
+            ASSERT(result != targetExhausted); // (length * 3) should be sufficient for any conversion
+
+            // Only produced from strict conversion.
+            if (result == sourceIllegal) {
+                ASSERT(strict);
+                return CString();
+            }
+
+            // Check for an unconverted high surrogate.
+            if (result == sourceExhausted) {
+                if (strict)
+                    return CString();
+                // This should be one unpaired high surrogate. Treat it the same
+                // was as an unpaired high surrogate would have been handled in
+                // the middle of a string with non-strict conversion - which is
+                // to say, simply encode it to UTF-8.
+                ASSERT((characters + 1) == (this->characters() + length));
+                ASSERT((*characters >= 0xD800) && (*characters <= 0xDBFF));
+                // There should be room left, since one UChar hasn't been converted.
+                ASSERT((buffer + 3) <= (buffer + bufferVector.size()));
+                putUTF8Triple(buffer, *characters);
+            }
+        }
+    }
+
+    return CString(bufferVector.data(), buffer - bufferVector.data());
+}
+
+String String::make8BitFrom16BitSource(const UChar* source, size_t length)
+{
+    if (!length)
+        return String();
+
+    LChar* destination;
+    String result = String::createUninitialized(length, destination);
+
+    copyLCharsFromUCharSource(destination, source, length);
+
+    return result;
+}
+
+String String::make16BitFrom8BitSource(const LChar* source, size_t length)
+{
+    if (!length)
+        return String();
+    
+    UChar* destination;
+    String result = String::createUninitialized(length, destination);
+    
+    StringImpl::copyChars(destination, source, length);
+    
+    return result;
+}
+
+String String::fromUTF8(const LChar* stringStart, size_t length)
+{
+    if (length > numeric_limits<unsigned>::max())
+        CRASH();
+
+    if (!stringStart)
+        return String();
+
+    // We'll use a StringImpl as a buffer; if the source string only contains ascii this should be
+    // the right length, if there are any multi-byte sequences this buffer will be too large.
+    UChar* buffer;
+    String stringBuffer(StringImpl::createUninitialized(length, buffer));
+    UChar* bufferEnd = buffer + length;
+
+    // Try converting into the buffer.
+    const char* stringCurrent = reinterpret_cast<const char*>(stringStart);
+    if (convertUTF8ToUTF16(&stringCurrent, reinterpret_cast<const char *>(stringStart + length), &buffer, bufferEnd) != conversionOK)
+        return String();
+
+    // stringBuffer is full (the input must have been all ascii) so just return it!
+    if (buffer == bufferEnd)
+        return stringBuffer;
+
+    // stringBuffer served its purpose as a buffer, copy the contents out into a new string.
+    unsigned utf16Length = buffer - stringBuffer.characters();
+    ASSERT(utf16Length < length);
+    return String(stringBuffer.characters(), utf16Length);
+}
+
+String String::fromUTF8(const LChar* string)
+{
+    if (!string)
+        return String();
+    return fromUTF8(string, strlen(reinterpret_cast<const char*>(string)));
+}
+
+String String::fromUTF8WithLatin1Fallback(const LChar* string, size_t size)
+{
+    String utf8 = fromUTF8(string, size);
+    if (!utf8)
+        return String(string, size);
+    return utf8;
+}
+
+// String Operations
+
+static bool isCharacterAllowedInBase(UChar c, int base)
+{
+    if (c > 0x7F)
+        return false;
+    if (isASCIIDigit(c))
+        return c - '0' < base;
+    if (isASCIIAlpha(c)) {
+        if (base > 36)
+            base = 36;
+        return (c >= 'a' && c < 'a' + base - 10)
+            || (c >= 'A' && c < 'A' + base - 10);
+    }
+    return false;
+}
+
+template <typename IntegralType, typename CharType>
+static inline IntegralType toIntegralType(const CharType* data, size_t length, bool* ok, int base)
+{
+    static const IntegralType integralMax = numeric_limits<IntegralType>::max();
+    static const bool isSigned = numeric_limits<IntegralType>::is_signed;
+    const IntegralType maxMultiplier = integralMax / base;
+
+    IntegralType value = 0;
+    bool isOk = false;
+    bool isNegative = false;
+
+    if (!data)
+        goto bye;
+
+    // skip leading whitespace
+    while (length && isSpaceOrNewline(*data)) {
+        length--;
+        data++;
+    }
+
+    if (isSigned && length && *data == '-') {
+        length--;
+        data++;
+        isNegative = true;
+    } else if (length && *data == '+') {
+        length--;
+        data++;
+    }
+
+    if (!length || !isCharacterAllowedInBase(*data, base))
+        goto bye;
+
+    while (length && isCharacterAllowedInBase(*data, base)) {
+        length--;
+        IntegralType digitValue;
+        CharType c = *data;
+        if (isASCIIDigit(c))
+            digitValue = c - '0';
+        else if (c >= 'a')
+            digitValue = c - 'a' + 10;
+        else
+            digitValue = c - 'A' + 10;
+
+        if (value > maxMultiplier || (value == maxMultiplier && digitValue > (integralMax % base) + isNegative))
+            goto bye;
+
+        value = base * value + digitValue;
+        data++;
+    }
+
+#if COMPILER(MSVC)
+#pragma warning(push, 0)
+#pragma warning(disable:4146)
+#endif
+
+    if (isNegative)
+        value = -value;
+
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+
+    // skip trailing space
+    while (length && isSpaceOrNewline(*data)) {
+        length--;
+        data++;
+    }
+
+    if (!length)
+        isOk = true;
+bye:
+    if (ok)
+        *ok = isOk;
+    return isOk ? value : 0;
+}
+
+template <typename CharType>
+static unsigned lengthOfCharactersAsInteger(const CharType* data, size_t length)
+{
+    size_t i = 0;
+
+    // Allow leading spaces.
+    for (; i != length; ++i) {
+        if (!isSpaceOrNewline(data[i]))
+            break;
+    }
+    
+    // Allow sign.
+    if (i != length && (data[i] == '+' || data[i] == '-'))
+        ++i;
+    
+    // Allow digits.
+    for (; i != length; ++i) {
+        if (!isASCIIDigit(data[i]))
+            break;
+    }
+
+    return i;
+}
+
+int charactersToIntStrict(const LChar* data, size_t length, bool* ok, int base)
+{
+    return toIntegralType<int, LChar>(data, length, ok, base);
+}
+
+int charactersToIntStrict(const UChar* data, size_t length, bool* ok, int base)
+{
+    return toIntegralType<int, UChar>(data, length, ok, base);
+}
+
+unsigned charactersToUIntStrict(const LChar* data, size_t length, bool* ok, int base)
+{
+    return toIntegralType<unsigned, LChar>(data, length, ok, base);
+}
+
+unsigned charactersToUIntStrict(const UChar* data, size_t length, bool* ok, int base)
+{
+    return toIntegralType<unsigned, UChar>(data, length, ok, base);
+}
+
+int64_t charactersToInt64Strict(const LChar* data, size_t length, bool* ok, int base)
+{
+    return toIntegralType<int64_t, LChar>(data, length, ok, base);
+}
+
+int64_t charactersToInt64Strict(const UChar* data, size_t length, bool* ok, int base)
+{
+    return toIntegralType<int64_t, UChar>(data, length, ok, base);
+}
+
+uint64_t charactersToUInt64Strict(const LChar* data, size_t length, bool* ok, int base)
+{
+    return toIntegralType<uint64_t, LChar>(data, length, ok, base);
+}
+
+uint64_t charactersToUInt64Strict(const UChar* data, size_t length, bool* ok, int base)
+{
+    return toIntegralType<uint64_t, UChar>(data, length, ok, base);
+}
+
+intptr_t charactersToIntPtrStrict(const LChar* data, size_t length, bool* ok, int base)
+{
+    return toIntegralType<intptr_t, LChar>(data, length, ok, base);
+}
+
+intptr_t charactersToIntPtrStrict(const UChar* data, size_t length, bool* ok, int base)
+{
+    return toIntegralType<intptr_t, UChar>(data, length, ok, base);
+}
+
+int charactersToInt(const LChar* data, size_t length, bool* ok)
+{
+    return toIntegralType<int, LChar>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
+}
+
+int charactersToInt(const UChar* data, size_t length, bool* ok)
+{
+    return toIntegralType<int, UChar>(data, lengthOfCharactersAsInteger(data, length), ok, 10);
+}
+
+unsigned charactersToUInt(const LChar* data, size_t length, bool* ok)
+{
+    return toIntegralType<unsigned, LChar>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
+}
+
+unsigned charactersToUInt(const UChar* data, size_t length, bool* ok)
+{
+    return toIntegralType<unsigned, UChar>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
+}
+
+int64_t charactersToInt64(const LChar* data, size_t length, bool* ok)
+{
+    return toIntegralType<int64_t, LChar>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
+}
+
+int64_t charactersToInt64(const UChar* data, size_t length, bool* ok)
+{
+    return toIntegralType<int64_t, UChar>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
+}
+
+uint64_t charactersToUInt64(const LChar* data, size_t length, bool* ok)
+{
+    return toIntegralType<uint64_t, LChar>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
+}
+
+uint64_t charactersToUInt64(const UChar* data, size_t length, bool* ok)
+{
+    return toIntegralType<uint64_t, UChar>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
+}
+
+intptr_t charactersToIntPtr(const LChar* data, size_t length, bool* ok)
+{
+    return toIntegralType<intptr_t, LChar>(data, lengthOfCharactersAsInteger<LChar>(data, length), ok, 10);
+}
+
+intptr_t charactersToIntPtr(const UChar* data, size_t length, bool* ok)
+{
+    return toIntegralType<intptr_t, UChar>(data, lengthOfCharactersAsInteger<UChar>(data, length), ok, 10);
+}
+
+enum TrailingJunkPolicy { DisallowTrailingJunk, AllowTrailingJunk };
+
+template <typename CharType, TrailingJunkPolicy policy>
+static inline double toDoubleType(const CharType* data, size_t length, bool* ok, size_t& parsedLength)
+{
+    size_t leadingSpacesLength = 0;
+    while (leadingSpacesLength < length && isASCIISpace(data[leadingSpacesLength]))
+        ++leadingSpacesLength;
+
+    double number = parseDouble(data + leadingSpacesLength, length - leadingSpacesLength, parsedLength);
+    if (!parsedLength) {
+        if (ok)
+            *ok = false;
+        return 0.0;
+    }
+
+    parsedLength += leadingSpacesLength;
+    if (ok)
+        *ok = policy == AllowTrailingJunk || parsedLength == length;
+    return number;
+}
+
+double charactersToDouble(const LChar* data, size_t length, bool* ok)
+{
+    size_t parsedLength;
+    return toDoubleType<LChar, DisallowTrailingJunk>(data, length, ok, parsedLength);
+}
+
+double charactersToDouble(const UChar* data, size_t length, bool* ok)
+{
+    size_t parsedLength;
+    return toDoubleType<UChar, DisallowTrailingJunk>(data, length, ok, parsedLength);
+}
+
+float charactersToFloat(const LChar* data, size_t length, bool* ok)
+{
+    // FIXME: This will return ok even when the string fits into a double but not a float.
+    size_t parsedLength;
+    return static_cast<float>(toDoubleType<LChar, DisallowTrailingJunk>(data, length, ok, parsedLength));
+}
+
+float charactersToFloat(const UChar* data, size_t length, bool* ok)
+{
+    // FIXME: This will return ok even when the string fits into a double but not a float.
+    size_t parsedLength;
+    return static_cast<float>(toDoubleType<UChar, DisallowTrailingJunk>(data, length, ok, parsedLength));
+}
+
+float charactersToFloat(const LChar* data, size_t length, size_t& parsedLength)
+{
+    // FIXME: This will return ok even when the string fits into a double but not a float.
+    return static_cast<float>(toDoubleType<LChar, AllowTrailingJunk>(data, length, 0, parsedLength));
+}
+
+float charactersToFloat(const UChar* data, size_t length, size_t& parsedLength)
+{
+    // FIXME: This will return ok even when the string fits into a double but not a float.
+    return static_cast<float>(toDoubleType<UChar, AllowTrailingJunk>(data, length, 0, parsedLength));
+}
+
+const String& emptyString()
+{
+    DEFINE_STATIC_LOCAL(String, emptyString, (StringImpl::empty()));
+    return emptyString;
+}
+
+} // namespace WTF
+
+#ifndef NDEBUG
+// For use in the debugger
+String* string(const char*);
+Vector<char> asciiDebug(StringImpl* impl);
+Vector<char> asciiDebug(String& string);
+
+void String::show() const
+{
+    dataLog("%s\n", asciiDebug(impl()).data());
+}
+
+String* string(const char* s)
+{
+    // leaks memory!
+    return new String(s);
+}
+
+Vector<char> asciiDebug(StringImpl* impl)
+{
+    if (!impl)
+        return asciiDebug(String("[null]").impl());
+
+    Vector<char> buffer;
+    for (unsigned i = 0; i < impl->length(); ++i) {
+        UChar ch = (*impl)[i];
+        if (isASCIIPrintable(ch)) {
+            if (ch == '\\')
+                buffer.append(ch);
+            buffer.append(ch);
+        } else {
+            buffer.append('\\');
+            buffer.append('u');
+            appendUnsignedAsHexFixedSize(ch, buffer, 4);
+        }
+    }
+    buffer.append('\0');
+    return buffer;
+}
+
+Vector<char> asciiDebug(String& string)
+{
+    return asciiDebug(string.impl());
+}
+
+#endif
diff --git a/Source/WTF/wtf/text/WTFString.h b/Source/WTF/wtf/text/WTFString.h
new file mode 100644
index 0000000..1a0b481
--- /dev/null
+++ b/Source/WTF/wtf/text/WTFString.h
@@ -0,0 +1,701 @@
+/*
+ * (C) 1999 Lars Knoll (knoll@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 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 WTFString_h
+#define WTFString_h
+
+// This file would be called String.h, but that conflicts with <string.h>
+// on systems without case-sensitive file systems.
+
+#include <wtf/text/ASCIIFastPath.h>
+#include <wtf/text/StringImpl.h>
+
+#ifdef __OBJC__
+#include <objc/objc.h>
+#endif
+
+#if PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QString;
+QT_END_NAMESPACE
+#endif
+
+#if PLATFORM(WX)
+class wxString;
+#endif
+
+#if PLATFORM(BLACKBERRY)
+namespace BlackBerry {
+namespace Platform {
+class String;
+}
+}
+#endif
+
+namespace WTF {
+
+class CString;
+class MemoryObjectInfo;
+struct StringHash;
+
+// Declarations of string operations
+
+int charactersToIntStrict(const LChar*, size_t, bool* ok = 0, int base = 10);
+WTF_EXPORT_STRING_API int charactersToIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10);
+unsigned charactersToUIntStrict(const LChar*, size_t, bool* ok = 0, int base = 10);
+WTF_EXPORT_STRING_API unsigned charactersToUIntStrict(const UChar*, size_t, bool* ok = 0, int base = 10);
+int64_t charactersToInt64Strict(const LChar*, size_t, bool* ok = 0, int base = 10);
+int64_t charactersToInt64Strict(const UChar*, size_t, bool* ok = 0, int base = 10);
+uint64_t charactersToUInt64Strict(const LChar*, size_t, bool* ok = 0, int base = 10);
+uint64_t charactersToUInt64Strict(const UChar*, size_t, bool* ok = 0, int base = 10);
+intptr_t charactersToIntPtrStrict(const LChar*, size_t, bool* ok = 0, int base = 10);
+intptr_t charactersToIntPtrStrict(const UChar*, size_t, bool* ok = 0, int base = 10);
+
+int charactersToInt(const LChar*, size_t, bool* ok = 0); // ignores trailing garbage
+WTF_EXPORT_STRING_API int charactersToInt(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+unsigned charactersToUInt(const LChar*, size_t, bool* ok = 0); // ignores trailing garbage
+unsigned charactersToUInt(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+int64_t charactersToInt64(const LChar*, size_t, bool* ok = 0); // ignores trailing garbage
+int64_t charactersToInt64(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+uint64_t charactersToUInt64(const LChar*, size_t, bool* ok = 0); // ignores trailing garbage
+uint64_t charactersToUInt64(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+intptr_t charactersToIntPtr(const LChar*, size_t, bool* ok = 0); // ignores trailing garbage
+intptr_t charactersToIntPtr(const UChar*, size_t, bool* ok = 0); // ignores trailing garbage
+
+// FIXME: Like the strict functions above, these give false for "ok" when there is trailing garbage.
+// Like the non-strict functions above, these return the value when there is trailing garbage.
+// It would be better if these were more consistent with the above functions instead.
+WTF_EXPORT_STRING_API double charactersToDouble(const LChar*, size_t, bool* ok = 0);
+WTF_EXPORT_STRING_API double charactersToDouble(const UChar*, size_t, bool* ok = 0);
+float charactersToFloat(const LChar*, size_t, bool* ok = 0);
+WTF_EXPORT_STRING_API float charactersToFloat(const UChar*, size_t, bool* ok = 0);
+WTF_EXPORT_STRING_API float charactersToFloat(const LChar*, size_t, size_t& parsedLength);
+WTF_EXPORT_STRING_API float charactersToFloat(const UChar*, size_t, size_t& parsedLength);
+
+class ASCIILiteral;
+
+enum TrailingZerosTruncatingPolicy {
+    KeepTrailingZeros,
+    TruncateTrailingZeros
+};
+
+template<bool isSpecialCharacter(UChar), typename CharacterType>
+bool isAllSpecialCharacters(const CharacterType*, size_t);
+
+class String {
+public:
+    // Construct a null string, distinguishable from an empty string.
+    String() { }
+
+    // Construct a string with UTF-16 data.
+    WTF_EXPORT_STRING_API String(const UChar* characters, unsigned length);
+
+    // Construct a string by copying the contents of a vector.  To avoid
+    // copying, consider using String::adopt instead.
+    template<size_t inlineCapacity>
+    explicit String(const Vector<UChar, inlineCapacity>&);
+
+    // Construct a string with UTF-16 data, from a null-terminated source.
+    WTF_EXPORT_STRING_API String(const UChar*);
+
+    // Construct a string with latin1 data.
+    WTF_EXPORT_STRING_API String(const LChar* characters, unsigned length);
+    WTF_EXPORT_STRING_API String(const char* characters, unsigned length);
+
+    // Construct a string with latin1 data, from a null-terminated source.
+    WTF_EXPORT_STRING_API String(const LChar* characters);
+    WTF_EXPORT_STRING_API String(const char* characters);
+
+    // Construct a string referencing an existing StringImpl.
+    String(StringImpl* impl) : m_impl(impl) { }
+    String(PassRefPtr<StringImpl> impl) : m_impl(impl) { }
+    String(RefPtr<StringImpl> impl) : m_impl(impl) { }
+
+    // Construct a string from a constant string literal.
+    WTF_EXPORT_STRING_API String(ASCIILiteral characters);
+
+    // Construct a string from a constant string literal.
+    // This constructor is the "big" version, as it put the length in the function call and generate bigger code.
+    enum ConstructFromLiteralTag { ConstructFromLiteral };
+    template<unsigned charactersCount>
+    String(const char (&characters)[charactersCount], ConstructFromLiteralTag) : m_impl(StringImpl::createFromLiteral<charactersCount>(characters)) { }
+
+#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES)
+    // We have to declare the copy constructor and copy assignment operator as well, otherwise
+    // they'll be implicitly deleted by adding the move constructor and move assignment operator.
+    String(const String& other) : m_impl(other.m_impl) { }
+    String(String&& other) : m_impl(other.m_impl.release()) { }
+    String& operator=(const String& other) { m_impl = other.m_impl; return *this; }
+    String& operator=(String&& other) { m_impl = other.m_impl.release(); return *this; }
+#endif
+
+    // Inline the destructor.
+    ALWAYS_INLINE ~String() { }
+
+    void swap(String& o) { m_impl.swap(o.m_impl); }
+
+    static String adopt(StringBuffer<LChar>& buffer) { return StringImpl::adopt(buffer); }
+    static String adopt(StringBuffer<UChar>& buffer) { return StringImpl::adopt(buffer); }
+    template<typename CharacterType, size_t inlineCapacity>
+    static String adopt(Vector<CharacterType, inlineCapacity>& vector) { return StringImpl::adopt(vector); }
+
+    bool isNull() const { return !m_impl; }
+    bool isEmpty() const { return !m_impl || !m_impl->length(); }
+
+    StringImpl* impl() const { return m_impl.get(); }
+
+    unsigned length() const
+    {
+        if (!m_impl)
+            return 0;
+        return m_impl->length();
+    }
+
+    const UChar* characters() const
+    {
+        if (!m_impl)
+            return 0;
+        return m_impl->characters();
+    }
+    
+    const LChar* characters8() const
+    {
+        if (!m_impl)
+            return 0;
+        ASSERT(m_impl->is8Bit());
+        return m_impl->characters8();
+    }
+
+    const UChar* characters16() const
+    {
+        if (!m_impl)
+            return 0;
+        ASSERT(!m_impl->is8Bit());
+        return m_impl->characters16();
+    }
+
+    // Return characters8() or characters16() depending on CharacterType.
+    template <typename CharacterType>
+    inline const CharacterType* getCharacters() const;
+
+    // Like getCharacters() and upconvert if CharacterType is UChar on a 8bit string.
+    template <typename CharacterType>
+    inline const CharacterType* getCharactersWithUpconvert() const;
+
+    bool is8Bit() const { return m_impl->is8Bit(); }
+
+    unsigned sizeInBytes() const
+    {
+        if (!m_impl)
+            return 0;
+        return m_impl->length() * (is8Bit() ? sizeof(LChar) : sizeof(UChar));
+    }
+
+    WTF_EXPORT_STRING_API CString ascii() const;
+    WTF_EXPORT_STRING_API CString latin1() const;
+
+    typedef enum {
+        LenientConversion,
+        StrictConversion,
+        StrictConversionReplacingUnpairedSurrogatesWithFFFD,
+    } ConversionMode;
+
+    WTF_EXPORT_STRING_API CString utf8(ConversionMode = LenientConversion) const;
+
+    UChar operator[](unsigned index) const
+    {
+        if (!m_impl || index >= m_impl->length())
+            return 0;
+        return (*m_impl)[index];
+    }
+
+    WTF_EXPORT_STRING_API static String number(int);
+    WTF_EXPORT_STRING_API static String number(unsigned int);
+    WTF_EXPORT_STRING_API static String number(long);
+    WTF_EXPORT_STRING_API static String number(unsigned long);
+    WTF_EXPORT_STRING_API static String number(long long);
+    WTF_EXPORT_STRING_API static String number(unsigned long long);
+
+    WTF_EXPORT_STRING_API static String number(double, unsigned precision = 6, TrailingZerosTruncatingPolicy = TruncateTrailingZeros);
+
+    // Number to String conversion following the ECMAScript definition.
+    WTF_EXPORT_STRING_API static String numberToStringECMAScript(double);
+    WTF_EXPORT_STRING_API static String numberToStringFixedWidth(double, unsigned decimalPlaces);
+
+    // Find a single character or string, also with match function & latin1 forms.
+    size_t find(UChar c, unsigned start = 0) const
+        { return m_impl ? m_impl->find(c, start) : notFound; }
+
+    size_t find(const String& str) const
+        { return m_impl ? m_impl->find(str.impl()) : notFound; }
+    size_t find(const String& str, unsigned start) const
+        { return m_impl ? m_impl->find(str.impl(), start) : notFound; }
+
+    size_t find(CharacterMatchFunctionPtr matchFunction, unsigned start = 0) const
+        { return m_impl ? m_impl->find(matchFunction, start) : notFound; }
+    size_t find(const LChar* str, unsigned start = 0) const
+        { return m_impl ? m_impl->find(str, start) : notFound; }
+
+    // Find the last instance of a single character or string.
+    size_t reverseFind(UChar c, unsigned start = UINT_MAX) const
+        { return m_impl ? m_impl->reverseFind(c, start) : notFound; }
+    size_t reverseFind(const String& str, unsigned start = UINT_MAX) const
+        { return m_impl ? m_impl->reverseFind(str.impl(), start) : notFound; }
+
+    // Case insensitive string matching.
+    size_t findIgnoringCase(const LChar* str, unsigned start = 0) const
+        { return m_impl ? m_impl->findIgnoringCase(str, start) : notFound; }
+    size_t findIgnoringCase(const String& str, unsigned start = 0) const
+        { return m_impl ? m_impl->findIgnoringCase(str.impl(), start) : notFound; }
+    size_t reverseFindIgnoringCase(const String& str, unsigned start = UINT_MAX) const
+        { return m_impl ? m_impl->reverseFindIgnoringCase(str.impl(), start) : notFound; }
+
+    // Wrappers for find & reverseFind adding dynamic sensitivity check.
+    size_t find(const LChar* str, unsigned start, bool caseSensitive) const
+        { return caseSensitive ? find(str, start) : findIgnoringCase(str, start); }
+    size_t find(const String& str, unsigned start, bool caseSensitive) const
+        { return caseSensitive ? find(str, start) : findIgnoringCase(str, start); }
+    size_t reverseFind(const String& str, unsigned start, bool caseSensitive) const
+        { return caseSensitive ? reverseFind(str, start) : reverseFindIgnoringCase(str, start); }
+
+    WTF_EXPORT_STRING_API const UChar* charactersWithNullTermination();
+    
+    WTF_EXPORT_STRING_API UChar32 characterStartingAt(unsigned) const; // Ditto.
+    
+    bool contains(UChar c) const { return find(c) != notFound; }
+    bool contains(const LChar* str, bool caseSensitive = true) const { return find(str, 0, caseSensitive) != notFound; }
+    bool contains(const String& str, bool caseSensitive = true) const { return find(str, 0, caseSensitive) != notFound; }
+
+    bool startsWith(const String& s, bool caseSensitive = true) const
+        { return m_impl ? m_impl->startsWith(s.impl(), caseSensitive) : s.isEmpty(); }
+    bool startsWith(UChar character) const
+        { return m_impl ? m_impl->startsWith(character) : false; }
+    template<unsigned matchLength>
+    bool startsWith(const char (&prefix)[matchLength], bool caseSensitive = true) const
+        { return m_impl ? m_impl->startsWith<matchLength>(prefix, caseSensitive) : !matchLength; }
+
+    bool endsWith(const String& s, bool caseSensitive = true) const
+        { return m_impl ? m_impl->endsWith(s.impl(), caseSensitive) : s.isEmpty(); }
+    bool endsWith(UChar character) const
+        { return m_impl ? m_impl->endsWith(character) : false; }
+    template<unsigned matchLength>
+    bool endsWith(const char (&prefix)[matchLength], bool caseSensitive = true) const
+        { return m_impl ? m_impl->endsWith<matchLength>(prefix, caseSensitive) : !matchLength; }
+
+    WTF_EXPORT_STRING_API void append(const String&);
+    WTF_EXPORT_STRING_API void append(LChar);
+    void append(char c) { append(static_cast<LChar>(c)); };
+    WTF_EXPORT_STRING_API void append(UChar);
+    WTF_EXPORT_STRING_API void append(const LChar*, unsigned length);
+    WTF_EXPORT_STRING_API void append(const UChar*, unsigned length);
+    WTF_EXPORT_STRING_API void insert(const String&, unsigned pos);
+    void insert(const UChar*, unsigned length, unsigned pos);
+
+    String& replace(UChar a, UChar b) { if (m_impl) m_impl = m_impl->replace(a, b); return *this; }
+    String& replace(UChar a, const String& b) { if (m_impl) m_impl = m_impl->replace(a, b.impl()); return *this; }
+    String& replace(const String& a, const String& b) { if (m_impl) m_impl = m_impl->replace(a.impl(), b.impl()); return *this; }
+    String& replace(unsigned index, unsigned len, const String& b) { if (m_impl) m_impl = m_impl->replace(index, len, b.impl()); return *this; }
+
+    template<unsigned charactersCount>
+    ALWAYS_INLINE String& replaceWithLiteral(UChar a, const char (&characters)[charactersCount])
+    {
+        if (m_impl)
+            m_impl = m_impl->replace(a, characters, charactersCount - 1);
+
+        return *this;
+    }
+
+    void makeLower() { if (m_impl) m_impl = m_impl->lower(); }
+    void makeUpper() { if (m_impl) m_impl = m_impl->upper(); }
+    void fill(UChar c) { if (m_impl) m_impl = m_impl->fill(c); }
+
+    WTF_EXPORT_STRING_API void truncate(unsigned len);
+    WTF_EXPORT_STRING_API void remove(unsigned pos, int len = 1);
+
+    WTF_EXPORT_STRING_API String substring(unsigned pos, unsigned len = UINT_MAX) const;
+    WTF_EXPORT_STRING_API String substringSharingImpl(unsigned pos, unsigned len = UINT_MAX) const;
+    String left(unsigned len) const { return substring(0, len); }
+    String right(unsigned len) const { return substring(length() - len, len); }
+
+    // Returns a lowercase/uppercase version of the string
+    WTF_EXPORT_STRING_API String lower() const;
+    WTF_EXPORT_STRING_API String upper() const;
+
+    WTF_EXPORT_STRING_API String stripWhiteSpace() const;
+    WTF_EXPORT_STRING_API String stripWhiteSpace(IsWhiteSpaceFunctionPtr) const;
+    WTF_EXPORT_STRING_API String simplifyWhiteSpace() const;
+    WTF_EXPORT_STRING_API String simplifyWhiteSpace(IsWhiteSpaceFunctionPtr) const;
+
+    WTF_EXPORT_STRING_API String removeCharacters(CharacterMatchFunctionPtr) const;
+    template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters() const;
+
+    // Return the string with case folded for case insensitive comparison.
+    WTF_EXPORT_STRING_API String foldCase() const;
+
+#if !PLATFORM(QT)
+    WTF_EXPORT_STRING_API static String format(const char *, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
+#else
+    WTF_EXPORT_STRING_API static String format(const char *, ...);
+#endif
+
+    // Returns an uninitialized string. The characters needs to be written
+    // into the buffer returned in data before the returned string is used.
+    // Failure to do this will have unpredictable results.
+    static String createUninitialized(unsigned length, UChar*& data) { return StringImpl::createUninitialized(length, data); }
+    static String createUninitialized(unsigned length, LChar*& data) { return StringImpl::createUninitialized(length, data); }
+
+    WTF_EXPORT_STRING_API void split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const;
+    void split(const String& separator, Vector<String>& result) const
+    {
+        split(separator, false, result);
+    }
+    WTF_EXPORT_STRING_API void split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const;
+    void split(UChar separator, Vector<String>& result) const
+    {
+        split(separator, false, result);
+    }
+
+    WTF_EXPORT_STRING_API int toIntStrict(bool* ok = 0, int base = 10) const;
+    WTF_EXPORT_STRING_API unsigned toUIntStrict(bool* ok = 0, int base = 10) const;
+    WTF_EXPORT_STRING_API int64_t toInt64Strict(bool* ok = 0, int base = 10) const;
+    uint64_t toUInt64Strict(bool* ok = 0, int base = 10) const;
+    intptr_t toIntPtrStrict(bool* ok = 0, int base = 10) const;
+
+    WTF_EXPORT_STRING_API int toInt(bool* ok = 0) const;
+    WTF_EXPORT_STRING_API unsigned toUInt(bool* ok = 0) const;
+    int64_t toInt64(bool* ok = 0) const;
+    WTF_EXPORT_STRING_API uint64_t toUInt64(bool* ok = 0) const;
+    WTF_EXPORT_STRING_API intptr_t toIntPtr(bool* ok = 0) const;
+
+    // FIXME: Like the strict functions above, these give false for "ok" when there is trailing garbage.
+    // Like the non-strict functions above, these return the value when there is trailing garbage.
+    // It would be better if these were more consistent with the above functions instead.
+    WTF_EXPORT_STRING_API double toDouble(bool* ok = 0) const;
+    WTF_EXPORT_STRING_API float toFloat(bool* ok = 0) const;
+
+    bool percentage(int& percentage) const;
+
+    WTF_EXPORT_STRING_API String isolatedCopy() const;
+
+    // Prevent Strings from being implicitly convertable to bool as it will be ambiguous on any platform that
+    // allows implicit conversion to another pointer type (e.g., Mac allows implicit conversion to NSString*).
+    typedef struct ImplicitConversionFromWTFStringToBoolDisallowedA* (String::*UnspecifiedBoolTypeA);
+    typedef struct ImplicitConversionFromWTFStringToBoolDisallowedB* (String::*UnspecifiedBoolTypeB);
+    operator UnspecifiedBoolTypeA() const;
+    operator UnspecifiedBoolTypeB() const;
+
+#if USE(CF)
+    String(CFStringRef);
+    RetainPtr<CFStringRef> createCFString() const;
+#endif
+
+#ifdef __OBJC__
+    String(NSString*);
+    
+    // This conversion maps NULL to "", which loses the meaning of NULL, but we 
+    // need this mapping because AppKit crashes when passed nil NSStrings.
+    operator NSString*() const { if (!m_impl) return @""; return *m_impl; }
+#endif
+
+#if PLATFORM(QT)
+    String(const QString&);
+    String(const QStringRef&);
+    operator QString() const;
+#endif
+
+#if PLATFORM(WX)
+    WTF_EXPORT_PRIVATE String(const wxString&);
+    WTF_EXPORT_PRIVATE operator wxString() const;
+#endif
+
+#if PLATFORM(BLACKBERRY)
+    String(const BlackBerry::Platform::String&);
+    operator BlackBerry::Platform::String() const;
+#endif
+
+    WTF_EXPORT_STRING_API static String make8BitFrom16BitSource(const UChar*, size_t);
+    WTF_EXPORT_STRING_API static String make16BitFrom8BitSource(const LChar*, size_t);
+
+    // String::fromUTF8 will return a null string if
+    // the input data contains invalid UTF-8 sequences.
+    WTF_EXPORT_STRING_API static String fromUTF8(const LChar*, size_t);
+    WTF_EXPORT_STRING_API static String fromUTF8(const LChar*);
+    static String fromUTF8(const char* s, size_t length) { return fromUTF8(reinterpret_cast<const LChar*>(s), length); };
+    static String fromUTF8(const char* s) { return fromUTF8(reinterpret_cast<const LChar*>(s)); };
+
+    // Tries to convert the passed in string to UTF-8, but will fall back to Latin-1 if the string is not valid UTF-8.
+    WTF_EXPORT_STRING_API static String fromUTF8WithLatin1Fallback(const LChar*, size_t);
+    static String fromUTF8WithLatin1Fallback(const char* s, size_t length) { return fromUTF8WithLatin1Fallback(reinterpret_cast<const LChar*>(s), length); };
+    
+    // Determines the writing direction using the Unicode Bidi Algorithm rules P2 and P3.
+    WTF::Unicode::Direction defaultWritingDirection(bool* hasStrongDirectionality = 0) const
+    {
+        if (m_impl)
+            return m_impl->defaultWritingDirection(hasStrongDirectionality);
+        if (hasStrongDirectionality)
+            *hasStrongDirectionality = false;
+        return WTF::Unicode::LeftToRight;
+    }
+
+    bool containsOnlyASCII() const;
+    bool containsOnlyLatin1() const;
+    bool containsOnlyWhitespace() const { return !m_impl || m_impl->containsOnlyWhitespace(); }
+
+    // Hash table deleted values, which are only constructed and never copied or destroyed.
+    String(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue) { }
+    bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue(); }
+
+#ifndef NDEBUG
+    WTF_EXPORT_STRING_API void show() const;
+#endif
+
+    // Workaround for a compiler bug. Use operator[] instead.
+    UChar characterAt(unsigned index) const
+    {
+        if (!m_impl || index >= m_impl->length())
+            return 0;
+        return (*m_impl)[index];
+    }
+
+private:
+    template <typename CharacterType>
+    void removeInternal(const CharacterType*, unsigned, int);
+
+    RefPtr<StringImpl> m_impl;
+};
+
+inline bool operator==(const String& a, const String& b) { return equal(a.impl(), b.impl()); }
+inline bool operator==(const String& a, const LChar* b) { return equal(a.impl(), b); }
+inline bool operator==(const String& a, const char* b) { return equal(a.impl(), reinterpret_cast<const LChar*>(b)); }
+inline bool operator==(const LChar* a, const String& b) { return equal(a, b.impl()); }
+inline bool operator==(const char* a, const String& b) { return equal(reinterpret_cast<const LChar*>(a), b.impl()); }
+template<size_t inlineCapacity>
+inline bool operator==(const Vector<char, inlineCapacity>& a, const String& b) { return equal(b.impl(), a.data(), a.size()); }
+template<size_t inlineCapacity>
+inline bool operator==(const String& a, const Vector<char, inlineCapacity>& b) { return b == a; }
+
+
+inline bool operator!=(const String& a, const String& b) { return !equal(a.impl(), b.impl()); }
+inline bool operator!=(const String& a, const LChar* b) { return !equal(a.impl(), b); }
+inline bool operator!=(const String& a, const char* b) { return !equal(a.impl(), reinterpret_cast<const LChar*>(b)); }
+inline bool operator!=(const LChar* a, const String& b) { return !equal(a, b.impl()); }
+inline bool operator!=(const char* a, const String& b) { return !equal(reinterpret_cast<const LChar*>(a), b.impl()); }
+template<size_t inlineCapacity>
+inline bool operator!=(const Vector<char, inlineCapacity>& a, const String& b) { return !(a == b); }
+template<size_t inlineCapacity>
+inline bool operator!=(const String& a, const Vector<char, inlineCapacity>& b) { return b != a; }
+
+inline bool equalIgnoringCase(const String& a, const String& b) { return equalIgnoringCase(a.impl(), b.impl()); }
+inline bool equalIgnoringCase(const String& a, const LChar* b) { return equalIgnoringCase(a.impl(), b); }
+inline bool equalIgnoringCase(const String& a, const char* b) { return equalIgnoringCase(a.impl(), reinterpret_cast<const LChar*>(b)); }
+inline bool equalIgnoringCase(const LChar* a, const String& b) { return equalIgnoringCase(a, b.impl()); }
+inline bool equalIgnoringCase(const char* a, const String& b) { return equalIgnoringCase(reinterpret_cast<const LChar*>(a), b.impl()); }
+
+inline bool equalPossiblyIgnoringCase(const String& a, const String& b, bool ignoreCase) 
+{
+    return ignoreCase ? equalIgnoringCase(a, b) : (a == b);
+}
+
+inline bool equalIgnoringNullity(const String& a, const String& b) { return equalIgnoringNullity(a.impl(), b.impl()); }
+
+template<size_t inlineCapacity>
+inline bool equalIgnoringNullity(const Vector<UChar, inlineCapacity>& a, const String& b) { return equalIgnoringNullity(a, b.impl()); }
+
+inline bool operator!(const String& str) { return str.isNull(); }
+
+inline void swap(String& a, String& b) { a.swap(b); }
+
+// Definitions of string operations
+
+template<size_t inlineCapacity>
+String::String(const Vector<UChar, inlineCapacity>& vector)
+    : m_impl(vector.size() ? StringImpl::create(vector.data(), vector.size()) : 0)
+{
+}
+
+template<>
+inline const LChar* String::getCharacters<LChar>() const
+{
+    ASSERT(is8Bit());
+    return characters8();
+}
+
+template<>
+inline const UChar* String::getCharacters<UChar>() const
+{
+    ASSERT(!is8Bit());
+    return characters16();
+}
+
+template<>
+inline const LChar* String::getCharactersWithUpconvert<LChar>() const
+{
+    ASSERT(is8Bit());
+    return characters8();
+}
+
+template<>
+inline const UChar* String::getCharactersWithUpconvert<UChar>() const
+{
+    return characters();
+}
+
+inline bool String::containsOnlyLatin1() const
+{
+    if (isEmpty())
+        return true;
+
+    if (is8Bit())
+        return true;
+
+    const UChar* characters = characters16();
+    UChar ored = 0;
+    for (size_t i = 0; i < m_impl->length(); ++i)
+        ored |= characters[i];
+    return !(ored & 0xFF00);
+}
+
+
+#ifdef __OBJC__
+// This is for situations in WebKit where the long standing behavior has been
+// "nil if empty", so we try to maintain longstanding behavior for the sake of
+// entrenched clients
+inline NSString* nsStringNilIfEmpty(const String& str) {  return str.isEmpty() ? nil : (NSString*)str; }
+#endif
+
+inline bool String::containsOnlyASCII() const
+{
+    if (isEmpty())
+        return true;
+
+    if (is8Bit())
+        return charactersAreAllASCII(characters8(), m_impl->length());
+
+    return charactersAreAllASCII(characters16(), m_impl->length());
+}
+
+WTF_EXPORT_STRING_API int codePointCompare(const String&, const String&);
+
+inline bool codePointCompareLessThan(const String& a, const String& b)
+{
+    return codePointCompare(a.impl(), b.impl()) < 0;
+}
+
+inline void append(Vector<UChar>& vector, const String& string)
+{
+    vector.append(string.characters(), string.length());
+}
+
+template<typename CharacterType>
+inline void appendNumber(Vector<CharacterType>& vector, unsigned char number)
+{
+    int numberLength = number > 99 ? 3 : (number > 9 ? 2 : 1);
+    size_t vectorSize = vector.size();
+    vector.grow(vectorSize + numberLength);
+
+    switch (numberLength) {
+    case 3:
+        vector[vectorSize + 2] = number % 10 + '0';
+        number /= 10;
+
+    case 2:
+        vector[vectorSize + 1] = number % 10 + '0';
+        number /= 10;
+
+    case 1:
+        vector[vectorSize] = number % 10 + '0';
+    }
+}
+
+template<bool isSpecialCharacter(UChar), typename CharacterType>
+inline bool isAllSpecialCharacters(const CharacterType* 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
+{
+    size_t len = length();
+
+    if (!len)
+        return true;
+
+    if (is8Bit())
+        return WTF::isAllSpecialCharacters<isSpecialCharacter, LChar>(characters8(), len);
+    return WTF::isAllSpecialCharacters<isSpecialCharacter, UChar>(characters(), len);
+}
+
+// StringHash is the default hash for String
+template<typename T> struct DefaultHash;
+template<> struct DefaultHash<String> {
+    typedef StringHash Hash;
+};
+
+template <> struct VectorTraits<String> : SimpleClassVectorTraits { };
+
+class ASCIILiteral {
+public:
+    explicit ASCIILiteral(const char* characters) : m_characters(characters) { }
+    operator const char*() { return m_characters; }
+
+private:
+    const char* m_characters;
+};
+
+// Shared global empty string.
+WTF_EXPORT_STRING_API const String& emptyString();
+
+}
+
+using WTF::CString;
+using WTF::KeepTrailingZeros;
+using WTF::String;
+using WTF::emptyString;
+using WTF::append;
+using WTF::appendNumber;
+using WTF::charactersAreAllASCII;
+using WTF::charactersToIntStrict;
+using WTF::charactersToUIntStrict;
+using WTF::charactersToInt64Strict;
+using WTF::charactersToUInt64Strict;
+using WTF::charactersToIntPtrStrict;
+using WTF::charactersToInt;
+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;
+using WTF::ASCIILiteral;
+
+#include <wtf/text/AtomicString.h>
+#endif
diff --git a/Source/WTF/wtf/threads/BinarySemaphore.cpp b/Source/WTF/wtf/threads/BinarySemaphore.cpp
new file mode 100644
index 0000000..5f60aaf
--- /dev/null
+++ b/Source/WTF/wtf/threads/BinarySemaphore.cpp
@@ -0,0 +1,68 @@
+/*
+ * 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 "config.h"
+#include "BinarySemaphore.h"
+
+#if !PLATFORM(WIN)
+
+namespace WTF {
+
+BinarySemaphore::BinarySemaphore()
+    : m_isSet(false)
+{
+}
+    
+BinarySemaphore::~BinarySemaphore()
+{
+}
+
+void BinarySemaphore::signal()
+{
+    MutexLocker locker(m_mutex);
+
+    m_isSet = true;
+    m_condition.signal();
+}
+
+bool BinarySemaphore::wait(double absoluteTime)
+{
+    MutexLocker locker(m_mutex);
+
+    bool timedOut = false;
+    while (!m_isSet) {
+        timedOut = !m_condition.timedWait(m_mutex, absoluteTime);
+        if (timedOut)
+            return false;
+    }
+
+    // Reset the semaphore.
+    m_isSet = false;
+    return true;
+}
+
+} // namespace WTF
+
+#endif // !PLATFORM(WIN)
diff --git a/Source/WTF/wtf/threads/BinarySemaphore.h b/Source/WTF/wtf/threads/BinarySemaphore.h
new file mode 100644
index 0000000..8e82207
--- /dev/null
+++ b/Source/WTF/wtf/threads/BinarySemaphore.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2010, 2011 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.
+ */
+
+#ifndef BinarySemaphore_h
+#define BinarySemaphore_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/ThreadingPrimitives.h>
+
+namespace WTF {
+
+class BinarySemaphore {
+    WTF_MAKE_NONCOPYABLE(BinarySemaphore);
+
+public:
+    BinarySemaphore();
+    ~BinarySemaphore();
+
+    void signal();
+    bool wait(double absoluteTime);
+
+#if PLATFORM(WIN)
+    HANDLE event() const { return m_event; }
+#endif
+
+private:
+#if PLATFORM(WIN)
+    HANDLE m_event;
+#else
+    bool m_isSet;
+
+    Mutex m_mutex;
+    ThreadCondition m_condition;
+#endif
+};
+
+} // namespace WTF
+
+using WTF::BinarySemaphore;
+
+#endif // BinarySemaphore_h
diff --git a/Source/WTF/wtf/threads/win/BinarySemaphoreWin.cpp b/Source/WTF/wtf/threads/win/BinarySemaphoreWin.cpp
new file mode 100644
index 0000000..0dad1ac
--- /dev/null
+++ b/Source/WTF/wtf/threads/win/BinarySemaphoreWin.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2011 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 "config.h"
+#include "BinarySemaphore.h"
+
+namespace WTF {
+
+BinarySemaphore::BinarySemaphore()
+    : m_event(::CreateEventW(0, FALSE, FALSE, 0))
+{
+}
+
+BinarySemaphore::~BinarySemaphore()
+{
+    ::CloseHandle(m_event);
+}
+
+void BinarySemaphore::signal()
+{
+    ::SetEvent(m_event);
+}
+
+bool BinarySemaphore::wait(double absoluteTime)
+{
+    DWORD interval = absoluteTimeToWaitTimeoutInterval(absoluteTime);
+    if (!interval) {
+        // Consider the wait to have timed out, even if the event has already been signaled, to
+        // match the WTF::ThreadCondition implementation.
+        return false;
+    }
+
+    DWORD result = ::WaitForSingleObject(m_event, interval);
+    switch (result) {
+    case WAIT_OBJECT_0:
+        // The event was signaled.
+        return true;
+
+    case WAIT_TIMEOUT:
+        // The wait timed out.
+        return false;
+
+    case WAIT_FAILED:
+        ASSERT_WITH_MESSAGE(false, "::WaitForSingleObject failed with error %lu", ::GetLastError());
+        return false;
+
+    default:
+        ASSERT_WITH_MESSAGE(false, "::WaitForSingleObject returned unexpected result %lu", result);
+        return false;
+    }
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/unicode/CharacterNames.h b/Source/WTF/wtf/unicode/CharacterNames.h
new file mode 100644
index 0000000..c36dfd0
--- /dev/null
+++ b/Source/WTF/wtf/unicode/CharacterNames.h
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2007, 2009, 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 CharacterNames_h
+#define CharacterNames_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WTF {
+namespace Unicode {
+
+// Names here are taken from the Unicode standard.
+
+// Most of these are UChar constants, not UChar32, which makes them
+// more convenient for WebCore code that mostly uses UTF-16.
+
+const UChar32 aegeanWordSeparatorLine = 0x10100;
+const UChar32 aegeanWordSeparatorDot = 0x10101;
+const UChar blackCircle = 0x25CF;
+const UChar blackSquare = 0x25A0;
+const UChar blackUpPointingTriangle = 0x25B2;
+const UChar bullet = 0x2022;
+const UChar bullseye = 0x25CE;
+const UChar carriageReturn = 0x000D;
+const UChar ethiopicPrefaceColon = 0x1366;
+const UChar ethiopicWordspace = 0x1361;
+const UChar fisheye = 0x25C9;
+const UChar hebrewPunctuationGeresh = 0x05F3;
+const UChar hebrewPunctuationGershayim = 0x05F4;
+const UChar HiraganaLetterSmallA = 0x3041;
+const UChar horizontalEllipsis = 0x2026;
+const UChar hyphen = 0x2010;
+const UChar hyphenMinus = 0x002D;
+const UChar ideographicComma = 0x3001;
+const UChar ideographicFullStop = 0x3002;
+const UChar ideographicSpace = 0x3000;
+const UChar leftDoubleQuotationMark = 0x201C;
+const UChar leftSingleQuotationMark = 0x2018;
+const UChar leftToRightEmbed = 0x202A;
+const UChar leftToRightMark = 0x200E;
+const UChar leftToRightOverride = 0x202D;
+const UChar minusSign = 0x2212;
+const UChar newlineCharacter = 0x000A;
+const UChar noBreakSpace = 0x00A0;
+const UChar objectReplacementCharacter = 0xFFFC;
+const UChar popDirectionalFormatting = 0x202C;
+const UChar replacementCharacter = 0xFFFD;
+const UChar rightDoubleQuotationMark = 0x201D;
+const UChar rightSingleQuotationMark = 0x2019;
+const UChar rightToLeftEmbed = 0x202B;
+const UChar rightToLeftMark = 0x200F;
+const UChar rightToLeftOverride = 0x202E;
+const UChar sesameDot = 0xFE45;
+const UChar smallLetterSharpS = 0x00DF;
+const UChar softHyphen = 0x00AD;
+const UChar space = 0x0020;
+const UChar tibetanMarkIntersyllabicTsheg = 0x0F0B;
+const UChar tibetanMarkDelimiterTshegBstar = 0x0F0C;
+const UChar32 ugariticWordDivider = 0x1039F;
+const UChar whiteBullet = 0x25E6;
+const UChar whiteCircle = 0x25CB;
+const UChar whiteSesameDot = 0xFE46;
+const UChar whiteUpPointingTriangle = 0x25B3;
+const UChar yenSign = 0x00A5;
+const UChar zeroWidthJoiner = 0x200D;
+const UChar zeroWidthNonJoiner = 0x200C;
+const UChar zeroWidthSpace = 0x200B;
+const UChar zeroWidthNoBreakSpace = 0xFEFF;
+
+} // namespace Unicode
+} // namespace WTF
+
+using WTF::Unicode::aegeanWordSeparatorLine;
+using WTF::Unicode::aegeanWordSeparatorDot;
+using WTF::Unicode::blackCircle;
+using WTF::Unicode::blackSquare;
+using WTF::Unicode::blackUpPointingTriangle;
+using WTF::Unicode::bullet;
+using WTF::Unicode::bullseye;
+using WTF::Unicode::carriageReturn;
+using WTF::Unicode::ethiopicPrefaceColon;
+using WTF::Unicode::ethiopicWordspace;
+using WTF::Unicode::fisheye;
+using WTF::Unicode::hebrewPunctuationGeresh;
+using WTF::Unicode::hebrewPunctuationGershayim;
+using WTF::Unicode::HiraganaLetterSmallA;
+using WTF::Unicode::horizontalEllipsis;
+using WTF::Unicode::hyphen;
+using WTF::Unicode::hyphenMinus;
+using WTF::Unicode::ideographicComma;
+using WTF::Unicode::ideographicFullStop;
+using WTF::Unicode::ideographicSpace;
+using WTF::Unicode::leftDoubleQuotationMark;
+using WTF::Unicode::leftSingleQuotationMark;
+using WTF::Unicode::leftToRightEmbed;
+using WTF::Unicode::leftToRightMark;
+using WTF::Unicode::leftToRightOverride;
+using WTF::Unicode::minusSign;
+using WTF::Unicode::newlineCharacter;
+using WTF::Unicode::noBreakSpace;
+using WTF::Unicode::objectReplacementCharacter;
+using WTF::Unicode::popDirectionalFormatting;
+using WTF::Unicode::replacementCharacter;
+using WTF::Unicode::rightDoubleQuotationMark;
+using WTF::Unicode::rightSingleQuotationMark;
+using WTF::Unicode::rightToLeftEmbed;
+using WTF::Unicode::rightToLeftMark;
+using WTF::Unicode::rightToLeftOverride;
+using WTF::Unicode::sesameDot;
+using WTF::Unicode::softHyphen;
+using WTF::Unicode::space;
+using WTF::Unicode::tibetanMarkIntersyllabicTsheg;
+using WTF::Unicode::tibetanMarkDelimiterTshegBstar;
+using WTF::Unicode::ugariticWordDivider;
+using WTF::Unicode::whiteBullet;
+using WTF::Unicode::whiteCircle;
+using WTF::Unicode::whiteSesameDot;
+using WTF::Unicode::whiteUpPointingTriangle;
+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/WTF/wtf/unicode/Collator.h b/Source/WTF/wtf/unicode/Collator.h
new file mode 100644
index 0000000..7994ff8
--- /dev/null
+++ b/Source/WTF/wtf/unicode/Collator.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2008 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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.
+ */
+
+#ifndef WTF_Collator_h
+#define WTF_Collator_h
+
+#include <wtf/FastAllocBase.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/unicode/Unicode.h>
+
+#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+struct UCollator;
+#endif
+
+namespace WTF {
+
+    class Collator {
+        WTF_MAKE_NONCOPYABLE(Collator); WTF_MAKE_FAST_ALLOCATED;
+    public:
+        enum Result { Equal = 0, Greater = 1, Less = -1 };
+
+        WTF_EXPORT_PRIVATE Collator(const char* locale); // Parsing is lenient; e.g. language identifiers (such as "en-US") are accepted, too.
+        WTF_EXPORT_PRIVATE ~Collator();
+        WTF_EXPORT_PRIVATE void setOrderLowerFirst(bool);
+
+        static PassOwnPtr<Collator> userDefault();
+
+        WTF_EXPORT_PRIVATE Result collate(const ::UChar*, size_t, const ::UChar*, size_t) const;
+
+    private:
+#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+        void createCollator() const;
+        void releaseCollator();
+        mutable UCollator* m_collator;
+#endif
+        char* m_locale;
+        bool m_lowerFirst;
+    };
+}
+
+using WTF::Collator;
+
+#endif
diff --git a/Source/WTF/wtf/unicode/CollatorDefault.cpp b/Source/WTF/wtf/unicode/CollatorDefault.cpp
new file mode 100644
index 0000000..7bde114
--- /dev/null
+++ b/Source/WTF/wtf/unicode/CollatorDefault.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2008 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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 "config.h"
+#include "Collator.h"
+
+#if !USE(ICU_UNICODE) || UCONFIG_NO_COLLATION
+
+namespace WTF {
+
+Collator::Collator(const char*)
+{
+}
+
+Collator::~Collator()
+{
+}
+
+void Collator::setOrderLowerFirst(bool)
+{
+}
+
+PassOwnPtr<Collator> Collator::userDefault()
+{
+    return adoptPtr(new Collator(0));
+}
+
+// A default implementation for platforms that lack Unicode-aware collation.
+Collator::Result Collator::collate(const UChar* lhs, size_t lhsLength, const UChar* rhs, size_t rhsLength) const
+{
+    int lmin = lhsLength < rhsLength ? lhsLength : rhsLength;
+    int l = 0;
+    while (l < lmin && *lhs == *rhs) {
+        lhs++;
+        rhs++;
+        l++;
+    }
+
+    if (l < lmin)
+        return (*lhs > *rhs) ? Greater : Less;
+
+    if (lhsLength == rhsLength)
+        return Equal;
+
+    return (lhsLength > rhsLength) ? Greater : Less;
+}
+
+}
+
+#endif
diff --git a/Source/WTF/wtf/unicode/ScriptCodesFromICU.h b/Source/WTF/wtf/unicode/ScriptCodesFromICU.h
new file mode 100644
index 0000000..4760399
--- /dev/null
+++ b/Source/WTF/wtf/unicode/ScriptCodesFromICU.h
@@ -0,0 +1,153 @@
+/*
+ *   Copyright (C) 1997-2006, International Business Machines
+ *   Corporation and others.  All Rights Reserved.
+ */
+
+#ifndef WTF_ScriptCodesFromICU_h
+#define WTF_ScriptCodesFromICU_h
+
+/**
+ * Constants for ISO 15924 script codes.
+ *
+ * Many of these script codes - those from Unicode's ScriptNames.txt -
+ * are character property values for Unicode's Script property.
+ * See UAX #24 Script Names (http://www.unicode.org/reports/tr24/).
+ *
+ * Starting with ICU 3.6, constants for most ISO 15924 script codes
+ * are included (currently excluding private-use codes Qaaa..Qabx).
+ * For scripts for which there are codes in ISO 15924 but which are not
+ * used in the Unicode Character Database (UCD), there are no Unicode characters
+ * associated with those scripts.
+ *
+ * For example, there are no characters that have a UCD script code of
+ * Hans or Hant. All Han ideographs have the Hani script code.
+ * The Hans and Hant script codes are used with CLDR data.
+ *
+ * ISO 15924 script codes are included for use with CLDR and similar.
+ *
+ * @stable ICU 2.2
+ */
+typedef enum UScriptCode {
+      USCRIPT_INVALID_CODE = -1,
+      USCRIPT_COMMON       =  0 , /* Zyyy */
+      USCRIPT_INHERITED    =  1,  /* Qaai */
+      USCRIPT_ARABIC       =  2,  /* Arab */
+      USCRIPT_ARMENIAN     =  3,  /* Armn */
+      USCRIPT_BENGALI      =  4,  /* Beng */
+      USCRIPT_BOPOMOFO     =  5,  /* Bopo */
+      USCRIPT_CHEROKEE     =  6,  /* Cher */
+      USCRIPT_COPTIC       =  7,  /* Copt */
+      USCRIPT_CYRILLIC     =  8,  /* Cyrl */
+      USCRIPT_DESERET      =  9,  /* Dsrt */
+      USCRIPT_DEVANAGARI   = 10,  /* Deva */
+      USCRIPT_ETHIOPIC     = 11,  /* Ethi */
+      USCRIPT_GEORGIAN     = 12,  /* Geor */
+      USCRIPT_GOTHIC       = 13,  /* Goth */
+      USCRIPT_GREEK        = 14,  /* Grek */
+      USCRIPT_GUJARATI     = 15,  /* Gujr */
+      USCRIPT_GURMUKHI     = 16,  /* Guru */
+      USCRIPT_HAN          = 17,  /* Hani */
+      USCRIPT_HANGUL       = 18,  /* Hang */
+      USCRIPT_HEBREW       = 19,  /* Hebr */
+      USCRIPT_HIRAGANA     = 20,  /* Hira */
+      USCRIPT_KANNADA      = 21,  /* Knda */
+      USCRIPT_KATAKANA     = 22,  /* Kana */
+      USCRIPT_KHMER        = 23,  /* Khmr */
+      USCRIPT_LAO          = 24,  /* Laoo */
+      USCRIPT_LATIN        = 25,  /* Latn */
+      USCRIPT_MALAYALAM    = 26,  /* Mlym */
+      USCRIPT_MONGOLIAN    = 27,  /* Mong */
+      USCRIPT_MYANMAR      = 28,  /* Mymr */
+      USCRIPT_OGHAM        = 29,  /* Ogam */
+      USCRIPT_OLD_ITALIC   = 30,  /* Ital */
+      USCRIPT_ORIYA        = 31,  /* Orya */
+      USCRIPT_RUNIC        = 32,  /* Runr */
+      USCRIPT_SINHALA      = 33,  /* Sinh */
+      USCRIPT_SYRIAC       = 34,  /* Syrc */
+      USCRIPT_TAMIL        = 35,  /* Taml */
+      USCRIPT_TELUGU       = 36,  /* Telu */
+      USCRIPT_THAANA       = 37,  /* Thaa */
+      USCRIPT_THAI         = 38,  /* Thai */
+      USCRIPT_TIBETAN      = 39,  /* Tibt */
+      /** Canadian_Aboriginal script. @stable ICU 2.6 */
+      USCRIPT_CANADIAN_ABORIGINAL = 40,  /* Cans */
+      /** Canadian_Aboriginal script (alias). @stable ICU 2.2 */
+      USCRIPT_UCAS         = USCRIPT_CANADIAN_ABORIGINAL,
+      USCRIPT_YI           = 41,  /* Yiii */
+      USCRIPT_TAGALOG      = 42,  /* Tglg */
+      USCRIPT_HANUNOO      = 43,  /* Hano */
+      USCRIPT_BUHID        = 44,  /* Buhd */
+      USCRIPT_TAGBANWA     = 45,  /* Tagb */
+
+      /* New scripts in Unicode 4 @stable ICU 2.6 */
+      USCRIPT_BRAILLE      = 46,  /* Brai */
+      USCRIPT_CYPRIOT      = 47,  /* Cprt */
+      USCRIPT_LIMBU        = 48,  /* Limb */
+      USCRIPT_LINEAR_B     = 49,  /* Linb */
+      USCRIPT_OSMANYA      = 50,  /* Osma */
+      USCRIPT_SHAVIAN      = 51,  /* Shaw */
+      USCRIPT_TAI_LE       = 52,  /* Tale */
+      USCRIPT_UGARITIC     = 53,  /* Ugar */
+
+      /** New script code in Unicode 4.0.1 @stable ICU 3.0 */
+      USCRIPT_KATAKANA_OR_HIRAGANA = 54,/*Hrkt */
+      
+#ifndef U_HIDE_DRAFT_API
+      /* New scripts in Unicode 4.1 @draft ICU 3.4 */
+      USCRIPT_BUGINESE      = 55, /* Bugi */
+      USCRIPT_GLAGOLITIC    = 56, /* Glag */
+      USCRIPT_KHAROSHTHI    = 57, /* Khar */
+      USCRIPT_SYLOTI_NAGRI  = 58, /* Sylo */
+      USCRIPT_NEW_TAI_LUE   = 59, /* Talu */
+      USCRIPT_TIFINAGH      = 60, /* Tfng */
+      USCRIPT_OLD_PERSIAN   = 61, /* Xpeo */
+
+      /* New script codes from ISO 15924 @draft ICU 3.6 */
+      USCRIPT_BALINESE                      = 62, /* Bali */
+      USCRIPT_BATAK                         = 63, /* Batk */
+      USCRIPT_BLISSYMBOLS                   = 64, /* Blis */
+      USCRIPT_BRAHMI                        = 65, /* Brah */
+      USCRIPT_CHAM                          = 66, /* Cham */
+      USCRIPT_CIRTH                         = 67, /* Cirt */
+      USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC  = 68, /* Cyrs */
+      USCRIPT_DEMOTIC_EGYPTIAN              = 69, /* Egyd */
+      USCRIPT_HIERATIC_EGYPTIAN             = 70, /* Egyh */
+      USCRIPT_EGYPTIAN_HIEROGLYPHS          = 71, /* Egyp */
+      USCRIPT_KHUTSURI                      = 72, /* Geok */
+      USCRIPT_SIMPLIFIED_HAN                = 73, /* Hans */
+      USCRIPT_TRADITIONAL_HAN               = 74, /* Hant */
+      USCRIPT_PAHAWH_HMONG                  = 75, /* Hmng */
+      USCRIPT_OLD_HUNGARIAN                 = 76, /* Hung */
+      USCRIPT_HARAPPAN_INDUS                = 77, /* Inds */
+      USCRIPT_JAVANESE                      = 78, /* Java */
+      USCRIPT_KAYAH_LI                      = 79, /* Kali */
+      USCRIPT_LATIN_FRAKTUR                 = 80, /* Latf */
+      USCRIPT_LATIN_GAELIC                  = 81, /* Latg */
+      USCRIPT_LEPCHA                        = 82, /* Lepc */
+      USCRIPT_LINEAR_A                      = 83, /* Lina */
+      USCRIPT_MANDAEAN                      = 84, /* Mand */
+      USCRIPT_MAYAN_HIEROGLYPHS             = 85, /* Maya */
+      USCRIPT_MEROITIC                      = 86, /* Mero */
+      USCRIPT_NKO                           = 87, /* Nkoo */
+      USCRIPT_ORKHON                        = 88, /* Orkh */
+      USCRIPT_OLD_PERMIC                    = 89, /* Perm */
+      USCRIPT_PHAGS_PA                      = 90, /* Phag */
+      USCRIPT_PHOENICIAN                    = 91, /* Phnx */
+      USCRIPT_PHONETIC_POLLARD              = 92, /* Plrd */
+      USCRIPT_RONGORONGO                    = 93, /* Roro */
+      USCRIPT_SARATI                        = 94, /* Sara */
+      USCRIPT_ESTRANGELO_SYRIAC             = 95, /* Syre */
+      USCRIPT_WESTERN_SYRIAC                = 96, /* Syrj */
+      USCRIPT_EASTERN_SYRIAC                = 97, /* Syrn */
+      USCRIPT_TENGWAR                       = 98, /* Teng */
+      USCRIPT_VAI                           = 99, /* Vaii */
+      USCRIPT_VISIBLE_SPEECH                = 100, /* Visp */
+      USCRIPT_CUNEIFORM                     = 101,/* Xsux */
+      USCRIPT_UNWRITTEN_LANGUAGES           = 102,/* Zxxx */
+      USCRIPT_UNKNOWN                       = 103,/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */
+      /* Private use codes from Qaaa - Qabx are not supported*/
+#endif /* U_HIDE_DRAFT_API */
+      USCRIPT_CODE_LIMIT    = 104
+} UScriptCode;
+
+#endif
diff --git a/Source/WTF/wtf/unicode/UTF8.cpp b/Source/WTF/wtf/unicode/UTF8.cpp
new file mode 100644
index 0000000..6e74f01
--- /dev/null
+++ b/Source/WTF/wtf/unicode/UTF8.cpp
@@ -0,0 +1,460 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 "UTF8.h"
+
+#include "ASCIICType.h"
+#include <wtf/StringHasher.h>
+#include <wtf/unicode/CharacterNames.h>
+
+namespace WTF {
+namespace Unicode {
+
+inline int inlineUTF8SequenceLengthNonASCII(char b0)
+{
+    if ((b0 & 0xC0) != 0xC0)
+        return 0;
+    if ((b0 & 0xE0) == 0xC0)
+        return 2;
+    if ((b0 & 0xF0) == 0xE0)
+        return 3;
+    if ((b0 & 0xF8) == 0xF0)
+        return 4;
+    return 0;
+}
+
+inline int inlineUTF8SequenceLength(char b0)
+{
+    return isASCII(b0) ? 1 : inlineUTF8SequenceLengthNonASCII(b0);
+}
+
+int UTF8SequenceLength(char b0)
+{
+    return isASCII(b0) ? 1 : inlineUTF8SequenceLengthNonASCII(b0);
+}
+
+int decodeUTF8Sequence(const char* sequence)
+{
+    // Handle 0-byte sequences (never valid).
+    const unsigned char b0 = sequence[0];
+    const int length = inlineUTF8SequenceLength(b0);
+    if (length == 0)
+        return -1;
+
+    // Handle 1-byte sequences (plain ASCII).
+    const unsigned char b1 = sequence[1];
+    if (length == 1) {
+        if (b1)
+            return -1;
+        return b0;
+    }
+
+    // Handle 2-byte sequences.
+    if ((b1 & 0xC0) != 0x80)
+        return -1;
+    const unsigned char b2 = sequence[2];
+    if (length == 2) {
+        if (b2)
+            return -1;
+        const int c = ((b0 & 0x1F) << 6) | (b1 & 0x3F);
+        if (c < 0x80)
+            return -1;
+        return c;
+    }
+
+    // Handle 3-byte sequences.
+    if ((b2 & 0xC0) != 0x80)
+        return -1;
+    const unsigned char b3 = sequence[3];
+    if (length == 3) {
+        if (b3)
+            return -1;
+        const int c = ((b0 & 0xF) << 12) | ((b1 & 0x3F) << 6) | (b2 & 0x3F);
+        if (c < 0x800)
+            return -1;
+        // UTF-16 surrogates should never appear in UTF-8 data.
+        if (c >= 0xD800 && c <= 0xDFFF)
+            return -1;
+        return c;
+    }
+
+    // Handle 4-byte sequences.
+    if ((b3 & 0xC0) != 0x80)
+        return -1;
+    const unsigned char b4 = sequence[4];
+    if (length == 4) {
+        if (b4)
+            return -1;
+        const int c = ((b0 & 0x7) << 18) | ((b1 & 0x3F) << 12) | ((b2 & 0x3F) << 6) | (b3 & 0x3F);
+        if (c < 0x10000 || c > 0x10FFFF)
+            return -1;
+        return c;
+    }
+
+    return -1;
+}
+
+// Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
+// into the first byte, depending on how many bytes follow.  There are
+// as many entries in this table as there are UTF-8 sequence types.
+// (I.e., one byte sequence, two byte... etc.). Remember that sequencs
+// for *legal* UTF-8 will be 4 or fewer bytes total.
+static const unsigned char firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
+
+ConversionResult convertLatin1ToUTF8(
+                                     const LChar** sourceStart, const LChar* sourceEnd, 
+                                     char** targetStart, char* targetEnd)
+{
+    ConversionResult result = conversionOK;
+    const LChar* source = *sourceStart;
+    char* target = *targetStart;
+    while (source < sourceEnd) {
+        UChar32 ch;
+        unsigned short bytesToWrite = 0;
+        const UChar32 byteMask = 0xBF;
+        const UChar32 byteMark = 0x80; 
+        const LChar* oldSource = source; // In case we have to back up because of target overflow.
+        ch = static_cast<unsigned short>(*source++);
+
+        // Figure out how many bytes the result will require
+        if (ch < (UChar32)0x80)
+            bytesToWrite = 1;
+        else
+            bytesToWrite = 2;
+
+        target += bytesToWrite;
+        if (target > targetEnd) {
+            source = oldSource; // Back up source pointer!
+            target -= bytesToWrite;
+            result = targetExhausted;
+            break;
+        }
+        switch (bytesToWrite) { // note: everything falls through.
+        case 2:
+            *--target = (char)((ch | byteMark) & byteMask);
+            ch >>= 6;
+        case 1:
+            *--target =  (char)(ch | firstByteMark[bytesToWrite]);
+        }
+        target += bytesToWrite;
+    }
+    *sourceStart = source;
+    *targetStart = target;
+    return result;
+}
+
+ConversionResult convertUTF16ToUTF8(
+    const UChar** sourceStart, const UChar* sourceEnd, 
+    char** targetStart, char* targetEnd, bool strict)
+{
+    ConversionResult result = conversionOK;
+    const UChar* source = *sourceStart;
+    char* target = *targetStart;
+    while (source < sourceEnd) {
+        UChar32 ch;
+        unsigned short bytesToWrite = 0;
+        const UChar32 byteMask = 0xBF;
+        const UChar32 byteMark = 0x80; 
+        const UChar* oldSource = source; // In case we have to back up because of target overflow.
+        ch = static_cast<unsigned short>(*source++);
+        // If we have a surrogate pair, convert to UChar32 first.
+        if (ch >= 0xD800 && ch <= 0xDBFF) {
+            // If the 16 bits following the high surrogate are in the source buffer...
+            if (source < sourceEnd) {
+                UChar32 ch2 = static_cast<unsigned short>(*source);
+                // If it's a low surrogate, convert to UChar32.
+                if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
+                    ch = ((ch - 0xD800) << 10) + (ch2 - 0xDC00) + 0x0010000;
+                    ++source;
+                } else if (strict) { // it's an unpaired high surrogate
+                    --source; // return to the illegal value itself
+                    result = sourceIllegal;
+                    break;
+                }
+            } else { // We don't have the 16 bits following the high surrogate.
+                --source; // return to the high surrogate
+                result = sourceExhausted;
+                break;
+            }
+        } else if (strict) {
+            // UTF-16 surrogate values are illegal in UTF-32
+            if (ch >= 0xDC00 && ch <= 0xDFFF) {
+                --source; // return to the illegal value itself
+                result = sourceIllegal;
+                break;
+            }
+        }
+        // Figure out how many bytes the result will require
+        if (ch < (UChar32)0x80) {
+            bytesToWrite = 1;
+        } else if (ch < (UChar32)0x800) {
+            bytesToWrite = 2;
+        } else if (ch < (UChar32)0x10000) {
+            bytesToWrite = 3;
+        } else if (ch < (UChar32)0x110000) {
+            bytesToWrite = 4;
+        } else {
+            bytesToWrite = 3;
+            ch = replacementCharacter;
+        }
+
+        target += bytesToWrite;
+        if (target > targetEnd) {
+            source = oldSource; // Back up source pointer!
+            target -= bytesToWrite;
+            result = targetExhausted;
+            break;
+        }
+        switch (bytesToWrite) { // note: everything falls through.
+            case 4: *--target = (char)((ch | byteMark) & byteMask); ch >>= 6;
+            case 3: *--target = (char)((ch | byteMark) & byteMask); ch >>= 6;
+            case 2: *--target = (char)((ch | byteMark) & byteMask); ch >>= 6;
+            case 1: *--target =  (char)(ch | firstByteMark[bytesToWrite]);
+        }
+        target += bytesToWrite;
+    }
+    *sourceStart = source;
+    *targetStart = target;
+    return result;
+}
+
+// This must be called with the length pre-determined by the first byte.
+// If presented with a length > 4, this returns false.  The Unicode
+// definition of UTF-8 goes up to 4-byte sequences.
+static bool isLegalUTF8(const unsigned char* source, int length)
+{
+    unsigned char a;
+    const unsigned char* srcptr = source + length;
+    switch (length) {
+        default: return false;
+        // Everything else falls through when "true"...
+        case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
+        case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
+        case 2: if ((a = (*--srcptr)) > 0xBF) return false;
+
+        switch (*source) {
+            // no fall-through in this inner switch
+            case 0xE0: if (a < 0xA0) return false; break;
+            case 0xED: if (a > 0x9F) return false; break;
+            case 0xF0: if (a < 0x90) return false; break;
+            case 0xF4: if (a > 0x8F) return false; break;
+            default:   if (a < 0x80) return false;
+        }
+
+        case 1: if (*source >= 0x80 && *source < 0xC2) return false;
+    }
+    if (*source > 0xF4)
+        return false;
+    return true;
+}
+
+// Magic values subtracted from a buffer value during UTF8 conversion.
+// This table contains as many values as there might be trailing bytes
+// in a UTF-8 sequence.
+static const UChar32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, static_cast<UChar32>(0xFA082080UL), static_cast<UChar32>(0x82082080UL) };
+
+static inline UChar32 readUTF8Sequence(const char*& sequence, unsigned length)
+{
+    UChar32 character = 0;
+
+    // The cases all fall through.
+    switch (length) {
+        case 6: character += static_cast<unsigned char>(*sequence++); character <<= 6;
+        case 5: character += static_cast<unsigned char>(*sequence++); character <<= 6;
+        case 4: character += static_cast<unsigned char>(*sequence++); character <<= 6;
+        case 3: character += static_cast<unsigned char>(*sequence++); character <<= 6;
+        case 2: character += static_cast<unsigned char>(*sequence++); character <<= 6;
+        case 1: character += static_cast<unsigned char>(*sequence++);
+    }
+
+    return character - offsetsFromUTF8[length - 1];
+}
+
+ConversionResult convertUTF8ToUTF16(
+    const char** sourceStart, const char* sourceEnd, 
+    UChar** targetStart, UChar* targetEnd, bool* sourceAllASCII, bool strict)
+{
+    ConversionResult result = conversionOK;
+    const char* source = *sourceStart;
+    UChar* target = *targetStart;
+    UChar orAllData = 0;
+    while (source < sourceEnd) {
+        int utf8SequenceLength = inlineUTF8SequenceLength(*source);
+        if (sourceEnd - source < utf8SequenceLength)  {
+            result = sourceExhausted;
+            break;
+        }
+        // Do this check whether lenient or strict
+        if (!isLegalUTF8(reinterpret_cast<const unsigned char*>(source), utf8SequenceLength)) {
+            result = sourceIllegal;
+            break;
+        }
+
+        UChar32 character = readUTF8Sequence(source, utf8SequenceLength);
+
+        if (target >= targetEnd) {
+            source -= utf8SequenceLength; // Back up source pointer!
+            result = targetExhausted;
+            break;
+        }
+
+        if (U_IS_BMP(character)) {
+            // UTF-16 surrogate values are illegal in UTF-32
+            if (U_IS_SURROGATE(character)) {
+                if (strict) {
+                    source -= utf8SequenceLength; // return to the illegal value itself
+                    result = sourceIllegal;
+                    break;
+                } else {
+                    *target++ = replacementCharacter;
+                    orAllData |= replacementCharacter;
+                }
+            } else {
+                *target++ = character; // normal case
+                orAllData |= character;
+            }
+        } else if (U_IS_SUPPLEMENTARY(character)) {
+            // target is a character in range 0xFFFF - 0x10FFFF
+            if (target + 1 >= targetEnd) {
+                source -= utf8SequenceLength; // Back up source pointer!
+                result = targetExhausted;
+                break;
+            }
+            *target++ = U16_LEAD(character);
+            *target++ = U16_TRAIL(character);
+            orAllData = 0xffff;
+        } else {
+            if (strict) {
+                source -= utf8SequenceLength; // return to the start
+                result = sourceIllegal;
+                break; // Bail out; shouldn't continue
+            } else {
+                *target++ = replacementCharacter;
+                orAllData |= replacementCharacter;
+            }
+        }
+    }
+    *sourceStart = source;
+    *targetStart = target;
+
+    if (sourceAllASCII)
+        *sourceAllASCII = !(orAllData & ~0x7f);
+
+    return result;
+}
+
+unsigned calculateStringHashAndLengthFromUTF8MaskingTop8Bits(const char* data, const char* dataEnd, unsigned& dataLength, unsigned& utf16Length)
+{
+    if (!data)
+        return 0;
+
+    StringHasher stringHasher;
+    dataLength = 0;
+    utf16Length = 0;
+
+    while (data < dataEnd || (!dataEnd && *data)) {
+        if (isASCII(*data)) {
+            stringHasher.addCharacter(*data++);
+            dataLength++;
+            utf16Length++;
+            continue;
+        }
+
+        int utf8SequenceLength = inlineUTF8SequenceLengthNonASCII(*data);
+        dataLength += utf8SequenceLength;
+
+        if (!dataEnd) {
+            for (int i = 1; i < utf8SequenceLength; ++i) {
+                if (!data[i])
+                    return 0;
+            }
+        } else if (dataEnd - data < utf8SequenceLength)
+            return 0;
+
+        if (!isLegalUTF8(reinterpret_cast<const unsigned char*>(data), utf8SequenceLength))
+            return 0;
+
+        UChar32 character = readUTF8Sequence(data, utf8SequenceLength);
+        ASSERT(!isASCII(character));
+
+        if (U_IS_BMP(character)) {
+            // UTF-16 surrogate values are illegal in UTF-32
+            if (U_IS_SURROGATE(character))
+                return 0;
+            stringHasher.addCharacter(static_cast<UChar>(character)); // normal case
+            utf16Length++;
+        } else if (U_IS_SUPPLEMENTARY(character)) {
+            stringHasher.addCharacters(static_cast<UChar>(U16_LEAD(character)),
+                                       static_cast<UChar>(U16_TRAIL(character)));
+            utf16Length += 2;
+        } else
+            return 0;
+    }
+
+    return stringHasher.hashWithTop8BitsMasked();
+}
+
+bool equalUTF16WithUTF8(const UChar* a, const UChar* aEnd, const char* b, const char* bEnd)
+{
+    while (b < bEnd) {
+        if (isASCII(*b)) {
+            if (*a++ != *b++)
+                return false;
+            continue;
+        }
+
+        int utf8SequenceLength = inlineUTF8SequenceLengthNonASCII(*b);
+
+        if (bEnd - b < utf8SequenceLength)
+            return false;
+
+        if (!isLegalUTF8(reinterpret_cast<const unsigned char*>(b), utf8SequenceLength))
+            return 0;
+
+        UChar32 character = readUTF8Sequence(b, utf8SequenceLength);
+        ASSERT(!isASCII(character));
+
+        if (U_IS_BMP(character)) {
+            // UTF-16 surrogate values are illegal in UTF-32
+            if (U_IS_SURROGATE(character))
+                return false;
+            if (*a++ != character)
+                return false;
+        } else if (U_IS_SUPPLEMENTARY(character)) {
+            if (*a++ != U16_LEAD(character))
+                return false;
+            if (*a++ != U16_TRAIL(character))
+                return false;
+        } else
+            return false;
+    }
+
+    return a == aEnd;
+}
+
+} // namespace Unicode
+} // namespace WTF
diff --git a/Source/WTF/wtf/unicode/UTF8.h b/Source/WTF/wtf/unicode/UTF8.h
new file mode 100644
index 0000000..1fc21ba
--- /dev/null
+++ b/Source/WTF/wtf/unicode/UTF8.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. 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_UTF8_h
+#define WTF_UTF8_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WTF {
+namespace Unicode {
+
+    // Given a first byte, gives the length of the UTF-8 sequence it begins.
+    // Returns 0 for bytes that are not legal starts of UTF-8 sequences.
+    // Only allows sequences of up to 4 bytes, since that works for all Unicode characters (U-00000000 to U-0010FFFF).
+    int UTF8SequenceLength(char);
+
+    // Takes a null-terminated C-style string with a UTF-8 sequence in it and converts it to a character.
+    // Only allows Unicode characters (U-00000000 to U-0010FFFF).
+    // Returns -1 if the sequence is not valid (including presence of extra bytes).
+    int decodeUTF8Sequence(const char*);
+
+    typedef enum {
+            conversionOK,       // conversion successful
+            sourceExhausted,    // partial character in source, but hit end
+            targetExhausted,    // insuff. room in target for conversion
+            sourceIllegal       // source sequence is illegal/malformed
+    } ConversionResult;
+
+    // These conversion functions take a "strict" argument. When this
+    // flag is set to strict, both irregular sequences and isolated surrogates
+    // will cause an error.  When the flag is set to lenient, both irregular
+    // sequences and isolated surrogates are converted.
+    // 
+    // Whether the flag is strict or lenient, all illegal sequences will cause
+    // an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,
+    // or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
+    // must check for illegal sequences.
+    // 
+    // When the flag is set to lenient, characters over 0x10FFFF are converted
+    // to the replacement character; otherwise (when the flag is set to strict)
+    // they constitute an error.
+
+    WTF_EXPORT_PRIVATE ConversionResult convertUTF8ToUTF16(
+                    const char** sourceStart, const char* sourceEnd, 
+                    UChar** targetStart, UChar* targetEnd, bool* isSourceAllASCII = 0, bool strict = true);
+
+    WTF_EXPORT_PRIVATE ConversionResult convertLatin1ToUTF8(
+                    const LChar** sourceStart, const LChar* sourceEnd, 
+                    char** targetStart, char* targetEnd);
+
+    WTF_EXPORT_PRIVATE ConversionResult convertUTF16ToUTF8(
+                    const UChar** sourceStart, const UChar* sourceEnd, 
+                    char** targetStart, char* targetEnd, bool strict = true);
+
+    WTF_EXPORT_PRIVATE unsigned calculateStringHashAndLengthFromUTF8MaskingTop8Bits(const char* data, const char* dataEnd, unsigned& dataLength, unsigned& utf16Length);
+
+    WTF_EXPORT_PRIVATE bool equalUTF16WithUTF8(const UChar* a, const UChar* aEnd, const char* b, const char* bEnd);
+
+} // namespace Unicode
+} // namespace WTF
+
+#endif // WTF_UTF8_h
diff --git a/Source/WTF/wtf/unicode/Unicode.h b/Source/WTF/wtf/unicode/Unicode.h
new file mode 100644
index 0000000..9260211
--- /dev/null
+++ b/Source/WTF/wtf/unicode/Unicode.h
@@ -0,0 +1,45 @@
+/*
+ *  Copyright (C) 2006 George Staikos <staikos@kde.org>
+ *  Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved.
+ *  Copyright (C) 2007-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.
+ *
+ */
+
+#ifndef WTF_UNICODE_H
+#define WTF_UNICODE_H
+
+#include <wtf/Assertions.h>
+
+// Define platform neutral 8 bit character type (L is for Latin-1).
+typedef unsigned char LChar;
+
+#if USE(QT4_UNICODE)
+#include "qt4/UnicodeQt4.h"
+#elif USE(ICU_UNICODE)
+#include <wtf/unicode/icu/UnicodeIcu.h>
+#elif USE(GLIB_UNICODE)
+#include <wtf/unicode/glib/UnicodeGLib.h>
+#elif USE(WCHAR_UNICODE)
+#include <wtf/unicode/wchar/UnicodeWchar.h>
+#else
+#error "Unknown Unicode implementation"
+#endif
+
+COMPILE_ASSERT(sizeof(UChar) == 2, UCharIsTwoBytes);
+
+#endif // WTF_UNICODE_H
diff --git a/Source/WTF/wtf/unicode/UnicodeMacrosFromICU.h b/Source/WTF/wtf/unicode/UnicodeMacrosFromICU.h
new file mode 100644
index 0000000..09a7036
--- /dev/null
+++ b/Source/WTF/wtf/unicode/UnicodeMacrosFromICU.h
@@ -0,0 +1,100 @@
+/*
+ *  Copyright (C) 1999-2004, International Business Machines Corporation and others.  All Rights Reserved.
+ *
+ */
+
+#ifndef UnicodeMacrosFromICU_h
+#define UnicodeMacrosFromICU_h
+
+// some defines from ICU
+
+#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_SUPPLEMENTARY(c) ((UChar32)((c)-0x10000)<=0xfffff)
+#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_GET(s, start, i, length, c) { \
+    (c)=(s)[i]; \
+    if(U16_IS_SURROGATE(c)) { \
+        uint16_t __c2; \
+        if(U16_IS_SURROGATE_LEAD(c)) { \
+            if((i)+1<(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \
+                (c)=U16_GET_SUPPLEMENTARY((c), __c2); \
+            } \
+        } else { \
+            if((i)-1>=(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+                (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+            } \
+        } \
+    } \
+}
+
+#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_BACK_1(s, start, i) { \
+    if(U16_IS_TRAIL((s)[--(i)]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
+        --(i); \
+    } \
+}
+
+#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_FWD_1(s, i, length) { \
+    if(U16_IS_LEAD((s)[(i)++]) && (i)<(length) && U16_IS_TRAIL((s)[i])) { \
+        ++(i); \
+    } \
+}
+
+#define U_MASK(x) ((uint32_t)1<<(x))
+
+#define U8_MAX_LENGTH 4
+
+#define U8_APPEND_UNSAFE(s, i, c) { \
+    if((uint32_t)(c)<=0x7f) { \
+        (s)[(i)++]=(uint8_t)(c); \
+    } else { \
+        if((uint32_t)(c)<=0x7ff) { \
+            (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \
+        } else { \
+            if((uint32_t)(c)<=0xffff) { \
+                (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \
+            } else { \
+                (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \
+                (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80); \
+            } \
+            (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \
+        } \
+        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
+    } \
+}
+#endif
diff --git a/Source/WTF/wtf/unicode/glib/UnicodeGLib.cpp b/Source/WTF/wtf/unicode/glib/UnicodeGLib.cpp
new file mode 100644
index 0000000..8040985
--- /dev/null
+++ b/Source/WTF/wtf/unicode/glib/UnicodeGLib.cpp
@@ -0,0 +1,193 @@
+/*
+ *  Copyright (C) 2008 Jürg Billeter <j@bitron.ch>
+ *  Copyright (C) 2008 Dominik Röttsches <dominik.roettsches@access-company.com>
+ *  Copyright (C) 2010 Igalia S.L.
+ *
+ *  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 "UnicodeGLib.h"
+
+#include <wtf/Vector.h>
+#include <wtf/unicode/UTF8.h>
+
+#define UTF8_IS_SURROGATE(character) (character >= 0x10000 && character <= 0x10FFFF)
+
+namespace WTF {
+namespace Unicode {
+
+UChar32 foldCase(UChar32 ch)
+{
+    GOwnPtr<GError> gerror;
+
+    GOwnPtr<char> utf8char;
+    utf8char.set(g_ucs4_to_utf8(reinterpret_cast<gunichar*>(&ch), 1, 0, 0, &gerror.outPtr()));
+    if (gerror)
+        return ch;
+
+    GOwnPtr<char> utf8caseFolded;
+    utf8caseFolded.set(g_utf8_casefold(utf8char.get(), -1));
+
+    GOwnPtr<gunichar> ucs4Result;
+    ucs4Result.set(g_utf8_to_ucs4_fast(utf8caseFolded.get(), -1, 0));
+
+    return *ucs4Result;
+}
+
+static int getUTF16LengthFromUTF8(const gchar* utf8String, int length)
+{
+    int utf16Length = 0;
+    const gchar* inputString = utf8String;
+
+    while ((utf8String + length - inputString > 0) && *inputString) {
+        gunichar character = g_utf8_get_char(inputString);
+
+        utf16Length += UTF8_IS_SURROGATE(character) ? 2 : 1;
+        inputString = g_utf8_next_char(inputString);
+    }
+
+    return utf16Length;
+}
+
+typedef gchar* (*UTF8CaseFunction)(const gchar*, gssize length);
+
+static int convertCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error, UTF8CaseFunction caseFunction)
+{
+    *error = false;
+
+    // Allocate a buffer big enough to hold all the characters.
+    Vector<char> buffer(srcLength * 3);
+    char* utf8Target = buffer.data();
+    const UChar* utf16Source = src;
+    ConversionResult conversionResult = convertUTF16ToUTF8(&utf16Source, utf16Source + srcLength, &utf8Target, utf8Target + buffer.size(), true);
+    if (conversionResult != conversionOK) {
+        *error = true;
+        return -1;
+    }
+    buffer.shrink(utf8Target - buffer.data());
+
+    GOwnPtr<char> utf8Result(caseFunction(buffer.data(), buffer.size()));
+    long utf8ResultLength = strlen(utf8Result.get());
+
+    // Calculate the destination buffer size.
+    int realLength = getUTF16LengthFromUTF8(utf8Result.get(), utf8ResultLength);
+    if (realLength > resultLength) {
+        *error = true;
+        return realLength;
+    }
+
+    // Convert the result to UTF-16.
+    UChar* utf16Target = result;
+    const char* utf8Source = utf8Result.get();
+    bool unusedISAllASCII;
+    conversionResult = convertUTF8ToUTF16(&utf8Source, utf8Source + utf8ResultLength, &utf16Target, utf16Target + resultLength, &unusedIsAllASCII, true);
+    long utf16ResultLength = utf16Target - result;
+    if (conversionResult != conversionOK)
+        *error = true;
+
+    return utf16ResultLength <= 0 ? -1 : utf16ResultLength;
+}
+int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+    return convertCase(result, resultLength, src, srcLength, error, g_utf8_casefold);
+}
+
+int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+    return convertCase(result, resultLength, src, srcLength, error, g_utf8_strdown);
+}
+
+int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+    return convertCase(result, resultLength, src, srcLength, error, g_utf8_strup);
+}
+
+Direction direction(UChar32 c)
+{
+    PangoBidiType type = pango_bidi_type_for_unichar(c);
+    switch (type) {
+    case PANGO_BIDI_TYPE_L:
+        return LeftToRight;
+    case PANGO_BIDI_TYPE_R:
+        return RightToLeft;
+    case PANGO_BIDI_TYPE_AL:
+        return RightToLeftArabic;
+    case PANGO_BIDI_TYPE_LRE:
+        return LeftToRightEmbedding;
+    case PANGO_BIDI_TYPE_RLE:
+        return RightToLeftEmbedding;
+    case PANGO_BIDI_TYPE_LRO:
+        return LeftToRightOverride;
+    case PANGO_BIDI_TYPE_RLO:
+        return RightToLeftOverride;
+    case PANGO_BIDI_TYPE_PDF:
+        return PopDirectionalFormat;
+    case PANGO_BIDI_TYPE_EN:
+        return EuropeanNumber;
+    case PANGO_BIDI_TYPE_AN:
+        return ArabicNumber;
+    case PANGO_BIDI_TYPE_ES:
+        return EuropeanNumberSeparator;
+    case PANGO_BIDI_TYPE_ET:
+        return EuropeanNumberTerminator;
+    case PANGO_BIDI_TYPE_CS:
+        return CommonNumberSeparator;
+    case PANGO_BIDI_TYPE_NSM:
+        return NonSpacingMark;
+    case PANGO_BIDI_TYPE_BN:
+        return BoundaryNeutral;
+    case PANGO_BIDI_TYPE_B:
+        return BlockSeparator;
+    case PANGO_BIDI_TYPE_S:
+        return SegmentSeparator;
+    case PANGO_BIDI_TYPE_WS:
+        return WhiteSpaceNeutral;
+    default:
+        return OtherNeutral;
+    }
+}
+
+int umemcasecmp(const UChar* a, const UChar* b, int len)
+{
+    GOwnPtr<char> utf8a;
+    GOwnPtr<char> utf8b;
+
+    utf8a.set(g_utf16_to_utf8(a, len, 0, 0, 0));
+    utf8b.set(g_utf16_to_utf8(b, len, 0, 0, 0));
+
+    GOwnPtr<char> foldedA;
+    GOwnPtr<char> foldedB;
+
+    foldedA.set(g_utf8_casefold(utf8a.get(), -1));
+    foldedB.set(g_utf8_casefold(utf8b.get(), -1));
+
+    // FIXME: umemcasecmp needs to mimic u_memcasecmp of icu
+    // from the ICU docs:
+    // "Compare two strings case-insensitively using full case folding.
+    // his is equivalent to u_strcmp(u_strFoldCase(s1, n, options), u_strFoldCase(s2, n, options))."
+    //
+    // So it looks like we don't need the full g_utf8_collate here,
+    // but really a bitwise comparison of casefolded unicode chars (not utf-8 bytes).
+    // As there is no direct equivalent to this icu function in GLib, for now
+    // we'll use g_utf8_collate():
+
+    return g_utf8_collate(foldedA.get(), foldedB.get());
+}
+
+}
+}
diff --git a/Source/WTF/wtf/unicode/glib/UnicodeGLib.h b/Source/WTF/wtf/unicode/glib/UnicodeGLib.h
new file mode 100644
index 0000000..89c9b1f
--- /dev/null
+++ b/Source/WTF/wtf/unicode/glib/UnicodeGLib.h
@@ -0,0 +1,233 @@
+/*
+ *  Copyright (C) 2006 George Staikos <staikos@kde.org>
+ *  Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ *  Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
+ *  Copyright (C) 2008 Jürg Billeter <j@bitron.ch>
+ *  Copyright (C) 2008 Dominik Röttsches <dominik.roettsches@access-company.com>
+ *
+ *  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 UnicodeGLib_h
+#define UnicodeGLib_h
+
+#include <wtf/gobject/GOwnPtr.h>
+#include <wtf/unicode/ScriptCodesFromICU.h>
+#include <wtf/unicode/UnicodeMacrosFromICU.h>
+
+#include <glib.h>
+#include <pango/pango.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+typedef uint16_t UChar;
+typedef int32_t UChar32;
+
+namespace WTF {
+namespace Unicode {
+
+enum Direction {
+    LeftToRight,
+    RightToLeft,
+    EuropeanNumber,
+    EuropeanNumberSeparator,
+    EuropeanNumberTerminator,
+    ArabicNumber,
+    CommonNumberSeparator,
+    BlockSeparator,
+    SegmentSeparator,
+    WhiteSpaceNeutral,
+    OtherNeutral,
+    LeftToRightEmbedding,
+    LeftToRightOverride,
+    RightToLeftArabic,
+    RightToLeftEmbedding,
+    RightToLeftOverride,
+    PopDirectionalFormat,
+    NonSpacingMark,
+    BoundaryNeutral
+};
+
+enum DecompositionType {
+    DecompositionNone,
+    DecompositionCanonical,
+    DecompositionCompat,
+    DecompositionCircle,
+    DecompositionFinal,
+    DecompositionFont,
+    DecompositionFraction,
+    DecompositionInitial,
+    DecompositionIsolated,
+    DecompositionMedial,
+    DecompositionNarrow,
+    DecompositionNoBreak,
+    DecompositionSmall,
+    DecompositionSquare,
+    DecompositionSub,
+    DecompositionSuper,
+    DecompositionVertical,
+    DecompositionWide,
+};
+
+enum CharCategory {
+    NoCategory =  0,
+    Other_NotAssigned = U_MASK(G_UNICODE_UNASSIGNED),
+    Letter_Uppercase = U_MASK(G_UNICODE_UPPERCASE_LETTER),
+    Letter_Lowercase = U_MASK(G_UNICODE_LOWERCASE_LETTER),
+    Letter_Titlecase = U_MASK(G_UNICODE_TITLECASE_LETTER),
+    Letter_Modifier = U_MASK(G_UNICODE_MODIFIER_LETTER),
+    Letter_Other = U_MASK(G_UNICODE_OTHER_LETTER),
+
+    Mark_NonSpacing = U_MASK(G_UNICODE_NON_SPACING_MARK),
+    Mark_Enclosing = U_MASK(G_UNICODE_ENCLOSING_MARK),
+    Mark_SpacingCombining = U_MASK(G_UNICODE_COMBINING_MARK),
+
+    Number_DecimalDigit = U_MASK(G_UNICODE_DECIMAL_NUMBER),
+    Number_Letter = U_MASK(G_UNICODE_LETTER_NUMBER),
+    Number_Other = U_MASK(G_UNICODE_OTHER_NUMBER),
+
+    Separator_Space = U_MASK(G_UNICODE_SPACE_SEPARATOR),
+    Separator_Line = U_MASK(G_UNICODE_LINE_SEPARATOR),
+    Separator_Paragraph = U_MASK(G_UNICODE_PARAGRAPH_SEPARATOR),
+
+    Other_Control = U_MASK(G_UNICODE_CONTROL),
+    Other_Format = U_MASK(G_UNICODE_FORMAT),
+    Other_PrivateUse = U_MASK(G_UNICODE_PRIVATE_USE),
+    Other_Surrogate = U_MASK(G_UNICODE_SURROGATE),
+
+    Punctuation_Dash = U_MASK(G_UNICODE_DASH_PUNCTUATION),
+    Punctuation_Open = U_MASK(G_UNICODE_OPEN_PUNCTUATION),
+    Punctuation_Close = U_MASK(G_UNICODE_CLOSE_PUNCTUATION),
+    Punctuation_Connector = U_MASK(G_UNICODE_CONNECT_PUNCTUATION),
+    Punctuation_Other = U_MASK(G_UNICODE_OTHER_PUNCTUATION),
+
+    Symbol_Math = U_MASK(G_UNICODE_MATH_SYMBOL),
+    Symbol_Currency = U_MASK(G_UNICODE_CURRENCY_SYMBOL),
+    Symbol_Modifier = U_MASK(G_UNICODE_MODIFIER_SYMBOL),
+    Symbol_Other = U_MASK(G_UNICODE_OTHER_SYMBOL),
+
+    Punctuation_InitialQuote = U_MASK(G_UNICODE_INITIAL_PUNCTUATION),
+    Punctuation_FinalQuote = U_MASK(G_UNICODE_FINAL_PUNCTUATION)
+};
+
+UChar32 foldCase(UChar32);
+
+int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error);
+
+int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error);
+
+inline UChar32 toLower(UChar32 c)
+{
+    return g_unichar_tolower(c);
+}
+
+inline UChar32 toUpper(UChar32 c)
+{
+    return g_unichar_toupper(c);
+}
+
+int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error);
+
+inline UChar32 toTitleCase(UChar32 c)
+{
+    return g_unichar_totitle(c);
+}
+
+inline bool isArabicChar(UChar32 c)
+{
+    return c >= 0x0600 && c <= 0x06FF;
+}
+
+inline bool isAlphanumeric(UChar32 c)
+{
+    return g_unichar_isalnum(c);
+}
+
+inline bool isFormatChar(UChar32 c)
+{
+    return g_unichar_type(c) == G_UNICODE_FORMAT;
+}
+
+inline bool isSeparatorSpace(UChar32 c)
+{
+    return g_unichar_type(c) == G_UNICODE_SPACE_SEPARATOR;
+}
+
+inline bool isPrintableChar(UChar32 c)
+{
+    return g_unichar_isprint(c);
+}
+
+inline bool isDigit(UChar32 c)
+{
+    return g_unichar_isdigit(c);
+}
+
+inline bool isPunct(UChar32 c)
+{
+    return g_unichar_ispunct(c);
+}
+
+inline bool hasLineBreakingPropertyComplexContext(UChar32 c)
+{
+    // FIXME
+    return false;
+}
+
+inline UChar32 mirroredChar(UChar32 c)
+{
+    gunichar mirror = 0;
+    g_unichar_get_mirror_char(c, &mirror);
+    return mirror;
+}
+
+inline CharCategory category(UChar32 c)
+{
+    if (c > 0xffff)
+        return NoCategory;
+
+    return (CharCategory) U_MASK(g_unichar_type(c));
+}
+
+Direction direction(UChar32);
+
+inline bool isLower(UChar32 c)
+{
+    return g_unichar_islower(c);
+}
+
+inline uint8_t combiningClass(UChar32 c)
+{
+    // FIXME
+    // return g_unichar_combining_class(c);
+    return 0;
+}
+
+inline DecompositionType decompositionType(UChar32 c)
+{
+    // FIXME
+    return DecompositionNone;
+}
+
+int umemcasecmp(const UChar*, const UChar*, int len);
+
+}
+}
+
+#endif
+
diff --git a/Source/WTF/wtf/unicode/icu/CollatorICU.cpp b/Source/WTF/wtf/unicode/icu/CollatorICU.cpp
new file mode 100644
index 0000000..72a8662
--- /dev/null
+++ b/Source/WTF/wtf/unicode/icu/CollatorICU.cpp
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2008 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.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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 "config.h"
+#include <wtf/unicode/Collator.h>
+
+#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+
+#include <wtf/Assertions.h>
+#include <wtf/StringExtras.h>
+#include <wtf/Threading.h>
+#include <unicode/ucol.h>
+#include <string.h>
+
+#if OS(DARWIN)
+#include <wtf/RetainPtr.h>
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
+namespace WTF {
+
+static UCollator* cachedCollator;
+static Mutex& cachedCollatorMutex()
+{
+    AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
+    return mutex;
+}
+
+Collator::Collator(const char* locale)
+    : m_collator(0)
+    , m_locale(locale ? strdup(locale) : 0)
+    , m_lowerFirst(false)
+{
+}
+
+PassOwnPtr<Collator> Collator::userDefault()
+{
+#if OS(DARWIN) && USE(CF)
+    // Mac OS X doesn't set UNIX locale to match user-selected one, so ICU default doesn't work.
+#if !OS(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
+    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)
+        return adoptPtr(new Collator(""));
+    CFStringGetCString(collationOrder, buf, sizeof(buf), kCFStringEncodingASCII);
+    return adoptPtr(new Collator(buf));
+#else
+    return adoptPtr(new Collator(0));
+#endif
+}
+
+Collator::~Collator()
+{
+    releaseCollator();
+    free(m_locale);
+}
+
+void Collator::setOrderLowerFirst(bool lowerFirst)
+{
+    m_lowerFirst = lowerFirst;
+}
+
+Collator::Result Collator::collate(const UChar* lhs, size_t lhsLength, const UChar* rhs, size_t rhsLength) const
+{
+    if (!m_collator)
+        createCollator();
+
+    return static_cast<Result>(ucol_strcoll(m_collator, lhs, lhsLength, rhs, rhsLength));
+}
+
+void Collator::createCollator() const
+{
+    ASSERT(!m_collator);
+    UErrorCode status = U_ZERO_ERROR;
+
+    {
+        Locker<Mutex> lock(cachedCollatorMutex());
+        if (cachedCollator) {
+            const char* cachedCollatorLocale = ucol_getLocaleByType(cachedCollator, ULOC_REQUESTED_LOCALE, &status);
+            ASSERT(U_SUCCESS(status));
+            ASSERT(cachedCollatorLocale);
+
+            UColAttributeValue cachedCollatorLowerFirst = ucol_getAttribute(cachedCollator, UCOL_CASE_FIRST, &status);
+            ASSERT(U_SUCCESS(status));
+
+            // FIXME: default locale is never matched, because ucol_getLocaleByType returns the actual one used, not 0.
+            if (m_locale && 0 == strcmp(cachedCollatorLocale, m_locale)
+                && ((UCOL_LOWER_FIRST == cachedCollatorLowerFirst && m_lowerFirst) || (UCOL_UPPER_FIRST == cachedCollatorLowerFirst && !m_lowerFirst))) {
+                m_collator = cachedCollator;
+                cachedCollator = 0;
+                return;
+            }
+        }
+    }
+
+    m_collator = ucol_open(m_locale, &status);
+    if (U_FAILURE(status)) {
+        status = U_ZERO_ERROR;
+        m_collator = ucol_open("", &status); // Fallback to Unicode Collation Algorithm.
+    }
+    ASSERT(U_SUCCESS(status));
+
+    ucol_setAttribute(m_collator, UCOL_CASE_FIRST, m_lowerFirst ? UCOL_LOWER_FIRST : UCOL_UPPER_FIRST, &status);
+    ASSERT(U_SUCCESS(status));
+
+    ucol_setAttribute(m_collator, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
+    ASSERT(U_SUCCESS(status));
+}
+
+void Collator::releaseCollator()
+{
+    {
+        Locker<Mutex> lock(cachedCollatorMutex());
+        if (cachedCollator)
+            ucol_close(cachedCollator);
+        cachedCollator = m_collator;
+        m_collator  = 0;
+    }
+}
+
+}
+
+#endif
diff --git a/Source/WTF/wtf/unicode/icu/UnicodeIcu.h b/Source/WTF/wtf/unicode/icu/UnicodeIcu.h
new file mode 100644
index 0000000..962e732
--- /dev/null
+++ b/Source/WTF/wtf/unicode/icu/UnicodeIcu.h
@@ -0,0 +1,230 @@
+/*
+ *  Copyright (C) 2006 George Staikos <staikos@kde.org>
+ *  Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ *  Copyright (C) 2006, 2007, 2008, 2009 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_UNICODE_ICU_H
+#define WTF_UNICODE_ICU_H
+
+#include <stdlib.h>
+#include <unicode/uchar.h>
+#include <unicode/uscript.h>
+#include <unicode/ustring.h>
+#include <unicode/utf16.h>
+
+namespace WTF {
+namespace Unicode {
+
+enum Direction {
+    LeftToRight = U_LEFT_TO_RIGHT,
+    RightToLeft = U_RIGHT_TO_LEFT,
+    EuropeanNumber = U_EUROPEAN_NUMBER,
+    EuropeanNumberSeparator = U_EUROPEAN_NUMBER_SEPARATOR,
+    EuropeanNumberTerminator = U_EUROPEAN_NUMBER_TERMINATOR,
+    ArabicNumber = U_ARABIC_NUMBER,
+    CommonNumberSeparator = U_COMMON_NUMBER_SEPARATOR,
+    BlockSeparator = U_BLOCK_SEPARATOR,
+    SegmentSeparator = U_SEGMENT_SEPARATOR,
+    WhiteSpaceNeutral = U_WHITE_SPACE_NEUTRAL,
+    OtherNeutral = U_OTHER_NEUTRAL,
+    LeftToRightEmbedding = U_LEFT_TO_RIGHT_EMBEDDING,
+    LeftToRightOverride = U_LEFT_TO_RIGHT_OVERRIDE,
+    RightToLeftArabic = U_RIGHT_TO_LEFT_ARABIC,
+    RightToLeftEmbedding = U_RIGHT_TO_LEFT_EMBEDDING,
+    RightToLeftOverride = U_RIGHT_TO_LEFT_OVERRIDE,
+    PopDirectionalFormat = U_POP_DIRECTIONAL_FORMAT,
+    NonSpacingMark = U_DIR_NON_SPACING_MARK,
+    BoundaryNeutral = U_BOUNDARY_NEUTRAL
+};
+
+enum DecompositionType {
+    DecompositionNone = U_DT_NONE,
+    DecompositionCanonical = U_DT_CANONICAL,
+    DecompositionCompat = U_DT_COMPAT,
+    DecompositionCircle = U_DT_CIRCLE,
+    DecompositionFinal = U_DT_FINAL,
+    DecompositionFont = U_DT_FONT,
+    DecompositionFraction = U_DT_FRACTION,
+    DecompositionInitial = U_DT_INITIAL,
+    DecompositionIsolated = U_DT_ISOLATED,
+    DecompositionMedial = U_DT_MEDIAL,
+    DecompositionNarrow = U_DT_NARROW,
+    DecompositionNoBreak = U_DT_NOBREAK,
+    DecompositionSmall = U_DT_SMALL,
+    DecompositionSquare = U_DT_SQUARE,
+    DecompositionSub = U_DT_SUB,
+    DecompositionSuper = U_DT_SUPER,
+    DecompositionVertical = U_DT_VERTICAL,
+    DecompositionWide = U_DT_WIDE,
+};
+
+enum CharCategory {
+    NoCategory =  0,
+    Other_NotAssigned = U_MASK(U_GENERAL_OTHER_TYPES),
+    Letter_Uppercase = U_MASK(U_UPPERCASE_LETTER),
+    Letter_Lowercase = U_MASK(U_LOWERCASE_LETTER),
+    Letter_Titlecase = U_MASK(U_TITLECASE_LETTER),
+    Letter_Modifier = U_MASK(U_MODIFIER_LETTER),
+    Letter_Other = U_MASK(U_OTHER_LETTER),
+
+    Mark_NonSpacing = U_MASK(U_NON_SPACING_MARK),
+    Mark_Enclosing = U_MASK(U_ENCLOSING_MARK),
+    Mark_SpacingCombining = U_MASK(U_COMBINING_SPACING_MARK),
+
+    Number_DecimalDigit = U_MASK(U_DECIMAL_DIGIT_NUMBER),
+    Number_Letter = U_MASK(U_LETTER_NUMBER),
+    Number_Other = U_MASK(U_OTHER_NUMBER),
+
+    Separator_Space = U_MASK(U_SPACE_SEPARATOR),
+    Separator_Line = U_MASK(U_LINE_SEPARATOR),
+    Separator_Paragraph = U_MASK(U_PARAGRAPH_SEPARATOR),
+
+    Other_Control = U_MASK(U_CONTROL_CHAR),
+    Other_Format = U_MASK(U_FORMAT_CHAR),
+    Other_PrivateUse = U_MASK(U_PRIVATE_USE_CHAR),
+    Other_Surrogate = U_MASK(U_SURROGATE),
+
+    Punctuation_Dash = U_MASK(U_DASH_PUNCTUATION),
+    Punctuation_Open = U_MASK(U_START_PUNCTUATION),
+    Punctuation_Close = U_MASK(U_END_PUNCTUATION),
+    Punctuation_Connector = U_MASK(U_CONNECTOR_PUNCTUATION),
+    Punctuation_Other = U_MASK(U_OTHER_PUNCTUATION),
+
+    Symbol_Math = U_MASK(U_MATH_SYMBOL),
+    Symbol_Currency = U_MASK(U_CURRENCY_SYMBOL),
+    Symbol_Modifier = U_MASK(U_MODIFIER_SYMBOL),
+    Symbol_Other = U_MASK(U_OTHER_SYMBOL),
+
+    Punctuation_InitialQuote = U_MASK(U_INITIAL_PUNCTUATION),
+    Punctuation_FinalQuote = U_MASK(U_FINAL_PUNCTUATION)
+};
+
+inline UChar32 foldCase(UChar32 c)
+{
+    return u_foldCase(c, U_FOLD_CASE_DEFAULT);
+}
+
+inline int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+    UErrorCode status = U_ZERO_ERROR;
+    int realLength = u_strFoldCase(result, resultLength, src, srcLength, U_FOLD_CASE_DEFAULT, &status);
+    *error = !U_SUCCESS(status);
+    return realLength;
+}
+
+inline int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+    UErrorCode status = U_ZERO_ERROR;
+    int realLength = u_strToLower(result, resultLength, src, srcLength, "", &status);
+    *error = !!U_FAILURE(status);
+    return realLength;
+}
+
+inline UChar32 toLower(UChar32 c)
+{
+    return u_tolower(c);
+}
+
+inline UChar32 toUpper(UChar32 c)
+{
+    return u_toupper(c);
+}
+
+inline int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
+{
+    UErrorCode status = U_ZERO_ERROR;
+    int realLength = u_strToUpper(result, resultLength, src, srcLength, "", &status);
+    *error = !!U_FAILURE(status);
+    return realLength;
+}
+
+inline UChar32 toTitleCase(UChar32 c)
+{
+    return u_totitle(c);
+}
+
+inline bool isArabicChar(UChar32 c)
+{
+      return ublock_getCode(c) == UBLOCK_ARABIC;
+}
+
+inline bool isAlphanumeric(UChar32 c)
+{
+    return u_isalnum(c);
+}
+
+inline bool isSeparatorSpace(UChar32 c)
+{
+    return u_charType(c) == U_SPACE_SEPARATOR;
+}
+
+inline bool isPrintableChar(UChar32 c)
+{
+    return !!u_isprint(c);
+}
+
+inline bool isPunct(UChar32 c)
+{
+    return !!u_ispunct(c);
+}
+
+inline bool hasLineBreakingPropertyComplexContext(UChar32 c)
+{
+    return u_getIntPropertyValue(c, UCHAR_LINE_BREAK) == U_LB_COMPLEX_CONTEXT;
+}
+
+inline UChar32 mirroredChar(UChar32 c)
+{
+    return u_charMirror(c);
+}
+
+inline CharCategory category(UChar32 c)
+{
+    return static_cast<CharCategory>(U_GET_GC_MASK(c));
+}
+
+inline Direction direction(UChar32 c)
+{
+    return static_cast<Direction>(u_charDirection(c));
+}
+
+inline bool isLower(UChar32 c)
+{
+    return !!u_islower(c);
+}
+
+inline uint8_t combiningClass(UChar32 c)
+{
+    return u_getCombiningClass(c);
+}
+
+inline DecompositionType decompositionType(UChar32 c)
+{
+    return static_cast<DecompositionType>(u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE));
+}
+
+inline int umemcasecmp(const UChar* a, const UChar* b, int len)
+{
+    return u_memcasecmp(a, b, len, U_FOLD_CASE_DEFAULT);
+}
+
+} }
+
+#endif // WTF_UNICODE_ICU_H
diff --git a/Source/WTF/wtf/unicode/qt4/UnicodeQt4.h b/Source/WTF/wtf/unicode/qt4/UnicodeQt4.h
new file mode 100644
index 0000000..a2d1ad4
--- /dev/null
+++ b/Source/WTF/wtf/unicode/qt4/UnicodeQt4.h
@@ -0,0 +1,377 @@
+/*
+ *  Copyright (C) 2006 George Staikos <staikos@kde.org>
+ *  Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ *  Copyright (C) 2006, 2007, 2008, 2009 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_UNICODE_QT4_H
+#define WTF_UNICODE_QT4_H
+
+#include <wtf/unicode/ScriptCodesFromICU.h>
+#include <wtf/unicode/UnicodeMacrosFromICU.h>
+
+#include <QChar>
+#include <QString>
+
+#include <config.h>
+
+#include <stdint.h>
+#if USE(ICU_UNICODE)
+#include <unicode/ubrk.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+namespace QUnicodeTables {
+    struct Properties {
+        ushort category : 8;
+        ushort line_break_class : 8;
+        ushort direction : 8;
+        ushort combiningClass :8;
+        ushort joining : 2;
+        signed short digitValue : 6; /* 5 needed */
+        ushort unicodeVersion : 4;
+        ushort lowerCaseSpecial : 1;
+        ushort upperCaseSpecial : 1;
+        ushort titleCaseSpecial : 1;
+        ushort caseFoldSpecial : 1; /* currently unused */
+        signed short mirrorDiff : 16;
+        signed short lowerCaseDiff : 16;
+        signed short upperCaseDiff : 16;
+        signed short titleCaseDiff : 16;
+        signed short caseFoldDiff : 16;
+    };
+    Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4);
+    Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2);
+}
+QT_END_NAMESPACE
+
+// ugly hack to make UChar compatible with JSChar in API/JSStringRef.h
+#if defined(Q_OS_WIN) || (COMPILER(RVCT) && !OS(LINUX))
+typedef wchar_t UChar;
+#else
+typedef uint16_t UChar;
+#endif
+
+#if !USE(ICU_UNICODE)
+typedef uint32_t UChar32;
+#endif
+
+namespace WTF {
+namespace Unicode {
+
+enum Direction {
+    LeftToRight = QChar::DirL,
+    RightToLeft = QChar::DirR,
+    EuropeanNumber = QChar::DirEN,
+    EuropeanNumberSeparator = QChar::DirES,
+    EuropeanNumberTerminator = QChar::DirET,
+    ArabicNumber = QChar::DirAN,
+    CommonNumberSeparator = QChar::DirCS,
+    BlockSeparator = QChar::DirB,
+    SegmentSeparator = QChar::DirS,
+    WhiteSpaceNeutral = QChar::DirWS,
+    OtherNeutral = QChar::DirON,
+    LeftToRightEmbedding = QChar::DirLRE,
+    LeftToRightOverride = QChar::DirLRO,
+    RightToLeftArabic = QChar::DirAL,
+    RightToLeftEmbedding = QChar::DirRLE,
+    RightToLeftOverride = QChar::DirRLO,
+    PopDirectionalFormat = QChar::DirPDF,
+    NonSpacingMark = QChar::DirNSM,
+    BoundaryNeutral = QChar::DirBN
+};
+
+enum DecompositionType {
+    DecompositionNone = QChar::NoDecomposition,
+    DecompositionCanonical = QChar::Canonical,
+    DecompositionCompat = QChar::Compat,
+    DecompositionCircle = QChar::Circle,
+    DecompositionFinal = QChar::Final,
+    DecompositionFont = QChar::Font,
+    DecompositionFraction = QChar::Fraction,
+    DecompositionInitial = QChar::Initial,
+    DecompositionIsolated = QChar::Isolated,
+    DecompositionMedial = QChar::Medial,
+    DecompositionNarrow = QChar::Narrow,
+    DecompositionNoBreak = QChar::NoBreak,
+    DecompositionSmall = QChar::Small,
+    DecompositionSquare = QChar::Square,
+    DecompositionSub = QChar::Sub,
+    DecompositionSuper = QChar::Super,
+    DecompositionVertical = QChar::Vertical,
+    DecompositionWide = QChar::Wide
+};
+
+enum CharCategory {
+    NoCategory = 0,
+    Mark_NonSpacing = U_MASK(QChar::Mark_NonSpacing),
+    Mark_SpacingCombining = U_MASK(QChar::Mark_SpacingCombining),
+    Mark_Enclosing = U_MASK(QChar::Mark_Enclosing),
+    Number_DecimalDigit = U_MASK(QChar::Number_DecimalDigit),
+    Number_Letter = U_MASK(QChar::Number_Letter),
+    Number_Other = U_MASK(QChar::Number_Other),
+    Separator_Space = U_MASK(QChar::Separator_Space),
+    Separator_Line = U_MASK(QChar::Separator_Line),
+    Separator_Paragraph = U_MASK(QChar::Separator_Paragraph),
+    Other_Control = U_MASK(QChar::Other_Control),
+    Other_Format = U_MASK(QChar::Other_Format),
+    Other_Surrogate = U_MASK(QChar::Other_Surrogate),
+    Other_PrivateUse = U_MASK(QChar::Other_PrivateUse),
+    Other_NotAssigned = U_MASK(QChar::Other_NotAssigned),
+    Letter_Uppercase = U_MASK(QChar::Letter_Uppercase),
+    Letter_Lowercase = U_MASK(QChar::Letter_Lowercase),
+    Letter_Titlecase = U_MASK(QChar::Letter_Titlecase),
+    Letter_Modifier = U_MASK(QChar::Letter_Modifier),
+    Letter_Other = U_MASK(QChar::Letter_Other),
+    Punctuation_Connector = U_MASK(QChar::Punctuation_Connector),
+    Punctuation_Dash = U_MASK(QChar::Punctuation_Dash),
+    Punctuation_Open = U_MASK(QChar::Punctuation_Open),
+    Punctuation_Close = U_MASK(QChar::Punctuation_Close),
+    Punctuation_InitialQuote = U_MASK(QChar::Punctuation_InitialQuote),
+    Punctuation_FinalQuote = U_MASK(QChar::Punctuation_FinalQuote),
+    Punctuation_Other = U_MASK(QChar::Punctuation_Other),
+    Symbol_Math = U_MASK(QChar::Symbol_Math),
+    Symbol_Currency = U_MASK(QChar::Symbol_Currency),
+    Symbol_Modifier = U_MASK(QChar::Symbol_Modifier),
+    Symbol_Other = U_MASK(QChar::Symbol_Other)
+};
+
+
+// FIXME: handle surrogates correctly in all methods
+
+inline UChar32 toLower(UChar32 ch)
+{
+    return QChar::toLower(uint32_t(ch));
+}
+
+inline int toLower(UChar* result, int resultLength, const UChar* src, int srcLength,  bool* error)
+{
+    const UChar *e = src + srcLength;
+    const UChar *s = src;
+    UChar *r = result;
+    uint rindex = 0;
+
+    // this avoids one out of bounds check in the loop
+    if (s < e && QChar(*s).isLowSurrogate()) {
+        if (r)
+            r[rindex] = *s++;
+        ++rindex;
+    }
+
+    int needed = 0;
+    while (s < e && (rindex < uint(resultLength) || !r)) {
+        uint c = *s;
+        if (QChar(c).isLowSurrogate() && QChar(*(s - 1)).isHighSurrogate())
+            c = QChar::surrogateToUcs4(*(s - 1), c);
+        const QUnicodeTables::Properties *prop = QUnicodeTables::properties(c);
+        if (prop->lowerCaseSpecial) {
+            QString qstring;
+            if (c < 0x10000) {
+                qstring += QChar(c);
+            } else {
+                qstring += QChar(*(s-1));
+                qstring += QChar(*s);
+            }
+            qstring = qstring.toLower();
+            for (int i = 0; i < qstring.length(); ++i) {
+                if (rindex >= uint(resultLength)) {
+                    needed += qstring.length() - i;
+                    break;
+                }
+                if (r)
+                    r[rindex] = qstring.at(i).unicode();
+                ++rindex;
+            }
+        } else {
+            if (r)
+                r[rindex] = *s + prop->lowerCaseDiff;
+            ++rindex;
+        }
+        ++s;
+    }
+    if (s < e)
+        needed += e - s;
+    *error = (needed != 0);
+    if (rindex < uint(resultLength))
+        r[rindex] = 0;
+    return rindex + needed;
+}
+
+inline UChar32 toUpper(UChar32 c)
+{
+    return QChar::toUpper(uint32_t(c));
+}
+
+inline int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength,  bool* error)
+{
+    const UChar *e = src + srcLength;
+    const UChar *s = src;
+    UChar *r = result;
+    int rindex = 0;
+
+    // this avoids one out of bounds check in the loop
+    if (s < e && QChar(*s).isLowSurrogate()) {
+        if (r)
+            r[rindex] = *s++;
+        ++rindex;
+    }
+
+    int needed = 0;
+    while (s < e && (rindex < resultLength || !r)) {
+        uint c = *s;
+        if (QChar(c).isLowSurrogate() && QChar(*(s - 1)).isHighSurrogate())
+            c = QChar::surrogateToUcs4(*(s - 1), c);
+        const QUnicodeTables::Properties *prop = QUnicodeTables::properties(c);
+        if (prop->upperCaseSpecial) {
+            QString qstring;
+            if (c < 0x10000) {
+                qstring += QChar(c);
+            } else {
+                qstring += QChar(*(s-1));
+                qstring += QChar(*s);
+            }
+            qstring = qstring.toUpper();
+            for (int i = 0; i < qstring.length(); ++i) {
+                if (rindex >= resultLength) {
+                    needed += qstring.length() - i;
+                    break;
+                }
+                if (r)
+                    r[rindex] = qstring.at(i).unicode();
+                ++rindex;
+            }
+        } else {
+            if (r)
+                r[rindex] = *s + prop->upperCaseDiff;
+            ++rindex;
+        }
+        ++s;
+    }
+    if (s < e)
+        needed += e - s;
+    *error = (needed != 0);
+    if (rindex < resultLength)
+        r[rindex] = 0;
+    return rindex + needed;
+}
+
+inline int toTitleCase(UChar32 c)
+{
+    return QChar::toTitleCase(uint32_t(c));
+}
+
+inline UChar32 foldCase(UChar32 c)
+{
+    return QChar::toCaseFolded(uint32_t(c));
+}
+
+inline int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength,  bool* error)
+{
+    // FIXME: handle special casing. Easiest with some low level API in Qt
+    *error = false;
+    if (resultLength < srcLength) {
+        *error = true;
+        return srcLength;
+    }
+    for (int i = 0; i < srcLength; ++i)
+        result[i] = QChar::toCaseFolded(ushort(src[i]));
+    return srcLength;
+}
+
+inline bool isArabicChar(UChar32 c)
+{
+    return c >= 0x0600 && c <= 0x06FF;
+}
+
+inline bool isPrintableChar(UChar32 c)
+{
+    const uint test = U_MASK(QChar::Other_Control) |
+                      U_MASK(QChar::Other_NotAssigned);
+    return !(U_MASK(QChar::category(uint32_t(c))) & test);
+}
+
+inline bool isSeparatorSpace(UChar32 c)
+{
+    return QChar::category(uint32_t(c)) == QChar::Separator_Space;
+}
+
+inline bool isPunct(UChar32 c)
+{
+    const uint test = U_MASK(QChar::Punctuation_Connector) |
+                      U_MASK(QChar::Punctuation_Dash) |
+                      U_MASK(QChar::Punctuation_Open) |
+                      U_MASK(QChar::Punctuation_Close) |
+                      U_MASK(QChar::Punctuation_InitialQuote) |
+                      U_MASK(QChar::Punctuation_FinalQuote) |
+                      U_MASK(QChar::Punctuation_Other);
+    return U_MASK(QChar::category(uint32_t(c))) & test;
+}
+
+inline bool isLower(UChar32 c)
+{
+    return QChar::category(uint32_t(c)) == QChar::Letter_Lowercase;
+}
+
+inline bool hasLineBreakingPropertyComplexContext(UChar32)
+{
+    // FIXME: Implement this to return whether the character has line breaking property SA (Complex Context).
+    return false;
+}
+
+inline UChar32 mirroredChar(UChar32 c)
+{
+    return QChar::mirroredChar(uint32_t(c));
+}
+
+inline uint8_t combiningClass(UChar32 c)
+{
+    return QChar::combiningClass(uint32_t(c));
+}
+
+inline DecompositionType decompositionType(UChar32 c)
+{
+    return (DecompositionType)QChar::decompositionTag(c);
+}
+
+inline int umemcasecmp(const UChar* a, const UChar* b, int len)
+{
+    // handle surrogates correctly
+    for (int i = 0; i < len; ++i) {
+        uint c1 = QChar::toCaseFolded(ushort(a[i]));
+        uint c2 = QChar::toCaseFolded(ushort(b[i]));
+        if (c1 != c2)
+            return c1 - c2;
+    }
+    return 0;
+}
+
+inline Direction direction(UChar32 c)
+{
+    return (Direction)QChar::direction(uint32_t(c));
+}
+
+inline CharCategory category(UChar32 c)
+{
+    return (CharCategory) U_MASK(QChar::category(uint32_t(c)));
+}
+
+} // namespace Unicode
+} // namespace WTF
+
+#endif // WTF_UNICODE_QT4_H
diff --git a/Source/WTF/wtf/unicode/wchar/UnicodeWchar.cpp b/Source/WTF/wtf/unicode/wchar/UnicodeWchar.cpp
new file mode 100644
index 0000000..e975c3b
--- /dev/null
+++ b/Source/WTF/wtf/unicode/wchar/UnicodeWchar.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
+ *
+ * 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 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 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 "config.h"
+#include "UnicodeWchar.h"
+
+#include <algorithm>
+
+namespace WTF {
+namespace Unicode {
+
+CharCategory category(UChar32)
+{
+    return NoCategory; // FIXME: implement!
+}
+
+unsigned char combiningClass(UChar32)
+{
+    return 0; // FIXME: implement!
+}
+
+Direction direction(UChar32)
+{
+    return LeftToRight; // FIXME: implement!
+}
+
+DecompositionType decompositionType(UChar32)
+{
+    return DecompositionNone; // FIXME: implement!
+}
+
+bool hasLineBreakingPropertyComplexContext(UChar32)
+{
+    return false; // FIXME: implement!
+}
+
+UChar32 mirroredChar(UChar32 c)
+{
+    return c; // FIXME: implement!
+}
+
+template<UChar Function(UChar)>
+static inline int convertWithFunction(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+    UChar* resultIterator = result;
+    UChar* resultEnd = result + std::min(resultLength, sourceLength);
+    while (resultIterator < resultEnd)
+        *resultIterator++ = Function(*source++);
+
+    if (sourceLength < resultLength)
+        *resultIterator = '\0';
+
+    *isError = sourceLength > resultLength;
+    return sourceLength;
+}
+
+int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+    return convertWithFunction<foldCase>(result, resultLength, source, sourceLength, isError);
+}
+
+int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+    return convertWithFunction<toLower>(result, resultLength, source, sourceLength, isError);
+}
+
+int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
+{
+    return convertWithFunction<toUpper>(result, resultLength, source, sourceLength, isError);
+}
+
+} // namespace Unicode
+} // namespace WTF
diff --git a/Source/WTF/wtf/unicode/wchar/UnicodeWchar.h b/Source/WTF/wtf/unicode/wchar/UnicodeWchar.h
new file mode 100644
index 0000000..10c2026
--- /dev/null
+++ b/Source/WTF/wtf/unicode/wchar/UnicodeWchar.h
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
+ *
+ * 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 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 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.
+ */
+
+#ifndef WTF_UnicodeWchar_h
+#define WTF_UnicodeWchar_h
+
+#include <stdint.h>
+#include <wchar.h>
+#include <wtf/unicode/ScriptCodesFromICU.h>
+#include <wtf/unicode/UnicodeMacrosFromICU.h>
+
+typedef wchar_t UChar;
+typedef uint32_t UChar32;
+
+namespace WTF {
+namespace Unicode {
+
+enum Direction {
+    LeftToRight,
+    RightToLeft,
+    EuropeanNumber,
+    EuropeanNumberSeparator,
+    EuropeanNumberTerminator,
+    ArabicNumber,
+    CommonNumberSeparator,
+    BlockSeparator,
+    SegmentSeparator,
+    WhiteSpaceNeutral,
+    OtherNeutral,
+    LeftToRightEmbedding,
+    LeftToRightOverride,
+    RightToLeftArabic,
+    RightToLeftEmbedding,
+    RightToLeftOverride,
+    PopDirectionalFormat,
+    NonSpacingMark,
+    BoundaryNeutral
+};
+
+enum DecompositionType {
+    DecompositionNone,
+    DecompositionCanonical,
+    DecompositionCompat,
+    DecompositionCircle,
+    DecompositionFinal,
+    DecompositionFont,
+    DecompositionFraction,
+    DecompositionInitial,
+    DecompositionIsolated,
+    DecompositionMedial,
+    DecompositionNarrow,
+    DecompositionNoBreak,
+    DecompositionSmall,
+    DecompositionSquare,
+    DecompositionSub,
+    DecompositionSuper,
+    DecompositionVertical,
+    DecompositionWide
+};
+
+enum CharCategory {
+    NoCategory = 0,
+    Other_NotAssigned = U_MASK(0),
+    Letter_Uppercase = U_MASK(1),
+    Letter_Lowercase = U_MASK(2),
+    Letter_Titlecase = U_MASK(3),
+    Letter_Modifier = U_MASK(4),
+    Letter_Other = U_MASK(5),
+
+    Mark_NonSpacing = U_MASK(6),
+    Mark_Enclosing = U_MASK(7),
+    Mark_SpacingCombining = U_MASK(8),
+
+    Number_DecimalDigit = U_MASK(9),
+    Number_Letter = U_MASK(10),
+    Number_Other = U_MASK(11),
+
+    Separator_Space = U_MASK(12),
+    Separator_Line = U_MASK(13),
+    Separator_Paragraph = U_MASK(14),
+
+    Other_Control = U_MASK(15),
+    Other_Format = U_MASK(16),
+    Other_PrivateUse = U_MASK(17),
+    Other_Surrogate = U_MASK(18),
+
+    Punctuation_Dash = U_MASK(19),
+    Punctuation_Open = U_MASK(20),
+    Punctuation_Close = U_MASK(21),
+    Punctuation_Connector = U_MASK(22),
+    Punctuation_Other = U_MASK(23),
+
+    Symbol_Math = U_MASK(24),
+    Symbol_Currency = U_MASK(25),
+    Symbol_Modifier = U_MASK(26),
+    Symbol_Other = U_MASK(27),
+
+    Punctuation_InitialQuote = U_MASK(28),
+    Punctuation_FinalQuote = U_MASK(29)
+};
+
+
+WTF_EXPORT_PRIVATE CharCategory category(UChar32);
+WTF_EXPORT_PRIVATE unsigned char combiningClass(UChar32);
+WTF_EXPORT_PRIVATE Direction direction(UChar32);
+WTF_EXPORT_PRIVATE DecompositionType decompositionType(UChar32);
+WTF_EXPORT_PRIVATE bool hasLineBreakingPropertyComplexContext(UChar32);
+WTF_EXPORT_PRIVATE UChar32 mirroredChar(UChar32);
+
+inline bool isAlphanumeric(UChar c) { return !!iswalnum(c); }
+inline bool isDigit(UChar c) { return !!iswdigit(c); }
+inline bool isLetter(UChar c) { return !!iswalpha(c); }
+inline bool isLower(UChar c) { return !!iswlower(c); }
+inline bool isPrintableChar(UChar c) { return !!iswprint(c); }
+inline bool isPunct(UChar c) { return !!iswpunct(c); }
+inline bool isSpace(UChar c) { return !!iswspace(c); }
+inline bool isUpper(UChar c) { return !!iswupper(c); }
+
+inline bool isArabicChar(UChar32 c) { return c >= 0x0600 && c <= 0x06ff; }
+inline bool isSeparatorSpace(UChar32 c) { return category(c) == Separator_Space; }
+
+inline UChar foldCase(UChar c) { return towlower(c); }
+inline UChar toLower(UChar c) { return towlower(c); }
+inline UChar toUpper(UChar c) { return towupper(c); }
+inline UChar toTitleCase(UChar c) { return towupper(c); }
+
+WTF_EXPORT_PRIVATE int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+WTF_EXPORT_PRIVATE int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+WTF_EXPORT_PRIVATE int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
+
+inline int umemcasecmp(const UChar* a, const UChar* b, int len)
+{
+    for (int i = 0; i < len; ++i) {
+        UChar c1 = foldCase(a[i]);
+        UChar c2 = foldCase(b[i]);
+        if (c1 != c2)
+            return c1 - c2;
+    }
+
+    return 0;
+}
+
+} // namespace Unicode
+} // namespace WTF
+
+#endif // WTF_UnicodeWchar_h
diff --git a/Source/WTF/wtf/url/api/ParsedURL.cpp b/Source/WTF/wtf/url/api/ParsedURL.cpp
new file mode 100644
index 0000000..c4a5669
--- /dev/null
+++ b/Source/WTF/wtf/url/api/ParsedURL.cpp
@@ -0,0 +1,359 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ * Copyright (C) 2012 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. ``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
+ * 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 "ParsedURL.h"
+
+#if USE(WTFURL)
+
+#include <wtf/DataLog.h>
+#include <wtf/RawURLBuffer.h>
+#include <wtf/URLComponent.h>
+#include <wtf/URLUtil.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/StringImpl.h>
+
+namespace WTF {
+
+ParsedURL::ParsedURL(const String& urlString, ParsedURLStringTag)
+{
+    unsigned urlStringLength = urlString.length();
+    if (!urlStringLength)
+        return; // FIXME: we should ASSERT on this, but people use KURL incorrectly with ParsedURLStringTag :(.
+
+    RawURLBuffer<char> outputBuffer;
+    String base;
+    const CString& baseStr = base.utf8();
+    bool isValid = false;
+    URLSegments baseSegments;
+
+    // FIXME: we should take shortcuts here! We do not have to resolve the relative part.
+    if (urlString.is8Bit())
+        isValid = URLUtilities::resolveRelative(baseStr.data(), baseSegments,
+                                                reinterpret_cast<const char*>(urlString.characters8()), urlStringLength,
+                                                /* charsetConverter */ 0,
+                                                outputBuffer, &m_segments);
+    else
+        isValid = URLUtilities::resolveRelative(baseStr.data(), baseSegments,
+                                                urlString.characters16(), urlStringLength,
+                                                /* charsetConverter */ 0,
+                                                outputBuffer, &m_segments);
+
+    // FIXME: we should ASSERT on isValid, but people use KURL incorrectly with ParsedURLStringTag :(.
+    if (isValid)
+        m_spec = URLString(String(outputBuffer.data(), outputBuffer.length()));
+}
+
+ParsedURL::ParsedURL(const String& urlString, URLQueryCharsetConverter* queryCharsetConverter)
+{
+    unsigned urlStringLength = urlString.length();
+    if (!urlStringLength)
+        return;
+
+    RawURLBuffer<char> outputBuffer;
+    String base;
+    const CString& baseStr = base.utf8();
+    bool isValid = false;
+    URLSegments baseSegments;
+
+    // FIXME: we should take shortcuts here! We do not have to resolve the relative part.
+    if (urlString.is8Bit())
+        isValid = URLUtilities::resolveRelative(baseStr.data(), baseSegments,
+                                                reinterpret_cast<const char*>(urlString.characters8()), urlStringLength,
+                                                queryCharsetConverter,
+                                                outputBuffer, &m_segments);
+    else
+        isValid = URLUtilities::resolveRelative(baseStr.data(), baseSegments,
+                                                urlString.characters16(), urlStringLength,
+                                                queryCharsetConverter,
+                                                outputBuffer, &m_segments);
+
+    if (isValid)
+        m_spec = URLString(String(outputBuffer.data(), outputBuffer.length()));
+}
+
+ParsedURL::ParsedURL(const ParsedURL& base, const String& relative, URLQueryCharsetConverter* queryCharsetConverter)
+{
+    if (!base.isValid())
+        return;
+
+    unsigned relativeLength = relative.length();
+    if (!relativeLength) {
+        *this = base.withoutFragment();
+        return;
+    }
+
+    RawURLBuffer<char> outputBuffer;
+    const CString& baseStr = base.m_spec.m_string.utf8();
+    bool isValid = false;
+
+    if (relative.is8Bit())
+        isValid = URLUtilities::resolveRelative(baseStr.data(), base.m_segments,
+                                                reinterpret_cast<const char*>(relative.characters8()), relativeLength,
+                                                queryCharsetConverter,
+                                                outputBuffer, &m_segments);
+    else
+        isValid = URLUtilities::resolveRelative(baseStr.data(), base.m_segments,
+                                                relative.characters16(), relativeLength,
+                                                queryCharsetConverter,
+                                                outputBuffer, &m_segments);
+
+    if (isValid)
+        m_spec = URLString(String(outputBuffer.data(), outputBuffer.length()));
+}
+
+ParsedURL ParsedURL::isolatedCopy() const
+{
+    ParsedURL copy;
+    copy.m_segments = this->m_segments;
+    copy.m_spec = URLString(this->m_spec.string().isolatedCopy());
+    return copy;
+}
+
+String ParsedURL::scheme() const
+{
+    return segment(m_segments.scheme);
+}
+
+bool ParsedURL::hasStandardScheme() const
+{
+    ASSERT(m_segments.scheme.isValid());
+    const String& urlStringSpec = m_spec.m_string;
+    if (urlStringSpec.is8Bit())
+        return URLUtilities::isStandard(urlStringSpec.characters8(), m_segments.scheme);
+    return URLUtilities::isStandard(urlStringSpec.characters16(), m_segments.scheme);
+}
+
+String ParsedURL::username() const
+{
+    return segment(m_segments.username);
+}
+
+String ParsedURL::password() const
+{
+    return segment(m_segments.password);
+}
+
+String ParsedURL::host() const
+{
+    return segment(m_segments.host);
+}
+
+bool ParsedURL::hasPort() const
+{
+    return m_segments.port.isNonEmpty();
+}
+
+String ParsedURL::port() const
+{
+    return segment(m_segments.port);
+}
+
+template<typename CharacterType>
+static inline String generateNewSpecWithPort(const String& spec, unsigned newSpecLength, unsigned portDelimiterPosition, const LChar* portString, unsigned portStringLength, unsigned postPortPositionInSource)
+{
+    ASSERT(newSpecLength == portDelimiterPosition + 1 + portStringLength + (spec.length() - postPortPositionInSource));
+
+    CharacterType* buffer;
+    String newSpec = StringImpl::createUninitialized(newSpecLength, buffer);
+
+    // Copy everything prior to the port posisiton.
+    ASSERT(buffer + portDelimiterPosition < buffer + newSpecLength);
+    StringImpl::copyChars(buffer, spec.getCharacters<CharacterType>(), portDelimiterPosition);
+
+    // Add the new port from the position.
+    buffer[portDelimiterPosition] = ':';
+    unsigned portPosition = portDelimiterPosition + 1;
+    ASSERT(buffer + portPosition + portStringLength <= buffer + newSpecLength);
+    StringImpl::copyChars(buffer + portPosition, portString, portStringLength);
+
+    // Copy the character post-port from the source.
+    unsigned remainingComponentsPositionInDestination = portPosition + portStringLength;
+    ASSERT(buffer + remainingComponentsPositionInDestination + (spec.length() - postPortPositionInSource) == buffer + newSpecLength);
+    StringImpl::copyChars(buffer + remainingComponentsPositionInDestination, &(spec.getCharacters<CharacterType>()[postPortPositionInSource]), spec.length() - postPortPositionInSource);
+
+    return newSpec;
+}
+
+static inline void replacePortWithString(String& spec, URLSegments& segments, const LChar* portString, unsigned portStringLength)
+{
+    // Compute the new spec length.
+    int lengthDifference;
+    const URLComponent oldPortComponent = segments.port;
+    if (oldPortComponent.isValid())
+        lengthDifference = portStringLength - oldPortComponent.length();
+    else
+        lengthDifference = 1 + portStringLength;
+    unsigned newLength = spec.length() + lengthDifference;
+
+    // Find the substring positions for the generator template.
+    int portDelimiterPosition = segments.charactersBefore(URLSegments::Port, URLSegments::DelimiterIncluded);
+    ASSERT(portDelimiterPosition > 0);
+
+    unsigned postPortPositionInSource;
+    if (oldPortComponent.isValid())
+        postPortPositionInSource = oldPortComponent.end();
+    else
+        postPortPositionInSource = portDelimiterPosition;
+
+    // Create the new spec with portString.
+    if (spec.is8Bit())
+        spec = generateNewSpecWithPort<LChar>(spec, newLength, static_cast<unsigned>(portDelimiterPosition), portString, portStringLength, postPortPositionInSource);
+    else
+        spec = generateNewSpecWithPort<UChar>(spec, newLength, static_cast<unsigned>(portDelimiterPosition), portString, portStringLength, postPortPositionInSource);
+
+    // Update the URL components.
+    unsigned portPosition = portDelimiterPosition + 1;
+    segments.port.setBegin(portPosition);
+    segments.port.setLength(portStringLength);
+    segments.moveFromComponentBy(URLSegments::Path, lengthDifference);
+}
+
+
+void ParsedURL::replacePort(unsigned short newPort)
+{
+    ASSERT(hasStandardScheme());
+
+    // Generate a char* string for the port number.
+    LChar buf[5];
+    LChar* end = buf + WTF_ARRAY_LENGTH(buf);
+    LChar* p = end;
+    do {
+        *--p = static_cast<LChar>((newPort % 10) + '0');
+        newPort /= 10;
+    } while (newPort);
+    const unsigned portStringLength = end - p;
+
+    replacePortWithString(m_spec.m_string, m_segments, p, portStringLength);
+}
+
+void ParsedURL::removePort()
+{
+    if (!hasPort())
+        return;
+
+    // 1) Remove the port from the spec, including the delimiter.
+    String newSpec;
+    int beginning = m_segments.port.begin() - 1;
+    unsigned length = m_segments.port.length() + 1;
+
+    String newSpecString = m_spec.string();
+    newSpecString.remove(beginning, length);
+    m_spec = URLString(newSpecString);
+
+    // 2) Update the components positions.
+    m_segments.port.reset();
+    m_segments.moveFromComponentBy(URLSegments::Path, -length);
+}
+
+String ParsedURL::path() const
+{
+    return segment(m_segments.path);
+}
+
+String ParsedURL::query() const
+{
+    return segment(m_segments.query);
+}
+
+bool ParsedURL::hasFragment() const
+{
+    return m_segments.fragment.isValid();
+}
+
+String ParsedURL::fragment() const
+{
+    return segment(m_segments.fragment);
+}
+
+ParsedURL ParsedURL::withoutFragment() const
+{
+    if (!hasFragment())
+        return *this;
+
+    ParsedURL newURL;
+
+    int charactersBeforeFragemnt = m_segments.charactersBefore(URLSegments::Fragment, URLSegments::DelimiterExcluded);
+    newURL.m_spec = URLString(m_spec.string().substringSharingImpl(0, charactersBeforeFragemnt));
+
+    newURL.m_segments = m_segments;
+    newURL.m_segments.fragment = URLComponent();
+    return newURL;
+}
+
+String ParsedURL::baseAsString() const
+{
+    // FIXME: Add WTFURL Implementation.
+    return String();
+}
+
+String ParsedURL::segment(const URLComponent& component) const
+{
+    ASSERT(isValid());
+
+    if (!component.isValid())
+        return String();
+
+    String segment = m_spec.string().substring(component.begin(), component.length());
+
+    // FIXME: GoogleURL create empty segments. This happen for the fragment for the test fast/url/segments.html
+    // ASSERT_WITH_MESSAGE(!segment.isEmpty(), "A valid URL component should not be empty.");
+    return segment;
+}
+
+#ifndef NDEBUG
+
+#define SHOW_COMPONENT(parsedURL, componentName) \
+    if (!parsedURL->componentName().isNull()) { \
+        dataLog("    " #componentName " = "); \
+        parsedURL->componentName().show(); \
+    }
+
+void ParsedURL::print() const
+{
+    if (!isValid()) {
+        dataLog("Invalid ParsedURL.\n");
+        return;
+    }
+
+    dataLog("Valid ParsedURL with:\n");
+    dataLog("    m_spec = ");
+    m_spec.print();
+
+    SHOW_COMPONENT(this, scheme);
+    SHOW_COMPONENT(this, username);
+    SHOW_COMPONENT(this, password);
+    SHOW_COMPONENT(this, host);
+    SHOW_COMPONENT(this, port);
+    SHOW_COMPONENT(this, path);
+    SHOW_COMPONENT(this, query);
+    SHOW_COMPONENT(this, fragment);
+}
+#endif
+
+}
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/api/ParsedURL.h b/Source/WTF/wtf/url/api/ParsedURL.h
new file mode 100644
index 0000000..c2cbb9c
--- /dev/null
+++ b/Source/WTF/wtf/url/api/ParsedURL.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ * Copyright (C) 2012 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. ``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
+ * 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 ParsedURL_h
+#define ParsedURL_h
+
+#if USE(WTFURL)
+
+#include <wtf/url/api/URLString.h>
+#include <wtf/url/src/URLSegments.h>
+
+namespace WTF {
+
+class URLComponent;
+class URLQueryCharsetConverter;
+
+// ParsedURL represents a valid URL decomposed by components.
+class ParsedURL {
+public:
+    enum ParsedURLStringTag { ParsedURLString };
+
+    ParsedURL() { };
+    WTF_EXPORT_PRIVATE explicit ParsedURL(const String&, ParsedURLStringTag);
+
+    WTF_EXPORT_PRIVATE explicit ParsedURL(const String&, URLQueryCharsetConverter*);
+    WTF_EXPORT_PRIVATE explicit ParsedURL(const ParsedURL& base, const String& relative, URLQueryCharsetConverter*);
+
+    WTF_EXPORT_PRIVATE ParsedURL isolatedCopy() const;
+
+    bool isValid() const { return !m_spec.string().isNull(); }
+
+    // Return a URL component or a null String if the component is undefined for the URL.
+    WTF_EXPORT_PRIVATE String scheme() const;
+    WTF_EXPORT_PRIVATE bool hasStandardScheme() const;
+
+    WTF_EXPORT_PRIVATE String username() const;
+    WTF_EXPORT_PRIVATE String password() const;
+    WTF_EXPORT_PRIVATE String host() const;
+
+    WTF_EXPORT_PRIVATE bool hasPort() const;
+    WTF_EXPORT_PRIVATE String port() const;
+    WTF_EXPORT_PRIVATE void replacePort(unsigned short newPort);
+    WTF_EXPORT_PRIVATE void removePort();
+
+    WTF_EXPORT_PRIVATE String path() const;
+    WTF_EXPORT_PRIVATE String query() const;
+
+    WTF_EXPORT_PRIVATE bool hasFragment() const;
+    WTF_EXPORT_PRIVATE String fragment() const;
+    WTF_EXPORT_PRIVATE ParsedURL withoutFragment() const;
+
+
+    WTF_EXPORT_PRIVATE String baseAsString() const;
+
+    const URLString& spec() const { return m_spec; }
+
+#ifndef NDEBUG
+    WTF_EXPORT_PRIVATE void print() const;
+#endif
+
+private:
+    inline String segment(const URLComponent&) const;
+
+    URLString m_spec;
+    URLSegments m_segments;
+};
+
+}
+
+#endif // USE(WTFURL)
+
+#endif
diff --git a/Source/WTF/wtf/url/api/URLBuffer.h b/Source/WTF/wtf/url/api/URLBuffer.h
new file mode 100644
index 0000000..6eccd04
--- /dev/null
+++ b/Source/WTF/wtf/url/api/URLBuffer.h
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2010 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.
+ *     * 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.
+ *     * 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 URLBuffer_h
+#define URLBuffer_h
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+// Base class for the canonicalizer output, this maintains a buffer and
+// supports simple resizing and append operations on it.
+//
+// It is VERY IMPORTANT that no virtual function calls be made on the common
+// code path. We only have two virtual function calls, the destructor and a
+// resize function that is called when the existing buffer is not big enough.
+// The derived class is then in charge of setting up our buffer which we will
+// manage.
+template<typename CharacterType>
+class URLBuffer {
+public:
+    URLBuffer() : m_buffer(0), m_capacity(0), m_length(0) { }
+    virtual ~URLBuffer() { }
+
+    // Implemented to resize the buffer. This function should update the buffer
+    // pointer to point to the new buffer, and any old data up to |m_length| in
+    // the buffer must be copied over.
+    //
+    // The new size must be larger than m_capacity.
+    virtual void resize(int) = 0;
+
+    inline char at(int offset) const { return m_buffer[offset]; }
+    inline void set(int offset, CharacterType ch)
+    {
+        // FIXME: Add ASSERT(offset < length());
+        m_buffer[offset] = ch;
+    }
+
+    // Returns the current capacity of the buffer. The length() is the number of
+    // characters that have been declared to be written, but the capacity() is
+    // the number that can be written without reallocation. If the caller must
+    // write many characters at once, it can make sure there is enough capacity,
+    // write the data, then use setLength() to declare the new length().
+    int capacity() const { return m_capacity; }
+    int length() const { return m_length; }
+
+    // The output will NOT be 0-terminated. Call length() to get the length.
+    const CharacterType* data() const { return m_buffer; }
+    CharacterType* data() { return m_buffer; }
+
+    // Shortens the URL to the new length. Used for "backing up" when processing
+    // relative paths. This can also be used if an external function writes a lot
+    // of data to the buffer (when using the "Raw" version below) beyond the end,
+    // to declare the new length.
+    void setLength(int length)
+    {
+        // FIXME: Add ASSERT(length < capacity());
+        m_length = length;
+    }
+
+    // This is the most performance critical function, since it is called for
+    // every character.
+    void append(CharacterType ch)
+    {
+        // In VC2005, putting this common case first speeds up execution
+        // dramatically because this branch is predicted as taken.
+        if (m_length < m_capacity) {
+            m_buffer[m_length] = ch;
+            ++m_length;
+            return;
+        }
+
+        if (!grow(1))
+            return;
+
+        m_buffer[m_length] = ch;
+        ++m_length;
+    }
+
+    void append(const CharacterType* str, int strLength)
+    {
+        if (m_length + strLength > m_capacity) {
+            if (!grow(m_length + strLength - m_capacity))
+                return;
+        }
+        for (int i = 0; i < strLength; i++)
+            m_buffer[m_length + i] = str[i];
+        m_length += strLength;
+    }
+
+protected:
+    // Returns true if the buffer could be resized, false on OOM.
+    bool grow(int minimumAdditionalCapacity)
+    {
+        static const int minimumCapacity = 16;
+        int newCapacity = m_capacity ? m_capacity : minimumCapacity;
+        do {
+            if (newCapacity >= (1 << 30)) // Prevent overflow below.
+                return false;
+            newCapacity *= 2;
+        } while (newCapacity < m_capacity + minimumAdditionalCapacity);
+        resize(newCapacity);
+        return true;
+    }
+
+    CharacterType* m_buffer;
+    int m_capacity;
+    int m_length; // Used characters in the buffer.
+};
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // URLBuffer_h
diff --git a/Source/WTF/wtf/url/api/URLQueryCharsetConverter.h b/Source/WTF/wtf/url/api/URLQueryCharsetConverter.h
new file mode 100644
index 0000000..5771a42
--- /dev/null
+++ b/Source/WTF/wtf/url/api/URLQueryCharsetConverter.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 URLQueryCharsetConverter_h
+#define URLQueryCharsetConverter_h
+
+#include <wtf/unicode/Unicode.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+template<typename CharacterType> class URLBuffer;
+
+class URLQueryCharsetConverter {
+public:
+    URLQueryCharsetConverter() { }
+    virtual ~URLQueryCharsetConverter() { }
+    virtual void convertFromUTF16(const UChar* input, unsigned inputLength, URLBuffer<char>& output) = 0;
+};
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // URLQueryCharsetConverter_h
diff --git a/Source/WTF/wtf/url/api/URLString.cpp b/Source/WTF/wtf/url/api/URLString.cpp
new file mode 100644
index 0000000..9147fe3
--- /dev/null
+++ b/Source/WTF/wtf/url/api/URLString.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 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. ``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
+ * 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 "URLString.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+#ifndef NDEBUG
+void URLString::print() const
+{
+    m_string.show();
+}
+#endif // ndef NDEBUG
+
+}
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/api/URLString.h b/Source/WTF/wtf/url/api/URLString.h
new file mode 100644
index 0000000..70ef219
--- /dev/null
+++ b/Source/WTF/wtf/url/api/URLString.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ * Copyright (C) 2012 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. ``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
+ * 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 URLString_h
+#define URLString_h
+
+#if USE(WTFURL)
+
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+// URLString represents a string that's a canonicalized URL.
+class URLString {
+public:
+    URLString() { }
+
+    const String& string() const { return m_string;}
+
+#ifndef NDEBUG
+    WTF_EXPORT_PRIVATE void print() const;
+#endif
+
+private:
+    friend class ParsedURL;
+
+    // URLString can only be constructed by a ParsedURL.
+    explicit URLString(const String& string)
+        : m_string(string)
+    {
+    }
+
+    String m_string;
+};
+
+}
+
+#endif // USE(WTFURL)
+
+#endif
+
diff --git a/Source/WTF/wtf/url/src/RawURLBuffer.h b/Source/WTF/wtf/url/src/RawURLBuffer.h
new file mode 100644
index 0000000..e6f238c
--- /dev/null
+++ b/Source/WTF/wtf/url/src/RawURLBuffer.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2010 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.
+ *     * 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.
+ *     * 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 RawURLBuffer_h
+#define RawURLBuffer_h
+
+#if USE(WTFURL)
+
+#include "URLBuffer.h"
+#include <string.h>
+
+namespace WTF {
+
+// Simple implementation of the URLBuffer using new[]. This class
+// also supports a static buffer so if it is allocated on the stack, most
+// URLs can be canonicalized with no heap allocations.
+template<typename CharacterType, int inlineCapacity = 1024>
+class RawURLBuffer : public URLBuffer<CharacterType> {
+public:
+    RawURLBuffer() : URLBuffer<CharacterType>()
+    {
+        this->m_buffer = m_inlineBuffer;
+        this->m_capacity = inlineCapacity;
+    }
+
+    virtual ~RawURLBuffer()
+    {
+        if (this->m_buffer != m_inlineBuffer)
+            delete[] this->m_buffer;
+    }
+
+    virtual void resize(int size)
+    {
+        CharacterType* newBuffer = new CharacterType[size];
+        memcpy(newBuffer, this->m_buffer, sizeof(CharacterType) * (this->m_length < size ? this->m_length : size));
+        if (this->m_buffer != m_inlineBuffer)
+            delete[] this->m_buffer;
+        this->m_buffer = newBuffer;
+        this->m_capacity = size;
+    }
+
+protected:
+    CharacterType m_inlineBuffer[inlineCapacity];
+};
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // RawURLBuffer_h
diff --git a/Source/WTF/wtf/url/src/URLCanon.h b/Source/WTF/wtf/url/src/URLCanon.h
new file mode 100644
index 0000000..d1e2b1c
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanon.h
@@ -0,0 +1,617 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 URLCanon_h
+#define URLCanon_h
+
+#include "URLBuffer.h"
+#include "URLParse.h"
+#include <stdlib.h>
+#include <wtf/unicode/Unicode.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+class URLQueryCharsetConverter;
+
+namespace URLCanonicalizer {
+
+// Whitespace -----------------------------------------------------------------
+
+// Searches for whitespace that should be removed from the middle of URLs, and
+// removes it. Removed whitespace are tabs and newlines, but NOT spaces. Spaces
+// are preserved, which is what most browsers do. A pointer to the output will
+// be returned, and the length of that output will be in |outputLength|.
+//
+// This should be called before parsing if whitespace removal is desired (which
+// it normally is when you are canonicalizing).
+//
+// If no whitespace is removed, this function will not use the buffer and will
+// return a pointer to the input, to avoid the extra copy. If modification is
+// required, the given |buffer| will be used and the returned pointer will
+// point to the beginning of the buffer.
+//
+// Therefore, callers should not use the buffer, since it may actuall be empty,
+// use the computed pointer and |outputLength| instead.
+const char* removeURLWhitespace(const char* input, int inputLength, URLBuffer<char>&, int& outputLength);
+const UChar* removeURLWhitespace(const UChar* input, int inputLength, URLBuffer<UChar>&, int& outputLength);
+
+// IDN ------------------------------------------------------------------------
+
+// Converts the Unicode input representing a hostname to ASCII using IDN rules.
+// The output must fall in the ASCII range, but will be encoded in UTF-16.
+//
+// On success, the output will be filled with the ASCII host name and it will
+// return true. Unlike most other canonicalization functions, this assumes that
+// the output is empty. The beginning of the host will be at offset 0, and
+// the length of the output will be set to the length of the new host name.
+//
+// On error, returns false. The output in this case is undefined.
+bool IDNToASCII(const UChar* src, int sourceLength, URLBuffer<UChar>& output);
+
+// Piece-by-piece canonicalizers ----------------------------------------------
+//
+// These individual canonicalizers append the canonicalized versions of the
+// corresponding URL component to the given std::string. The spec and the
+// previously-identified range of that component are the input. The range of
+// the canonicalized component will be written to the output component.
+//
+// These functions all append to the output so they can be chained. Make sure
+// the output is empty when you start.
+//
+// These functions returns boolean values indicating success. On failure, they
+// will attempt to write something reasonable to the output so that, if
+// displayed to the user, they will recognise it as something that's messed up.
+// Nothing more should ever be done with these invalid URLs, however.
+
+// Scheme: Appends the scheme and colon to the URL. The output component will
+// indicate the range of characters up to but not including the colon.
+//
+// Canonical URLs always have a scheme. If the scheme is not present in the
+// input, this will just write the colon to indicate an empty scheme. Does not
+// append slashes which will be needed before any authority components for most
+// URLs.
+//
+// The 8-bit version requires UTF-8 encoding.
+bool canonicalizeScheme(const char* spec, const URLComponent& scheme, URLBuffer<char>&, URLComponent& ouputScheme);
+bool canonicalizeScheme(const UChar* spec, const URLComponent& scheme, URLBuffer<char>&, URLComponent& ouputScheme);
+
+// User info: username/password. If present, this will add the delimiters so
+// the output will be "<username>:<password>@" or "<username>@". Empty
+// username/password pairs, or empty passwords, will get converted to
+// nonexistant in the canonical version.
+//
+// The components for the username and password refer to ranges in the
+// respective source strings. Usually, these will be the same string, which
+// is legal as long as the two components don't overlap.
+//
+// The 8-bit version requires UTF-8 encoding.
+bool canonicalizeUserInfo(const char* usernameSource, const URLComponent& username, const char* passwordSource, const URLComponent& password,
+                          URLBuffer<char>&, URLComponent& outputUsername, URLComponent& outputPassword);
+bool canonicalizeUserInfo(const UChar* usernameSource, const URLComponent& username, const UChar* passwordSource, const URLComponent& password,
+                          URLBuffer<char>&, URLComponent& outputUsername, URLComponent& outputPassword);
+
+
+// This structure holds detailed state exported from the IP/Host canonicalizers.
+// Additional fields may be added as callers require them.
+struct CanonHostInfo {
+    CanonHostInfo()
+        : family(NEUTRAL)
+        , ipv4ComponentsCount(0)
+        , ouputHost()
+    {
+    }
+
+    // Convenience function to test if family is an IP address.
+    bool IsIPAddress() const { return family == IPV4 || family == IPV6; }
+
+    // This field summarizes how the input was classified by the canonicalizer.
+    enum Family {
+        // - Doesn't resemble an IP address. As far as the IP
+        // canonicalizer is concerned, it should be treated as a
+        //   hostname.
+        NEUTRAL,
+
+        // - Almost an IP, but was not canonicalized. This could be an
+        // IPv4 address where truncation occurred, or something
+        // containing the special characters :[] which did not parse
+        // as an IPv6 address. Never attempt to connect to this
+        // address, because it might actually succeed!
+        BROKEN,
+
+        IPV4, // - Successfully canonicalized as an IPv4 address.
+        IPV6, // - Successfully canonicalized as an IPv6 address.
+    };
+    Family family;
+
+    // If |family| is IPV4, then this is the number of nonempty dot-separated
+    // components in the input text, from 1 to 4. If |family| is not IPV4,
+    // this value is undefined.
+    int ipv4ComponentsCount;
+
+    // Location of host within the canonicalized output.
+    // canonicalizeIPAddress() only sets this field if |family| is IPV4 or IPV6.
+    URLComponent ouputHost;
+
+    // |address| contains the parsed IP Address (if any) in its first
+    // AddressLength() bytes, in network order. If IsIPAddress() is false
+    // AddressLength() will return zero and the content of |address| is undefined.
+    unsigned char address[16];
+
+    // Convenience function to calculate the length of an IP address corresponding
+    // to the current IP version in |family|, if any. For use with |address|.
+    int AddressLength() const
+    {
+        return family == IPV4 ? 4 : (family == IPV6 ? 16 : 0);
+    }
+};
+
+// Host.
+//
+// The 8-bit version requires UTF-8 encoding. Use this version when you only
+// need to know whether canonicalization succeeded.
+bool canonicalizeHost(const char* spec, const URLComponent& host, URLBuffer<char>&, URLComponent& ouputHost);
+bool canonicalizeHost(const UChar* spec, const URLComponent& host, URLBuffer<char>&, URLComponent& ouputHost);
+
+// IP addresses.
+//
+// Tries to interpret the given host name as an IPv4 or IPv6 address. If it is
+// an IP address, it will canonicalize it as such, appending it to |output|.
+// Additional status information is returned via the |*hostInfo| parameter.
+// See the definition of CanonHostInfo above for details.
+//
+// This is called AUTOMATICALLY from the host canonicalizer, which ensures that
+// the input is unescaped and name-prepped, etc. It should not normally be
+// necessary or wise to call this directly.
+void canonicalizeIPAddress(const char* spec, const URLComponent& host, URLBuffer<char>&, CanonHostInfo&);
+void canonicalizeIPAddress(const UChar* spec, const URLComponent& host, URLBuffer<char>&, CanonHostInfo&);
+
+// Port: this function will add the colon for the port if a port is present.
+// The caller can pass URLParser::PORT_UNSPECIFIED as the
+// defaultPortForScheme argument if there is no default port.
+//
+// The 8-bit version requires UTF-8 encoding.
+bool canonicalizePort(const char* spec, const URLComponent& port, int defaultPortForScheme, URLBuffer<char>&, URLComponent& ouputPort);
+bool canonicalizePort(const UChar* spec, const URLComponent& port, int defaultPortForScheme, URLBuffer<char>&, URLComponent& ouputPort);
+
+// Returns the default port for the given canonical scheme, or PORT_UNSPECIFIED
+// if the scheme is unknown.
+int defaultPortForScheme(const char* scheme, int schemeLength);
+
+// Path. If the input does not begin in a slash (including if the input is
+// empty), we'll prepend a slash to the path to make it canonical.
+//
+// The 8-bit version assumes UTF-8 encoding, but does not verify the validity
+// of the UTF-8 (i.e., you can have invalid UTF-8 sequences, invalid
+// characters, etc.). Normally, URLs will come in as UTF-16, so this isn't
+// an issue. Somebody giving us an 8-bit path is responsible for generating
+// the path that the server expects (we'll escape high-bit characters), so
+// if something is invalid, it's their problem.
+bool CanonicalizePath(const char* spec, const URLComponent& path, URLBuffer<char>&, URLComponent* outputPath);
+bool CanonicalizePath(const UChar* spec, const URLComponent& path, URLBuffer<char>&, URLComponent* outputPath);
+
+// Canonicalizes the input as a file path. This is like CanonicalizePath except
+// that it also handles Windows drive specs. For example, the path can begin
+// with "c|\" and it will get properly canonicalized to "C:/".
+// The string will be appended to |output| and |outputPath| will be updated.
+//
+// The 8-bit version requires UTF-8 encoding.
+bool FileCanonicalizePath(const char* spec, const URLComponent& path, URLBuffer<char>&, URLComponent* outputPath);
+bool FileCanonicalizePath(const UChar* spec, const URLComponent& path, URLBuffer<char>&, URLComponent* outputPath);
+
+// Query: Prepends the ? if needed.
+//
+// The 8-bit version requires the input to be UTF-8 encoding. Incorrectly
+// encoded characters (in UTF-8 or UTF-16) will be replaced with the Unicode
+// "invalid character." This function can not fail, we always just try to do
+// our best for crazy input here since web pages can set it themselves.
+//
+// This will convert the given input into the output encoding that the given
+// character set converter object provides. The converter will only be called
+// if necessary, for ASCII input, no conversions are necessary.
+//
+// The converter can be null. In this case, the output encoding will be UTF-8.
+void CanonicalizeQuery(const char* spec, const URLComponent& query, URLQueryCharsetConverter*, URLBuffer<char>&, URLComponent* outputQuery);
+void CanonicalizeQuery(const UChar* spec, const URLComponent& query, URLQueryCharsetConverter*, URLBuffer<char>&, URLComponent* outputQuery);
+
+// Ref: Prepends the # if needed. The output will be UTF-8 (this is the only
+// canonicalizer that does not produce ASCII output). The output is
+// guaranteed to be valid UTF-8.
+//
+// This function will not fail. If the input is invalid UTF-8/UTF-16, we'll use
+// the "Unicode replacement character" for the confusing bits and copy the rest.
+void canonicalizeFragment(const char* spec, const URLComponent& path, URLBuffer<char>&, URLComponent& outputFragment);
+void canonicalizeFragment(const UChar* spec, const URLComponent& path, URLBuffer<char>&, URLComponent& outputFragment);
+
+// Full canonicalizer ---------------------------------------------------------
+//
+// These functions replace any string contents, rather than append as above.
+// See the above piece-by-piece functions for information specific to
+// canonicalizing individual components.
+//
+// The output will be ASCII except the reference fragment, which may be UTF-8.
+//
+// The 8-bit versions require UTF-8 encoding.
+
+// Use for standard URLs with authorities and paths.
+bool CanonicalizeStandardURL(const char* spec, int specLength, const URLSegments& parsed, URLQueryCharsetConverter* queryConverter,
+                             URLBuffer<char>&, URLSegments* outputParsed);
+bool CanonicalizeStandardURL(const UChar* spec, int specLength, const URLSegments& parsed, URLQueryCharsetConverter* queryConverter,
+                             URLBuffer<char>&, URLSegments* outputParsed);
+
+// Use for file URLs.
+bool CanonicalizeFileURL(const char* spec, int specLength, const URLSegments& parsed, URLQueryCharsetConverter* queryConverter,
+                         URLBuffer<char>&, URLSegments* outputParsed);
+bool CanonicalizeFileURL(const UChar* spec, int specLength, const URLSegments& parsed, URLQueryCharsetConverter* queryConverter,
+                         URLBuffer<char>&, URLSegments* outputParsed);
+
+// Use for filesystem URLs.
+bool canonicalizeFileSystemURL(const char* spec, const URLSegments& parsed, URLQueryCharsetConverter* queryConverter,
+                               URLBuffer<char>&, URLSegments& outputParsed);
+bool canonicalizeFileSystemURL(const UChar* spec, const URLSegments& parsed, URLQueryCharsetConverter* queryConverter,
+                               URLBuffer<char>&, URLSegments& outputParsed);
+
+// Use for path URLs such as javascript. This does not modify the path in any
+// way, for example, by escaping it.
+bool canonicalizePathURL(const char* spec, const URLSegments& parsed, URLBuffer<char>& output, URLSegments& ouputParsed);
+bool canonicalizePathURL(const UChar* spec, const URLSegments& parsed, URLBuffer<char>& output, URLSegments& ouputParsed);
+
+// Use for mailto URLs. This "canonicalizes" the url into a path and query
+// component. It does not attempt to merge "to" fields. It uses UTF-8 for
+// the query encoding if there is a query. This is because a mailto URL is
+// really intended for an external mail program, and the encoding of a page,
+// etc. which would influence a query encoding normally are irrelevant.
+bool canonicalizeMailtoURL(const char* spec, const URLSegments& parsed, URLBuffer<char>&, URLSegments& outputParsed);
+bool canonicalizeMailtoURL(const UChar* spec,  const URLSegments& parsed, URLBuffer<char>&, URLSegments& outputParsed);
+
+// Part replacer --------------------------------------------------------------
+
+// Internal structure used for storing separate strings for each component.
+// The basic canonicalization functions use this structure internally so that
+// component replacement (different strings for different components) can be
+// treated on the same code path as regular canonicalization (the same string
+// for each component).
+//
+// A URLSegments structure usually goes along with this. Those
+// components identify offsets within these strings, so that they can all be
+// in the same string, or spread arbitrarily across different ones.
+//
+// This structures does not own any data. It is the caller's responsibility to
+// ensure that the data the pointers point to stays in scope and is not
+// modified.
+template<typename CharacterType>
+struct URLComponentSource {
+    // Constructor normally used by callers wishing to replace components. This
+    // will make them all null, which is no replacement. The caller would then
+    // override the components they want to replace.
+    URLComponentSource()
+        : scheme(0)
+        , username(0)
+        , password(0)
+        , host(0)
+        , port(0)
+        , path(0)
+        , query(0)
+        , ref(0)
+    {
+    }
+
+    // Constructor normally used internally to initialize all the components to
+    // point to the same spec.
+    explicit URLComponentSource(const CharacterType* defaultValue)
+        : scheme(defaultValue)
+        , username(defaultValue)
+        , password(defaultValue)
+        , host(defaultValue)
+        , port(defaultValue)
+        , path(defaultValue)
+        , query(defaultValue)
+        , ref(defaultValue)
+    {
+    }
+
+    const CharacterType* scheme;
+    const CharacterType* username;
+    const CharacterType* password;
+    const CharacterType* host;
+    const CharacterType* port;
+    const CharacterType* path;
+    const CharacterType* query;
+    const CharacterType* ref;
+};
+
+// This structure encapsulates information on modifying a URL. Each component
+// may either be left unchanged, replaced, or deleted.
+//
+// By default, each component is unchanged. For those components that should be
+// modified, call either Set* or Clear* to modify it.
+//
+// The string passed to Set* functions DOES NOT GET COPIED AND MUST BE KEPT
+// IN SCOPE BY THE CALLER for as long as this object exists!
+//
+// Prefer the 8-bit replacement version if possible since it is more efficient.
+template<typename CharacterType>
+class Replacements {
+public:
+    Replacements()
+    {
+    }
+
+    // Scheme
+    void SetScheme(const CharacterType* s, const URLComponent& comp)
+    {
+        m_sources.scheme = s;
+        m_segments.scheme = comp;
+    }
+    // Note: we don't have a ClearScheme since this doesn't make any sense.
+    bool IsSchemeOverridden() const { return !!m_sources.scheme; }
+
+    // Username
+    void SetUsername(const CharacterType* s, const URLComponent& comp)
+    {
+        m_sources.username = s;
+        m_segments.username = comp;
+    }
+    void ClearUsername()
+    {
+        m_sources.username = Placeholder();
+        m_segments.username = URLComponent();
+    }
+    bool IsUsernameOverridden() const { return !!m_sources.username; }
+
+    // Password
+    void SetPassword(const CharacterType* s, const URLComponent& comp)
+    {
+        m_sources.password = s;
+        m_segments.password = comp;
+    }
+    void ClearPassword()
+    {
+        m_sources.password = Placeholder();
+        m_segments.password = URLComponent();
+    }
+    bool IsPasswordOverridden() const { return !!m_sources.password; }
+
+    // Host
+    void SetHost(const CharacterType* s, const URLComponent& comp)
+    {
+        m_sources.host = s;
+        m_segments.host = comp;
+    }
+    void ClearHost()
+    {
+        m_sources.host = Placeholder();
+        m_segments.host = URLComponent();
+    }
+    bool IsHostOverridden() const { return !!m_sources.host; }
+
+    // Port
+    void SetPort(const CharacterType* s, const URLComponent& comp)
+    {
+        m_sources.port = s;
+        m_segments.port = comp;
+    }
+    void ClearPort()
+    {
+        m_sources.port = Placeholder();
+        m_segments.port = URLComponent();
+    }
+    bool IsPortOverridden() const { return !!m_sources.port; }
+
+    // Path
+    void SetPath(const CharacterType* s, const URLComponent& comp)
+    {
+        m_sources.path = s;
+        m_segments.path = comp;
+    }
+    void ClearPath()
+    {
+        m_sources.path = Placeholder();
+        m_segments.path = URLComponent();
+    }
+    bool IsPathOverridden() const { return !m_sources.path; }
+
+    // Query
+    void SetQuery(const CharacterType* s, const URLComponent& comp)
+    {
+        m_sources.query = s;
+        m_segments.query = comp;
+    }
+    void ClearQuery()
+    {
+        m_sources.query = Placeholder();
+        m_segments.query = URLComponent();
+    }
+    bool IsQueryOverridden() const { return !m_sources.query; }
+
+    // Ref
+    void SetRef(const CharacterType* s, const URLComponent& comp)
+    {
+        m_sources.ref = s;
+        m_segments.fragment = comp;
+    }
+    void ClearRef()
+    {
+        m_sources.ref = Placeholder();
+        m_segments.fragment = URLComponent();
+    }
+    bool IsRefOverridden() const { return !m_sources.ref; }
+
+    // Getters for the itnernal data. See the variables below for how the
+    // information is encoded.
+    const URLComponentSource<CharacterType>& sources() const { return m_sources; }
+    const URLSegments& components() const { return m_segments; }
+
+private:
+    // Returns a pointer to a static empty string that is used as a placeholder
+    // to indicate a component should be deleted (see below).
+    const CharacterType* Placeholder()
+    {
+        static const CharacterType emptyString = 0;
+        return &emptyString;
+    }
+
+    // We support three states:
+    //
+    // Action                 | Source                Component
+    // -----------------------+--------------------------------------------------
+    // Don't change component | null                  (unused)
+    // Replace component      | (replacement string)  (replacement component)
+    // Delete component       | (non-null)            (invalid component: (0,-1))
+    //
+    // We use a pointer to the empty string for the source when the component
+    // should be deleted.
+    URLComponentSource<CharacterType> m_sources;
+    URLSegments m_segments;
+};
+
+// The base must be an 8-bit canonical URL.
+bool ReplaceStandardURL(const char* base,
+                        const URLSegments& baseParsed,
+                        const Replacements<char>&,
+                        URLQueryCharsetConverter* queryConverter,
+                        URLBuffer<char>&,
+                        URLSegments* outputParsed);
+bool ReplaceStandardURL(const char* base,
+                        const URLSegments& baseParsed,
+                        const Replacements<UChar>&,
+                        URLQueryCharsetConverter* queryConverter,
+                        URLBuffer<char>&,
+                        URLSegments* outputParsed);
+
+// Filesystem URLs can only have the path, query, or ref replaced.
+// All other components will be ignored.
+bool ReplaceFileSystemURL(const char* base,
+                          const URLSegments& baseParsed,
+                          const Replacements<char>&,
+                          URLQueryCharsetConverter* queryConverter,
+                          URLBuffer<char>&,
+                          URLSegments* outputParsed);
+bool ReplaceFileSystemURL(const char* base,
+                          const URLSegments& baseParsed,
+                          const Replacements<UChar>&,
+                          URLQueryCharsetConverter* queryConverter,
+                          URLBuffer<char>&,
+                          URLSegments* outputParsed);
+
+// Replacing some parts of a file URL is not permitted. Everything except
+// the host, path, query, and ref will be ignored.
+bool ReplaceFileURL(const char* base,
+                    const URLSegments& baseParsed,
+                    const Replacements<char>&,
+                    URLQueryCharsetConverter* queryConverter,
+                    URLBuffer<char>&,
+                    URLSegments* outputParsed);
+bool ReplaceFileURL(const char* base,
+                    const URLSegments& baseParsed,
+                    const Replacements<UChar>&,
+                    URLQueryCharsetConverter* queryConverter,
+                    URLBuffer<char>&,
+                    URLSegments* outputParsed);
+
+// Path URLs can only have the scheme and path replaced. All other components
+// will be ignored.
+bool ReplacePathURL(const char* base,
+                    const URLSegments& baseParsed,
+                    const Replacements<char>&,
+                    URLBuffer<char>&,
+                    URLSegments* outputParsed);
+bool ReplacePathURL(const char* base,
+                    const URLSegments& baseParsed,
+                    const Replacements<UChar>&,
+                    URLBuffer<char>&,
+                    URLSegments* outputParsed);
+
+// Mailto URLs can only have the scheme, path, and query replaced.
+// All other components will be ignored.
+bool replaceMailtoURL(const char* base, const URLSegments& baseParsed,
+                      const Replacements<char>&,
+                      URLBuffer<char>& output, URLSegments& outputParsed);
+bool replaceMailtoURL(const char* base, const URLSegments& baseParsed,
+                      const Replacements<UChar>&,
+                      URLBuffer<char>& output, URLSegments& outputParsed);
+
+// Relative URL ---------------------------------------------------------------
+
+// Given an input URL or URL fragment |fragment|, determines if it is a
+// relative or absolute URL and places the result into |*isRelative|. If it is
+// relative, the relevant portion of the URL will be placed into
+// |*relativeComponent| (there may have been trimmed whitespace, for example).
+// This value is passed to resolveRelativeURL. If the input is not relative,
+// this value is UNDEFINED (it may be changed by the function).
+//
+// Returns true on success (we successfully determined the URL is relative or
+// not). Failure means that the combination of URLs doesn't make any sense.
+//
+// The base URL should always be canonical, therefore is ASCII.
+bool isRelativeURL(const char* base, const URLSegments& baseParsed,
+                   const char* fragment, int fragmentLength,
+                   bool isBaseHierarchical,
+                   bool& isRelative, URLComponent& relativeComponent);
+bool isRelativeURL(const char* base, const URLSegments& baseParsed,
+                   const UChar* fragment, int fragmentLength,
+                   bool isBaseHierarchical,
+                   bool& isRelative, URLComponent& relativeComponent);
+
+// Given a canonical parsed source URL, a URL fragment known to be relative,
+// and the identified relevant portion of the relative URL (computed by
+// isRelativeURL), this produces a new parsed canonical URL in |output| and
+// |outputParsed|.
+//
+// It also requires a flag indicating whether the base URL is a file: URL
+// which triggers additional logic.
+//
+// The base URL should be canonical and have a host (may be empty for file
+// URLs) and a path. If it doesn't have these, we can't resolve relative
+// URLs off of it and will return the base as the output with an error flag.
+// Becausee it is canonical is should also be ASCII.
+//
+// The query charset converter follows the same rules as CanonicalizeQuery.
+//
+// Returns true on success. On failure, the output will be "something
+// reasonable" that will be consistent and valid, just probably not what
+// was intended by the web page author or caller.
+bool resolveRelativeURL(const char* baseURL, const URLSegments& baseParsed, bool baseIsFile,
+                        const char* relativeURL, const URLComponent& relativeComponent,
+                        URLQueryCharsetConverter* queryConverter,
+                        URLBuffer<char>&, URLSegments* outputParsed);
+bool resolveRelativeURL(const char* baseURL, const URLSegments& baseParsed, bool baseIsFile,
+                        const UChar* relativeURL, const URLComponent& relativeComponent,
+                        URLQueryCharsetConverter* queryConverter,
+                        URLBuffer<char>&, URLSegments* outputParsed);
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // URLCanon_h
diff --git a/Source/WTF/wtf/url/src/URLCanonEtc.cpp b/Source/WTF/wtf/url/src/URLCanonEtc.cpp
new file mode 100644
index 0000000..f3cdd9c
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonEtc.cpp
@@ -0,0 +1,374 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// Canonicalizers for random bits that aren't big enough for their own files.
+
+#include "config.h"
+#include "URLCanon.h"
+
+#include "URLCanonInternal.h"
+#include <wtf/ASCIICType.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+// Returns true if the given character should be removed from the middle of a
+// URL.
+inline bool isRemovableURLWhitespace(int character)
+{
+    return character == '\r' || character == '\n' || character == '\t';
+}
+
+// Backend for removeURLWhitespace (see declaration in URLCanon.h).
+// It sucks that we have to do this, since this takes about 13% of the total URL
+// canonicalization time.
+template<typename CharacterType>
+const CharacterType* doRemoveURLWhitespace(const CharacterType* input, int inputLength, URLBuffer<CharacterType>& buffer, int& outputLength)
+{
+    // Fast verification that there's nothing that needs removal. This is the 99%
+    // case, so we want it to be fast and don't care about impacting the speed
+    // when we do find whitespace.
+    bool foundWhitespace = false;
+    for (int i = 0; i < inputLength; ++i) {
+        if (!isRemovableURLWhitespace(input[i]))
+            continue;
+        foundWhitespace = true;
+        break;
+    }
+
+    if (!foundWhitespace) {
+        // Didn't find any whitespace, we don't need to do anything. We can just
+        // return the input as the output.
+        outputLength = inputLength;
+        return input;
+    }
+
+    // Remove the whitespace into the new buffer and return it.
+    for (int i = 0; i < inputLength; i++) {
+        if (!isRemovableURLWhitespace(input[i]))
+            buffer.append(input[i]);
+    }
+    outputLength = buffer.length();
+    return buffer.data();
+}
+
+// Contains the canonical version of each possible input letter in the scheme
+// (basically, lower-cased). The corresponding entry will be 0 if the letter
+// is not allowed in a scheme.
+const char kSchemeCanonical[0x80] = {
+// 00-1f: all are invalid
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+//  ' '   !    "    #    $    %    &    '    (    )    *    +    ,    -    .    /
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  '+',  0,  '-', '.',  0,
+//   0    1    2    3    4    5    6    7    8    9    :    ;    <    =    >    ?
+    '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,
+//   @    A    B    C    D    E    F    G    H    I    J    K    L    M    N    O
+     0 , 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+//   P    Q    R    S    T    U    V    W    X    Y    Z    [    \    ]    ^    _
+    'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',  0,   0 ,  0,   0 ,  0,
+//   `    a    b    c    d    e    f    g    h    i    j    k    l    m    n    o
+     0 , 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+//   p    q    r    s    t    u    v    w    x    y    z    {    |    }    ~
+    'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',  0 ,  0 ,  0 ,  0 ,  0 };
+
+// This could be a table lookup as well by setting the high bit for each
+// valid character, but it's only called once per URL, and it makes the lookup
+// table easier to read not having extra stuff in it.
+inline bool isSchemeFirstChar(unsigned char character)
+{
+    return isASCIIAlpha(character);
+}
+
+template<typename CharacterType, typename UCHAR>
+bool doScheme(const CharacterType* spec, const URLComponent& scheme, URLBuffer<char>& output, URLComponent& outputScheme)
+{
+    if (scheme.length() <= 0) {
+        // Scheme is unspecified or empty, convert to empty by appending a colon.
+        outputScheme = URLComponent(output.length(), 0);
+        output.append(':');
+        return true;
+    }
+
+    // The output scheme starts from the current position.
+    outputScheme.moveBy(output.length());
+
+    // Danger: it's important that this code does not strip any characters: it
+    // only emits the canonical version (be it valid or escaped) of each of
+    // the input characters. Stripping would put it out of sync with
+    // URLUtilities::FindAndCompareScheme, which could cause some security checks on
+    // schemes to be incorrect.
+    bool success = true;
+    int end = scheme.end();
+    for (int i = scheme.begin(); i < end; ++i) {
+        UCHAR character = static_cast<UCHAR>(spec[i]);
+        char replacement = 0;
+        if (character < 0x80) {
+            if (i == scheme.begin()) {
+                // Need to do a special check for the first letter of the scheme.
+                if (isSchemeFirstChar(static_cast<unsigned char>(character)))
+                    replacement = kSchemeCanonical[character];
+            } else
+                replacement = kSchemeCanonical[character];
+        }
+
+        if (replacement)
+            output.append(replacement);
+        else if (character == '%') {
+            // Canonicalizing the scheme multiple times should lead to the same
+            // result. Since invalid characters will be escaped, we need to preserve
+            // the percent to avoid multiple escaping. The scheme will be invalid.
+            success = false;
+            output.append('%');
+        } else {
+            // Invalid character, store it but mark this scheme as invalid.
+            success = false;
+
+            // This will escape the output and also handle encoding issues.
+            // Ignore the return value since we already failed.
+            AppendUTF8EscapedChar(spec, &i, end, output);
+        }
+    }
+
+    // The output scheme ends with the the current position, before appending
+    // the colon.
+    outputScheme.setLength(output.length() - outputScheme.begin());
+    output.append(':');
+    return success;
+}
+
+// The username and password components reference ranges in the corresponding
+// *_spec strings. Typically, these specs will be the same (we're
+// canonicalizing a single source string), but may be different when
+// replacing components.
+template<typename CharacterType, typename UCHAR>
+bool doUserInfo(const CharacterType* usernameSpec,
+                const URLComponent& username,
+                const CharacterType* passwordSpec,
+                const URLComponent& password,
+                URLBuffer<char>& output,
+                URLComponent& outputUsername,
+                URLComponent& outputPassword)
+{
+    if (username.length() <= 0 && password.length() <= 0) {
+        // Common case: no user info. We strip empty username/passwords.
+        outputUsername = URLComponent();
+        outputPassword = URLComponent();
+        return true;
+    }
+
+    // Write the username.
+    outputUsername.setBegin(output.length());
+    if (username.length() > 0) {
+        // This will escape characters not valid for the username.
+        appendStringOfType(&usernameSpec[username.begin()], username.length(), URLCharacterTypes::UserInfoCharacter, output);
+    }
+    outputUsername.setLength(output.length() - outputUsername.begin());
+
+    // When there is a password, we need the separator. Note that we strip
+    // empty but specified passwords.
+    if (password.length() > 0) {
+        output.append(':');
+        outputPassword.setBegin(output.length());
+        appendStringOfType(&passwordSpec[password.begin()], password.length(), URLCharacterTypes::UserInfoCharacter, output);
+        outputPassword.setLength(output.length() - outputPassword.begin());
+    } else
+        outputPassword = URLComponent();
+
+    output.append('@');
+    return true;
+}
+
+// Helper functions for converting port integers to strings.
+inline void writePortInt(char* output, int outputLength, int port)
+{
+    _itoa_s(port, output, outputLength, 10);
+}
+
+// This function will prepend the colon if there will be a port.
+template<typename CharacterType, typename UCHAR>
+bool doPort(const CharacterType* spec,
+            const URLComponent& port,
+            int defaultPortForScheme,
+            URLBuffer<char>& output,
+            URLComponent& outputPortComponent)
+{
+    int portNumber = URLParser::ParsePort(spec, port);
+    if (portNumber == URLParser::PORT_UNSPECIFIED || portNumber == defaultPortForScheme) {
+        outputPortComponent = URLComponent();
+        return true; // Leave port empty.
+    }
+
+    if (portNumber == URLParser::PORT_INVALID) {
+        // Invalid port: We'll copy the text from the input so the user can see
+        // what the error was, and mark the URL as invalid by returning false.
+        output.append(':');
+        outputPortComponent.setBegin(output.length());
+        AppendInvalidNarrowString(spec, port.begin(), port.end(), output);
+        outputPortComponent.setLength(output.length() - outputPortComponent.begin());
+        return false;
+    }
+
+    // Convert port number back to an integer. Max port value is 5 digits, and
+    // the Parsed::ExtractPort will have made sure the integer is in range.
+    const int bufferSize = 6;
+    char buffer[bufferSize];
+    writePortInt(buffer, bufferSize, portNumber);
+
+    // Append the port number to the output, preceeded by a colon.
+    output.append(':');
+    outputPortComponent.setBegin(output.length());
+    for (int i = 0; i < bufferSize && buffer[i]; ++i)
+        output.append(buffer[i]);
+
+    outputPortComponent.setLength(output.length() - outputPortComponent.begin());
+    return true;
+}
+
+template<typename CharacterType, typename UCHAR>
+void doCanonicalizeFragment(const CharacterType* spec, const URLComponent& fragment, URLBuffer<char>& output, URLComponent& outputFragment)
+{
+    if (fragment.length() < 0) {
+        // Common case of no fragment.
+        outputFragment = URLComponent();
+        return;
+    }
+
+    // Append the fragment separator. Note that we need to do this even when the fragment
+    // is empty but present.
+    output.append('#');
+    outputFragment.setBegin(output.length());
+
+    // Now iterate through all the characters, converting to UTF-8 and validating.
+    int end = fragment.end();
+    for (int i = fragment.begin(); i < end; ++i) {
+        if (!spec[i]) {
+            // IE just strips NULLs, so we do too.
+            continue;
+        }
+        if (static_cast<UCHAR>(spec[i]) < 0x20) {
+            // Unline IE seems to, we escape control characters. This will probably
+            // make the reference fragment unusable on a web page, but people
+            // shouldn't be using control characters in their anchor names.
+            appendURLEscapedCharacter(static_cast<unsigned char>(spec[i]), output);
+        } else if (static_cast<UCHAR>(spec[i]) < 0x80) {
+            // Normal ASCII characters are just appended.
+            output.append(static_cast<char>(spec[i]));
+        } else {
+            // Non-ASCII characters are appended unescaped, but only when they are
+            // valid. Invalid Unicode characters are replaced with the "invalid
+            // character" as IE seems to (readUTFChar puts the unicode replacement
+            // character in the output on failure for us).
+            unsigned codePoint;
+            readUTFChar(spec, &i, end, &codePoint);
+            AppendUTF8Value(codePoint, output);
+        }
+    }
+
+    outputFragment.setLength(output.length() - outputFragment.begin());
+}
+
+} // namespace
+
+const char* removeURLWhitespace(const char* input, int inputLength, URLBuffer<char>& buffer, int& outputLength)
+{
+    return doRemoveURLWhitespace(input, inputLength, buffer, outputLength);
+}
+
+const UChar* removeURLWhitespace(const UChar* input, int inputLength, URLBuffer<UChar>& buffer, int& outputLength)
+{
+    return doRemoveURLWhitespace(input, inputLength, buffer, outputLength);
+}
+
+char canonicalSchemeChar(UChar character)
+{
+    if (character >= 0x80)
+        return 0; // Non-ASCII is not supported by schemes.
+    return kSchemeCanonical[character];
+}
+
+bool canonicalizeScheme(const char* spec, const URLComponent& scheme, URLBuffer<char>& output, URLComponent& outputScheme)
+{
+    return doScheme<char, unsigned char>(spec, scheme, output, outputScheme);
+}
+
+bool canonicalizeScheme(const UChar* spec, const URLComponent& scheme, URLBuffer<char>& output, URLComponent& outputScheme)
+{
+    return doScheme<UChar, UChar>(spec, scheme, output, outputScheme);
+}
+
+bool canonicalizeUserInfo(const char* usernameSource, const URLComponent& username, const char* passwordSource, const URLComponent& password,
+                          URLBuffer<char>& output, URLComponent& outputUsername, URLComponent& outputPassword)
+{
+    return doUserInfo<char, unsigned char>(usernameSource, username, passwordSource, password, output, outputUsername, outputPassword);
+}
+
+bool canonicalizeUserInfo(const UChar* usernameSource, const URLComponent& username, const UChar* passwordSource, const URLComponent& password,
+                          URLBuffer<char>& output, URLComponent& outputUsername, URLComponent& outputPassword)
+{
+    return doUserInfo<UChar, UChar>(usernameSource, username, passwordSource, password, output, outputUsername, outputPassword);
+}
+
+bool canonicalizePort(const char* spec, const URLComponent& port, int defaultPortForScheme,
+                      URLBuffer<char>& output, URLComponent& outputPortComponent)
+{
+    return doPort<char, unsigned char>(spec, port,
+                                       defaultPortForScheme,
+                                       output, outputPortComponent);
+}
+
+bool canonicalizePort(const UChar* spec, const URLComponent& port, int defaultPortForScheme,
+                      URLBuffer<char>& output, URLComponent& outputPortComponent)
+{
+    return doPort<UChar, UChar>(spec, port, defaultPortForScheme,
+                                output, outputPortComponent);
+}
+
+void canonicalizeFragment(const char* spec, const URLComponent& ref, URLBuffer<char>& output, URLComponent& outputFragment)
+{
+    doCanonicalizeFragment<char, unsigned char>(spec, ref, output, outputFragment);
+}
+
+void canonicalizeFragment(const UChar* spec, const URLComponent& ref, URLBuffer<char>& output, URLComponent& outputFragment)
+{
+    doCanonicalizeFragment<UChar, UChar>(spec, ref, output, outputFragment);
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonFilesystemurl.cpp b/Source/WTF/wtf/url/src/URLCanonFilesystemurl.cpp
new file mode 100644
index 0000000..361bbbe
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonFilesystemurl.cpp
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2012 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// Functions for canonicalizing "filesystem:file:" URLs.
+
+#include "config.h"
+#include "URLCanon.h"
+
+#include "RawURLBuffer.h"
+#include "URLCanonInternal.h"
+#include "URLFile.h"
+#include "URLParseInternal.h"
+#include "URLUtil.h"
+#include "URLUtilInternal.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+// We use the URLComponentSource for the outer URL, as it can have replacements,
+// whereas the inner_url can't, so it uses spec.
+template<typename CharacterType, typename UCHAR>
+bool doCanonicalizeFileSystemURL(const CharacterType* spec,
+                                 const URLComponentSource<CharacterType>& source,
+                                 const URLSegments& parsed,
+                                 URLQueryCharsetConverter* charsetConverter,
+                                 URLBuffer<char>& output,
+                                 URLSegments& outputParsed)
+{
+    // filesystem only uses {scheme, path, query, ref} -- clear the rest.
+    outputParsed.username = URLComponent();
+    outputParsed.password = URLComponent();
+    outputParsed.host = URLComponent();
+    outputParsed.port = URLComponent();
+
+    const URLSegments* innerParsed = parsed.innerURLSegments();
+    URLSegments newInnerParsed;
+
+    // Scheme (known, so we don't bother running it through the more
+    // complicated scheme canonicalizer).
+    outputParsed.scheme.setBegin(output.length());
+    output.append("filesystem:", 11);
+    outputParsed.scheme.setLength(10);
+
+    if (!parsed.innerURLSegments() || !parsed.innerURLSegments()->scheme.isValid())
+        return false;
+
+    bool success = true;
+    if (URLUtilities::CompareSchemeComponent(spec, innerParsed->scheme, URLUtilities::kFileScheme)) {
+        newInnerParsed.scheme.setBegin(output.length());
+        output.append("file://", 7);
+        newInnerParsed.scheme.setLength(4);
+        success &= CanonicalizePath(spec, innerParsed->path, output,
+                                    &newInnerParsed.path);
+    } else if (URLUtilities::isStandard(spec, innerParsed->scheme)) {
+        success =
+        URLCanonicalizer::CanonicalizeStandardURL(spec,
+                                                  parsed.innerURLSegments()->length(),
+                                                  *parsed.innerURLSegments(),
+                                                  charsetConverter, output,
+                                                  &newInnerParsed);
+    } else {
+        // TODO(ericu): The URL is wrong, but should we try to output more of what
+        // we were given? Echoing back filesystem:mailto etc. doesn't seem all that useful.
+        return false;
+    }
+    // The filesystem type must be more than just a leading slash for validity.
+    success &= parsed.innerURLSegments()->path.length() > 1;
+
+    success &= CanonicalizePath(source.path, parsed.path, output, &outputParsed.path);
+
+    // Ignore failures for query/ref since the URL can probably still be loaded.
+    CanonicalizeQuery(source.query, parsed.query, charsetConverter, output, &outputParsed.query);
+    canonicalizeFragment(source.ref, parsed.fragment, output, outputParsed.fragment);
+    if (success)
+        outputParsed.setInnerURLSegments(newInnerParsed);
+
+    return success;
+}
+
+} // namespace
+
+bool canonicalizeFileSystemURL(const char* spec,
+                               const URLSegments& parsed,
+                               URLQueryCharsetConverter* charsetConverter,
+                               URLBuffer<char>& output,
+                               URLSegments& outputParsed)
+{
+    return doCanonicalizeFileSystemURL<char, unsigned char>(spec, URLComponentSource<char>(spec), parsed, charsetConverter, output, outputParsed);
+}
+
+bool canonicalizeFileSystemURL(const UChar* spec,
+                               const URLSegments& parsed,
+                               URLQueryCharsetConverter* charsetConverter,
+                               URLBuffer<char>& output,
+                               URLSegments& outputParsed)
+{
+    return doCanonicalizeFileSystemURL<UChar, UChar>(spec, URLComponentSource<UChar>(spec), parsed, charsetConverter, output, outputParsed);
+}
+
+bool ReplaceFileSystemURL(const char* base,
+                          const URLSegments& baseParsed,
+                          const Replacements<char>& replacements,
+                          URLQueryCharsetConverter* charsetConverter,
+                          URLBuffer<char>& output,
+                          URLSegments* outputParsed)
+{
+    URLComponentSource<char> source(base);
+    URLSegments parsed(baseParsed);
+    SetupOverrideComponents(base, replacements, &source, &parsed);
+    return doCanonicalizeFileSystemURL<char, unsigned char>(base, source, parsed, charsetConverter, output, *outputParsed);
+}
+
+bool ReplaceFileSystemURL(const char* base,
+                          const URLSegments& baseParsed,
+                          const Replacements<UChar>& replacements,
+                          URLQueryCharsetConverter* charsetConverter,
+                          URLBuffer<char>& output,
+                          URLSegments* outputParsed)
+{
+    RawURLBuffer<char> utf8;
+    URLComponentSource<char> source(base);
+    URLSegments parsed(baseParsed);
+    SetupUTF16OverrideComponents(base, replacements, utf8, &source, &parsed);
+    return doCanonicalizeFileSystemURL<char, unsigned char>(base, source, parsed, charsetConverter, output, *outputParsed);
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonFileurl.cpp b/Source/WTF/wtf/url/src/URLCanonFileurl.cpp
new file mode 100644
index 0000000..73a9f6d
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonFileurl.cpp
@@ -0,0 +1,224 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// Functions for canonicalizing "file:" URLs.
+
+#include "config.h"
+#include "URLCanon.h"
+
+#include "RawURLBuffer.h"
+#include "URLCanonInternal.h"
+#include "URLFile.h"
+#include "URLParseInternal.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+#if OS(WINDOWS)
+
+// Given a pointer into the spec, this copies and canonicalizes the drive
+// letter and colon to the output, if one is found. If there is not a drive
+// spec, it won't do anything. The index of the next character in the input
+// spec is returned (after the colon when a drive spec is found, the begin
+// offset if one is not).
+template<typename CHAR>
+int FileDoDriveSpec(const CHAR* spec, int begin, int end, URLBuffer<char>& output)
+{
+    // The path could be one of several things: /foo/bar, c:/foo/bar, /c:/foo,
+    // (with backslashes instead of slashes as well).
+    int numSlashes = URLParser::countConsecutiveSlashes(spec, begin, end);
+    int afterSlashes = begin + numSlashes;
+
+    if (!URLParser::doesBeginWindowsDriveSpec(spec, afterSlashes, end))
+        return begin; // Haven't consumed any characters
+
+    // A drive spec is the start of a path, so we need to add a slash for the
+    // authority terminator (typically the third slash).
+    output.append('/');
+
+    // doesBeginWindowsDriveSpec will ensure that the drive letter is valid
+    // and that it is followed by a colon/pipe.
+
+    // Normalize Windows drive letters to uppercase
+    if (spec[afterSlashes] >= 'a' && spec[afterSlashes] <= 'z')
+        output.append(spec[afterSlashes] - 'a' + 'A');
+    else
+        output.append(static_cast<char>(spec[afterSlashes]));
+
+    // Normalize the character following it to a colon rather than pipe.
+    output.append(':');
+    return afterSlashes + 2;
+}
+
+#endif // OS(WINDOWS)
+
+template<typename CharacterType, typename UCHAR>
+bool doFileCanonicalizePath(const CharacterType* spec,
+                            const URLComponent& path,
+                            URLBuffer<char>& output,
+                            URLComponent& outputPath)
+{
+    // Copies and normalizes the "c:" at the beginning, if present.
+    outputPath.setBegin(output.length());
+    int afterDrive;
+#if OS(WINDOWS)
+    afterDrive = FileDoDriveSpec(spec, path.begin, path.end(), output);
+#else
+    afterDrive = path.begin();
+#endif
+
+    // Copies the rest of the path, starting from the slash following the
+    // drive colon (if any, Windows only), or the first slash of the path.
+    bool success = true;
+    if (afterDrive < path.end()) {
+        // Use the regular path canonicalizer to canonicalize the rest of the
+        // path. Give it a fake output component to write into. DoCanonicalizeFile
+        // will compute the full path component.
+        URLComponent subPath = URLComponent::fromRange(afterDrive, path.end());
+        URLComponent fakeOutputPath;
+        success = CanonicalizePath(spec, subPath, output, &fakeOutputPath);
+    } else {
+        // No input path, canonicalize to a slash.
+        output.append('/');
+    }
+
+    outputPath.setLength(output.length() - outputPath.begin());
+    return success;
+}
+
+template<typename CharacterType, typename UCHAR>
+bool doCanonicalizeFileURL(const URLComponentSource<CharacterType>& source,
+                           const URLSegments& parsed,
+                           URLQueryCharsetConverter* queryConverter,
+                           URLBuffer<char>& output,
+                           URLSegments& outputParsed)
+{
+    // Things we don't set in file: URLs.
+    outputParsed.username = URLComponent();
+    outputParsed.password = URLComponent();
+    outputParsed.port = URLComponent();
+
+    // Scheme (known, so we don't bother running it through the more
+    // complicated scheme canonicalizer).
+    outputParsed.scheme.setBegin(output.length());
+    output.append("file://", 7);
+    outputParsed.scheme.setLength(4);
+
+    // Append the host. For many file URLs, this will be empty. For UNC, this
+    // will be present.
+    // TODO(brettw) This doesn't do any checking for host name validity. We
+    // should probably handle validity checking of UNC hosts differently than
+    // for regular IP hosts.
+    bool success = canonicalizeHost(source.host, parsed.host, output, outputParsed.host);
+    success &= doFileCanonicalizePath<CharacterType, UCHAR>(source.path, parsed.path, output, outputParsed.path);
+    CanonicalizeQuery(source.query, parsed.query, queryConverter, output, &outputParsed.query);
+
+    // Ignore failure for refs since the URL can probably still be loaded.
+    canonicalizeFragment(source.ref, parsed.fragment, output, outputParsed.fragment);
+
+    return success;
+}
+
+} // namespace
+
+bool CanonicalizeFileURL(const char* spec,
+                         int /* specLength */,
+                         const URLSegments& parsed,
+                         URLQueryCharsetConverter* queryConverter,
+                         URLBuffer<char>& output,
+                         URLSegments* outputParsed)
+{
+    return doCanonicalizeFileURL<char, unsigned char>(URLComponentSource<char>(spec), parsed, queryConverter, output, *outputParsed);
+}
+
+bool CanonicalizeFileURL(const UChar* spec,
+                         int /* specLength */,
+                         const URLSegments& parsed,
+                         URLQueryCharsetConverter* queryConverter,
+                         URLBuffer<char>& output,
+                         URLSegments* outputParsed)
+{
+    return doCanonicalizeFileURL<UChar, UChar>(URLComponentSource<UChar>(spec), parsed, queryConverter, output, *outputParsed);
+}
+
+bool FileCanonicalizePath(const char* spec,
+                          const URLComponent& path,
+                          URLBuffer<char>& output,
+                          URLComponent* outputPath)
+{
+    return doFileCanonicalizePath<char, unsigned char>(spec, path, output, *outputPath);
+}
+
+bool FileCanonicalizePath(const UChar* spec,
+                          const URLComponent& path,
+                          URLBuffer<char>& output,
+                          URLComponent* outputPath)
+{
+    return doFileCanonicalizePath<UChar, UChar>(spec, path, output, *outputPath);
+}
+
+bool ReplaceFileURL(const char* base,
+                    const URLSegments& baseParsed,
+                    const Replacements<char>& replacements,
+                    URLQueryCharsetConverter* queryConverter,
+                    URLBuffer<char>& output,
+                    URLSegments* outputParsed)
+{
+    URLComponentSource<char> source(base);
+    URLSegments parsed(baseParsed);
+    SetupOverrideComponents(base, replacements, &source, &parsed);
+    return doCanonicalizeFileURL<char, unsigned char>(source, parsed, queryConverter, output, *outputParsed);
+}
+
+bool ReplaceFileURL(const char* base,
+                    const URLSegments& baseParsed,
+                    const Replacements<UChar>& replacements,
+                    URLQueryCharsetConverter* queryConverter,
+                    URLBuffer<char>& output,
+                    URLSegments* outputParsed)
+{
+    RawURLBuffer<char> utf8;
+    URLComponentSource<char> source(base);
+    URLSegments parsed(baseParsed);
+    SetupUTF16OverrideComponents(base, replacements, utf8, &source, &parsed);
+    return doCanonicalizeFileURL<char, unsigned char>(source, parsed, queryConverter, output, *outputParsed);
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonHost.cpp b/Source/WTF/wtf/url/src/URLCanonHost.cpp
new file mode 100644
index 0000000..5ea2f99
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonHost.cpp
@@ -0,0 +1,383 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 "URLCanon.h"
+
+#include "RawURLBuffer.h"
+#include "URLCanonInternal.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+// For reference, here's what IE supports:
+// Key: 0 (disallowed: failure if present in the input)
+//      + (allowed either escaped or unescaped, and unmodified)
+//      U (allowed escaped or unescaped but always unescaped if present in
+//         escaped form)
+//      E (allowed escaped or unescaped but always escaped if present in
+//         unescaped form)
+//      % (only allowed escaped in the input, will be unmodified).
+//      I left blank alpha numeric characters.
+//
+//    00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
+//    -----------------------------------------------
+// 0   0  E  E  E  E  E  E  E  E  E  E  E  E  E  E  E
+// 1   E  E  E  E  E  E  E  E  E  E  E  E  E  E  E  E
+// 2   E  +  E  E  +  E  +  +  +  +  +  +  +  U  U  0
+// 3                                 %  %  E  +  E  0  <-- Those are  : ; < = > ?
+// 4   %
+// 5                                    U  0  U  U  U  <-- Those are  [ \ ] ^ _
+// 6   E                                               <-- That's  `
+// 7                                    E  E  E  U  E  <-- Those are { | } ~ (UNPRINTABLE)
+//
+// NOTE: I didn't actually test all the control characters. Some may be
+// disallowed in the input, but they are all accepted escaped except for 0.
+// I also didn't test if characters affecting HTML parsing are allowed
+// unescaped, eg. (") or (#), which would indicate the beginning of the path.
+// Surprisingly, space is accepted in the input and always escaped.
+
+// This table lists the canonical version of all characters we allow in the
+// input, with 0 indicating it is disallowed. We use the magic kEscapedHostChar
+// value to indicate that this character should be escaped. We are a little more
+// restrictive than IE, but less restrictive than Firefox.
+//
+// Note that we disallow the % character. We will allow it when part of an
+// escape sequence, of course, but this disallows "%25". Even though IE allows
+// it, allowing it would put us in a funny state. If there was an invalid
+// escape sequence like "%zz", we'll add "%25zz" to the output and fail.
+// Allowing percents means we'll succeed a second time, so validity would change
+// based on how many times you run the canonicalizer. We prefer to always report
+// the same vailidity, so reject this.
+const unsigned char kEsc = 0xff;
+const unsigned char kHostCharLookup[0x80] = {
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+//  ' '   !     "     #     $     %     &     '     (     )     *     +     ,     -     .     /
+    kEsc, kEsc, kEsc, kEsc, kEsc,   0,  kEsc, kEsc, kEsc, kEsc, kEsc,  '+', kEsc,  '-',  '.',   0,
+//   0    1    2    3    4    5    6    7    8    9    :    ;    <    =    >    ?
+    '0',  '1',  '2',  '3',  '4',  '5',  '6',  '7',  '8',  '9',  ':',   0 , kEsc, kEsc, kEsc,   0 ,
+//   @      A     B     C     D     E     F     G     H     I     J     K     L     M     N     O
+    kEsc,  'a',  'b',  'c',  'd',  'e',  'f',  'g',  'h',  'i',  'j',  'k',  'l',  'm',  'n',  'o',
+//   P     Q     R     S     T     U     V     W     X     Y     Z     [     \     ]     ^     _
+    'p',  'q',  'r',  's',  't',  'u',  'v',  'w',  'x',  'y',  'z',  '[',   0 ,  ']',   0 ,  '_',
+//   `      a     b     c     d     e     f     g     h     i     j     k     l     m     n     o
+    kEsc,  'a',  'b',  'c',  'd',  'e',  'f',  'g',  'h',  'i',  'j',  'k',  'l',  'm',  'n',  'o',
+//   p     q     r     s     t     u     v     w     x     y     z     {     |     }     ~
+    'p',  'q',  'r',  's',  't',  'u',  'v',  'w',  'x',  'y',  'z', kEsc, kEsc, kEsc,   0 ,   0 };
+
+typedef RawURLBuffer<char> StackBuffer;
+typedef RawURLBuffer<UChar> StackBufferW;
+
+// Scans a host name and fills in the output flags according to what we find.
+// |hasNonASCII| will be true if there are any non-7-bit characters, and
+// |hasEscaped| will be true if there is a percent sign.
+template<typename CharacterType, typename UCHAR>
+void scanHostname(const CharacterType* spec, const URLComponent& host, bool& hasNonASCII, bool& hasEscaped)
+{
+    int end = host.end();
+    hasNonASCII = false;
+    hasEscaped = false;
+    for (int i = host.begin(); i < end; ++i) {
+        if (static_cast<UCHAR>(spec[i]) >= 0x80)
+            hasNonASCII = true;
+        else if (spec[i] == '%')
+            hasEscaped = true;
+    }
+}
+
+// Canonicalizes a host name that is entirely 8-bit characters (even though
+// the type holding them may be 16 bits. Escaped characters will be unescaped.
+// Non-7-bit characters (for example, UTF-8) will be passed unchanged.
+//
+// The |*hasNonASCII| flag will be true if there are non-7-bit characters in
+// the output.
+//
+// This function is used in two situations:
+//
+//  * When the caller knows there is no non-ASCII or percent escaped
+//    characters. This is what DoHost does. The result will be a completely
+//    canonicalized host since we know nothing weird can happen (escaped
+//    characters could be unescaped to non-7-bit, so they have to be treated
+//    with suspicion at this point). It does not use the |hasNonASCII| flag.
+//
+//  * When the caller has an 8-bit string that may need unescaping.
+//    doComplexHost calls us this situation to do unescaping and validation.
+//    After this, it may do other IDN operations depending on the value of the
+//    |*hasNonASCII| flag.
+//
+// The return value indicates if the output is a potentially valid host name.
+template<typename INCHAR, typename OUTCHAR>
+bool doSimpleHost(const INCHAR* host, int hostLength, URLBuffer<OUTCHAR>& output, bool& hasNonASCII)
+{
+    hasNonASCII = false;
+
+    bool success = true;
+    for (int i = 0; i < hostLength; ++i) {
+        unsigned source = host[i];
+        if (source == '%') {
+            // Unescape first, if possible.
+            // Source will be used only if decode operation was successful.
+            if (!DecodeEscaped(host, &i, hostLength,
+                               reinterpret_cast<unsigned char*>(&source))) {
+                // Invalid escaped character. There is nothing that can make this
+                // host valid. We append an escaped percent so the URL looks reasonable
+                // and mark as failed.
+                appendURLEscapedCharacter('%', output);
+                success = false;
+                continue;
+            }
+        }
+
+        if (source < 0x80) {
+            // We have ASCII input, we can use our lookup table.
+            unsigned char replacement = kHostCharLookup[source];
+            if (!replacement) {
+                // Invalid character, add it as percent-escaped and mark as failed.
+                appendURLEscapedCharacter(source, output);
+                success = false;
+            } else if (replacement == kEsc) {
+                // This character is valid but should be escaped.
+                appendURLEscapedCharacter(source, output);
+            } else {
+                // Common case, the given character is valid in a hostname, the lookup
+                // table tells us the canonical representation of that character (lower
+                // cased).
+                output.append(replacement);
+            }
+        } else {
+            // It's a non-ascii char. Just push it to the output.
+            // In case where we have UChar input, and char output it's safe to
+            // cast UChar->char only if input string was converted to ASCII.
+            output.append(static_cast<OUTCHAR>(source));
+            hasNonASCII = true;
+        }
+    }
+
+    return success;
+}
+
+// Canonicalizes a host that requires IDN conversion. Returns true on success
+bool doIDNHost(const UChar* src, int sourceLength, URLBuffer<char>& output)
+{
+    // We need to escape URL before doing IDN conversion, since punicode strings
+    // cannot be escaped after they are created.
+    RawURLBuffer<UChar> urlEscapedHost;
+    bool hasNonASCII;
+    doSimpleHost(src, sourceLength, urlEscapedHost, hasNonASCII);
+
+    StackBufferW wideOutput;
+    if (!IDNToASCII(urlEscapedHost.data(),
+                    urlEscapedHost.length(),
+                    wideOutput)) {
+        // Some error, give up. This will write some reasonable looking
+        // representation of the string to the output.
+        AppendInvalidNarrowString(src, 0, sourceLength, output);
+        return false;
+    }
+
+    // Now we check the ASCII output like a normal host. It will also handle
+    // unescaping. Although we unescaped everything before this function call, if
+    // somebody does %00 as fullwidth, ICU will convert this to ASCII.
+    bool success = doSimpleHost(wideOutput.data(), wideOutput.length(), output, hasNonASCII);
+    ASSERT(!hasNonASCII);
+    return success;
+}
+
+// 8-bit convert host to its ASCII version: this converts the UTF-8 input to
+// UTF-16. The hasEscaped flag should be set if the input string requires
+// unescaping.
+bool doComplexHost(const char* host, int hostLength, bool hasNonASCII, bool hasEscaped, URLBuffer<char>& output)
+{
+    // Save the current position in the output. We may write stuff and rewind it
+    // below, so we need to know where to rewind to.
+    int beginLength = output.length();
+
+    // Points to the UTF-8 data we want to convert. This will either be the
+    // input or the unescaped version written to |output| if necessary.
+    const char* utf8Source;
+    int utf8SourceLength;
+    if (hasEscaped) {
+        // Unescape before converting to UTF-16 for IDN. We write this into the
+        // output because it most likely does not require IDNization, and we can
+        // save another huge stack buffer. It will be replaced below if it requires
+        // IDN. This will also update our non-ASCII flag so we know whether the
+        // unescaped input requires IDN.
+        if (!doSimpleHost(host, hostLength, output, hasNonASCII)) {
+            // Error with some escape sequence. We'll call the current output
+            // complete. doSimpleHost will have written some "reasonable" output.
+            return false;
+        }
+
+        // Unescaping may have left us with ASCII input, in which case the
+        // unescaped version we wrote to output is complete.
+        if (!hasNonASCII)
+            return true;
+
+        // Save the pointer into the data was just converted (it may be appended to
+        // other data in the output buffer).
+        utf8Source = &output.data()[beginLength];
+        utf8SourceLength = output.length() - beginLength;
+    } else {
+        // We don't need to unescape, use input for IDNization later. (We know the
+        // input has non-ASCII, or the simple version would have been called
+        // instead of us.)
+        utf8Source = host;
+        utf8SourceLength = hostLength;
+    }
+
+    // Non-ASCII input requires IDN, convert to UTF-16 and do the IDN conversion.
+    // Above, we may have used the output to write the unescaped values to, so
+    // we have to rewind it to where we started after we convert it to UTF-16.
+    StackBufferW utf16;
+    if (!ConvertUTF8ToUTF16(utf8Source, utf8SourceLength, utf16)) {
+        // In this error case, the input may or may not be the output.
+        StackBuffer utf8;
+        for (int i = 0; i < utf8SourceLength; i++)
+            utf8.append(utf8Source[i]);
+        output.setLength(beginLength);
+        AppendInvalidNarrowString(utf8.data(), 0, utf8.length(), output);
+        return false;
+    }
+    output.setLength(beginLength);
+
+    // This will call doSimpleHost which will do normal ASCII canonicalization
+    // and also check for IP addresses in the outpt.
+    return doIDNHost(utf16.data(), utf16.length(), output);
+}
+
+// UTF-16 convert host to its ASCII version. The set up is already ready for
+// the backend, so we just pass through. The hasEscaped flag should be set if
+// the input string requires unescaping.
+bool doComplexHost(const UChar* host, int hostLength, bool hasNonASCII, bool hasEscaped, URLBuffer<char>& output)
+{
+    if (hasEscaped) {
+        // Yikes, we have escaped characters with wide input. The escaped
+        // characters should be interpreted as UTF-8. To solve this problem,
+        // we convert to UTF-8, unescape, then convert back to UTF-16 for IDN.
+        //
+        // We don't bother to optimize the conversion in the ASCII case (which
+        // *could* just be a copy) and use the UTF-8 path, because it should be
+        // very rare that host names have escaped characters, and it is relatively
+        // fast to do the conversion anyway.
+        StackBuffer utf8;
+        if (!ConvertUTF16ToUTF8(host, hostLength, utf8)) {
+            AppendInvalidNarrowString(host, 0, hostLength, output);
+            return false;
+        }
+
+        // Once we convert to UTF-8, we can use the 8-bit version of the complex
+        // host handling code above.
+        return doComplexHost(utf8.data(), utf8.length(), hasNonASCII,
+                             hasEscaped, output);
+    }
+
+    // No unescaping necessary, we can safely pass the input to ICU. This
+    // function will only get called if we either have escaped or non-ascii
+    // input, so it's safe to just use ICU now. Even if the input is ASCII,
+    // this function will do the right thing (just slower than we could).
+    return doIDNHost(host, hostLength, output);
+}
+
+template<typename CharacterType, typename UCHAR>
+void doHost(const CharacterType* spec, const URLComponent& host, URLBuffer<char>& output, CanonHostInfo& hostInfo)
+{
+    if (host.length() <= 0) {
+        // Empty hosts don't need anything.
+        hostInfo.family = CanonHostInfo::NEUTRAL;
+        hostInfo.ouputHost = URLComponent();
+        return;
+    }
+
+    bool hasNonASCII;
+    bool hasEscaped;
+    scanHostname<CharacterType, UCHAR>(spec, host, hasNonASCII, hasEscaped);
+
+    // Keep track of output's initial length, so we can rewind later.
+    const int outputBegin = output.length();
+
+    bool success;
+    if (!hasNonASCII && !hasEscaped) {
+        success = doSimpleHost(&spec[host.begin()], host.length(), output, hasNonASCII);
+        ASSERT(!hasNonASCII);
+    } else
+        success = doComplexHost(&spec[host.begin()], host.length(), hasNonASCII, hasEscaped, output);
+
+    if (!success) {
+        // Canonicalization failed. Set BROKEN to notify the caller.
+        hostInfo.family = CanonHostInfo::BROKEN;
+    } else {
+        // After all the other canonicalization, check if we ended up with an IP
+        // address. IP addresses are small, so writing into this temporary buffer
+        // should not cause an allocation.
+        RawURLBuffer<char, 64> canon_ip;
+        canonicalizeIPAddress(output.data(), URLComponent::fromRange(outputBegin, output.length()), canon_ip, hostInfo);
+
+        // If we got an IPv4/IPv6 address, copy the canonical form back to the
+        // real buffer. Otherwise, it's a hostname or broken IP, in which case
+        // we just leave it in place.
+        if (hostInfo.IsIPAddress()) {
+            output.setLength(outputBegin);
+            output.append(canon_ip.data(), canon_ip.length());
+        }
+    }
+
+    hostInfo.ouputHost = URLComponent::fromRange(outputBegin, output.length());
+}
+
+} // namespace
+
+bool canonicalizeHost(const char* spec, const URLComponent& host, URLBuffer<char>& output, URLComponent& ouputHost)
+{
+    CanonHostInfo hostInfo;
+    doHost<char, unsigned char>(spec, host, output, hostInfo);
+    ouputHost = hostInfo.ouputHost;
+    return (hostInfo.family != CanonHostInfo::BROKEN);
+}
+
+bool canonicalizeHost(const UChar* spec, const URLComponent& host, URLBuffer<char>& output, URLComponent& ouputHost)
+{
+    CanonHostInfo hostInfo;
+    doHost<UChar, UChar>(spec, host, output, hostInfo);
+    ouputHost = hostInfo.ouputHost;
+    return (hostInfo.family != CanonHostInfo::BROKEN);
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonICU.cpp b/Source/WTF/wtf/url/src/URLCanonICU.cpp
new file mode 100644
index 0000000..e61fa70
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonICU.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2011 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// ICU integration functions.
+
+#include "config.h"
+
+#if USE(WTFURL)
+
+#include "URLCanonInternal.h" // for _itoa_s
+#include <stdlib.h>
+#include <string.h>
+#include <unicode/ucnv.h>
+#include <unicode/ucnv_cb.h>
+#include <unicode/uidna.h>
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+// Called when converting a character that can not be represented, this will
+// append an escaped version of the numerical character reference for that code
+// point. It is of the form "&#1234;" and we will escape the non-digits to
+// "%26%231234%3B". Why? This is what Netscape did back in the olden days.
+void appendURLEscapedChar(const void* /* context */,
+                          UConverterFromUnicodeArgs* fromArgs,
+                          const UChar* /* code_units */,
+                          int32_t /* length */,
+                          UChar32 codePoint,
+                          UConverterCallbackReason reason,
+                          UErrorCode* err)
+{
+    if (reason == UCNV_UNASSIGNED) {
+        *err = U_ZERO_ERROR;
+
+        const static int prefixLength = 6;
+        const static char prefix[prefixLength + 1] = "%26%23"; // "&#" percent-escaped
+        ucnv_cbFromUWriteBytes(fromArgs, prefix, prefixLength, 0, err);
+
+        ASSERT(codePoint < 0x110000);
+        char number[8]; // Max Unicode code point is 7 digits.
+        _itoa_s(codePoint, number, 10);
+        int numberLength = static_cast<int>(strlen(number));
+        ucnv_cbFromUWriteBytes(fromArgs, number, numberLength, 0, err);
+
+        const static int postfixLength = 3;
+        const static char postfix[postfixLength + 1] = "%3B"; // ";" percent-escaped
+        ucnv_cbFromUWriteBytes(fromArgs, postfix, postfixLength, 0, err);
+    }
+}
+
+// A class for scoping the installation of the invalid character callback.
+class AppendHandlerInstaller {
+public:
+    // The owner of this object must ensure that the converter is alive for the
+    // duration of this object's lifetime.
+    AppendHandlerInstaller(UConverter* converter)
+        : m_converter(converter)
+    {
+        UErrorCode err = U_ZERO_ERROR;
+        ucnv_setFromUCallBack(m_converter, appendURLEscapedChar, 0, &m_oldCallback, &m_oldContext, &err);
+    }
+
+    ~AppendHandlerInstaller()
+    {
+        UErrorCode err = U_ZERO_ERROR;
+        ucnv_setFromUCallBack(m_converter, m_oldCallback, m_oldContext, 0, 0, &err);
+    }
+
+private:
+    UConverter* m_converter;
+
+    UConverterFromUCallback m_oldCallback;
+    const void* m_oldContext;
+};
+
+} // namespace
+
+// Converts the Unicode input representing a hostname to ASCII using IDN rules.
+// The output must be ASCII, but is represented as wide characters.
+//
+// On success, the output will be filled with the ASCII host name and it will
+// return true. Unlike most other canonicalization functions, this assumes that
+// the output is empty. The beginning of the host will be at offset 0, and
+// the length of the output will be set to the length of the new host name.
+//
+// On error, this will return false. The output in this case is undefined.
+bool IDNToASCII(const UChar* src, int sourceLength, URLBuffer<UChar>& output)
+{
+    ASSERT(!output.length()); // Output buffer is assumed empty.
+    while (true) {
+        // Use ALLOW_UNASSIGNED to be more tolerant of hostnames that violate
+        // the spec (which do exist). This does not present any risk and is a
+        // little more future proof.
+        UErrorCode err = U_ZERO_ERROR;
+        int numConverted = uidna_IDNToASCII(src, sourceLength, output.data(),
+                                             output.capacity(),
+                                             UIDNA_ALLOW_UNASSIGNED, 0, &err);
+        if (err == U_ZERO_ERROR) {
+            output.setLength(numConverted);
+            return true;
+        }
+        if (err != U_BUFFER_OVERFLOW_ERROR)
+            return false; // Unknown error, give up.
+
+        // Not enough room in our buffer, expand.
+        output.resize(output.capacity() * 2);
+    }
+}
+
+bool readUTFChar(const char* str, int* begin, int length, unsigned* codePointOut)
+{
+    int codePoint; // Avoids warning when U8_NEXT writes -1 to it.
+    U8_NEXT(str, *begin, length, codePoint);
+    *codePointOut = static_cast<unsigned>(codePoint);
+
+    // The ICU macro above moves to the next char, we want to point to the last
+    // char consumed.
+    (*begin)--;
+
+    // Validate the decoded value.
+    if (U_IS_UNICODE_CHAR(codePoint))
+        return true;
+    *codePointOut = kUnicodeReplacementCharacter;
+    return false;
+}
+
+bool readUTFChar(const UChar* str, int* begin, int length, unsigned* codePoint)
+{
+    if (U16_IS_SURROGATE(str[*begin])) {
+        if (!U16_IS_SURROGATE_LEAD(str[*begin]) || *begin + 1 >= length || !U16_IS_TRAIL(str[*begin + 1])) {
+            // Invalid surrogate pair.
+            *codePoint = kUnicodeReplacementCharacter;
+            return false;
+        }
+
+        // Valid surrogate pair.
+        *codePoint = U16_GET_SUPPLEMENTARY(str[*begin], str[*begin + 1]);
+        (*begin)++;
+    } else {
+        // Not a surrogate, just one 16-bit word.
+        *codePoint = str[*begin];
+    }
+
+    if (U_IS_UNICODE_CHAR(*codePoint))
+        return true;
+
+    // Invalid code point.
+    *codePoint = kUnicodeReplacementCharacter;
+    return false;
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonIP.cpp b/Source/WTF/wtf/url/src/URLCanonIP.cpp
new file mode 100644
index 0000000..4462353
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonIP.cpp
@@ -0,0 +1,683 @@
+/*
+ * Copyright 2009 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 "URLCanonInternal.h"
+#include "URLCharacterTypes.h"
+#include <limits>
+#include <stdint.h>
+#include <stdlib.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+// Converts one of the character types that represent a numerical base to the
+// corresponding base.
+static inline int baseForType(URLCharacterTypes::CharacterTypes type)
+{
+    switch (type) {
+    case URLCharacterTypes::HexadecimalCharacter:
+        return 16;
+    case URLCharacterTypes::DecimalCharacter:
+        return 10;
+    case URLCharacterTypes::OctalCharacter:
+        return 8;
+    default:
+        return 0;
+    }
+}
+
+// Converts an IPv4 component to a 32-bit number, while checking for overflow.
+//
+// Possible return values:
+// - IPV4    - The number was valid, and did not overflow.
+// - BROKEN  - The input was numeric, but too large for a 32-bit field.
+// - NEUTRAL - Input was not numeric.
+//
+// The input is assumed to be ASCII. FindIPv4Components should have stripped
+// out any input that is greater than 7 bits. The components are assumed
+// to be non-empty.
+template<typename CharacterType>
+CanonHostInfo::Family IPv4ComponentToNumber(const CharacterType* spec, const URLComponent& component, uint32_t* number)
+{
+    // Figure out the base
+    URLCharacterTypes::CharacterTypes base;
+    int basePrefixLength = 0; // Size of the prefix for this base.
+    if (spec[component.begin()] == '0') {
+        // Either hex or dec, or a standalone zero.
+        if (component.length() == 1) {
+            base = URLCharacterTypes::DecimalCharacter;
+        } else if (spec[component.begin() + 1] == 'X' || spec[component.begin() + 1] == 'x') {
+            base = URLCharacterTypes::HexadecimalCharacter;
+            basePrefixLength = 2;
+        } else {
+            base = URLCharacterTypes::OctalCharacter;
+            basePrefixLength = 1;
+        }
+    } else
+        base = URLCharacterTypes::DecimalCharacter;
+
+    // Extend the prefix to consume all leading zeros.
+    while (basePrefixLength < component.length() && spec[component.begin() + basePrefixLength] == '0')
+        ++basePrefixLength;
+
+    // Put the component, minus any base prefix, into a zero-terminated buffer so
+    // we can call the standard library. Because leading zeros have already been
+    // discarded, filling the entire buffer is guaranteed to trigger the 32-bit
+    // overflow check.
+    const int kMaxComponentLen = 16;
+    char buf[kMaxComponentLen + 1]; // digits + '\0'
+    int destI = 0;
+    for (int i = component.begin() + basePrefixLength; i < component.end(); i++) {
+        // We know the input is 7-bit, so convert to narrow (if this is the wide
+        // version of the template) by casting.
+        char input = static_cast<char>(spec[i]);
+
+        // Validate that this character is OK for the given base.
+        if (!URLCharacterTypes::isCharacterOfType(input, base))
+            return CanonHostInfo::NEUTRAL;
+
+        // Fill the buffer, if there's space remaining. This check allows us to
+        // verify that all characters are numeric, even those that don't fit.
+        if (destI < kMaxComponentLen)
+            buf[destI++] = input;
+    }
+
+    buf[destI] = '\0';
+
+    // Use the 64-bit strtoi so we get a big number (no hex, decimal, or octal
+    // number can overflow a 64-bit number in <= 16 characters).
+    uint64_t num = _strtoui64(buf, 0, baseForType(base));
+
+    // Check for 32-bit overflow.
+    if (num > std::numeric_limits<uint32_t>::max())
+        return CanonHostInfo::BROKEN;
+
+    // No overflow. Success!
+    *number = static_cast<uint32_t>(num);
+    return CanonHostInfo::IPV4;
+}
+
+template<typename CharacterType, typename UCHAR>
+bool doFindIPv4Components(const CharacterType* spec, const URLComponent& host, URLComponent components[4])
+{
+    if (!host.isNonEmpty())
+        return false;
+
+    int currentComponent = 0; // Index of the component we're working on.
+    int currentComponentBegin = host.begin(); // Start of the current component.
+    int end = host.end();
+    for (int i = host.begin(); /* nothing */; ++i) {
+        if (i >= end || spec[i] == '.') {
+            // Found the end of the current component.
+            int componentLength = i - currentComponentBegin;
+            components[currentComponent] = URLComponent(currentComponentBegin, componentLength);
+
+            // The next component starts after the dot.
+            currentComponentBegin = i + 1;
+            currentComponent++;
+
+            // Don't allow empty components (two dots in a row), except we may
+            // allow an empty component at the end (this would indicate that the
+            // input ends in a dot). We also want to error if the component is
+            // empty and it's the only component (currentComponent == 1).
+            if (!componentLength && (i < end || currentComponent == 1))
+                return false;
+
+            if (i >= end)
+                break; // End of the input.
+
+            if (currentComponent == 4) {
+                // Anything else after the 4th component is an error unless it is a
+                // dot that would otherwise be treated as the end of input.
+                if (spec[i] == '.' && i + 1 == end)
+                    break;
+                return false;
+            }
+        } else if (static_cast<UCHAR>(spec[i]) >= 0x80 || !URLCharacterTypes::isIPv4Char(static_cast<unsigned char>(spec[i]))) {
+            // Invalid character for an IPv4 address.
+            return false;
+        }
+    }
+
+    // Fill in any unused components.
+    while (currentComponent < 4)
+        components[currentComponent++] = URLComponent();
+    return true;
+}
+
+static bool FindIPv4Components(const char* spec, const URLComponent& host, URLComponent components[4])
+{
+    return doFindIPv4Components<char, unsigned char>(spec, host, components);
+}
+
+static bool FindIPv4Components(const UChar* spec, const URLComponent& host, URLComponent components[4])
+{
+    return doFindIPv4Components<UChar, UChar>(spec, host, components);
+}
+
+template<typename CharacterType>
+CanonHostInfo::Family doIPv4AddressToNumber(const CharacterType* spec, const URLComponent& host, unsigned char address[4], int& ipv4ComponentsCount)
+{
+    // The identified components. Not all may exist.
+    URLComponent components[4];
+    if (!FindIPv4Components(spec, host, components))
+        return CanonHostInfo::NEUTRAL;
+
+    // Convert existing components to digits. Values up to
+    // |existingComponents| will be valid.
+    uint32_t componentValues[4];
+    int existingComponents = 0;
+
+    // Set to true if one or more components are BROKEN. BROKEN is only
+    // returned if all components are IPV4 or BROKEN, so, for example,
+    // 12345678912345.de returns NEUTRAL rather than broken.
+    bool broken = false;
+    for (int i = 0; i < 4; i++) {
+        if (components[i].length() <= 0)
+            continue;
+        CanonHostInfo::Family family = IPv4ComponentToNumber(spec, components[i], &componentValues[existingComponents]);
+
+        if (family == CanonHostInfo::BROKEN)
+            broken = true;
+        else if (family != CanonHostInfo::IPV4) {
+            // Stop if we hit a non-BROKEN invalid non-empty component.
+            return family;
+        }
+
+        existingComponents++;
+    }
+
+    if (broken)
+        return CanonHostInfo::BROKEN;
+
+    // Use that sequence of numbers to fill out the 4-component IP address.
+
+    // First, process all components but the last, while making sure each fits
+    // within an 8-bit field.
+    for (int i = 0; i < existingComponents - 1; i++) {
+        if (componentValues[i] > std::numeric_limits<uint8_t>::max())
+            return CanonHostInfo::BROKEN;
+        address[i] = static_cast<unsigned char>(componentValues[i]);
+    }
+
+    // Next, consume the last component to fill in the remaining bytes.
+    uint32_t lastValue = componentValues[existingComponents - 1];
+    for (int i = 3; i >= existingComponents - 1; i--) {
+        address[i] = static_cast<unsigned char>(lastValue);
+        lastValue >>= 8;
+    }
+
+    // If the last component has residual bits, report overflow.
+    if (lastValue)
+        return CanonHostInfo::BROKEN;
+
+    // Tell the caller how many components we saw.
+    ipv4ComponentsCount = existingComponents;
+
+    // Success!
+    return CanonHostInfo::IPV4;
+}
+
+static inline void appendIPv4Address(const unsigned char address[4], URLBuffer<char>& output)
+{
+    for (int i = 0; i < 4; ++i) {
+        char buffer[16];
+        _itoa_s(address[i], buffer, 10);
+
+        for (int ch = 0; buffer[ch]; ch++)
+            output.append(buffer[ch]);
+
+        if (i != 3)
+            output.append('.');
+    }
+}
+
+// Return true if we've made a final IPV4/BROKEN decision, false if the result
+// is NEUTRAL, and we could use a second opinion.
+template<typename CharacterType, typename UCHAR>
+bool doCanonicalizeIPv4Address(const CharacterType* spec, const URLComponent& host, URLBuffer<char>& output, CanonHostInfo& hostInfo)
+{
+    hostInfo.family = doIPv4AddressToNumber(spec, host, hostInfo.address, hostInfo.ipv4ComponentsCount);
+
+    switch (hostInfo.family) {
+    case CanonHostInfo::IPV4:
+        // Definitely an IPv4 address.
+        hostInfo.ouputHost.setBegin(output.length());
+        appendIPv4Address(hostInfo.address, output);
+        hostInfo.ouputHost.setLength(output.length() - hostInfo.ouputHost.begin());
+        return true;
+    case CanonHostInfo::BROKEN:
+        // Definitely broken.
+        return true;
+    default:
+        // Could be IPv6 or a hostname.
+        return false;
+    }
+}
+
+// Helper class that describes the main components of an IPv6 input string.
+// See the following examples to understand how it breaks up an input string:
+//
+// [Example 1]: input = "[::aa:bb]"
+//  ==> numHexComponents = 2
+//  ==> hexComponents[0] = Component(3,2) "aa"
+//  ==> hexComponents[1] = Component(6,2) "bb"
+//  ==> indexOfContraction = 0
+//  ==> ipv4Component = Component(0, -1)
+//
+// [Example 2]: input = "[1:2::3:4:5]"
+//  ==> numHexComponents = 5
+//  ==> hexComponents[0] = Component(1,1) "1"
+//  ==> hexComponents[1] = Component(3,1) "2"
+//  ==> hexComponents[2] = Component(6,1) "3"
+//  ==> hexComponents[3] = Component(8,1) "4"
+//  ==> hexComponents[4] = Component(10,1) "5"
+//  ==> indexOfContraction = 2
+//  ==> ipv4Component = Component(0, -1)
+//
+// [Example 3]: input = "[::ffff:192.168.0.1]"
+//  ==> numHexComponents = 1
+//  ==> hexComponents[0] = Component(3,4) "ffff"
+//  ==> indexOfContraction = 0
+//  ==> ipv4Component = Component(8, 11) "192.168.0.1"
+//
+// [Example 4]: input = "[1::]"
+//  ==> numHexComponents = 1
+//  ==> hexComponents[0] = Component(1,1) "1"
+//  ==> indexOfContraction = 1
+//  ==> ipv4Component = Component(0, -1)
+//
+// [Example 5]: input = "[::192.168.0.1]"
+//  ==> numHexComponents = 0
+//  ==> indexOfContraction = 0
+//  ==> ipv4Component = Component(8, 11) "192.168.0.1"
+//
+struct IPv6Parsed {
+    // Zero-out the parse information.
+    void reset()
+    {
+        numHexComponents = 0;
+        indexOfContraction = -1;
+        ipv4Component.reset();
+    }
+
+    // There can be up to 8 hex components (colon separated) in the literal.
+    URLComponent hexComponents[8];
+
+    // The count of hex components present. Ranges from [0,8].
+    int numHexComponents;
+
+    // The index of the hex component that the "::" contraction precedes, or
+    // -1 if there is no contraction.
+    int indexOfContraction;
+
+    // The range of characters which are an IPv4 literal.
+    URLComponent ipv4Component;
+};
+
+// Parse the IPv6 input string. If parsing succeeded returns true and fills
+// |parsed| with the information. If parsing failed (because the input is
+// invalid) returns false.
+template<typename CharacterType, typename UCHAR>
+bool doParseIPv6(const CharacterType* spec, const URLComponent& host, IPv6Parsed& parsed)
+{
+    // Zero-out the info.
+    parsed.reset();
+
+    if (!host.isNonEmpty())
+        return false;
+
+    // The index for start and end of address range (no brackets).
+    int begin = host.begin();
+    int end = host.end();
+
+    int currentComponentBegin = begin; // Start of the current component.
+
+    // Scan through the input, searching for hex components, "::" contractions,
+    // and IPv4 components.
+    for (int i = begin; /* i <= end */; i++) {
+        bool isColon = spec[i] == ':';
+        bool isContraction = isColon && i < end - 1 && spec[i + 1] == ':';
+
+        // We reached the end of the current component if we encounter a colon
+        // (separator between hex components, or start of a contraction), or end of
+        // input.
+        if (isColon || i == end) {
+            int componentLength = i - currentComponentBegin;
+
+            // A component should not have more than 4 hex digits.
+            if (componentLength > 4)
+                return false;
+
+            // Don't allow empty components.
+            if (!componentLength) {
+                // The exception is when contractions appear at beginning of the
+                // input or at the end of the input.
+                if (!((isContraction && i == begin) || (i == end && parsed.indexOfContraction == parsed.numHexComponents)))
+                    return false;
+            }
+
+            // Add the hex component we just found to running list.
+            if (componentLength > 0) {
+                // Can't have more than 8 components!
+                if (parsed.numHexComponents >= 8)
+                    return false;
+
+                parsed.hexComponents[parsed.numHexComponents++] =
+                URLComponent(currentComponentBegin, componentLength);
+            }
+        }
+
+        if (i == end)
+            break; // Reached the end of the input, DONE.
+
+        // We found a "::" contraction.
+        if (isContraction) {
+            // There can be at most one contraction in the literal.
+            if (parsed.indexOfContraction != -1)
+                return false;
+            parsed.indexOfContraction = parsed.numHexComponents;
+            ++i; // Consume the colon we peeked.
+        }
+
+        if (isColon) {
+            // Colons are separators between components, keep track of where the
+            // current component started (after this colon).
+            currentComponentBegin = i + 1;
+        } else {
+            if (static_cast<UCHAR>(spec[i]) >= 0x80)
+                return false; // Not ASCII.
+
+            if (!URLCharacterTypes::isHexChar(static_cast<unsigned char>(spec[i]))) {
+                // Regular components are hex numbers. It is also possible for
+                // a component to be an IPv4 address in dotted form.
+                if (URLCharacterTypes::isIPv4Char(static_cast<unsigned char>(spec[i]))) {
+                    // Since IPv4 address can only appear at the end, assume the rest
+                    // of the string is an IPv4 address. (We will parse this separately
+                    // later).
+                    parsed.ipv4Component = URLComponent::fromRange(currentComponentBegin, end);
+                    break;
+                }
+                // The character was neither a hex digit, nor an IPv4 character.
+                return false;
+            }
+        }
+    }
+
+    return true;
+}
+
+// Verifies the parsed IPv6 information, checking that the various components
+// add up to the right number of bits (hex components are 16 bits, while
+// embedded IPv4 formats are 32 bits, and contractions are placeholdes for
+// 16 or more bits). Returns true if sizes match up, false otherwise. On
+// success writes the length of the contraction (if any) to
+// |outNumBytesOfContraction|.
+bool CheckIPv6ComponentsSize(const IPv6Parsed& parsed, int* outNumBytesOfContraction)
+{
+    // Each group of four hex digits contributes 16 bits.
+    int numBytesWithoutContraction = parsed.numHexComponents * 2;
+
+    // If an IPv4 address was embedded at the end, it contributes 32 bits.
+    if (parsed.ipv4Component.isValid())
+        numBytesWithoutContraction += 4;
+
+    // If there was a "::" contraction, its size is going to be:
+    // MAX([16bits], [128bits] - numBytesWithoutContraction).
+    int numBytesOfContraction = 0;
+    if (parsed.indexOfContraction != -1) {
+        numBytesOfContraction = 16 - numBytesWithoutContraction;
+        if (numBytesOfContraction < 2)
+            numBytesOfContraction = 2;
+    }
+
+    // Check that the numbers add up.
+    if (numBytesWithoutContraction + numBytesOfContraction != 16)
+        return false;
+
+    *outNumBytesOfContraction = numBytesOfContraction;
+    return true;
+}
+
+// Converts a hex comonent into a number. This cannot fail since the caller has
+// already verified that each character in the string was a hex digit, and
+// that there were no more than 4 characters.
+template<typename CharacterType>
+uint16_t IPv6HexComponentToNumber(const CharacterType* spec, const URLComponent& component)
+{
+    ASSERT(component.length() <= 4);
+
+    // Copy the hex string into a C-string.
+    char buf[5];
+    for (int i = 0; i < component.length(); ++i)
+        buf[i] = static_cast<char>(spec[component.begin() + i]);
+    buf[component.length()] = '\0';
+
+    // Convert it to a number (overflow is not possible, since with 4 hex
+    // characters we can at most have a 16 bit number).
+    return static_cast<uint16_t>(_strtoui64(buf, 0, 16));
+}
+
+// Converts an IPv6 address to a 128-bit number (network byte order), returning
+// true on success. False means that the input was not a valid IPv6 address.
+template<typename CharacterType, typename UCHAR>
+bool doIPv6AddressToNumber(const CharacterType* spec,
+                           const URLComponent& host,
+                           unsigned char address[16])
+{
+    // Make sure the component is bounded by '[' and ']'.
+    int end = host.end();
+    if (!host.isNonEmpty() || spec[host.begin()] != '[' || spec[end - 1] != ']')
+        return false;
+
+    // Exclude the square brackets.
+    URLComponent ipv6Component(host.begin() + 1, host.length() - 2);
+
+    // Parse the IPv6 address -- identify where all the colon separated hex
+    // components are, the "::" contraction, and the embedded IPv4 address.
+    IPv6Parsed ipv6Parsed;
+    if (!doParseIPv6<CharacterType, UCHAR>(spec, ipv6Component, ipv6Parsed))
+        return false;
+
+    // Do some basic size checks to make sure that the address doesn't
+    // specify more than 128 bits or fewer than 128 bits. This also resolves
+    // how may zero bytes the "::" contraction represents.
+    int numBytesOfContraction;
+    if (!CheckIPv6ComponentsSize(ipv6Parsed, &numBytesOfContraction))
+        return false;
+
+    int currentIndexInAddress = 0;
+
+    // Loop through each hex components, and contraction in order.
+    for (int i = 0; i <= ipv6Parsed.numHexComponents; ++i) {
+        // Append the contraction if it appears before this component.
+        if (i == ipv6Parsed.indexOfContraction) {
+            for (int j = 0; j < numBytesOfContraction; ++j)
+                address[currentIndexInAddress++] = 0;
+        }
+        // Append the hex component's value.
+        if (i != ipv6Parsed.numHexComponents) {
+            // Get the 16-bit value for this hex component.
+            uint16_t number = IPv6HexComponentToNumber<CharacterType>(spec, ipv6Parsed.hexComponents[i]);
+            // Append to |address|, in network byte order.
+            address[currentIndexInAddress++] = (number & 0xFF00) >> 8;
+            address[currentIndexInAddress++] = (number & 0x00FF);
+        }
+    }
+
+    // If there was an IPv4 section, convert it into a 32-bit number and append
+    // it to |address|.
+    if (ipv6Parsed.ipv4Component.isValid()) {
+        // Append the 32-bit number to |address|.
+        int ignoredIPv4ComponentsCount;
+        if (CanonHostInfo::IPV4 !=
+            doIPv4AddressToNumber(spec, ipv6Parsed.ipv4Component, &address[currentIndexInAddress], ignoredIPv4ComponentsCount))
+            return false;
+    }
+
+    return true;
+}
+
+// Searches for the longest sequence of zeros in |address|, and writes the
+// range into |contractionRange|. The run of zeros must be at least 16 bits,
+// and if there is a tie the first is chosen.
+void ChooseIPv6ContractionRange(const unsigned char address[16], URLComponent* contractionRange)
+{
+    // The longest run of zeros in |address| seen so far.
+    URLComponent maxRange;
+
+    // The current run of zeros in |address| being iterated over.
+    URLComponent currentRange;
+
+    for (int i = 0; i < 16; i += 2) {
+        // Test for 16 bits worth of zero.
+        bool isZero = (!address[i] && !address[i + 1]);
+
+        if (isZero) {
+            // Add the zero to the current range (or start a new one).
+            if (!currentRange.isValid())
+                currentRange = URLComponent(i, 0);
+            currentRange.setLength(currentRange.length() + 2);
+        }
+
+        if (!isZero || i == 14) {
+            // Just completed a run of zeros. If the run is greater than 16 bits,
+            // it is a candidate for the contraction.
+            if (currentRange.length() > 2 && currentRange.length() > maxRange.length())
+                maxRange = currentRange;
+
+            currentRange.reset();
+        }
+    }
+    *contractionRange = maxRange;
+}
+
+static inline void appendIPv6Address(const unsigned char address[16], URLBuffer<char>& output)
+{
+    // We will output the address according to the rules in:
+    // http://tools.ietf.org/html/draft-kawamura-ipv6-text-representation-01#section-4
+
+    // Start by finding where to place the "::" contraction (if any).
+    URLComponent contractionRange;
+    ChooseIPv6ContractionRange(address, &contractionRange);
+
+    for (int i = 0; i <= 14;) {
+        // We check 2 bytes at a time, from bytes (0, 1) to (14, 15), inclusive.
+        ASSERT(!(i % 2));
+        if (i == contractionRange.begin() && contractionRange.length() > 0) {
+            // Jump over the contraction.
+            if (!i)
+                output.append(':');
+            output.append(':');
+            i = contractionRange.end();
+        } else {
+            // Consume the next 16 bits from |address|.
+            int x = address[i] << 8 | address[i + 1];
+
+            i += 2;
+
+            // Stringify the 16 bit number (at most requires 4 hex digits).
+            char str[5];
+            _itoa_s(x, str, 16);
+            for (int ch = 0; str[ch]; ++ch)
+                output.append(str[ch]);
+
+            // Put a colon after each number, except the last.
+            if (i < 16)
+                output.append(':');
+        }
+    }
+}
+
+// Return true if we've made a final IPV6/BROKEN decision, false if the result
+// is NEUTRAL, and we could use a second opinion.
+template<typename CharacterType, typename UCHAR>
+bool doCanonicalizeIPv6Address(const CharacterType* spec, const URLComponent& host, URLBuffer<char>& output, CanonHostInfo& hostInfo)
+{
+    // Turn the IP address into a 128 bit number.
+    if (!doIPv6AddressToNumber<CharacterType, UCHAR>(spec, host, hostInfo.address)) {
+        // If it's not an IPv6 address, scan for characters that should *only*
+        // exist in an IPv6 address.
+        for (int i = host.begin(); i < host.end(); i++) {
+            switch (spec[i]) {
+            case '[':
+            case ']':
+            case ':':
+                hostInfo.family = CanonHostInfo::BROKEN;
+                return true;
+            }
+        }
+
+        // No invalid characters. Could still be IPv4 or a hostname.
+        hostInfo.family = CanonHostInfo::NEUTRAL;
+        return false;
+    }
+
+    hostInfo.ouputHost.setBegin(output.length());
+    output.append('[');
+    appendIPv6Address(hostInfo.address, output);
+    output.append(']');
+    hostInfo.ouputHost.setLength(output.length() - hostInfo.ouputHost.begin());
+
+    hostInfo.family = CanonHostInfo::IPV6;
+    return true;
+}
+
+} // namespace
+
+void canonicalizeIPAddress(const char* spec, const URLComponent& host, URLBuffer<char>& output, CanonHostInfo& hostInfo)
+{
+    if (doCanonicalizeIPv4Address<char, unsigned char>(spec, host, output, hostInfo))
+        return;
+    if (doCanonicalizeIPv6Address<char, unsigned char>(spec, host, output, hostInfo))
+        return;
+}
+
+void canonicalizeIPAddress(const UChar* spec, const URLComponent& host, URLBuffer<char>& output, CanonHostInfo& hostInfo)
+{
+    if (doCanonicalizeIPv4Address<UChar, UChar>(spec, host, output, hostInfo))
+        return;
+    if (doCanonicalizeIPv6Address<UChar, UChar>(spec, host, output, hostInfo))
+        return;
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonInternal.cpp b/Source/WTF/wtf/url/src/URLCanonInternal.cpp
new file mode 100644
index 0000000..b7ae098
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonInternal.cpp
@@ -0,0 +1,310 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 "URLCanonInternal.h"
+
+#include <cstdio>
+#include <errno.h>
+#include <stdlib.h>
+#include <string>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+template<typename CharacterType, typename UCHAR>
+void doAppendStringOfType(const CharacterType* source, int length, URLCharacterTypes::CharacterTypes type, URLBuffer<char>& output)
+{
+    for (int i = 0; i < length; ++i) {
+        if (static_cast<UCHAR>(source[i]) >= 0x80) {
+            // ReadChar will fill the code point with kUnicodeReplacementCharacter
+            // when the input is invalid, which is what we want.
+            unsigned codePoint;
+            readUTFChar(source, &i, length, &codePoint);
+            AppendUTF8EscapedValue(codePoint, output);
+        } else {
+            // Just append the 7-bit character, possibly escaping it.
+            unsigned char uch = static_cast<unsigned char>(source[i]);
+            if (!URLCharacterTypes::isCharacterOfType(uch, type))
+                appendURLEscapedCharacter(uch, output);
+            else
+                output.append(uch);
+        }
+    }
+}
+
+// This function assumes the input values are all contained in 8-bit,
+// although it allows any type. Returns true if input is valid, false if not.
+template<typename CharacterType, typename UCHAR>
+void doAppendInvalidNarrowString(const CharacterType* spec, int begin, int end, URLBuffer<char>& output)
+{
+    for (int i = begin; i < end; ++i) {
+        UCHAR uch = static_cast<UCHAR>(spec[i]);
+        if (uch >= 0x80) {
+            // Handle UTF-8/16 encodings. This call will correctly handle the error
+            // case by appending the invalid character.
+            AppendUTF8EscapedChar(spec, &i, end, output);
+        } else if (uch <= ' ' || uch == 0x7f) {
+            // This function is for error handling, so we escape all control
+            // characters and spaces, but not anything else since we lack
+            // context to do something more specific.
+            appendURLEscapedCharacter(static_cast<unsigned char>(uch), output);
+        } else
+            output.append(static_cast<char>(uch));
+    }
+}
+
+// Overrides one component, see the URLCanonicalizer::Replacements structure for
+// what the various combionations of source pointer and component mean.
+void doOverrideComponent(const char* overrideSource, const URLComponent& overrideComponent, const char*& destination, URLComponent& destinationComponent)
+{
+    if (overrideSource) {
+        destination = overrideSource;
+        destinationComponent = overrideComponent;
+    }
+}
+
+// Similar to doOverrideComponent except that it takes a UTF-16 input and does
+// not actually set the output character pointer.
+//
+// The input is converted to UTF-8 at the end of the given buffer as a temporary
+// holding place. The component indentifying the portion of the buffer used in
+// the |utf8Buffer| will be specified in |*destinationComponent|.
+//
+// This will not actually set any |dest| pointer like doOverrideComponent
+// does because all of the pointers will point into the |utf8Buffer|, which
+// may get resized while we're overriding a subsequent component. Instead, the
+// caller should use the beginning of the |utf8Buffer| as the string pointer
+// for all components once all overrides have been prepared.
+bool PrepareUTF16OverrideComponent(const UChar* overrideSource,
+                                   const URLComponent& overrideComponent,
+                                   URLBuffer<char>& utf8Buffer,
+                                   URLComponent* destinationComponent)
+{
+    bool success = true;
+    if (overrideSource) {
+        if (!overrideComponent.isValid()) {
+            // Non-"valid" component (means delete), so we need to preserve that.
+            *destinationComponent = URLComponent();
+        } else {
+            // Convert to UTF-8.
+            destinationComponent->setBegin(utf8Buffer.length());
+            success = ConvertUTF16ToUTF8(&overrideSource[overrideComponent.begin()],
+                                         overrideComponent.length(), utf8Buffer);
+            destinationComponent->setLength(utf8Buffer.length() - destinationComponent->begin());
+        }
+    }
+    return success;
+}
+
+} // namespace
+
+const char kCharToHexLookup[8] = {
+    0, // 0x00 - 0x1f
+    '0', // 0x20 - 0x3f: digits 0 - 9 are 0x30 - 0x39
+    'A' - 10, // 0x40 - 0x5f: letters A - F are 0x41 - 0x46
+    'a' - 10, // 0x60 - 0x7f: letters a - f are 0x61 - 0x66
+    0, // 0x80 - 0x9F
+    0, // 0xA0 - 0xBF
+    0, // 0xC0 - 0xDF
+    0, // 0xE0 - 0xFF
+};
+
+const UChar kUnicodeReplacementCharacter = 0xfffd;
+
+void appendStringOfType(const char* source, int length, URLCharacterTypes::CharacterTypes urlComponentType, URLBuffer<char>& output)
+{
+    doAppendStringOfType<char, unsigned char>(source, length, urlComponentType, output);
+}
+
+void appendStringOfType(const UChar* source, int length, URLCharacterTypes::CharacterTypes urlComponentType, URLBuffer<char>& output)
+{
+    doAppendStringOfType<UChar, UChar>(source, length, urlComponentType, output);
+}
+
+void AppendInvalidNarrowString(const char* spec, int begin, int end, URLBuffer<char>& output)
+{
+    doAppendInvalidNarrowString<char, unsigned char>(spec, begin, end, output);
+}
+
+void AppendInvalidNarrowString(const UChar* spec, int begin, int end, URLBuffer<char>& output)
+{
+    doAppendInvalidNarrowString<UChar, UChar>(spec, begin, end, output);
+}
+
+bool ConvertUTF16ToUTF8(const UChar* input, int inputLength, URLBuffer<char>& output)
+{
+    bool success = true;
+    for (int i = 0; i < inputLength; ++i) {
+        unsigned codePoint;
+        success &= readUTFChar(input, &i, inputLength, &codePoint);
+        AppendUTF8Value(codePoint, output);
+    }
+    return success;
+}
+
+bool ConvertUTF8ToUTF16(const char* input, int inputLength, URLBuffer<UChar>& output)
+{
+    bool success = true;
+    for (int i = 0; i < inputLength; i++) {
+        unsigned codePoint;
+        success &= readUTFChar(input, &i, inputLength, &codePoint);
+        AppendUTF16Value(codePoint, output);
+    }
+    return success;
+}
+
+void SetupOverrideComponents(const char* /* base */,
+                             const Replacements<char>& repl,
+                             URLComponentSource<char>* source,
+                             URLSegments* parsed)
+{
+    // Get the source and parsed structures of the things we are replacing.
+    const URLComponentSource<char>& replSource = repl.sources();
+    const URLSegments& replParsed = repl.components();
+
+    doOverrideComponent(replSource.scheme, replParsed.scheme, source->scheme, parsed->scheme);
+    doOverrideComponent(replSource.username, replParsed.username, source->username, parsed->username);
+    doOverrideComponent(replSource.password, replParsed.password, source->password, parsed->password);
+
+    // Our host should be empty if not present, so override the default setup.
+    doOverrideComponent(replSource.host, replParsed.host, source->host, parsed->host);
+    if (parsed->host.length() == -1)
+        parsed->host.setLength(0);
+
+    doOverrideComponent(replSource.port, replParsed.port, source->port, parsed->port);
+    doOverrideComponent(replSource.path, replParsed.path, source->path, parsed->path);
+    doOverrideComponent(replSource.query, replParsed.query, source->query, parsed->query);
+    doOverrideComponent(replSource.ref, replParsed.fragment, source->ref, parsed->fragment);
+}
+
+bool SetupUTF16OverrideComponents(const char* /* base */,
+                                  const Replacements<UChar>& repl,
+                                  URLBuffer<char>& utf8Buffer,
+                                  URLComponentSource<char>* source,
+                                  URLSegments* parsed)
+    {
+        bool success = true;
+
+        // Get the source and parsed structures of the things we are replacing.
+        const URLComponentSource<UChar>& replSource = repl.sources();
+        const URLSegments& replParsed = repl.components();
+
+        success &= PrepareUTF16OverrideComponent(replSource.scheme, replParsed.scheme,
+                                                 utf8Buffer, &parsed->scheme);
+        success &= PrepareUTF16OverrideComponent(replSource.username, replParsed.username,
+                                                 utf8Buffer, &parsed->username);
+        success &= PrepareUTF16OverrideComponent(replSource.password, replParsed.password,
+                                                 utf8Buffer, &parsed->password);
+        success &= PrepareUTF16OverrideComponent(replSource.host, replParsed.host,
+                                                 utf8Buffer, &parsed->host);
+        success &= PrepareUTF16OverrideComponent(replSource.port, replParsed.port,
+                                                 utf8Buffer, &parsed->port);
+        success &= PrepareUTF16OverrideComponent(replSource.path, replParsed.path,
+                                                 utf8Buffer, &parsed->path);
+        success &= PrepareUTF16OverrideComponent(replSource.query, replParsed.query,
+                                                 utf8Buffer, &parsed->query);
+        success &= PrepareUTF16OverrideComponent(replSource.ref, replParsed.fragment,
+                                                 utf8Buffer, &parsed->fragment);
+
+        // PrepareUTF16OverrideComponent will not have set the data pointer since the
+        // buffer could be resized, invalidating the pointers. We set the data
+        // pointers for affected components now that the buffer is finalized.
+        if (replSource.scheme)
+            source->scheme = utf8Buffer.data();
+        if (replSource.username)
+            source->username = utf8Buffer.data();
+        if (replSource.password)
+            source->password = utf8Buffer.data();
+        if (replSource.host)
+            source->host = utf8Buffer.data();
+        if (replSource.port)
+            source->port = utf8Buffer.data();
+        if (replSource.path)
+            source->path = utf8Buffer.data();
+        if (replSource.query)
+            source->query = utf8Buffer.data();
+        if (replSource.ref)
+            source->ref = utf8Buffer.data();
+
+        return success;
+}
+
+#if !OS(WINDOWS)
+int _itoa_s(int value, char* buffer, size_t sizeInChars, int radix)
+{
+    int written;
+    if (radix == 10)
+        written = snprintf(buffer, sizeInChars, "%d", value);
+    else if (radix == 16)
+        written = snprintf(buffer, sizeInChars, "%x", value);
+    else
+        return EINVAL;
+
+    if (static_cast<size_t>(written) >= sizeInChars) {
+        // Output was truncated, or written was negative.
+        return EINVAL;
+    }
+    return 0;
+}
+
+int _itow_s(int value, UChar* buffer, size_t sizeInChars, int radix)
+{
+    if (radix != 10)
+        return EINVAL;
+
+    // No more than 12 characters will be required for a 32-bit integer.
+    // Add an extra byte for the terminating null.
+    char temp[13];
+    int written = snprintf(temp, sizeof(temp), "%d", value);
+    if (static_cast<size_t>(written) >= sizeInChars) {
+        // Output was truncated, or written was negative.
+        return EINVAL;
+    }
+
+    for (int i = 0; i < written; ++i)
+        buffer[i] = static_cast<UChar>(temp[i]);
+    buffer[written] = '\0';
+    return 0;
+}
+
+#endif // !OS(WINDOWS)
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonInternal.h b/Source/WTF/wtf/url/src/URLCanonInternal.h
new file mode 100644
index 0000000..9b29706
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonInternal.h
@@ -0,0 +1,394 @@
+/*
+ * Copyright 2011 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// This file is intended to be included in another C++ file where the character
+// types are defined. This allows us to write mostly generic code, but not have
+// templace bloat because everything is inlined when anybody calls any of our
+// functions.
+
+#ifndef URLCanonInternal_h
+#define URLCanonInternal_h
+
+#include "URLCanon.h"
+#include "URLCharacterTypes.h"
+#include <stdlib.h>
+#include <wtf/HexNumber.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+// Appends the given string to the output, escaping characters that do not
+// match the given |type| in SharedCharTypes.
+void appendStringOfType(const char* source, int length, URLCharacterTypes::CharacterTypes urlComponentType, URLBuffer<char>& output);
+void appendStringOfType(const UChar* source, int length, URLCharacterTypes::CharacterTypes urlComponentType, URLBuffer<char>& output);
+
+// This lookup table allows fast conversion between ASCII hex letters and their
+// corresponding numerical value. The 8-bit range is divided up into 8
+// regions of 0x20 characters each. Each of the three character types (numbers,
+// uppercase, lowercase) falls into different regions of this range. The table
+// contains the amount to subtract from characters in that range to get at
+// the corresponding numerical value.
+//
+// See HexDigitToValue for the lookup.
+extern const char kCharToHexLookup[8];
+
+// Assumes the input is a valid hex digit! Call isHexChar before using this.
+inline unsigned char hexCharToValue(unsigned char character)
+{
+    return character - kCharToHexLookup[character / 0x20];
+}
+
+// Indicates if the given character is a dot or dot equivalent, returning the
+// number of characters taken by it. This will be one for a literal dot, 3 for
+// an escaped dot. If the character is not a dot, this will return 0.
+template<typename CharacterType>
+inline int isDot(const CharacterType* spec, int offset, int end)
+{
+    if (spec[offset] == '.')
+        return 1;
+
+    if (spec[offset] == '%' && offset + 3 <= end && spec[offset + 1] == '2' && (spec[offset + 2] == 'e' || spec[offset + 2] == 'E')) {
+        // Found "%2e"
+        return 3;
+    }
+    return 0;
+}
+
+// Returns the canonicalized version of the input character according to scheme
+// rules. This is implemented alongside the scheme canonicalizer, and is
+// required for relative URL resolving to test for scheme equality.
+//
+// Returns 0 if the input character is not a valid scheme character.
+char canonicalSchemeChar(UChar);
+
+// Write a single character, escaped, to the output. This always escapes: it
+// does no checking that thee character requires escaping.
+// Escaping makes sense only 8 bit chars, so code works in all cases of
+// input parameters (8/16bit).
+template<typename InChar, typename OutChar>
+inline void appendURLEscapedCharacter(InChar character, URLBuffer<OutChar>& buffer)
+{
+    buffer.append('%');
+    buffer.append(WTF::Internal::upperHexDigits[character >> 4]);
+    buffer.append(WTF::Internal::upperHexDigits[character & 0xf]);
+}
+
+// The character we'll substitute for undecodable or invalid characters.
+extern const UChar kUnicodeReplacementCharacter;
+
+// UTF-8 functions ------------------------------------------------------------
+
+// Reads one character in UTF-8 starting at |*begin| in |str| and places
+// the decoded value into |*codePoint|. If the character is valid, we will
+// return true. If invalid, we'll return false and put the
+// kUnicodeReplacementCharacter into |*codePoint|.
+//
+// |*begin| will be updated to point to the last character consumed so it
+// can be incremented in a loop and will be ready for the next character.
+// (for a single-byte ASCII character, it will not be changed).
+//
+// Implementation is in URLCanonicalizer_icu.cc.
+bool readUTFChar(const char* str, int* begin, int length, unsigned* codePointOut);
+
+// Generic To-UTF-8 converter. This will call the given append method for each
+// character that should be appended, with the given output method. Wrappers
+// are provided below for escaped and non-escaped versions of this.
+//
+// The charactervalue must have already been checked that it's a valid Unicode
+// character.
+template<class Output, void appendFunction(unsigned char, Output&)>
+inline void doAppendUTF8(unsigned charactervalue, Output& output)
+{
+    if (charactervalue <= 0x7f) {
+        appendFunction(static_cast<unsigned char>(charactervalue), output);
+    } else if (charactervalue <= 0x7ff) {
+        // 110xxxxx 10xxxxxx
+        appendFunction(static_cast<unsigned char>(0xC0 | (charactervalue >> 6)), output);
+        appendFunction(static_cast<unsigned char>(0x80 | (charactervalue & 0x3f)), output);
+    } else if (charactervalue <= 0xffff) {
+        // 1110xxxx 10xxxxxx 10xxxxxx
+        appendFunction(static_cast<unsigned char>(0xe0 | (charactervalue >> 12)), output);
+        appendFunction(static_cast<unsigned char>(0x80 | ((charactervalue >> 6) & 0x3f)), output);
+        appendFunction(static_cast<unsigned char>(0x80 | (charactervalue & 0x3f)), output);
+    } else if (charactervalue <= 0x10FFFF) { // Max unicode code point.
+        // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+        appendFunction(static_cast<unsigned char>(0xf0 | (charactervalue >> 18)), output);
+        appendFunction(static_cast<unsigned char>(0x80 | ((charactervalue >> 12) & 0x3f)), output);
+        appendFunction(static_cast<unsigned char>(0x80 | ((charactervalue >> 6) & 0x3f)), output);
+        appendFunction(static_cast<unsigned char>(0x80 | (charactervalue & 0x3f)), output);
+    } else {
+        // Invalid UTF-8 character (>20 bits).
+        ASSERT_NOT_REACHED();
+    }
+}
+
+// Helper used by AppendUTF8Value below. We use an unsigned parameter so there
+// are no funny sign problems with the input, but then have to convert it to
+// a regular char for appending.
+inline void AppendCharToOutput(unsigned char character, URLBuffer<char>& output)
+{
+    output.append(static_cast<char>(character));
+}
+
+// Writes the given character to the output as UTF-8. This does NO checking
+// of the validity of the unicode characters; the caller should ensure that
+// the value it is appending is valid to append.
+inline void AppendUTF8Value(unsigned charactervalue, URLBuffer<char>& output)
+{
+    doAppendUTF8<URLBuffer<char>, AppendCharToOutput>(charactervalue, output);
+}
+
+// Writes the given character to the output as UTF-8, escaping ALL
+// characters (even when they are ASCII). This does NO checking of the
+// validity of the unicode characters; the caller should ensure that the value
+// it is appending is valid to append.
+inline void AppendUTF8EscapedValue(unsigned charactervalue, URLBuffer<char>& output)
+{
+    doAppendUTF8<URLBuffer<char>, appendURLEscapedCharacter>(charactervalue, output);
+}
+
+// UTF-16 functions -----------------------------------------------------------
+
+// Reads one character in UTF-16 starting at |*begin| in |str| and places
+// the decoded value into |*codePoint|. If the character is valid, we will
+// return true. If invalid, we'll return false and put the
+// kUnicodeReplacementCharacter into |*codePoint|.
+//
+// |*begin| will be updated to point to the last character consumed so it
+// can be incremented in a loop and will be ready for the next character.
+// (for a single-16-bit-word character, it will not be changed).
+//
+// Implementation is in URLCanonicalizer_icu.cc.
+bool readUTFChar(const UChar* str, int* begin, int length, unsigned* codePoint);
+
+// Equivalent to U16_APPEND_UNSAFE in ICU but uses our output method.
+inline void AppendUTF16Value(unsigned codePoint, URLBuffer<UChar>& output)
+{
+    if (codePoint > 0xffff) {
+        output.append(static_cast<UChar>((codePoint >> 10) + 0xd7c0));
+        output.append(static_cast<UChar>((codePoint & 0x3ff) | 0xdc00));
+    } else
+        output.append(static_cast<UChar>(codePoint));
+}
+
+// Escaping functions ---------------------------------------------------------
+
+// Writes the given character to the output as UTF-8, escaped. Call this
+// function only when the input is wide. Returns true on success. Failure
+// means there was some problem with the encoding, we'll still try to
+// update the |*begin| pointer and add a placeholder character to the
+// output so processing can continue.
+//
+// We will append the character starting at ch[begin] with the buffer ch
+// being |length|. |*begin| will be updated to point to the last character
+// consumed (we may consume more than one for UTF-16) so that if called in
+// a loop, incrementing the pointer will move to the next character.
+//
+// Every single output character will be escaped. This means that if you
+// give it an ASCII character as input, it will be escaped. Some code uses
+// this when it knows that a character is invalid according to its rules
+// for validity. If you don't want escaping for ASCII characters, you will
+// have to filter them out prior to calling this function.
+//
+// Assumes that ch[begin] is within range in the array, but does not assume
+// that any following characters are.
+inline bool AppendUTF8EscapedChar(const UChar* str, int* begin, int length, URLBuffer<char>& output)
+{
+    // UTF-16 input. ReadUChar will handle invalid characters for us and give
+    // us the kUnicodeReplacementCharacter, so we don't have to do special
+    // checking after failure, just pass through the failure to the caller.
+    unsigned charactervalue;
+    bool success = readUTFChar(str, begin, length, &charactervalue);
+    AppendUTF8EscapedValue(charactervalue, output);
+    return success;
+}
+
+// Handles UTF-8 input. See the wide version above for usage.
+inline bool AppendUTF8EscapedChar(const char* str, int* begin, int length, URLBuffer<char>& output)
+{
+    // ReadUTF8Char will handle invalid characters for us and give us the
+    // kUnicodeReplacementCharacter, so we don't have to do special checking
+    // after failure, just pass through the failure to the caller.
+    unsigned ch;
+    bool success = readUTFChar(str, begin, length, &ch);
+    AppendUTF8EscapedValue(ch, output);
+    return success;
+}
+
+// Given a '%' character at |*begin| in the string |spec|, this will decode
+// the escaped value and put it into |*unescapedValue| on success (returns
+// true). On failure, this will return false, and will not write into
+// |*unescapedValue|.
+//
+// |*begin| will be updated to point to the last character of the escape
+// sequence so that when called with the index of a for loop, the next time
+// through it will point to the next character to be considered. On failure,
+// |*begin| will be unchanged.
+inline bool Is8BitChar(char)
+{
+    return true; // this case is specialized to avoid a warning
+}
+inline bool Is8BitChar(UChar c)
+{
+    return c <= 255;
+}
+
+template<typename CHAR>
+inline bool DecodeEscaped(const CHAR* spec, int* begin, int end, unsigned char* unescapedValue)
+{
+    if (*begin + 3 > end || !Is8BitChar(spec[*begin + 1]) || !Is8BitChar(spec[*begin + 2])) {
+        // Invalid escape sequence because there's not enough room, or the
+        // digits are not ASCII.
+        return false;
+    }
+
+    unsigned char first = static_cast<unsigned char>(spec[*begin + 1]);
+    unsigned char second = static_cast<unsigned char>(spec[*begin + 2]);
+    if (!URLCharacterTypes::isHexChar(first) || !URLCharacterTypes::isHexChar(second)) {
+        // Invalid hex digits, fail.
+        return false;
+    }
+
+    // Valid escape sequence.
+    *unescapedValue = (hexCharToValue(first) << 4) + hexCharToValue(second);
+    *begin += 2;
+    return true;
+}
+
+// Appends the given substring to the output, escaping "some" characters that
+// it feels may not be safe. It assumes the input values are all contained in
+// 8-bit although it allows any type.
+//
+// This is used in error cases to append invalid output so that it looks
+// approximately correct. Non-error cases should not call this function since
+// the escaping rules are not guaranteed!
+void AppendInvalidNarrowString(const char* spec, int begin, int end, URLBuffer<char>& output);
+void AppendInvalidNarrowString(const UChar* spec, int begin, int end, URLBuffer<char>& output);
+
+// Misc canonicalization helpers ----------------------------------------------
+
+// Converts between UTF-8 and UTF-16, returning true on successful conversion.
+// The output will be appended to the given canonicalizer output (so make sure
+// it's empty if you want to replace).
+//
+// On invalid input, this will still write as much output as possible,
+// replacing the invalid characters with the "invalid character". It will
+// return false in the failure case, and the caller should not continue as
+// normal.
+bool ConvertUTF16ToUTF8(const UChar* input, int inputLength, URLBuffer<char>& output);
+bool ConvertUTF8ToUTF16(const char* input, int inputLength, URLBuffer<UChar>& output);
+
+// Converts from UTF-16 to 8-bit using the character set converter. If the
+// converter is null, this will use UTF-8.
+void ConvertUTF16ToQueryEncoding(const UChar* input, const URLComponent& query, URLQueryCharsetConverter*, URLBuffer<char>& output);
+
+// Applies the replacements to the given component source. The component source
+// should be pre-initialized to the "old" base. That is, all pointers will
+// point to the spec of the old URL, and all of the Parsed components will
+// be indices into that string.
+//
+// The pointers and components in the |source| for all non-null strings in the
+// |repl| (replacements) will be updated to reference those strings.
+// Canonicalizing with the new |source| and |parsed| can then combine URL
+// components from many different strings.
+void SetupOverrideComponents(const char* base,
+                             const Replacements<char>&,
+                             URLComponentSource<char>*,
+                             URLSegments* parsed);
+
+// Like the above 8-bit version, except that it additionally converts the
+// UTF-16 input to UTF-8 before doing the overrides.
+//
+// The given utf8Buffer is used to store the converted components. They will
+// be appended one after another, with the parsed structure identifying the
+// appropriate substrings. This buffer is a parameter because the source has
+// no storage, so the buffer must have the same lifetime as the source
+// parameter owned by the caller.
+//
+// THE CALLER MUST NOT ADD TO THE |utf8Buffer| AFTER THIS CALL. Members of
+// |source| will point into this buffer, which could be invalidated if
+// additional data is added and the CanonOutput resizes its buffer.
+//
+// Returns true on success. Fales means that the input was not valid UTF-16,
+// although we will have still done the override with "invalid characters" in
+// place of errors.
+bool SetupUTF16OverrideComponents(const char* base,
+                                  const Replacements<UChar>&,
+                                  URLBuffer<char>& utf8Buffer,
+                                  URLComponentSource<char>*,
+                                  URLSegments* parsed);
+
+// Implemented in URLCanonicalizer_path.cc, these are required by the relative URL
+// resolver as well, so we declare them here.
+bool CanonicalizePartialPath(const char* spec,
+                             const URLComponent& path,
+                             int pathBeginInOutput,
+                             URLBuffer<char>& output);
+bool CanonicalizePartialPath(const UChar* spec,
+                             const URLComponent& path,
+                             int pathBeginInOutput,
+                             URLBuffer<char>& output);
+
+#if !OS(WINDOWS)
+// Implementations of Windows' int-to-string conversions
+int _itoa_s(int value, char* buffer, size_t sizeInChars, int radix);
+int _itow_s(int value, UChar* buffer, size_t sizeInChars, int radix);
+
+// Secure template overloads for these functions
+template<size_t N>
+inline int _itoa_s(int value, char (&buffer)[N], int radix)
+{
+    return _itoa_s(value, buffer, N, radix);
+}
+
+template<size_t N>
+inline int _itow_s(int value, UChar (&buffer)[N], int radix)
+{
+    return _itow_s(value, buffer, N, radix);
+}
+
+// _strtoui64 and strtoull behave the same
+inline unsigned long long _strtoui64(const char* nptr, char** endptr, int base)
+{
+    return strtoull(nptr, endptr, base);
+}
+#endif // OS(WINDOWS)
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // URLCanonInternal_h
diff --git a/Source/WTF/wtf/url/src/URLCanonMailto.cpp b/Source/WTF/wtf/url/src/URLCanonMailto.cpp
new file mode 100644
index 0000000..bdb3538
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonMailto.cpp
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2008 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// Functions for canonicalizing "mailto:" URLs.
+
+#include "config.h"
+#include "URLCanon.h"
+
+#include "RawURLBuffer.h"
+#include "URLCanonInternal.h"
+#include "URLFile.h"
+#include "URLParseInternal.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+
+template<typename CharacterType, typename UCHAR>
+bool doCanonicalizeMailtoURL(const URLComponentSource<CharacterType>& source, const URLSegments& parsed, URLBuffer<char>& output, URLSegments& outputParsed)
+{
+    // mailto: only uses {scheme, path, query} -- clear the rest.
+    outputParsed.username = URLComponent();
+    outputParsed.password = URLComponent();
+    outputParsed.host = URLComponent();
+    outputParsed.port = URLComponent();
+    outputParsed.fragment = URLComponent();
+
+    // Scheme (known, so we don't bother running it through the more
+    // complicated scheme canonicalizer).
+    outputParsed.scheme.setBegin(output.length());
+    output.append("mailto:", 7);
+    outputParsed.scheme.setLength(6);
+
+    bool success = true;
+
+    // Path
+    if (parsed.path.isValid()) {
+        outputParsed.path.setBegin(output.length());
+
+        // Copy the path using path URL's more lax escaping rules.
+        // We convert to UTF-8 and escape non-ASCII, but leave all
+        // ASCII characters alone.
+        int end = parsed.path.end();
+        for (int i = parsed.path.begin(); i < end; ++i) {
+            UCHAR uch = static_cast<UCHAR>(source.path[i]);
+            if (uch < 0x20 || uch >= 0x80)
+                success &= AppendUTF8EscapedChar(source.path, &i, end, output);
+            else
+                output.append(static_cast<char>(uch));
+        }
+
+        outputParsed.path.setLength(output.length() - outputParsed.path.begin());
+    } else {
+        // No path at all
+        outputParsed.path.reset();
+    }
+
+    // Query -- always use the default utf8 charset converter.
+    CanonicalizeQuery(source.query, parsed.query, 0, output, &outputParsed.query);
+
+    return success;
+}
+
+} // namespace
+
+bool canonicalizeMailtoURL(const char* spec, const URLSegments& parsed, URLBuffer<char>& output, URLSegments& outputParsed)
+{
+    return doCanonicalizeMailtoURL<char, unsigned char>(URLComponentSource<char>(spec), parsed, output, outputParsed);
+}
+
+bool canonicalizeMailtoURL(const UChar* spec, const URLSegments& parsed, URLBuffer<char>& output, URLSegments& outputParsed)
+{
+    return doCanonicalizeMailtoURL<UChar, UChar>(URLComponentSource<UChar>(spec), parsed, output, outputParsed);
+}
+
+bool replaceMailtoURL(const char* base, const URLSegments& baseParsed,
+                      const Replacements<char>& replacements,
+                      URLBuffer<char>& output, URLSegments& outputParsed)
+{
+    URLComponentSource<char> source(base);
+    URLSegments parsed(baseParsed);
+    SetupOverrideComponents(base, replacements, &source, &parsed);
+    return doCanonicalizeMailtoURL<char, unsigned char>(source, parsed, output, outputParsed);
+}
+
+bool replaceMailtoURL(const char* base, const URLSegments& baseParsed,
+                      const Replacements<UChar>& replacements,
+                      URLBuffer<char>& output, URLSegments& outputParsed)
+{
+    RawURLBuffer<char> utf8;
+    URLComponentSource<char> source(base);
+    URLSegments parsed(baseParsed);
+    SetupUTF16OverrideComponents(base, replacements, utf8, &source, &parsed);
+    return doCanonicalizeMailtoURL<char, unsigned char>(source, parsed, output, outputParsed);
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonPath.cpp b/Source/WTF/wtf/url/src/URLCanonPath.cpp
new file mode 100644
index 0000000..9bc443f
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonPath.cpp
@@ -0,0 +1,372 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// Canonicalization functions for the paths of URLs.
+
+#include "config.h"
+#include "URLCanon.h"
+
+#include "URLCanonInternal.h"
+#include "URLParseInternal.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+enum CharacterFlags {
+    // Pass through unchanged, whether escaped or unescaped. This doesn't
+    // actually set anything so you can't OR it to check, it's just to make the
+    // table below more clear when neither ESCAPE or UNESCAPE is set.
+    PASS = 0,
+
+    // This character requires special handling in doPartialPath. Doing this test
+    // first allows us to filter out the common cases of regular characters that
+    // can be directly copied.
+    SPECIAL = 1,
+
+    // This character must be escaped in the canonical output. Note that all
+    // escaped chars also have the "special" bit set so that the code that looks
+    // for this is triggered. Not valid with PASS or ESCAPE
+    ESCAPE_BIT = 2,
+    ESCAPE = ESCAPE_BIT | SPECIAL,
+
+    // This character must be unescaped in canonical output. Not valid with
+    // ESCAPE or PASS. We DON'T set the SPECIAL flag since if we encounter these
+    // characters unescaped, they should just be copied.
+    UNESCAPE = 4,
+
+    // This character is disallowed in URLs. Note that the "special" bit is also
+    // set to trigger handling.
+    INVALID_BIT = 8,
+    INVALID = INVALID_BIT | SPECIAL,
+};
+
+// This table contains one of the above flag values. Note some flags are more
+// than one bits because they also turn on the "special" flag. Special is the
+// only flag that may be combined with others.
+//
+// This table is designed to match exactly what IE does with the characters.
+//
+// Dot is even more special, and the escaped version is handled specially by
+// isDot. Therefore, we don't need the "escape" flag, and even the "unescape"
+// bit is never handled (we just need the "special") bit.
+const unsigned char kPathCharLookup[0x100] = {
+//   null     control chars...
+     INVALID,  ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,
+//   control chars...
+     ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,
+//   ' '       !         "         #         $         %         &         '         (         )         *         +         ,         -         .         /
+     ESCAPE,   PASS,     ESCAPE,   ESCAPE,   PASS,     ESCAPE,   PASS,     PASS,     PASS,     PASS,     PASS,     PASS,     PASS,     UNESCAPE, SPECIAL,  PASS,
+//   0         1         2         3         4         5         6         7         8         9         :         ;         <         =          >        ?
+     UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, PASS,     PASS,     ESCAPE,   PASS,     ESCAPE,   ESCAPE,
+//   @         A         B         C         D         E         F         G         H         I         J         K         L         M         N         O
+     PASS,     UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE,
+//   P         Q         R         S         T         U         V         W         X         Y         Z         [         \         ]         ^         _
+     UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, PASS,     ESCAPE,   PASS,     ESCAPE,   UNESCAPE,
+//   `         a         b         c         d         e         f         g         h         i         j         k         l         m         n         o
+     ESCAPE,   UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE,
+//   p         q         r         s         t         u         v         w         x         y         z         {         |         }         ~         <NBSP>
+     UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, UNESCAPE, ESCAPE,   ESCAPE,   ESCAPE,   UNESCAPE, ESCAPE,
+//   ...all the high-bit characters are escaped
+     ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,
+     ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,
+     ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,
+     ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,
+     ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,
+     ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,
+     ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,
+     ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE,   ESCAPE};
+
+enum DotDisposition {
+    // The given dot is just part of a filename and is not special.
+    NOT_A_DIRECTORY,
+
+    // The given dot is the current directory.
+    DIRECTORY_CUR,
+
+    // The given dot is the first of a double dot that should take us up one.
+    DIRECTORY_UP
+};
+
+// When the path resolver finds a dot, this function is called with the
+// character following that dot to see what it is. The return value
+// indicates what type this dot is (see above). This code handles the case
+// where the dot is at the end of the input.
+//
+// |*consumedLength| will contain the number of characters in the input that
+// express what we found.
+//
+// If the input is "../foo", |afterDot| = 1, |end| = 6, and
+// at the end, |*consumedLength| = 2 for the "./" this function consumed. The
+// original dot length should be handled by the caller.
+template<typename CHAR>
+DotDisposition ClassifyAfterDot(const CHAR* spec, int afterDot, int end, int* consumedLength)
+{
+    if (afterDot == end) {
+        // Single dot at the end.
+        *consumedLength = 0;
+        return DIRECTORY_CUR;
+    }
+    if (URLParser::isURLSlash(spec[afterDot])) {
+        // Single dot followed by a slash.
+        *consumedLength = 1; // Consume the slash
+        return DIRECTORY_CUR;
+    }
+
+    int secondDotLength = isDot(spec, afterDot, end);
+    if (secondDotLength) {
+        int afterSecondDot = afterDot + secondDotLength;
+        if (afterSecondDot == end) {
+            // Double dot at the end.
+            *consumedLength = secondDotLength;
+            return DIRECTORY_UP;
+        }
+        if (URLParser::isURLSlash(spec[afterSecondDot])) {
+            // Double dot followed by a slash.
+            *consumedLength = secondDotLength + 1;
+            return DIRECTORY_UP;
+        }
+    }
+
+    // The dots are followed by something else, not a directory.
+    *consumedLength = 0;
+    return NOT_A_DIRECTORY;
+}
+
+// Rewinds the output to the previous slash. It is assumed that the output
+// ends with a slash and this doesn't count (we call this when we are
+// appending directory paths, so the previous path component has and ending
+// slash).
+//
+// This will stop at the first slash (assumed to be at position
+// |pathBeginInOutput| and not go any higher than that. Some web pages
+// do ".." too many times, so we need to handle that brokenness.
+//
+// It searches for a literal slash rather than including a backslash as well
+// because it is run only on the canonical output.
+//
+// The output is guaranteed to end in a slash when this function completes.
+void BackUpToPreviousSlash(int pathBeginInOutput, URLBuffer<char>& output)
+{
+    ASSERT(output.length() > 0);
+
+    int i = output.length() - 1;
+    ASSERT(output.at(i) == '/');
+    if (i == pathBeginInOutput)
+        return; // We're at the first slash, nothing to do.
+
+    // Now back up (skipping the trailing slash) until we find another slash.
+    i--;
+    while (output.at(i) != '/' && i > pathBeginInOutput)
+        i--;
+
+    // Now shrink the output to just include that last slash we found.
+    output.setLength(i + 1);
+}
+
+// Appends the given path to the output. It assumes that if the input path
+// starts with a slash, it should be copied to the output. If no path has
+// already been appended to the output (the case when not resolving
+// relative URLs), the path should begin with a slash.
+//
+// If there are already path components (this mode is used when appending
+// relative paths for resolving), it assumes that the output already has
+// a trailing slash and that if the input begins with a slash, it should be
+// copied to the output.
+//
+// We do not collapse multiple slashes in a row to a single slash. It seems
+// no web browsers do this, and we don't want incompababilities, even though
+// it would be correct for most systems.
+template<typename CharacterType, typename UCHAR>
+bool doPartialPath(const CharacterType* spec, const URLComponent& path, int pathBeginInOutput, URLBuffer<char>& output)
+{
+    int end = path.end();
+
+    bool success = true;
+    for (int i = path.begin(); i < end; ++i) {
+        UCHAR uch = static_cast<UCHAR>(spec[i]);
+        if (sizeof(CharacterType) > sizeof(char) && uch >= 0x80) {
+            // We only need to test wide input for having non-ASCII characters. For
+            // narrow input, we'll always just use the lookup table. We don't try to
+            // do anything tricky with decoding/validating UTF-8. This function will
+            // read one or two UTF-16 characters and append the output as UTF-8. This
+            // call will be removed in 8-bit mode.
+            success &= AppendUTF8EscapedChar(spec, &i, end, output);
+        } else {
+            // Normal ASCII character or 8-bit input, use the lookup table.
+            unsigned char outCh = static_cast<unsigned char>(uch);
+            unsigned char flags = kPathCharLookup[outCh];
+            if (flags & SPECIAL) {
+                // Needs special handling of some sort.
+                int dotlen;
+                if ((dotlen = isDot(spec, i, end)) > 0) {
+                    // See if this dot was preceeded by a slash in the output. We
+                    // assume that when canonicalizing paths, they will always
+                    // start with a slash and not a dot, so we don't have to
+                    // bounds check the output.
+                    //
+                    // Note that we check this in the case of dots so we don't have to
+                    // special case slashes. Since slashes are much more common than
+                    // dots, this actually increases performance measurably (though
+                    // slightly).
+                    ASSERT(output.length() > pathBeginInOutput);
+                    if (output.length() > pathBeginInOutput && output.at(output.length() - 1) == '/') {
+                        // Slash followed by a dot, check to see if this is means relative
+                        int consumedLength;
+                        switch (ClassifyAfterDot<CharacterType>(spec, i + dotlen, end, &consumedLength)) {
+                        case NOT_A_DIRECTORY:
+                            // Copy the dot to the output, it means nothing special.
+                            output.append('.');
+                            i += dotlen - 1;
+                            break;
+                        case DIRECTORY_CUR: // Current directory, just skip the input.
+                            i += dotlen + consumedLength - 1;
+                            break;
+                        case DIRECTORY_UP:
+                            BackUpToPreviousSlash(pathBeginInOutput, output);
+                            i += dotlen + consumedLength - 1;
+                            break;
+                        }
+                    } else {
+                        // This dot is not preceeded by a slash, it is just part of some
+                        // file name.
+                        output.append('.');
+                        i += dotlen - 1;
+                    }
+                } else if (outCh == '\\') {
+                    // Convert backslashes to forward slashes
+                    output.append('/');
+                } else if (outCh == '%') {
+                    // Handle escape sequences.
+                    unsigned char unescapedValue;
+                    if (DecodeEscaped(spec, &i, end, &unescapedValue)) {
+                        // Valid escape sequence, see if we keep, reject, or unescape it.
+                        char unescapedFlags = kPathCharLookup[unescapedValue];
+
+                        if (unescapedFlags & UNESCAPE) {
+                            // This escaped value shouldn't be escaped, copy it.
+                            output.append(unescapedValue);
+                        } else if (unescapedFlags & INVALID_BIT) {
+                            // Invalid escaped character, copy it and remember the error.
+                            output.append('%');
+                            output.append(static_cast<char>(spec[i - 1]));
+                            output.append(static_cast<char>(spec[i]));
+                            success = false;
+                        } else {
+                            // Valid escaped character but we should keep it escaped. We
+                            // don't want to change the case of any hex letters in case
+                            // the server is sensitive to that, so we just copy the two
+                            // characters without checking (DecodeEscape will have advanced
+                            // to the last character of the pair).
+                            output.append('%');
+                            output.append(static_cast<char>(spec[i - 1]));
+                            output.append(static_cast<char>(spec[i]));
+                        }
+                    } else {
+                        // Invalid escape sequence. IE7 rejects any URLs with such
+                        // sequences, while Firefox, IE6, and Safari all pass it through
+                        // unchanged. We are more permissive unlike IE7. I don't think this
+                        // can cause significant problems, if it does, we should change
+                        // to be more like IE7.
+                        output.append('%');
+                    }
+
+                } else if (flags & INVALID_BIT) {
+                    // For NULLs, etc. fail.
+                    appendURLEscapedCharacter(outCh, output);
+                    success = false;
+
+                } else if (flags & ESCAPE_BIT) {
+                    // This character should be escaped.
+                    appendURLEscapedCharacter(outCh, output);
+                }
+            } else {
+                // Nothing special about this character, just append it.
+                output.append(outCh);
+            }
+        }
+    }
+    return success;
+}
+
+template<typename CharacterType, typename UCHAR>
+bool doPath(const CharacterType* spec, const URLComponent& path, URLBuffer<char>& output, URLComponent& outputPath)
+{
+    bool success = true;
+    outputPath.setBegin(output.length());
+    if (path.length() > 0) {
+        // Write out an initial slash if the input has none. If we just parse a URL
+        // and then canonicalize it, it will of course have a slash already. This
+        // check is for the replacement and relative URL resolving cases of file
+        // URLs.
+        if (!URLParser::isURLSlash(spec[path.begin()]))
+            output.append('/');
+
+        success = doPartialPath<CharacterType, UCHAR>(spec, path, outputPath.begin(), output);
+    } else {
+        // No input, canonical path is a slash.
+        output.append('/');
+    }
+    outputPath.setLength(output.length() - outputPath.begin());
+    return success;
+}
+
+} // namespace
+
+bool CanonicalizePath(const char* spec, const URLComponent& path, URLBuffer<char>& output, URLComponent* outputPath)
+{
+    return doPath<char, unsigned char>(spec, path, output, *outputPath);
+}
+
+bool CanonicalizePath(const UChar* spec, const URLComponent& path, URLBuffer<char>& output, URLComponent* outputPath)
+{
+    return doPath<UChar, UChar>(spec, path, output, *outputPath);
+}
+
+bool CanonicalizePartialPath(const char* spec, const URLComponent& path, int pathBeginInOutput, URLBuffer<char>& output)
+{
+    return doPartialPath<char, unsigned char>(spec, path, pathBeginInOutput, output);
+}
+
+bool CanonicalizePartialPath(const UChar* spec, const URLComponent& path, int pathBeginInOutput, URLBuffer<char>& output)
+{
+    return doPartialPath<UChar, UChar>(spec, path, pathBeginInOutput, output);
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonPathurl.cpp b/Source/WTF/wtf/url/src/URLCanonPathurl.cpp
new file mode 100644
index 0000000..cea037c
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonPathurl.cpp
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// Functions for canonicalizing "path" URLs. Not to be confused with the path
+// of a URL, these are URLs that have no authority section, only a path. For
+// example, "javascript:" and "data:".
+
+#include "config.h"
+#include "URLCanon.h"
+
+#include "RawURLBuffer.h"
+#include "URLCanonInternal.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+template<typename CharacterType, typename UCHAR>
+bool doCanonicalizePathURL(const URLComponentSource<CharacterType>& source, const URLSegments& parsed, URLBuffer<char>& output, URLSegments& ouputParsed)
+{
+    // Scheme: this will append the colon.
+    bool success = canonicalizeScheme(source.scheme, parsed.scheme, output, ouputParsed.scheme);
+
+    // We assume there's no authority for path URLs. Note that hosts should never
+    // have -1 length.
+    ouputParsed.username.reset();
+    ouputParsed.password.reset();
+    ouputParsed.host.reset();
+    ouputParsed.port.reset();
+
+    if (parsed.path.isValid()) {
+        // Copy the path using path URL's more lax escaping rules (think for
+        // javascript:). We convert to UTF-8 and escape non-ASCII, but leave all
+        // ASCII characters alone. This helps readability of JavaStript.
+        ouputParsed.path.setBegin(output.length());
+        int end = parsed.path.end();
+        for (int i = parsed.path.begin(); i < end; ++i) {
+            UCHAR uch = static_cast<UCHAR>(source.path[i]);
+            if (uch < 0x20 || uch >= 0x80)
+                success &= AppendUTF8EscapedChar(source.path, &i, end, output);
+            else
+                output.append(static_cast<char>(uch));
+        }
+        ouputParsed.path.setLength(output.length() - ouputParsed.path.begin());
+    } else {
+        // Empty path.
+        ouputParsed.path.reset();
+    }
+
+    // Assume there's no query or ref.
+    ouputParsed.query.reset();
+    ouputParsed.fragment.reset();
+
+    return success;
+}
+
+} // namespace
+
+bool canonicalizePathURL(const char* spec, const URLSegments& parsed, URLBuffer<char>& output, URLSegments& ouputParsed)
+{
+    return doCanonicalizePathURL<char, unsigned char>(URLComponentSource<char>(spec), parsed, output, ouputParsed);
+}
+
+bool canonicalizePathURL(const UChar* spec, const URLSegments& parsed, URLBuffer<char>& output, URLSegments& ouputParsed)
+{
+    return doCanonicalizePathURL<UChar, UChar>(URLComponentSource<UChar>(spec), parsed, output, ouputParsed);
+}
+
+bool ReplacePathURL(const char* base, const URLSegments& baseParsed, const Replacements<char>& replacements, URLBuffer<char>& output, URLSegments* ouputParsed)
+{
+    URLComponentSource<char> source(base);
+    URLSegments parsed(baseParsed);
+    SetupOverrideComponents(base, replacements, &source, &parsed);
+    return doCanonicalizePathURL<char, unsigned char>(source, parsed, output, *ouputParsed);
+}
+
+bool ReplacePathURL(const char* base, const URLSegments& baseParsed, const Replacements<UChar>& replacements, URLBuffer<char>& output, URLSegments* ouputParsed)
+{
+    RawURLBuffer<char> utf8;
+    URLComponentSource<char> source(base);
+    URLSegments parsed(baseParsed);
+    SetupUTF16OverrideComponents(base, replacements, utf8, &source, &parsed);
+    return doCanonicalizePathURL<char, unsigned char>(source, parsed, output, *ouputParsed);
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonQuery.cpp b/Source/WTF/wtf/url/src/URLCanonQuery.cpp
new file mode 100644
index 0000000..0b829ba
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonQuery.cpp
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 "URLCanon.h"
+
+#include "RawURLBuffer.h"
+#include "URLCanonInternal.h"
+#include "URLCharacterTypes.h"
+#include "URLQueryCharsetConverter.h"
+#include <wtf/text/ASCIIFastPath.h>
+
+// Query canonicalization in IE
+// ----------------------------
+// IE is very permissive for query parameters specified in links on the page
+// (in contrast to links that it constructs itself based on form data). It does
+// not unescape any character. It does not reject any escape sequence (be they
+// invalid like "%2y" or freaky like %00).
+//
+// IE only escapes spaces and nothing else. Embedded NULLs, tabs (0x09),
+// LF (0x0a), and CR (0x0d) are removed (this probably happens at an earlier
+// layer since they are removed from all portions of the URL). All other
+// characters are passed unmodified. Invalid UTF-16 sequences are preserved as
+// well, with each character in the input being converted to UTF-8. It is the
+// server's job to make sense of this invalid query.
+//
+// Invalid multibyte sequences (for example, invalid UTF-8 on a UTF-8 page)
+// are converted to the invalid character and sent as unescaped UTF-8 (0xef,
+// 0xbf, 0xbd). This may not be canonicalization, the parser may generate these
+// strings before the URL handler ever sees them.
+//
+// Our query canonicalization
+// --------------------------
+// We escape all non-ASCII characters and control characters, like Firefox.
+// This is more conformant to the URL spec, and there do not seem to be many
+// problems relating to Firefox's behavior.
+//
+// Like IE, we will never unescape (although the application may want to try
+// unescaping to present the user with a more understandable URL). We will
+// replace all invalid sequences (including invalid UTF-16 sequences, which IE
+// doesn't) with the "invalid character," and we will escape it.
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+// Returns true if the characters starting at |begin| and going until |end|
+// (non-inclusive) are all representable in 7-bits.
+template<typename CharacterType>
+bool isAllASCII(const CharacterType* spec, const URLComponent& query)
+{
+    return charactersAreAllASCII(spec + query.begin(), query.length());
+}
+
+// FIXME: Benjamin: get rid of this when everything is based on LChar.
+template<>
+bool isAllASCII<char>(const char* spec, const URLComponent& query)
+{
+    return charactersAreAllASCII(reinterpret_cast<const LChar*>(spec + query.begin()), query.length());
+}
+
+// Appends the given string to the output, escaping characters that do not
+// match the given |type| in SharedCharTypes. This version will accept 8 or 16
+// bit characters, but assumes that they have only 7-bit values. It also assumes
+// that all UTF-8 values are correct, so doesn't bother checking
+template<typename CharacterType>
+void appendRaw8BitQueryString(const CharacterType* source, int length, URLBuffer<char>& output)
+{
+    for (int i = 0; i < length; ++i) {
+        if (!URLCharacterTypes::isQueryChar(static_cast<unsigned char>(source[i])))
+            appendURLEscapedCharacter(static_cast<unsigned char>(source[i]), output);
+        else // Doesn't need escaping.
+            output.append(static_cast<char>(source[i]));
+    }
+}
+
+// Runs the converter on the given UTF-8 input. Since the converter expects
+// UTF-16, we have to convert first. The converter must be non-null.
+void runConverter(const char* spec, const URLComponent& query, URLQueryCharsetConverter* converter, URLBuffer<char>& output)
+{
+    // This function will replace any misencoded values with the invalid
+    // character. This is what we want so we don't have to check for error.
+    RawURLBuffer<UChar> utf16;
+    ConvertUTF8ToUTF16(&spec[query.begin()], query.length(), utf16);
+    converter->convertFromUTF16(utf16.data(), utf16.length(), output);
+}
+
+// Runs the converter with the given UTF-16 input. We don't have to do
+// anything, but this overriddden function allows us to use the same code
+// for both UTF-8 and UTF-16 input.
+void runConverter(const UChar* spec, const URLComponent& query, URLQueryCharsetConverter* converter, URLBuffer<char>& output)
+{
+    converter->convertFromUTF16(&spec[query.begin()], query.length(), output);
+}
+
+template<typename CharacterType>
+void doConvertToQueryEncoding(const CharacterType* spec, const URLComponent& query, URLQueryCharsetConverter* converter, URLBuffer<char>& output)
+{
+    if (isAllASCII(spec, query)) {
+        // Easy: the input can just appended with no character set conversions.
+        appendRaw8BitQueryString(&spec[query.begin()], query.length(), output);
+    } else {
+        // Harder: convert to the proper encoding first.
+        if (converter) {
+            // Run the converter to get an 8-bit string, then append it, escaping
+            // necessary values.
+            RawURLBuffer<char> eightBitQueryString;
+            runConverter(spec, query, converter, eightBitQueryString);
+            appendRaw8BitQueryString(eightBitQueryString.data(), eightBitQueryString.length(), output);
+        } else {
+            // No converter, do our own UTF-8 conversion.
+            appendStringOfType(&spec[query.begin()], query.length(), URLCharacterTypes::QueryCharacter, output);
+        }
+    }
+}
+
+template<typename CharacterType>
+void doCanonicalizeQuery(const CharacterType* spec, const URLComponent& query, URLQueryCharsetConverter* converter,
+                         URLBuffer<char>& output, URLComponent& outputQueryComponent)
+{
+    if (query.length() < 0) {
+        outputQueryComponent = URLComponent();
+        return;
+    }
+
+    output.append('?');
+    outputQueryComponent.setBegin(output.length());
+
+    doConvertToQueryEncoding<CharacterType>(spec, query, converter, output);
+
+    outputQueryComponent.setLength(output.length() - outputQueryComponent.begin());
+}
+
+} // namespace
+
+void CanonicalizeQuery(const char* spec, const URLComponent& query, URLQueryCharsetConverter* converter,
+                       URLBuffer<char>& output, URLComponent* outputQueryComponent)
+{
+    doCanonicalizeQuery(spec, query, converter, output, *outputQueryComponent);
+}
+
+void CanonicalizeQuery(const UChar* spec, const URLComponent& query, URLQueryCharsetConverter* converter,
+                       URLBuffer<char>& output, URLComponent* outputQueryComponent)
+{
+    doCanonicalizeQuery(spec, query, converter, output, *outputQueryComponent);
+}
+
+void ConvertUTF16ToQueryEncoding(const UChar* input, const URLComponent& query, URLQueryCharsetConverter* converter, URLBuffer<char>& output)
+{
+    doConvertToQueryEncoding<UChar>(input, query, converter, output);
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonRelative.cpp b/Source/WTF/wtf/url/src/URLCanonRelative.cpp
new file mode 100644
index 0000000..7ef0500
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonRelative.cpp
@@ -0,0 +1,572 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// Canonicalizer functions for working with and resolving relative URLs.
+
+#include "config.h"
+#include "URLCanon.h"
+
+#include "URLCanonInternal.h"
+#include "URLFile.h"
+#include "URLParseInternal.h"
+#include "URLUtilInternal.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+// Firefox does a case-sensitive compare (which is probably wrong--Mozilla bug
+// 379034), whereas IE is case-insensetive.
+//
+// We choose to be more permissive like IE. We don't need to worry about
+// unescaping or anything here: neither IE or Firefox allow this. We also
+// don't have to worry about invalid scheme characters since we are comparing
+// against the canonical scheme of the base.
+//
+// The base URL should always be canonical, therefore is ASCII.
+template<typename CHAR>
+bool AreSchemesEqual(const char* base,
+                     const URLComponent& baseScheme,
+                     const CHAR* cmp,
+                     const URLComponent& cmpScheme)
+{
+    if (baseScheme.length() != cmpScheme.length())
+        return false;
+    for (int i = 0; i < baseScheme.length(); i++) {
+        // We assume the base is already canonical, so we don't have to
+        // canonicalize it.
+        if (canonicalSchemeChar(cmp[cmpScheme.begin() + i]) !=
+            base[baseScheme.begin() + i])
+            return false;
+    }
+    return true;
+}
+
+#if OS(WINDOWS)
+// Here, we also allow Windows paths to be represented as "/C:/" so we can be
+// consistent about URL paths beginning with slashes. This function is like
+// DoesBeginWindowsDrivePath except that it also requires a slash at the
+// beginning.
+template<typename CHAR>
+bool doesBeginSlashWindowsDriveSpec(const CHAR* spec, int startOffset, int specLength)
+{
+    if (startOffset >= specLength)
+        return false;
+    return URLParser::isURLSlash(spec[startOffset]) && URLParser::doesBeginWindowsDriveSpec(spec, startOffset + 1, specLength);
+}
+
+#endif // OS(WINDOWS)
+
+// See isRelativeURL in the header file for usage.
+template<typename CharacterType>
+bool doIsRelativeURL(const char* base, const URLSegments& baseParsed,
+                     const CharacterType* url, int urlLength,
+                     bool isBaseHierarchical,
+                     bool& isRelative, URLComponent& relativeComponent)
+{
+    isRelative = false; // So we can default later to not relative.
+
+    // Trim whitespace and construct a new range for the substring.
+    int begin = 0;
+    URLParser::trimURL(url, begin, urlLength);
+    if (begin >= urlLength) {
+        // Empty URLs are relative, but do nothing.
+        relativeComponent = URLComponent(begin, 0);
+        isRelative = true;
+        return true;
+    }
+
+#if OS(WINDOWS)
+    // We special case paths like "C:\foo" so they can link directly to the
+    // file on Windows (IE compatability). The security domain stuff should
+    // prevent a link like this from actually being followed if its on a
+    // web page.
+    //
+    // We treat "C:/foo" as an absolute URL. We can go ahead and treat "/c:/"
+    // as relative, as this will just replace the path when the base scheme
+    // is a file and the answer will still be correct.
+    //
+    // We require strict backslashes when detecting UNC since two forward
+    // shashes should be treated a a relative URL with a hostname.
+    if (URLParser::doesBeginWindowsDriveSpec(url, begin, urlLength) || URLParser::doesBeginUNCPath(url, begin, urlLength, true))
+        return true;
+#endif // OS(WINDOWS)
+
+    // See if we've got a scheme, if not, we know this is a relative URL.
+    // BUT: Just because we have a scheme, doesn't make it absolute.
+    // "http:foo.html" is a relative URL with path "foo.html". If the scheme is
+    // empty, we treat it as relative (":foo") like IE does.
+    URLComponent scheme;
+    if (!URLParser::ExtractScheme(url, urlLength, &scheme) || !scheme.length()) {
+        // Don't allow relative URLs if the base scheme doesn't support it.
+        if (!isBaseHierarchical)
+            return false;
+
+        relativeComponent = URLComponent::fromRange(begin, urlLength);
+        isRelative = true;
+        return true;
+    }
+
+    // If the scheme isn't valid, then it's relative.
+    int schemeEnd = scheme.end();
+    for (int i = scheme.begin(); i < schemeEnd; i++) {
+        if (!canonicalSchemeChar(url[i])) {
+            relativeComponent = URLComponent::fromRange(begin, urlLength);
+            isRelative = true;
+            return true;
+        }
+    }
+
+    // If the scheme is not the same, then we can't count it as relative.
+    if (!AreSchemesEqual(base, baseParsed.scheme, url, scheme))
+        return true;
+
+    // When the scheme that they both share is not hierarchical, treat the
+    // incoming scheme as absolute (this way with the base of "data:foo",
+    // "data:bar" will be reported as absolute.
+    if (!isBaseHierarchical)
+        return true;
+
+    int colonOffset = scheme.end();
+
+    // If it's a filesystem URL, the only valid way to make it relative is not to
+    // supply a scheme. There's no equivalent to e.g. http:index.html.
+    if (URLUtilities::CompareSchemeComponent(url, scheme, "filesystem"))
+        return true;
+
+    // ExtractScheme guarantees that the colon immediately follows what it
+    // considers to be the scheme. countConsecutiveSlashes will handle the
+    // case where the begin offset is the end of the input.
+    int numSlashes = URLParser::countConsecutiveSlashes(url, colonOffset + 1, urlLength);
+
+    if (!numSlashes || numSlashes == 1) {
+        // No slashes means it's a relative path like "http:foo.html". One slash
+        // is an absolute path. "http:/home/foo.html"
+        isRelative = true;
+        relativeComponent = URLComponent::fromRange(colonOffset + 1, urlLength);
+        return true;
+    }
+
+    // Two or more slashes after the scheme we treat as absolute.
+    return true;
+}
+
+// Copies all characters in the range [begin, end) of |spec| to the output,
+// up until and including the last slash. There should be a slash in the
+// range, if not, nothing will be copied.
+//
+// The input is assumed to be canonical, so we search only for exact slashes
+// and not backslashes as well. We also know that it's ASCII.
+void CopyToLastSlash(const char* spec, int begin, int end, URLBuffer<char>& output)
+{
+    // Find the last slash.
+    int lastSlash = -1;
+    for (int i = end - 1; i >= begin; --i) {
+        if (spec[i] == '/') {
+            lastSlash = i;
+            break;
+        }
+    }
+    if (lastSlash < 0)
+        return; // No slash.
+
+    // Copy.
+    for (int i = begin; i <= lastSlash; ++i)
+        output.append(spec[i]);
+}
+
+// Copies a single component from the source to the output. This is used
+// when resolving relative URLs and a given component is unchanged. Since the
+// source should already be canonical, we don't have to do anything special,
+// and the input is ASCII.
+void CopyOneComponent(const char* source,
+                      const URLComponent& sourceComponent,
+                      URLBuffer<char>& output,
+                      URLComponent* outputComponent)
+{
+    if (sourceComponent.length() < 0) {
+        // This component is not present.
+        *outputComponent = URLComponent();
+        return;
+    }
+
+    outputComponent->setBegin(output.length());
+    int sourceEnd = sourceComponent.end();
+    for (int i = sourceComponent.begin(); i < sourceEnd; i++)
+        output.append(source[i]);
+    outputComponent->setLength(output.length() - outputComponent->begin());
+}
+
+#if OS(WINDOWS)
+
+// Called on Windows when the base URL is a file URL, this will copy the "C:"
+// to the output, if there is a drive letter and if that drive letter is not
+// being overridden by the relative URL. Otherwise, do nothing.
+//
+// It will return the index of the beginning of the next character in the
+// base to be processed: if there is a "C:", the slash after it, or if
+// there is no drive letter, the slash at the beginning of the path, or
+// the end of the base. This can be used as the starting offset for further
+// path processing.
+template<typename CHAR>
+int CopyBaseDriveSpecIfNecessary(const char* baseURL,
+                                 int basePathBegin,
+                                 int basePathEnd,
+                                 const CHAR* relativeURL,
+                                 int pathStart,
+                                 int relativeUrlLength,
+                                 URLBuffer<char>& output)
+{
+    if (basePathBegin >= basePathEnd)
+        return basePathBegin; // No path.
+
+    // If the relative begins with a drive spec, don't do anything. The existing
+    // drive spec in the base will be replaced.
+    if (URLParser::doesBeginWindowsDriveSpec(relativeURL,
+                                             pathStart, relativeUrlLength)) {
+        return basePathBegin; // Relative URL path is "C:/foo"
+    }
+
+    // The path should begin with a slash (as all canonical paths do). We check
+    // if it is followed by a drive letter and copy it.
+    if (doesBeginSlashWindowsDriveSpec(baseURL, basePathBegin, basePathEnd)) {
+        // Copy the two-character drive spec to the output. It will now look like
+        // "file:///C:" so the rest of it can be treated like a standard path.
+        output.append('/');
+        output.append(baseURL[basePathBegin + 1]);
+        output.append(baseURL[basePathBegin + 2]);
+        return basePathBegin + 3;
+    }
+
+    return basePathBegin;
+}
+
+#endif // OS(WINDOWS)
+
+// A subroutine of doResolveRelativeURL, this resolves the URL knowning that
+// the input is a relative path or less (qyuery or ref).
+template<typename CHAR>
+bool doResolveRelativePath(const char* baseURL,
+                           const URLSegments& baseParsed,
+                           bool /* baseIsFile */,
+                           const CHAR* relativeURL,
+                           const URLComponent& relativeComponent,
+                           URLQueryCharsetConverter* queryConverter,
+                           URLBuffer<char>& output,
+                           URLSegments* outputParsed)
+{
+    bool success = true;
+
+    // We know the authority section didn't change, copy it to the output. We
+    // also know we have a path so can copy up to there.
+    URLComponent path, query, ref;
+    URLParser::parsePathInternal(relativeURL,
+                                 relativeComponent,
+                                 &path,
+                                 &query,
+                                 &ref);
+    // Canonical URLs always have a path, so we can use that offset.
+    output.append(baseURL, baseParsed.path.begin());
+
+    if (path.length() > 0) {
+        // The path is replaced or modified.
+        int truePathBegin = output.length();
+
+        // For file: URLs on Windows, we don't want to treat the drive letter and
+        // colon as part of the path for relative file resolution when the
+        // incoming URL does not provide a drive spec. We save the true path
+        // beginning so we can fix it up after we are done.
+        int basePathBegin = baseParsed.path.begin();
+#if OS(WINDOWS)
+        if (baseIsFile) {
+            basePathBegin = CopyBaseDriveSpecIfNecessary(baseURL, baseParsed.path.begin(), baseParsed.path.end(),
+                                                         relativeURL, relativeComponent.begin(), relativeComponent.end(),
+                                                         output);
+            // Now the output looks like either "file://" or "file:///C:"
+            // and we can start appending the rest of the path. |basePathBegin|
+            // points to the character in the base that comes next.
+        }
+#endif // OS(WINDOWS)
+
+        if (URLParser::isURLSlash(relativeURL[path.begin()])) {
+            // Easy case: the path is an absolute path on the server, so we can
+            // just replace everything from the path on with the new versions.
+            // Since the input should be canonical hierarchical URL, we should
+            // always have a path.
+            success &= CanonicalizePath(relativeURL, path,
+                                        output, &outputParsed->path);
+        } else {
+            // Relative path, replace the query, and reference. We take the
+            // original path with the file part stripped, and append the new path.
+            // The canonicalizer will take care of resolving ".." and "."
+            int pathBegin = output.length();
+            CopyToLastSlash(baseURL, basePathBegin, baseParsed.path.end(),
+                            output);
+            success &= CanonicalizePartialPath(relativeURL, path, pathBegin,
+                                               output);
+            outputParsed->path = URLComponent::fromRange(pathBegin, output.length());
+
+            // Copy the rest of the stuff after the path from the relative path.
+        }
+
+        // Finish with the query and reference part (these can't fail).
+        CanonicalizeQuery(relativeURL, query, queryConverter, output, &outputParsed->query);
+        canonicalizeFragment(relativeURL, ref, output, outputParsed->fragment);
+
+        // Fix the path beginning to add back the "C:" we may have written above.
+        outputParsed->path = URLComponent::fromRange(truePathBegin,
+                                                     outputParsed->path.end());
+        return success;
+    }
+
+    // If we get here, the path is unchanged: copy to output.
+    CopyOneComponent(baseURL, baseParsed.path, output, &outputParsed->path);
+
+    if (query.isValid()) {
+        // Just the query specified, replace the query and reference (ignore
+        // failures for refs)
+        CanonicalizeQuery(relativeURL, query, queryConverter,
+                          output, &outputParsed->query);
+        canonicalizeFragment(relativeURL, ref, output, outputParsed->fragment);
+        return success;
+    }
+
+    // If we get here, the query is unchanged: copy to output. Note that the
+    // range of the query parameter doesn't include the question mark, so we
+    // have to add it manually if there is a component.
+    if (baseParsed.query.isValid())
+        output.append('?');
+    CopyOneComponent(baseURL, baseParsed.query, output, &outputParsed->query);
+
+    if (ref.isValid()) {
+        // Just the reference specified: replace it (ignoring failures).
+        canonicalizeFragment(relativeURL, ref, output, outputParsed->fragment);
+        return success;
+    }
+
+    // We should always have something to do in this function, the caller checks
+    // that some component is being replaced.
+    ASSERT_NOT_REACHED();
+    return success;
+}
+
+// Resolves a relative URL that contains a host. Typically, these will
+// be of the form "//www.apple.com/foo/bar?baz#fragment" and the only thing which
+// should be kept from the original URL is the scheme.
+template<typename CHAR>
+bool doResolveRelativeHost(const char* baseURL,
+                           const URLSegments& baseParsed,
+                           const CHAR* relativeURL,
+                           const URLComponent& relativeComponent,
+                           URLQueryCharsetConverter* queryConverter,
+                           URLBuffer<char>& output,
+                           URLSegments* outputParsed)
+{
+    // Parse the relative URL, just like we would for anything following a
+    // scheme.
+    URLSegments relativeParsed; // Everything but the scheme is valid.
+    URLParser::parseAfterScheme(&relativeURL[relativeComponent.begin()],
+                                relativeComponent.length(), relativeComponent.begin(),
+                                relativeParsed);
+
+    // Now we can just use the replacement function to replace all the necessary
+    // parts of the old URL with the new one.
+    Replacements<CHAR> replacements;
+    replacements.SetUsername(relativeURL, relativeParsed.username);
+    replacements.SetPassword(relativeURL, relativeParsed.password);
+    replacements.SetHost(relativeURL, relativeParsed.host);
+    replacements.SetPort(relativeURL, relativeParsed.port);
+    replacements.SetPath(relativeURL, relativeParsed.path);
+    replacements.SetQuery(relativeURL, relativeParsed.query);
+    replacements.SetRef(relativeURL, relativeParsed.fragment);
+
+    return ReplaceStandardURL(baseURL, baseParsed, replacements,
+                              queryConverter, output, outputParsed);
+}
+
+// Resolves a relative URL that happens to be an absolute file path. Examples
+// include: "//hostname/path", "/c:/foo", and "//hostname/c:/foo".
+template<typename CharacterType>
+bool doResolveAbsoluteFile(const CharacterType* relativeURL,
+                           const URLComponent& relativeComponent,
+                           URLQueryCharsetConverter* queryConverter,
+                           URLBuffer<char>& output,
+                           URLSegments& outputParsed)
+{
+    // Parse the file URL. The file URl parsing function uses the same logic
+    // as we do for determining if the file is absolute, in which case it will
+    // not bother to look for a scheme.
+    URLSegments relativeParsed;
+    URLParser::ParseFileURL(&relativeURL[relativeComponent.begin()],
+                            relativeComponent.length(), &relativeParsed);
+
+    return CanonicalizeFileURL(&relativeURL[relativeComponent.begin()],
+                               relativeComponent.length(), relativeParsed,
+                               queryConverter, output, &outputParsed);
+}
+
+// TODO(brettw) treat two slashes as root like Mozilla for FTP?
+template<typename CHAR>
+bool doResolveRelativeURL(const char* baseURL,
+                          const URLSegments& baseParsed,
+                          bool baseIsFile,
+                          const CHAR* relativeURL,
+                          const URLComponent& relativeComponent,
+                          URLQueryCharsetConverter* queryConverter,
+                          URLBuffer<char>& output,
+                          URLSegments* outputParsed)
+{
+    // Starting point for our output parsed. We'll fix what we change.
+    *outputParsed = baseParsed;
+
+    // Sanity check: the input should have a host or we'll break badly below.
+    // We can only resolve relative URLs with base URLs that have hosts and
+    // paths (even the default path of "/" is OK).
+    //
+    // We allow hosts with no length so we can handle file URLs, for example.
+    if (baseParsed.path.length() <= 0) {
+        // On error, return the input (resolving a relative URL on a non-relative
+        // base = the base).
+        int baseLength = baseParsed.length();
+        for (int i = 0; i < baseLength; i++)
+            output.append(baseURL[i]);
+        return false;
+    }
+
+    if (relativeComponent.length() <= 0) {
+        // Empty relative URL, leave unchanged, only removing the ref component.
+        int baseLength = baseParsed.length();
+        baseLength -= baseParsed.fragment.length() + 1;
+        outputParsed->fragment.reset();
+        output.append(baseURL, baseLength);
+        return true;
+    }
+
+    int numSlashes = URLParser::countConsecutiveSlashes(relativeURL, relativeComponent.begin(), relativeComponent.end());
+
+#if OS(WINDOWS)
+    // On Windows, two slashes for a file path (regardless of which direction
+    // they are) means that it's UNC. Two backslashes on any base scheme mean
+    // that it's an absolute UNC path (we use the baseIsFile flag to control
+    // how strict the UNC finder is).
+    //
+    // We also allow Windows absolute drive specs on any scheme (for example
+    // "c:\foo") like IE does. There must be no preceeding slashes in this
+    // case (we reject anything like "/c:/foo") because that should be treated
+    // as a path. For file URLs, we allow any number of slashes since that would
+    // be setting the path.
+    //
+    // This assumes the absolute path resolver handles absolute URLs like this
+    // properly. URLUtilities::DoCanonicalize does this.
+    int afterSlashes = relativeComponent.begin + numSlashes;
+    if (URLParser::doesBeginUNCPath(relativeURL, relativeComponent.begin(), relativeComponent.end(), !baseIsFile)
+        || ((!numSlashes || baseIsFile) && URLParser::doesBeginWindowsDriveSpec(relativeURL, afterSlashes, relativeComponent.end()))) {
+             return doResolveAbsoluteFile(relativeURL, relativeComponent,
+                                          queryConverter, output, *outputParsed);
+         }
+#else
+    // Other platforms need explicit handling for file: URLs with multiple
+    // slashes because the generic scheme parsing always extracts a host, but a
+    // file: URL only has a host if it has exactly 2 slashes. This also
+    // handles the special case where the URL is only slashes, since that
+    // doesn't have a host part either.
+    if (baseIsFile && (numSlashes > 2 || numSlashes == relativeComponent.length())) {
+        return doResolveAbsoluteFile(relativeURL, relativeComponent,
+                                     queryConverter, output, *outputParsed);
+    }
+#endif
+
+    // Any other double-slashes mean that this is relative to the scheme.
+    if (numSlashes >= 2) {
+        return doResolveRelativeHost(baseURL, baseParsed,
+                                     relativeURL, relativeComponent,
+                                     queryConverter, output, outputParsed);
+    }
+
+    // When we get here, we know that the relative URL is on the same host.
+    return doResolveRelativePath(baseURL, baseParsed, baseIsFile,
+                                 relativeURL, relativeComponent,
+                                 queryConverter, output, outputParsed);
+}
+
+} // namespace
+
+bool isRelativeURL(const char* base, const URLSegments& baseParsed,
+                   const char* fragment, int fragmentLength,
+                   bool isBaseHierarchical,
+                   bool& isRelative, URLComponent& relativeComponent)
+{
+    return doIsRelativeURL<char>(base, baseParsed, fragment, fragmentLength, isBaseHierarchical, isRelative, relativeComponent);
+}
+
+bool isRelativeURL(const char* base, const URLSegments& baseParsed,
+                   const UChar* fragment, int fragmentLength,
+                   bool isBaseHierarchical,
+                   bool& isRelative, URLComponent& relativeComponent)
+{
+    return doIsRelativeURL<UChar>(base, baseParsed, fragment, fragmentLength, isBaseHierarchical, isRelative, relativeComponent);
+}
+
+bool resolveRelativeURL(const char* baseURL,
+                        const URLSegments& baseParsed,
+                        bool baseIsFile,
+                        const char* relativeURL,
+                        const URLComponent& relativeComponent,
+                        URLQueryCharsetConverter* queryConverter,
+                        URLBuffer<char>& output,
+                        URLSegments* outputParsed)
+{
+    return doResolveRelativeURL<char>(baseURL, baseParsed, baseIsFile, relativeURL,
+                                      relativeComponent, queryConverter, output, outputParsed);
+}
+
+bool resolveRelativeURL(const char* baseURL,
+                        const URLSegments& baseParsed,
+                        bool baseIsFile,
+                        const UChar* relativeURL,
+                        const URLComponent& relativeComponent,
+                        URLQueryCharsetConverter* queryConverter,
+                        URLBuffer<char>& output,
+                        URLSegments* outputParsed)
+{
+    return doResolveRelativeURL<UChar>(baseURL, baseParsed, baseIsFile, relativeURL,
+                                       relativeComponent, queryConverter, output, outputParsed);
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCanonStdURL.cpp b/Source/WTF/wtf/url/src/URLCanonStdURL.cpp
new file mode 100644
index 0000000..5e2dd1c
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCanonStdURL.cpp
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// Functions to canonicalize "standard" URLs, which are ones that have an
+// authority section including a host name.
+
+#include "config.h"
+#include "URLCanon.h"
+
+#include "RawURLBuffer.h"
+#include "URLCanonInternal.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLCanonicalizer {
+
+namespace {
+
+template<typename CHAR, typename UCHAR>
+bool doCanonicalizeStandardURL(const URLComponentSource<CHAR>& source,
+                               const URLSegments& parsed,
+                               URLQueryCharsetConverter* queryConverter,
+                               URLBuffer<char>& output,
+                               URLSegments& outputParsed)
+{
+    // Scheme: this will append the colon.
+    bool success = canonicalizeScheme(source.scheme, parsed.scheme, output, outputParsed.scheme);
+
+    // Authority (username, password, host, port)
+    bool haveAuthority;
+    if (parsed.username.isNonEmpty() || parsed.password.isValid() || parsed.host.isNonEmpty() || parsed.port.isValid()) {
+        haveAuthority = true;
+
+        // Only write the authority separators when we have a scheme.
+        if (parsed.scheme.isValid())
+            output.append("//", 2);
+
+        // User info: the canonicalizer will handle the : and @.
+        success &= canonicalizeUserInfo(source.username, parsed.username, source.password, parsed.password,
+                                        output, outputParsed.username, outputParsed.password);
+        success &= canonicalizeHost(source.host, parsed.host, output, outputParsed.host);
+
+        // Host must not be empty for standard URLs.
+        if (!parsed.host.isNonEmpty())
+            success = false;
+
+        // Port: the port canonicalizer will handle the colon.
+        int defaultPort = defaultPortForScheme(&output.data()[outputParsed.scheme.begin()], outputParsed.scheme.length());
+        success &= canonicalizePort(source.port, parsed.port, defaultPort, output, outputParsed.port);
+    } else {
+        // No authority, clear the components.
+        haveAuthority = false;
+        outputParsed.host.reset();
+        outputParsed.username.reset();
+        outputParsed.password.reset();
+        outputParsed.port.reset();
+        success = false; // Standard URLs must have an authority.
+    }
+
+    // Path
+    if (parsed.path.isNonEmpty())
+        success &= CanonicalizePath(source.path, parsed.path, output, &outputParsed.path);
+    else if (haveAuthority || parsed.query.isNonEmpty() || parsed.fragment.isNonEmpty()) {
+        // When we have an empty path, make up a path when we have an authority
+        // or something following the path. The only time we allow an empty
+        // output path is when there is nothing else.
+        outputParsed.path = URLComponent(output.length(), 1);
+        output.append('/');
+    } else
+        outputParsed.path.reset(); // No path at all
+
+    // Query
+    CanonicalizeQuery(source.query, parsed.query, queryConverter, output, &outputParsed.query);
+
+    // Ref: ignore failure for this, since the page can probably still be loaded.
+    canonicalizeFragment(source.ref, parsed.fragment, output, outputParsed.fragment);
+
+    return success;
+}
+
+} // namespace
+
+
+// Returns the default port for the given canonical scheme, or PORT_UNSPECIFIED
+// if the scheme is unknown.
+int defaultPortForScheme(const char* scheme, int schemeLength)
+{
+    int defaultPort = URLParser::PORT_UNSPECIFIED;
+    switch (schemeLength) {
+    case 4:
+        if (!strncmp(scheme, "http", schemeLength))
+            defaultPort = 80;
+        break;
+    case 5:
+        if (!strncmp(scheme, "https", schemeLength))
+            defaultPort = 443;
+        break;
+    case 3:
+        if (!strncmp(scheme, "ftp", schemeLength))
+            defaultPort = 21;
+        else if (!strncmp(scheme, "wss", schemeLength))
+            defaultPort = 443;
+        break;
+    case 6:
+        if (!strncmp(scheme, "gopher", schemeLength))
+            defaultPort = 70;
+        break;
+    case 2:
+        if (!strncmp(scheme, "ws", schemeLength))
+            defaultPort = 80;
+        break;
+    }
+    return defaultPort;
+}
+
+bool CanonicalizeStandardURL(const char* spec,
+                             int /* specLength */,
+                             const URLSegments& parsed,
+                             URLQueryCharsetConverter* queryConverter,
+                             URLBuffer<char>& output,
+                             URLSegments* outputParsed)
+{
+    return doCanonicalizeStandardURL<char, unsigned char>(URLComponentSource<char>(spec), parsed, queryConverter,
+                                                          output, *outputParsed);
+}
+
+bool CanonicalizeStandardURL(const UChar* spec,
+                             int /* specLength */,
+                             const URLSegments& parsed,
+                             URLQueryCharsetConverter* queryConverter,
+                             URLBuffer<char>& output,
+                             URLSegments* outputParsed)
+{
+    return doCanonicalizeStandardURL<UChar, UChar>(URLComponentSource<UChar>(spec), parsed, queryConverter,
+                                                   output, *outputParsed);
+}
+
+// It might be nice in the future to optimize this so unchanged components don't
+// need to be recanonicalized. This is especially true since the common case for
+// ReplaceComponents is removing things we don't want, like reference fragments
+// and usernames. These cases can become more efficient if we can assume the
+// rest of the URL is OK with these removed (or only the modified parts
+// recanonicalized). This would be much more complex to implement, however.
+//
+// You would also need to update DoReplaceComponents in URLUtilities.cc which
+// relies on this re-checking everything (see the comment there for why).
+bool ReplaceStandardURL(const char* base,
+                        const URLSegments& baseParsed,
+                        const Replacements<char>& replacements,
+                        URLQueryCharsetConverter* queryConverter,
+                        URLBuffer<char>& output,
+                        URLSegments* outputParsed)
+{
+    URLComponentSource<char> source(base);
+    URLSegments parsed(baseParsed);
+    SetupOverrideComponents(base, replacements, &source, &parsed);
+    return doCanonicalizeStandardURL<char, unsigned char>(source, parsed, queryConverter, output, *outputParsed);
+}
+
+// For 16-bit replacements, we turn all the replacements into UTF-8 so the
+// regular codepath can be used.
+bool ReplaceStandardURL(const char* base,
+                        const URLSegments& baseParsed,
+                        const Replacements<UChar>& replacements,
+                        URLQueryCharsetConverter* queryConverter,
+                        URLBuffer<char>& output,
+                        URLSegments* outputParsed)
+{
+    RawURLBuffer<char> utf8;
+    URLComponentSource<char> source(base);
+    URLSegments parsed(baseParsed);
+    SetupUTF16OverrideComponents(base, replacements, utf8, &source, &parsed);
+    return doCanonicalizeStandardURL<char, unsigned char>(source, parsed, queryConverter, output, *outputParsed);
+}
+
+} // namespace URLCanonicalizer
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCharacterTypes.cpp b/Source/WTF/wtf/url/src/URLCharacterTypes.cpp
new file mode 100644
index 0000000..21dd22f
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCharacterTypes.cpp
@@ -0,0 +1,178 @@
+/*
+ * Copyright 2010 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.
+ *     * 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.
+ *     * 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 "URLCharacterTypes.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+const unsigned char URLCharacterTypes::characterTypeTable[0x100] = {
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0x00 - 0x0f
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0x10 - 0x1f
+    InvalidCharacter, // 0x20  ' ' (escape spaces in queries)
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x21  !
+    InvalidCharacter, // 0x22  "
+    InvalidCharacter, // 0x23  #  (invalid in query since it marks the ref)
+    QueryCharacter | UserInfoCharacter, // 0x24  $
+    QueryCharacter | UserInfoCharacter, // 0x25  %
+    QueryCharacter | UserInfoCharacter, // 0x26  &
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x27  '
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x28  (
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x29  )
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x2a  *
+    QueryCharacter | UserInfoCharacter, // 0x2b  +
+    QueryCharacter | UserInfoCharacter, // 0x2c  ,
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x2d  -
+    QueryCharacter | UserInfoCharacter | IPv4Character | ComponentCharacter, // 0x2e  .
+    QueryCharacter, // 0x2f  /
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | DecimalCharacter | OctalCharacter | ComponentCharacter, // 0x30  0
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | DecimalCharacter | OctalCharacter | ComponentCharacter, // 0x31  1
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | DecimalCharacter | OctalCharacter | ComponentCharacter, // 0x32  2
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | DecimalCharacter | OctalCharacter | ComponentCharacter, // 0x33  3
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | DecimalCharacter | OctalCharacter | ComponentCharacter, // 0x34  4
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | DecimalCharacter | OctalCharacter | ComponentCharacter, // 0x35  5
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | DecimalCharacter | OctalCharacter | ComponentCharacter, // 0x36  6
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | DecimalCharacter | OctalCharacter | ComponentCharacter, // 0x37  7
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | DecimalCharacter | ComponentCharacter, // 0x38  8
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | DecimalCharacter | ComponentCharacter, // 0x39  9
+    QueryCharacter, // 0x3a  :
+    QueryCharacter, // 0x3b  ;
+    InvalidCharacter, // 0x3c  <  (Try to prevent certain types of XSS.)
+    QueryCharacter, // 0x3d  =
+    InvalidCharacter, // 0x3e  >  (Try to prevent certain types of XSS.)
+    QueryCharacter, // 0x3f  ?
+    QueryCharacter, // 0x40  @
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x41  A
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x42  B
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x43  C
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x44  D
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x45  E
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x46  F
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x47  G
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x48  H
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x49  I
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x4a  J
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x4b  K
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x4c  L
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x4d  M
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x4e  N
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x4f  O
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x50  P
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x51  Q
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x52  R
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x53  S
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x54  T
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x55  U
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x56  V
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x57  W
+    QueryCharacter | UserInfoCharacter | IPv4Character | ComponentCharacter, // 0x58  X
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x59  Y
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x5a  Z
+    QueryCharacter, // 0x5b  [
+    QueryCharacter, // 0x5c  '\'
+    QueryCharacter, // 0x5d  ]
+    QueryCharacter, // 0x5e  ^
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x5f  _
+    QueryCharacter, // 0x60  `
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x61  a
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x62  b
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x63  c
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x64  d
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x65  e
+    QueryCharacter | UserInfoCharacter | IPv4Character | HexadecimalCharacter | ComponentCharacter, // 0x66  f
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x67  g
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x68  h
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x69  i
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x6a  j
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x6b  k
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x6c  l
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x6d  m
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x6e  n
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x6f  o
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x70  p
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x71  q
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x72  r
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x73  s
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x74  t
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x75  u
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x76  v
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x77  w
+    QueryCharacter | UserInfoCharacter | IPv4Character | ComponentCharacter, // 0x78  x
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x79  y
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x7a  z
+    QueryCharacter, // 0x7b  {
+    QueryCharacter, // 0x7c  |
+    QueryCharacter, // 0x7d  }
+    QueryCharacter | UserInfoCharacter | ComponentCharacter, // 0x7e  ~
+    InvalidCharacter, // 0x7f
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0x80 - 0x8f
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0x90 - 0x9f
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xa0 - 0xaf
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xb0 - 0xbf
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xc0 - 0xcf
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xd0 - 0xdf
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xe0 - 0xef
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter,
+    InvalidCharacter, InvalidCharacter, InvalidCharacter, InvalidCharacter, // 0xf0 - 0xff
+};
+
+}
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLCharacterTypes.h b/Source/WTF/wtf/url/src/URLCharacterTypes.h
new file mode 100644
index 0000000..6652105
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLCharacterTypes.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2010 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.
+ *     * 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.
+ *     * 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 URLCharacterTypes_h
+#define URLCharacterTypes_h
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+class URLCharacterTypes {
+public:
+    enum CharacterTypes {
+        InvalidCharacter = 0,
+        QueryCharacter = 1 << 0,
+        UserInfoCharacter = 1 << 1,
+        IPv4Character = 1 << 2,
+        HexadecimalCharacter = 1 << 3,
+        DecimalCharacter = 1 << 4,
+        OctalCharacter = 1 << 5,
+        ComponentCharacter = 1 << 6,
+    };
+
+    static inline bool isComponentChar(unsigned char character) { return isCharacterOfType(character, ComponentCharacter); }
+    static inline bool isHexChar(unsigned char character) { return isCharacterOfType(character, HexadecimalCharacter); }
+    static inline bool isIPv4Char(unsigned char character) { return isCharacterOfType(character, IPv4Character); }
+    static inline bool isQueryChar(unsigned char character) { return isCharacterOfType(character, QueryCharacter); }
+
+    static inline bool isCharacterOfType(unsigned char HexCharacter, CharacterTypes type)
+    {
+        return !!(characterTypeTable[HexCharacter] & type);
+    }
+
+private:
+    static const unsigned char characterTypeTable[0x100];
+};
+
+}
+
+#endif // USE(WTFURL)
+
+#endif // URLCharacterTypes_h
diff --git a/Source/WTF/wtf/url/src/URLComponent.h b/Source/WTF/wtf/url/src/URLComponent.h
new file mode 100644
index 0000000..86ae05a
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLComponent.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2010 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.
+ *     * 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.
+ *     * 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 URLComponent_h
+#define URLComponent_h
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+// Represents a substring for URL parsing.
+class URLComponent {
+public:
+    URLComponent() : m_begin(0), m_length(-1) { }
+    URLComponent(int begin, int length) : m_begin(begin), m_length(length) { }
+
+    // Helper that returns a component created with the given begin and ending
+    // points. The ending point is non-inclusive.
+    static inline URLComponent fromRange(int begin, int end)
+    {
+        return URLComponent(begin, end - begin);
+    }
+
+    // Returns true if this component is valid, meaning the length is given. Even
+    // valid components may be empty to record the fact that they exist.
+    bool isValid() const { return m_length != -1; }
+
+    bool isNonEmpty() const { return m_length > 0; }
+    bool isEmptyOrInvalid() const { return m_length <= 0; }
+
+    void reset()
+    {
+        m_begin = 0;
+        m_length = -1;
+    }
+
+    bool operator==(const URLComponent& other) const { return m_begin == other.m_begin && m_length == other.m_length; }
+
+    int begin() const { return m_begin; }
+    void setBegin(int begin) { m_begin = begin; }
+    void moveBy(int offset) { m_begin += offset; }
+
+    int length() const { return m_length; }
+    void setLength(int length) { m_length = length; }
+
+    int end() const { return m_begin + m_length; }
+
+private:
+    int m_begin; // Byte offset in the string of this component.
+    int m_length; // Will be -1 if the component is unspecified.
+};
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // URLComponent_h
diff --git a/Source/WTF/wtf/url/src/URLFile.h b/Source/WTF/wtf/url/src/URLFile.h
new file mode 100644
index 0000000..48b12eb
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLFile.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// Provides shared functions used by the internals of the parser and
+// canonicalizer for file URLs. Do not use outside of these modules.
+
+#ifndef URLFile_h
+#define URLFile_h
+
+#include "URLParseInternal.h"
+#include <wtf/unicode/Unicode.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLParser {
+
+#if OS(WINDOWS)
+// We allow both "c:" and "c|" as drive identifiers.
+inline bool isWindowsDriveSeparator(UChar character)
+{
+    return character == ':' || character == '|';
+}
+inline bool isWindowsDriveLetter(UChar character)
+{
+    return (character >= 'A' && character <= 'Z') || (character >= 'a' && character <= 'z');
+}
+#endif // OS(WINDOWS)
+
+// Returns the index of the next slash in the input after the given index, or
+// specLength if the end of the input is reached.
+template<typename CharacterType>
+inline int findNextSlash(const CharacterType* spec, int beginIndex, int specLength)
+{
+    int idx = beginIndex;
+    while (idx < specLength && !isURLSlash(spec[idx]))
+        ++idx;
+    return idx;
+}
+
+#if OS(WINDOWS)
+// Returns true if the startOffset in the given spec looks like it begins a
+// drive spec, for example "c:". This function explicitly handles startOffset
+// values that are equal to or larger than the specLength to simplify callers.
+//
+// If this returns true, the spec is guaranteed to have a valid drive letter
+// plus a colon starting at |startOffset|.
+template<typename CharacterType>
+inline bool doesBeginWindowsDriveSpec(const CharacterType* spec, int startOffset, int specLength)
+{
+    int remainingLength = specLength - startOffset;
+    if (remainingLength < 2)
+        return false; // Not enough room.
+    if (!isWindowsDriveLetter(spec[startOffset]))
+        return false; // Doesn't start with a valid drive letter.
+    if (!isWindowsDriveSeparator(spec[startOffset + 1]))
+        return false; // Isn't followed with a drive separator.
+    return true;
+}
+
+// Returns true if the startOffset in the given text looks like it begins a
+// UNC path, for example "\\". This function explicitly handles startOffset
+// values that are equal to or larger than the specLength to simplify callers.
+//
+// When strictSlashes is set, this function will only accept backslashes as is
+// standard for Windows. Otherwise, it will accept forward slashes as well
+// which we use for a lot of URL handling.
+template<typename CharacterType>
+inline bool doesBeginUNCPath(const CharacterType* text, int startOffset, int length, bool strictSlashes)
+{
+    int remainingLength = length - startOffset;
+    if (remainingLength < 2)
+        return false;
+
+    if (strictSlashes)
+        return text[startOffset] == '\\' && text[startOffset + 1] == '\\';
+    return isURLSlash(text[startOffset]) && isURLSlash(text[startOffset + 1]);
+}
+#endif // OS(WINDOWS)
+
+} // namespace URLParser
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // URLFile_h
diff --git a/Source/WTF/wtf/url/src/URLParse.cpp b/Source/WTF/wtf/url/src/URLParse.cpp
new file mode 100644
index 0000000..91e65b4
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLParse.cpp
@@ -0,0 +1,780 @@
+/* Based on nsURLParsers.cc from Mozilla
+ * -------------------------------------
+ * Copyright (C) 1998 Netscape Communications Corporation.
+ * Copyright 2012, Google Inc. All rights reserved.
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Darin Fisher (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ */
+
+#include "config.h"
+#include "URLParse.h"
+
+#include "URLParseInternal.h"
+#include "URLUtil.h"
+#include "URLUtilInternal.h"
+#include <stdlib.h>
+#include <wtf/ASCIICType.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLParser {
+
+namespace {
+
+// Returns the offset of the next authority terminator in the input starting
+// from startOffset. If no terminator is found, the return value will be equal
+// to specLength.
+template<typename CharacterType>
+int findNextAuthorityTerminator(const CharacterType* spec, int startOffset, int specLength)
+{
+    for (int i = startOffset; i < specLength; i++) {
+        if (IsAuthorityTerminator(spec[i]))
+            return i;
+    }
+    return specLength; // Not found.
+}
+
+template<typename CharacterType>
+void parseUserInfo(const CharacterType* spec, const URLComponent& user, URLComponent& username, URLComponent& password)
+{
+    // Find the first colon in the user section, which separates the username and
+    // password.
+    int colonOffset = 0;
+    while (colonOffset < user.length() && spec[user.begin() + colonOffset] != ':')
+        ++colonOffset;
+
+    if (colonOffset < user.length()) {
+        // Found separator: <username>:<password>
+        username = URLComponent(user.begin(), colonOffset);
+        password = URLComponent::fromRange(user.begin() + colonOffset + 1, user.end());
+    } else {
+        // No separator, treat everything as the username
+        username = user;
+        password = URLComponent();
+    }
+}
+
+template<typename CharacterType>
+void parseServerInfo(const CharacterType* spec, const URLComponent& serverInfo, URLComponent& hostname, URLComponent& port)
+{
+    if (!serverInfo.length()) {
+        // No server info, host name is empty.
+        hostname = URLComponent();
+        port = URLComponent();
+        return;
+    }
+
+    // If the host starts with a left-bracket, assume the entire host is an
+    // IPv6 literal. Otherwise, assume none of the host is an IPv6 literal.
+    // This assumption will be overridden if we find a right-bracket.
+    //
+    // Our IPv6 address canonicalization code requires both brackets to exist,
+    // but the ability to locate an incomplete address can still be useful.
+    int ipv6Terminator = spec[serverInfo.begin()] == '[' ? serverInfo.end() : -1;
+    int colon = -1;
+
+    // Find the last right-bracket, and the last colon.
+    for (int i = serverInfo.begin(); i < serverInfo.end(); ++i) {
+        switch (spec[i]) {
+        case ']':
+            ipv6Terminator = i;
+            break;
+        case ':':
+            colon = i;
+            break;
+        }
+    }
+
+    if (colon > ipv6Terminator) {
+        // Found a port number: <hostname>:<port>
+        hostname = URLComponent::fromRange(serverInfo.begin(), colon);
+        if (!hostname.length())
+            hostname.reset();
+        port = URLComponent::fromRange(colon + 1, serverInfo.end());
+    } else {
+        // No port: <hostname>
+        hostname = serverInfo;
+        port = URLComponent();
+    }
+}
+
+// Given an already-identified auth section, breaks it into its consituent
+// parts. The port number will be parsed and the resulting integer will be
+// filled into the given *port variable, or -1 if there is no port number or it
+// is invalid.
+template<typename CharacterType>
+void doParseAuthority(const CharacterType* spec, const URLComponent& authority, URLComponent& username, URLComponent& password, URLComponent& hostname, URLComponent& port)
+{
+    ASSERT_WITH_MESSAGE(authority.isValid(), "We should always get an authority");
+    if (!authority.length()) {
+        username = URLComponent();
+        password = URLComponent();
+        hostname = URLComponent();
+        port = URLComponent();
+        return;
+    }
+
+    // Search backwards for @, which is the separator between the user info and
+    // the server info.
+    int i = authority.end() - 1;
+    while (i > authority.begin() && spec[i] != '@')
+        --i;
+
+    if (spec[i] == '@') {
+        // Found user info: <user-info>@<server-info>
+        parseUserInfo(spec, URLComponent(authority.begin(), i - authority.begin()), username, password);
+        parseServerInfo(spec, URLComponent::fromRange(i + 1, authority.end()), hostname, port);
+    } else {
+        // No user info, everything is server info.
+        username = URLComponent();
+        password = URLComponent();
+        parseServerInfo(spec, authority, hostname, port);
+    }
+}
+
+template<typename CharacterType>
+void parsePath(const CharacterType* spec, const URLComponent& hierarchicalidentifiers, URLComponent& resourcePath, URLComponent& query, URLComponent& fragment)
+{
+    // path = [/]<segment1>/<segment2>/<...>/<segmentN>;<param>?<query>#<ref>
+
+    // Special case when there is no path.
+    if (hierarchicalidentifiers.length() == -1) {
+        resourcePath = URLComponent();
+        query = URLComponent();
+        fragment = URLComponent();
+        return;
+    }
+    ASSERT_WITH_MESSAGE(hierarchicalidentifiers.length() > 0, "We should never have 0 length paths");
+
+    // Search for first occurrence of either ? or #.
+    int pathEnd = hierarchicalidentifiers.end();
+
+    int querySeparator = -1; // Index of the '?'
+    int fragmentSeparator = -1; // Index of the '#'
+    for (int i = hierarchicalidentifiers.begin(); i < pathEnd; ++i) {
+        switch (spec[i]) {
+        case '?':
+            // Only match the query string if it precedes the reference fragment
+            // and when we haven't found one already.
+            if (fragmentSeparator < 0 && querySeparator < 0)
+                querySeparator = i;
+            break;
+        case '#':
+            // Record the first # sign only.
+            if (fragmentSeparator < 0)
+                fragmentSeparator = i;
+            break;
+        }
+    }
+
+    // Markers pointing to the character after each of these corresponding
+    // components. The code below words from the end back to the beginning,
+    // and will update these indices as it finds components that exist.
+    int resourcePathEnd = -1;
+    int queryEnd = -1;
+
+    // Ref fragment: from the # to the end of the path.
+    if (fragmentSeparator >= 0) {
+        resourcePathEnd = queryEnd = fragmentSeparator;
+        fragment = URLComponent::fromRange(fragmentSeparator + 1, pathEnd);
+    } else {
+        resourcePathEnd = queryEnd = pathEnd;
+        fragment = URLComponent();
+    }
+
+    // Query fragment: everything from the ? to the next boundary (either the end
+    // of the path or the ref fragment).
+    if (querySeparator >= 0) {
+        resourcePathEnd = querySeparator;
+        query = URLComponent::fromRange(querySeparator + 1, queryEnd);
+    } else
+        query = URLComponent();
+
+    // File path: treat an empty file path as no file path.
+    if (resourcePathEnd != hierarchicalidentifiers.begin())
+        resourcePath = URLComponent::fromRange(hierarchicalidentifiers.begin(), resourcePathEnd);
+    else
+        resourcePath = URLComponent();
+}
+
+template<typename CharacterType>
+bool doExtractScheme(const CharacterType* url, int urlLength, URLComponent& scheme)
+{
+    // Skip leading whitespace and control characters.
+    int begin = 0;
+    while (begin < urlLength && shouldTrimFromURL(url[begin]))
+        ++begin;
+
+    if (begin == urlLength)
+        return false; // Input is empty or all whitespace.
+
+    // Find the first colon character.
+    for (int i = begin; i < urlLength; ++i) {
+        if (url[i] == ':') {
+            scheme = URLComponent::fromRange(begin, i);
+            return true;
+        }
+    }
+    return false; // No colon found: no scheme
+}
+
+// Fills in all members of the Parsed structure except for the scheme.
+//
+// |spec| is the full spec being parsed, of length |specLength|.
+// |afterScheme| is the character immediately following the scheme (after the
+//   colon) where we'll begin parsing.
+//
+// Compatability data points. I list "host", "path" extracted:
+// Input                IE6             Firefox                Us
+// -----                --------------  --------------         --------------
+// http://foo.com/      "foo.com", "/"  "foo.com", "/"         "foo.com", "/"
+// http:foo.com/        "foo.com", "/"  "foo.com", "/"         "foo.com", "/"
+// http:/foo.com/       fail(*)         "foo.com", "/"         "foo.com", "/"
+// http:\foo.com/       fail(*)         "\foo.com", "/"(fail)  "foo.com", "/"
+// http:////foo.com/    "foo.com", "/"  "foo.com", "/"         "foo.com", "/"
+//
+// (*) Interestingly, although IE fails to load these URLs, its history
+// canonicalizer handles them, meaning if you've been to the corresponding
+// "http://foo.com/" link, it will be colored.
+template <typename CharacterType>
+void doParseAfterScheme(const CharacterType* spec, int specLength, int afterScheme, URLSegments& parsed)
+{
+    int slashesCount = countConsecutiveSlashes(spec, afterScheme, specLength);
+    int afterSlashes = afterScheme + slashesCount;
+
+    // First split into two main parts, the authority (username, password, host,
+    // and port) and the full path (path, query, and reference).
+    URLComponent authority;
+    URLComponent fullPath;
+
+    // Found "//<some data>", looks like an authority section. Treat everything
+    // from there to the next slash (or end of spec) to be the authority. Note
+    // that we ignore the number of slashes and treat it as the authority.
+    int endAuth = findNextAuthorityTerminator(spec, afterSlashes, specLength);
+    authority = URLComponent::fromRange(afterSlashes, endAuth);
+
+    if (endAuth == specLength) // No beginning of path found.
+        fullPath = URLComponent();
+    else // Everything starting from the slash to the end is the path.
+        fullPath = URLComponent::fromRange(endAuth, specLength);
+
+    // Now parse those two sub-parts.
+    doParseAuthority(spec, authority, parsed.username, parsed.password, parsed.host, parsed.port);
+    parsePath(spec, fullPath, parsed.path, parsed.query, parsed.fragment);
+}
+
+// The main parsing function for standard URLs. Standard URLs have a scheme,
+// host, path, etc.
+template<typename CharacterType>
+void doParseStandardURL(const CharacterType* spec, int specLength, URLSegments& parsed)
+{
+    ASSERT(specLength >= 0);
+
+    // Strip leading & trailing spaces and control characters.
+    int begin = 0;
+    trimURL(spec, begin, specLength);
+
+    int afterScheme = -1;
+    if (doExtractScheme(spec, specLength, parsed.scheme))
+        afterScheme = parsed.scheme.end() + 1; // Skip past the colon.
+    else {
+        // Say there's no scheme when there is no colon. We could also say that
+        // everything is the scheme. Both would produce an invalid URL, but this way
+        // seems less wrong in more cases.
+        parsed.scheme.reset();
+        afterScheme = begin;
+    }
+    doParseAfterScheme(spec, specLength, afterScheme, parsed);
+}
+
+template<typename CharacterType>
+void doParseFileSystemURL(const CharacterType* spec, int specLength, URLSegments& parsed)
+{
+    ASSERT(specLength >= 0);
+
+    // Get the unused parts of the URL out of the way.
+    parsed.username.reset();
+    parsed.password.reset();
+    parsed.host.reset();
+    parsed.port.reset();
+    parsed.path.reset(); // May use this; reset for convenience.
+    parsed.fragment.reset(); // May use this; reset for convenience.
+    parsed.query.reset(); // May use this; reset for convenience.
+    parsed.clearInnerURLSegments(); // May use this; reset for convenience.
+
+    // Strip leading & trailing spaces and control characters.
+    int begin = 0;
+    trimURL(spec, begin, specLength);
+
+    // Handle empty specs or ones that contain only whitespace or control chars.
+    if (begin == specLength) {
+        parsed.scheme.reset();
+        return;
+    }
+
+    int innerStart = -1;
+
+    // Extract the scheme. We also handle the case where there is no scheme.
+    if (doExtractScheme(&spec[begin], specLength - begin, parsed.scheme)) {
+        // Offset the results since we gave ExtractScheme a substring.
+        parsed.scheme.moveBy(begin);
+
+        if (parsed.scheme.end() == specLength - 1)
+            return;
+
+        innerStart = parsed.scheme.end() + 1;
+    } else {
+        // No scheme found; that's not valid for filesystem URLs.
+        parsed.scheme.reset();
+        return;
+    }
+
+    URLComponent innerScheme;
+    const CharacterType* innerSpec = &spec[innerStart];
+    int innerSpecLength = specLength - innerStart;
+
+    if (doExtractScheme(innerSpec, innerSpecLength, innerScheme)) {
+        // Offset the results since we gave ExtractScheme a substring.
+        innerScheme.moveBy(innerStart);
+
+        if (innerScheme.end() == specLength - 1)
+            return;
+    } else {
+        // No scheme found; that's not valid for filesystem URLs.
+        // The best we can do is return "filesystem://".
+        return;
+    }
+
+    URLSegments innerParsed;
+    if (URLUtilities::CompareSchemeComponent(spec, innerScheme, URLUtilities::kFileScheme)) {
+        // File URLs are special.
+        ParseFileURL(innerSpec, innerSpecLength, &innerParsed);
+    } else if (URLUtilities::CompareSchemeComponent(spec, innerScheme, URLUtilities::kFileSystemScheme)) {
+        // Filesystem URLs don't nest.
+        return;
+    } else if (URLUtilities::isStandard(spec, innerScheme)) {
+        // All "normal" URLs.
+        doParseStandardURL(innerSpec, innerSpecLength, innerParsed);
+    } else
+        return;
+
+    // All members of innerParsed need to be offset by innerStart.
+    // If we had any scheme that supported nesting more than one level deep,
+    // we'd have to recurse into the innerParsed's innerParsed when
+    // adjusting by innerStart.
+    innerParsed.moveFromComponentBy(URLSegments::Scheme, innerStart);
+
+    // Query and ref move from innerParsed to parsed.
+    parsed.query = innerParsed.query;
+    innerParsed.query.reset();
+    parsed.fragment = innerParsed.fragment;
+    innerParsed.fragment.reset();
+
+    parsed.setInnerURLSegments(innerParsed);
+    if (!innerParsed.scheme.isValid() || !innerParsed.path.isValid() || innerParsed.innerURLSegments())
+        return;
+
+    // The path in innerParsed should start with a slash, then have a filesystem
+    // type followed by a slash. From the first slash up to but excluding the
+    // second should be what it keeps; the rest goes to parsed. If the path ends
+    // before the second slash, it's still pretty clear what the user meant, so
+    // we'll let that through.
+    if (!isURLSlash(spec[innerParsed.path.begin()]))
+        return;
+
+    int innerPathEnd = innerParsed.path.begin() + 1; // skip the leading slash
+    while (innerPathEnd < specLength && !isURLSlash(spec[innerPathEnd]))
+        ++innerPathEnd;
+    parsed.path.setBegin(innerPathEnd);
+    int newInnerPathLength = innerPathEnd - innerParsed.path.begin();
+    parsed.path.setLength(innerParsed.path.length() - newInnerPathLength);
+    innerParsed.path.setLength(newInnerPathLength);
+    parsed.setInnerURLSegments(innerParsed);
+}
+
+// Initializes a path URL which is merely a scheme followed by a path. Examples
+// include "about:foo" and "javascript:alert('bar');"
+template<typename CharacterType>
+void doParsePathURL(const CharacterType* spec, int specLength, URLSegments& parsed)
+{
+    // Get the non-path and non-scheme parts of the URL out of the way, we never
+    // use them.
+    parsed.username.reset();
+    parsed.password.reset();
+    parsed.host.reset();
+    parsed.port.reset();
+    parsed.query.reset();
+    parsed.fragment.reset();
+
+    // Strip leading & trailing spaces and control characters.
+    int begin = 0;
+    trimURL(spec, begin, specLength);
+
+    // Handle empty specs or ones that contain only whitespace or control chars.
+    if (begin == specLength) {
+        parsed.scheme.reset();
+        parsed.path.reset();
+        return;
+    }
+
+    // Extract the scheme, with the path being everything following. We also
+    // handle the case where there is no scheme.
+    if (ExtractScheme(&spec[begin], specLength - begin, &parsed.scheme)) {
+        // Offset the results since we gave ExtractScheme a substring.
+        parsed.scheme.moveBy(begin);
+
+        // For compatability with the standard URL parser, we treat no path as
+        // -1, rather than having a length of 0 (we normally wouldn't care so
+        // much for these non-standard URLs).
+        if (parsed.scheme.end() == specLength - 1)
+            parsed.path.reset();
+        else
+            parsed.path = URLComponent::fromRange(parsed.scheme.end() + 1, specLength);
+    } else {
+        // No scheme found, just path.
+        parsed.scheme.reset();
+        parsed.path = URLComponent::fromRange(begin, specLength);
+    }
+}
+
+template<typename CharacterType>
+void doParseMailtoURL(const CharacterType* spec, int specLength, URLSegments& parsed)
+{
+    ASSERT(specLength >= 0);
+
+    // Get the non-path and non-scheme parts of the URL out of the way, we never
+    // use them.
+    parsed.username.reset();
+    parsed.password.reset();
+    parsed.host.reset();
+    parsed.port.reset();
+    parsed.fragment.reset();
+    parsed.query.reset(); // May use this; reset for convenience.
+
+    // Strip leading & trailing spaces and control characters.
+    int begin = 0;
+    trimURL(spec, begin, specLength);
+
+    // Handle empty specs or ones that contain only whitespace or control chars.
+    if (begin == specLength) {
+        parsed.scheme.reset();
+        parsed.path.reset();
+        return;
+    }
+
+    int pathBegin = -1;
+    int pathEnd = -1;
+
+    // Extract the scheme, with the path being everything following. We also
+    // handle the case where there is no scheme.
+    if (ExtractScheme(&spec[begin], specLength - begin, &parsed.scheme)) {
+        // Offset the results since we gave ExtractScheme a substring.
+        parsed.scheme.moveBy(begin);
+
+        if (parsed.scheme.end() != specLength - 1) {
+            pathBegin = parsed.scheme.end() + 1;
+            pathEnd = specLength;
+        }
+    } else {
+        // No scheme found, just path.
+        parsed.scheme.reset();
+        pathBegin = begin;
+        pathEnd = specLength;
+    }
+
+    // Split [pathBegin, pathEnd) into a path + query.
+    for (int i = pathBegin; i < pathEnd; ++i) {
+        if (spec[i] == '?') {
+            parsed.query = URLComponent::fromRange(i + 1, pathEnd);
+            pathEnd = i;
+            break;
+        }
+    }
+
+    // For compatability with the standard URL parser, treat no path as
+    // -1, rather than having a length of 0
+    if (pathBegin == pathEnd)
+        parsed.path.reset();
+    else
+        parsed.path = URLComponent::fromRange(pathBegin, pathEnd);
+}
+
+// Converts a port number in a string to an integer. We'd like to just call
+// sscanf but our input is not null-terminated, which sscanf requires. Instead,
+// we copy the digits to a small stack buffer (since we know the maximum number
+// of digits in a valid port number) that we can null terminate.
+template<typename CharacterType>
+int doParsePort(const CharacterType* spec, const URLComponent& component)
+{
+    // Easy success case when there is no port.
+    const int kMaxDigits = 5;
+    if (!component.isNonEmpty())
+        return PORT_UNSPECIFIED;
+
+    // Skip over any leading 0s.
+    URLComponent digitComponent(component.end(), 0);
+    for (int i = 0; i < component.length(); i++) {
+        if (spec[component.begin() + i] != '0') {
+            digitComponent = URLComponent::fromRange(component.begin() + i, component.end());
+            break;
+        }
+    }
+    if (!digitComponent.length())
+        return 0; // All digits were 0.
+
+    // Verify we don't have too many digits (we'll be copying to our buffer so
+    // we need to double-check).
+    if (digitComponent.length() > kMaxDigits)
+        return PORT_INVALID;
+
+    // Copy valid digits to the buffer.
+    char digits[kMaxDigits + 1]; // +1 for null terminator
+    for (int i = 0; i < digitComponent.length(); i++) {
+        CharacterType ch = spec[digitComponent.begin() + i];
+        if (!isASCIIDigit(ch)) {
+            // Invalid port digit, fail.
+            return PORT_INVALID;
+        }
+        digits[i] = static_cast<char>(ch);
+    }
+
+    // Null-terminate the string and convert to integer. Since we guarantee
+    // only digits, atoi's lack of error handling is OK.
+    digits[digitComponent.length()] = 0;
+    int port = atoi(digits);
+    if (port > 65535)
+        return PORT_INVALID; // Out of range.
+    return port;
+}
+
+template<typename CharacterType>
+void doExtractFileName(const CharacterType* spec, const URLComponent& path, URLComponent& fileName)
+{
+    // Handle empty paths: they have no file names.
+    if (!path.isNonEmpty()) {
+        fileName = URLComponent();
+        return;
+    }
+
+    // Search backwards for a parameter, which is a normally unused field in a
+    // URL delimited by a semicolon. We parse the parameter as part of the
+    // path, but here, we don't want to count it. The last semicolon is the
+    // parameter. The path should start with a slash, so we don't need to check
+    // the first one.
+    int fileEnd = path.end();
+    for (int i = path.end() - 1; i > path.begin(); --i) {
+        if (spec[i] == ';') {
+            fileEnd = i;
+            break;
+        }
+    }
+
+    // Now search backwards from the filename end to the previous slash
+    // to find the beginning of the filename.
+    for (int i = fileEnd - 1; i >= path.begin(); --i) {
+        if (isURLSlash(spec[i])) {
+            // File name is everything following this character to the end
+            fileName = URLComponent::fromRange(i + 1, fileEnd);
+            return;
+        }
+    }
+
+    // No slash found, this means the input was degenerate (generally paths
+    // will start with a slash). Let's call everything the file name.
+    fileName = URLComponent::fromRange(path.begin(), fileEnd);
+    return;
+}
+
+template<typename CharacterType>
+bool doExtractQueryKeyValue(const CharacterType* spec, URLComponent& query, URLComponent& key, URLComponent& value)
+{
+    if (!query.isNonEmpty())
+        return false;
+
+    int start = query.begin();
+    int current = start;
+    int end = query.end();
+
+    // We assume the beginning of the input is the beginning of the "key" and we
+    // skip to the end of it.
+    key.setBegin(current);
+    while (current < end && spec[current] != '&' && spec[current] != '=')
+        ++current;
+    key.setLength(current - key.begin());
+
+    // Skip the separator after the key (if any).
+    if (current < end && spec[current] == '=')
+        ++current;
+
+    // Find the value part.
+    value.setBegin(current);
+    while (current < end && spec[current] != '&')
+        ++current;
+    value.setLength(current - value.begin());
+
+    // Finally skip the next separator if any
+    if (current < end && spec[current] == '&')
+        ++current;
+
+    // Save the new query
+    query = URLComponent::fromRange(current, end);
+    return true;
+}
+
+} // namespace
+
+bool ExtractScheme(const char* url, int urlLength, URLComponent* scheme)
+{
+    return doExtractScheme(url, urlLength, *scheme);
+}
+
+bool ExtractScheme(const UChar* url, int urlLength, URLComponent* scheme)
+{
+    return doExtractScheme(url, urlLength, *scheme);
+}
+
+// This handles everything that may be an authority terminator, including
+// backslash. For special backslash handling see DoParseAfterScheme.
+bool IsAuthorityTerminator(UChar character)
+{
+    return isURLSlash(character) || character == '?' || character == '#';
+}
+
+void ExtractFileName(const char* url, const URLComponent& path, URLComponent* fileName)
+{
+    doExtractFileName(url, path, *fileName);
+}
+
+void ExtractFileName(const UChar* url, const URLComponent& path, URLComponent* fileName)
+{
+    doExtractFileName(url, path, *fileName);
+}
+
+bool ExtractQueryKeyValue(const char* url, URLComponent* query, URLComponent* key, URLComponent* value)
+{
+    return doExtractQueryKeyValue(url, *query, *key, *value);
+}
+
+bool ExtractQueryKeyValue(const UChar* url, URLComponent* query, URLComponent* key,  URLComponent* value)
+{
+    return doExtractQueryKeyValue(url, *query, *key, *value);
+}
+
+void ParseAuthority(const char* spec, const URLComponent& auth, URLComponent* username, URLComponent* password, URLComponent* hostname, URLComponent* portNumber)
+{
+    doParseAuthority(spec, auth, *username, *password, *hostname, *portNumber);
+}
+
+void ParseAuthority(const UChar* spec, const URLComponent& auth, URLComponent* username, URLComponent* password, URLComponent* hostname, URLComponent* portNumber)
+{
+    doParseAuthority(spec, auth, *username, *password, *hostname, *portNumber);
+}
+
+int ParsePort(const char* url, const URLComponent& port)
+{
+    return doParsePort(url, port);
+}
+
+int ParsePort(const UChar* url, const URLComponent& port)
+{
+    return doParsePort(url, port);
+}
+
+void ParseStandardURL(const char* url, int urlLength, URLSegments* parsed)
+{
+    doParseStandardURL(url, urlLength, *parsed);
+}
+
+void ParseStandardURL(const UChar* url, int urlLength, URLSegments* parsed)
+{
+    doParseStandardURL(url, urlLength, *parsed);
+}
+
+void ParsePathURL(const char* url, int urlLength, URLSegments* parsed)
+{
+    doParsePathURL(url, urlLength, *parsed);
+}
+
+void ParsePathURL(const UChar* url, int urlLength, URLSegments* parsed)
+{
+    doParsePathURL(url, urlLength, *parsed);
+}
+
+void ParseFileSystemURL(const char* url, int urlLength, URLSegments* parsed)
+{
+    doParseFileSystemURL(url, urlLength, *parsed);
+}
+
+void ParseFileSystemURL(const UChar* url, int urlLength, URLSegments* parsed)
+{
+    doParseFileSystemURL(url, urlLength, *parsed);
+}
+
+void ParseMailtoURL(const char* url, int urlLength, URLSegments* parsed)
+{
+    doParseMailtoURL(url, urlLength, *parsed);
+}
+
+void ParseMailtoURL(const UChar* url, int urlLength, URLSegments* parsed)
+{
+    doParseMailtoURL(url, urlLength, *parsed);
+}
+
+void parsePathInternal(const char* spec, const URLComponent& path, URLComponent* filepath, URLComponent* query, URLComponent* fragment)
+{
+    parsePath(spec, path, *filepath, *query, *fragment);
+}
+
+void parsePathInternal(const UChar* spec, const URLComponent& path, URLComponent* filepath, URLComponent* query, URLComponent* fragment)
+{
+    parsePath(spec, path, *filepath, *query, *fragment);
+}
+
+void parseAfterScheme(const char* spec, int specLength, int afterScheme, URLSegments& parsed)
+{
+    doParseAfterScheme(spec, specLength, afterScheme, parsed);
+}
+
+void parseAfterScheme(const UChar* spec, int specLength, int afterScheme, URLSegments& parsed)
+{
+    doParseAfterScheme(spec, specLength, afterScheme, parsed);
+}
+
+} // namespace URLParser
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLParse.h b/Source/WTF/wtf/url/src/URLParse.h
new file mode 100644
index 0000000..c97b10a
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLParse.h
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 URLParse_h
+#define URLParse_h
+
+#include "URLComponent.h"
+#include "URLSegments.h"
+#include <wtf/unicode/Unicode.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLParser {
+
+// Initialization functions ---------------------------------------------------
+//
+// These functions parse the given URL, filling in all of the structure's
+// components. These functions can not fail, they will always do their best
+// at interpreting the input given.
+//
+// The string length of the URL MUST be specified, we do not check for NULLs
+// at any point in the process, and will actually handle embedded NULLs.
+//
+// IMPORTANT: These functions do NOT hang on to the given pointer or copy it
+// in any way. See the comment above the struct.
+//
+// The 8-bit versions require UTF-8 encoding.
+
+// StandardURL is for when the scheme is known to be one that has an
+// authority (host) like "http". This function will not handle weird ones
+// like "about:" and "javascript:", or do the right thing for "file:" URLs.
+void ParseStandardURL(const char* url, int urlLength, URLSegments* parsed);
+void ParseStandardURL(const UChar* url, int urlLength, URLSegments* parsed);
+
+// PathURL is for when the scheme is known not to have an authority (host)
+// section but that aren't file URLs either. The scheme is parsed, and
+// everything after the scheme is considered as the path. This is used for
+// things like "about:" and "javascript:"
+void ParsePathURL(const char* url, int urlLength, URLSegments* parsed);
+void ParsePathURL(const UChar* url, int urlLength, URLSegments* parsed);
+
+// FileURL is for file URLs. There are some special rules for interpreting
+// these.
+void ParseFileURL(const char* url, int urlLength, URLSegments* parsed);
+void ParseFileURL(const UChar* url, int urlLength, URLSegments* parsed);
+
+// Filesystem URLs are structured differently than other URLs.
+void ParseFileSystemURL(const char* url, int urlLength, URLSegments* parsed);
+void ParseFileSystemURL(const UChar* url, int urlLength, URLSegments* parsed);
+
+// MailtoURL is for mailto: urls. They are made up scheme,path,query
+void ParseMailtoURL(const char* url, int urlLength, URLSegments* parsed);
+void ParseMailtoURL(const UChar* url, int urlLength, URLSegments* parsed);
+
+// Helper functions -----------------------------------------------------------
+
+// Locates the scheme according to the URL  parser's rules. This function is
+// designed so the caller can find the scheme and call the correct Init*
+// function according to their known scheme types.
+//
+// It also does not perform any validation on the scheme.
+//
+// This function will return true if the scheme is found and will put the
+// scheme's range into *scheme. False means no scheme could be found. Note
+// that a URL beginning with a colon has a scheme, but it is empty, so this
+// function will return true but *scheme will = (0,0).
+//
+// The scheme is found by skipping spaces and control characters at the
+// beginning, and taking everything from there to the first colon to be the
+// scheme. The character at scheme.end() will be the colon (we may enhance
+// this to handle full width colons or something, so don't count on the
+// actual character value). The character at scheme.end()+1 will be the
+// beginning of the rest of the URL, be it the authority or the path (or the
+// end of the string).
+//
+// The 8-bit version requires UTF-8 encoding.
+bool ExtractScheme(const char* url, int urlLength, URLComponent* scheme);
+bool ExtractScheme(const UChar* url, int urlLength, URLComponent* scheme);
+
+// Returns true if ch is a character that terminates the authority segment of a URL.
+bool IsAuthorityTerminator(UChar);
+
+// Does a best effort parse of input |spec|, in range |auth|. If a particular
+// component is not found, it will be set to invalid.
+void ParseAuthority(const char* spec, const URLComponent& auth,
+                    URLComponent* username, URLComponent* password, URLComponent* hostname, URLComponent* portNumber);
+void ParseAuthority(const UChar* spec, const URLComponent& auth,
+                    URLComponent* username, URLComponent* password, URLComponent* hostname, URLComponent* portNumber);
+
+// Computes the integer port value from the given port component. The port
+// component should have been identified by one of the init functions on
+// |Parsed| for the given input url.
+//
+// The return value will be a positive integer between 0 and 64K, or one of
+// the two special values below.
+enum SpecialPort { PORT_UNSPECIFIED = -1, PORT_INVALID = -2 };
+int ParsePort(const char* url, const URLComponent& port);
+int ParsePort(const UChar* url, const URLComponent& port);
+
+// Extracts the range of the file name in the given url. The path must
+// already have been computed by the parse function, and the matching URL
+// and extracted path are provided to this function. The filename is
+// defined as being everything from the last slash/backslash of the path
+// to the end of the path.
+//
+// The file name will be empty if the path is empty or there is nothing
+// following the last slash.
+//
+// The 8-bit version requires UTF-8 encoding.
+void ExtractFileName(const char* url, const URLComponent& path, URLComponent* fileName);
+void ExtractFileName(const UChar* url, const URLComponent& path, URLComponent* fileName);
+
+// Extract the first key/value from the range defined by |*query|. Updates
+// |*query| to start at the end of the extracted key/value pair. This is
+// designed for use in a loop: you can keep calling it with the same query
+// object and it will iterate over all items in the query.
+//
+// Some key/value pairs may have the key, the value, or both be empty (for
+// example, the query string "?&"). These will be returned. Note that an empty
+// last parameter "foo.com?" or foo.com?a&" will not be returned, this case
+// is the same as "done."
+//
+// The initial query component should not include the '?' (this is the default
+// for parsed URLs).
+//
+// If no key/value are found |*key| and |*value| will be unchanged and it will
+// return false.
+bool ExtractQueryKeyValue(const char* url, URLComponent* query, URLComponent* key, URLComponent* value);
+bool ExtractQueryKeyValue(const UChar* url, URLComponent* query, URLComponent* key, URLComponent* value);
+
+} // namespace URLParser
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // URLParse_h
diff --git a/Source/WTF/wtf/url/src/URLParseFile.cpp b/Source/WTF/wtf/url/src/URLParseFile.cpp
new file mode 100644
index 0000000..9118219
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLParseFile.cpp
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 "URLParse.h"
+
+#include "URLFile.h"
+#include "URLParseInternal.h"
+
+// Interesting IE file:isms...
+//
+//  INPUT                      OUTPUT
+//  =========================  ==============================
+//  file:/foo/bar              file:///foo/bar
+//      The result here seems totally invalid!?!? This isn't UNC.
+//
+//  file:/
+//  file:// or any other number of slashes
+//      IE6 doesn't do anything at all if you click on this link. No error:
+//      nothing. IE6's history system seems to always color this link, so I'm
+//      guessing that it maps internally to the empty URL.
+//
+//  C:\                        file:///C:/
+//      When on a file: URL source page, this link will work. When over HTTP,
+//      the file: URL will appear in the status bar but the link will not work
+//      (security restriction for all file URLs).
+//
+//  file:foo/                  file:foo/     (invalid?!?!?)
+//  file:/foo/                 file:///foo/  (invalid?!?!?)
+//  file://foo/                file://foo/   (UNC to server "foo")
+//  file:///foo/               file:///foo/  (invalid, seems to be a file)
+//  file:////foo/              file://foo/   (UNC to server "foo")
+//      Any more than four slashes is also treated as UNC.
+//
+//  file:C:/                   file://C:/
+//  file:/C:/                  file://C:/
+//      The number of slashes after "file:" don't matter if the thing following
+//      it looks like an absolute drive path. Also, slashes and backslashes are
+//      equally valid here.
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLParser {
+
+namespace {
+
+// A subcomponent of DoInitFileURL, the input of this function should be a UNC
+// path name, with the index of the first character after the slashes following
+// the scheme given in |afterSlashes|. This will initialize the host, path,
+// query, and ref, and leave the other output components untouched
+// (DoInitFileURL handles these for us).
+template<typename CharacterType>
+void doParseUNC(const CharacterType* spec, int afterSlashes, int specLength, URLSegments& parsed)
+{
+    int nextSlash = findNextSlash(spec, afterSlashes, specLength);
+    if (nextSlash == specLength) {
+        // No additional slash found, as in "file://foo", treat the text as the
+        // host with no path (this will end up being UNC to server "foo").
+        int hostLength = specLength - afterSlashes;
+        if (hostLength)
+            parsed.host = URLComponent(afterSlashes, hostLength);
+        else
+            parsed.host.reset();
+        parsed.path.reset();
+        return;
+    }
+
+#if OS(WINDOWS)
+    // See if we have something that looks like a path following the first
+    // component. As in "file://localhost/c:/", we get "c:/" out. We want to
+    // treat this as a having no host but the path given. Works on Windows only.
+    if (doesBeginWindowsDriveSpec(spec, nextSlash + 1, specLength)) {
+        parsed.host.reset();
+        parsePathInternal(spec, MakeRange(nextSlash, specLength),
+                          &parsed.path, &parsed.query, &parsed.ref);
+        return;
+    }
+#endif
+
+    // Otherwise, everything up until that first slash we found is the host name,
+    // which will end up being the UNC host. For example "file://foo/bar.txt"
+    // will get a server name of "foo" and a path of "/bar". Later, on Windows,
+    // this should be treated as the filename "\\foo\bar.txt" in proper UNC
+    // notation.
+    int hostLength = nextSlash - afterSlashes;
+    if (hostLength)
+        parsed.host = URLComponent::fromRange(afterSlashes, nextSlash);
+    else
+        parsed.host.reset();
+    if (nextSlash < specLength) {
+        parsePathInternal(spec, URLComponent::fromRange(nextSlash, specLength),
+                          &parsed.path, &parsed.query, &parsed.fragment);
+    } else
+        parsed.path.reset();
+}
+
+// A subcomponent of DoParseFileURL, the input should be a local file, with the
+// beginning of the path indicated by the index in |pathBegin|. This will
+// initialize the host, path, query, and ref, and leave the other output
+// components untouched (DoInitFileURL handles these for us).
+template<typename CharacterType>
+void doParseLocalFile(const CharacterType* spec, int pathBegin, int specLength, URLSegments& parsed)
+{
+    parsed.host.reset();
+    parsePathInternal(spec, URLComponent::fromRange(pathBegin, specLength),
+                      &parsed.path, &parsed.query, &parsed.fragment);
+}
+
+// Backend for the external functions that operates on either char type.
+// We are handed the character after the "file:" at the beginning of the spec.
+// Usually this is a slash, but needn't be; we allow paths like "file:c:\foo".
+template<typename CharacterType>
+void doParseFileURL(const CharacterType* spec, int specLength, URLSegments& parsed)
+{
+    ASSERT(specLength >= 0);
+
+    // Get the parts we never use for file URLs out of the way.
+    parsed.username.reset();
+    parsed.password.reset();
+    parsed.port.reset();
+
+    // Many of the code paths don't set these, so it's convenient to just clear
+    // them. We'll write them in those cases we need them.
+    parsed.query.reset();
+    parsed.fragment.reset();
+
+    // Strip leading & trailing spaces and control characters.
+    int begin = 0;
+    trimURL(spec, begin, specLength);
+
+    // Find the scheme.
+    int numSlashes;
+    int afterScheme;
+    int afterSlashes;
+#if OS(WINDOWS)
+    // See how many slashes there are. We want to handle cases like UNC but also
+    // "/c:/foo". This is when there is no scheme, so we can allow pages to do
+    // links like "c:/foo/bar" or "//foo/bar". This is also called by the
+    // relative URL resolver when it determines there is an absolute URL, which
+    // may give us input like "/c:/foo".
+    numSlashes = countConsecutiveSlashes(spec, begin, specLength);
+    afterSlashes = begin + numSlashes;
+    if (doesBeginWindowsDriveSpec(spec, afterSlashes, specLength)) {
+        // Windows path, don't try to extract the scheme (for example, "c:\foo").
+        parsed.scheme.reset();
+        afterScheme = afterSlashes;
+    } else if (doesBeginUNCPath(spec, begin, specLength, false)) {
+        // Windows UNC path: don't try to extract the scheme, but keep the slashes.
+        parsed.scheme.reset();
+        afterScheme = begin;
+    } else
+#endif
+    {
+        if (ExtractScheme(&spec[begin], specLength - begin, &parsed.scheme)) {
+            // Offset the results since we gave ExtractScheme a substring.
+            parsed.scheme.moveBy(begin);
+            afterScheme = parsed.scheme.end() + 1;
+        } else {
+            // No scheme found, remember that.
+            parsed.scheme.reset();
+            afterScheme = begin;
+        }
+    }
+
+    // Handle empty specs ones that contain only whitespace or control chars,
+    // or that are just the scheme (for example "file:").
+    if (afterScheme == specLength) {
+        parsed.host.reset();
+        parsed.path.reset();
+        return;
+    }
+
+    numSlashes = countConsecutiveSlashes(spec, afterScheme, specLength);
+
+    afterSlashes = afterScheme + numSlashes;
+#if OS(WINDOWS)
+    // Check whether the input is a drive again. We checked above for windows
+    // drive specs, but that's only at the very beginning to see if we have a
+    // scheme at all. This test will be duplicated in that case, but will
+    // additionally handle all cases with a real scheme such as "file:///C:/".
+    if (!doesBeginWindowsDriveSpec(spec, afterSlashes, specLength) &&  numSlashes != 3) {
+        // Anything not beginning with a drive spec ("c:\") on Windows is treated
+        // as UNC, with the exception of three slashes which always means a file.
+        // Even IE7 treats file:///foo/bar as "/foo/bar", which then fails.
+        doParseUNC(spec, afterSlashes, specLength, parsed);
+        return;
+    }
+#else
+    // file: URL with exactly 2 slashes is considered to have a host component.
+    if (numSlashes == 2) {
+        doParseUNC(spec, afterSlashes, specLength, parsed);
+        return;
+    }
+#endif // OS(WINDOWS)
+
+    // Easy and common case, the full path immediately follows the scheme
+    // (modulo slashes), as in "file://c:/foo". Just treat everything from
+    // there to the end as the path. Empty hosts have 0 length instead of -1.
+    // We include the last slash as part of the path if there is one.
+    doParseLocalFile(spec,
+                     numSlashes > 0 ? afterScheme + numSlashes - 1 : afterScheme,
+                     specLength, parsed);
+}
+
+} // namespace
+
+void ParseFileURL(const char* url, int urlLength, URLSegments* parsed)
+{
+    doParseFileURL(url, urlLength, *parsed);
+}
+
+void ParseFileURL(const UChar* url, int urlLength, URLSegments* parsed)
+{
+    doParseFileURL(url, urlLength, *parsed);
+}
+
+} // namespace URLParser
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLParseInternal.h b/Source/WTF/wtf/url/src/URLParseInternal.h
new file mode 100644
index 0000000..de27aed
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLParseInternal.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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.
+ */
+
+// Contains common inline helper functions used by the URL parsing routines.
+
+#ifndef URLParseInternal_h
+#define URLParseInternal_h
+
+#include "URLParse.h"
+#include <wtf/unicode/Unicode.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLParser {
+
+// We treat slashes and backslashes the same for IE compatability.
+inline bool isURLSlash(UChar ch)
+{
+    return ch == '/' || ch == '\\';
+}
+
+// Returns true if we should trim this character from the URL because it is a
+// space or a control character.
+inline bool shouldTrimFromURL(UChar ch)
+{
+    return ch <= ' ';
+}
+
+// Given an already-initialized begin index and length, this shrinks the range
+// to eliminate "should-be-trimmed" characters. Note that the length does *not*
+// indicate the length of untrimmed data from |*begin|, but rather the position
+// in the input string (so the string starts at character |*begin| in the spec,
+// and goes until |*len|).
+template<typename CharacterType>
+inline void trimURL(const CharacterType* spec, int& begin, int& length)
+{
+    // Strip leading whitespace and control characters.
+    while (begin < length && shouldTrimFromURL(spec[begin]))
+        ++begin;
+
+    // Strip trailing whitespace and control characters. We need the >i test for
+    // when the input string is all blanks; we don't want to back past the input.
+    while (length > begin && shouldTrimFromURL(spec[length - 1]))
+        --length;
+}
+
+// Counts the number of consecutive slashes starting at the given offset
+// in the given string of the given length.
+template<typename CharacterType>
+inline int countConsecutiveSlashes(const CharacterType *str, int begin_offset, int strLength)
+{
+    int count = 0;
+    while (begin_offset + count < strLength && isURLSlash(str[begin_offset + count]))
+        ++count;
+    return count;
+}
+
+// Internal functions in URLParser.cc that parse the path, that is, everything
+// following the authority section. The input is the range of everything
+// following the authority section, and the output is the identified ranges.
+//
+// This is designed for the file URL parser or other consumers who may do
+// special stuff at the beginning, but want regular path parsing, it just
+// maps to the internal parsing function for paths.
+void parsePathInternal(const char* spec,
+                       const URLComponent& path,
+                       URLComponent* filepath,
+                       URLComponent* query,
+                       URLComponent* fragment);
+void parsePathInternal(const UChar* spec,
+                       const URLComponent& path,
+                       URLComponent* filepath,
+                       URLComponent* query,
+                       URLComponent* fragment);
+
+
+// Given a spec and a pointer to the character after the colon following the
+// scheme, this parses it and fills in the structure, Every item in the parsed
+// structure is filled EXCEPT for the scheme, which is untouched.
+void parseAfterScheme(const char* spec, int specLength, int afterScheme, URLSegments& parsed);
+void parseAfterScheme(const UChar* spec, int specLength, int afterScheme, URLSegments& parsed);
+
+} // namespace URLParser
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // URLParseInternal_h
diff --git a/Source/WTF/wtf/url/src/URLSegments.cpp b/Source/WTF/wtf/url/src/URLSegments.cpp
new file mode 100644
index 0000000..14c95be
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLSegments.cpp
@@ -0,0 +1,138 @@
+/* Based on nsURLParsers.cc from Mozilla
+ * -------------------------------------
+ * Copyright (C) 1998 Netscape Communications Corporation.
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Other contributors:
+ *   Darin Fisher (original author)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#include "config.h"
+#include "URLSegments.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+int URLSegments::length() const
+{
+    if (fragment.isValid())
+        return fragment.end();
+    return charactersBefore(Fragment, DelimiterExcluded);
+}
+
+int URLSegments::charactersBefore(ComponentType type, DelimiterInclusion includeDelimiter) const
+{
+    if (type == Scheme)
+        return scheme.begin();
+
+    int current = 0;
+    if (scheme.isValid())
+        current = scheme.end() + 1; // Advance over the ':' at the end of the scheme.
+
+    if (username.isValid()) {
+        if (type <= Username)
+            return username.begin();
+        current = username.end() + 1; // Advance over the '@' or ':' at the end.
+    }
+
+    if (password.isValid()) {
+        if (type <= Password)
+            return password.begin();
+        current = password.end() + 1; // Advance over the '@' at the end.
+    }
+
+    if (host.isValid()) {
+        if (type <= Host)
+            return host.begin();
+        current = host.end();
+    }
+
+    if (port.isValid()) {
+        if (type < Port || (type == Port && includeDelimiter == DelimiterIncluded))
+            return port.begin() - 1; // Back over delimiter.
+        if (type == Port)
+            return port.begin(); // Don't want delimiter counted.
+        current = port.end();
+    }
+
+    if (path.isValid()) {
+        if (type <= Path)
+            return path.begin();
+        current = path.end();
+    }
+
+    if (query.isValid()) {
+        if (type < Query || (type == Query && includeDelimiter == DelimiterIncluded))
+            return query.begin() - 1; // Back over delimiter.
+        if (type == Query)
+            return query.begin(); // Don't want delimiter counted.
+        current = query.end();
+    }
+
+    if (fragment.isValid()) {
+        if (type == Fragment && includeDelimiter == DelimiterExcluded)
+            return fragment.begin(); // Back over delimiter.
+
+        // When there is a fragment and we get here, the component we wanted was before
+        // this and not found, so we always know the beginning of the fragment is right.
+        return fragment.begin() - 1; // Don't want delimiter counted.
+    }
+
+    return current;
+}
+
+void URLSegments::moveFromComponentBy(ComponentType type, int offset)
+{
+    switch (type) {
+    // Fall through.
+    case Scheme:
+        scheme.moveBy(offset);
+    case Username:
+        username.moveBy(offset);
+    case Password:
+        password.moveBy(offset);
+    case Host:
+        host.moveBy(offset);
+    case Port:
+        port.moveBy(offset);
+    case Path:
+        path.moveBy(offset);
+    case Query:
+        query.moveBy(offset);
+    case Fragment:
+        fragment.moveBy(offset);
+    }
+}
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLSegments.h b/Source/WTF/wtf/url/src/URLSegments.h
new file mode 100644
index 0000000..971eec3
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLSegments.h
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 URLSegments_h
+#define URLSegments_h
+
+#include "URLComponent.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+class URLSegments;
+
+// A structure that holds the identified parts of an input URL. This structure
+// does NOT store the URL itself. The caller will have to store the URL text
+// and its corresponding Parsed structure separately.
+class URLSegments {
+public:
+    // Identifies different components.
+    enum ComponentType {
+        Scheme,
+        Username,
+        Password,
+        Host,
+        Port,
+        Path,
+        Query,
+        Fragment,
+    };
+    enum DelimiterInclusion {
+        DelimiterExcluded,
+        DelimiterIncluded
+    };
+
+    URLSegments() { }
+
+    URLSegments(const URLSegments& otherSegment)
+    {
+        *this = otherSegment;
+    }
+
+    URLSegments& operator=(const URLSegments& otherSegment)
+    {
+        scheme = otherSegment.scheme;
+        username = otherSegment.username;
+        password = otherSegment.password;
+        host = otherSegment.host;
+        port = otherSegment.port;
+        path = otherSegment.path;
+        query = otherSegment.query;
+        fragment = otherSegment.fragment;
+        if (otherSegment.m_innerURLSegments)
+            m_innerURLSegments = adoptPtr(new URLSegments(*otherSegment.m_innerURLSegments));
+            return *this;
+    }
+
+    // Returns the length of the URL (the end of the last component).
+    //
+    // Note that for some invalid, non-canonical URLs, this may not be the length
+    // of the string. For example "http://": the parsed structure will only
+    // contain an entry for the four-character scheme, and it doesn't know about
+    // the "://". For all other last-components, it will return the real length.
+    int length() const;
+
+    // Returns the number of characters before the given component if it exists,
+    // or where the component would be if it did exist. This will return the
+    // string length if the component would be appended to the end.
+    //
+    // Note that this can get a little funny for the port, query, and fragment
+    // components which have a delimiter that is not counted as part of the
+    // component. The |includeDelimiter| flag controls if you want this counted
+    // as part of the component or not when the component exists.
+    //
+    // This example shows the difference between the two flags for two of these
+    // delimited components that is present (the port and query) and one that
+    // isn't (the reference). The components that this flag affects are marked
+    // with a *.
+    //                 0         1         2
+    //                 012345678901234567890
+    // Example input: http://foo:80/?query
+    //              include_delim=true,  ...=false  ("<-" indicates different)
+    //      Scheme: 0                    0
+    //    Username: 5                    5
+    //    Password: 5                    5
+    //        Host: 7                    7
+    //       *Port: 10                   11 <-
+    //        Path: 13                   13
+    //      *Query: 14                   15 <-
+    //        *Fragment: 20                   20
+    //
+    int charactersBefore(ComponentType, DelimiterInclusion) const;
+
+    // Shift all the components from 'firstComponent' to the last component by 'offset'.
+    void moveFromComponentBy(ComponentType firstComponent, int offset);
+
+    // Each component excludes the related delimiters and has a length of -1
+    // if that component is absent but 0 if the component exists but is empty.
+    URLComponent scheme;
+    URLComponent username;
+    URLComponent password;
+    URLComponent host;
+    URLComponent port;
+    URLComponent path;
+    URLComponent query;
+    URLComponent fragment;
+
+    // FIXME: this is a damn ugly API and is basically untested.
+    const URLSegments* innerURLSegments() const { return m_innerURLSegments.get(); }
+    void setInnerURLSegments(const URLSegments& urlSegments) { m_innerURLSegments = adoptPtr(new URLSegments(urlSegments)); }
+    void clearInnerURLSegments() { return m_innerURLSegments.clear(); }
+
+private:
+    // The Filesystem API describe a URL format with an internal URL. E.g.: filesystem:http://www.apple.com/
+    // The inner URL segment contains the parsed inner URL of a filesystem: URL.
+    OwnPtr<URLSegments> m_innerURLSegments;
+};
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // URLSegments_h
diff --git a/Source/WTF/wtf/url/src/URLUtil.cpp b/Source/WTF/wtf/url/src/URLUtil.cpp
new file mode 100644
index 0000000..4a429a1
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLUtil.cpp
@@ -0,0 +1,473 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 "URLUtil.h"
+
+#include "RawURLBuffer.h"
+#include "URLCanonInternal.h"
+#include "URLFile.h"
+#include "URLUtilInternal.h"
+#include <wtf/ASCIICType.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLUtilities {
+
+const char kFileScheme[] = "file";
+const char kFileSystemScheme[] = "filesystem";
+const char kMailtoScheme[] = "mailto";
+
+namespace {
+
+template<typename Iter>
+static bool lowerCaseEqualsASCII(Iter aBegin, Iter aEnd, const char* b)
+{
+    for (Iter it = aBegin; it != aEnd; ++it, ++b) {
+        if (!*b || toASCIILower(*it) != *b)
+            return false;
+    }
+    return !(*b);
+}
+
+const int kNumStandardURLSchemes = 8;
+const char* kStandardURLSchemes[kNumStandardURLSchemes] = {
+    "http",
+    "https",
+    kFileScheme, // Yes, file urls can have a hostname!
+    "ftp",
+    "gopher",
+    "ws", // WebSocket.
+    "wss", // WebSocket secure.
+    kFileSystemScheme
+};
+
+// Given a string and a range inside the string, compares it to the given
+// lower-case |compareTo| buffer.
+template<typename CharacterType>
+inline bool doCompareSchemeComponent(const CharacterType* spec, const URLComponent& component, const char* compareTo)
+{
+    if (!component.isNonEmpty())
+        return !compareTo[0]; // When component is empty, match empty scheme.
+    return lowerCaseEqualsASCII(&spec[component.begin()], &spec[component.end()], compareTo);
+}
+
+// Returns true if the given scheme identified by |scheme| within |spec| is one
+// of the registered "standard" schemes.
+template<typename CharacterType>
+bool doIsStandard(const CharacterType* spec, const URLComponent& scheme)
+{
+    if (!scheme.isNonEmpty())
+        return false; // Empty or invalid schemes are non-standard.
+
+    for (size_t i = 0; i < kNumStandardURLSchemes; ++i) {
+        if (lowerCaseEqualsASCII(&spec[scheme.begin()], &spec[scheme.end()], kStandardURLSchemes[i]))
+            return true;
+    }
+    return false;
+}
+
+template<typename CharacterType>
+bool doFindAndCompareScheme(const CharacterType* str, int strLength, const char* compare, URLComponent* foundScheme)
+{
+    // Before extracting scheme, canonicalize the URL to remove any whitespace.
+    // This matches the canonicalization done in doCanonicalize function.
+    RawURLBuffer<CharacterType> whitespaceBuffer;
+    int specLength;
+    const CharacterType* spec = URLCanonicalizer::removeURLWhitespace(str, strLength, whitespaceBuffer, specLength);
+
+    URLComponent ourScheme;
+    if (!URLParser::ExtractScheme(spec, specLength, &ourScheme)) {
+        // No scheme.
+        if (foundScheme)
+            *foundScheme = URLComponent();
+        return false;
+    }
+    if (foundScheme)
+        *foundScheme = ourScheme;
+    return doCompareSchemeComponent(spec, ourScheme, compare);
+}
+
+template<typename CharacterType>
+bool doCanonicalize(const CharacterType* inSpec, int inSpecLength,
+                    URLQueryCharsetConverter* charsetConverter,
+                    URLBuffer<char>& output, URLSegments& ouputParsed)
+{
+    // Remove any whitespace from the middle of the relative URL, possibly
+    // copying to the new buffer.
+    RawURLBuffer<CharacterType> whitespaceBuffer;
+    int specLength;
+    const CharacterType* spec = URLCanonicalizer::removeURLWhitespace(inSpec, inSpecLength, whitespaceBuffer, specLength);
+
+    URLSegments parsedInput;
+#if OS(WINDOWS)
+    // For Windows, we allow things that look like absolute Windows paths to be
+    // fixed up magically to file URLs. This is done for IE compatability. For
+    // example, this will change "c:/foo" into a file URL rather than treating
+    // it as a URL with the protocol "c". It also works for UNC ("\\foo\bar.txt").
+    // There is similar logic in URLCanonicalizer_relative.cc for
+    //
+    // For Max & Unix, we don't do this (the equivalent would be "/foo/bar" which
+    // has no meaning as an absolute path name. This is because browsers on Mac
+    // & Unix don't generally do this, so there is no compatibility reason for
+    // doing so.
+    if (URLParser::doesBeginUNCPath(spec, 0, specLength, false)
+        || URLParser::doesBeginWindowsDriveSpec(spec, 0, specLength)) {
+        URLParser::ParseFileURL(spec, specLength, &parsedInput);
+        return URLCanonicalizer::CanonicalizeFileURL(spec, specLength, parsedInput,
+                                                     charsetConverter,
+                                                     output, *ouputParsed);
+    }
+#endif
+
+    URLComponent scheme;
+    if (!URLParser::ExtractScheme(spec, specLength, &scheme))
+        return false;
+
+    // This is the parsed version of the input URL, we have to canonicalize it
+    // before storing it in our object.
+    bool success;
+    if (doCompareSchemeComponent(spec, scheme, kFileScheme)) {
+        // File URLs are special.
+        URLParser::ParseFileURL(spec, specLength, &parsedInput);
+        success = URLCanonicalizer::CanonicalizeFileURL(spec, specLength, parsedInput,
+                                                        charsetConverter, output,
+                                                        &ouputParsed);
+    } else if (doCompareSchemeComponent(spec, scheme, kFileSystemScheme)) {
+        // Filesystem URLs are special.
+        URLParser::ParseFileSystemURL(spec, specLength, &parsedInput);
+        success = URLCanonicalizer::canonicalizeFileSystemURL(spec, parsedInput,
+                                                              charsetConverter,
+                                                              output, ouputParsed);
+
+    } else if (doIsStandard(spec, scheme)) {
+        // All "normal" URLs.
+        URLParser::ParseStandardURL(spec, specLength, &parsedInput);
+        success = URLCanonicalizer::CanonicalizeStandardURL(spec, specLength, parsedInput,
+                                                            charsetConverter,
+                                                            output, &ouputParsed);
+
+    } else if (doCompareSchemeComponent(spec, scheme, kMailtoScheme)) {
+        // Mailto are treated like a standard url with only a scheme, path, query
+        URLParser::ParseMailtoURL(spec, specLength, &parsedInput);
+        success = URLCanonicalizer::canonicalizeMailtoURL(spec, parsedInput, output, ouputParsed);
+
+    } else {
+        // "Weird" URLs like data: and javascript:
+        URLParser::ParsePathURL(spec, specLength, &parsedInput);
+        success = URLCanonicalizer::canonicalizePathURL(spec, parsedInput, output, ouputParsed);
+    }
+    return success;
+}
+
+template<typename CharacterType>
+bool doResolveRelative(const char* baseSpec, const URLSegments& baseParsed,
+                       const CharacterType* inRelative, int inRelativeLength,
+                       URLQueryCharsetConverter* charsetConverter,
+                       URLBuffer<char>& output, URLSegments* ouputParsed)
+{
+    // Remove any whitespace from the middle of the relative URL, possibly
+    // copying to the new buffer.
+    RawURLBuffer<CharacterType> whitespaceBuffer;
+    int relativeLength;
+    const CharacterType* relative = URLCanonicalizer::removeURLWhitespace(inRelative, inRelativeLength, whitespaceBuffer, relativeLength);
+
+    // See if our base URL should be treated as "standard".
+    bool standardBaseScheme = baseParsed.scheme.isNonEmpty() && doIsStandard(baseSpec, baseParsed.scheme);
+
+    bool isRelative;
+    URLComponent relativeComponent;
+    if (!URLCanonicalizer::isRelativeURL(baseSpec, baseParsed,
+                                         relative, relativeLength,
+                                         standardBaseScheme,
+                                         isRelative, relativeComponent))
+        return false; // Error resolving.
+
+    if (isRelative) {
+        // Relative, resolve and canonicalize.
+        bool fileBaseScheme = baseParsed.scheme.isNonEmpty() && doCompareSchemeComponent(baseSpec, baseParsed.scheme, kFileScheme);
+        return URLCanonicalizer::resolveRelativeURL(baseSpec, baseParsed,
+                                                    fileBaseScheme, relative,
+                                                    relativeComponent, charsetConverter,
+                                                    output, ouputParsed);
+    }
+
+    // Not relative, canonicalize the input.
+    return doCanonicalize(relative, relativeLength, charsetConverter, output, *ouputParsed);
+}
+
+template<typename CharacterType>
+bool doReplaceComponents(const char* spec,
+                         int specLength,
+                         const URLSegments& parsed,
+                         const URLCanonicalizer::Replacements<CharacterType>& replacements,
+                         URLQueryCharsetConverter* charsetConverter,
+                         URLBuffer<char>& output,
+                         URLSegments& outputParsed)
+{
+    // If the scheme is overridden, just do a simple string substitution and
+    // reparse the whole thing. There are lots of edge cases that we really don't
+    // want to deal with. Like what happens if I replace "http://e:8080/foo"
+    // with a file. Does it become "file:///E:/8080/foo" where the port number
+    // becomes part of the path? Parsing that string as a file URL says "yes"
+    // but almost no sane rule for dealing with the components individually would
+    // come up with that.
+    //
+    // Why allow these crazy cases at all? Programatically, there is almost no
+    // case for replacing the scheme. The most common case for hitting this is
+    // in JS when building up a URL using the location object. In this case, the
+    // JS code expects the string substitution behavior:
+    //   http://www.w3.org/TR/2008/WD-html5-20080610/structured.html#common3
+    if (replacements.IsSchemeOverridden()) {
+        // Canonicalize the new scheme so it is 8-bit and can be concatenated with
+        // the existing spec.
+        RawURLBuffer<char, 128> scheme_replaced;
+        URLComponent schemeReplacedParsed;
+        URLCanonicalizer::canonicalizeScheme(replacements.sources().scheme,
+                                             replacements.components().scheme,
+                                             scheme_replaced, schemeReplacedParsed);
+
+        // We can assume that the input is canonicalized, which means it always has
+        // a colon after the scheme (or where the scheme would be).
+        int specAfterColon = parsed.scheme.isValid() ? parsed.scheme.end() + 1
+        : 1;
+        if (specLength - specAfterColon > 0) {
+            scheme_replaced.append(&spec[specAfterColon],
+                                   specLength - specAfterColon);
+        }
+
+        // We now need to completely re-parse the resulting string since its meaning
+        // may have changed with the different scheme.
+        RawURLBuffer<char, 128> recanonicalized;
+        URLSegments recanonicalizedParsed;
+        doCanonicalize(scheme_replaced.data(), scheme_replaced.length(),
+                       charsetConverter,
+                       recanonicalized, recanonicalizedParsed);
+
+        // Recurse using the version with the scheme already replaced. This will now
+        // use the replacement rules for the new scheme.
+        //
+        // Warning: this code assumes that ReplaceComponents will re-check all
+        // components for validity. This is because we can't fail if DoCanonicalize
+        // failed above since theoretically the thing making it fail could be
+        // getting replaced here. If ReplaceComponents didn't re-check everything,
+        // we wouldn't know if something *not* getting replaced is a problem.
+        // If the scheme-specific replacers are made more intelligent so they don't
+        // re-check everything, we should instead recanonicalize the whole thing
+        // after this call to check validity (this assumes replacing the scheme is
+        // much much less common than other types of replacements, like clearing the
+        // ref).
+        URLCanonicalizer::Replacements<CharacterType> replacementsNoScheme = replacements;
+        replacementsNoScheme.SetScheme(0, URLComponent());
+        return doReplaceComponents(recanonicalized.data(), recanonicalized.length(),
+                                   recanonicalizedParsed, replacementsNoScheme,
+                                   charsetConverter, output, outputParsed);
+    }
+
+    // If we get here, then we know the scheme doesn't need to be replaced, so can
+    // just key off the scheme in the spec to know how to do the replacements.
+    if (doCompareSchemeComponent(spec, parsed.scheme, kFileScheme)) {
+        return URLCanonicalizer::ReplaceFileURL(spec, parsed, replacements,
+                                                charsetConverter, output, &outputParsed);
+    }
+    if (doCompareSchemeComponent(spec, parsed.scheme, kFileSystemScheme)) {
+        return URLCanonicalizer::ReplaceFileSystemURL(spec, parsed, replacements,
+                                                      charsetConverter, output,
+                                                      &outputParsed);
+    }
+    if (doIsStandard(spec, parsed.scheme)) {
+        return URLCanonicalizer::ReplaceStandardURL(spec, parsed, replacements,
+                                                    charsetConverter, output, &outputParsed);
+    }
+    if (doCompareSchemeComponent(spec, parsed.scheme, kMailtoScheme))
+        return URLCanonicalizer::replaceMailtoURL(spec, parsed, replacements, output, outputParsed);
+
+    // Default is a path URL.
+    return URLCanonicalizer::ReplacePathURL(spec, parsed, replacements, output, &outputParsed);
+}
+
+} // namespace
+
+bool isStandard(const LChar* spec, const URLComponent& scheme)
+{
+    return doIsStandard(spec, scheme);
+}
+
+bool isStandard(const UChar* spec, const URLComponent& scheme)
+{
+    return doIsStandard(spec, scheme);
+}
+
+bool FindAndCompareScheme(const char* str, int strLength, const char* compare, URLComponent* foundScheme)
+{
+    return doFindAndCompareScheme(str, strLength, compare, foundScheme);
+}
+
+bool FindAndCompareScheme(const UChar* str, int strLength, const char* compare, URLComponent* foundScheme)
+{
+    return doFindAndCompareScheme(str, strLength, compare, foundScheme);
+}
+
+bool canonicalize(const char* spec, int specLength,
+                  URLQueryCharsetConverter* charsetConverter,
+                  URLBuffer<char>& output, URLSegments& ouputParsed)
+{
+    return doCanonicalize(spec, specLength, charsetConverter, output, ouputParsed);
+}
+
+bool canonicalize(const UChar* spec, int specLength,
+                  URLQueryCharsetConverter* charsetConverter,
+                  URLBuffer<char>& output, URLSegments& ouputParsed)
+{
+    return doCanonicalize(spec, specLength, charsetConverter, output, ouputParsed);
+}
+
+bool resolveRelative(const char* baseSpec, const URLSegments& baseParsed,
+                     const char* relative, int relativeLength,
+                     URLQueryCharsetConverter* charsetConverter,
+                     URLBuffer<char>& output, URLSegments* ouputParsed)
+{
+    return doResolveRelative(baseSpec, baseParsed,
+                             relative, relativeLength,
+                             charsetConverter, output, ouputParsed);
+}
+
+bool resolveRelative(const char* baseSpec, const URLSegments& baseParsed,
+                     const UChar* relative, int relativeLength,
+                     URLQueryCharsetConverter* charsetConverter,
+                     URLBuffer<char>& output, URLSegments* ouputParsed)
+{
+    return doResolveRelative(baseSpec, baseParsed,
+                             relative, relativeLength,
+                             charsetConverter, output, ouputParsed);
+}
+
+bool ReplaceComponents(const char* spec,
+                       int specLength,
+                       const URLSegments& parsed,
+                       const URLCanonicalizer::Replacements<char>& replacements,
+                       URLQueryCharsetConverter* charsetConverter,
+                       URLBuffer<char>& output,
+                       URLSegments* outputParsed)
+{
+    return doReplaceComponents(spec, specLength, parsed, replacements,
+                               charsetConverter, output, *outputParsed);
+}
+
+bool ReplaceComponents(const char* spec,
+                       int specLength,
+                       const URLSegments& parsed,
+                       const URLCanonicalizer::Replacements<UChar>& replacements,
+                       URLQueryCharsetConverter* charsetConverter,
+                       URLBuffer<char>& output,
+                       URLSegments* outputParsed)
+{
+    return doReplaceComponents(spec, specLength, parsed, replacements,
+                               charsetConverter, output, *outputParsed);
+}
+
+void DecodeURLEscapeSequences(const char* input, int length, URLBuffer<UChar>& output)
+{
+    RawURLBuffer<char> unescapedChars;
+    for (int i = 0; i < length; ++i) {
+        if (input[i] == '%') {
+            unsigned char ch;
+            if (URLCanonicalizer::DecodeEscaped(input, &i, length, &ch))
+                unescapedChars.append(ch);
+            else {
+                // Invalid escape sequence, copy the percent literal.
+                unescapedChars.append('%');
+            }
+        } else {
+            // Regular non-escaped 8-bit character.
+            unescapedChars.append(input[i]);
+        }
+    }
+
+    // Convert that 8-bit to UTF-16. It's not clear IE does this at all to
+    // JavaScript URLs, but Firefox and Safari do.
+    for (int i = 0; i < unescapedChars.length(); i++) {
+        unsigned char uch = static_cast<unsigned char>(unescapedChars.at(i));
+        if (uch < 0x80) {
+            // Non-UTF-8, just append directly
+            output.append(uch);
+        } else {
+            // next_ch will point to the last character of the decoded
+            // character.
+            int nextCharacter = i;
+            unsigned codePoint;
+            if (URLCanonicalizer::readUTFChar(unescapedChars.data(), &nextCharacter,
+                                              unescapedChars.length(), &codePoint)) {
+                // Valid UTF-8 character, convert to UTF-16.
+                URLCanonicalizer::AppendUTF16Value(codePoint, output);
+                i = nextCharacter;
+            } else {
+                // If there are any sequences that are not valid UTF-8, we keep
+                // invalid code points and promote to UTF-16. We copy all characters
+                // from the current position to the end of the identified sequence.
+                while (i < nextCharacter) {
+                    output.append(static_cast<unsigned char>(unescapedChars.at(i)));
+                    i++;
+                }
+                output.append(static_cast<unsigned char>(unescapedChars.at(i)));
+            }
+        }
+    }
+}
+
+void EncodeURIComponent(const char* input, int length, URLBuffer<char>& output)
+{
+    for (int i = 0; i < length; ++i) {
+        unsigned char c = static_cast<unsigned char>(input[i]);
+        if (URLCharacterTypes::isComponentChar(c))
+            output.append(c);
+        else
+            URLCanonicalizer::appendURLEscapedCharacter(c, output);
+    }
+}
+
+bool CompareSchemeComponent(const char* spec, const URLComponent& component, const char* compareTo)
+{
+    return doCompareSchemeComponent(spec, component, compareTo);
+}
+
+bool CompareSchemeComponent(const UChar* spec, const URLComponent& component, const char* compareTo)
+{
+    return doCompareSchemeComponent(spec, component, compareTo);
+}
+
+} // namespace URLUtilities
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
diff --git a/Source/WTF/wtf/url/src/URLUtil.h b/Source/WTF/wtf/url/src/URLUtil.h
new file mode 100644
index 0000000..e85a334
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLUtil.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2007 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 URLUtil_h
+#define URLUtil_h
+
+#include "URLBuffer.h"
+#include "URLCanon.h"
+#include "URLParse.h"
+#include <wtf/unicode/Unicode.h>
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+class URLQueryCharsetConverter;
+
+namespace URLUtilities {
+
+// Locates the scheme in the given string and places it into |foundScheme|,
+// which may be 0 to indicate the caller does not care about the range.
+//
+// Returns whether the given |compare| scheme matches the scheme found in the
+// input (if any). The |compare| scheme must be a valid canonical scheme or
+// the result of the comparison is undefined.
+bool FindAndCompareScheme(const char* str, int strLength, const char* compare, URLComponent* foundScheme);
+bool FindAndCompareScheme(const UChar* str, int strLength, const char* compare, URLComponent* foundScheme);
+
+// Returns true if the given string represents a standard URL. This means that
+// either the scheme is in the list of known standard schemes.
+bool isStandard(const LChar* spec, const URLComponent& scheme);
+bool isStandard(const UChar* spec, const URLComponent& scheme);
+inline bool isStandard(const char* spec, const URLComponent& scheme) { return isStandard(reinterpret_cast<const LChar*>(spec), scheme); }
+
+// URL library wrappers -------------------------------------------------------
+
+// Parses the given spec according to the extracted scheme type. Normal users
+// should use the URL object, although this may be useful if performance is
+// critical and you don't want to do the heap allocation for the std::string.
+//
+// As with the URLCanonicalizer::Canonicalize* functions, the charset converter can
+// be 0 to use UTF-8 (it will be faster in this case).
+//
+// Returns true if a valid URL was produced, false if not. On failure, the
+// output and parsed structures will still be filled and will be consistent,
+// but they will not represent a loadable URL.
+bool canonicalize(const char* spec, int specLength, URLQueryCharsetConverter*,
+                  URLBuffer<char>&, URLSegments& ouputParsed);
+bool canonicalize(const UChar* spec, int specLength, URLQueryCharsetConverter*,
+                  URLBuffer<char>&, URLSegments& ouputParsed);
+
+// Resolves a potentially relative URL relative to the given parsed base URL.
+// The base MUST be valid. The resulting canonical URL and parsed information
+// will be placed in to the given out variables.
+//
+// The relative need not be relative. If we discover that it's absolute, this
+// will produce a canonical version of that URL. See Canonicalize() for more
+// about the charsetConverter.
+//
+// Returns true if the output is valid, false if the input could not produce
+// a valid URL.
+bool resolveRelative(const char* baseSpec, const URLSegments& baseParsed,
+                     const char* relative, int relativeLength,
+                     URLQueryCharsetConverter*,
+                     URLBuffer<char>&, URLSegments* ouputParsed);
+bool resolveRelative(const char* baseSpec, const URLSegments& baseParsed,
+                     const UChar* relative, int relativeLength,
+                     URLQueryCharsetConverter*,
+                     URLBuffer<char>&, URLSegments* ouputParsed);
+
+// Replaces components in the given VALID input url. The new canonical URL info
+// is written to output and outputParsed.
+//
+// Returns true if the resulting URL is valid.
+bool ReplaceComponents(const char* spec, int specLength, const URLSegments& parsed,
+                       const URLCanonicalizer::Replacements<char>&,
+                       URLQueryCharsetConverter*,
+                       URLBuffer<char>&, URLSegments* outputParsed);
+bool ReplaceComponents(const char* spec, int specLength, const URLSegments& parsed,
+                       const URLCanonicalizer::Replacements<UChar>&,
+                       URLQueryCharsetConverter*,
+                       URLBuffer<char>&, URLSegments* outputParsed);
+
+// Unescapes the given string using URL escaping rules.
+void DecodeURLEscapeSequences(const char* input, int length, URLBuffer<UChar>&);
+
+// Escapes the given string as defined by the JS method encodeURIComponent.
+// See https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURIComponent
+void EncodeURIComponent(const char* input, int length, URLBuffer<char>&);
+
+
+} // namespace URLUtilities
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // URLUtil_h
diff --git a/Source/WTF/wtf/url/src/URLUtilInternal.h b/Source/WTF/wtf/url/src/URLUtilInternal.h
new file mode 100644
index 0000000..0840aec
--- /dev/null
+++ b/Source/WTF/wtf/url/src/URLUtilInternal.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2011 Google Inc. All rights reserved.
+ * Copyright 2012 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * 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 URLUtilInternal_h
+#define URLUtilInternal_h
+
+#include "URLParse.h"
+
+#if USE(WTFURL)
+
+namespace WTF {
+
+namespace URLUtilities {
+
+extern const char kFileScheme[];
+extern const char kFileSystemScheme[];
+extern const char kMailtoScheme[];
+
+// Given a string and a range inside the string, compares it to the given
+// lower-case |compareTo| buffer.
+bool CompareSchemeComponent(const char* spec, const URLComponent&, const char* compareTo);
+bool CompareSchemeComponent(const UChar* spec, const URLComponent&, const char* compareTo);
+
+} // namespace URLUtilities
+
+} // namespace WTF
+
+#endif // USE(WTFURL)
+
+#endif // URLUtilInternal_h
diff --git a/Source/WTF/wtf/win/MainThreadWin.cpp b/Source/WTF/wtf/win/MainThreadWin.cpp
new file mode 100644
index 0000000..ee3a273
--- /dev/null
+++ b/Source/WTF/wtf/win/MainThreadWin.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2007, 2008 Apple 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
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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 "config.h"
+#include "MainThread.h"
+
+#include "Assertions.h"
+#include "Threading.h"
+#if !OS(WINCE)
+#include <windows.h>
+#endif
+
+namespace WTF {
+
+static HWND threadingWindowHandle;
+static UINT threadingFiredMessage;
+const LPCWSTR kThreadingWindowClassName = L"ThreadingWindowClass";
+
+LRESULT CALLBACK ThreadingWindowWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    if (message == threadingFiredMessage)
+        dispatchFunctionsFromMainThread();
+    else
+        return DefWindowProc(hWnd, message, wParam, lParam);
+    return 0;
+}
+
+void initializeMainThreadPlatform()
+{
+    if (threadingWindowHandle)
+        return;
+
+    HWND hWndParent = 0;
+#if OS(WINCE)
+    WNDCLASS wcex;
+    memset(&wcex, 0, sizeof(WNDCLASS));
+#else
+    WNDCLASSEX wcex;
+    memset(&wcex, 0, sizeof(WNDCLASSEX));
+    wcex.cbSize = sizeof(WNDCLASSEX);
+#endif
+    wcex.lpfnWndProc    = ThreadingWindowWndProc;
+    wcex.lpszClassName  = kThreadingWindowClassName;
+#if OS(WINCE)
+    RegisterClass(&wcex);
+#else
+    RegisterClassEx(&wcex);
+    hWndParent = HWND_MESSAGE;
+#endif
+
+    threadingWindowHandle = CreateWindow(kThreadingWindowClassName, 0, 0,
+       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWndParent, 0, 0, 0);
+    threadingFiredMessage = RegisterWindowMessage(L"com.apple.WebKit.MainThreadFired");
+
+    initializeCurrentThreadInternal("Main Thread");
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+    ASSERT(threadingWindowHandle);
+    PostMessage(threadingWindowHandle, threadingFiredMessage, 0, 0);
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/win/OwnPtrWin.cpp b/Source/WTF/wtf/win/OwnPtrWin.cpp
new file mode 100644
index 0000000..67a32ff
--- /dev/null
+++ b/Source/WTF/wtf/win/OwnPtrWin.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Torch Mobile, Inc.
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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 "OwnPtr.h"
+
+#include <windows.h>
+
+namespace WTF {
+
+void deleteOwnedPtr(HBITMAP ptr)
+{
+    if (ptr)
+        DeleteObject(ptr);
+}
+
+void deleteOwnedPtr(HBRUSH ptr)
+{
+    if (ptr)
+        DeleteObject(ptr);
+}
+
+void deleteOwnedPtr(HDC ptr)
+{
+    if (ptr)
+        DeleteDC(ptr);
+}
+
+void deleteOwnedPtr(HFONT ptr)
+{
+    if (ptr)
+        DeleteObject(ptr);
+}
+
+void deleteOwnedPtr(HPALETTE ptr)
+{
+    if (ptr)
+        DeleteObject(ptr);
+}
+
+void deleteOwnedPtr(HPEN ptr)
+{
+    if (ptr)
+        DeleteObject(ptr);
+}
+
+void deleteOwnedPtr(HRGN ptr)
+{
+    if (ptr)
+        DeleteObject(ptr);
+}
+
+}
diff --git a/Source/WTF/wtf/wince/FastMallocWinCE.h b/Source/WTF/wtf/wince/FastMallocWinCE.h
new file mode 100644
index 0000000..3601249
--- /dev/null
+++ b/Source/WTF/wtf/wince/FastMallocWinCE.h
@@ -0,0 +1,175 @@
+/*
+ *  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 WTF_FastMallocWinCE_h
+#define WTF_FastMallocWinCE_h
+
+#include <new.h>
+
+#ifdef __cplusplus
+#include <new>
+#include <wtf/wince/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 // WTF_FastMallocWinCE_h
diff --git a/Source/WTF/wtf/wince/MemoryManager.cpp b/Source/WTF/wtf/wince/MemoryManager.cpp
new file mode 100644
index 0000000..81d4f80
--- /dev/null
+++ b/Source/WTF/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;
+}
+
+TryMallocReturnValue tryFastMalloc(size_t n)
+{
+    MemoryAllocationCanFail canFail;
+    return fastMalloc(n);
+}
+
+TryMallocReturnValue tryFastZeroedMalloc(size_t n)
+{
+    MemoryAllocationCanFail canFail;
+    return fastZeroedMalloc(n);
+}
+
+TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size)
+{
+    MemoryAllocationCanFail canFail;
+    return fastCalloc(n_elements, element_size);
+}
+
+TryMallocReturnValue 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/Source/WTF/wtf/wince/MemoryManager.h b/Source/WTF/wtf/wince/MemoryManager.h
new file mode 100644
index 0000000..f405612
--- /dev/null
+++ b/Source/WTF/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/Source/WTF/wtf/wx/MainThreadWx.cpp b/Source/WTF/wtf/wx/MainThreadWx.cpp
new file mode 100644
index 0000000..e1d15c9
--- /dev/null
+++ b/Source/WTF/wtf/wx/MainThreadWx.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier
+ *
+ * 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.  Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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 "config.h"
+#include "MainThread.h"
+
+#include <wx/defs.h>
+#include <wx/app.h>
+#include <wx/event.h>
+
+const wxEventType wxEVT_CALL_AFTER = wxNewEventType();
+
+class wxCallAfter : public wxEvtHandler
+{
+public:
+    wxCallAfter() 
+        : wxEvtHandler()
+        {
+            wxTheApp->Connect(-1, -1, wxEVT_CALL_AFTER, wxCommandEventHandler(wxCallAfter::OnCallback));
+            wxCommandEvent event(wxEVT_CALL_AFTER);
+            wxPostEvent(wxTheApp, event);
+        }
+        
+    void OnCallback(wxCommandEvent& event)
+    {
+        WTF::dispatchFunctionsFromMainThread();
+    }
+};
+
+namespace WTF {
+
+void initializeMainThreadPlatform()
+{
+}
+
+void scheduleDispatchFunctionsOnMainThread()
+{
+    wxCallAfter();
+}
+
+} // namespace WTF
diff --git a/Source/WTF/wtf/wx/StringWx.cpp b/Source/WTF/wtf/wx/StringWx.cpp
new file mode 100644
index 0000000..d5f6c57
--- /dev/null
+++ b/Source/WTF/wtf/wx/StringWx.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2007 Vaclav Slavik, Kevin Ollivier <kevino@theolliviers.com>
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. 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"
+
+// The wx headers must come first in this case, because the wtf/text headers
+// import windows.h, and we need to allow the wx headers to set its configuration
+// first.
+#include <wx/defs.h>
+#include <wx/string.h>
+
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+String::String(const wxString& wxstr)
+{
+#if !wxUSE_UNICODE
+    #error "This code only works in Unicode build of wxWidgets"
+#endif
+
+#if SIZEOF_WCHAR_T == 2
+
+    const UChar* str = wxstr.wc_str(); 
+    const size_t len = wxstr.length(); 
+
+#else // SIZEOF_WCHAR_T == 4
+
+    // NB: we can't simply use wxstr.mb_str(wxMBConvUTF16()) here because
+    //     the number of characters in UTF-16 encoding of the string may differ
+    //     from the number of UTF-32 values and we can't get the length from
+    //     returned buffer:
+
+#if defined(wxUSE_UNICODE_UTF8) && wxUSE_UNICODE_UTF8
+    // in wx3's UTF8 mode, wc_str() returns a buffer, not raw pointer
+    wxWCharBuffer wideString(wxstr.wc_str());
+#else
+    const wxChar *wideString = wxstr.wc_str();
+#endif
+    size_t wideLength = wxstr.length();
+
+    wxMBConvUTF16 conv;
+
+    const size_t utf16bufLen = conv.FromWChar(0, 0, wideString, wideLength); 
+    wxCharBuffer utf16buf(utf16bufLen); 
+
+    const UChar* str = (const UChar*)utf16buf.data(); 
+    size_t len = conv.FromWChar(utf16buf.data(), utf16bufLen, wideString, wideLength) / 2; 
+
+#endif // SIZEOF_WCHAR_T == 2
+
+    m_impl = StringImpl::create(str, len);
+
+}
+
+String::operator wxString() const
+{
+    return wxString(utf8().data(), wxConvUTF8);
+}
+
+} // namespace WTF