build,v8: sync V8 gypfiles with 7.5

Co-authored-by: Ujjwal Sharma <usharma1998@gmail.com>
Co-authored-by: Michaël Zasso <targos@protonmail.com>

PR-URL: https://github.com/nodejs/node/pull/27375
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Refael Ackermann 2019-03-29 03:38:12 -04:00
parent e3cd79ef8e
commit 417c18e834
8 changed files with 1515 additions and 981 deletions

View File

@ -70,6 +70,11 @@
# https://github.com/nodejs/node/pull/22920/files#r222779926 # https://github.com/nodejs/node/pull/22920/files#r222779926
'v8_enable_fast_mksnapshot': 0, 'v8_enable_fast_mksnapshot': 0,
'v8_win64_unwinding_info': 0,
# TODO(refack): make v8-perfetto happen
'v8_use_perfetto': 0,
##### end V8 defaults ##### ##### end V8 defaults #####
'conditions': [ 'conditions': [
@ -81,23 +86,23 @@
}], }],
['GENERATOR=="ninja"', { ['GENERATOR=="ninja"', {
'obj_dir': '<(PRODUCT_DIR)/obj', 'obj_dir': '<(PRODUCT_DIR)/obj',
'v8_base': '<(PRODUCT_DIR)/obj/tools/v8_gypfiles/libv8_base.a', 'v8_base': '<(PRODUCT_DIR)/obj/tools/v8_gypfiles/libv8_snapshot.a',
}, { }, {
'obj_dir%': '<(PRODUCT_DIR)/obj.target', 'obj_dir%': '<(PRODUCT_DIR)/obj.target',
'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_base.a', 'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
}], }],
['OS == "win"', { ['OS == "win"', {
'os_posix': 0, 'os_posix': 0,
'v8_postmortem_support%': 0, 'v8_postmortem_support%': 0,
'obj_dir': '<(PRODUCT_DIR)/obj', 'obj_dir': '<(PRODUCT_DIR)/obj',
'v8_base': '<(PRODUCT_DIR)/lib/v8_libbase.lib', 'v8_base': '<(PRODUCT_DIR)/lib/libv8_snapshot.a',
}, { }, {
'os_posix': 1, 'os_posix': 1,
'v8_postmortem_support%': 1, 'v8_postmortem_support%': 1,
}], }],
['OS == "mac"', { ['OS == "mac"', {
'obj_dir%': '<(PRODUCT_DIR)/obj.target', 'obj_dir%': '<(PRODUCT_DIR)/obj.target',
'v8_base': '<(PRODUCT_DIR)/libv8_base.a', 'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a',
}], }],
['openssl_fips != ""', { ['openssl_fips != ""', {
'openssl_product': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)', 'openssl_product': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)',
@ -234,30 +239,20 @@
'WarningLevel': 3, # /W3 'WarningLevel': 3, # /W3
}, },
'VCLinkerTool': { 'VCLinkerTool': {
'target_conditions': [
['_type=="executable"', {
'SubSystem': 1, # /SUBSYSTEM:CONSOLE
}],
],
'conditions': [ 'conditions': [
['target_arch=="ia32"', { ['target_arch=="ia32"', {
'TargetMachine' : 1, # /MACHINE:X86 'TargetMachine' : 1, # /MACHINE:X86
'target_conditions': [
['_type=="executable"', {
'AdditionalOptions': [ '/SubSystem:Console,"5.01"' ],
}],
],
}], }],
['target_arch=="x64"', { ['target_arch=="x64"', {
'TargetMachine' : 17, # /MACHINE:AMD64 'TargetMachine' : 17, # /MACHINE:X64
'target_conditions': [
['_type=="executable"', {
'AdditionalOptions': [ '/SubSystem:Console,"5.02"' ],
}],
],
}], }],
['target_arch=="arm64"', { ['target_arch=="arm64"', {
'TargetMachine' : 0, # /MACHINE:ARM64 is inferred from the input files. 'TargetMachine' : 0, # NotSet. MACHINE:ARM64 is inferred from the input files.
'target_conditions': [
['_type=="executable"', {
'AdditionalOptions': [ '/SubSystem:Console' ],
}],
],
}], }],
], ],
'GenerateDebugInformation': 'true', 'GenerateDebugInformation': 'true',

View File

@ -615,6 +615,13 @@ def b(value):
else: else:
return 'false' return 'false'
def B(value):
"""Returns 1 if value is truthy, 0 otherwise."""
if value:
return 1
else:
return 0
def pkg_config(pkg): def pkg_config(pkg):
"""Run pkg-config on the specified package """Run pkg-config on the specified package
@ -1594,6 +1601,7 @@ configure_inspector(output)
# move everything else to target_defaults # move everything else to target_defaults
variables = output['variables'] variables = output['variables']
del output['variables'] del output['variables']
variables['is_debug'] = B(options.debug)
# make_global_settings for special FIPS linking # make_global_settings for special FIPS linking
# should not be used to compile modules in node-gyp # should not be used to compile modules in node-gyp

View File

@ -344,22 +344,24 @@
[ 'node_intermediate_lib_type=="static_library" and node_shared=="false"', { [ 'node_intermediate_lib_type=="static_library" and node_shared=="false"', {
'xcode_settings': { 'xcode_settings': {
'OTHER_LDFLAGS': [ 'OTHER_LDFLAGS': [
'-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)' '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
'<(node_core_target_name)<(STATIC_LIB_SUFFIX)', '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)',
], ],
}, },
'msvs_settings': { 'msvs_settings': {
'VCLinkerTool': { 'VCLinkerTool': {
'AdditionalOptions': [ 'AdditionalOptions': [
'/WHOLEARCHIVE:<(node_lib_target_name)<(STATIC_LIB_SUFFIX)', '/WHOLEARCHIVE:<(node_lib_target_name)<(STATIC_LIB_SUFFIX)',
'/WHOLEARCHIVE:<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)',
], ],
}, },
}, },
'conditions': [ 'conditions': [
['OS!="aix"', { ['OS != "aix" and OS != "mac"', {
'ldflags': [ 'ldflags': [
'-Wl,--whole-archive,<(obj_dir)/<(STATIC_LIB_PREFIX)' '-Wl,--whole-archive',
'<(node_core_target_name)<(STATIC_LIB_SUFFIX)', '<(obj_dir)/<(STATIC_LIB_PREFIX)<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
'<(obj_dir)/tools/v8_gypfiles/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)',
'-Wl,--no-whole-archive', '-Wl,--no-whole-archive',
], ],
}], }],
@ -386,10 +388,12 @@
'NODE_ARCH="<(target_arch)"', 'NODE_ARCH="<(target_arch)"',
'NODE_PLATFORM="<(OS)"', 'NODE_PLATFORM="<(OS)"',
], ],
'conditions': [
['OS=="win"', {
'libraries': [ 'Ws2_32' ],
}], }],
['OS=="win"', {
'libraries': [
'Dbghelp.lib',
'winmm.lib',
'Ws2_32.lib',
], ],
}], }],
['node_with_ltcg=="true"', { ['node_with_ltcg=="true"', {
@ -986,7 +990,7 @@
{ {
'action_name': 'node_dtrace_ustack_constants', 'action_name': 'node_dtrace_ustack_constants',
'inputs': [ 'inputs': [
'<(v8_base)' '<(obj_dir)/tools/v8_gypfiles/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)'
], ],
'outputs': [ 'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/v8constants.h' '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
@ -1140,8 +1144,16 @@
}], }],
], ],
}], }],
['OS=="win"', {
'libraries': [
'Dbghelp.lib',
'winmm.lib',
'Ws2_32.lib',
],
}],
], ],
}, # cctest }, # cctest
# TODO(joyeecheung): do not depend on node_lib, # TODO(joyeecheung): do not depend on node_lib,
# instead create a smaller static library node_lib_base that does # instead create a smaller static library node_lib_base that does
# just enough for node_native_module.cc and the cache builder to # just enough for node_native_module.cc and the cache builder to
@ -1180,22 +1192,14 @@
'tools/code_cache/cache_builder.h', 'tools/code_cache/cache_builder.h',
], ],
'conditions': [
[ 'node_report=="true"', {
'conditions': [ 'conditions': [
['OS=="win"', { ['OS=="win"', {
'libraries': [ 'libraries': [
'dbghelp.lib', 'dbghelp.lib',
'PsApi.lib', 'PsApi.lib',
'winmm.lib',
'Ws2_32.lib', 'Ws2_32.lib',
], ],
'dll_files': [
'dbghelp.dll',
'PsApi.dll',
'Ws2_32.dll',
],
}],
],
}], }],
], ],
}, # mkcodecache }, # mkcodecache
@ -1230,12 +1234,12 @@
'tools/snapshot/snapshot_builder.h', 'tools/snapshot/snapshot_builder.h',
], ],
'conditions': [
[ 'node_report=="true"', {
'conditions': [ 'conditions': [
['OS=="win"', { ['OS=="win"', {
'libraries': [ 'Ws2_32' ], 'libraries': [
}], 'Dbghelp.lib',
'winmm.lib',
'Ws2_32.lib',
], ],
}], }],
], ],

View File

@ -70,7 +70,7 @@
}], }],
[ 'node_use_bundled_v8=="true"', { [ 'node_use_bundled_v8=="true"', {
'dependencies': [ 'dependencies': [
'tools/v8_gypfiles/v8.gyp:v8', 'tools/v8_gypfiles/v8.gyp:v8_snapshot',
'tools/v8_gypfiles/v8.gyp:v8_libplatform', 'tools/v8_gypfiles/v8.gyp:v8_libplatform',
], ],
}], }],
@ -116,21 +116,13 @@
[ 'node_no_browser_globals=="true"', { [ 'node_no_browser_globals=="true"', {
'defines': [ 'NODE_NO_BROWSER_GLOBALS' ], 'defines': [ 'NODE_NO_BROWSER_GLOBALS' ],
} ], } ],
[ 'node_use_bundled_v8=="true" and v8_postmortem_support==1 and force_load=="true"', {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-Wl,-force_load,<(v8_base)',
],
},
}],
[ 'node_shared_zlib=="false"', { [ 'node_shared_zlib=="false"', {
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ], 'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
'conditions': [ 'conditions': [
[ 'force_load=="true"', { [ 'force_load=="true"', {
'xcode_settings': { 'xcode_settings': {
'OTHER_LDFLAGS': [ 'OTHER_LDFLAGS': [
'-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)' '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)zlib<(STATIC_LIB_SUFFIX)',
'zlib<(STATIC_LIB_SUFFIX)',
], ],
}, },
'msvs_settings': { 'msvs_settings': {
@ -143,7 +135,7 @@
'conditions': [ 'conditions': [
['OS!="aix" and node_shared=="false"', { ['OS!="aix" and node_shared=="false"', {
'ldflags': [ 'ldflags': [
'-Wl,--whole-archive,' '-Wl,--whole-archive',
'<(obj_dir)/deps/zlib/<(STATIC_LIB_PREFIX)zlib<(STATIC_LIB_SUFFIX)', '<(obj_dir)/deps/zlib/<(STATIC_LIB_PREFIX)zlib<(STATIC_LIB_SUFFIX)',
'-Wl,--no-whole-archive', '-Wl,--no-whole-archive',
], ],
@ -170,8 +162,7 @@
[ 'force_load=="true"', { [ 'force_load=="true"', {
'xcode_settings': { 'xcode_settings': {
'OTHER_LDFLAGS': [ 'OTHER_LDFLAGS': [
'-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)' '-Wl,-force_load,<(PRODUCT_DIR)/libuv<(STATIC_LIB_SUFFIX)',
'uv<(STATIC_LIB_SUFFIX)',
], ],
}, },
'msvs_settings': { 'msvs_settings': {
@ -184,7 +175,7 @@
'conditions': [ 'conditions': [
['OS!="aix" and node_shared=="false"', { ['OS!="aix" and node_shared=="false"', {
'ldflags': [ 'ldflags': [
'-Wl,--whole-archive,' '-Wl,--whole-archive',
'<(obj_dir)/deps/uv/<(STATIC_LIB_PREFIX)uv<(STATIC_LIB_SUFFIX)', '<(obj_dir)/deps/uv/<(STATIC_LIB_PREFIX)uv<(STATIC_LIB_SUFFIX)',
'-Wl,--no-whole-archive', '-Wl,--no-whole-archive',
], ],
@ -269,9 +260,18 @@
}], }],
[ '(OS=="freebsd" or OS=="linux") and node_shared=="false"' [ '(OS=="freebsd" or OS=="linux") and node_shared=="false"'
' and force_load=="true"', { ' and force_load=="true"', {
'ldflags': [ '-Wl,-z,noexecstack', 'ldflags': [
'-Wl,-z,noexecstack',
'-Wl,--whole-archive <(v8_base)', '-Wl,--whole-archive <(v8_base)',
'-Wl,--no-whole-archive' ] '-Wl,--no-whole-archive',
]
}],
[ 'node_use_bundled_v8=="true" and v8_postmortem_support==1 and force_load=="true"', {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-Wl,-force_load,<(v8_base)',
],
},
}], }],
[ 'coverage=="true" and node_shared=="false" and OS in "mac freebsd linux"', { [ 'coverage=="true" and node_shared=="false" and OS in "mac freebsd linux"', {
'cflags!': [ '-O3' ], 'cflags!': [ '-O3' ],

View File

@ -1,3 +1,19 @@
#include "src/api-inl.h" #include "src/api-inl.h"
#include "src/ast/ast.h"
#include "src/builtins/builtins-definitions.h"
#include "src/code-stub-assembler.h"
#include "src/globals.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "src/objects/dictionary-inl.h"
#include "src/objects/js-objects-inl.h"
#include "src/objects/fixed-array-inl.h"
#include "src/utils.h" #include "src/utils.h"
#include "src/vector.h"
#include <algorithm>
#include <cstring>
#include <iterator>
#include <iosfwd>
#include <memory>
#include <string>

View File

@ -34,13 +34,36 @@
'v8_current_cpu%': '<(target_arch)', 'v8_current_cpu%': '<(target_arch)',
# Emulate GN variables # Emulate GN variables
# https://chromium.googlesource.com/chromium/src/build/+/556c524beb09c332698debe1b47b065d5d029cd0/config/BUILDCONFIG.gn#269
'conditions': [ 'conditions': [
['OS == "win" or OS == "winuwp"', {
'is_win': 1,
}, {
'is_win': 0,
}],
['OS == "fuchsia"', {
'is_fuchsia': 1,
}, {
'is_fuchsia': 0,
}],
['OS=="android"', { # GYP reverts OS to linux so use `-D OS=android` ['OS=="android"', { # GYP reverts OS to linux so use `-D OS=android`
'is_android': 1, 'is_android': 1,
}, { }, {
'is_android': 0, 'is_android': 0,
}], }],
# flattened (!is_win && !is_fuchsia) because of GYP evaluation order
['not (OS == "win" or OS == "winuwp") and not (OS == "fuchsia")', {
'is_posix': 1,
}, {
'is_posix': 0,
}],
['component and "library" in component', {
'is_component_build': 1,
}, {
'is_component_build': 0,
}],
], ],
'is_debug%': 0,
# Variables from BUILD.gn # Variables from BUILD.gn
@ -92,9 +115,18 @@
# Enable embedded builtins. # Enable embedded builtins.
'v8_enable_embedded_builtins%': 1, 'v8_enable_embedded_builtins%': 1,
# Enable the registration of unwinding info for Windows/x64.
'v8_win64_unwinding_info%': 0,
# Enable code comments for builtins in the snapshot (impacts performance). # Enable code comments for builtins in the snapshot (impacts performance).
'v8_enable_snapshot_code_comments%': 0, 'v8_enable_snapshot_code_comments%': 0,
# Enable native counters from the snapshot (impacts performance, sets
# -dV8_SNAPSHOT_NATIVE_CODE_COUNTERS).
# This option will generate extra code in the snapshot to increment counters,
# as per the --native-code-counters flag.
'v8_enable_snapshot_native_code_counters%': 0,
# Enable code-generation-time checking of types in the CodeStubAssembler. # Enable code-generation-time checking of types in the CodeStubAssembler.
'v8_enable_verify_csa%': 0, 'v8_enable_verify_csa%': 0,
@ -123,6 +155,10 @@
# Enables various testing features. # Enables various testing features.
'v8_enable_test_features%': 0, 'v8_enable_test_features%': 0,
# Enables raw heap snapshots containing internals. Used for debugging memory
# on platform and embedder level.
'v8_enable_raw_heap_snapshots%': 0,
# With post mortem support enabled, metadata is embedded into libv8 that # With post mortem support enabled, metadata is embedded into libv8 that
# describes various parameters of the VM for use by debuggers. See # describes various parameters of the VM for use by debuggers. See
# tools/gen-postmortem-metadata.py for details. # tools/gen-postmortem-metadata.py for details.
@ -131,6 +167,10 @@
# Use Siphash as added protection against hash flooding attacks. # Use Siphash as added protection against hash flooding attacks.
'v8_use_siphash%': 0, 'v8_use_siphash%': 0,
# Use Perfetto (https://perfetto.dev) as the default TracingController. Not
# currently implemented.
'v8_use_perfetto%': 0,
# Controls the threshold for on-heap/off-heap Typed Arrays. # Controls the threshold for on-heap/off-heap Typed Arrays.
'v8_typed_array_max_size_in_heap%': 64, 'v8_typed_array_max_size_in_heap%': 64,
@ -170,6 +210,9 @@
['v8_promise_internal_field_count!=0', { ['v8_promise_internal_field_count!=0', {
'defines': ['V8_PROMISE_INTERNAL_FIELD_COUNT=<(v8_promise_internal_field_count)'], 'defines': ['V8_PROMISE_INTERNAL_FIELD_COUNT=<(v8_promise_internal_field_count)'],
}], }],
['v8_enable_raw_heap_snapshots==1', {
'defines': ['V8_ENABLE_RAW_HEAP_SNAPSHOTS',],
}],
['v8_enable_future==1', { ['v8_enable_future==1', {
'defines': ['V8_ENABLE_FUTURE',], 'defines': ['V8_ENABLE_FUTURE',],
}], }],
@ -240,6 +283,11 @@
# }], # }],
['v8_use_snapshot==1', { ['v8_use_snapshot==1', {
'defines': ['V8_USE_SNAPSHOT',], 'defines': ['V8_USE_SNAPSHOT',],
'conditions': [
['v8_enable_snapshot_native_code_counters==1', {
'defines': ['V8_SNAPSHOT_NATIVE_CODE_COUNTERS',],
}],
],
}], }],
['v8_use_external_startup_data==1', { ['v8_use_external_startup_data==1', {
'defines': ['V8_USE_EXTERNAL_STARTUP_DATA',], 'defines': ['V8_USE_EXTERNAL_STARTUP_DATA',],
@ -265,6 +313,12 @@
['v8_untrusted_code_mitigations==0', { ['v8_untrusted_code_mitigations==0', {
'defines': ['DISABLE_UNTRUSTED_CODE_MITIGATIONS',], 'defines': ['DISABLE_UNTRUSTED_CODE_MITIGATIONS',],
}], }],
['v8_use_perfetto==1', {
'defines': ['V8_USE_PERFETTO',],
}],
['v8_win64_unwinding_info==1', {
'defines': ['V8_WIN64_UNWINDING_INFO',],
}],
], # conditions ], # conditions
'defines': [ 'defines': [
'V8_GYP_BUILD', 'V8_GYP_BUILD',

View File

@ -135,6 +135,8 @@
# Indicates if gcmole tools are downloaded by a hook. # Indicates if gcmole tools are downloaded by a hook.
'gcmole%': 0, 'gcmole%': 0,
}, },
# [GYP] this needs to be outside of the top level 'variables'
'conditions': [ 'conditions': [
['host_arch=="ia32" or host_arch=="x64" or \ ['host_arch=="ia32" or host_arch=="x64" or \
host_arch=="ppc" or host_arch=="ppc64" or \ host_arch=="ppc" or host_arch=="ppc64" or \
@ -166,6 +168,12 @@
'<(V8_ROOT)/include', '<(V8_ROOT)/include',
], ],
'conditions': [ 'conditions': [
['clang', {
'cflags': [ '-Werror', '-Wno-unknown-pragmas' ],
},{
'cflags!': [ '-Wall', '-Wextra' ],
'cflags': [ '-Wno-return-type' ],
}],
['v8_target_arch=="arm"', { ['v8_target_arch=="arm"', {
'defines': [ 'defines': [
'V8_TARGET_ARCH_ARM', 'V8_TARGET_ARCH_ARM',
@ -1398,24 +1406,20 @@
], # conditions ], # conditions
}, # Release }, # Release
}, # configurations }, # configurations
'cflags!': [ '-Wall', '-Wextra' ],
'msvs_disabled_warnings': [ 'msvs_disabled_warnings': [
4129, # unrecognized character escape sequence (torque-generated) 4129, # unrecognized character escape sequence (torque-generated)
4245, # Conversion with signed/unsigned mismatch. 4245, # Conversion with signed/unsigned mismatch.
4267, # Conversion with possible loss of data. 4267, # Conversion with possible loss of data.
4324, # Padding structure due to alignment. 4324, # Padding structure due to alignment.
4351, # 4351, # [refack] Old issue with array init.
4355, 4355, # 'this' used in base member initializer list
4661, # no suitable definition provided for explicit template instantiation request
4701, # Potentially uninitialized local variable. 4701, # Potentially uninitialized local variable.
4702, # Unreachable code. 4702, # Unreachable code.
4703, # Potentially uninitialized local pointer variable. 4703, # Potentially uninitialized local pointer variable.
4709, # Comma operator within array index expr (bugged). 4709, # Comma operator within array index expr (bugged).
4714, # Function marked forceinline not inlined. # 4714, # Function marked forceinline not inlined.
4715, # Not all control paths return a value. (see https://crbug.com/v8/7658)
# MSVC assumes that control can get past an exhaustive switch and then
# warns if there's no return there (see https://crbug.com/v8/7658)
4715, # Not all control paths return a value.
4718, # Recursive call has no side-effect. 4718, # Recursive call has no side-effect.
4723, # https://crbug.com/v8/7771 4723, # https://crbug.com/v8/7771
4724, # https://crbug.com/v8/7771 4724, # https://crbug.com/v8/7771

File diff suppressed because it is too large Load Diff