michael@0: // RegExp.exec -> RegExp.test optimization should use the builtin test method. michael@0: function f() { michael@0: var res = 0; michael@0: for (var i=0; i<100; i++) { michael@0: if (/a/.exec("a")) michael@0: res++; michael@0: } michael@0: assertEq(res, 100); michael@0: } michael@0: delete RegExp.prototype.test; michael@0: gc(); michael@0: f(); michael@0: michael@0: RegExp.prototype.test = function() { assertEq(0, 1); } michael@0: gc(); michael@0: f(); michael@0: michael@0: Object.defineProperty(RegExp.prototype, "test", {get: function() { assertEq(0, 1); }}); michael@0: gc(); michael@0: f();