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

Unified Diff: src/json-stringifier.cc

Issue 2026563002: [json] implement InternalizeJSONProperty in C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase and address comments Created 4 years, 7 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 | « src/json-parser.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/json-stringifier.cc
diff --git a/src/json-stringifier.cc b/src/json-stringifier.cc
index 192c01202fd1b0d0b69f049b47f739bf3ebef7f5..6293b0c4593944f30a1832dbf34f7fc6931b6cb2 100644
--- a/src/json-stringifier.cc
+++ b/src/json-stringifier.cc
@@ -534,33 +534,20 @@ JsonStringifier::Result JsonStringifier::SerializeJSReceiverSlow(
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate_, contents,
KeyAccumulator::GetKeys(object, KeyCollectionMode::kOwnOnly,
- ENUMERABLE_STRINGS),
+ ENUMERABLE_STRINGS,
+ GetKeysConversion::kConvertToString),
EXCEPTION);
}
builder_.AppendCharacter('{');
Indent();
bool comma = false;
for (int i = 0; i < contents->length(); i++) {
- Object* key = contents->get(i);
- Handle<String> key_handle;
- MaybeHandle<Object> maybe_property;
- if (key->IsString()) {
- key_handle = Handle<String>(String::cast(key), isolate_);
- maybe_property = Object::GetPropertyOrElement(object, key_handle);
- } else {
- DCHECK(key->IsNumber());
- key_handle = factory()->NumberToString(Handle<Object>(key, isolate_));
- if (key->IsSmi()) {
- maybe_property =
- JSReceiver::GetElement(isolate_, object, Smi::cast(key)->value());
- } else {
- maybe_property = Object::GetPropertyOrElement(object, key_handle);
- }
- }
+ Handle<String> key(String::cast(contents->get(i)), isolate_);
Handle<Object> property;
- ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate_, property, maybe_property,
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate_, property,
+ Object::GetPropertyOrElement(object, key),
EXCEPTION);
- Result result = SerializeProperty(property, comma, key_handle);
+ Result result = SerializeProperty(property, comma, key);
if (!comma && result == SUCCESS) comma = true;
if (result == EXCEPTION) return result;
}
@@ -572,6 +559,7 @@ JsonStringifier::Result JsonStringifier::SerializeJSReceiverSlow(
JsonStringifier::Result JsonStringifier::SerializeJSProxy(
Handle<JSProxy> object) {
+ HandleScope scope(isolate_);
Result stack_push = StackPush(object);
if (stack_push != SUCCESS) return stack_push;
Maybe<bool> is_array = Object::IsArray(object);
« no previous file with comments | « src/json-parser.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698