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

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

Issue 348313002: Introduce a PrototypeIterator template and use it all over the place (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/isolate.cc ('k') | src/objects.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_JSON_STRINGIFIER_H_ 5 #ifndef V8_JSON_STRINGIFIER_H_
6 #define V8_JSON_STRINGIFIER_H_ 6 #define V8_JSON_STRINGIFIER_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/conversions.h" 10 #include "src/conversions.h"
11 #include "src/prototype-iterator.h"
11 #include "src/utils.h" 12 #include "src/utils.h"
12 13
13 namespace v8 { 14 namespace v8 {
14 namespace internal { 15 namespace internal {
15 16
16 class BasicJsonStringifier BASE_EMBEDDED { 17 class BasicJsonStringifier BASE_EMBEDDED {
17 public: 18 public:
18 explicit BasicJsonStringifier(Isolate* isolate); 19 explicit BasicJsonStringifier(Isolate* isolate);
19 20
20 MUST_USE_RESULT MaybeHandle<Object> Stringify(Handle<Object> object); 21 MUST_USE_RESULT MaybeHandle<Object> Stringify(Handle<Object> object);
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 return SUCCESS; 624 return SUCCESS;
624 } 625 }
625 626
626 627
627 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject( 628 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject(
628 Handle<JSObject> object) { 629 Handle<JSObject> object) {
629 HandleScope handle_scope(isolate_); 630 HandleScope handle_scope(isolate_);
630 Result stack_push = StackPush(object); 631 Result stack_push = StackPush(object);
631 if (stack_push != SUCCESS) return stack_push; 632 if (stack_push != SUCCESS) return stack_push;
632 if (object->IsJSGlobalProxy()) { 633 if (object->IsJSGlobalProxy()) {
633 object = Handle<JSObject>( 634 object = Handle<JSObject>(JSObject::cast(SAFE_GET_PROTOTYPE_FAST(*object)),
634 JSObject::cast(object->GetPrototype()), isolate_); 635 isolate_);
635 ASSERT(object->IsGlobalObject()); 636 ASSERT(object->IsGlobalObject());
636 } 637 }
637 638
638 Append('{'); 639 Append('{');
639 bool comma = false; 640 bool comma = false;
640 641
641 if (object->HasFastProperties() && 642 if (object->HasFastProperties() &&
642 !object->HasIndexedInterceptor() && 643 !object->HasIndexedInterceptor() &&
643 !object->HasNamedInterceptor() && 644 !object->HasNamedInterceptor() &&
644 object->elements()->length() == 0) { 645 object->elements()->length() == 0) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 SerializeString_<false, uint8_t>(object); 871 SerializeString_<false, uint8_t>(object);
871 } else { 872 } else {
872 SerializeString_<false, uc16>(object); 873 SerializeString_<false, uc16>(object);
873 } 874 }
874 } 875 }
875 } 876 }
876 877
877 } } // namespace v8::internal 878 } } // namespace v8::internal
878 879
879 #endif // V8_JSON_STRINGIFIER_H_ 880 #endif // V8_JSON_STRINGIFIER_H_
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698