Commit d0e0ff01 authored by dslomov@chromium.org's avatar dslomov@chromium.org

Revamp v8_optimized_debug options

This patch changes the definition of v8_optimized_debug==1 to match the release-mode compiler optimization settings (generally, going from -O1 to -O3 on Linux, similar switches for Mac/Win). This produces a minor speed up on Linux, but significant speedups on Mac and Win. This may make it much harder to debug, though.

It also adds a v8_optimized_debug==2 that, in addition to the compiler optimizations, undef's DEBUG and defines DEBUG. This leaves V8_ENABLE_CHECKS alone (so that the assertions are still enabled), but otherwise basically matches a release mode build.

Builds with v8_optimized_debug==2 roughly match a Release mode build for speed; the V8_ENABLE_CHECKS checks appear to have minimal performance impact (maybe 5-10%, unlike what was previously thought). In addition, switching from the previous optimization settings makes a significant improvement on Mac and Win (50% or more), and switching from DEBUG to NDEBUG makes a significant improvement (another 50% or more).

Note that using v8_optimized_debug==2 may also cause some v8 tests to fail. This is currently is believed to be acceptable.

R=machenbach@chromium.org
BUG=254188

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

Patch from Dirk Pranke <dpranke@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15937 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b019910a
...@@ -60,7 +60,19 @@ ...@@ -60,7 +60,19 @@
'v8_enable_backtrace%': 0, 'v8_enable_backtrace%': 0,
# Turns on compiler optimizations in Debug builds (#defines are unaffected). # Speeds up Debug builds:
# 0 - compiler optimizations off (debuggable) (default). This may
# be 5x slower than Release (or worse).
# 1 - turn on compiler optimizations. and #undef DEBUG/#define NDEBUG.
# This may be hard or impossible to debug. This may still be
# 2x slower than Release (or worse).
# 2 - Turn on optimizations, and also #undef DEBUG / #define NDEBUG
# (but leave V8_ENABLE_CHECKS and most other assertions enabled.
# This may cause some v8 tests to fail in the Debug configuration.
# This roughly matches the performance of a Release build and can
# be used by embedders that need to build their own code as debug
# but don't want or need a debug version of V8. This should produce
# near-release speeds.
'v8_optimized_debug%': 0, 'v8_optimized_debug%': 0,
# Enable profiling support. Only required on Windows. # Enable profiling support. Only required on Windows.
...@@ -435,7 +447,6 @@ ...@@ -435,7 +447,6 @@
'configurations': { 'configurations': {
'Debug': { 'Debug': {
'defines': [ 'defines': [
'DEBUG',
'ENABLE_DISASSEMBLER', 'ENABLE_DISASSEMBLER',
'V8_ENABLE_CHECKS', 'V8_ENABLE_CHECKS',
'OBJECT_PRINT', 'OBJECT_PRINT',
...@@ -449,41 +460,96 @@ ...@@ -449,41 +460,96 @@
}, { }, {
'RuntimeLibrary': '1', # /MTd 'RuntimeLibrary': '1', # /MTd
}], }],
['v8_optimized_debug==1', { ['v8_optimized_debug==0', {
'Optimization': '1', 'Optimization': '0',
}, {
'Optimization': '2',
'InlineFunctionExpansion': '2', 'InlineFunctionExpansion': '2',
'EnableIntrinsicFunctions': 'true', 'EnableIntrinsicFunctions': 'true',
'FavorSizeOrSpeed': '0', 'FavorSizeOrSpeed': '0',
'StringPooling': 'true', 'StringPooling': 'true',
'BasicRuntimeChecks': '0', 'BasicRuntimeChecks': '0',
'conditions': [
['component=="shared_library"', {
'RuntimeLibrary': '2', #/MD
}, { }, {
'Optimization': '0', 'RuntimeLibrary': '0', #/MT
}],
['v8_target_arch=="x64"', {
# TODO(2207): remove this option once the bug is fixed.
'WholeProgramOptimization': 'true',
}],
],
}], }],
], ],
}, },
'VCLinkerTool': { 'VCLinkerTool': {
'conditions': [
['v8_optimized_debug==0', {
'LinkIncremental': '2', 'LinkIncremental': '2',
}, {
'LinkIncremental': '1',
'OptimizeReferences': '2',
'EnableCOMDATFolding': '2',
}],
],
}, },
}, },
'conditions': [ 'conditions': [
['v8_optimized_debug==2', {
'defines': [
'NDEBUG',
],
}, {
'defines': [
'DEBUG',
],
}],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', { ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
'-Wnon-virtual-dtor', '-Woverloaded-virtual', '-Wnon-virtual-dtor', '-Woverloaded-virtual',
'<(wno_array_bounds)' ], '<(wno_array_bounds)' ],
'conditions': [ 'conditions': [
['v8_optimized_debug==0', {
'cflags!': [
'-O0',
'-O3',
'-O2',
'-O1',
'-Os',
],
'cflags': [
'-fdata-sections',
'-ffunction-sections',
],
}],
['v8_optimized_debug==1', { ['v8_optimized_debug==1', {
'cflags!': [ 'cflags!': [
'-O0', '-O0',
'-O3', # TODO(2807) should be -O1.
'-O2', '-O2',
'-Os', '-Os',
], ],
'cflags': [ 'cflags': [
'-fdata-sections', '-fdata-sections',
'-ffunction-sections', '-ffunction-sections',
'-O1', # TODO(2807) should be -O3.
],
}],
['v8_optimized_debug==2', {
'cflags!': [
'-O0',
'-O1', '-O1',
'-O2',
'-Os',
],
'cflags': [
'-fdata-sections',
'-ffunction-sections',
'-O3',
], ],
}], }],
['v8_optimized_debug==1 and gcc_version==44 and clang==0', { ['v8_optimized_debug!=0 and gcc_version==44 and clang==0', {
'cflags': [ 'cflags': [
# Avoid crashes with gcc 4.4 in the v8 test suite. # Avoid crashes with gcc 4.4 in the v8 test suite.
'-fno-tree-vrp', '-fno-tree-vrp',
...@@ -512,11 +578,11 @@ ...@@ -512,11 +578,11 @@
['OS=="mac"', { ['OS=="mac"', {
'xcode_settings': { 'xcode_settings': {
'conditions': [ 'conditions': [
['v8_optimized_debug==1', { ['v8_optimized_debug==0', {
'GCC_OPTIMIZATION_LEVEL': '1', # -O1
'GCC_STRICT_ALIASING': 'YES',
}, {
'GCC_OPTIMIZATION_LEVEL': '0', # -O0 'GCC_OPTIMIZATION_LEVEL': '0', # -O0
}, {
'GCC_OPTIMIZATION_LEVEL': '3', # -O3
'GCC_STRICT_ALIASING': 'YES',
}], }],
], ],
}, },
......
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