2 "This tests that function inlining in the DFG JIT doesn't get confused by different global objects."
5 if (window.layoutTestController)
6 layoutTestController.waitUntilDone();
14 shouldBe("foo(3)", "324");
16 function done(value) {
17 var expected = 5770500;
18 if (value == expected)
19 testPassed("done() called with " + expected);
21 testFailed("done() is " + value + " and should be " + expected + ".");
22 layoutTestController.notifyDone();
26 document.getElementById("frameparent").innerHTML = "";
27 document.getElementById("frameparent").innerHTML = "<iframe id='testframe'>";
28 var testFrame = document.getElementById("testframe");
29 testFrame.contentDocument.open();
31 code = "<!DOCTYPE html>\n<head></head><body><script type=\"text/javascript\">\n";
33 // Make sure that we get as many variables as the parent.
34 for (var i = 0; i < 100; ++i)
35 code += "var b" + i + " = " +i + ";\n";
37 code += "result = 0;\n" +
38 "function bar(a) {\n" +
39 " var foo = window.parent.foo;\n" +
42 for (var i = 0; i < 100; ++i)
43 code += "b" + i + " + ";
47 "for (var i = 0; i < 1000; ++i) {\n" +
48 " result += bar(i);\n" +
50 "window.parent.done(result);\n" +
51 "</script></body></html>"
53 testFrame.contentDocument.write(code);
54 testFrame.contentDocument.close();
57 window.setTimeout(doit, 10);