Commit 53dd910b authored by verwaest@chromium.org's avatar verwaest@chromium.org

Directly use %ObjectKeys in json stringify.

BUG=2312

Review URL: https://chromiumcodereview.appspot.com/10905059

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12424 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b7398b33
......@@ -247,22 +247,23 @@ function BasicSerializeObject(value, stack, builder) {
}
builder.push("{");
var first = true;
for (var p in value) {
if (%HasLocalProperty(value, p)) {
if (!first) {
builder.push(%QuoteJSONStringComma(p));
} else {
builder.push(%QuoteJSONString(p));
}
builder.push(":");
var before = builder.length;
BasicJSONSerialize(p, value[p], stack, builder);
if (before == builder.length) {
builder.pop();
builder.pop();
} else {
first = false;
}
var keys = %ObjectKeys(value);
var len = keys.length;
for (var i = 0; i < len; i++) {
var p = keys[i];
if (!first) {
builder.push(%QuoteJSONStringComma(p));
} else {
builder.push(%QuoteJSONString(p));
}
builder.push(":");
var before = builder.length;
BasicJSONSerialize(p, value[p], stack, builder);
if (before == builder.length) {
builder.pop();
builder.pop();
} else {
first = false;
}
}
stack.pop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment