| Index: test/mjsunit/regress/regress-2437.js
|
| diff --git a/test/mjsunit/compiler/optimized-closures.js b/test/mjsunit/regress/regress-2437.js
|
| similarity index 59%
|
| copy from test/mjsunit/compiler/optimized-closures.js
|
| copy to test/mjsunit/regress/regress-2437.js
|
| index eaf75f8d00ccd9123ed0f5232a91137845fc3973..06b69b23db8feae21ac013bf23d2d3fff467bbea 100644
|
| --- a/test/mjsunit/compiler/optimized-closures.js
|
| +++ b/test/mjsunit/regress/regress-2437.js
|
| @@ -25,33 +25,51 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Flags: --allow-natives-syntax
|
| +// Test Regexp.prototype.exec
|
| +r = /a/;
|
| +r.lastIndex = 1;
|
| +r.exec("zzzz");
|
| +assertEquals(0, r.lastIndex);
|
|
|
| -// Test optimized closures.
|
| +// Test Regexp.prototype.test
|
| +r = /a/;
|
| +r.lastIndex = 1;
|
| +r.test("zzzz");
|
| +assertEquals(0, r.lastIndex);
|
|
|
| -var a = new Array(100);
|
| +// Test String.prototype.match
|
| +r = /a/;
|
| +r.lastIndex = 1;
|
| +"zzzz".match(r);
|
| +assertEquals(0, r.lastIndex);
|
|
|
| -function f() {
|
| - var x=0;
|
| - for (var i=0; i<100; i++) {
|
| - var g = function goo(y) {
|
| - function h() {
|
| - if (goo.arguments[0] == 23) return -42;
|
| - return 42;
|
| - }
|
| - return x + y + h(y);
|
| - }
|
| - g(0);
|
| - %OptimizeFunctionOnNextCall(g);
|
| - a[i] = g(i);
|
| - }
|
| -}
|
| +// Test String.prototype.replace with atomic regexp and empty string.
|
| +r = /a/;
|
| +r.lastIndex = 1;
|
| +"zzzz".replace(r, "");
|
| +assertEquals(0, r.lastIndex);
|
|
|
| -f();
|
| -assertEquals(42, a[0]);
|
| -assertEquals(49, a[7]);
|
| -assertEquals(-19, a[23]);
|
| +// Test String.prototype.replace with non-atomic regexp and empty string.
|
| +r = /\d/;
|
| +r.lastIndex = 1;
|
| +"zzzz".replace(r, "");
|
| +assertEquals(0, r.lastIndex);
|
|
|
| +// Test String.prototype.replace with atomic regexp and non-empty string.
|
| +r = /a/;
|
| +r.lastIndex = 1;
|
| +"zzzz".replace(r, "a");
|
| +assertEquals(0, r.lastIndex);
|
|
|
| +// Test String.prototype.replace with non-atomic regexp and non-empty string.
|
| +r = /\d/;
|
| +r.lastIndex = 1;
|
| +"zzzz".replace(r, "a");
|
| +assertEquals(0, r.lastIndex);
|
|
|
| +// Test String.prototype.replace with replacement function
|
| +r = /a/;
|
| +r.lastIndex = 1;
|
| +"zzzz".replace(r, function() { return ""; });
|
| +assertEquals(0, r.lastIndex);
|
|
|
|
|