Home | History | Annotate | Download | only in build
      1 # Copyright 2013 the V8 project authors. All rights reserved.
      2 # Redistribution and use in source and binary forms, with or without
      3 # modification, are permitted provided that the following conditions are
      4 # met:
      5 #
      6 #     * Redistributions of source code must retain the above copyright
      7 #       notice, this list of conditions and the following disclaimer.
      8 #     * Redistributions in binary form must reproduce the above
      9 #       copyright notice, this list of conditions and the following
     10 #       disclaimer in the documentation and/or other materials provided
     11 #       with the distribution.
     12 #     * Neither the name of Google Inc. nor the names of its
     13 #       contributors may be used to endorse or promote products derived
     14 #       from this software without specific prior written permission.
     15 #
     16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 
     28 # Shared definitions for all V8-related targets.
     29 
     30 {
     31   'variables': {
     32     'msvs_use_common_release': 0,
     33     'gcc_version%': 'unknown',
     34     'CXX%': '${CXX:-$(which g++)}',  # Used to assemble a shell command.
     35     'v8_target_arch%': '<(target_arch)',
     36     # Native Client builds currently use the V8 ARM JIT and
     37     # arm/simulator-arm.cc to defer the significant effort required
     38     # for NaCl JIT support. The nacl_target_arch variable provides
     39     # the 'true' target arch for places in this file that need it.
     40     # TODO(bradchen): get rid of nacl_target_arch when someday
     41     # NaCl V8 builds stop using the ARM simulator
     42     'nacl_target_arch%': 'none',     # must be set externally
     43 
     44     # Setting 'v8_can_use_vfp32dregs' to 'true' will cause V8 to use the VFP
     45     # registers d16-d31 in the generated code, both in the snapshot and for the
     46     # ARM target. Leaving the default value of 'false' will avoid the use of
     47     # these registers in the snapshot and use CPU feature probing when running
     48     # on the target.
     49     'v8_can_use_vfp32dregs%': 'false',
     50     'arm_test%': 'off',
     51 
     52     # Similar to vfp but on MIPS.
     53     'v8_can_use_fpu_instructions%': 'true',
     54 
     55     # Similar to the ARM hard float ABI but on MIPS.
     56     'v8_use_mips_abi_hardfloat%': 'true',
     57 
     58     # Default arch variant for MIPS.
     59     'mips_arch_variant%': 'mips32r2',
     60 
     61     'v8_enable_backtrace%': 0,
     62 
     63     # Enable profiling support. Only required on Windows.
     64     'v8_enable_prof%': 0,
     65 
     66     # Some versions of GCC 4.5 seem to need -fno-strict-aliasing.
     67     'v8_no_strict_aliasing%': 0,
     68 
     69     # Chrome needs this definition unconditionally. For standalone V8 builds,
     70     # it's handled in build/standalone.gypi.
     71     'want_separate_host_toolset%': 1,
     72 
     73     'host_os%': '<(OS)',
     74     'werror%': '-Werror',
     75     # For a shared library build, results in "libv8-<(soname_version).so".
     76     'soname_version%': '',
     77 
     78     # Allow to suppress the array bounds warning (default is no suppression).
     79     'wno_array_bounds%': '',
     80   },
     81   'target_defaults': {
     82     'conditions': [
     83       ['v8_target_arch=="arm"', {
     84         'defines': [
     85           'V8_TARGET_ARCH_ARM',
     86         ],
     87         'target_conditions': [
     88           ['_toolset=="host"', {
     89             'variables': {
     90               'armcompiler': '<!($(echo ${CXX_host:-$(which g++)}) -v 2>&1 | grep -q "^Target: arm" && echo "yes" || echo "no")',
     91             },
     92             'conditions': [
     93               ['armcompiler=="yes"', {
     94                 'conditions': [
     95                   [ 'armv7==1', {
     96                     'cflags': ['-march=armv7-a',],
     97                   }],
     98                   [ 'armv7==1 or armv7=="default"', {
     99                     'conditions': [
    100                       [ 'arm_neon==1', {
    101                         'cflags': ['-mfpu=neon',],
    102                       },
    103                       {
    104                         'conditions': [
    105                           [ 'arm_fpu!="default"', {
    106                             'cflags': ['-mfpu=<(arm_fpu)',],
    107                           }],
    108                         ],
    109                       }],
    110                     ],
    111                   }],
    112                   [ 'arm_float_abi!="default"', {
    113                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
    114                   }],
    115                   [ 'arm_thumb==1', {
    116                     'cflags': ['-mthumb',],
    117                   }],
    118                   [ 'arm_thumb==0', {
    119                     'cflags': ['-marm',],
    120                   }],
    121                   [ 'arm_test=="on"', {
    122                     'defines': [
    123                       'ARM_TEST',
    124                     ],
    125                   }],
    126                 ],
    127               }, {
    128                 # armcompiler=="no"
    129                 'conditions': [
    130                   [ 'armv7==1 or armv7=="default"', {
    131                     'defines': [
    132                       'CAN_USE_ARMV7_INSTRUCTIONS=1',
    133                     ],
    134                     'conditions': [
    135                       [ 'arm_fpu=="default"', {
    136                         'defines': [
    137                           'CAN_USE_VFP3_INSTRUCTIONS',
    138                         ],
    139                       }],
    140                       [ 'arm_fpu=="vfpv3-d16"', {
    141                         'defines': [
    142                           'CAN_USE_VFP3_INSTRUCTIONS',
    143                         ],
    144                       }],
    145                       [ 'arm_fpu=="vfpv3"', {
    146                         'defines': [
    147                           'CAN_USE_VFP3_INSTRUCTIONS',
    148                           'CAN_USE_VFP32DREGS',
    149                         ],
    150                       }],
    151                       [ 'arm_fpu=="neon" or arm_neon==1', {
    152                         'defines': [
    153                           'CAN_USE_VFP3_INSTRUCTIONS',
    154                           'CAN_USE_VFP32DREGS',
    155                         ],
    156                       }],
    157                     ],
    158                   }],
    159                   [ 'arm_float_abi=="hard"', {
    160                     'defines': [
    161                       'USE_EABI_HARDFLOAT=1',
    162                     ],
    163                   }],
    164                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
    165                     'defines': [
    166                       'USE_EABI_HARDFLOAT=0',
    167                     ],
    168                   }],
    169                 ],
    170                 'defines': [
    171                   'ARM_TEST',
    172                 ],
    173               }],
    174             ],
    175           }],  # _toolset=="host"
    176           ['_toolset=="target"', {
    177             'variables': {
    178               'armcompiler': '<!($(echo ${CXX_target:-<(CXX)}) -v 2>&1 | grep -q "^Target: arm" && echo "yes" || echo "no")',
    179             },
    180             'conditions': [
    181               ['armcompiler=="yes"', {
    182                 'conditions': [
    183                   [ 'armv7==1', {
    184                     'cflags': ['-march=armv7-a',],
    185                   }],
    186                   [ 'armv7==1 or armv7=="default"', {
    187                     'conditions': [
    188                       [ 'arm_neon==1', {
    189                         'cflags': ['-mfpu=neon',],
    190                       },
    191                       {
    192                         'conditions': [
    193                           [ 'arm_fpu!="default"', {
    194                             'cflags': ['-mfpu=<(arm_fpu)',],
    195                           }],
    196                         ],
    197                       }],
    198                     ],
    199                   }],
    200                   [ 'arm_float_abi!="default"', {
    201                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
    202                   }],
    203                   [ 'arm_thumb==1', {
    204                     'cflags': ['-mthumb',],
    205                   }],
    206                   [ 'arm_thumb==0', {
    207                     'cflags': ['-marm',],
    208                   }],
    209                   [ 'arm_test=="on"', {
    210                     'defines': [
    211                       'ARM_TEST',
    212                     ],
    213                   }],
    214                 ],
    215               }, {
    216                 # armcompiler=="no"
    217                 'conditions': [
    218                   [ 'armv7==1 or armv7=="default"', {
    219                     'defines': [
    220                       'CAN_USE_ARMV7_INSTRUCTIONS=1',
    221                     ],
    222                     'conditions': [
    223                       [ 'arm_fpu=="default"', {
    224                         'defines': [
    225                           'CAN_USE_VFP3_INSTRUCTIONS',
    226                         ],
    227                       }],
    228                       [ 'arm_fpu=="vfpv3-d16"', {
    229                         'defines': [
    230                           'CAN_USE_VFP3_INSTRUCTIONS',
    231                         ],
    232                       }],
    233                       [ 'arm_fpu=="vfpv3"', {
    234                         'defines': [
    235                           'CAN_USE_VFP3_INSTRUCTIONS',
    236                           'CAN_USE_VFP32DREGS',
    237                         ],
    238                       }],
    239                       [ 'arm_fpu=="neon" or arm_neon==1', {
    240                         'defines': [
    241                           'CAN_USE_VFP3_INSTRUCTIONS',
    242                           'CAN_USE_VFP32DREGS',
    243                         ],
    244                       }],
    245                     ],
    246                   }],
    247                   [ 'arm_float_abi=="hard"', {
    248                     'defines': [
    249                       'USE_EABI_HARDFLOAT=1',
    250                     ],
    251                   }],
    252                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
    253                     'defines': [
    254                       'USE_EABI_HARDFLOAT=0',
    255                     ],
    256                   }],
    257                 ],
    258                 'defines': [
    259                   'ARM_TEST',
    260                 ],
    261               }],
    262             ],
    263           }],  # _toolset=="target"
    264         ],
    265       }],  # v8_target_arch=="arm"
    266       ['v8_target_arch=="ia32"', {
    267         'defines': [
    268           'V8_TARGET_ARCH_IA32',
    269         ],
    270       }],  # v8_target_arch=="ia32"
    271       ['v8_target_arch=="mipsel"', {
    272         'defines': [
    273           'V8_TARGET_ARCH_MIPS',
    274         ],
    275         'variables': {
    276           'mipscompiler': '<!($(echo <(CXX)) -v 2>&1 | grep -q "^Target: mips" && echo "yes" || echo "no")',
    277         },
    278         'conditions': [
    279           ['mipscompiler=="yes"', {
    280             'target_conditions': [
    281               ['_toolset=="target"', {
    282                 'cflags': ['-EL'],
    283                 'ldflags': ['-EL'],
    284                 'conditions': [
    285                   [ 'v8_use_mips_abi_hardfloat=="true"', {
    286                     'cflags': ['-mhard-float'],
    287                     'ldflags': ['-mhard-float'],
    288                   }, {
    289                     'cflags': ['-msoft-float'],
    290                     'ldflags': ['-msoft-float'],
    291                   }],
    292                   ['mips_arch_variant=="mips32r2"', {
    293                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
    294                   }],
    295                   ['mips_arch_variant=="mips32r1"', {
    296                     'cflags': ['-mips32', '-Wa,-mips32'],
    297                  }],
    298                   ['mips_arch_variant=="loongson"', {
    299                     'cflags': ['-mips3', '-Wa,-mips3'],
    300                   }],
    301                 ],
    302               }],
    303             ],
    304           }],
    305           [ 'v8_can_use_fpu_instructions=="true"', {
    306             'defines': [
    307               'CAN_USE_FPU_INSTRUCTIONS',
    308             ],
    309           }],
    310           [ 'v8_use_mips_abi_hardfloat=="true"', {
    311             'defines': [
    312               '__mips_hard_float=1',
    313               'CAN_USE_FPU_INSTRUCTIONS',
    314             ],
    315           }, {
    316             'defines': [
    317               '__mips_soft_float=1'
    318             ],
    319           }],
    320           ['mips_arch_variant=="mips32r2"', {
    321             'defines': ['_MIPS_ARCH_MIPS32R2',],
    322           }],
    323           ['mips_arch_variant=="loongson"', {
    324             'defines': ['_MIPS_ARCH_LOONGSON',],
    325           }],
    326         ],
    327       }],  # v8_target_arch=="mipsel"
    328       ['v8_target_arch=="x64"', {
    329         'defines': [
    330           'V8_TARGET_ARCH_X64',
    331         ],
    332         'xcode_settings': {
    333           'ARCHS': [ 'x86_64' ],
    334         },
    335         'msvs_settings': {
    336           'VCLinkerTool': {
    337             'StackReserveSize': '2097152',
    338           },
    339         },
    340         'msvs_configuration_platform': 'x64',
    341       }],  # v8_target_arch=="x64"
    342       ['OS=="win"', {
    343         'defines': [
    344           'WIN32',
    345         ],
    346         'msvs_configuration_attributes': {
    347           'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
    348           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
    349           'CharacterSet': '1',
    350         },
    351       }],
    352       ['OS=="win" and v8_enable_prof==1', {
    353         'msvs_settings': {
    354           'VCLinkerTool': {
    355             'GenerateMapFile': 'true',
    356           },
    357         },
    358       }],
    359       ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
    360          or OS=="netbsd"', {
    361         'conditions': [
    362           [ 'v8_no_strict_aliasing==1', {
    363             'cflags': [ '-fno-strict-aliasing' ],
    364           }],
    365         ],  # conditions
    366       }],
    367       ['OS=="solaris"', {
    368         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
    369       }],
    370       ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
    371          or OS=="netbsd" or OS=="mac" or OS=="android") and \
    372         (v8_target_arch=="arm" or v8_target_arch=="ia32" or \
    373          v8_target_arch=="mipsel")', {
    374         # Check whether the host compiler and target compiler support the
    375         # '-m32' option and set it if so.
    376         'target_conditions': [
    377           ['_toolset=="host"', {
    378             'variables': {
    379               'm32flag': '<!(($(echo ${CXX_host:-$(which g++)}) -m32 -E - > /dev/null 2>&1 < /dev/null) && echo "-m32" || true)',
    380             },
    381             'cflags': [ '<(m32flag)' ],
    382             'ldflags': [ '<(m32flag)' ],
    383             'xcode_settings': {
    384               'ARCHS': [ 'i386' ],
    385             },
    386           }],
    387           ['_toolset=="target"', {
    388             'variables': {
    389               'm32flag': '<!(($(echo ${CXX_target:-<(CXX)}) -m32 -E - > /dev/null 2>&1 < /dev/null) && echo "-m32" || true)',
    390               'clang%': 0,
    391             },
    392             'conditions': [
    393               ['(OS!="android" or clang==1) and \
    394                 nacl_target_arch!="nacl_x64"', {
    395                 'cflags': [ '<(m32flag)' ],
    396                 'ldflags': [ '<(m32flag)' ],
    397               }],
    398             ],
    399             'xcode_settings': {
    400               'ARCHS': [ 'i386' ],
    401             },
    402           }],
    403         ],
    404       }],
    405       ['(OS=="linux") and (v8_target_arch=="x64")', {
    406         # Check whether the host compiler and target compiler support the
    407         # '-m64' option and set it if so.
    408         'target_conditions': [
    409           ['_toolset=="host"', {
    410             'variables': {
    411               'm64flag': '<!(($(echo ${CXX_host:-$(which g++)}) -m64 -E - > /dev/null 2>&1 < /dev/null) && echo "-m64" || true)',
    412             },
    413             'cflags': [ '<(m64flag)' ],
    414             'ldflags': [ '<(m64flag)' ],
    415           }],
    416           ['_toolset=="target"', {
    417             'variables': {
    418               'm64flag': '<!(($(echo ${CXX_target:-<(CXX)}) -m64 -E - > /dev/null 2>&1 < /dev/null) && echo "-m64" || true)',
    419             },
    420             'cflags': [ '<(m64flag)' ],
    421             'ldflags': [ '<(m64flag)' ],
    422           }]
    423         ],
    424       }],
    425       ['OS=="freebsd" or OS=="openbsd"', {
    426         'cflags': [ '-I/usr/local/include' ],
    427       }],
    428       ['OS=="netbsd"', {
    429         'cflags': [ '-I/usr/pkg/include' ],
    430       }],
    431     ],  # conditions
    432     'configurations': {
    433       'Debug': {
    434         'defines': [
    435           'ENABLE_DISASSEMBLER',
    436           'V8_ENABLE_CHECKS',
    437           'OBJECT_PRINT',
    438           'VERIFY_HEAP',
    439           'DEBUG'
    440         ],
    441         'msvs_settings': {
    442           'VCCLCompilerTool': {
    443             'conditions': [
    444               ['v8_optimized_debug==0', {
    445                 'Optimization': '0',
    446                 'conditions': [
    447                   ['component=="shared_library"', {
    448                     'RuntimeLibrary': '3',  # /MDd
    449                   }, {
    450                     'RuntimeLibrary': '1',  # /MTd
    451                   }],
    452                 ],
    453               }],
    454               ['v8_optimized_debug==1', {
    455                 'Optimization': '1',
    456                 'InlineFunctionExpansion': '2',
    457                 'EnableIntrinsicFunctions': 'true',
    458                 'FavorSizeOrSpeed': '0',
    459                 'StringPooling': 'true',
    460                 'BasicRuntimeChecks': '0',
    461                 'conditions': [
    462                   ['component=="shared_library"', {
    463                     'RuntimeLibrary': '3',  # /MDd
    464                   }, {
    465                     'RuntimeLibrary': '1',  # /MTd
    466                   }],
    467                 ],
    468               }],
    469               ['v8_optimized_debug==2', {
    470                 'Optimization': '2',
    471                 'InlineFunctionExpansion': '2',
    472                 'EnableIntrinsicFunctions': 'true',
    473                 'FavorSizeOrSpeed': '0',
    474                 'StringPooling': 'true',
    475                 'BasicRuntimeChecks': '0',
    476                 'conditions': [
    477                   ['component=="shared_library"', {
    478                     'RuntimeLibrary': '3',  #/MDd
    479                   }, {
    480                     'RuntimeLibrary': '1',  #/MTd
    481                   }],
    482                   ['v8_target_arch=="x64"', {
    483                     # TODO(2207): remove this option once the bug is fixed.
    484                     'WholeProgramOptimization': 'true',
    485                   }],
    486                 ],
    487               }],
    488             ],
    489           },
    490           'VCLinkerTool': {
    491             'conditions': [
    492               ['v8_optimized_debug==0', {
    493                 'LinkIncremental': '2',
    494               }],
    495               ['v8_optimized_debug==1', {
    496                 'LinkIncremental': '2',
    497               }],
    498               ['v8_optimized_debug==2', {
    499                 'LinkIncremental': '1',
    500                 'OptimizeReferences': '2',
    501                 'EnableCOMDATFolding': '2',
    502               }],
    503             ],
    504           },
    505         },
    506         'conditions': [
    507           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
    508             'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
    509                         '-Wnon-virtual-dtor', '-Woverloaded-virtual',
    510                         '<(wno_array_bounds)' ],
    511             'conditions': [
    512               ['v8_optimized_debug==0', {
    513                 'cflags!': [
    514                   '-O0',
    515                   '-O3',
    516                   '-O2',
    517                   '-O1',
    518                   '-Os',
    519                 ],
    520                 'cflags': [
    521                   '-fdata-sections',
    522                   '-ffunction-sections',
    523                 ],
    524               }],
    525               ['v8_optimized_debug==1', {
    526                 'cflags!': [
    527                   '-O0',
    528                   '-O3', # TODO(2807) should be -O1.
    529                   '-O2',
    530                   '-Os',
    531                 ],
    532                 'cflags': [
    533                   '-fdata-sections',
    534                   '-ffunction-sections',
    535                   '-O1', # TODO(2807) should be -O3.
    536                 ],
    537               }],
    538               ['v8_optimized_debug==2', {
    539                 'cflags!': [
    540                   '-O0',
    541                   '-O1',
    542                   '-Os',
    543                 ],
    544                 'cflags': [
    545                   '-fdata-sections',
    546                   '-ffunction-sections',
    547                 ],
    548                 'defines': [
    549                   'OPTIMIZED_DEBUG'
    550                 ],
    551                 'conditions': [
    552                   # TODO(crbug.com/272548): Avoid -O3 in NaCl
    553                   ['nacl_target_arch=="none"', {
    554                     'cflags': ['-O3'],
    555                     'cflags!': ['-O2'],
    556                     }, {
    557                     'cflags': ['-O2'],
    558                     'cflags!': ['-O3'],
    559                   }],
    560                 ],
    561               }],
    562               ['v8_optimized_debug!=0 and gcc_version==44 and clang==0', {
    563                 'cflags': [
    564                   # Avoid crashes with gcc 4.4 in the v8 test suite.
    565                   '-fno-tree-vrp',
    566                 ],
    567               }],
    568             ],
    569           }],
    570           ['OS=="linux" and v8_enable_backtrace==1', {
    571             # Support for backtrace_symbols.
    572             'ldflags': [ '-rdynamic' ],
    573           }],
    574           ['OS=="android"', {
    575             'variables': {
    576               'android_full_debug%': 1,
    577             },
    578             'conditions': [
    579               ['android_full_debug==0', {
    580                 # Disable full debug if we want a faster v8 in a debug build.
    581                 # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
    582                 'defines!': [
    583                   'DEBUG',
    584                 ],
    585               }],
    586             ],
    587           }],
    588           ['OS=="mac"', {
    589             'xcode_settings': {
    590               'conditions': [
    591                  ['v8_optimized_debug==0', {
    592                    'GCC_OPTIMIZATION_LEVEL': '0',  # -O0
    593                  }, {
    594                    'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
    595                    'GCC_STRICT_ALIASING': 'YES',
    596                  }],
    597                ],
    598             },
    599           }],
    600         ],
    601       },  # Debug
    602       'Release': {
    603         'conditions': [
    604           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
    605             'cflags!': [
    606               '-Os',
    607             ],
    608             'cflags': [
    609               '-fdata-sections',
    610               '-ffunction-sections',
    611               '<(wno_array_bounds)',
    612             ],
    613             'conditions': [
    614               [ 'gcc_version==44 and clang==0', {
    615                 'cflags': [
    616                   # Avoid crashes with gcc 4.4 in the v8 test suite.
    617                   '-fno-tree-vrp',
    618                 ],
    619               }],
    620               # TODO(crbug.com/272548): Avoid -O3 in NaCl
    621               ['nacl_target_arch=="none"', {
    622                 'cflags': ['-O3'],
    623                 'cflags!': ['-O2'],
    624               }, {
    625                 'cflags': ['-O2'],
    626                 'cflags!': ['-O3'],
    627               }],
    628             ],
    629           }],
    630           ['OS=="android"', {
    631             'cflags!': [
    632               '-O3',
    633               '-Os',
    634             ],
    635             'cflags': [
    636               '-fdata-sections',
    637               '-ffunction-sections',
    638               '-O2',
    639             ],
    640             'conditions': [
    641               [ 'gcc_version==44 and clang==0', {
    642                 'cflags': [
    643                   # Avoid crashes with gcc 4.4 in the v8 test suite.
    644                   '-fno-tree-vrp',
    645                 ],
    646               }],
    647             ],
    648           }],
    649           ['OS=="mac"', {
    650             'xcode_settings': {
    651               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
    652 
    653               # -fstrict-aliasing.  Mainline gcc
    654               # enables this at -O2 and above,
    655               # but Apple gcc does not unless it
    656               # is specified explicitly.
    657               'GCC_STRICT_ALIASING': 'YES',
    658             },
    659           }],  # OS=="mac"
    660           ['OS=="win"', {
    661             'msvs_settings': {
    662               'VCCLCompilerTool': {
    663                 'Optimization': '2',
    664                 'InlineFunctionExpansion': '2',
    665                 'EnableIntrinsicFunctions': 'true',
    666                 'FavorSizeOrSpeed': '0',
    667                 'StringPooling': 'true',
    668                 'conditions': [
    669                   ['component=="shared_library"', {
    670                     'RuntimeLibrary': '2',  #/MD
    671                   }, {
    672                     'RuntimeLibrary': '0',  #/MT
    673                   }],
    674                   ['v8_target_arch=="x64"', {
    675                     # TODO(2207): remove this option once the bug is fixed.
    676                     'WholeProgramOptimization': 'true',
    677                   }],
    678                 ],
    679               },
    680               'VCLinkerTool': {
    681                 'LinkIncremental': '1',
    682                 'OptimizeReferences': '2',
    683                 'EnableCOMDATFolding': '2',
    684               },
    685             },
    686           }],  # OS=="win"
    687         ],  # conditions
    688       },  # Release
    689     },  # configurations
    690   },  # target_defaults
    691 }
    692