Chromium Code Reviews| Index: src/json-stringifier.cc |
| diff --git a/src/json-stringifier.cc b/src/json-stringifier.cc |
| index b7059d6f110482ec9a8d06466a2a7114840e984b..27712cdd50831c8ebcffe3e6f5e3f51840a01df8 100644 |
| --- a/src/json-stringifier.cc |
| +++ b/src/json-stringifier.cc |
| @@ -533,33 +533,20 @@ JsonStringifier::Result JsonStringifier::SerializeJSReceiverSlow( |
| if (contents.is_null()) { |
| ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
| isolate_, contents, |
| - KeyAccumulator::GetKeys(object, OWN_ONLY, ENUMERABLE_STRINGS), |
| + KeyAccumulator::GetKeys(object, OWN_ONLY, ENUMERABLE_STRINGS, |
| + CONVERT_TO_STRING), |
| 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))); |
|
Camillo Bruni
2016/05/30 14:25:20
nit: pass in the isolate_ directly
|
| 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; |
| } |
| @@ -571,6 +558,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); |