Commit bf705f0f authored by yangguo's avatar yangguo Committed by Commit bot

[json] move json parser and stringifier into own compilation units.

This is a pure refactoring.

R=cbruni@chromium.org

Review-Url: https://codereview.chromium.org/2002933002
Cr-Commit-Position: refs/heads/master@{#36435}
parent 726d3be8
......@@ -1264,7 +1264,9 @@ v8_source_set("v8_base") {
"src/isolate-inl.h",
"src/isolate.cc",
"src/isolate.h",
"src/json-parser.cc",
"src/json-parser.h",
"src/json-stringifier.cc",
"src/json-stringifier.h",
"src/keys.cc",
"src/keys.h",
......@@ -2102,7 +2104,10 @@ executable("d8") {
}
}
if ((current_toolchain == host_toolchain && v8_toolset_for_shell == "host") || (current_toolchain == v8_snapshot_toolchain && v8_toolset_for_shell == "host") || (current_toolchain != host_toolchain && v8_toolset_for_shell == "target")) {
if ((current_toolchain == host_toolchain && v8_toolset_for_shell == "host") ||
(current_toolchain == v8_snapshot_toolchain &&
v8_toolset_for_shell == "host") ||
(current_toolchain != host_toolchain && v8_toolset_for_shell == "target")) {
executable("v8_shell") {
sources = [
"samples/shell.cc",
......
......@@ -40,6 +40,7 @@
#include "src/icu_util.h"
#include "src/isolate-inl.h"
#include "src/json-parser.h"
#include "src/json-stringifier.h"
#include "src/messages.h"
#include "src/parsing/parser.h"
#include "src/parsing/scanner-character-streams.h"
......@@ -2777,9 +2778,9 @@ MaybeLocal<String> JSON::Stringify(Local<Context> context,
? isolate->factory()->empty_string()
: Utils::OpenHandle(*gap);
i::Handle<i::Object> maybe;
has_pending_exception =
!i::Runtime::BasicJsonStringify(isolate, object, gap_string)
.ToHandle(&maybe);
has_pending_exception = !i::BasicJsonStringifier(isolate, gap_string)
.Stringify(object)
.ToHandle(&maybe);
RETURN_ON_FAILED_EXECUTION(String);
Local<String> result;
has_pending_exception =
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -8,6 +8,7 @@
#include "src/char-predicates-inl.h"
#include "src/isolate-inl.h"
#include "src/json-parser.h"
#include "src/json-stringifier.h"
#include "src/objects-inl.h"
namespace v8 {
......@@ -19,7 +20,7 @@ RUNTIME_FUNCTION(Runtime_QuoteJSONString) {
DCHECK(args.length() == 1);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, Runtime::BasicJsonStringifyString(isolate, string));
isolate, result, BasicJsonStringifier::StringifyString(isolate, string));
return *result;
}
......@@ -30,7 +31,7 @@ RUNTIME_FUNCTION(Runtime_BasicJSONStringify) {
CONVERT_ARG_HANDLE_CHECKED(String, gap, 1);
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, Runtime::BasicJsonStringify(isolate, object, gap));
isolate, result, BasicJsonStringifier(isolate, gap).Stringify(object));
return *result;
}
......
......@@ -8,7 +8,6 @@
#include "src/bootstrapper.h"
#include "src/debug/debug.h"
#include "src/isolate-inl.h"
#include "src/json-stringifier.h"
#include "src/messages.h"
#include "src/property-descriptor.h"
#include "src/runtime/runtime.h"
......@@ -226,16 +225,6 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
return value;
}
MaybeHandle<Object> Runtime::BasicJsonStringify(Isolate* isolate,
Handle<Object> object,
Handle<String> gap) {
return BasicJsonStringifier(isolate, gap).Stringify(object);
}
MaybeHandle<Object> Runtime::BasicJsonStringifyString(Isolate* isolate,
Handle<String> string) {
return BasicJsonStringifier::StringifyString(isolate, string);
}
RUNTIME_FUNCTION(Runtime_GetPrototype) {
HandleScope scope(isolate);
......
......@@ -1089,12 +1089,6 @@ class Runtime : public AllStatic {
MUST_USE_RESULT static MaybeHandle<Object> GetObjectProperty(
Isolate* isolate, Handle<Object> object, Handle<Object> key);
MUST_USE_RESULT static MaybeHandle<Object> BasicJsonStringify(
Isolate* isolate, Handle<Object> object, Handle<String> gap);
MUST_USE_RESULT static MaybeHandle<Object> BasicJsonStringifyString(
Isolate* isolate, Handle<String> string);
enum TypedArrayId {
// arrayIds below should be synchronized with typedarray.js natives.
ARRAY_ID_UINT8 = 1,
......
......@@ -923,7 +923,9 @@
'isolate-inl.h',
'isolate.cc',
'isolate.h',
'json-parser.cc',
'json-parser.h',
'json-stringifier.cc',
'json-stringifier.h',
'keys.h',
'keys.cc',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment