OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 19 matching lines...) Expand all Loading... |
30 for (var i = 0; i < 128; i++) { | 30 for (var i = 0; i < 128; i++) { |
31 new_space_string += String.fromCharCode((Math.random() * 26 + 65) | 0); | 31 new_space_string += String.fromCharCode((Math.random() * 26 + 65) | 0); |
32 } | 32 } |
33 for (var i = 0; i < 10000; i++) a.push(new_space_string); | 33 for (var i = 0; i < 10000; i++) a.push(new_space_string); |
34 | 34 |
35 // At some point during the first stringify, allocation causes a GC and | 35 // At some point during the first stringify, allocation causes a GC and |
36 // new_space_string is moved to old space. Make sure that this does not | 36 // new_space_string is moved to old space. Make sure that this does not |
37 // screw up reading from the correct location. | 37 // screw up reading from the correct location. |
38 json1 = JSON.stringify(a); | 38 json1 = JSON.stringify(a); |
39 json2 = JSON.stringify(a); | 39 json2 = JSON.stringify(a); |
40 assertEquals(json1, json2); | 40 assertEquals(json1, json2, "GC caused JSON.stringify to fail."); |
41 | 41 |
OLD | NEW |