Diff
Modified: trunk/LayoutTests/ChangeLog (123934 => 123935)
--- trunk/LayoutTests/ChangeLog 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/LayoutTests/ChangeLog 2012-07-27 23:32:19 UTC (rev 123935)
@@ -1,3 +1,16 @@
+2012-07-27 Arnaud Renevier <[email protected]>
+
+ use createUninitialized when creating TypedArray from another array
+ https://bugs.webkit.org/show_bug.cgi?id=92518
+
+ Reviewed by Kenneth Russell.
+
+ 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.
+
2012-07-27 Caio Marcelo de Oliveira Filho <[email protected]>
[Qt] Remaining rebaselines after new test fonts
Added: trunk/LayoutTests/fast/canvas/webgl/array-constructor-expected.txt (0 => 123935)
--- trunk/LayoutTests/fast/canvas/webgl/array-constructor-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/array-constructor-expected.txt 2012-07-27 23:32:19 UTC (rev 123935)
@@ -0,0 +1,30 @@
+Verifies that when constructing WebGLArray with nan values, it results in a 0
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS 10 is 10
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 10 is 10
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS 0 is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/webgl/array-constructor.html (0 => 123935)
--- trunk/LayoutTests/fast/canvas/webgl/array-constructor.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/array-constructor.html 2012-07-27 23:32:19 UTC (rev 123935)
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+
+description("Verifies that when constructing WebGLArray with nan values, it results in a 0");
+
+var source, target, idx;
+
+source = new Array(10);
+
+target = new Uint8Array(source);
+shouldBe(target.length.toString(), source.length.toString())
+for (idx = 0; idx < target.length; idx++) {
+ shouldBeZero(target[idx].toString());
+}
+
+source = {length: 10};
+target = new Uint8Array(source);
+shouldBe(target.length.toString(), source.length.toString())
+for (idx = 0; idx < target.length; idx++) {
+ shouldBeZero(target[idx].toString());
+}
+
+</script>
+
+<script src=""
+</body>
+</html>
+
Added: trunk/PerformanceTests/Bindings/typed-array-construct-from-array.html (0 => 123935)
--- trunk/PerformanceTests/Bindings/typed-array-construct-from-array.html (rev 0)
+++ trunk/PerformanceTests/Bindings/typed-array-construct-from-array.html 2012-07-27 23:32:19 UTC (rev 123935)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<script>
+
+var length = 10000000;
+var source = new Array(length);
+for (var i = 0; i < length; i++) {
+ source[i] = i;
+}
+
+PerfTestRunner.run(function() {
+ var target = new Uint8Array(source);
+});
+</script>
+</body>
+
Modified: trunk/PerformanceTests/ChangeLog (123934 => 123935)
--- trunk/PerformanceTests/ChangeLog 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/PerformanceTests/ChangeLog 2012-07-27 23:32:19 UTC (rev 123935)
@@ -1,3 +1,12 @@
+2012-07-27 Arnaud Renevier <[email protected]>
+
+ use createUninitialized when creating TypedArray from another array
+ https://bugs.webkit.org/show_bug.cgi?id=92518
+
+ Reviewed by Kenneth Russell.
+
+ * Bindings/typed-array-construct-from-array.html: Added.
+
2012-07-27 Ryosuke Niwa <[email protected]>
Add more Russian replay performance tests
Modified: trunk/Source/WTF/ChangeLog (123934 => 123935)
--- trunk/Source/WTF/ChangeLog 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WTF/ChangeLog 2012-07-27 23:32:19 UTC (rev 123935)
@@ -1,3 +1,47 @@
+2012-07-27 Arnaud Renevier <[email protected]>
+
+ use createUninitialized when creating TypedArray from another array
+ https://bugs.webkit.org/show_bug.cgi?id=92518
+
+ Reviewed by Kenneth Russell.
+
+ Expose a createUninitialized static method on TypedArray classes.
+
+ * wtf/Float32Array.h:
+ (Float32Array):
+ (WTF::Float32Array::createUninitialized):
+ (WTF):
+ * wtf/Float64Array.h:
+ (Float64Array):
+ (WTF::Float64Array::createUninitialized):
+ (WTF):
+ * wtf/Int16Array.h:
+ (Int16Array):
+ (WTF::Int16Array::createUninitialized):
+ (WTF):
+ * wtf/Int32Array.h:
+ (Int32Array):
+ (WTF::Int32Array::createUninitialized):
+ (WTF):
+ * wtf/Int8Array.h:
+ (Int8Array):
+ (WTF::Int8Array::createUninitialized):
+ (WTF):
+ * wtf/Uint16Array.h:
+ (Uint16Array):
+ (WTF::Uint16Array::createUninitialized):
+ (WTF):
+ * wtf/Uint32Array.h:
+ (Uint32Array):
+ (WTF::Uint32Array::createUninitialized):
+ (WTF):
+ * wtf/Uint8Array.h:
+ (Uint8Array):
+ (WTF::Uint8Array::createUninitialized):
+ (WTF):
+ * wtf/Uint8ClampedArray.h:
+ (Uint8ClampedArray):
+
2012-07-27 Patrick Gansterer <[email protected]>
[WINCE] Use macros from ICU instead of defining the same functionality again
Modified: trunk/Source/WTF/wtf/Float32Array.h (123934 => 123935)
--- trunk/Source/WTF/wtf/Float32Array.h 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WTF/wtf/Float32Array.h 2012-07-27 23:32:19 UTC (rev 123935)
@@ -38,6 +38,10 @@
static inline PassRefPtr<Float32Array> create(const float* array, unsigned length);
static inline PassRefPtr<Float32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+ // Should only be used when it is known the entire array will be filled. Do
+ // not return these results directly to _javascript_ without filling first.
+ static inline PassRefPtr<Float32Array> createUninitialized(unsigned length);
+
// Can’t use "using" here due to a bug in the RVCT compiler.
bool set(TypedArrayBase<float>* array, unsigned offset) { return TypedArrayBase<float>::set(array, offset); }
@@ -79,6 +83,11 @@
return TypedArrayBase<float>::create<Float32Array>(buffer, byteOffset, length);
}
+PassRefPtr<Float32Array> Float32Array::createUninitialized(unsigned length)
+{
+ return TypedArrayBase<float>::createUninitialized<Float32Array>(length);
+}
+
Float32Array::Float32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: TypedArrayBase<float>(buffer, byteOffset, length)
{
Modified: trunk/Source/WTF/wtf/Float64Array.h (123934 => 123935)
--- trunk/Source/WTF/wtf/Float64Array.h 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WTF/wtf/Float64Array.h 2012-07-27 23:32:19 UTC (rev 123935)
@@ -38,6 +38,10 @@
static inline PassRefPtr<Float64Array> create(const double* array, unsigned length);
static inline PassRefPtr<Float64Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+ // Should only be used when it is known the entire array will be filled. Do
+ // not return these results directly to _javascript_ without filling first.
+ static inline PassRefPtr<Float64Array> createUninitialized(unsigned length);
+
// Can’t use "using" here due to a bug in the RVCT compiler.
bool set(TypedArrayBase<double>* array, unsigned offset) { return TypedArrayBase<double>::set(array, offset); }
@@ -79,6 +83,11 @@
return TypedArrayBase<double>::create<Float64Array>(buffer, byteOffset, length);
}
+PassRefPtr<Float64Array> Float64Array::createUninitialized(unsigned length)
+{
+ return TypedArrayBase<double>::createUninitialized<Float64Array>(length);
+}
+
Float64Array::Float64Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: TypedArrayBase<double>(buffer, byteOffset, length)
{
Modified: trunk/Source/WTF/wtf/Int16Array.h (123934 => 123935)
--- trunk/Source/WTF/wtf/Int16Array.h 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WTF/wtf/Int16Array.h 2012-07-27 23:32:19 UTC (rev 123935)
@@ -38,6 +38,10 @@
static inline PassRefPtr<Int16Array> create(const short* array, unsigned length);
static inline PassRefPtr<Int16Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+ // Should only be used when it is known the entire array will be filled. Do
+ // not return these results directly to _javascript_ without filling first.
+ static inline PassRefPtr<Int16Array> createUninitialized(unsigned length);
+
// Can’t use "using" here due to a bug in the RVCT compiler.
bool set(TypedArrayBase<short>* array, unsigned offset) { return TypedArrayBase<short>::set(array, offset); }
void set(unsigned index, double value) { IntegralTypedArrayBase<short>::set(index, value); }
@@ -73,6 +77,11 @@
return TypedArrayBase<short>::create<Int16Array>(buffer, byteOffset, length);
}
+PassRefPtr<Int16Array> Int16Array::createUninitialized(unsigned length)
+{
+ return TypedArrayBase<short>::createUninitialized<Int16Array>(length);
+}
+
Int16Array::Int16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: IntegralTypedArrayBase<short>(buffer, byteOffset, length)
{
Modified: trunk/Source/WTF/wtf/Int32Array.h (123934 => 123935)
--- trunk/Source/WTF/wtf/Int32Array.h 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WTF/wtf/Int32Array.h 2012-07-27 23:32:19 UTC (rev 123935)
@@ -37,6 +37,10 @@
static inline PassRefPtr<Int32Array> create(const int* array, unsigned length);
static inline PassRefPtr<Int32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+ // Should only be used when it is known the entire array will be filled. Do
+ // not return these results directly to _javascript_ without filling first.
+ static inline PassRefPtr<Int32Array> createUninitialized(unsigned length);
+
// Can’t use "using" here due to a bug in the RVCT compiler.
bool set(TypedArrayBase<int>* array, unsigned offset) { return TypedArrayBase<int>::set(array, offset); }
void set(unsigned index, double value) { IntegralTypedArrayBase<int>::set(index, value); }
@@ -72,6 +76,11 @@
return TypedArrayBase<int>::create<Int32Array>(buffer, byteOffset, length);
}
+PassRefPtr<Int32Array> Int32Array::createUninitialized(unsigned length)
+{
+ return TypedArrayBase<int>::createUninitialized<Int32Array>(length);
+}
+
Int32Array::Int32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: IntegralTypedArrayBase<int>(buffer, byteOffset, length)
{
Modified: trunk/Source/WTF/wtf/Int8Array.h (123934 => 123935)
--- trunk/Source/WTF/wtf/Int8Array.h 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WTF/wtf/Int8Array.h 2012-07-27 23:32:19 UTC (rev 123935)
@@ -39,6 +39,10 @@
static inline PassRefPtr<Int8Array> create(const signed char* array, unsigned length);
static inline PassRefPtr<Int8Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+ // Should only be used when it is known the entire array will be filled. Do
+ // not return these results directly to _javascript_ without filling first.
+ static inline PassRefPtr<Int8Array> createUninitialized(unsigned length);
+
// Can’t use "using" here due to a bug in the RVCT compiler.
bool set(TypedArrayBase<signed char>* array, unsigned offset) { return TypedArrayBase<signed char>::set(array, offset); }
void set(unsigned index, double value) { IntegralTypedArrayBase<signed char>::set(index, value); }
@@ -74,6 +78,11 @@
return TypedArrayBase<signed char>::create<Int8Array>(buffer, byteOffset, length);
}
+PassRefPtr<Int8Array> Int8Array::createUninitialized(unsigned length)
+{
+ return TypedArrayBase<signed char>::createUninitialized<Int8Array>(length);
+}
+
Int8Array::Int8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: IntegralTypedArrayBase<signed char>(buffer, byteOffset, length)
{
Modified: trunk/Source/WTF/wtf/Uint16Array.h (123934 => 123935)
--- trunk/Source/WTF/wtf/Uint16Array.h 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WTF/wtf/Uint16Array.h 2012-07-27 23:32:19 UTC (rev 123935)
@@ -39,6 +39,10 @@
static inline PassRefPtr<Uint16Array> create(const unsigned short* array, unsigned length);
static inline PassRefPtr<Uint16Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+ // Should only be used when it is known the entire array will be filled. Do
+ // not return these results directly to _javascript_ without filling first.
+ static inline PassRefPtr<Uint16Array> createUninitialized(unsigned length);
+
// Can’t use "using" here due to a bug in the RVCT compiler.
bool set(TypedArrayBase<unsigned short>* array, unsigned offset) { return TypedArrayBase<unsigned short>::set(array, offset); }
void set(unsigned index, double value) { IntegralTypedArrayBase<unsigned short>::set(index, value); }
@@ -74,6 +78,11 @@
return TypedArrayBase<unsigned short>::create<Uint16Array>(buffer, byteOffset, length);
}
+PassRefPtr<Uint16Array> Uint16Array::createUninitialized(unsigned length)
+{
+ return TypedArrayBase<unsigned short>::createUninitialized<Uint16Array>(length);
+}
+
Uint16Array::Uint16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: IntegralTypedArrayBase<unsigned short>(buffer, byteOffset, length)
{
Modified: trunk/Source/WTF/wtf/Uint32Array.h (123934 => 123935)
--- trunk/Source/WTF/wtf/Uint32Array.h 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WTF/wtf/Uint32Array.h 2012-07-27 23:32:19 UTC (rev 123935)
@@ -39,6 +39,10 @@
static inline PassRefPtr<Uint32Array> create(const unsigned int* array, unsigned length);
static inline PassRefPtr<Uint32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+ // Should only be used when it is known the entire array will be filled. Do
+ // not return these results directly to _javascript_ without filling first.
+ static inline PassRefPtr<Uint32Array> createUninitialized(unsigned length);
+
// Can’t use "using" here due to a bug in the RVCT compiler.
bool set(TypedArrayBase<unsigned int>* array, unsigned offset) { return TypedArrayBase<unsigned int>::set(array, offset); }
void set(unsigned index, double value) { IntegralTypedArrayBase<unsigned int>::set(index, value); }
@@ -74,6 +78,11 @@
return TypedArrayBase<unsigned int>::create<Uint32Array>(buffer, byteOffset, length);
}
+PassRefPtr<Uint32Array> Uint32Array::createUninitialized(unsigned length)
+{
+ return TypedArrayBase<unsigned int>::createUninitialized<Uint32Array>(length);
+}
+
Uint32Array::Uint32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: IntegralTypedArrayBase<unsigned int>(buffer, byteOffset, length)
{
Modified: trunk/Source/WTF/wtf/Uint8Array.h (123934 => 123935)
--- trunk/Source/WTF/wtf/Uint8Array.h 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WTF/wtf/Uint8Array.h 2012-07-27 23:32:19 UTC (rev 123935)
@@ -39,6 +39,10 @@
static inline PassRefPtr<Uint8Array> create(const unsigned char* array, unsigned length);
static inline PassRefPtr<Uint8Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
+ // Should only be used when it is known the entire array will be filled. Do
+ // not return these results directly to _javascript_ without filling first.
+ static inline PassRefPtr<Uint8Array> createUninitialized(unsigned length);
+
// Can’t use "using" here due to a bug in the RVCT compiler.
bool set(TypedArrayBase<unsigned char>* array, unsigned offset) { return TypedArrayBase<unsigned char>::set(array, offset); }
void set(unsigned index, double value) { IntegralTypedArrayBase<unsigned char>::set(index, value); }
@@ -74,6 +78,11 @@
return TypedArrayBase<unsigned char>::create<Uint8Array>(buffer, byteOffset, length);
}
+PassRefPtr<Uint8Array> Uint8Array::createUninitialized(unsigned length)
+{
+ return TypedArrayBase<unsigned char>::createUninitialized<Uint8Array>(length);
+}
+
Uint8Array::Uint8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: IntegralTypedArrayBase<unsigned char>(buffer, byteOffset, length)
{
Modified: trunk/Source/WTF/wtf/Uint8ClampedArray.h (123934 => 123935)
--- trunk/Source/WTF/wtf/Uint8ClampedArray.h 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WTF/wtf/Uint8ClampedArray.h 2012-07-27 23:32:19 UTC (rev 123935)
@@ -38,9 +38,8 @@
static inline PassRefPtr<Uint8ClampedArray> create(const unsigned char* array, unsigned length);
static inline PassRefPtr<Uint8ClampedArray> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
- // Should only be used for WebCore-internal use (like filters and
- // getImageData) when it is known the entire array will be filled.
- // Do not return these results directly to _javascript_.
+ // Should only be used when it is known the entire array will be filled. Do
+ // not return these results directly to _javascript_ without filling first.
static inline PassRefPtr<Uint8ClampedArray> createUninitialized(unsigned length);
// It's only needed to potentially call this method if the array
Modified: trunk/Source/WebCore/ChangeLog (123934 => 123935)
--- trunk/Source/WebCore/ChangeLog 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WebCore/ChangeLog 2012-07-27 23:32:19 UTC (rev 123935)
@@ -1,3 +1,21 @@
+2012-07-27 Arnaud Renevier <[email protected]>
+
+ use createUninitialized when creating TypedArray from another array
+ https://bugs.webkit.org/show_bug.cgi?id=92518
+
+ Reviewed by Kenneth Russell.
+
+ 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):
+
2012-07-27 Eli Fidler <[email protected]>
[BlackBerry] Adapt to change in the FontInfo platform API.
Modified: trunk/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h (123934 => 123935)
--- trunk/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h 2012-07-27 23:29:20 UTC (rev 123934)
+++ trunk/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h 2012-07-27 23:32:19 UTC (rev 123935)
@@ -99,7 +99,7 @@
return 0;
uint32_t length = asObject(exec->argument(0))->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
- RefPtr<C> array = C::create(length);
+ RefPtr<C> array = C::createUninitialized(length);
if (!array) {
setDOMException(exec, INDEX_SIZE_ERR);
return array;
@@ -212,7 +212,7 @@
JSC::JSObject* srcArray = asObject(exec->argument(0));
uint32_t length = srcArray->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
- RefPtr<C> array = C::create(length);
+ RefPtr<C> array = C::createUninitialized(length);
if (!array) {
setDOMException(exec, INDEX_SIZE_ERR);
return array;