[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: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58640}
This commit is contained in:
Yang Guo 2019-01-08 15:22:38 +01:00 committed by Commit Bot
parent 9e15860520
commit 052083f1f8
5 changed files with 9 additions and 31 deletions

View File

@ -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) {
android_assets("v8_external_startup_data_assets") {
if (v8_use_external_startup_data) {
@ -3603,11 +3585,11 @@ if (is_component_build) {
v8_executable("d8") {
sources = [
"$target_gen_dir/d8-js.cc",
"src/async-hooks-wrapper.cc",
"src/async-hooks-wrapper.h",
"src/d8-console.cc",
"src/d8-console.h",
"src/d8-js.cc",
"src/d8-platforms.cc",
"src/d8-platforms.h",
"src/d8.cc",
@ -3622,7 +3604,6 @@ v8_executable("d8") {
]
deps = [
":d8_js2c",
":v8",
":v8_libbase",
":v8_libplatform",
@ -4089,7 +4070,6 @@ group("v8_generated_cc_files") {
testonly = true
deps = [
":d8_js2c",
":generate_bytecode_builtins_list",
":js2c_extras",
":run_torque",

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/d8.h"
const char* v8::Shell::stringify_source_ = R"D8(
(function() {
"use strict";
@ -94,3 +97,5 @@ function StringifyProxy(proxy, depth) {
return Stringify;
})();
)D8";

View File

@ -1660,18 +1660,11 @@ Local<String> Shell::Stringify(Isolate* isolate, Local<Value> value) {
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(isolate, evaluation_context_);
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 =
String::NewFromUtf8(isolate, source_string.start(),
NewStringType::kNormal, source_string.length())
String::NewFromUtf8(isolate, stringify_source_, NewStringType::kNormal)
.ToLocalChecked();
Local<String> name =
String::NewFromUtf8(isolate, source_name.start(),
NewStringType::kNormal, source_name.length())
String::NewFromUtf8(isolate, "d8-stringify", NewStringType::kNormal)
.ToLocalChecked();
ScriptOrigin origin(name);
Local<Script> script =

View File

@ -543,6 +543,7 @@ class Shell : public i::AllStatic {
static Global<Context> evaluation_context_;
static base::OnceType quit_once_;
static Global<Function> stringify_function_;
static const char* stringify_source_;
static CounterMap* counter_map_;
// 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

View File

@ -16,7 +16,6 @@ namespace internal {
enum NativeType {
EXTRAS,
D8,
TEST
};