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

Side by Side Diff: src/api.cc

Issue 2004413002: [json] support property list argument in BasicJsonStringifier. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase 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 | « no previous file | src/js/json.js » ('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 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 2756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2767 2767
2768 Local<Value> JSON::Parse(Local<String> json_string) { 2768 Local<Value> JSON::Parse(Local<String> json_string) {
2769 RETURN_TO_LOCAL_UNCHECKED(Parse(Local<Context>(), json_string), Value); 2769 RETURN_TO_LOCAL_UNCHECKED(Parse(Local<Context>(), json_string), Value);
2770 } 2770 }
2771 2771
2772 MaybeLocal<String> JSON::Stringify(Local<Context> context, 2772 MaybeLocal<String> JSON::Stringify(Local<Context> context,
2773 Local<Object> json_object, 2773 Local<Object> json_object,
2774 Local<String> gap) { 2774 Local<String> gap) {
2775 PREPARE_FOR_EXECUTION(context, JSON, Stringify, String); 2775 PREPARE_FOR_EXECUTION(context, JSON, Stringify, String);
2776 i::Handle<i::Object> object = Utils::OpenHandle(*json_object); 2776 i::Handle<i::Object> object = Utils::OpenHandle(*json_object);
2777 i::Handle<i::Object> replacer = isolate->factory()->undefined_value();
2777 i::Handle<i::String> gap_string = gap.IsEmpty() 2778 i::Handle<i::String> gap_string = gap.IsEmpty()
2778 ? isolate->factory()->empty_string() 2779 ? isolate->factory()->empty_string()
2779 : Utils::OpenHandle(*gap); 2780 : Utils::OpenHandle(*gap);
2780 i::Handle<i::Object> maybe; 2781 i::Handle<i::Object> maybe;
2781 has_pending_exception = !i::BasicJsonStringifier(isolate) 2782 has_pending_exception = !i::BasicJsonStringifier(isolate)
2782 .Stringify(object, gap_string) 2783 .Stringify(object, replacer, gap_string)
2783 .ToHandle(&maybe); 2784 .ToHandle(&maybe);
2784 RETURN_ON_FAILED_EXECUTION(String); 2785 RETURN_ON_FAILED_EXECUTION(String);
2785 Local<String> result; 2786 Local<String> result;
2786 has_pending_exception = 2787 has_pending_exception =
2787 !ToLocal<String>(i::Object::ToString(isolate, maybe), &result); 2788 !ToLocal<String>(i::Object::ToString(isolate, maybe), &result);
2788 RETURN_ON_FAILED_EXECUTION(String); 2789 RETURN_ON_FAILED_EXECUTION(String);
2789 RETURN_ESCAPED(result); 2790 RETURN_ESCAPED(result);
2790 } 2791 }
2791 2792
2792 // --- D a t a --- 2793 // --- D a t a ---
(...skipping 6016 matching lines...) Expand 10 before | Expand all | Expand 10 after
8809 Address callback_address = 8810 Address callback_address =
8810 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8811 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8811 VMState<EXTERNAL> state(isolate); 8812 VMState<EXTERNAL> state(isolate);
8812 ExternalCallbackScope call_scope(isolate, callback_address); 8813 ExternalCallbackScope call_scope(isolate, callback_address);
8813 callback(info); 8814 callback(info);
8814 } 8815 }
8815 8816
8816 8817
8817 } // namespace internal 8818 } // namespace internal
8818 } // namespace v8 8819 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/js/json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698