Skip to content

Commit

Permalink
build: configure default v8_optimized_debug
Browse files Browse the repository at this point in the history
Under the assumption that debugging is more often focused on node core
source. This setting compiles V8 with only partial optimizations,
DCHECKS, and debug symbols, so it is still very much debuggable,
but it is much faster.

It does disable SLOW_DCHECKS, but at the advice of the V8 team, those
are more important for deep V8 debugging.

Override is configurable with `./configure --v8-non-optimized-debug`.

PR-URL: #23704
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
  • Loading branch information
refack authored and MylesBorins committed Nov 27, 2018
1 parent 592f5bd commit 51947a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 0 additions & 3 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@

'openssl_fips%': '',

# Default to -O0 for debug builds.
'v8_optimized_debug%': 0,

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.44',
Expand Down
8 changes: 7 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,12 @@
default=True,
help='get more output from this script')

parser.add_option('--v8-non-optimized-debug',
action='store_true',
dest='v8_non_optimized_debug',
default=False,
help='compile V8 with minimal optimizations and with runtime checks')

# Create compile_commands.json in out/Debug and out/Release.
parser.add_option('-C',
action='store_true',
Expand Down Expand Up @@ -1156,7 +1162,7 @@ def configure_library(lib, output):
def configure_v8(o):
o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0
o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs.
o['variables']['v8_optimized_debug'] = 0 # Compile with -O0 in debug builds.
o['variables']['v8_optimized_debug'] = 0 if options.v8_non_optimized_debug else 1
o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables.
o['variables']['v8_promise_internal_field_count'] = 1 # Add internal field to promises for async hooks.
o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true'
Expand Down

0 comments on commit 51947a5

Please sign in to comment.