forked from burg/timelapse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: http://svn.webkit.org/repository/webkit/trunk@123935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
commit-queue@webkit.org
committed
Jul 27, 2012
1 parent
5193ce9
commit 108c43a
Showing
17 changed files
with
243 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
LayoutTests/fast/canvas/webgl/array-constructor-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<html> | ||
<head> | ||
<script src="../../js/resources/js-test-pre.js"></script> | ||
<script src="resources/webgl-test.js"></script> | ||
</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="../../js/resources/js-test-post.js"></script> | ||
</body> | ||
</html> | ||
|
17 changes: 17 additions & 0 deletions
17
PerformanceTests/Bindings/typed-array-construct-from-array.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src="../resources/runner.js"></script> | ||
<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> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters