blob: b46c16516eca5868104f2ed796e69af76323649c [file] [log] [blame]
keith_miller@apple.com34199b62016-10-18 23:40:10 +00001
2// Test GetByVal => GetById conversion works correctly when inlining a getter in the DFG.
3function foo(obj, val) {
4 if (obj[val]) {
5 return 1;
6 }
7 return 0;
8}
9noInline(foo);
10
11
12o = { num: 0,
13 get hello() {
14 if (this.num === 1)
15 return true;
16 return false;
17 }
18 };
19
20for(i = 0; i < 100000; ++i) {
21 let num = i % 2;
22 o.num = num;
23 if (foo(o, "hello") !== num)
24 throw new Error("bad result on iteration: " + i);
25}