1f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// Copyright 2008 the V8 project authors. All rights reserved. 2f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// Redistribution and use in source and binary forms, with or without 3f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// modification, are permitted provided that the following conditions are 4f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// met: 5f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// 6f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// * Redistributions of source code must retain the above copyright 7f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// notice, this list of conditions and the following disclaimer. 8f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// * Redistributions in binary form must reproduce the above 9f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// copyright notice, this list of conditions and the following 10f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// disclaimer in the documentation and/or other materials provided 11f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// with the distribution. 12f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// * Neither the name of Google Inc. nor the names of its 13f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// contributors may be used to endorse or promote products derived 14f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// from this software without specific prior written permission. 15f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// 16f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org 28f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// Test that we don't cache the result of a regexp match across a 29f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org// compile event. 30160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgvar re = /x/; 31f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.orgassertEquals("a.yb", "axyb".replace(re, ".")); 32f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org 33160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgre.compile("y"); 34f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.orgassertEquals("ax.b", "axyb".replace(re, ".")); 35f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org 36f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.orgre.compile("(x)"); 37f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org 38160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(["x", "x"], re.exec("axyb")); 39f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org 40f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.orgre.compile("(y)"); 41f837290e142d49c9e1332841ec2c49ee2f09584avegorov@chromium.org 42160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(["y", "y"], re.exec("axyb")); 43