1486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// Copyright 2010 the V8 project authors. All rights reserved.
2486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// Redistribution and use in source and binary forms, with or without
3486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// modification, are permitted provided that the following conditions are
4486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// met:
5486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//
6486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//     * Redistributions of source code must retain the above copyright
7486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       notice, this list of conditions and the following disclaimer.
8486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//     * Redistributions in binary form must reproduce the above
9486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       copyright notice, this list of conditions and the following
10486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       disclaimer in the documentation and/or other materials provided
11486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       with the distribution.
12486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//     * Neither the name of Google Inc. nor the names of its
13486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       contributors may be used to endorse or promote products derived
14486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       from this software without specific prior written permission.
15486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//
16486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org
28486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// Flags: --expose-gc
29486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org
30486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.orgvar N = 2040 - 2 + 10;
31486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.orgvar arr = new Array(N);
32486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org
33486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.orggc();
34486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.orggc();
35486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.orggc();
36486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org
37486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// arr is in the large object space now.
38486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// Write new space object into it.
39486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.orgarr[arr.length - 2] = new Object;
40486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org
41486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// Shift array multiple times to ensure that young
42486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// object crosses region boundary.
43486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.orgfor (var i = 0; i < 9; i++) arr.shift();
44486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org
45486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// Do a GC to verify region dirty marks.
46486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.orggc();
47