use createUninitialized when creating TypedArray from another array
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jul 2012 23:32:19 +0000 (23:32 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jul 2012 23:32:19 +0000 (23:32 +0000)
commit66b472a796a86f699c6df08f56b6a3060906180e
treea0a142bb7d54ec22a2622b6e8cbb2951fe449902
parent0541b3ec6e1b793d32af2fd3a4cc8d5e181de3c7
use createUninitialized when creating TypedArray from another array
https://bugs.webkit.org/show_bug.cgi?id=92518

Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-07-27
Reviewed by Kenneth Russell.

PerformanceTests:

* Bindings/typed-array-construct-from-array.html: Added.

Source/WebCore:

When creating a Typed Array from another array, we fill it with values
from the source array. So, we can create it uninitialized. This is
make constructor about 35% faster when constructed with another typed
array.

Test: fast/canvas/webgl/array-constructor.html

* bindings/js/JSArrayBufferViewHelper.h:
(WebCore::constructArrayBufferViewWithTypedArrayArgument):
(WebCore::constructArrayBufferView):

Source/WTF:

Expose a createUninitialized static method on TypedArray classes.

* wtf/Float32Array.h:
(Float32Array):
(WTF::Float32Array::createUninitialized):
(WTF):
* wtf/Float64Array.h:
(Float64Array):
(WTF::Float64Array::createUninitialized):
(WTF):
* wtf/Int16Array.h:
(Int16Array):
(WTF::Int16Array::createUninitialized):
(WTF):
* wtf/Int32Array.h:
(Int32Array):
(WTF::Int32Array::createUninitialized):
(WTF):
* wtf/Int8Array.h:
(Int8Array):
(WTF::Int8Array::createUninitialized):
(WTF):
* wtf/Uint16Array.h:
(Uint16Array):
(WTF::Uint16Array::createUninitialized):
(WTF):
* wtf/Uint32Array.h:
(Uint32Array):
(WTF::Uint32Array::createUninitialized):
(WTF):
* wtf/Uint8Array.h:
(Uint8Array):
(WTF::Uint8Array::createUninitialized):
(WTF):
* wtf/Uint8ClampedArray.h:
(Uint8ClampedArray):

LayoutTests:

Add test to check that constructing a Typed Array with nan values does
not result in random values.

* fast/canvas/webgl/array-constructor-expected.txt: Added.
* fast/canvas/webgl/array-constructor.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/array-constructor-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/webgl/array-constructor.html [new file with mode: 0644]
PerformanceTests/Bindings/typed-array-construct-from-array.html [new file with mode: 0644]
PerformanceTests/ChangeLog
Source/WTF/ChangeLog
Source/WTF/wtf/Float32Array.h
Source/WTF/wtf/Float64Array.h
Source/WTF/wtf/Int16Array.h
Source/WTF/wtf/Int32Array.h
Source/WTF/wtf/Int8Array.h
Source/WTF/wtf/Uint16Array.h
Source/WTF/wtf/Uint32Array.h
Source/WTF/wtf/Uint8Array.h
Source/WTF/wtf/Uint8ClampedArray.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSArrayBufferViewHelper.h