diff options
author | siggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-20 21:37:37 +0000 |
---|---|---|
committer | siggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-20 21:37:37 +0000 |
commit | 2212d27f2cc41983901f45299cda82d704c76e82 (patch) | |
tree | fd93ccd2a78bf29937cd08d79bdb36d6f64378d3 | |
parent | 91f0305ba68709d19b3ac85ffa67a0dc5525503e (diff) | |
download | chromium_src-2212d27f2cc41983901f45299cda82d704c76e82.zip chromium_src-2212d27f2cc41983901f45299cda82d704c76e82.tar.gz chromium_src-2212d27f2cc41983901f45299cda82d704c76e82.tar.bz2 |
With this change, each target can select an optimization level for Windows official builds by setting a variable name "optimize" to one of three possible values:
- "size"; optimizes for minimal code size, the default.
- "speed"; optimizes for speed over code size.
- "max"; turns on link time code generation and whole
program optimization, which is very expensive and should
be used sparingly.
Note that this change by itself lowers the optimization level to "size" for all targets. Separate changes to the V8 and WebKit repos will be needed to bring up their optimization levels to WPO.
BUG=108167
TEST=
Review URL: http://codereview.chromium.org/8983002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115187 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | build/common.gypi | 66 | ||||
-rw-r--r-- | build/internal/release_defaults.gypi | 6 | ||||
-rw-r--r-- | build/internal/release_impl.gypi | 3 | ||||
-rw-r--r-- | build/internal/release_impl_official.gypi | 14 |
4 files changed, 77 insertions, 12 deletions
diff --git a/build/common.gypi b/build/common.gypi index 12f3b05..dc5b830 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -755,14 +755,14 @@ ], }], # OS=="mac" - # Whether to use multiple cores to compile with visual studio. This is - # optional because it sometimes causes corruption on VS 2005. - # It is on by default on VS 2008 and off on VS 2005. ['OS=="win"', { 'conditions': [ ['component=="shared_library"', { 'win_use_allocator_shim%': 0, }], + # Whether to use multiple cores to compile with visual studio. This is + # optional because it sometimes causes corruption on VS 2005. + # It is on by default on VS 2008 and off on VS 2005. ['MSVS_VERSION=="2005"', { 'msvs_multi_core_compile%': 0, },{ @@ -1509,9 +1509,14 @@ }, 'msvs_settings': { 'VCCLCompilerTool': { - 'Optimization': '<(win_release_Optimization)', 'RuntimeLibrary': '<(win_release_RuntimeLibrary)', 'conditions': [ + # In official builds, each target will self-select + # an optimization level. + ['buildtype!="Official"', { + 'Optimization': '<(win_release_Optimization)', + }, + ], # According to MSVS, InlineFunctionExpansion=0 means # "default inlining", not "/Ob0". # Thus, we have to handle InlineFunctionExpansion==0 separately. @@ -2341,7 +2346,7 @@ 'OTHER_LDFLAGS': [ '-faddress-sanitizer', # The symbols below are referenced in the ASan runtime - # library (compiled on OS X 10.6), but may be unavailable + # library (compiled on OS X 10.6), but may be unavailable # on the prior OS X versions. Because Chromium is currently # targeting 10.5.0, we need to explicitly mark these # symbols as dynamic_lookup. @@ -2493,6 +2498,57 @@ '_HAS_TR1=0', ], 'conditions': [ + ['buildtype=="Official"', { + # In official builds, targets can self-select an optimization + # level by defining a variable named 'optimize', and setting it + # to one of + # - "size", optimizes for minimal code size - the default. + # - "speed", optimizes for speed over code size. + # - "max", whole program optimization and link-time code + # generation. This is very expensive and should be used + # sparingly. + 'variables': { + 'optimize%': 'size', + }, + 'target_conditions': [ + ['optimize=="size"', { + 'msvs_settings': { + 'VCCLCompilerTool': { + # 1, optimizeMinSpace, Minimize Size (/O1) + 'Optimization': '1', + # 2, favorSize - Favor small code (/Os) + 'FavorSizeOrSpeed': '2', + }, + }, + }, + ], + ['optimize=="speed"', { + 'msvs_settings': { + 'VCCLCompilerTool': { + # 2, optimizeMaxSpeed, Maximize Speed (/O2) + 'Optimization': '2', + # 1, favorSpeed - Favor fast code (/Ot) + 'FavorSizeOrSpeed': '1', + }, + }, + }, + ], + ['optimize=="max"', { + 'msvs_settings': { + 'VCCLCompilerTool': { + # 2, optimizeMaxSpeed, Maximize Speed (/O2) + 'Optimization': '2', + # 1, favorSpeed - Favor fast code (/Ot) + 'FavorSizeOrSpeed': '1', + # This implies link time code generation. + 'WholeProgramOptimization': 'true', + }, + }, + }, + ], + ], + }, + ], ['component=="static_library"', { 'defines': [ '_HAS_EXCEPTIONS=0', diff --git a/build/internal/release_defaults.gypi b/build/internal/release_defaults.gypi index 7f1ddb8..1bf674a 100644 --- a/build/internal/release_defaults.gypi +++ b/build/internal/release_defaults.gypi @@ -1,11 +1,17 @@ +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. { 'msvs_settings': { 'VCCLCompilerTool': { 'StringPooling': 'true', }, 'VCLinkerTool': { + # No incremental linking. 'LinkIncremental': '1', + # Eliminate Unreferenced Data (/OPT:REF). 'OptimizeReferences': '2', + # Folding on (/OPT:ICF). 'EnableCOMDATFolding': '2', }, }, diff --git a/build/internal/release_impl.gypi b/build/internal/release_impl.gypi index aff06dc..2e95aee 100644 --- a/build/internal/release_impl.gypi +++ b/build/internal/release_impl.gypi @@ -1,3 +1,6 @@ +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. { 'includes': ['release_defaults.gypi'], } diff --git a/build/internal/release_impl_official.gypi b/build/internal/release_impl_official.gypi index d62e955..8c13349 100644 --- a/build/internal/release_impl_official.gypi +++ b/build/internal/release_impl_official.gypi @@ -1,23 +1,23 @@ +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. { 'includes': ['release_defaults.gypi'], 'defines': ['OFFICIAL_BUILD'], 'msvs_settings': { 'VCCLCompilerTool': { - 'Optimization': '3', 'InlineFunctionExpansion': '2', 'EnableIntrinsicFunctions': 'true', - 'FavorSizeOrSpeed': '2', 'OmitFramePointers': 'true', 'EnableFiberSafeOptimizations': 'true', - 'WholeProgramOptimization': 'true', }, 'VCLibrarianTool': { - 'AdditionalOptions': ['/ltcg', '/expectedoutputsize:120000000'], + 'AdditionalOptions': [ + '/ltcg', + '/expectedoutputsize:120000000' + ], }, 'VCLinkerTool': { - # Get more debug spew from the linker while we're sorting out - # build problems and performance. - # TODO(siggi): Remove these flags after we're out of the woods. 'AdditionalOptions': [ '/time', # This may reduce memory fragmentation during linking. |