build,win,v8: allow precompiling objects-inl.h

This makes compiling v8_base much faster on Windows.

Sharding is disabled because the header would have to be precompiled
for each shard but is only once. The library is much smaller, so
sharding is unnecessary.

This is enabled by default, but disabled for CI and releases.

PR-URL: https://github.com/nodejs/node/pull/21772
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
This commit is contained in:
João Reis 2018-07-11 22:25:18 +01:00 committed by Rich Trott
parent 186c2fb6d8
commit 48e5b350b3
6 changed files with 33 additions and 6 deletions

View file

@ -17,6 +17,7 @@
'node_use_bundled_v8%': 'true',
'node_module_version%': '',
'node_with_ltcg%': '',
'node_use_pch%': 'false',
'node_tag%': '',
'uv_library%': 'static_library',

10
configure vendored
View file

@ -438,6 +438,11 @@ parser.add_option('--with-ltcg',
dest='with_ltcg',
help='Use Link Time Code Generation. This feature is only available on Windows.')
parser.add_option('--with-pch',
action='store_true',
dest='with_pch',
help='Use Precompiled Headers (only available on Windows).')
intl_optgroup.add_option('--download',
action='store',
dest='download_list',
@ -995,6 +1000,11 @@ def configure_node(o):
if flavor != 'win' and options.with_ltcg:
raise Exception('Link Time Code Generation is only supported on Windows.')
if flavor == 'win':
o['variables']['node_use_pch'] = b(options.with_pch)
else:
o['variables']['node_use_pch'] = 'false'
if options.tag:
o['variables']['node_tag'] = '-' + options.tag
else:

View file

@ -1844,10 +1844,20 @@
'gyp_generators': '<!(echo $GYP_GENERATORS)',
},
'msvs_disabled_warnings': [4351, 4355, 4800],
# When building Official, the .lib is too large and exceeds the 2G
# limit. This breaks it into multiple pieces to avoid the limit.
# See http://crbug.com/485155.
'msvs_shard': 4,
'conditions': [
['node_use_pch!="true"', {
# When building Official, the .lib is too large and exceeds the 2G
# limit. This breaks it into multiple pieces to avoid the limit.
# See http://crbug.com/485155.
'msvs_shard': 4,
}, {
'msvs_precompiled_header': 'tools/msvs/pch/pch_v8_base.h',
'msvs_precompiled_source': '../../../tools/msvs/pch/pch_v8_base.cc',
'sources': [
'../../../tools/msvs/pch/pch_v8_base.cc',
],
}],
],
# This will prevent V8's .cc files conflicting with the inspector's
# .cpp files in the same shard.
'msvs_settings': {

View file

@ -0,0 +1 @@
#include "tools/msvs/pch/pch_v8_base.h"

View file

@ -0,0 +1 @@
#include "src/objects-inl.h"

View file

@ -16,6 +16,7 @@ set config=Release
set target=Build
set target_arch=x64
set ltcg=
set pch=1
set target_env=
set noprojgen=
set projgen=
@ -62,7 +63,7 @@ set doc=
:next-arg
if "%1"=="" goto args-done
if /i "%1"=="debug" set config=Debug&goto arg-ok
if /i "%1"=="release" set config=Release&set ltcg=1&goto arg-ok
if /i "%1"=="release" set config=Release&set ltcg=1&set "pch="&goto arg-ok
if /i "%1"=="clean" set target=Clean&goto arg-ok
if /i "%1"=="ia32" set target_arch=x86&goto arg-ok
if /i "%1"=="x86" set target_arch=x86&goto arg-ok
@ -77,6 +78,7 @@ if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok
if /i "%1"=="noetw" set noetw=1&goto arg-ok
if /i "%1"=="noperfctr" set noperfctr=1&goto arg-ok
if /i "%1"=="ltcg" set ltcg=1&goto arg-ok
if /i "%1"=="nopch" set "pch="&goto arg-ok
if /i "%1"=="licensertf" set licensertf=1&goto arg-ok
if /i "%1"=="test" set test_args=%test_args% -J %common_test_suites%&set lint_cpp=1&set lint_js=1&set lint_md=1&goto arg-ok
if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap %common_test_suites%&set cctest_args=%cctest_args% --gtest_output=tap:cctest.tap&goto arg-ok
@ -153,6 +155,7 @@ if defined build_release (
set i18n_arg=small-icu
set projgen=1
set ltcg=1
set "pch="
)
:: assign path to node_exe
@ -166,6 +169,7 @@ if defined nosnapshot set configure_flags=%configure_flags% --without-snap
if defined noetw set configure_flags=%configure_flags% --without-etw& set noetw_msi_arg=/p:NoETW=1
if defined noperfctr set configure_flags=%configure_flags% --without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1
if defined ltcg set configure_flags=%configure_flags% --with-ltcg
if defined pch set configure_flags=%configure_flags% --with-pch
if defined release_urlbase set configure_flags=%configure_flags% --release-urlbase=%release_urlbase%
if defined download_arg set configure_flags=%configure_flags% %download_arg%
if defined enable_vtune_arg set configure_flags=%configure_flags% --enable-vtune-profiling
@ -668,7 +672,7 @@ del .used_configure_flags
goto exit
:help
echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-internet/test-pummel/test-simple/test-message/test-gc/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [ltcg] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm]
echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-internet/test-pummel/test-simple/test-message/test-gc/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [ltcg] [nopch] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm]
echo Examples:
echo vcbuild.bat : builds release build
echo vcbuild.bat debug : builds debug build