Use abstract configurations to switch between opt debug settings

The problem is that conditions are evaluated before configuration inheritance is resolved, so we can't just define a configuration like this:

'Optdebug': {
  'inherits_from': ['Debug'],
  'variables': {
    'v8_optimized_debug': 2,
  }
}

Instead, we have to put the different settings depending on the optimization level into separate configurations, and use conditions inside the concrete configurations to inherit from the correct base class.

Common settings go in the base configuration DebugBaseCommon, and v8_optimized_debug dependent settings go into DebugBase{0,1,2}

The new Debug configuration inherits from DebugBaseCommon and DebugBase<(v8_optimized_debug), while the new configuration Optdebug inherits from DebugBaseCommon and DebugBase2.

BUG=v8:3252
R=machenbach@chromium.org, jkummerow@chromium.org
LOG=n

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20605 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jochen@chromium.org 2014-04-09 09:54:49 +00:00
parent 728614daf9
commit d426cd1012
3 changed files with 188 additions and 137 deletions

View File

@ -98,7 +98,8 @@
}],
], # conditions
'configurations': {
'Debug': {
'DebugBaseCommon': {
'abstract': 1,
'variables': {
'v8_enable_extra_checks%': 1,
'v8_enable_handle_zapping%': 1,

View File

@ -135,9 +135,15 @@
},
'default_configuration': 'Debug',
'configurations': {
'Debug': {
'DebugBaseCommon': {
'cflags': [ '-g', '-O0' ],
},
'Optdebug': {
'inherit_from': [ 'DebugBaseCommon', 'DebugBase2' ],
},
'Debug': {
# Xcode insists on this empty entry.
},
'Release': {
# Xcode insists on this empty entry.
},

View File

@ -445,7 +445,172 @@
}],
], # conditions
'configurations': {
'Debug': {
# Abstract configuration for v8_optimized_debug == 0.
'DebugBase0': {
'abstract': 1,
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': '0',
'conditions': [
['component=="shared_library"', {
'RuntimeLibrary': '3', # /MDd
}, {
'RuntimeLibrary': '1', # /MTd
}],
],
},
'VCLinkerTool': {
'LinkIncremental': '2',
},
},
'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
OS=="qnx"', {
'cflags!': [
'-O0',
'-O3',
'-O2',
'-O1',
'-Os',
],
'cflags': [
'-fdata-sections',
'-ffunction-sections',
],
}],
['OS=="mac"', {
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '0', # -O0
},
}],
],
}, # DebugBase0
# Abstract configuration for v8_optimized_debug == 1.
'DebugBase1': {
'abstract': 1,
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': '1',
'InlineFunctionExpansion': '2',
'EnableIntrinsicFunctions': 'true',
'FavorSizeOrSpeed': '0',
'StringPooling': 'true',
'BasicRuntimeChecks': '0',
'conditions': [
['component=="shared_library"', {
'RuntimeLibrary': '3', # /MDd
}, {
'RuntimeLibrary': '1', # /MTd
}],
],
},
'VCLinkerTool': {
'LinkIncremental': '2',
},
},
'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
OS=="qnx"', {
'cflags!': [
'-O0',
'-O3', # TODO(2807) should be -O1.
'-O2',
'-Os',
],
'cflags': [
'-fdata-sections',
'-ffunction-sections',
'-O1', # TODO(2807) should be -O3.
],
'conditions': [
['gcc_version==44 and clang==0', {
'cflags': [
# Avoid crashes with gcc 4.4 in the v8 test suite.
'-fno-tree-vrp',
],
}],
],
}],
['OS=="mac"', {
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '3', # -O3
'GCC_STRICT_ALIASING': 'YES',
},
}],
],
}, # DebugBase1
# Abstract configuration for v8_optimized_debug == 2.
'DebugBase2': {
'abstract': 1,
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': '2',
'InlineFunctionExpansion': '2',
'EnableIntrinsicFunctions': 'true',
'FavorSizeOrSpeed': '0',
'StringPooling': 'true',
'BasicRuntimeChecks': '0',
'conditions': [
['component=="shared_library"', {
'RuntimeLibrary': '3', #/MDd
}, {
'RuntimeLibrary': '1', #/MTd
}],
['v8_target_arch=="x64"', {
# TODO(2207): remove this option once the bug is fixed.
'WholeProgramOptimization': 'true',
}],
],
},
'VCLinkerTool': {
'LinkIncremental': '1',
'OptimizeReferences': '2',
'EnableCOMDATFolding': '2',
},
},
'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
OS=="qnx"', {
'cflags!': [
'-O0',
'-O1',
'-Os',
],
'cflags': [
'-fdata-sections',
'-ffunction-sections',
],
'defines': [
'OPTIMIZED_DEBUG'
],
'conditions': [
# TODO(crbug.com/272548): Avoid -O3 in NaCl
['nacl_target_arch=="none"', {
'cflags': ['-O3'],
'cflags!': ['-O2'],
}, {
'cflags': ['-O2'],
'cflags!': ['-O3'],
}],
['gcc_version==44 and clang==0', {
'cflags': [
# Avoid crashes with gcc 4.4 in the v8 test suite.
'-fno-tree-vrp',
],
}],
],
}],
['OS=="mac"', {
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '3', # -O3
'GCC_STRICT_ALIASING': 'YES',
},
}],
],
}, # DebugBase2
# Common settings for the Debug configuration.
'DebugBaseCommon': {
'abstract': 1,
'defines': [
'ENABLE_DISASSEMBLER',
'V8_ENABLE_CHECKS',
@ -453,133 +618,10 @@
'VERIFY_HEAP',
'DEBUG'
],
'msvs_settings': {
'VCCLCompilerTool': {
'conditions': [
['v8_optimized_debug==0', {
'Optimization': '0',
'conditions': [
['component=="shared_library"', {
'RuntimeLibrary': '3', # /MDd
}, {
'RuntimeLibrary': '1', # /MTd
}],
],
}],
['v8_optimized_debug==1', {
'Optimization': '1',
'InlineFunctionExpansion': '2',
'EnableIntrinsicFunctions': 'true',
'FavorSizeOrSpeed': '0',
'StringPooling': 'true',
'BasicRuntimeChecks': '0',
'conditions': [
['component=="shared_library"', {
'RuntimeLibrary': '3', # /MDd
}, {
'RuntimeLibrary': '1', # /MTd
}],
],
}],
['v8_optimized_debug==2', {
'Optimization': '2',
'InlineFunctionExpansion': '2',
'EnableIntrinsicFunctions': 'true',
'FavorSizeOrSpeed': '0',
'StringPooling': 'true',
'BasicRuntimeChecks': '0',
'conditions': [
['component=="shared_library"', {
'RuntimeLibrary': '3', #/MDd
}, {
'RuntimeLibrary': '1', #/MTd
}],
['v8_target_arch=="x64"', {
# TODO(2207): remove this option once the bug is fixed.
'WholeProgramOptimization': 'true',
}],
],
}],
],
},
'VCLinkerTool': {
'conditions': [
['v8_optimized_debug==0', {
'LinkIncremental': '2',
}],
['v8_optimized_debug==1', {
'LinkIncremental': '2',
}],
['v8_optimized_debug==2', {
'LinkIncremental': '1',
'OptimizeReferences': '2',
'EnableCOMDATFolding': '2',
}],
],
},
},
'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
OS=="qnx"', {
'cflags': [ '-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',
'-Os',
],
'cflags': [
'-fdata-sections',
'-ffunction-sections',
],
'defines': [
'OPTIMIZED_DEBUG'
],
'conditions': [
# TODO(crbug.com/272548): Avoid -O3 in NaCl
['nacl_target_arch=="none"', {
'cflags': ['-O3'],
'cflags!': ['-O2'],
}, {
'cflags': ['-O2'],
'cflags!': ['-O3'],
}],
],
}],
['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',
],
}],
],
}],
['OS=="linux" and v8_enable_backtrace==1', {
# Support for backtrace_symbols.
@ -599,17 +641,19 @@
}],
],
}],
['OS=="mac"', {
'xcode_settings': {
'conditions': [
['v8_optimized_debug==0', {
'GCC_OPTIMIZATION_LEVEL': '0', # -O0
}, {
'GCC_OPTIMIZATION_LEVEL': '3', # -O3
'GCC_STRICT_ALIASING': 'YES',
}],
],
},
],
}, # DebugBaseCommon
'Debug': {
'inherit_from': ['DebugBaseCommon'],
'conditions': [
['v8_optimized_debug==0', {
'inherit_from': ['DebugBase0'],
}],
['v8_optimized_debug==1', {
'inherit_from': ['DebugBase1'],
}],
['v8_optimized_debug==2', {
'inherit_from': ['DebugBase2'],
}],
],
}, # Debug