Bug 1283334 - Part 5: Do not sparsify dense arrays when freezing - Tests. r=jandem

--HG--
extra : rebase_source : 2f3fed3591809bba99a61b6f3f6242024122e2e5
extra : histedit_source : a3438c47c2c1fddefccd26e611e4705604684213
This commit is contained in:
Leo Gaspard 2016-08-23 19:02:06 -07:00
parent 6e5839fc27
commit 9efe6c6dc7
9 changed files with 102 additions and 1 deletions

View File

@ -0,0 +1,16 @@
"use strict";
var t = [4];
var stop;
Object.freeze(t);
do {
let ok = false;
stop = inIon();
try {
t[1] = 2;
} catch(e) {
ok = true;
}
assertEq(ok, true);
assertEq(t.length, 1);
assertEq(t[1], undefined);
} while (!stop);

View File

@ -0,0 +1,9 @@
var t = [4];
var stop;
Object.freeze(t);
do {
stop = inIon();
t[1] = 2;
assertEq(t.length, 1);
assertEq(t[1], undefined);
} while (!stop);

View File

@ -0,0 +1,14 @@
function foo(x) {
"use strict";
var ok = false;
try {
x.c = 10;
} catch(e) {
ok = true;
}
assertEq(ok, true);
assertEq(x.c, undefined);
}
x = {a:0,b:1};
Object.freeze(x);
foo(x);

View File

@ -0,0 +1,7 @@
function foo(x) {
x.c = 10;
assertEq(x.c, undefined);
}
x = {a:0,b:1};
Object.freeze(x);
foo(x);

View File

@ -0,0 +1,20 @@
// |jit-test| --no-threads; --ion-eager; --ion-shared-stubs=off
setJitCompilerOption('ion.forceinlineCaches', 1);
function foo(t) {
"use strict";
var stop;
do {
let ok = false;
stop = inIon();
try {
t[0] = 2;
} catch(e) {
ok = true;
}
assertEq(ok, true);
} while (!stop);
}
var t = [4];
Object.freeze(t);
foo(t);
foo(t);

View File

@ -0,0 +1,14 @@
"use strict";
var t = [4];
var stop;
Object.freeze(t);
do {
let ok = false;
stop = inIon();
try {
t[0] = 2;
} catch(e) {
ok = true;
}
assertEq(ok, true);
} while (!stop);

View File

@ -0,0 +1,8 @@
var t = [4];
var stop;
Object.freeze(t);
do {
stop = inIon();
t[0] = 2;
assertEq(t[0], 4);
} while (!stop);

View File

@ -0,0 +1,14 @@
function foo(x) {
"use strict";
var ok = false;
try {
x.a = 10;
} catch(e) {
ok = true;
}
assertEq(ok, true);
assertEq(x.a, 0);
}
x = {a:0,b:1};
Object.freeze(x);
foo(x);

View File

@ -1,4 +1,3 @@
function foo(x) {
x.a = 10;
assertEq(x.a, 0);