Debian Codegraph @

js/src/jit-test/tests/ion/inlining/getelem-getter-noninlined-call.js

raw
1 // With-Statements are not supported in Ion, therefore functions containing
2 // them can't be inlined in Ion. However it's still possible to inline the
3 // property access to the getter into a simple guard-shape instruction.
4
5 // Defined outside of the test functions to ensure they're recognised as
6 // constants in Ion.
7 var atom = "prop";
8 var symbol = Symbol();
9
10 function testAtom() {
11 var holder = {
12 get [atom]() {
13 with ({}) {
14 return 1;
15 }
16 }
17 };
18
19 function f() {
20 for (var i = 0; i < 1000; ++i) {
21 var x = holder[atom];
22 assertEq(x, 1);
23 }
24 }
25
26 for (var i = 0; i < 2; i++) {
27 f();
28 }
29 }
30 testAtom();
31
32 function testSymbol() {
33 var holder = {
34 get [symbol]() {
35 with ({}) {
36 return 1;
37 }
38 }
39 };
40
41 function f() {
42 for (var i = 0; i < 1000; ++i) {
43 var x = holder[symbol];
44 assertEq(x, 1);
45 }
46 }
47
48 for (var i = 0; i < 2; i++) {
49 f();
50 }
51 }
52 testSymbol();