Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: test/mjsunit/regress/regress-3976.js

Issue 1024823002: Fix OOM bug 3976. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix signed/unsigned comparison Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-3976.js
diff --git a/test/mjsunit/regress/regress-491.js b/test/mjsunit/regress/regress-3976.js
similarity index 65%
copy from test/mjsunit/regress/regress-491.js
copy to test/mjsunit/regress/regress-3976.js
index 2cf5e20ed6ab69946843ad04a4a7be35113d8187..c151f689f46e57126b6ed73b458941c4ca6a769e 100644
--- a/test/mjsunit/regress/regress-491.js
+++ b/test/mjsunit/regress/regress-3976.js
@@ -1,4 +1,4 @@
-// Copyright 2009 the V8 project authors. All rights reserved.
+// Copyright 2015 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -25,23 +25,56 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// See: http://code.google.com/p/v8/issues/detail?id=491
-// This should not hit any asserts in debug mode on ARM.
+// Flags: --max-old-space-size=60
-function function_with_n_strings(n) {
- var source = '(function f(){';
- for (var i = 0; i < n; i++) {
- if (i != 0) source += ';';
- source += '"x"';
+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];
}
- source += '})()';
- eval(source);
+ return '"' + s + '"';
}
-var i;
-for (i = 500; i < 600; i++) {
- function_with_n_strings(i);
+
+function value() {
+ return '[{' + '"field1" : ' + random() + ', "field2" : ' + random() + '}]';
}
-for (i = 1100; i < 1200; i++) {
- function_with_n_strings(i);
+
+
+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");
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698