summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/v8/test/mjsunit/external-array.js
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2012-04-17 11:03:39 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-26 08:55:55 +0200
commit227e72d1bba70d518639996aab4146b060507cd6 (patch)
tree723564e760e94a7d205a3d3300c44192e1d2f2e1 /src/3rdparty/v8/test/mjsunit/external-array.js
parent5b1fcb16da41f711f27f2e8ff84de8b70a30b645 (diff)
Updated V8 from git://github.com/v8/v8.git to 57f8959fb264354ba1a2e5118db512f588917061
Update V8 source to version 3.10.1. * Added optimizations and stability improvements on all platforms. * Various performance improvements. * Cleanup ScopeInfo and SerializedScopeInfo. * Introduce extended mode. * Implemented performance improvements to the incremental garbage collector. * Fixed handling of arrays in DefineOwnProperty. (issue 1756) * Fixed GCC 4.7 warnings. * Performance improvements for large Smi-only arrays. * Reduce the space used by the stack for the profiling thread. * Reduced memory use immediately after starting V8. * Fixed VFP detection through compiler defines. (issue 1996) * Remove static initializers in v8. (issue 1859) * Optimized boot-up memory use. * Optimized regular expressions. Change-Id: I2dad3092612de279179950dae4dd43daf0463a9f Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src/3rdparty/v8/test/mjsunit/external-array.js')
-rw-r--r--src/3rdparty/v8/test/mjsunit/external-array.js80
1 files changed, 79 insertions, 1 deletions
diff --git a/src/3rdparty/v8/test/mjsunit/external-array.js b/src/3rdparty/v8/test/mjsunit/external-array.js
index 81c6cfe..32f78a7 100644
--- a/src/3rdparty/v8/test/mjsunit/external-array.js
+++ b/src/3rdparty/v8/test/mjsunit/external-array.js
@@ -1,4 +1,4 @@
-// Copyright 2011 the V8 project authors. All rights reserved.
+// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -43,6 +43,50 @@ 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);
+var derived_uint8 = new Uint8Array(ab);
+assertEquals(12, derived_uint8.length);
+var derived_uint32 = new Uint32Array(ab);
+assertEquals(3, derived_uint32.length);
+var derived_uint32_2 = new Uint32Array(ab,4);
+assertEquals(2, derived_uint32_2.length);
+var derived_uint32_3 = new Uint32Array(ab,4,1);
+assertEquals(1, derived_uint32_3.length);
+
+// If a given byteOffset and length references an area beyond the end of the
+// ArrayBuffer an exception is raised.
+function abfunc3() {
+ new Uint32Array(ab,4,3);
+}
+assertThrows(abfunc3);
+function abfunc4() {
+ new Uint32Array(ab,16);
+}
+assertThrows(abfunc4);
+
+// The given byteOffset must be a multiple of the element size of the specific
+// type, otherwise an exception is raised.
+function abfunc5() {
+ new Uint32Array(ab,5);
+}
+assertThrows(abfunc5);
+
+// If length is not explicitly specified, the length of the ArrayBuffer minus
+// the byteOffset must be a multiple of the element size of the specific type,
+// or an exception is raised.
+var ab2 = new ArrayBuffer(13);
+function abfunc6() {
+ new Uint32Array(ab2,4);
+}
+assertThrows(abfunc6);
+
// Test the correct behavior of the |BYTES_PER_ELEMENT| property (which is
// "constant", but not read-only).
a = new Int32Array(2);
@@ -273,3 +317,37 @@ for (var t = 0; t < types.length; t++) {
%DeoptimizeFunction(array_load_set_smi_check2);
gc(); // Makes V8 forget about type information for array_load_set_smi_check.
}
+
+// Check handling of undefined in 32- and 64-bit external float arrays.
+
+function store_float32_undefined(ext_array) {
+ ext_array[0] = undefined;
+}
+
+var float32_array = new Float32Array(1);
+// Make sure runtime does it right
+store_float32_undefined(float32_array);
+assertTrue(isNaN(float32_array[0]));
+// Make sure the ICs do it right
+store_float32_undefined(float32_array);
+assertTrue(isNaN(float32_array[0]));
+// Make sure that Cranskshft does it right.
+%OptimizeFunctionOnNextCall(store_float32_undefined);
+store_float32_undefined(float32_array);
+assertTrue(isNaN(float32_array[0]));
+
+function store_float64_undefined(ext_array) {
+ ext_array[0] = undefined;
+}
+
+var float64_array = new Float64Array(1);
+// Make sure runtime does it right
+store_float64_undefined(float64_array);
+assertTrue(isNaN(float64_array[0]));
+// Make sure the ICs do it right
+store_float64_undefined(float64_array);
+assertTrue(isNaN(float64_array[0]));
+// Make sure that Cranskshft does it right.
+%OptimizeFunctionOnNextCall(store_float64_undefined);
+store_float64_undefined(float64_array);
+assertTrue(isNaN(float64_array[0]));