Debian Codegraph @

js/src/jit-test/tests/xdr/function-flags.js

raw
1 load(libdir + 'bytecode-cache.js');
2
3 var test;
4
5 // Ensure that if a function is encoded we don't encode its "name
6 // resolved" flag.
7 test = `
8 function f() { delete f.name; return f.hasOwnProperty('name'); }
9 f();
10 `
11 evalWithCache(test, { assertEqBytecode: true, assertEqResult: true });
12
13 test = `
14 function f() { return f.hasOwnProperty('name'); }
15 f();
16 `
17 evalWithCache(test, { assertEqBytecode: true, assertEqResult: true });
18
19 // Ensure that if a function is encoded we don't encode its "length
20 // resolved" flag.
21 test = `
22 function f() { delete f.length; return f.hasOwnProperty('length'); }
23 f();
24 `
25 evalWithCache(test, { assertEqBytecode: true, assertEqResult: true });
26
27 test = `
28 function f() { return f.hasOwnProperty('length'); }
29 f();
30 `
31 evalWithCache(test, { assertEqBytecode: true, assertEqResult: true });
32
33 // And make sure our bytecode is actually not reflecting the flags,
34 // not that we ignore them on decode.
35 test = `
36 function f() { return f.hasOwnProperty('length') || f.hasOwnProperty('name'); }
37 f();
38 `
39 evalWithCache(test, { assertEqBytecode: true, assertEqResult: true });
40