| <p> |
| This page verifies that the single property optimization doesn't cause similar |
| looking objects to be given the same structure identifiers. If the test passes, |
| you'll see a PASS message below. |
| </p> |
| |
| <pre id="console"></pre> |
| |
| <script> |
| (function() { |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| function log(s) |
| { |
| if (this.document) |
| document.getElementById("console").appendChild(document.createTextNode(s + "\n")); |
| else |
| print(s + "\n"); |
| } |
| |
| function shouldBe(a, aDescription, b) |
| { |
| if (a === b) { |
| log("PASS: " + aDescription + " should be " + b + " and is."); |
| } else { |
| log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + "."); |
| } |
| } |
| |
| function getA(o) |
| { |
| return o.a; |
| } |
| |
| var o1 = { a: 1, x: 1 }; |
| var o2 = { b: 1, x: 1 }; |
| |
| getA(o1); |
| getA(o1); |
| |
| shouldBe(getA(o2), "getA(o2)", undefined); |
| })(); |
| </script> |