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

Unified Diff: src/json.js

Issue 5578004: Improved JSON stringify. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/array.js ('k') | test/mjsunit/json.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/json.js
===================================================================
--- src/json.js (revision 5918)
+++ src/json.js (working copy)
@@ -205,7 +205,7 @@
var len = value.length;
for (var i = 0; i < len; i++) {
var before = builder.length;
- BasicJSONSerialize($String(i), value, stack, builder);
+ BasicJSONSerialize(i, value, stack, builder);
if (before == builder.length) builder.push("null");
builder.push(",");
}
@@ -226,8 +226,9 @@
stack.push(value);
builder.push("{");
for (var p in value) {
- if (ObjectHasOwnProperty.call(value, p)) {
- builder.push(%QuoteJSONString(p), ":");
+ if (%HasLocalProperty(value, p)) {
+ builder.push(%QuoteJSONString(p));
+ builder.push(":");
var before = builder.length;
BasicJSONSerialize(p, value, stack, builder);
if (before == builder.length) {
@@ -251,7 +252,7 @@
var value = holder[key];
if (IS_OBJECT(value) && value) {
var toJSON = value.toJSON;
- if (IS_FUNCTION(toJSON)) value = toJSON.call(value, key);
+ if (IS_FUNCTION(toJSON)) value = toJSON.call(value, $String(key));
}
if (IS_STRING(value)) {
builder.push(%QuoteJSONString(value));
« no previous file with comments | « src/array.js ('k') | test/mjsunit/json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698