summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/xdr/function-flags.js
blob: 62c69752b7affd44ad6845569eea2616c9a2186a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
load(libdir + 'bytecode-cache.js');

var test;

// Ensure that if a function is encoded we don't encode its "name
// resolved" flag.
test = `
  function f() { delete f.name; return f.hasOwnProperty('name'); }
  f();
  `
evalWithCache(test, { assertEqBytecode: true, assertEqResult: true });

test = `
  function f() { return f.hasOwnProperty('name'); }
  f();
  `
evalWithCache(test, { assertEqBytecode: true, assertEqResult: true });

// Ensure that if a function is encoded we don't encode its "length
// resolved" flag.
test = `
  function f() { delete f.length; return f.hasOwnProperty('length'); }
  f();
  `
evalWithCache(test, { assertEqBytecode: true, assertEqResult: true });

test = `
  function f() { return f.hasOwnProperty('length'); }
  f();
  `
evalWithCache(test, { assertEqBytecode: true, assertEqResult: true });

// And make sure our bytecode is actually not reflecting the flags,
// not that we ignore them on decode.
test = `
  function f() { return f.hasOwnProperty('length') || f.hasOwnProperty('name'); }
  f();
  `
evalWithCache(test, { assertEqBytecode: true, assertEqResult: true });