Index: test/mjsunit/typed-array-slice.js |
diff --git a/test/mjsunit/compiler/regress-loadfield.js b/test/mjsunit/typed-array-slice.js |
similarity index 63% |
copy from test/mjsunit/compiler/regress-loadfield.js |
copy to test/mjsunit/typed-array-slice.js |
index a3da156e3b9ac3363ce6620541b108fc2ff5083d..15b23ffd3084081187e07a327c442e51fa2071d5 100644 |
--- a/test/mjsunit/compiler/regress-loadfield.js |
+++ b/test/mjsunit/typed-array-slice.js |
@@ -27,43 +27,34 @@ |
// Flags: --allow-natives-syntax |
-// Regression test for GVN on field loads. |
+// This is a regression test for overlapping key and value registers. |
-function bar() {} |
+types = [Array, Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, |
+ Uint32Array, Uint8ClampedArray, Float32Array, Float64Array]; |
-// Make sure there is a transition on adding "bar" inobject property. |
-var b = new bar(); |
-b.bar = "bar"; |
+results1 = [-2, -2, 254, -2, 65534, -2, 4294967294, 0, -2, -2]; |
+results2 = [undefined, -1, 255, -1, 65535, -1, 4294967295, 0, -1, -1]; |
+results3 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
+results4 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; |
rossberg
2012/07/02 10:40:21
Could you declare all the above variables with 'va
|
-function test(a) { |
- var b = new Array(10); |
- for (var i = 0; i < 10; i++) { |
- b[i] = new bar(); |
- } |
+const kElementCount = 40; |
- for (var i = 0; i < 10; i++) { |
- b[i].bar = a.foo; |
- } |
+function do_slice(a) { |
+ return Array.prototype.slice.call(a, 4, 8); |
} |
-// Create an object with fast backing store properties. |
-var a = {}; |
-a.p1 = ""; |
-a.p2 = ""; |
-a.p3 = ""; |
-a.p4 = ""; |
-a.p5 = ""; |
-a.p6 = ""; |
-a.p7 = ""; |
-a.p8 = ""; |
-a.p9 = ""; |
-a.p10 = ""; |
-a.p11 = ""; |
-a.foo = "foo"; |
-for (var i = 0; i < 5; i++) { |
- test(a); |
+for (var t = 0; t < types.length; t++) { |
+ var type = types[t]; |
+ var a = new type(kElementCount); |
+ for (i = 0; i < kElementCount; ++i ) { |
rossberg
2012/07/02 10:40:21
This could take a 'var', too.
|
+ a[i] = i-6; |
+ } |
+ delete a[5]; |
+ var sliced = do_slice(a); |
+ |
+ %ClearFunctionTypeFeedback(do_slice); |
+ assertEquals(results1[t], sliced[0]); |
+ assertEquals(results2[t], sliced[1]); |
+ assertEquals(results3[t], sliced[2]); |
+ assertEquals(results4[t], sliced[3]); |
} |
-%OptimizeFunctionOnNextCall(test); |
-test(a); |
- |
-test(""); |