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

Side by Side Diff: src/json.js

Issue 11225026: Revert r12760 (JSON.stringify). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 | « no previous file | src/json-stringifier.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 BasicSerializeArray(value, stack, builder); 300 BasicSerializeArray(value, stack, builder);
301 } else { 301 } else {
302 BasicSerializeObject(value, stack, builder); 302 BasicSerializeObject(value, stack, builder);
303 } 303 }
304 } 304 }
305 } 305 }
306 306
307 307
308 function JSONStringify(value, replacer, space) { 308 function JSONStringify(value, replacer, space) {
309 if (%_ArgumentsLength() == 1) { 309 if (%_ArgumentsLength() == 1) {
310 var result = %BasicJSONStringify(value);
311 if (result != 0) return result;
312 var builder = new InternalArray(); 310 var builder = new InternalArray();
313 BasicJSONSerialize('', value, new InternalArray(), builder); 311 BasicJSONSerialize('', value, new InternalArray(), builder);
314 if (builder.length == 0) return; 312 if (builder.length == 0) return;
315 result = %_FastAsciiArrayJoin(builder, ""); 313 var result = %_FastAsciiArrayJoin(builder, "");
316 if (!IS_UNDEFINED(result)) return result; 314 if (!IS_UNDEFINED(result)) return result;
317 return %StringBuilderConcat(builder, builder.length, ""); 315 return %StringBuilderConcat(builder, builder.length, "");
318 } 316 }
319 if (IS_OBJECT(space)) { 317 if (IS_OBJECT(space)) {
320 // Unwrap 'space' if it is wrapped 318 // Unwrap 'space' if it is wrapped
321 if (IS_NUMBER_WRAPPER(space)) { 319 if (IS_NUMBER_WRAPPER(space)) {
322 space = ToNumber(space); 320 space = ToNumber(space);
323 } else if (IS_STRING_WRAPPER(space)) { 321 } else if (IS_STRING_WRAPPER(space)) {
324 space = ToString(space); 322 space = ToString(space);
325 } 323 }
(...skipping 16 matching lines...) Expand all
342 340
343 function SetUpJSON() { 341 function SetUpJSON() {
344 %CheckIsBootstrapping(); 342 %CheckIsBootstrapping();
345 InstallFunctions($JSON, DONT_ENUM, $Array( 343 InstallFunctions($JSON, DONT_ENUM, $Array(
346 "parse", JSONParse, 344 "parse", JSONParse,
347 "stringify", JSONStringify 345 "stringify", JSONStringify
348 )); 346 ));
349 } 347 }
350 348
351 SetUpJSON(); 349 SetUpJSON();
OLDNEW
« no previous file with comments | « no previous file | src/json-stringifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698