1496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// Copyright 2011 the V8 project authors. All rights reserved.
27be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// Redistribution and use in source and binary forms, with or without
37be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// modification, are permitted provided that the following conditions are
47be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// met:
57be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org//
67be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org//     * Redistributions of source code must retain the above copyright
77be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org//       notice, this list of conditions and the following disclaimer.
87be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org//     * Redistributions in binary form must reproduce the above
97be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org//       copyright notice, this list of conditions and the following
107be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org//       disclaimer in the documentation and/or other materials provided
117be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org//       with the distribution.
127be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org//     * Neither the name of Google Inc. nor the names of its
137be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org//       contributors may be used to endorse or promote products derived
147be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org//       from this software without specific prior written permission.
157be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org//
167be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
177be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
187be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
197be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
207be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
217be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
227be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
237be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
247be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
257be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
267be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
277be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org
28496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// Flags: --verify-heap --expose-gc
297be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org
30496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// This should not hit an assertion in debug mode.
317be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org
32496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// Create RegExp that is syntactically correct, but throws a stack overflow
33496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// during compilation.
34496c03a64f12710e837204e261ef155601247895sgjesse@chromium.orgvar source = Array(50000).join("(") + "a" + Array(50000).join(")");
35496c03a64f12710e837204e261ef155601247895sgjesse@chromium.orgvar r = RegExp(source);
36496c03a64f12710e837204e261ef155601247895sgjesse@chromium.orgtry {
37496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org  // Try to compile in UC16 mode, and drop the exception.
38496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org  r.test("\x80");
39496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org  assertUnreachable();
40496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org} catch (e) {
41496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org}
427be3c996bea370e151c9fe4ecf7f779cdc5f87adkasperl@chromium.org
43496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// Trigger a heap validation.
44496c03a64f12710e837204e261ef155601247895sgjesse@chromium.orggc();
45