Commit 1590a5d6 authored by rossberg@chromium.org's avatar rossberg@chromium.org

Added tests for calling typed array constructors as functions.

R=danno@chromium.org
BUG=v8:1497
TEST=

Review URL: https://chromiumcodereview.appspot.com/10701055

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11968 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 771ba7ae
......@@ -540,3 +540,28 @@ assertSame(a.buffer, aa.buffer);
assertThrows(function(){ a.subarray.call({}, 0) });
assertThrows(function(){ a.subarray.call([], 0) });
assertThrows(function(){ a.subarray.call(a) });
// Call constructors directly as functions, and through .call and .apply
b = ArrayBuffer(100)
a = Int8Array(b, 5, 77)
assertInstance(b, ArrayBuffer)
assertInstance(a, Int8Array)
assertSame(b, a.buffer)
assertEquals(5, a.byteOffset)
assertEquals(77, a.byteLength)
b = ArrayBuffer.call(null, 10)
a = Uint16Array.call(null, b, 2, 4)
assertInstance(b, ArrayBuffer)
assertInstance(a, Uint16Array)
assertSame(b, a.buffer)
assertEquals(2, a.byteOffset)
assertEquals(8, a.byteLength)
b = ArrayBuffer.apply(null, [1000])
a = Float32Array.apply(null, [b, 128, 1])
assertInstance(b, ArrayBuffer)
assertInstance(a, Float32Array)
assertSame(b, a.buffer)
assertEquals(128, a.byteOffset)
assertEquals(4, a.byteLength)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment