Commit 36383f08 authored by brettw's avatar brettw Committed by Commit bot

Add d8 target to the GN build.

Also formats the rest of the file with "gn format". This accounts for all the changes except for the "d8" target additions.

Review URL: https://codereview.chromium.org/834113005

Cr-Commit-Position: refs/heads/master@{#25984}
parent a2a5dada
...@@ -23,7 +23,6 @@ v8_enable_extra_checks = is_debug ...@@ -23,7 +23,6 @@ v8_enable_extra_checks = is_debug
v8_target_arch = cpu_arch v8_target_arch = cpu_arch
v8_random_seed = "314159265" v8_random_seed = "314159265"
############################################################################### ###############################################################################
# Configurations # Configurations
# #
...@@ -64,54 +63,34 @@ config("features") { ...@@ -64,54 +63,34 @@ config("features") {
defines = [] defines = []
if (v8_enable_disassembler == true) { if (v8_enable_disassembler == true) {
defines += [ defines += [ "ENABLE_DISASSEMBLER" ]
"ENABLE_DISASSEMBLER",
]
} }
if (v8_enable_gdbjit == true) { if (v8_enable_gdbjit == true) {
defines += [ defines += [ "ENABLE_GDB_JIT_INTERFACE" ]
"ENABLE_GDB_JIT_INTERFACE",
]
} }
if (v8_object_print == true) { if (v8_object_print == true) {
defines += [ defines += [ "OBJECT_PRINT" ]
"OBJECT_PRINT",
]
} }
if (v8_enable_verify_heap == true) { if (v8_enable_verify_heap == true) {
defines += [ defines += [ "VERIFY_HEAP" ]
"VERIFY_HEAP",
]
} }
if (v8_interpreted_regexp == true) { if (v8_interpreted_regexp == true) {
defines += [ defines += [ "V8_INTERPRETED_REGEXP" ]
"V8_INTERPRETED_REGEXP",
]
} }
if (v8_deprecation_warnings == true) { if (v8_deprecation_warnings == true) {
defines += [ defines += [ "V8_DEPRECATION_WARNINGS" ]
"V8_DEPRECATION_WARNINGS",
]
} }
if (v8_enable_i18n_support == true) { if (v8_enable_i18n_support == true) {
defines += [ defines += [ "V8_I18N_SUPPORT" ]
"V8_I18N_SUPPORT",
]
} }
if (v8_enable_extra_checks == true) { if (v8_enable_extra_checks == true) {
defines += [ defines += [ "ENABLE_EXTRA_CHECKS" ]
"ENABLE_EXTRA_CHECKS",
]
} }
if (v8_enable_handle_zapping == true) { if (v8_enable_handle_zapping == true) {
defines += [ defines += [ "ENABLE_HANDLE_ZAPPING" ]
"ENABLE_HANDLE_ZAPPING",
]
} }
if (v8_use_external_startup_data == true) { if (v8_use_external_startup_data == true) {
defines += [ defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ]
"V8_USE_EXTERNAL_STARTUP_DATA",
]
} }
} }
...@@ -124,24 +103,16 @@ config("toolchain") { ...@@ -124,24 +103,16 @@ config("toolchain") {
# TODO(jochen): Add support for arm, mips, mipsel. # TODO(jochen): Add support for arm, mips, mipsel.
if (v8_target_arch == "arm64") { if (v8_target_arch == "arm64") {
defines += [ defines += [ "V8_TARGET_ARCH_ARM64" ]
"V8_TARGET_ARCH_ARM64",
]
} }
if (v8_target_arch == "x86") { if (v8_target_arch == "x86") {
defines += [ defines += [ "V8_TARGET_ARCH_IA32" ]
"V8_TARGET_ARCH_IA32",
]
} }
if (v8_target_arch == "x64") { if (v8_target_arch == "x64") {
defines += [ defines += [ "V8_TARGET_ARCH_X64" ]
"V8_TARGET_ARCH_X64",
]
} }
if (is_win) { if (is_win) {
defines += [ defines += [ "WIN32" ]
"WIN32",
]
# TODO(jochen): Support v8_enable_prof. # TODO(jochen): Support v8_enable_prof.
} }
...@@ -204,7 +175,7 @@ action("js2c") { ...@@ -204,7 +175,7 @@ action("js2c") {
] ]
outputs = [ outputs = [
"$target_gen_dir/libraries.cc" "$target_gen_dir/libraries.cc",
] ]
if (v8_enable_i18n_support) { if (v8_enable_i18n_support) {
...@@ -220,11 +191,28 @@ action("js2c") { ...@@ -220,11 +191,28 @@ action("js2c") {
outputs += [ "$target_gen_dir/libraries.bin" ] outputs += [ "$target_gen_dir/libraries.bin" ]
args += [ args += [
"--startup_blob", "--startup_blob",
rebase_path("$target_gen_dir/libraries.bin", root_build_dir) rebase_path("$target_gen_dir/libraries.bin", root_build_dir),
] ]
} }
} }
action("d8_js2c") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
script = "tools/js2c.py"
inputs = [
"src/d8.js",
"src/macros.py",
]
outputs = [
"$target_gen_dir/d8-js.cc",
]
args = rebase_path(outputs, root_build_dir) + [ "D8" ] +
rebase_path(inputs, root_build_dir)
}
action("js2c_experimental") { action("js2c_experimental") {
visibility = [ ":*" ] # Only targets in this file can depend on this. visibility = [ ":*" ] # Only targets in this file can depend on this.
...@@ -245,15 +233,16 @@ action("js2c_experimental") { ...@@ -245,15 +233,16 @@ action("js2c_experimental") {
"src/harmony-classes.js", "src/harmony-classes.js",
"src/harmony-tostring.js", "src/harmony-tostring.js",
"src/harmony-templates.js", "src/harmony-templates.js",
"src/harmony-regexp.js" "src/harmony-regexp.js",
] ]
outputs = [ outputs = [
"$target_gen_dir/experimental-libraries.cc" "$target_gen_dir/experimental-libraries.cc",
] ]
args = [ args = [
rebase_path("$target_gen_dir/experimental-libraries.cc", root_build_dir), rebase_path("$target_gen_dir/experimental-libraries.cc",
root_build_dir),
"EXPERIMENTAL", "EXPERIMENTAL",
] + rebase_path(sources, root_build_dir) ] + rebase_path(sources, root_build_dir)
...@@ -261,7 +250,7 @@ action("js2c_experimental") { ...@@ -261,7 +250,7 @@ action("js2c_experimental") {
outputs += [ "$target_gen_dir/libraries_experimental.bin" ] outputs += [ "$target_gen_dir/libraries_experimental.bin" ]
args += [ args += [
"--startup_blob", "--startup_blob",
rebase_path("$target_gen_dir/libraries_experimental.bin", root_build_dir) rebase_path("$target_gen_dir/libraries_experimental.bin", root_build_dir),
] ]
} }
} }
...@@ -272,16 +261,16 @@ if (v8_use_external_startup_data) { ...@@ -272,16 +261,16 @@ if (v8_use_external_startup_data) {
deps = [ deps = [
":js2c", ":js2c",
":js2c_experimental" ":js2c_experimental",
] ]
sources = [ sources = [
"$target_gen_dir/libraries.bin", "$target_gen_dir/libraries.bin",
"$target_gen_dir/libraries_experimental.bin" "$target_gen_dir/libraries_experimental.bin",
] ]
outputs = [ outputs = [
"$root_out_dir/natives_blob.bin" "$root_out_dir/natives_blob.bin",
] ]
script = "tools/concatenate-files.py" script = "tools/concatenate-files.py"
...@@ -301,23 +290,24 @@ action("postmortem-metadata") { ...@@ -301,23 +290,24 @@ action("postmortem-metadata") {
] ]
outputs = [ outputs = [
"$target_gen_dir/debug-support.cc" "$target_gen_dir/debug-support.cc",
] ]
args = args = rebase_path(outputs, root_build_dir) +
rebase_path(outputs, root_build_dir) +
rebase_path(sources, root_build_dir) rebase_path(sources, root_build_dir)
} }
action("run_mksnapshot") { action("run_mksnapshot") {
visibility = [ ":*" ] # Only targets in this file can depend on this. visibility = [ ":*" ] # Only targets in this file can depend on this.
deps = [ ":mksnapshot($host_toolchain)" ] deps = [
":mksnapshot($host_toolchain)",
]
script = "tools/run.py" script = "tools/run.py"
outputs = [ outputs = [
"$target_gen_dir/snapshot.cc" "$target_gen_dir/snapshot.cc",
] ]
args = [ args = [
...@@ -325,24 +315,27 @@ action("run_mksnapshot") { ...@@ -325,24 +315,27 @@ action("run_mksnapshot") {
"root_out_dir") + "/mksnapshot", "root_out_dir") + "/mksnapshot",
root_build_dir), root_build_dir),
"--log-snapshot-positions", "--log-snapshot-positions",
"--logfile", rebase_path("$target_gen_dir/snapshot.log", root_build_dir), "--logfile",
rebase_path("$target_gen_dir/snapshot.cc", root_build_dir) rebase_path("$target_gen_dir/snapshot.log", root_build_dir),
rebase_path("$target_gen_dir/snapshot.cc", root_build_dir),
] ]
if (v8_random_seed != "0") { if (v8_random_seed != "0") {
args += [ "--random-seed", v8_random_seed ] args += [
"--random-seed",
v8_random_seed,
]
} }
if (v8_use_external_startup_data) { if (v8_use_external_startup_data) {
outputs += [ "$root_out_dir/snapshot_blob.bin" ] outputs += [ "$root_out_dir/snapshot_blob.bin" ]
args += [ args += [
"--startup_blob", "--startup_blob",
rebase_path("$root_out_dir/snapshot_blob.bin", root_build_dir) rebase_path("$root_out_dir/snapshot_blob.bin", root_build_dir),
] ]
} }
} }
############################################################################### ###############################################################################
# Source Sets (aka static libraries) # Source Sets (aka static libraries)
# #
...@@ -364,7 +357,11 @@ source_set("v8_nosnapshot") { ...@@ -364,7 +357,11 @@ source_set("v8_nosnapshot") {
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":internal_config", ":features", ":toolchain" ] configs += [
":internal_config",
":features",
":toolchain",
]
} }
source_set("v8_snapshot") { source_set("v8_snapshot") {
...@@ -385,7 +382,11 @@ source_set("v8_snapshot") { ...@@ -385,7 +382,11 @@ source_set("v8_snapshot") {
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":internal_config", ":features", ":toolchain" ] configs += [
":internal_config",
":features",
":toolchain",
]
} }
if (v8_use_external_startup_data) { if (v8_use_external_startup_data) {
...@@ -407,7 +408,11 @@ if (v8_use_external_startup_data) { ...@@ -407,7 +408,11 @@ if (v8_use_external_startup_data) {
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":internal_config", ":features", ":toolchain" ] configs += [
":internal_config",
":features",
":toolchain",
]
} }
} }
...@@ -1212,7 +1217,11 @@ source_set("v8_base") { ...@@ -1212,7 +1217,11 @@ source_set("v8_base") {
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":internal_config", ":features", ":toolchain" ] configs += [
":internal_config",
":features",
":toolchain",
]
if (!is_debug) { if (!is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:optimize" ]
...@@ -1220,7 +1229,9 @@ source_set("v8_base") { ...@@ -1220,7 +1229,9 @@ source_set("v8_base") {
} }
defines = [] defines = []
deps = [ ":v8_libbase" ] deps = [
":v8_libbase",
]
if (is_win) { if (is_win) {
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations. # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
...@@ -1232,6 +1243,7 @@ source_set("v8_base") { ...@@ -1232,6 +1243,7 @@ source_set("v8_base") {
if (is_win) { if (is_win) {
deps += [ "//third_party/icu:icudata" ] deps += [ "//third_party/icu:icudata" ]
} }
# TODO(jochen): Add support for icu_use_data_file_flag # TODO(jochen): Add support for icu_use_data_file_flag
defines += [ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE" ] defines += [ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE" ]
} else { } else {
...@@ -1300,7 +1312,11 @@ source_set("v8_libbase") { ...@@ -1300,7 +1312,11 @@ source_set("v8_libbase") {
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":internal_config_base", ":features", ":toolchain" ] configs += [
":internal_config_base",
":features",
":toolchain",
]
if (!is_debug) { if (!is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:optimize" ]
...@@ -1310,15 +1326,11 @@ source_set("v8_libbase") { ...@@ -1310,15 +1326,11 @@ source_set("v8_libbase") {
defines = [] defines = []
if (is_posix) { if (is_posix) {
sources += [ sources += [ "src/base/platform/platform-posix.cc" ]
"src/base/platform/platform-posix.cc"
]
} }
if (is_linux) { if (is_linux) {
sources += [ sources += [ "src/base/platform/platform-linux.cc" ]
"src/base/platform/platform-linux.cc"
]
libs = [ "rt" ] libs = [ "rt" ]
} else if (is_android) { } else if (is_android) {
...@@ -1347,7 +1359,10 @@ source_set("v8_libbase") { ...@@ -1347,7 +1359,10 @@ source_set("v8_libbase") {
defines += [ "_CRT_RAND_S" ] # for rand_s() defines += [ "_CRT_RAND_S" ] # for rand_s()
libs = [ "winmm.lib", "ws2_32.lib" ] libs = [
"winmm.lib",
"ws2_32.lib",
]
} }
# TODO(jochen): Add support for qnx, freebsd, openbsd, netbsd, and solaris. # TODO(jochen): Add support for qnx, freebsd, openbsd, netbsd, and solaris.
...@@ -1366,7 +1381,11 @@ source_set("v8_libplatform") { ...@@ -1366,7 +1381,11 @@ source_set("v8_libplatform") {
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":internal_config_base", ":features", ":toolchain" ] configs += [
":internal_config_base",
":features",
":toolchain",
]
if (!is_debug) { if (!is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:optimize" ]
...@@ -1392,7 +1411,11 @@ if (current_toolchain == host_toolchain) { ...@@ -1392,7 +1411,11 @@ if (current_toolchain == host_toolchain) {
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":internal_config", ":features", ":toolchain" ] configs += [
":internal_config",
":features",
":toolchain",
]
deps = [ deps = [
":v8_base", ":v8_base",
...@@ -1401,6 +1424,43 @@ if (current_toolchain == host_toolchain) { ...@@ -1401,6 +1424,43 @@ if (current_toolchain == host_toolchain) {
"//build/config/sanitizers:deps", "//build/config/sanitizers:deps",
] ]
} }
executable("d8") {
sources = [
"src/d8.cc",
]
deps = [
":d8_js2c",
":v8",
":v8_libplatform",
]
configs += [
":internal_config",
":features",
":toolchain",
]
# TODO(GYP): Build option for readline support.
if (is_posix) {
sources += [ "src/d8-posix.cc" ]
} else if (is_win) {
sources += [ "src/d8-windows.cc" ]
}
if (component_mode != "shared_library") {
sources += [
"src/d8-debug.cc",
"$target_gen_dir/d8-js.cc",
]
}
if (v8_enable_i18n_support) {
deps += [ "//third_party/icu" ]
}
# TODO(GYP) v8_enable_vtunejit support in d8.
}
} }
############################################################################### ###############################################################################
...@@ -1408,8 +1468,7 @@ if (current_toolchain == host_toolchain) { ...@@ -1408,8 +1468,7 @@ if (current_toolchain == host_toolchain) {
# #
if (component_mode == "shared_library") { if (component_mode == "shared_library") {
component("v8") {
component("v8") {
sources = [ sources = [
"src/v8dll-main.cc", "src/v8dll-main.cc",
] ]
...@@ -1434,7 +1493,11 @@ component("v8") { ...@@ -1434,7 +1493,11 @@ component("v8") {
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":internal_config", ":features", ":toolchain" ] configs += [
":internal_config",
":features",
":toolchain",
]
direct_dependent_configs = [ ":external_config" ] direct_dependent_configs = [ ":external_config" ]
...@@ -1442,11 +1505,9 @@ component("v8") { ...@@ -1442,11 +1505,9 @@ component("v8") {
if (is_android && current_toolchain != host_toolchain) { if (is_android && current_toolchain != host_toolchain) {
libs += [ "log" ] libs += [ "log" ]
} }
} }
} else { } else {
group("v8") {
group("v8") {
if (v8_use_snapshot && v8_use_external_startup_data) { if (v8_use_snapshot && v8_use_external_startup_data) {
deps = [ deps = [
":v8_base", ":v8_base",
...@@ -1466,6 +1527,5 @@ group("v8") { ...@@ -1466,6 +1527,5 @@ group("v8") {
} }
direct_dependent_configs = [ ":external_config" ] direct_dependent_configs = [ ":external_config" ]
} }
} }
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