Revision: 15937
Author: [email protected]
Date: Mon Jul 29 07:00:06 2013
Log: 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.
[email protected]
BUG=254188
Review URL: https://codereview.chromium.org/19384011
Patch from Dirk Pranke <[email protected]>.
http://code.google.com/p/v8/source/detail?r=15937
Modified:
/branches/bleeding_edge/build/toolchain.gypi
=======================================
--- /branches/bleeding_edge/build/toolchain.gypi Wed Jul 10 09:21:17 2013
+++ /branches/bleeding_edge/build/toolchain.gypi Mon Jul 29 07:00:06 2013
@@ -60,7 +60,19 @@
'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,
# Enable profiling support. Only required on Windows.
@@ -435,7 +447,6 @@
'configurations': {
'Debug': {
'defines': [
- 'DEBUG',
'ENABLE_DISASSEMBLER',
'V8_ENABLE_CHECKS',
'OBJECT_PRINT',
@@ -449,41 +460,96 @@
}, {
'RuntimeLibrary': '1', # /MTd
}],
- ['v8_optimized_debug==1', {
- 'Optimization': '1',
+ ['v8_optimized_debug==0', {
+ 'Optimization': '0',
+ }, {
+ 'Optimization': '2',
'InlineFunctionExpansion': '2',
'EnableIntrinsicFunctions': 'true',
'FavorSizeOrSpeed': '0',
'StringPooling': 'true',
'BasicRuntimeChecks': '0',
- }, {
- 'Optimization': '0',
+ 'conditions': [
+ ['component=="shared_library"', {
+ 'RuntimeLibrary': '2', #/MD
+ }, {
+ 'RuntimeLibrary': '0', #/MT
+ }],
+ ['v8_target_arch=="x64"', {
+ # TODO(2207): remove this option once the bug is fixed.
+ 'WholeProgramOptimization': 'true',
+ }],
+ ],
}],
],
},
'VCLinkerTool': {
- 'LinkIncremental': '2',
+ 'conditions': [
+ ['v8_optimized_debug==0', {
+ 'LinkIncremental': '2',
+ }, {
+ 'LinkIncremental': '1',
+ 'OptimizeReferences': '2',
+ 'EnableCOMDATFolding': '2',
+ }],
+ ],
},
},
'conditions': [
+ ['v8_optimized_debug==2', {
+ 'defines': [
+ 'NDEBUG',
+ ],
+ }, {
+ 'defines': [
+ 'DEBUG',
+ ],
+ }],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or
OS=="netbsd"', {
'cflags':
[ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
'-Wnon-virtual-dtor', '-Woverloaded-virtual',
'<(wno_array_bounds)' ],
'conditions': [
+ ['v8_optimized_debug==0', {
+ 'cflags!': [
+ '-O0',
+ '-O3',
+ '-O2',
+ '-O1',
+ '-Os',
+ ],
+ 'cflags': [
+ '-fdata-sections',
+ '-ffunction-sections',
+ ],
+ }],
['v8_optimized_debug==1', {
'cflags!': [
'-O0',
+ '-O3', # TODO(2807) should be -O1.
'-O2',
'-Os',
],
'cflags': [
'-fdata-sections',
'-ffunction-sections',
+ '-O1', # TODO(2807) should be -O3.
+ ],
+ }],
+ ['v8_optimized_debug==2', {
+ 'cflags!': [
+ '-O0',
'-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': [
# Avoid crashes with gcc 4.4 in the v8 test suite.
'-fno-tree-vrp',
@@ -512,11 +578,11 @@
['OS=="mac"', {
'xcode_settings': {
'conditions': [
- ['v8_optimized_debug==1', {
- 'GCC_OPTIMIZATION_LEVEL': '1', # -O1
- 'GCC_STRICT_ALIASING': 'YES',
- }, {
+ ['v8_optimized_debug==0', {
'GCC_OPTIMIZATION_LEVEL': '0', # -O0
+ }, {
+ 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
+ 'GCC_STRICT_ALIASING': 'YES',
}],
],
},
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.