Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 4377f1a6b366d4f8ac3c1401d71a8a4da2c60d5e..075c267944f19963d5bb22348b12acf9d176e3f0 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -49,12 +49,12 @@ |
#include "src/profiler/heap-snapshot-generator-inl.h" |
#include "src/profiler/profile-generator-inl.h" |
#include "src/profiler/sampler.h" |
-#include "src/property.h" |
#include "src/property-descriptor.h" |
#include "src/property-details.h" |
+#include "src/property.h" |
#include "src/prototype.h" |
-#include "src/runtime/runtime.h" |
#include "src/runtime-profiler.h" |
+#include "src/runtime/runtime.h" |
#include "src/simulator.h" |
#include "src/snapshot/natives.h" |
#include "src/snapshot/snapshot.h" |
@@ -66,7 +66,6 @@ |
#include "src/version.h" |
#include "src/vm-state-inl.h" |
- |
namespace v8 { |
#define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr)) |
@@ -2752,6 +2751,21 @@ Local<Value> JSON::Parse(Local<String> json_string) { |
RETURN_TO_LOCAL_UNCHECKED(Parse(isolate, json_string), Value); |
} |
+MaybeLocal<String> JSON::Stringify(Isolate* v8_isolate, |
+ Local<Object> json_object) { |
+ auto isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
+ PREPARE_FOR_EXECUTION_WITH_ISOLATE(isolate, "JSON::Stringify", String); |
+ i::Handle<i::Object> object = Utils::OpenHandle(*json_object); |
+ i::Handle<i::Object> maybe; |
+ has_pending_exception = |
+ !i::Runtime::BasicJsonStringify(isolate, object).ToHandle(&maybe); |
+ RETURN_ON_FAILED_EXECUTION(String); |
+ Local<String> result; |
+ has_pending_exception = |
+ !ToLocal<String>(i::Object::ToString(isolate, maybe), &result); |
+ RETURN_ON_FAILED_EXECUTION(String); |
+ RETURN_ESCAPED(result); |
+} |
// --- D a t a --- |