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

Unified Diff: test/mjsunit/regress/regress-json-stringify-gc.js

Issue 11189112: Reland JSON.stringify reimplementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: makev8 ia32.release.check Created 8 years, 2 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/json-recursive.js ('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-json-stringify-gc.js
diff --git a/test/mjsunit/regress/regress-2185.js b/test/mjsunit/regress/regress-json-stringify-gc.js
similarity index 77%
copy from test/mjsunit/regress/regress-2185.js
copy to test/mjsunit/regress/regress-json-stringify-gc.js
index 895f322fc63880b2a5c3f0480673d6f01cace9cd..42087167e77025c48fa83ceb107c50cd1288d8af 100644
--- a/test/mjsunit/regress/regress-2185.js
+++ b/test/mjsunit/regress/regress-json-stringify-gc.js
@@ -26,11 +26,16 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var a = [];
-
-for (var i = 0; i < 2; i++) {
- for (var j = 0; j < 30000; j++) {
- a.push(j);
- }
+var new_space_string = "";
+for (var i = 0; i < 128; i++) {
+ new_space_string += String.fromCharCode((Math.random() * 26 + 65) | 0);
}
+for (var i = 0; i < 10000; i++) a.push(new_space_string);
+
+// At some point during the first stringify, allocation causes a GC and
+// new_space_string is moved to old space. Make sure that this does not
+// screw up reading from the correct location.
+json1 = JSON.stringify(a);
+json2 = JSON.stringify(a);
+assertEquals(json1, json2);
-a.sort(function(a, b) { return a - b; } );
« no previous file with comments | « test/mjsunit/json-recursive.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698