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

Side by Side Diff: test/mjsunit/json2.js

Issue 85163003: Speed up long-running test cases. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/harmony/symbols.js ('k') | test/mjsunit/limit-locals.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 assertTrue(JSON.stringify(this, null, 0).indexOf('"a":12345') > 0); 33 assertTrue(JSON.stringify(this, null, 0).indexOf('"a":12345') > 0);
34 34
35 // Test JSON.stringify of array in dictionary mode. 35 // Test JSON.stringify of array in dictionary mode.
36 function TestStringify(expected, input) { 36 function TestStringify(expected, input) {
37 assertEquals(expected, JSON.stringify(input)); 37 assertEquals(expected, JSON.stringify(input));
38 assertEquals(expected, JSON.stringify(input, null, 0)); 38 assertEquals(expected, JSON.stringify(input, null, 0));
39 } 39 }
40 40
41 var array_1 = []; 41 var array_1 = [];
42 var array_2 = []; 42 var array_2 = [];
43 array_1[100000] = 1; 43 array_1[1<<13] = 1;
44 array_2[100000] = function() { return 1; }; 44 array_2[1<<13] = function() { return 1; };
45 var nulls = ""; 45 var nulls = "null,";
46 for (var i = 0; i < 100000; i++) { 46 for (var i = 0; i < 13; i++) {
47 nulls += 'null,'; 47 nulls += nulls;
48 } 48 }
49
Igor Sheludko 2013/11/25 19:37:49 Nice!
49 expected_1 = '[' + nulls + '1]'; 50 expected_1 = '[' + nulls + '1]';
50 expected_2 = '[' + nulls + 'null]'; 51 expected_2 = '[' + nulls + 'null]';
51 TestStringify(expected_1, array_1); 52 TestStringify(expected_1, array_1);
52 TestStringify(expected_2, array_2); 53 TestStringify(expected_2, array_2);
53 54
54 // Test JSValue with custom prototype. 55 // Test JSValue with custom prototype.
55 var num_wrapper = Object(42); 56 var num_wrapper = Object(42);
56 num_wrapper.__proto__ = { __proto__: null, 57 num_wrapper.__proto__ = { __proto__: null,
57 toString: function() { return true; } }; 58 toString: function() { return true; } };
58 TestStringify('1', num_wrapper); 59 TestStringify('1', num_wrapper);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 non_enum.a = 1; 172 non_enum.a = 1;
172 Object.defineProperty(non_enum, "b", { value: 2, enumerable: false }); 173 Object.defineProperty(non_enum, "b", { value: 2, enumerable: false });
173 non_enum.c = 3; 174 non_enum.c = 3;
174 TestStringify('{"a":1,"c":3}', non_enum); 175 TestStringify('{"a":1,"c":3}', non_enum);
175 176
176 var str = "external"; 177 var str = "external";
177 try { 178 try {
178 externalizeString(str, true); 179 externalizeString(str, true);
179 } catch (e) { } 180 } catch (e) { }
180 TestStringify("\"external\"", str, null, 0); 181 TestStringify("\"external\"", str, null, 0);
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/symbols.js ('k') | test/mjsunit/limit-locals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698