js/src/jit-test/tests/ion/inlining/array-push.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 function test1() {
michael@0 2 function push(arr, x) {
michael@0 3 return arr.push(x);
michael@0 4 }
michael@0 5 var arr = [];
michael@0 6 for (var i=0; i<100; i++) {
michael@0 7 assertEq(push(arr, i), i + 1);
michael@0 8 }
michael@0 9 }
michael@0 10 test1();
michael@0 11
michael@0 12 function test2() {
michael@0 13 var arr;
michael@0 14 for (var i=0; i<60; i++) {
michael@0 15 arr = [];
michael@0 16 assertEq(arr.push(3.3), 1);
michael@0 17 assertEq(arr.push(undefined), 2);
michael@0 18 assertEq(arr.push(true), 3);
michael@0 19 assertEq(arr.push(Math), 4);
michael@0 20 assertEq(arr.toString(), "3.3,,true,[object Math]");
michael@0 21 }
michael@0 22 }
michael@0 23 test2();
michael@0 24
michael@0 25 function test3() {
michael@0 26 function push(arr, v) {
michael@0 27 arr.push(v);
michael@0 28 }
michael@0 29 for (var i=0; i<60; i++) {
michael@0 30 var arr = [];
michael@0 31 push(arr, null);
michael@0 32 push(arr, 3.14);
michael@0 33 push(arr, {});
michael@0 34 assertEq(arr.toString(), ",3.14,[object Object]");
michael@0 35 }
michael@0 36 }
michael@0 37 test3();

mercurial