| Index: test/webkit/dfg-patchable-get-by-id-after-watchpoint.js
|
| diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/dfg-patchable-get-by-id-after-watchpoint.js
|
| similarity index 61%
|
| copy from test/webkit/concat-while-having-a-bad-time.js
|
| copy to test/webkit/dfg-patchable-get-by-id-after-watchpoint.js
|
| index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..9866126ef09bafb7ca15f1b9a595ecb5f96a6215 100644
|
| --- a/test/webkit/concat-while-having-a-bad-time.js
|
| +++ b/test/webkit/dfg-patchable-get-by-id-after-watchpoint.js
|
| @@ -22,10 +22,49 @@
|
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| description(
|
| -"Tests the behavior of Array.prototype.concat while the array is having a bad time due to one of the elements we are concatenating."
|
| +"This tests that a patchable GetById right after a watchpoint has the appropriate nop padding."
|
| );
|
|
|
| -Object.defineProperty(Array.prototype, 0, { writable: false });
|
| -shouldBe("[42].concat()", "[42]");
|
| +function foo(o, p) {
|
| + var a = p.f;
|
| + var b = o.f; // Watchpoint.
|
| + var c = p.g; // Patchable GetById.
|
| + return b(a + c);
|
| +}
|
|
|
| +function O() {
|
| +}
|
| +
|
| +O.prototype.f = function(x) { return x + 1; };
|
| +
|
| +var o = new O();
|
| +
|
| +function P1() {
|
| +}
|
| +
|
| +P1.prototype.g = 42;
|
| +
|
| +function P2() {
|
| +}
|
| +
|
| +P2.prototype.g = 24;
|
| +
|
| +var p1 = new P1();
|
| +var p2 = new P2();
|
| +
|
| +p1.f = 1;
|
| +p2.f = 2;
|
| +
|
| +for (var i = 0; i < 200; ++i) {
|
| + var p = (i % 2) ? p1 : p2;
|
| + var expected = (i % 2) ? 44 : 27;
|
| + if (i == 150) {
|
| + // Cause first the watchpoint on o.f to fire, and then the GetById
|
| + // to be reset.
|
| + O.prototype.g = 57; // Fire the watchpoint.
|
| + P1.prototype.h = 58; // Reset the GetById.
|
| + P2.prototype.h = 59; // Not necessary, but what the heck - this resets the GetById even more.
|
| + }
|
| + shouldBe("foo(o, p)", "" + expected);
|
| +}
|
|
|
|
|