| OLD | NEW |
| (Empty) |
| 1 <body> | |
| 2 <head> | |
| 3 <script> | |
| 4 if (window.testRunner) | |
| 5 testRunner.dumpAsText(); | |
| 6 if (window.internals) | |
| 7 internals.setJavaScriptProfilingEnabled(true); | |
| 8 | |
| 9 function log(s) | |
| 10 { | |
| 11 if (this.document) | |
| 12 document.getElementById("console").appendChild(document.createTextNode(s
+ "\n")); | |
| 13 else | |
| 14 print(s + "\n"); | |
| 15 } | |
| 16 | |
| 17 function shouldBe(a, aDescription, b) | |
| 18 { | |
| 19 if (a === b) | |
| 20 log("PASS: " + aDescription + " should be " + b + " and is.\n"); | |
| 21 else | |
| 22 log("FAIL: " + aDescription + " should be " + b + " but instead is " + a
+ ".\n"); | |
| 23 } | |
| 24 | |
| 25 function localCallTest(a, b) | |
| 26 { | |
| 27 function localCall(o) | |
| 28 { | |
| 29 return o.toString(); | |
| 30 } | |
| 31 return [localCall(a), b][1]; | |
| 32 } | |
| 33 | |
| 34 function globalCall(o) | |
| 35 { | |
| 36 return o.toString(); | |
| 37 } | |
| 38 | |
| 39 function globalCallTest(a, b) | |
| 40 { | |
| 41 return [globalCall(a), b][1]; | |
| 42 } | |
| 43 | |
| 44 function scopedCallTest(a, b) | |
| 45 { | |
| 46 function scopedCall(o) | |
| 47 { | |
| 48 return o.toString(); | |
| 49 } | |
| 50 | |
| 51 function f() | |
| 52 { | |
| 53 return [scopedCall(a), b][1]; | |
| 54 } | |
| 55 | |
| 56 return f(); | |
| 57 } | |
| 58 | |
| 59 function resolveCallTest(a, b) | |
| 60 { | |
| 61 o = { resolvedCall: function(o) { return o.toString(); }}; | |
| 62 with (o) { | |
| 63 return [resolvedCall(o), b][1]; | |
| 64 } | |
| 65 } | |
| 66 | |
| 67 function bracketCallTest(a, b) | |
| 68 { | |
| 69 return [a["toString"](), b][1]; | |
| 70 } | |
| 71 | |
| 72 function dotCallTest(a, b) | |
| 73 { | |
| 74 return [a.toString(), b][1]; | |
| 75 } | |
| 76 | |
| 77 function testConstructor(o) | |
| 78 { | |
| 79 return o.toString(); | |
| 80 } | |
| 81 | |
| 82 function newTest(a, b) | |
| 83 { | |
| 84 return [new testConstructor(a), b][1]; | |
| 85 } | |
| 86 | |
| 87 function startTest() | |
| 88 { | |
| 89 shouldBe(localCallTest(1, 2), "localCallTest(1, 2)", 2); | |
| 90 shouldBe(globalCallTest(1, 2), "globalCallTest(1, 2)", 2); | |
| 91 shouldBe(scopedCallTest(1, 2), "scopedCallTest(1, 2)", 2); | |
| 92 shouldBe(resolveCallTest(1, 2), "resolveCallTest(1, 2)", 2); | |
| 93 shouldBe(bracketCallTest(1, 2), "bracketCallTest(1, 2)", 2); | |
| 94 shouldBe(dotCallTest(1, 2), "dotCallTest(1, 2)", 2); | |
| 95 shouldBe(newTest(1, 2), "newTest(1, 2)", 2); | |
| 96 } | |
| 97 </script> | |
| 98 </head> | |
| 99 <body onload="startTest()"> | |
| 100 <p> | |
| 101 This page tests that the generation of bytecode allocates registers correctly wh
en profiling is enabled. To run the test manually, enable profiling in the web i
nspector and reload this page. | |
| 102 </p> | |
| 103 <pre id="console"></pre> | |
| 104 </body> | |
| 105 </html> | |
| OLD | NEW |