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

Unified Diff: src/json.js

Issue 11186025: Reimplement a simpler version of JSON.stringify. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | src/json-stringifier.h » ('j') | src/json-stringifier.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/json.js
diff --git a/src/json.js b/src/json.js
index 85224b0f053ffde051228ae9f66de947009db402..608cb7109d972f5981be6f51fefa17aab6ebc2ab 100644
--- a/src/json.js
+++ b/src/json.js
@@ -307,10 +307,12 @@ function BasicJSONSerialize(key, value, stack, builder) {
function JSONStringify(value, replacer, space) {
if (%_ArgumentsLength() == 1) {
+ var result = %BasicJSONStringify(value);
+ if (result != 0) return result;
Toon Verwaest 2012/10/17 17:52:50 If possible, also use IS_UNDEFINED here; like belo
Yang 2012/10/18 12:27:33 I don't think this is necessary: if nothing is wri
var builder = new InternalArray();
BasicJSONSerialize('', value, new InternalArray(), builder);
if (builder.length == 0) return;
- var result = %_FastAsciiArrayJoin(builder, "");
+ result = %_FastAsciiArrayJoin(builder, "");
if (!IS_UNDEFINED(result)) return result;
return %StringBuilderConcat(builder, builder.length, "");
}
« no previous file with comments | « no previous file | src/json-stringifier.h » ('j') | src/json-stringifier.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698