Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / dfg-cross-global-object-inline-new-array.js
blob3cd29adfa3b2a2c9fd096c71843ce5282c3b8b44
1 description(
2 "This tests that function inlining in the DFG JIT doesn't get confused about the global object to use for array allocation."
3 );
5 window.jsTestIsAsync = true;
7 function foo() {
8 return new Array();
11 Array.prototype.thingy = 24;
13 function done(value) {
14 var expected = 24 * 200;
15 if (value == expected)
16 testPassed("done() called with " + expected);
17 else
18 testFailed("done() called with " + value + ", but expected " + expected);
19 finishJSTest();
22 function doit() {
23 document.getElementById("frameparent").innerHTML = "";
24 document.getElementById("frameparent").innerHTML = "<iframe id='testframe'>";
25 var testFrame = document.getElementById("testframe");
26 testFrame.contentDocument.open();
28 code = "<!DOCTYPE html>\n<head></head><body><script type=\"text/javascript\">\n";
29 code += "Array.prototype.thingy = 42;\n";
30 code += "function bar() {\n";
31 code += " return window.parent.foo();\n";
32 code += "}\n";
33 code += "var result = 0;\n";
34 code += "for (var i = 0; i < 200; ++i)\n";
35 code += " result += bar().thingy;\n";
36 code += "window.parent.done(result);\n";
37 code += "</script></body></html>";
39 testFrame.contentDocument.write(code);
40 testFrame.contentDocument.close();
43 window.setTimeout(doit, 10);