Index: test/mjsunit/gc-early-with-fragmentation.js |
diff --git a/test/mjsunit/regress/regress-3976.js b/test/mjsunit/gc-early-with-fragmentation.js |
similarity index 60% |
copy from test/mjsunit/regress/regress-3976.js |
copy to test/mjsunit/gc-early-with-fragmentation.js |
index efa3ac03bc05a5b1018eb1bdd0db761154f2b664..635acceee403d405572176230b47fe4f0b2a9da5 100644 |
--- a/test/mjsunit/regress/regress-3976.js |
+++ b/test/mjsunit/gc-early-with-fragmentation.js |
@@ -25,56 +25,25 @@ |
// (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: --max-old-space-size=60 --check-handle-count |
- |
-table = []; |
- |
-for (var i = 0; i < 32; i++) { |
- table[i] = String.fromCharCode(i + 0x410); |
-} |
- |
- |
-var random = (function() { |
- var seed = 10; |
- return function() { |
- seed = (seed * 1009) % 8831; |
- return seed; |
- }; |
-})(); |
- |
- |
-function key(length) { |
- var s = ""; |
- for (var i = 0; i < length; i++) { |
- s += table[random() % 32]; |
- } |
- return '"' + s + '"'; |
-} |
- |
- |
-function value() { |
- return '[{' + '"field1" : ' + random() + ', "field2" : ' + random() + '}]'; |
+// Test that we don't keep doing new-space scavenges when the fragmented old |
+// space should be forcing us to do mark-sweeps. Passes by not crashing. |
+ |
+// This is a 32bit-only test. It generates about 20Mbytes of live data. |
+// At the time of writing, this test passes with max old space size 40, |
+// whereas before it only passed with old space size 70. Set the limit |
+// at 50 in order to run fast, and not be too flaky. We limit semispace |
+// size too, since 50 is very low relative to the default 8Mbyte semispace |
+// size. A separate issue means we don't accellerate incremental marking |
+// fast enough when nearing the limit. We will deal with that in a |
+// different change, hence we switch off incremental marking for this test. |
+ |
+// Flags: --max-old-space-size=50 --no-incremental-marking --max-semi-space-size=4 |
+ |
+var shortlived = Array(400); |
+var longlived = Array(1000); |
+for (var i = 0; i < 10000; i++) { |
+ if ((i % 100) == 0) print(i); |
+ var a = new Array(5000); |
+ shortlived[i % 400] = a; |
+ longlived[((i / 10) | 0) % 1000] = a; |
} |
- |
- |
-function generate(n) { |
- var s = '{'; |
- for (var i = 0; i < n; i++) { |
- if (i > 0) s += ', '; |
- s += key(random() % 10 + 7); |
- s += ':'; |
- s += value(); |
- } |
- s += '}'; |
- return s; |
-} |
- |
- |
-print("generating"); |
- |
-var str = generate(50000); |
- |
-print("parsing " + str.length); |
-JSON.parse(str); |
- |
-print("done"); |