Debian Codegraph @

js/src/jit-test/tests/debug/Frame-eval-20.js

raw
1 // |jit-test| --ion-osr=off
2
3 // Eval-in-frame with different type on non-youngest Ion frame.
4
5 load(libdir + "jitopts.js");
6
7 if (!jitTogglesMatch(Opts_Ion2NoOffthreadCompilation))
8 quit(0);
9
10 withJitOptions(Opts_Ion2NoOffthreadCompilation, function () {
11 function test(shadow) {
12 var g = newGlobal({newCompartment: true});
13 var dbg = new Debugger;
14
15 // Note that we depend on CCW scripted functions being opaque to Ion
16 // optimization for this test.
17 g.h = function h(d) {
18 if (d) {
19 dbg.addDebuggee(g);
20 var f = dbg.getNewestFrame().older;
21 assertEq(f.implementation, "ion");
22 assertEq(f.environment.getVariable("foo"), 42);
23
24 // EIF of a different type too.
25 f.eval((shadow ? "var " : "") + "foo = 'string of 42'");
26 g.expected = shadow ? 42 : "string of 42";
27 }
28 }
29
30 g.eval("" + function f(d) {
31 var foo = 42;
32 g(d);
33 return foo;
34 });
35 g.eval("" + function g(d) {
36 h(d);
37 });
38
39 g.eval("(" + function () {
40 for (i = 0; i < 5; i++)
41 f(false);
42 assertEq(f(true), "string of 42");
43 } + ")();");
44 }
45
46 test(false);
47 test(true);
48 });