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

Side by Side Diff: src/json-stringifier.cc

Issue 1995263002: [keys] Simplify KeyAccumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix handle dereferencing 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 unified diff | Download patch
« no previous file with comments | « src/elements.cc ('k') | src/keys.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 JSReceiver::GetKeys(object, OWN_ONLY, ENUMERABLE_STRINGS), EXCEPTION); 547 KeyAccumulator::GetKeys(object, OWN_ONLY, ENUMERABLE_STRINGS),
548 EXCEPTION);
548 } 549 }
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
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
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | src/keys.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698