OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/json-stringifier.h" | 5 #include "src/json-stringifier.h" |
6 | 6 |
7 #include "src/conversions.h" | 7 #include "src/conversions.h" |
8 #include "src/lookup.h" | 8 #include "src/lookup.h" |
9 #include "src/messages.h" | 9 #include "src/messages.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 StackPop(); | 537 StackPop(); |
538 return SUCCESS; | 538 return SUCCESS; |
539 } | 539 } |
540 | 540 |
541 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSReceiverSlow( | 541 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSReceiverSlow( |
542 Handle<JSReceiver> object) { | 542 Handle<JSReceiver> object) { |
543 Handle<FixedArray> contents = property_list_; | 543 Handle<FixedArray> contents = property_list_; |
544 if (contents.is_null()) { | 544 if (contents.is_null()) { |
545 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 545 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
546 isolate_, contents, | 546 isolate_, contents, |
547 KeyAccumulator::GetKeys(object, OWN_ONLY, ENUMERABLE_STRINGS), | 547 JSReceiver::GetKeys(object, OWN_ONLY, ENUMERABLE_STRINGS), EXCEPTION); |
548 EXCEPTION); | |
549 } | 548 } |
| 549 |
550 builder_.AppendCharacter('{'); | 550 builder_.AppendCharacter('{'); |
551 Indent(); | 551 Indent(); |
552 bool comma = false; | 552 bool comma = false; |
553 for (int i = 0; i < contents->length(); i++) { | 553 for (int i = 0; i < contents->length(); i++) { |
554 Object* key = contents->get(i); | 554 Object* key = contents->get(i); |
555 Handle<String> key_handle; | 555 Handle<String> key_handle; |
556 MaybeHandle<Object> maybe_property; | 556 MaybeHandle<Object> maybe_property; |
557 if (key->IsString()) { | 557 if (key->IsString()) { |
558 key_handle = Handle<String>(String::cast(key), isolate_); | 558 key_handle = Handle<String>(String::cast(key), isolate_); |
559 maybe_property = Object::GetPropertyOrElement(object, key_handle); | 559 maybe_property = Object::GetPropertyOrElement(object, key_handle); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 if (object->IsOneByteRepresentationUnderneath()) { | 704 if (object->IsOneByteRepresentationUnderneath()) { |
705 SerializeString_<uint8_t, uc16>(object); | 705 SerializeString_<uint8_t, uc16>(object); |
706 } else { | 706 } else { |
707 SerializeString_<uc16, uc16>(object); | 707 SerializeString_<uc16, uc16>(object); |
708 } | 708 } |
709 } | 709 } |
710 } | 710 } |
711 | 711 |
712 } // namespace internal | 712 } // namespace internal |
713 } // namespace v8 | 713 } // namespace v8 |
OLD | NEW |