| OLD | NEW |
| 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 2751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2762 has_pending_exception = !ToLocal<Value>(maybe, &result); | 2762 has_pending_exception = !ToLocal<Value>(maybe, &result); |
| 2763 RETURN_ON_FAILED_EXECUTION(Value); | 2763 RETURN_ON_FAILED_EXECUTION(Value); |
| 2764 RETURN_ESCAPED(result); | 2764 RETURN_ESCAPED(result); |
| 2765 } | 2765 } |
| 2766 | 2766 |
| 2767 Local<Value> JSON::Parse(Local<String> json_string) { | 2767 Local<Value> JSON::Parse(Local<String> json_string) { |
| 2768 RETURN_TO_LOCAL_UNCHECKED(Parse(Local<Context>(), json_string), Value); | 2768 RETURN_TO_LOCAL_UNCHECKED(Parse(Local<Context>(), json_string), Value); |
| 2769 } | 2769 } |
| 2770 | 2770 |
| 2771 MaybeLocal<String> JSON::Stringify(Local<Context> context, | 2771 MaybeLocal<String> JSON::Stringify(Local<Context> context, |
| 2772 Local<Object> json_object) { | 2772 Local<Object> json_object, |
| 2773 Local<String> gap) { |
| 2773 PREPARE_FOR_EXECUTION(context, JSON, Stringify, String); | 2774 PREPARE_FOR_EXECUTION(context, JSON, Stringify, String); |
| 2774 i::Handle<i::Object> object = Utils::OpenHandle(*json_object); | 2775 i::Handle<i::Object> object = Utils::OpenHandle(*json_object); |
| 2776 i::Handle<i::String> gap_string = gap.IsEmpty() |
| 2777 ? isolate->factory()->empty_string() |
| 2778 : Utils::OpenHandle(*gap); |
| 2775 i::Handle<i::Object> maybe; | 2779 i::Handle<i::Object> maybe; |
| 2776 has_pending_exception = | 2780 has_pending_exception = |
| 2777 !i::Runtime::BasicJsonStringify(isolate, object).ToHandle(&maybe); | 2781 !i::Runtime::BasicJsonStringify(isolate, object, gap_string) |
| 2782 .ToHandle(&maybe); |
| 2778 RETURN_ON_FAILED_EXECUTION(String); | 2783 RETURN_ON_FAILED_EXECUTION(String); |
| 2779 Local<String> result; | 2784 Local<String> result; |
| 2780 has_pending_exception = | 2785 has_pending_exception = |
| 2781 !ToLocal<String>(i::Object::ToString(isolate, maybe), &result); | 2786 !ToLocal<String>(i::Object::ToString(isolate, maybe), &result); |
| 2782 RETURN_ON_FAILED_EXECUTION(String); | 2787 RETURN_ON_FAILED_EXECUTION(String); |
| 2783 RETURN_ESCAPED(result); | 2788 RETURN_ESCAPED(result); |
| 2784 } | 2789 } |
| 2785 | 2790 |
| 2786 // --- D a t a --- | 2791 // --- D a t a --- |
| 2787 | 2792 |
| (...skipping 6010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8798 Address callback_address = | 8803 Address callback_address = |
| 8799 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8804 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8800 VMState<EXTERNAL> state(isolate); | 8805 VMState<EXTERNAL> state(isolate); |
| 8801 ExternalCallbackScope call_scope(isolate, callback_address); | 8806 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8802 callback(info); | 8807 callback(info); |
| 8803 } | 8808 } |
| 8804 | 8809 |
| 8805 | 8810 |
| 8806 } // namespace internal | 8811 } // namespace internal |
| 8807 } // namespace v8 | 8812 } // namespace v8 |
| OLD | NEW |