Commit 052083f1 authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

[d8] no longer require js2c for d8

R=jgruber@chromium.org

Bug: v8:7624
Change-Id: I357e0b9d497ebff03e0e41a3495621c5b4c63464
Reviewed-on: https://chromium-review.googlesource.com/c/1400402
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58640}
parent 9e158605
...@@ -730,24 +730,6 @@ action("js2c_extras") { ...@@ -730,24 +730,6 @@ action("js2c_extras") {
} }
} }
action("d8_js2c") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
script = "tools/js2c.py"
# NOSORT
inputs = [
"src/d8.js",
]
outputs = [
"$target_gen_dir/d8-js.cc",
]
args = rebase_path(outputs, root_build_dir) + [ "D8" ] +
rebase_path(inputs, root_build_dir)
}
if (is_android && enable_java_templates) { if (is_android && enable_java_templates) {
android_assets("v8_external_startup_data_assets") { android_assets("v8_external_startup_data_assets") {
if (v8_use_external_startup_data) { if (v8_use_external_startup_data) {
...@@ -3603,11 +3585,11 @@ if (is_component_build) { ...@@ -3603,11 +3585,11 @@ if (is_component_build) {
v8_executable("d8") { v8_executable("d8") {
sources = [ sources = [
"$target_gen_dir/d8-js.cc",
"src/async-hooks-wrapper.cc", "src/async-hooks-wrapper.cc",
"src/async-hooks-wrapper.h", "src/async-hooks-wrapper.h",
"src/d8-console.cc", "src/d8-console.cc",
"src/d8-console.h", "src/d8-console.h",
"src/d8-js.cc",
"src/d8-platforms.cc", "src/d8-platforms.cc",
"src/d8-platforms.h", "src/d8-platforms.h",
"src/d8.cc", "src/d8.cc",
...@@ -3622,7 +3604,6 @@ v8_executable("d8") { ...@@ -3622,7 +3604,6 @@ v8_executable("d8") {
] ]
deps = [ deps = [
":d8_js2c",
":v8", ":v8",
":v8_libbase", ":v8_libbase",
":v8_libplatform", ":v8_libplatform",
...@@ -4089,7 +4070,6 @@ group("v8_generated_cc_files") { ...@@ -4089,7 +4070,6 @@ group("v8_generated_cc_files") {
testonly = true testonly = true
deps = [ deps = [
":d8_js2c",
":generate_bytecode_builtins_list", ":generate_bytecode_builtins_list",
":js2c_extras", ":js2c_extras",
":run_torque", ":run_torque",
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "src/d8.h"
const char* v8::Shell::stringify_source_ = R"D8(
(function() { (function() {
"use strict"; "use strict";
...@@ -94,3 +97,5 @@ function StringifyProxy(proxy, depth) { ...@@ -94,3 +97,5 @@ function StringifyProxy(proxy, depth) {
return Stringify; return Stringify;
})(); })();
)D8";
...@@ -1660,18 +1660,11 @@ Local<String> Shell::Stringify(Isolate* isolate, Local<Value> value) { ...@@ -1660,18 +1660,11 @@ Local<String> Shell::Stringify(Isolate* isolate, Local<Value> value) {
v8::Local<v8::Context> context = v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(isolate, evaluation_context_); v8::Local<v8::Context>::New(isolate, evaluation_context_);
if (stringify_function_.IsEmpty()) { if (stringify_function_.IsEmpty()) {
int source_index = i::NativesCollection<i::D8>::GetIndex("d8");
i::Vector<const char> source_string =
i::NativesCollection<i::D8>::GetScriptSource(source_index);
i::Vector<const char> source_name =
i::NativesCollection<i::D8>::GetScriptName(source_index);
Local<String> source = Local<String> source =
String::NewFromUtf8(isolate, source_string.start(), String::NewFromUtf8(isolate, stringify_source_, NewStringType::kNormal)
NewStringType::kNormal, source_string.length())
.ToLocalChecked(); .ToLocalChecked();
Local<String> name = Local<String> name =
String::NewFromUtf8(isolate, source_name.start(), String::NewFromUtf8(isolate, "d8-stringify", NewStringType::kNormal)
NewStringType::kNormal, source_name.length())
.ToLocalChecked(); .ToLocalChecked();
ScriptOrigin origin(name); ScriptOrigin origin(name);
Local<Script> script = Local<Script> script =
......
...@@ -543,6 +543,7 @@ class Shell : public i::AllStatic { ...@@ -543,6 +543,7 @@ class Shell : public i::AllStatic {
static Global<Context> evaluation_context_; static Global<Context> evaluation_context_;
static base::OnceType quit_once_; static base::OnceType quit_once_;
static Global<Function> stringify_function_; static Global<Function> stringify_function_;
static const char* stringify_source_;
static CounterMap* counter_map_; static CounterMap* counter_map_;
// We statically allocate a set of local counters to be used if we // We statically allocate a set of local counters to be used if we
// don't want to store the stats in a memory-mapped file // don't want to store the stats in a memory-mapped file
......
...@@ -16,7 +16,6 @@ namespace internal { ...@@ -16,7 +16,6 @@ namespace internal {
enum NativeType { enum NativeType {
EXTRAS, EXTRAS,
D8,
TEST TEST
}; };
......
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