Move typed array implementations into wtf
https://bugs.webkit.org/show_bug.cgi?id=73248
Reviewed by Sam Weinig.
Source/JavaScriptCore:
Move typed array implementation files from WebCore to wtf. Inline the
.cpp files for each of the array views to cut down on unnecessary exports
and function call overhead for trivial operations.
Added files to all the project files.
* GNUmakefile.list.am:
* JavaScriptCore.exp:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/ArrayBuffer.cpp: Renamed from Source/WebCore/html/canvas/Float32Array.cpp.
(WTF::ArrayBuffer::transfer):
(WTF::ArrayBuffer::addView):
(WTF::ArrayBuffer::removeView):
* wtf/ArrayBuffer.h: Renamed from Source/WebCore/html/canvas/ArrayBuffer.cpp.
(WTF::ArrayBufferContents::ArrayBufferContents):
(WTF::ArrayBufferContents::data):
(WTF::ArrayBufferContents::sizeInBytes):
(WTF::ArrayBufferContents::transfer):
(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: Copied from Source/WebCore/bindings/js/JSArrayBufferCustom.cpp.
(WTF::ArrayBufferView::ArrayBufferView):
(WTF::ArrayBufferView::~ArrayBufferView):
(WTF::ArrayBufferView::neuter):
* wtf/ArrayBufferView.h: Renamed from Source/WebCore/html/canvas/ArrayBufferView.h.
(WTF::ArrayBufferView::isByteArray):
(WTF::ArrayBufferView::isUnsignedByteArray):
(WTF::ArrayBufferView::isShortArray):
(WTF::ArrayBufferView::isUnsignedShortArray):
(WTF::ArrayBufferView::isIntArray):
(WTF::ArrayBufferView::isUnsignedIntArray):
(WTF::ArrayBufferView::isFloatArray):
(WTF::ArrayBufferView::isDoubleArray):
(WTF::ArrayBufferView::isDataView):
(WTF::ArrayBufferView::buffer):
(WTF::ArrayBufferView::baseAddress):
(WTF::ArrayBufferView::byteOffset):
(WTF::ArrayBufferView::verifySubRange):
(WTF::ArrayBufferView::clampOffsetAndNumElements):
(WTF::ArrayBufferView::setImpl):
(WTF::ArrayBufferView::setRangeImpl):
(WTF::ArrayBufferView::zeroRangeImpl):
(WTF::ArrayBufferView::calculateOffsetAndLength):
* wtf/CMakeLists.txt:
* wtf/Float32Array.h: Renamed from Source/WebCore/html/canvas/Float32Array.h.
(WTF::Float32Array::set):
(WTF::Float32Array::item):
(WTF::Float32Array::isFloatArray):
(WTF::Float32Array::create):
(WTF::Float32Array::Float32Array):
(WTF::Float32Array::subarray):
* wtf/Float64Array.h: Renamed from Source/WebCore/html/canvas/Float64Array.h.
(WTF::Float64Array::set):
(WTF::Float64Array::item):
(WTF::Float64Array::isDoubleArray):
(WTF::Float64Array::create):
(WTF::Float64Array::Float64Array):
(WTF::Float64Array::subarray):
* wtf/Int16Array.h: Renamed from Source/WebCore/html/canvas/Int16Array.cpp.
(WTF::Int16Array::set):
(WTF::Int16Array::isShortArray):
(WTF::Int16Array::create):
(WTF::Int16Array::Int16Array):
(WTF::Int16Array::subarray):
* wtf/Int32Array.h: Renamed from Source/WebCore/html/canvas/Int32Array.cpp.
(WTF::Int32Array::set):
(WTF::Int32Array::isIntArray):
(WTF::Int32Array::create):
(WTF::Int32Array::Int32Array):
(WTF::Int32Array::subarray):
* wtf/Int8Array.h: Renamed from Source/WebCore/html/canvas/Int8Array.cpp.
(WTF::Int8Array::set):
(WTF::Int8Array::isByteArray):
(WTF::Int8Array::create):
(WTF::Int8Array::Int8Array):
(WTF::Int8Array::subarray):
* wtf/IntegralTypedArrayBase.h: Renamed from Source/WebCore/html/canvas/IntegralTypedArrayBase.h.
(WTF::IntegralTypedArrayBase::set):
(WTF::IntegralTypedArrayBase::item):
(WTF::IntegralTypedArrayBase::IntegralTypedArrayBase):
* wtf/TypedArrayBase.h: Renamed from Source/WebCore/html/canvas/TypedArrayBase.h.
(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/Uint16Array.h: Renamed from Source/WebCore/html/canvas/Uint16Array.cpp.
(WTF::Uint16Array::set):
(WTF::Uint16Array::isUnsignedShortArray):
(WTF::Uint16Array::create):
(WTF::Uint16Array::Uint16Array):
(WTF::Uint16Array::subarray):
* wtf/Uint32Array.h: Renamed from Source/WebCore/html/canvas/Uint32Array.cpp.
(WTF::Uint32Array::set):
(WTF::Uint32Array::isUnsignedIntArray):
(WTF::Uint32Array::create):
(WTF::Uint32Array::Uint32Array):
(WTF::Uint32Array::subarray):
* wtf/Uint8Array.h: Renamed from Source/WebCore/html/canvas/Uint8Array.h.
(WTF::Uint8Array::set):
(WTF::Uint8Array::isUnsignedByteArray):
(WTF::Uint8Array::create):
(WTF::Uint8Array::Uint8Array):
(WTF::Uint8Array::subarray):
* wtf/wtf.pro:
Source/WebCore:
Removed the typed array implementation files from WebCore and
added forwarding headers.
* CMakeLists.txt:
* ForwardingHeaders/wtf/ArrayBuffer.h: Added.
* ForwardingHeaders/wtf/ArrayBufferView.h: Added.
* ForwardingHeaders/wtf/Float32Array.h: Added.
* ForwardingHeaders/wtf/Float64Array.h: Added.
* ForwardingHeaders/wtf/Int16Array.h: Added.
* ForwardingHeaders/wtf/Int32Array.h: Added.
* ForwardingHeaders/wtf/Int8Array.h: Added.
* ForwardingHeaders/wtf/Uint16Array.h: Added.
* ForwardingHeaders/wtf/Uint32Array.h: Added.
* ForwardingHeaders/wtf/Uint8Array.h: Added.
* GNUmakefile.list.am:
* Target.pri:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSArrayBufferCustom.cpp:
* bindings/js/JSArrayBufferViewHelper.h:
* bindings/js/JSAudioContextCustom.cpp:
* bindings/js/JSFileReaderCustom.cpp:
* bindings/js/JSFloat32ArrayCustom.cpp:
* bindings/js/JSFloat64ArrayCustom.cpp:
* bindings/js/JSInt16ArrayCustom.cpp:
* bindings/js/JSInt32ArrayCustom.cpp:
* bindings/js/JSInt8ArrayCustom.cpp:
* bindings/js/JSUint16ArrayCustom.cpp:
* bindings/js/JSUint32ArrayCustom.cpp:
* bindings/js/JSUint8ArrayCustom.cpp:
* bindings/js/JSWaveShaperNodeCustom.cpp:
* bindings/js/JSWebGLRenderingContextCustom.cpp:
* bindings/js/JSXMLHttpRequestCustom.cpp:
* bindings/scripts/CodeGeneratorJS.pm:
(AddIncludesForType):
(GenerateHeader):
(NativeToJSValue):
* bindings/scripts/test/JS/JSFloat64Array.cpp:
* bindings/scripts/test/JS/JSFloat64Array.h:
* dom/MessageEvent.h:
* fileapi/FileReader.cpp:
* fileapi/FileReaderLoader.cpp:
* fileapi/FileReaderSync.cpp:
* fileapi/WebKitBlobBuilder.cpp:
* html/HTMLMediaElement.cpp:
* html/canvas/ArrayBuffer.h: Removed.
* html/canvas/ArrayBufferView.cpp: Removed.
* html/canvas/DataView.h:
* html/canvas/Float64Array.cpp: Removed.
* html/canvas/Int16Array.h: Removed.
* html/canvas/Int32Array.h: Removed.
* html/canvas/Int8Array.h: Removed.
* html/canvas/Uint16Array.h: Removed.
* html/canvas/Uint32Array.h: Removed.
* html/canvas/Uint8Array.cpp: Removed.
* html/canvas/WebGLBuffer.cpp:
* html/canvas/WebGLBuffer.h:
* html/canvas/WebGLGetInfo.cpp:
* html/canvas/WebGLGetInfo.h:
* html/canvas/WebGLRenderingContext.cpp:
* html/canvas/WebGLRenderingContext.h:
* page/Crypto.cpp:
* platform/graphics/GraphicsContext3D.cpp:
* platform/graphics/mac/GraphicsContext3DMac.mm:
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
* webaudio/AsyncAudioDecoder.cpp:
* webaudio/AudioBuffer.h:
* webaudio/AudioContext.cpp:
* webaudio/AudioParam.h:
* webaudio/AudioParamTimeline.h:
* webaudio/JavaScriptAudioNode.cpp:
* webaudio/RealtimeAnalyser.cpp:
* webaudio/WaveShaperProcessor.h:
* websockets/WebSocketChannel.cpp:
* websockets/WorkerThreadableWebSocketChannel.cpp:
* xml/XMLHttpRequest.cpp:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@101295 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 120faff..08c522a 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,130 @@
+2011-11-28 Oliver Hunt <oliver@apple.com>
+
+ Move typed array implementations into wtf
+ https://bugs.webkit.org/show_bug.cgi?id=73248
+
+ Reviewed by Sam Weinig.
+
+ Move typed array implementation files from WebCore to wtf. Inline the
+ .cpp files for each of the array views to cut down on unnecessary exports
+ and function call overhead for trivial operations.
+
+ Added files to all the project files.
+
+ * GNUmakefile.list.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/ArrayBuffer.cpp: Renamed from Source/WebCore/html/canvas/Float32Array.cpp.
+ (WTF::ArrayBuffer::transfer):
+ (WTF::ArrayBuffer::addView):
+ (WTF::ArrayBuffer::removeView):
+ * wtf/ArrayBuffer.h: Renamed from Source/WebCore/html/canvas/ArrayBuffer.cpp.
+ (WTF::ArrayBufferContents::ArrayBufferContents):
+ (WTF::ArrayBufferContents::data):
+ (WTF::ArrayBufferContents::sizeInBytes):
+ (WTF::ArrayBufferContents::transfer):
+ (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: Copied from Source/WebCore/bindings/js/JSArrayBufferCustom.cpp.
+ (WTF::ArrayBufferView::ArrayBufferView):
+ (WTF::ArrayBufferView::~ArrayBufferView):
+ (WTF::ArrayBufferView::neuter):
+ * wtf/ArrayBufferView.h: Renamed from Source/WebCore/html/canvas/ArrayBufferView.h.
+ (WTF::ArrayBufferView::isByteArray):
+ (WTF::ArrayBufferView::isUnsignedByteArray):
+ (WTF::ArrayBufferView::isShortArray):
+ (WTF::ArrayBufferView::isUnsignedShortArray):
+ (WTF::ArrayBufferView::isIntArray):
+ (WTF::ArrayBufferView::isUnsignedIntArray):
+ (WTF::ArrayBufferView::isFloatArray):
+ (WTF::ArrayBufferView::isDoubleArray):
+ (WTF::ArrayBufferView::isDataView):
+ (WTF::ArrayBufferView::buffer):
+ (WTF::ArrayBufferView::baseAddress):
+ (WTF::ArrayBufferView::byteOffset):
+ (WTF::ArrayBufferView::verifySubRange):
+ (WTF::ArrayBufferView::clampOffsetAndNumElements):
+ (WTF::ArrayBufferView::setImpl):
+ (WTF::ArrayBufferView::setRangeImpl):
+ (WTF::ArrayBufferView::zeroRangeImpl):
+ (WTF::ArrayBufferView::calculateOffsetAndLength):
+ * wtf/CMakeLists.txt:
+ * wtf/Float32Array.h: Renamed from Source/WebCore/html/canvas/Float32Array.h.
+ (WTF::Float32Array::set):
+ (WTF::Float32Array::item):
+ (WTF::Float32Array::isFloatArray):
+ (WTF::Float32Array::create):
+ (WTF::Float32Array::Float32Array):
+ (WTF::Float32Array::subarray):
+ * wtf/Float64Array.h: Renamed from Source/WebCore/html/canvas/Float64Array.h.
+ (WTF::Float64Array::set):
+ (WTF::Float64Array::item):
+ (WTF::Float64Array::isDoubleArray):
+ (WTF::Float64Array::create):
+ (WTF::Float64Array::Float64Array):
+ (WTF::Float64Array::subarray):
+ * wtf/Int16Array.h: Renamed from Source/WebCore/html/canvas/Int16Array.cpp.
+ (WTF::Int16Array::set):
+ (WTF::Int16Array::isShortArray):
+ (WTF::Int16Array::create):
+ (WTF::Int16Array::Int16Array):
+ (WTF::Int16Array::subarray):
+ * wtf/Int32Array.h: Renamed from Source/WebCore/html/canvas/Int32Array.cpp.
+ (WTF::Int32Array::set):
+ (WTF::Int32Array::isIntArray):
+ (WTF::Int32Array::create):
+ (WTF::Int32Array::Int32Array):
+ (WTF::Int32Array::subarray):
+ * wtf/Int8Array.h: Renamed from Source/WebCore/html/canvas/Int8Array.cpp.
+ (WTF::Int8Array::set):
+ (WTF::Int8Array::isByteArray):
+ (WTF::Int8Array::create):
+ (WTF::Int8Array::Int8Array):
+ (WTF::Int8Array::subarray):
+ * wtf/IntegralTypedArrayBase.h: Renamed from Source/WebCore/html/canvas/IntegralTypedArrayBase.h.
+ (WTF::IntegralTypedArrayBase::set):
+ (WTF::IntegralTypedArrayBase::item):
+ (WTF::IntegralTypedArrayBase::IntegralTypedArrayBase):
+ * wtf/TypedArrayBase.h: Renamed from Source/WebCore/html/canvas/TypedArrayBase.h.
+ (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/Uint16Array.h: Renamed from Source/WebCore/html/canvas/Uint16Array.cpp.
+ (WTF::Uint16Array::set):
+ (WTF::Uint16Array::isUnsignedShortArray):
+ (WTF::Uint16Array::create):
+ (WTF::Uint16Array::Uint16Array):
+ (WTF::Uint16Array::subarray):
+ * wtf/Uint32Array.h: Renamed from Source/WebCore/html/canvas/Uint32Array.cpp.
+ (WTF::Uint32Array::set):
+ (WTF::Uint32Array::isUnsignedIntArray):
+ (WTF::Uint32Array::create):
+ (WTF::Uint32Array::Uint32Array):
+ (WTF::Uint32Array::subarray):
+ * wtf/Uint8Array.h: Renamed from Source/WebCore/html/canvas/Uint8Array.h.
+ (WTF::Uint8Array::set):
+ (WTF::Uint8Array::isUnsignedByteArray):
+ (WTF::Uint8Array::create):
+ (WTF::Uint8Array::Uint8Array):
+ (WTF::Uint8Array::subarray):
+ * wtf/wtf.pro:
+
2011-11-27 Filip Pizlo <fpizlo@apple.com>
Don't try to optimize huge code blocks
diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am
index d5bdd8a..a34c200 100644
--- a/Source/JavaScriptCore/GNUmakefile.list.am
+++ b/Source/JavaScriptCore/GNUmakefile.list.am
@@ -496,14 +496,18 @@
Source/JavaScriptCore/runtime/WriteBarrier.h \
Source/JavaScriptCore/wtf/Alignment.h \
Source/JavaScriptCore/wtf/AlwaysInline.h \
+ Source/JavaScriptCore/wtf/ArrayBuffer.cpp \
+ Source/JavaScriptCore/wtf/ArrayBuffer.h \
+ Source/JavaScriptCore/wtf/ArrayBufferView.cpp \
+ Source/JavaScriptCore/wtf/ArrayBufferView.h \
Source/JavaScriptCore/wtf/ASCIICType.h \
Source/JavaScriptCore/wtf/Assertions.cpp \
Source/JavaScriptCore/wtf/Assertions.h \
Source/JavaScriptCore/wtf/Atomics.h \
Source/JavaScriptCore/wtf/AVLTree.h \
+ Source/JavaScriptCore/wtf/Bitmap.h \
Source/JavaScriptCore/wtf/BitVector.cpp \
Source/JavaScriptCore/wtf/BitVector.h \
- Source/JavaScriptCore/wtf/Bitmap.h \
Source/JavaScriptCore/wtf/BlockStack.h \
Source/JavaScriptCore/wtf/BloomFilter.h \
Source/JavaScriptCore/wtf/BoundsCheckedPointer.h \
@@ -520,30 +524,30 @@
Source/JavaScriptCore/wtf/DateMath.h \
Source/JavaScriptCore/wtf/DecimalNumber.cpp \
Source/JavaScriptCore/wtf/DecimalNumber.h \
- Source/JavaScriptCore/wtf/dtoa/bignum-dtoa.cc \
- Source/JavaScriptCore/wtf/dtoa/bignum.cc \
- Source/JavaScriptCore/wtf/dtoa/cached-powers.cc \
- Source/JavaScriptCore/wtf/dtoa/diy-fp.cc \
- Source/JavaScriptCore/wtf/dtoa/double-conversion.cc \
- Source/JavaScriptCore/wtf/dtoa/fast-dtoa.cc \
- Source/JavaScriptCore/wtf/dtoa/fixed-dtoa.cc \
- Source/JavaScriptCore/wtf/dtoa/strtod.cc \
- Source/JavaScriptCore/wtf/dtoa/bignum-dtoa.h \
- Source/JavaScriptCore/wtf/dtoa/bignum.h \
- Source/JavaScriptCore/wtf/dtoa/cached-powers.h \
- Source/JavaScriptCore/wtf/dtoa/diy-fp.h \
- Source/JavaScriptCore/wtf/dtoa/double-conversion.h \
- Source/JavaScriptCore/wtf/dtoa/double.h \
- Source/JavaScriptCore/wtf/dtoa/fast-dtoa.h \
- Source/JavaScriptCore/wtf/dtoa/fixed-dtoa.h \
- Source/JavaScriptCore/wtf/dtoa/strtod.h \
- Source/JavaScriptCore/wtf/dtoa/utils.h \
Source/JavaScriptCore/wtf/Decoder.h \
Source/JavaScriptCore/wtf/Deque.h \
Source/JavaScriptCore/wtf/DisallowCType.h \
Source/JavaScriptCore/wtf/DoublyLinkedList.h \
Source/JavaScriptCore/wtf/dtoa.cpp \
Source/JavaScriptCore/wtf/dtoa.h \
+ Source/JavaScriptCore/wtf/dtoa/bignum-dtoa.cc \
+ Source/JavaScriptCore/wtf/dtoa/bignum-dtoa.h \
+ Source/JavaScriptCore/wtf/dtoa/bignum.cc \
+ Source/JavaScriptCore/wtf/dtoa/bignum.h \
+ Source/JavaScriptCore/wtf/dtoa/cached-powers.cc \
+ Source/JavaScriptCore/wtf/dtoa/cached-powers.h \
+ Source/JavaScriptCore/wtf/dtoa/diy-fp.cc \
+ Source/JavaScriptCore/wtf/dtoa/diy-fp.h \
+ Source/JavaScriptCore/wtf/dtoa/double-conversion.cc \
+ Source/JavaScriptCore/wtf/dtoa/double-conversion.h \
+ Source/JavaScriptCore/wtf/dtoa/double.h \
+ Source/JavaScriptCore/wtf/dtoa/fast-dtoa.cc \
+ Source/JavaScriptCore/wtf/dtoa/fast-dtoa.h \
+ Source/JavaScriptCore/wtf/dtoa/fixed-dtoa.cc \
+ Source/JavaScriptCore/wtf/dtoa/fixed-dtoa.h \
+ Source/JavaScriptCore/wtf/dtoa/strtod.cc \
+ Source/JavaScriptCore/wtf/dtoa/strtod.h \
+ Source/JavaScriptCore/wtf/dtoa/utils.h \
Source/JavaScriptCore/wtf/DynamicAnnotations.cpp \
Source/JavaScriptCore/wtf/DynamicAnnotations.h \
Source/JavaScriptCore/wtf/Encoder.h \
@@ -551,6 +555,8 @@
Source/JavaScriptCore/wtf/FastMalloc.cpp \
Source/JavaScriptCore/wtf/FastMalloc.h \
Source/JavaScriptCore/wtf/FixedArray.h \
+ Source/JavaScriptCore/wtf/Float32Array.h \
+ Source/JavaScriptCore/wtf/Float64Array.h \
Source/JavaScriptCore/wtf/Forward.h \
Source/JavaScriptCore/wtf/GetPtr.h \
Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp \
@@ -569,6 +575,10 @@
Source/JavaScriptCore/wtf/HashTraits.h \
Source/JavaScriptCore/wtf/HexNumber.h \
Source/JavaScriptCore/wtf/InlineASM.h \
+ Source/JavaScriptCore/wtf/Int16Array.h \
+ Source/JavaScriptCore/wtf/Int32Array.h \
+ Source/JavaScriptCore/wtf/Int8Array.h \
+ Source/JavaScriptCore/wtf/IntegralTypedArrayBase.h \
Source/JavaScriptCore/wtf/ListHashSet.h \
Source/JavaScriptCore/wtf/ListRefPtr.h \
Source/JavaScriptCore/wtf/Locker.h \
@@ -578,12 +588,12 @@
Source/JavaScriptCore/wtf/MathExtras.h \
Source/JavaScriptCore/wtf/MD5.cpp \
Source/JavaScriptCore/wtf/MD5.h \
+ Source/JavaScriptCore/wtf/MessageQueue.h \
Source/JavaScriptCore/wtf/MetaAllocator.cpp \
Source/JavaScriptCore/wtf/MetaAllocator.h \
Source/JavaScriptCore/wtf/MetaAllocatorHandle.h \
- Source/JavaScriptCore/wtf/MessageQueue.h \
- Source/JavaScriptCore/wtf/NonCopyingSort.h \
Source/JavaScriptCore/wtf/Noncopyable.h \
+ Source/JavaScriptCore/wtf/NonCopyingSort.h \
Source/JavaScriptCore/wtf/NotFound.h \
Source/JavaScriptCore/wtf/NullPtr.h \
Source/JavaScriptCore/wtf/OSAllocator.h \
@@ -591,24 +601,24 @@
Source/JavaScriptCore/wtf/OSRandomSource.h \
Source/JavaScriptCore/wtf/OwnArrayPtr.h \
Source/JavaScriptCore/wtf/OwnFastMallocPtr.h \
- Source/JavaScriptCore/wtf/OwnPtrCommon.h \
Source/JavaScriptCore/wtf/OwnPtr.h \
+ Source/JavaScriptCore/wtf/OwnPtrCommon.h \
Source/JavaScriptCore/wtf/PackedIntVector.h \
Source/JavaScriptCore/wtf/PageAllocation.h \
Source/JavaScriptCore/wtf/PageAllocationAligned.cpp \
Source/JavaScriptCore/wtf/PageAllocationAligned.h \
- Source/JavaScriptCore/wtf/PageReservation.h \
Source/JavaScriptCore/wtf/PageBlock.cpp \
Source/JavaScriptCore/wtf/PageBlock.h \
- Source/JavaScriptCore/wtf/PassOwnArrayPtr.h \
- Source/JavaScriptCore/wtf/PassOwnPtr.h \
- Source/JavaScriptCore/wtf/PassRefPtr.h \
- Source/JavaScriptCore/wtf/PassTraits.h \
+ Source/JavaScriptCore/wtf/PageReservation.h \
Source/JavaScriptCore/wtf/ParallelJobs.h \
Source/JavaScriptCore/wtf/ParallelJobsGeneric.cpp \
Source/JavaScriptCore/wtf/ParallelJobsGeneric.h \
Source/JavaScriptCore/wtf/ParallelJobsLibdispatch.h \
Source/JavaScriptCore/wtf/ParallelJobsOpenMP.h \
+ Source/JavaScriptCore/wtf/PassOwnArrayPtr.h \
+ Source/JavaScriptCore/wtf/PassOwnPtr.h \
+ Source/JavaScriptCore/wtf/PassRefPtr.h \
+ Source/JavaScriptCore/wtf/PassTraits.h \
Source/JavaScriptCore/wtf/Platform.h \
Source/JavaScriptCore/wtf/PossiblyNull.h \
Source/JavaScriptCore/wtf/RandomNumber.cpp \
@@ -656,26 +666,30 @@
Source/JavaScriptCore/wtf/text/TextPosition.h \
Source/JavaScriptCore/wtf/text/WTFString.cpp \
Source/JavaScriptCore/wtf/text/WTFString.h \
- Source/JavaScriptCore/wtf/threads/BinarySemaphore.cpp \
- Source/JavaScriptCore/wtf/threads/BinarySemaphore.h \
Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp \
Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.h \
- Source/JavaScriptCore/wtf/ThreadRestrictionVerifier.h \
Source/JavaScriptCore/wtf/Threading.cpp \
Source/JavaScriptCore/wtf/Threading.h \
Source/JavaScriptCore/wtf/ThreadingPrimitives.h \
Source/JavaScriptCore/wtf/ThreadingPthreads.cpp \
+ Source/JavaScriptCore/wtf/ThreadRestrictionVerifier.h \
+ Source/JavaScriptCore/wtf/threads/BinarySemaphore.cpp \
+ Source/JavaScriptCore/wtf/threads/BinarySemaphore.h \
Source/JavaScriptCore/wtf/ThreadSafeRefCounted.h \
Source/JavaScriptCore/wtf/ThreadSpecific.h \
+ Source/JavaScriptCore/wtf/TypedArrayBase.h \
Source/JavaScriptCore/wtf/TypeTraits.cpp \
Source/JavaScriptCore/wtf/TypeTraits.h \
- Source/JavaScriptCore/wtf/UnionFind.h \
+ Source/JavaScriptCore/wtf/Uint16Array.h \
+ Source/JavaScriptCore/wtf/Uint32Array.h \
+ Source/JavaScriptCore/wtf/Uint8Array.h \
Source/JavaScriptCore/wtf/unicode/CharacterNames.h \
- Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp \
Source/JavaScriptCore/wtf/unicode/Collator.h \
+ Source/JavaScriptCore/wtf/unicode/CollatorDefault.cpp \
Source/JavaScriptCore/wtf/unicode/Unicode.h \
Source/JavaScriptCore/wtf/unicode/UTF8.cpp \
Source/JavaScriptCore/wtf/unicode/UTF8.h \
+ Source/JavaScriptCore/wtf/UnionFind.h \
Source/JavaScriptCore/wtf/UnusedParam.h \
Source/JavaScriptCore/wtf/ValueCheck.h \
Source/JavaScriptCore/wtf/Vector.h \
diff --git a/Source/JavaScriptCore/JavaScriptCore.exp b/Source/JavaScriptCore/JavaScriptCore.exp
index 0daeeb8..3715ab1 100644
--- a/Source/JavaScriptCore/JavaScriptCore.exp
+++ b/Source/JavaScriptCore/JavaScriptCore.exp
@@ -423,6 +423,9 @@
__ZN3WTF14fastMallocSizeEPKv
__ZN3WTF14numberToStringEdPc
__ZN3WTF14tryFastReallocEPvm
+__ZN3WTF15ArrayBufferView6neuterEv
+__ZN3WTF15ArrayBufferViewC2ENS_10PassRefPtrINS_11ArrayBufferEEEj
+__ZN3WTF15ArrayBufferViewD2Ev
__ZN3WTF15ThreadCondition4waitERNS_5MutexE
__ZN3WTF15ThreadCondition6signalEv
__ZN3WTF15ThreadCondition9broadcastEv
diff --git a/Source/JavaScriptCore/JavaScriptCore.gypi b/Source/JavaScriptCore/JavaScriptCore.gypi
index 81db2b4..06e2013 100644
--- a/Source/JavaScriptCore/JavaScriptCore.gypi
+++ b/Source/JavaScriptCore/JavaScriptCore.gypi
@@ -545,6 +545,10 @@
'runtime/Tracing.h',
'runtime/UString.cpp',
'runtime/UStringConcatenate.h',
+ 'wtf/ArrayBuffer.cpp',
+ 'wtf/ArrayBuffer.h',
+ 'wtf/ArrayBufferView.cpp',
+ 'wtf/ArrayBufferView.h',
'wtf/Assertions.cpp',
'wtf/ByteArray.cpp',
'wtf/CryptographicallyRandomNumber.cpp',
@@ -554,7 +558,13 @@
'wtf/DynamicAnnotations.cpp',
'wtf/DynamicAnnotations.h',
'wtf/FastMalloc.cpp',
+ 'wtf/Float32Array.h',
+ 'wtf/Float64Array.h',
'wtf/HashTable.cpp',
+ 'wtf/Int16Array.h',
+ 'wtf/Int32Array.h',
+ 'wtf/Int8Array.h',
+ 'wtf/IntegralTypedArrayBase.h',
'wtf/MD5.cpp',
'wtf/MainThread.cpp',
'wtf/MallocZoneSupport.h',
@@ -587,7 +597,11 @@
'wtf/ThreadingPthreads.cpp',
'wtf/ThreadingWin.cpp',
'wtf/TypeTraits.cpp',
- 'wtf/WTFThreadData.cpp',
+ 'wtf/TypedArrayBase.h',
+ 'wtf/WTFThreadData.cpp'
+ 'wtf/Uint16Array.h',
+ 'wtf/Uint32Array.h',
+ 'wtf/Uint8Array.h',
'wtf/chromium/ChromiumThreading.h',
'wtf/chromium/MainThreadChromium.cpp',
'wtf/dtoa.cpp',
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
index be63dbd..f6cf020 100644
--- a/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
@@ -613,6 +613,22 @@
>
</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>
@@ -729,6 +745,14 @@
>
</File>
<File
+ RelativePath="..\..\wtf\Float32Array.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Float64Array.h"
+ >
+ </File>
+ <File
RelativePath="..\..\wtf\dtoa.cpp"
>
</File>
@@ -833,6 +857,18 @@
>
</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>
@@ -1157,6 +1193,18 @@
>
</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>
diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index b27e713..bfd9957 100644
--- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -457,6 +457,20 @@
A7386554118697B400540279 /* SpecializedThunkJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = A7386551118697B400540279 /* SpecializedThunkJIT.h */; };
A7386555118697B400540279 /* ThunkGenerators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7386552118697B400540279 /* ThunkGenerators.cpp */; };
A7386556118697B400540279 /* ThunkGenerators.h in Headers */ = {isa = PBXBuildFile; fileRef = A7386553118697B400540279 /* ThunkGenerators.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE168148420520091204B /* ArrayBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73BE154148420520091204B /* ArrayBuffer.cpp */; };
+ A73BE169148420520091204B /* ArrayBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE155148420520091204B /* ArrayBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE16A148420520091204B /* ArrayBufferView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73BE156148420520091204B /* ArrayBufferView.cpp */; };
+ A73BE16B148420520091204B /* ArrayBufferView.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE157148420520091204B /* ArrayBufferView.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE16D148420520091204B /* Float32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE159148420520091204B /* Float32Array.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE16F148420520091204B /* Float64Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE15B148420520091204B /* Float64Array.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE171148420520091204B /* Int8Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE15D148420520091204B /* Int8Array.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE173148420520091204B /* Int16Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE15F148420520091204B /* Int16Array.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE175148420520091204B /* Int32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE161148420520091204B /* Int32Array.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE177148420520091204B /* Uint8Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE163148420520091204B /* Uint8Array.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE179148420520091204B /* Uint16Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE165148420520091204B /* Uint16Array.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE17B148420520091204B /* Uint32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE167148420520091204B /* Uint32Array.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE17E148420840091204B /* TypedArrayBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE17D148420840091204B /* TypedArrayBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A73BE180148420A80091204B /* IntegralTypedArrayBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A73BE17F148420A80091204B /* IntegralTypedArrayBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */; };
A7482E93116A7CAD003B0712 /* JSWeakObjectMapRefInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1265,6 +1279,20 @@
A7386551118697B400540279 /* SpecializedThunkJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecializedThunkJIT.h; sourceTree = "<group>"; };
A7386552118697B400540279 /* ThunkGenerators.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThunkGenerators.cpp; sourceTree = "<group>"; };
A7386553118697B400540279 /* ThunkGenerators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThunkGenerators.h; sourceTree = "<group>"; };
+ A73BE154148420520091204B /* ArrayBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayBuffer.cpp; sourceTree = "<group>"; };
+ A73BE155148420520091204B /* ArrayBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayBuffer.h; sourceTree = "<group>"; };
+ A73BE156148420520091204B /* ArrayBufferView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayBufferView.cpp; sourceTree = "<group>"; };
+ A73BE157148420520091204B /* ArrayBufferView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayBufferView.h; sourceTree = "<group>"; };
+ A73BE159148420520091204B /* Float32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Float32Array.h; sourceTree = "<group>"; };
+ A73BE15B148420520091204B /* Float64Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Float64Array.h; sourceTree = "<group>"; };
+ A73BE15D148420520091204B /* Int8Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Int8Array.h; sourceTree = "<group>"; };
+ A73BE15F148420520091204B /* Int16Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Int16Array.h; sourceTree = "<group>"; };
+ A73BE161148420520091204B /* Int32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Int32Array.h; sourceTree = "<group>"; };
+ A73BE163148420520091204B /* Uint8Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Uint8Array.h; sourceTree = "<group>"; };
+ A73BE165148420520091204B /* Uint16Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Uint16Array.h; sourceTree = "<group>"; };
+ A73BE167148420520091204B /* Uint32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Uint32Array.h; sourceTree = "<group>"; };
+ A73BE17D148420840091204B /* TypedArrayBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypedArrayBase.h; sourceTree = "<group>"; };
+ A73BE17F148420A80091204B /* IntegralTypedArrayBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntegralTypedArrayBase.h; sourceTree = "<group>"; };
A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakObjectMapRefPrivate.h; sourceTree = "<group>"; };
A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWeakObjectMapRefPrivate.cpp; sourceTree = "<group>"; };
A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakObjectMapRefInternal.h; sourceTree = "<group>"; };
@@ -1862,21 +1890,20 @@
65162EF108E6A21C007556CD /* wtf */ = {
isa = PBXGroup;
children = (
- C22C524813FAF6EF00B7DC0D /* dtoa */,
- 06D358A00DAAD9C4003B174E /* mac */,
- 8656573E115BE35200291F40 /* text */,
- 1A082776142168D60090CCAC /* threads */,
- E195678D09E7CF1200B89D13 /* unicode */,
A1D764511354448B00C5C7C0 /* Alignment.h */,
93AA4F770957251F0084B3A7 /* AlwaysInline.h */,
+ A73BE154148420520091204B /* ArrayBuffer.cpp */,
+ A73BE155148420520091204B /* ArrayBuffer.h */,
+ A73BE156148420520091204B /* ArrayBufferView.cpp */,
+ A73BE157148420520091204B /* ArrayBufferView.h */,
938C4F690CA06BC700D9310A /* ASCIICType.h */,
65E217B808E7EECC0023E5F6 /* Assertions.cpp */,
65E217B708E7EECC0023E5F6 /* Assertions.h */,
BC5F7BBB11823B590052C02C /* Atomics.h */,
E1A596370DE3E1C300C17E37 /* AVLTree.h */,
+ DD377CBB12072C18006A2517 /* Bitmap.h */,
0F16D724142C39A200CF784A /* BitVector.cpp */,
0FD82F491428069200179C94 /* BitVector.h */,
- DD377CBB12072C18006A2517 /* Bitmap.h */,
A7C40C07130B057D00D002A1 /* BlockStack.h */,
E4D8CE9B12FC42E100BC9F5A /* BloomFilter.h */,
0FD82E82141F3FC900179C94 /* BoundsCheckedPointer.h */,
@@ -1898,6 +1925,7 @@
5186111D0CC824830081412B /* Deque.h */,
938C4F6B0CA06BCE00D9310A /* DisallowCType.h */,
14456A311314657800212CA3 /* DoublyLinkedList.h */,
+ C22C524813FAF6EF00B7DC0D /* dtoa */,
651F6412039D5B5F0078395C /* dtoa.cpp */,
651F6413039D5B5F0078395C /* dtoa.h */,
D75AF59512F8CB9500FC0ADF /* DynamicAnnotations.cpp */,
@@ -1907,6 +1935,8 @@
65E217B908E7EECC0023E5F6 /* FastMalloc.cpp */,
65E217BA08E7EECC0023E5F6 /* FastMalloc.h */,
A7F19ECD11DD490900931E70 /* FixedArray.h */,
+ A73BE159148420520091204B /* Float32Array.h */,
+ A73BE15B148420520091204B /* Float64Array.h */,
935AF46909E9D9DB00ACD1D8 /* Forward.h */,
93B6A0DE0AA64DA40076DE27 /* GetPtr.h */,
657EEBBF094E445E008C9C7B /* HashCountedSet.h */,
@@ -1919,9 +1949,14 @@
65DFC92F08EA173A00F7300B /* HashTraits.h */,
7186A6E813100B57004479E1 /* HexNumber.h */,
8699AA60146A0E2B00E23A73 /* InlineASM.h */,
+ A73BE15F148420520091204B /* Int16Array.h */,
+ A73BE161148420520091204B /* Int32Array.h */,
+ A73BE15D148420520091204B /* Int8Array.h */,
+ A73BE17F148420A80091204B /* IntegralTypedArrayBase.h */,
657EB7450B708F540063461B /* ListHashSet.h */,
148A1626095D16BB00666D0D /* ListRefPtr.h */,
E1EE79270D6C964500FEA3BA /* Locker.h */,
+ 06D358A00DAAD9C4003B174E /* mac */,
06D358A20DAAD9C4003B174E /* MainThread.cpp */,
06D358A30DAAD9C4003B174E /* MainThread.h */,
5DBD18AF0C5401A700C15EAE /* MallocZoneSupport.h */,
@@ -1991,6 +2026,7 @@
6541BD6F08E80A17002CBEE7 /* TCSpinLock.h */,
6541BD7008E80A17002CBEE7 /* TCSystemAlloc.cpp */,
6541BD7108E80A17002CBEE7 /* TCSystemAlloc.h */,
+ 8656573E115BE35200291F40 /* text */,
18BAB52710DADFCD000D945B /* ThreadIdentifierDataPthreads.cpp */,
18BAB52810DADFCD000D945B /* ThreadIdentifierDataPthreads.h */,
5D6A566A0F05995500266145 /* Threading.cpp */,
@@ -1998,10 +2034,16 @@
BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */,
E1EE793C0D6C9B9200FEA3BA /* ThreadingPthreads.cpp */,
0BAC949E1338728400CF135B /* ThreadRestrictionVerifier.h */,
+ 1A082776142168D60090CCAC /* threads */,
BC5F7BBD11823B590052C02C /* ThreadSafeRefCounted.h */,
E1B7C8BD0DA3A3360074B0DC /* ThreadSpecific.h */,
+ A73BE17D148420840091204B /* TypedArrayBase.h */,
0B330C260F38C62300692DE3 /* TypeTraits.cpp */,
0B4D7E620F319AC800AD7E58 /* TypeTraits.h */,
+ A73BE165148420520091204B /* Uint16Array.h */,
+ A73BE167148420520091204B /* Uint32Array.h */,
+ A73BE163148420520091204B /* Uint8Array.h */,
+ E195678D09E7CF1200B89D13 /* unicode */,
0FD52AAC1430359D0026DC9F /* UnionFind.h */,
935AF46B09E9D9DB00ACD1D8 /* UnusedParam.h */,
E17FF770112131D200076A19 /* ValueCheck.h */,
@@ -2923,6 +2965,18 @@
0F5F08CF146C7633000472A9 /* UnconditionalFinalizer.h in Headers */,
978801411471AD920041B016 /* JSDateMath.h in Headers */,
0F2C556F14738F3100121E4F /* DFGCodeBlocks.h in Headers */,
+ A73BE169148420520091204B /* ArrayBuffer.h in Headers */,
+ A73BE16B148420520091204B /* ArrayBufferView.h in Headers */,
+ A73BE16D148420520091204B /* Float32Array.h in Headers */,
+ A73BE16F148420520091204B /* Float64Array.h in Headers */,
+ A73BE171148420520091204B /* Int8Array.h in Headers */,
+ A73BE173148420520091204B /* Int16Array.h in Headers */,
+ A73BE175148420520091204B /* Int32Array.h in Headers */,
+ A73BE177148420520091204B /* Uint8Array.h in Headers */,
+ A73BE179148420520091204B /* Uint16Array.h in Headers */,
+ A73BE17B148420520091204B /* Uint32Array.h in Headers */,
+ A73BE17E148420840091204B /* TypedArrayBase.h in Headers */,
+ A73BE180148420A80091204B /* IntegralTypedArrayBase.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3458,6 +3512,8 @@
0FC097A1146B28CA00CF2442 /* DFGThunks.cpp in Sources */,
978801401471AD920041B016 /* JSDateMath.cpp in Sources */,
0F2C557014738F3500121E4F /* DFGCodeBlocks.cpp in Sources */,
+ A73BE168148420520091204B /* ArrayBuffer.cpp in Sources */,
+ A73BE16A148420520091204B /* ArrayBufferView.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Source/JavaScriptCore/wtf/ArrayBuffer.cpp b/Source/JavaScriptCore/wtf/ArrayBuffer.cpp
new file mode 100644
index 0000000..1ebe74f4
--- /dev/null
+++ b/Source/JavaScriptCore/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<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/JavaScriptCore/wtf/ArrayBuffer.h b/Source/JavaScriptCore/wtf/ArrayBuffer.h
new file mode 100644
index 0000000..4196aa8
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ArrayBuffer.h
@@ -0,0 +1,219 @@
+/*
+ * 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;
+
+class ArrayBufferContents {
+ WTF_MAKE_NONCOPYABLE(ArrayBufferContents);
+public:
+ ArrayBufferContents()
+ : m_data(0)
+ , m_sizeInBytes(0)
+ { }
+
+ inline ~ArrayBufferContents();
+
+ void* data() { return m_data; }
+ unsigned sizeInBytes() { return m_sizeInBytes; }
+
+private:
+ ArrayBufferContents(void* data, unsigned sizeInBytes)
+ : m_data(data)
+ , m_sizeInBytes(sizeInBytes)
+ { }
+
+ friend class ArrayBuffer;
+
+ static inline void tryAllocate(unsigned numElements, unsigned elementByteSize, 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;
+ }
+
+ void* m_data;
+ unsigned m_sizeInBytes;
+};
+
+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&);
+
+ 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*);
+
+ bool transfer(ArrayBufferContents&, Vector<ArrayBufferView*>& neuteredViews);
+
+ ~ArrayBuffer() { }
+
+private:
+ 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)
+{
+ ArrayBufferContents contents;
+ ArrayBufferContents::tryAllocate(numElements, elementByteSize, contents);
+ if (!contents.m_data)
+ return 0;
+ return adoptRef(new ArrayBuffer(contents));
+}
+
+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, 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));
+}
+
+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& 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;
+ }
+ }
+ if (WTF::tryFastCalloc(numElements, elementByteSize).getValue(result.m_data)) {
+ result.m_sizeInBytes = numElements * elementByteSize;
+ return;
+ }
+ result.m_data = 0;
+}
+
+ArrayBufferContents::~ArrayBufferContents()
+{
+ WTF::fastFree(m_data);
+}
+
+} // namespace WTF
+
+using WTF::ArrayBuffer;
+
+#endif // ArrayBuffer_h
diff --git a/Source/JavaScriptCore/wtf/ArrayBufferView.cpp b/Source/JavaScriptCore/wtf/ArrayBufferView.cpp
new file mode 100644
index 0000000..67dbdcf
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ArrayBufferView.cpp
@@ -0,0 +1,55 @@
+/*
+ * 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_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/JavaScriptCore/wtf/ArrayBufferView.h b/Source/JavaScriptCore/wtf/ArrayBufferView.h
new file mode 100644
index 0000000..ccb7fd3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/ArrayBufferView.h
@@ -0,0 +1,198 @@
+/*
+ * 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 "ArrayBuffer.h"
+
+#include <algorithm>
+#include <limits.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WTF {
+
+class ArrayBufferView : public RefCounted<ArrayBufferView> {
+ public:
+ virtual bool isByteArray() const { return false; }
+ virtual bool isUnsignedByteArray() const { return false; }
+ virtual bool isShortArray() const { return false; }
+ virtual bool isUnsignedShortArray() const { return false; }
+ virtual bool isIntArray() const { return false; }
+ virtual bool isUnsignedIntArray() const { return false; }
+ virtual bool isFloatArray() const { return false; }
+ virtual bool isDoubleArray() const { return false; }
+ virtual bool isDataView() const { return false; }
+
+ PassRefPtr<ArrayBuffer> buffer() const
+ {
+ return m_buffer;
+ }
+
+ void* baseAddress() const
+ {
+ return m_baseAddress;
+ }
+
+ unsigned byteOffset() const
+ {
+ return m_byteOffset;
+ }
+
+ virtual unsigned byteLength() const = 0;
+
+ virtual ~ArrayBufferView();
+
+ protected:
+ 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);
+ }
+
+ 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 (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/JavaScriptCore/wtf/CMakeLists.txt b/Source/JavaScriptCore/wtf/CMakeLists.txt
index 08b4da5..6d1cee8 100644
--- a/Source/JavaScriptCore/wtf/CMakeLists.txt
+++ b/Source/JavaScriptCore/wtf/CMakeLists.txt
@@ -3,6 +3,8 @@
AVLTree.h
Alignment.h
AlwaysInline.h
+ ArrayBuffer.cpp
+ ArrayBufferView.cpp
Assertions.h
Atomics.h
BitVector.h
diff --git a/Source/JavaScriptCore/wtf/Float32Array.h b/Source/JavaScriptCore/wtf/Float32Array.h
new file mode 100644
index 0000000..230a768
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Float32Array.h
@@ -0,0 +1,108 @@
+/*
+ * 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 "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);
+
+ // 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);
+ }
+
+ // Invoked by the indexed getter. Does not perform range checks; caller
+ // is responsible for doing so and returning undefined as necessary.
+ float item(unsigned index) const
+ {
+ ASSERT(index < TypedArrayBase<float>::m_length);
+ float result = TypedArrayBase<float>::data()[index];
+ return result;
+ }
+
+ inline PassRefPtr<Float32Array> subarray(int start) const;
+ inline PassRefPtr<Float32Array> subarray(int start, int end) const;
+
+private:
+ inline Float32Array(PassRefPtr<ArrayBuffer>,
+ unsigned byteOffset,
+ unsigned length);
+ // Make constructor visible to superclass.
+ friend class TypedArrayBase<float>;
+
+ // Overridden from ArrayBufferView.
+ virtual bool isFloatArray() const { return true; }
+};
+
+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);
+}
+
+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/JavaScriptCore/wtf/Float64Array.h b/Source/JavaScriptCore/wtf/Float64Array.h
new file mode 100644
index 0000000..4671355
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Float64Array.h
@@ -0,0 +1,108 @@
+/*
+ * 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 "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);
+
+ // 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);
+ }
+
+ // Invoked by the indexed getter. Does not perform range checks; caller
+ // is responsible for doing so and returning undefined as necessary.
+ double item(unsigned index) const
+ {
+ ASSERT(index < TypedArrayBase<double>::m_length);
+ double result = TypedArrayBase<double>::data()[index];
+ return result;
+ }
+
+ inline PassRefPtr<Float64Array> subarray(int start) const;
+ inline PassRefPtr<Float64Array> subarray(int start, int end) const;
+
+private:
+ inline Float64Array(PassRefPtr<ArrayBuffer>,
+ unsigned byteOffset,
+ unsigned length);
+ // Make constructor visible to superclass.
+ friend class TypedArrayBase<double>;
+
+ // Overridden from ArrayBufferView.
+ virtual bool isDoubleArray() const { return true; }
+};
+
+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);
+}
+
+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/JavaScriptCore/wtf/Int16Array.h b/Source/JavaScriptCore/wtf/Int16Array.h
new file mode 100644
index 0000000..34a52de
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Int16Array.h
@@ -0,0 +1,93 @@
+/*
+ * 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 "IntegralTypedArrayBase.h"
+
+namespace WTF {
+
+class ArrayBuffer;
+
+class Int16Array : public IntegralTypedArrayBase<short> {
+public:
+ static inline PassRefPtr<Int16Array> create(unsigned length);
+ static inline PassRefPtr<Int16Array> create(short* array, unsigned length);
+ static inline PassRefPtr<Int16Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, 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;
+
+private:
+ inline Int16Array(PassRefPtr<ArrayBuffer>,
+ unsigned byteOffset,
+ unsigned length);
+ // Make constructor visible to superclass.
+ friend class TypedArrayBase<short>;
+
+ // Overridden from ArrayBufferView.
+ virtual bool isShortArray() const { return true; }
+};
+
+PassRefPtr<Int16Array> Int16Array::create(unsigned length)
+{
+ return TypedArrayBase<short>::create<Int16Array>(length);
+}
+
+PassRefPtr<Int16Array> Int16Array::create(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);
+}
+
+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/JavaScriptCore/wtf/Int32Array.h b/Source/JavaScriptCore/wtf/Int32Array.h
new file mode 100644
index 0000000..0b61457
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Int32Array.h
@@ -0,0 +1,92 @@
+/*
+ * 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 "IntegralTypedArrayBase.h"
+
+namespace WTF {
+
+class Int32Array : public IntegralTypedArrayBase<int> {
+public:
+ static inline PassRefPtr<Int32Array> create(unsigned length);
+ static inline PassRefPtr<Int32Array> create(int* array, unsigned length);
+ static inline PassRefPtr<Int32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, 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;
+
+private:
+ inline Int32Array(PassRefPtr<ArrayBuffer>,
+ unsigned byteOffset,
+ unsigned length);
+ // Make constructor visible to superclass.
+ friend class TypedArrayBase<int>;
+
+ // Overridden from ArrayBufferView.
+ virtual bool isIntArray() const { return true; }
+};
+
+PassRefPtr<Int32Array> Int32Array::create(unsigned length)
+{
+ return TypedArrayBase<int>::create<Int32Array>(length);
+}
+
+PassRefPtr<Int32Array> Int32Array::create(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);
+}
+
+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/JavaScriptCore/wtf/Int8Array.h b/Source/JavaScriptCore/wtf/Int8Array.h
new file mode 100644
index 0000000..6db7b68
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Int8Array.h
@@ -0,0 +1,94 @@
+/*
+ * 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 "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(signed char* array, unsigned length);
+ static inline PassRefPtr<Int8Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, 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;
+
+private:
+ inline Int8Array(PassRefPtr<ArrayBuffer>,
+ unsigned byteOffset,
+ unsigned length);
+ // Make constructor visible to superclass.
+ friend class TypedArrayBase<signed char>;
+
+ // Overridden from ArrayBufferView.
+ virtual bool isByteArray() const { return true; }
+};
+
+PassRefPtr<Int8Array> Int8Array::create(unsigned length)
+{
+ return TypedArrayBase<signed char>::create<Int8Array>(length);
+}
+
+PassRefPtr<Int8Array> Int8Array::create(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);
+}
+
+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/JavaScriptCore/wtf/IntegralTypedArrayBase.h b/Source/JavaScriptCore/wtf/IntegralTypedArrayBase.h
new file mode 100644
index 0000000..48f82a3
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/IntegralTypedArrayBase.h
@@ -0,0 +1,72 @@
+/*
+ * 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 "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));
+ }
+
+ // 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];
+ }
+
+ 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/JavaScriptCore/wtf/TypedArrayBase.h b/Source/JavaScriptCore/wtf/TypedArrayBase.h
new file mode 100644
index 0000000..ae30c17
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/TypedArrayBase.h
@@ -0,0 +1,124 @@
+/*
+ * 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 "ArrayBuffer.h"
+#include "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);
+ }
+
+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>
+ 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);
+ }
+
+ // 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/JavaScriptCore/wtf/Uint16Array.h b/Source/JavaScriptCore/wtf/Uint16Array.h
new file mode 100644
index 0000000..2d07650
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Uint16Array.h
@@ -0,0 +1,94 @@
+/*
+ * 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 "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(unsigned short* array, unsigned length);
+ static inline PassRefPtr<Uint16Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, 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;
+
+private:
+ inline Uint16Array(PassRefPtr<ArrayBuffer>,
+ unsigned byteOffset,
+ unsigned length);
+ // Make constructor visible to superclass.
+ friend class TypedArrayBase<unsigned short>;
+
+ // Overridden from ArrayBufferView.
+ virtual bool isUnsignedShortArray() const { return true; }
+};
+
+PassRefPtr<Uint16Array> Uint16Array::create(unsigned length)
+{
+ return TypedArrayBase<unsigned short>::create<Uint16Array>(length);
+}
+
+PassRefPtr<Uint16Array> Uint16Array::create(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);
+}
+
+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/JavaScriptCore/wtf/Uint32Array.h b/Source/JavaScriptCore/wtf/Uint32Array.h
new file mode 100644
index 0000000..3765f80
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Uint32Array.h
@@ -0,0 +1,94 @@
+/*
+ * 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 "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(unsigned int* array, unsigned length);
+ static inline PassRefPtr<Uint32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, 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;
+
+private:
+ inline Uint32Array(PassRefPtr<ArrayBuffer>,
+ unsigned byteOffset,
+ unsigned length);
+ // Make constructor visible to superclass.
+ friend class TypedArrayBase<unsigned int>;
+
+ // Overridden from ArrayBufferView.
+ virtual bool isUnsignedIntArray() const { return true; }
+};
+
+PassRefPtr<Uint32Array> Uint32Array::create(unsigned length)
+{
+ return TypedArrayBase<unsigned int>::create<Uint32Array>(length);
+}
+
+PassRefPtr<Uint32Array> Uint32Array::create(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);
+}
+
+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/JavaScriptCore/wtf/Uint8Array.h b/Source/JavaScriptCore/wtf/Uint8Array.h
new file mode 100644
index 0000000..58fdb842
--- /dev/null
+++ b/Source/JavaScriptCore/wtf/Uint8Array.h
@@ -0,0 +1,94 @@
+/*
+ * 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 "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(unsigned char* array, unsigned length);
+ static inline PassRefPtr<Uint8Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, 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;
+
+private:
+ inline Uint8Array(PassRefPtr<ArrayBuffer>,
+ unsigned byteOffset,
+ unsigned length);
+ // Make constructor visible to superclass.
+ friend class TypedArrayBase<unsigned char>;
+
+ // Overridden from ArrayBufferView.
+ virtual bool isUnsignedByteArray() const { return true; }
+};
+
+PassRefPtr<Uint8Array> Uint8Array::create(unsigned length)
+{
+ return TypedArrayBase<unsigned char>::create<Uint8Array>(length);
+}
+
+PassRefPtr<Uint8Array> Uint8Array::create(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);
+}
+
+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/JavaScriptCore/wtf/wtf.pro b/Source/JavaScriptCore/wtf/wtf.pro
index 252e354..c677759 100644
--- a/Source/JavaScriptCore/wtf/wtf.pro
+++ b/Source/JavaScriptCore/wtf/wtf.pro
@@ -25,6 +25,8 @@
HEADERS += \
Alignment.h \
AlwaysInline.h \
+ ArrayBuffer.h \
+ ArrayBufferView.h \
ASCIICType.h \
Assertions.h \
Atomics.h \
@@ -44,6 +46,7 @@
Decoder.h \
Deque.h \
DisallowCType.h \
+ dtoa.h \
dtoa/bignum-dtoa.h \
dtoa/bignum.h \
dtoa/cached-powers.h \
@@ -52,7 +55,6 @@
dtoa/double.h \
dtoa/fast-dtoa.h \
dtoa/fixed-dtoa.h \
- dtoa.h \
dtoa/strtod.h \
dtoa/utils.h \
DynamicAnnotations.h \
@@ -60,6 +62,8 @@
FastAllocBase.h \
FastMalloc.h \
FixedArray.h \
+ Float32Array.h \
+ Float64Array.h \
Forward.h \
GetPtr.h \
HashCountedSet.h \
@@ -70,6 +74,9 @@
HashTable.h \
HashTraits.h \
HexNumber.h \
+ Int16Array.h \
+ Int32Array.h \
+ Int8Array.h \
ListHashSet.h \
ListRefPtr.h \
Locker.h \
@@ -88,15 +95,15 @@
OSRandomSource.h \
OwnArrayPtr.h \
OwnFastMallocPtr.h \
- OwnPtrCommon.h \
OwnPtr.h \
+ OwnPtrCommon.h \
PackedIntVector.h \
- PageAllocationAligned.h \
PageAllocation.h \
+ PageAllocationAligned.h \
PageBlock.h \
PageReservation.h \
- ParallelJobsGeneric.h \
ParallelJobs.h \
+ ParallelJobsGeneric.h \
ParallelJobsLibdispatch.h \
ParallelJobsOpenMP.h \
PassOwnArrayPtr.h \
@@ -142,6 +149,9 @@
ThreadSafeRefCounted.h \
ThreadSpecific.h \
TypeTraits.h \
+ Uint16Array.h \
+ Uint32Array.h \
+ Uint8Array.h \
unicode/CharacterNames.h \
unicode/Collator.h \
unicode/icu/UnicodeIcu.h \
@@ -157,7 +167,10 @@
VMTags.h \
WTFThreadData.h
+
SOURCES += \
+ ArrayBuffer.cpp \
+ ArrayBufferView.cpp \
Assertions.cpp \
BitVector.cpp \
ByteArray.cpp \