Debian Codegraph @

js/src/jit-test/tests/jaeger/setPropTypeGuard.js

raw
1
2 /*
3 * Get a SETPROP site which is monitored (unknown lhs) and is repeatedly
4 * invoked on objects with the same shape but different types (and without
5 * triggering a recompile of the function). The SETPROP PIC needs a type guard
6 * when the object is being monitored.
7 */
8 var x = {g:0};
9 var y = {g:0,f:"fubar"};
10 x.f = 10;
11
12 function foo(x) {
13 for (var i = 0; i < 30; i++)
14 x.f = 10;
15 }
16 function access(x) {
17 return x.f + 10;
18 }
19 foo(Object.create({}));
20 eval("foo(x)");
21 assertEq(access(y), "fubar10");
22 eval("foo(y)");
23 assertEq(access(y), 20);