(obj)
| 5 | // Flags: --allow-natives-syntax --maglev |
| 6 | |
| 7 | function test(obj) { |
| 8 | var funs = [function(x) { |
| 9 | // Force a map check on x.x |
| 10 | x.size; |
| 11 | // Will be constantfolded |
| 12 | return Object.getPrototypeOf(x); |
| 13 | }, function(x) { |
| 14 | x.size; |
| 15 | try { |
| 16 | return Reflect.getPrototypeOf(x); |
| 17 | } catch(e) { |
| 18 | return x.__proto__; |
| 19 | } |
| 20 | }, function(x) { |
| 21 | x.size; |
| 22 | return x.__proto__; |
| 23 | }]; |
| 24 | funs.forEach((f) => { |
| 25 | %PrepareFunctionForOptimization(f); |
| 26 | f(obj); |
| 27 | %OptimizeMaglevOnNextCall(f); |
| 28 | assertTrue(f(obj) == Object.getPrototypeOf(obj)); |
| 29 | assertTrue(f(obj) == obj.__proto__); |
| 30 | assertFalse(f(obj) == 1); |
| 31 | }); |
| 32 | } |
| 33 | |
| 34 | test({}); |
| 35 | test({x:1}); |
no test coverage detected