Reviewers: rossberg,
Message:
I have removed all non-ES6-complaint tests from our mjsunit tests. This is
structured so that our current d8 implementation passes (so at the moment,
these
tests pass with or without --harmony-typed-arrays). All "new" tests (where
d8
implementation fails but harmony typed arrays do not and should not) are in
harmony/typedarrays.js
https://codereview.chromium.org/14580012/diff/4001/test/mjsunit/external-array-no-sse2.js
File test/mjsunit/external-array-no-sse2.js (left):
https://codereview.chromium.org/14580012/diff/4001/test/mjsunit/external-array-no-sse2.js#oldcode57
test/mjsunit/external-array-no-sse2.js:57:
This does not fail per ES6 spec
https://codereview.chromium.org/14580012/diff/4001/test/mjsunit/external-array-no-sse2.js#oldcode169
test/mjsunit/external-array-no-sse2.js:169: assertEquals(42,
a.BYTES_PER_ELEMENT);
Property is readonly per ES6 spec.
https://codereview.chromium.org/14580012/diff/4001/test/mjsunit/external-array-no-sse2.js#oldcode205
test/mjsunit/external-array-no-sse2.js:205:
array_with_length_from_non_number = new Int32Array(undefined);
Spec is currently unclear on what should happen for these cases (due to
overload resolution and array-like objects).
All these tests do not currently work in webkit implementation.
https://codereview.chromium.org/14580012/diff/4001/test/mjsunit/external-array-no-sse2.js#oldcode363
test/mjsunit/external-array-no-sse2.js:363: assertEquals(2, a.length);
'length' is now a property on the prototype so delete here has no
effect.
https://codereview.chromium.org/14580012/diff/4001/test/mjsunit/external-array-no-sse2.js#oldcode543
test/mjsunit/external-array-no-sse2.js:543:
a.subarray() is a valid call per ES6 (returns a copy of an array)
Description:
Update mjsunit tests to be complaian with ES6 implementation of typed arrays
[email protected]
Please review this at https://codereview.chromium.org/14580012/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M test/mjsunit/external-array-no-sse2.js
M test/mjsunit/external-array.js
Index: test/mjsunit/external-array-no-sse2.js
diff --git a/test/mjsunit/external-array-no-sse2.js
b/test/mjsunit/external-array-no-sse2.js
index
0b843d865f728fbd98a8e44ca0b2db68dd06b72d..b3d91a534c0ef450fa5b090dce6370cab1c4f6a9
100644
--- a/test/mjsunit/external-array-no-sse2.js
+++ b/test/mjsunit/external-array-no-sse2.js
@@ -49,12 +49,6 @@ f(a);
assertEquals(0, a[0]);
assertEquals(0, a[1]);
-// No-parameter constructor should fail right now.
-function abfunc1() {
- return new ArrayBuffer();
-}
-assertThrows(abfunc1);
-
// Test derivation from an ArrayBuffer
var ab = new ArrayBuffer(12);
assertInstance(ab, ArrayBuffer);
@@ -161,12 +155,10 @@ assertSame(a.buffer, (new
Float32Array(a.buffer,4)).buffer);
assertSame(a.buffer, (new Int8Array(a.buffer,3,51)).buffer);
assertInstance(a.buffer, ArrayBuffer);
-// Test the correct behavior of the |BYTES_PER_ELEMENT| property (which is
-// "constant", but not read-only).
+// Test the correct behavior of the |BYTES_PER_ELEMENT| property.
a = new Int32Array(2);
assertEquals(4, a.BYTES_PER_ELEMENT);
a.BYTES_PER_ELEMENT = 42;
-assertEquals(42, a.BYTES_PER_ELEMENT);
a = new Uint8Array(2);
assertEquals(1, a.BYTES_PER_ELEMENT);
a = new Int16Array(2);
@@ -202,15 +194,6 @@ assertEquals(3.5, get(array, 1));
// Test non-number parameters.
var array_with_length_from_non_number = new Int32Array("2");
assertEquals(2, array_with_length_from_non_number.length);
-array_with_length_from_non_number = new Int32Array(undefined);
-assertEquals(0, array_with_length_from_non_number.length);
-var foo = { valueOf: function() { return 3; } };
-array_with_length_from_non_number = new Int32Array(foo);
-assertEquals(3, array_with_length_from_non_number.length);
-foo = { toString: function() { return "4"; } };
-array_with_length_from_non_number = new Int32Array(foo);
-assertEquals(4, array_with_length_from_non_number.length);
-
// Test loads and stores.
types = [Array, Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array,
@@ -359,8 +342,6 @@ for (var t = 0; t < types.length; t++) {
a.length = 2;
assertEquals(kElementCount, a.length);
assertTrue(delete a.length);
- a.length = 2;
- assertEquals(2, a.length);
// Make sure bounds checks are handled correctly for external arrays.
run_bounds_test(a);
@@ -539,8 +520,6 @@ 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
Index: test/mjsunit/external-array.js
diff --git a/test/mjsunit/external-array.js b/test/mjsunit/external-array.js
index
85a8cc584724d2e3e11a4953607893153193f27f..3108c3bf193183d14e37eacc03bb1991aeccfb79
100644
--- a/test/mjsunit/external-array.js
+++ b/test/mjsunit/external-array.js
@@ -49,12 +49,6 @@ f(a);
assertEquals(0, a[0]);
assertEquals(0, a[1]);
-// No-parameter constructor should fail right now.
-function abfunc1() {
- return new ArrayBuffer();
-}
-assertThrows(abfunc1);
-
// Test derivation from an ArrayBuffer
var ab = new ArrayBuffer(12);
assertInstance(ab, ArrayBuffer);
@@ -161,12 +155,9 @@ assertSame(a.buffer, (new
Float32Array(a.buffer,4)).buffer);
assertSame(a.buffer, (new Int8Array(a.buffer,3,51)).buffer);
assertInstance(a.buffer, ArrayBuffer);
-// Test the correct behavior of the |BYTES_PER_ELEMENT| property (which is
-// "constant", but not read-only).
+// Test the correct behavior of the |BYTES_PER_ELEMENT| property
a = new Int32Array(2);
assertEquals(4, a.BYTES_PER_ELEMENT);
-a.BYTES_PER_ELEMENT = 42;
-assertEquals(42, a.BYTES_PER_ELEMENT);
a = new Uint8Array(2);
assertEquals(1, a.BYTES_PER_ELEMENT);
a = new Int16Array(2);
@@ -202,15 +193,6 @@ assertEquals(3.5, get(array, 1));
// Test non-number parameters.
var array_with_length_from_non_number = new Int32Array("2");
assertEquals(2, array_with_length_from_non_number.length);
-array_with_length_from_non_number = new Int32Array(undefined);
-assertEquals(0, array_with_length_from_non_number.length);
-var foo = { valueOf: function() { return 3; } };
-array_with_length_from_non_number = new Int32Array(foo);
-assertEquals(3, array_with_length_from_non_number.length);
-foo = { toString: function() { return "4"; } };
-array_with_length_from_non_number = new Int32Array(foo);
-assertEquals(4, array_with_length_from_non_number.length);
-
// Test loads and stores.
types = [Array, Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array,
@@ -359,8 +341,6 @@ for (var t = 0; t < types.length; t++) {
a.length = 2;
assertEquals(kElementCount, a.length);
assertTrue(delete a.length);
- a.length = 2;
- assertEquals(2, a.length);
// Make sure bounds checks are handled correctly for external arrays.
run_bounds_test(a);
@@ -452,7 +432,6 @@ assertEquals(0, a.length);
a[0] = 1;
assertEquals(undefined, a[0]);
-
// Check construction from arrays.
a = new Uint32Array([]);
assertInstance(a, Uint32Array);
@@ -539,8 +518,6 @@ 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
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.