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     # Toolset the d8 binary should be compiled for. Possible values are 'host'
     74     # and 'target'. If you want to run v8 tests, it needs to be set to 'target'.
     75     # The setting is ignored if want_separate_host_toolset is 0.
     76     'v8_toolset_for_d8%': 'target',
     77 
     78     'host_os%': '<(OS)',
     79     'werror%': '-Werror',
     80     # For a shared library build, results in "libv8-<(soname_version).so".
     81     'soname_version%': '',
     82 
     83     # Allow to suppress the array bounds warning (default is no suppression).
     84     'wno_array_bounds%': '',
     85   },
     86   'target_defaults': {
     87     'conditions': [
     88       ['v8_target_arch=="arm"', {
     89         'defines': [
     90           'V8_TARGET_ARCH_ARM',
     91         ],
     92         'target_conditions': [
     93           ['_toolset=="host"', {
     94             'variables': {
     95               'armcompiler': '<!($(echo ${CXX_host:-$(which g++)}) -v 2>&1 | grep -q "^Target: arm" && echo "yes" || echo "no")',
     96             },
     97             'conditions': [
     98               ['armcompiler=="yes"', {
     99                 'conditions': [
    100                   [ 'arm_version==7', {
    101                     'cflags': ['-march=armv7-a',],
    102                   }],
    103                   [ 'arm_version==7 or arm_version=="default"', {
    104                     'conditions': [
    105                       [ 'arm_fpu!="default"', {
    106                         'cflags': ['-mfpu=<(arm_fpu)',],
    107                       }],
    108                     ],
    109                   }],
    110                   [ 'arm_float_abi!="default"', {
    111                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
    112                   }],
    113                   [ 'arm_thumb==1', {
    114                     'cflags': ['-mthumb',],
    115                   }],
    116                   [ 'arm_thumb==0', {
    117                     'cflags': ['-marm',],
    118                   }],
    119                   [ 'arm_test=="on"', {
    120                     'defines': [
    121                       'ARM_TEST',
    122                     ],
    123                   }],
    124                 ],
    125               }, {
    126                 # armcompiler=="no"
    127                 'conditions': [
    128                   [ 'arm_version==7 or arm_version=="default"', {
    129                     'defines': [
    130                       'CAN_USE_ARMV7_INSTRUCTIONS=1',
    131                     ],
    132                     'conditions': [
    133                       [ 'arm_fpu=="default"', {
    134                         'defines': [
    135                           'CAN_USE_VFP3_INSTRUCTIONS',
    136                         ],
    137                       }],
    138                       [ 'arm_fpu=="vfpv3-d16"', {
    139                         'defines': [
    140                           'CAN_USE_VFP3_INSTRUCTIONS',
    141                         ],
    142                       }],
    143                       [ 'arm_fpu=="vfpv3"', {
    144                         'defines': [
    145                           'CAN_USE_VFP3_INSTRUCTIONS',
    146                           'CAN_USE_VFP32DREGS',
    147                         ],
    148                       }],
    149                       [ 'arm_fpu=="neon"', {
    150                         'defines': [
    151                           'CAN_USE_VFP3_INSTRUCTIONS',
    152                           'CAN_USE_VFP32DREGS',
    153                           'CAN_USE_NEON',
    154                         ],
    155                       }],
    156                     ],
    157                   }],
    158                   [ 'arm_float_abi=="hard"', {
    159                     'defines': [
    160                       'USE_EABI_HARDFLOAT=1',
    161                     ],
    162                   }],
    163                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
    164                     'defines': [
    165                       'USE_EABI_HARDFLOAT=0',
    166                     ],
    167                   }],
    168                 ],
    169                 'defines': [
    170                   'ARM_TEST',
    171                 ],
    172               }],
    173             ],
    174           }],  # _toolset=="host"
    175           ['_toolset=="target"', {
    176             'variables': {
    177               'armcompiler': '<!($(echo ${CXX_target:-<(CXX)}) -v 2>&1 | grep -q "^Target: arm" && echo "yes" || echo "no")',
    178             },
    179             'conditions': [
    180               ['armcompiler=="yes"', {
    181                 'conditions': [
    182                   [ 'arm_version==7', {
    183                     'cflags': ['-march=armv7-a',],
    184                   }],
    185                   [ 'arm_version==7 or arm_version=="default"', {
    186                     'conditions': [
    187                       [ 'arm_fpu!="default"', {
    188                         'cflags': ['-mfpu=<(arm_fpu)',],
    189                       }],
    190                     ],
    191                   }],
    192                   [ 'arm_float_abi!="default"', {
    193                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
    194                   }],
    195                   [ 'arm_thumb==1', {
    196                     'cflags': ['-mthumb',],
    197                   }],
    198                   [ 'arm_thumb==0', {
    199                     'cflags': ['-marm',],
    200                   }],
    201                   [ 'arm_test=="on"', {
    202                     'defines': [
    203                       'ARM_TEST',
    204                     ],
    205                     'conditions': [
    206                       [ 'arm_fpu=="vfpv3-d16"', {
    207                         'defines': [
    208                           'CAN_USE_VFP3_INSTRUCTIONS',
    209                         ],
    210                       }],
    211                       [ 'arm_fpu=="vfpv3"', {
    212                         'defines': [
    213                           'CAN_USE_VFP3_INSTRUCTIONS',
    214                           'CAN_USE_VFP32DREGS',
    215                         ],
    216                       }],
    217                       [ 'arm_fpu=="neon"', {
    218                         'defines': [
    219                           'CAN_USE_VFP3_INSTRUCTIONS',
    220                           'CAN_USE_VFP32DREGS',
    221                           'CAN_USE_NEON',
    222                         ],
    223                       }],
    224                     ],
    225                   }],
    226                 ],
    227               }, {
    228                 # armcompiler=="no"
    229                 'conditions': [
    230                   [ 'arm_version==7 or arm_version=="default"', {
    231                     'defines': [
    232                       'CAN_USE_ARMV7_INSTRUCTIONS=1',
    233                     ],
    234                     'conditions': [
    235                       [ 'arm_fpu=="default"', {
    236                         'defines': [
    237                           'CAN_USE_VFP3_INSTRUCTIONS',
    238                           'CAN_USE_VFP32DREGS',
    239                           'CAN_USE_NEON',
    240                         ],
    241                       }],
    242                       [ 'arm_fpu=="vfpv3-d16"', {
    243                         'defines': [
    244                           'CAN_USE_VFP3_INSTRUCTIONS',
    245                         ],
    246                       }],
    247                       [ 'arm_fpu=="vfpv3"', {
    248                         'defines': [
    249                           'CAN_USE_VFP3_INSTRUCTIONS',
    250                           'CAN_USE_VFP32DREGS',
    251                         ],
    252                       }],
    253                       [ 'arm_fpu=="neon"', {
    254                         'defines': [
    255                           'CAN_USE_VFP3_INSTRUCTIONS',
    256                           'CAN_USE_VFP32DREGS',
    257                           'CAN_USE_NEON',
    258                         ],
    259                       }],
    260                     ],
    261                   }],
    262                   [ 'arm_float_abi=="hard"', {
    263                     'defines': [
    264                       'USE_EABI_HARDFLOAT=1',
    265                     ],
    266                   }],
    267                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
    268                     'defines': [
    269                       'USE_EABI_HARDFLOAT=0',
    270                     ],
    271                   }],
    272                 ],
    273                 'defines': [
    274                   'ARM_TEST',
    275                 ],
    276               }],
    277             ],
    278           }],  # _toolset=="target"
    279         ],
    280       }],  # v8_target_arch=="arm"
    281       ['v8_target_arch=="arm64"', {
    282         'defines': [
    283           'V8_TARGET_ARCH_ARM64',
    284         ],
    285       }],
    286       ['v8_target_arch=="ia32"', {
    287         'defines': [
    288           'V8_TARGET_ARCH_IA32',
    289         ],
    290       }],  # v8_target_arch=="ia32"
    291       ['v8_target_arch=="x87"', {
    292         'defines': [
    293           'V8_TARGET_ARCH_X87',
    294         ],
    295         'cflags': ['-march=i586'],
    296       }],  # v8_target_arch=="x87"
    297       ['v8_target_arch=="mips"', {
    298         'defines': [
    299           'V8_TARGET_ARCH_MIPS',
    300         ],
    301         'variables': {
    302           'mipscompiler': '<!($(echo <(CXX)) -v 2>&1 | grep -q "^Target: mips" && echo "yes" || echo "no")',
    303         },
    304         'conditions': [
    305           ['mipscompiler=="yes"', {
    306             'target_conditions': [
    307               ['_toolset=="target"', {
    308                 'cflags': ['-EB'],
    309                 'ldflags': ['-EB'],
    310                 'conditions': [
    311                   [ 'v8_use_mips_abi_hardfloat=="true"', {
    312                     'cflags': ['-mhard-float'],
    313                     'ldflags': ['-mhard-float'],
    314                   }, {
    315                     'cflags': ['-msoft-float'],
    316                     'ldflags': ['-msoft-float'],
    317                   }],
    318                   ['mips_arch_variant=="mips32r2"', {
    319                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
    320                   }],
    321                   ['mips_arch_variant=="mips32r1"', {
    322                     'cflags': ['-mips32', '-Wa,-mips32'],
    323                   }],
    324                 ],
    325               }],
    326             ],
    327           }],
    328           [ 'v8_can_use_fpu_instructions=="true"', {
    329             'defines': [
    330               'CAN_USE_FPU_INSTRUCTIONS',
    331             ],
    332           }],
    333           [ 'v8_use_mips_abi_hardfloat=="true"', {
    334             'defines': [
    335               '__mips_hard_float=1',
    336               'CAN_USE_FPU_INSTRUCTIONS',
    337             ],
    338           }, {
    339             'defines': [
    340               '__mips_soft_float=1'
    341             ],
    342           }],
    343           ['mips_arch_variant=="mips32r2"', {
    344             'defines': ['_MIPS_ARCH_MIPS32R2',],
    345           }],
    346         ],
    347       }],  # v8_target_arch=="mips"
    348       ['v8_target_arch=="mipsel"', {
    349         'defines': [
    350           'V8_TARGET_ARCH_MIPS',
    351         ],
    352         'variables': {
    353           'mipscompiler': '<!($(echo <(CXX)) -v 2>&1 | grep -q "^Target: mips" && echo "yes" || echo "no")',
    354         },
    355         'conditions': [
    356           ['mipscompiler=="yes"', {
    357             'target_conditions': [
    358               ['_toolset=="target"', {
    359                 'cflags': ['-EL'],
    360                 'ldflags': ['-EL'],
    361                 'conditions': [
    362                   [ 'v8_use_mips_abi_hardfloat=="true"', {
    363                     'cflags': ['-mhard-float'],
    364                     'ldflags': ['-mhard-float'],
    365                   }, {
    366                     'cflags': ['-msoft-float'],
    367                     'ldflags': ['-msoft-float'],
    368                   }],
    369                   ['mips_arch_variant=="mips32r2"', {
    370                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
    371                   }],
    372                   ['mips_arch_variant=="mips32r1"', {
    373                     'cflags': ['-mips32', '-Wa,-mips32'],
    374                  }],
    375                   ['mips_arch_variant=="loongson"', {
    376                     'cflags': ['-mips3', '-Wa,-mips3'],
    377                   }],
    378                 ],
    379               }],
    380             ],
    381           }],
    382           [ 'v8_can_use_fpu_instructions=="true"', {
    383             'defines': [
    384               'CAN_USE_FPU_INSTRUCTIONS',
    385             ],
    386           }],
    387           [ 'v8_use_mips_abi_hardfloat=="true"', {
    388             'defines': [
    389               '__mips_hard_float=1',
    390               'CAN_USE_FPU_INSTRUCTIONS',
    391             ],
    392           }, {
    393             'defines': [
    394               '__mips_soft_float=1'
    395             ],
    396           }],
    397           ['mips_arch_variant=="mips32r2"', {
    398             'defines': ['_MIPS_ARCH_MIPS32R2',],
    399           }],
    400           ['mips_arch_variant=="loongson"', {
    401             'defines': ['_MIPS_ARCH_LOONGSON',],
    402           }],
    403         ],
    404       }],  # v8_target_arch=="mipsel"
    405       ['v8_target_arch=="x64"', {
    406         'defines': [
    407           'V8_TARGET_ARCH_X64',
    408         ],
    409         'xcode_settings': {
    410           'ARCHS': [ 'x86_64' ],
    411         },
    412         'msvs_settings': {
    413           'VCLinkerTool': {
    414             'StackReserveSize': '2097152',
    415           },
    416         },
    417         'msvs_configuration_platform': 'x64',
    418       }],  # v8_target_arch=="x64"
    419       ['OS=="win"', {
    420         'defines': [
    421           'WIN32',
    422         ],
    423         'msvs_configuration_attributes': {
    424           'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
    425           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
    426           'CharacterSet': '1',
    427         },
    428       }],
    429       ['OS=="win" and v8_enable_prof==1', {
    430         'msvs_settings': {
    431           'VCLinkerTool': {
    432             'GenerateMapFile': 'true',
    433           },
    434         },
    435       }],
    436       ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
    437          or OS=="netbsd" or OS=="qnx"', {
    438         'conditions': [
    439           [ 'v8_no_strict_aliasing==1', {
    440             'cflags': [ '-fno-strict-aliasing' ],
    441           }],
    442         ],  # conditions
    443       }],
    444       ['OS=="solaris"', {
    445         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
    446       }],
    447       ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
    448          or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
    449         (v8_target_arch=="arm" or v8_target_arch=="ia32" or v8_target_arch=="x87" or\
    450          v8_target_arch=="mips" or v8_target_arch=="mipsel")', {
    451         # Check whether the host compiler and target compiler support the
    452         # '-m32' option and set it if so.
    453         'target_conditions': [
    454           ['_toolset=="host"', {
    455             'variables': {
    456               'm32flag': '<!(($(echo ${CXX_host:-$(which g++)}) -m32 -E - > /dev/null 2>&1 < /dev/null) && echo "-m32" || true)',
    457             },
    458             'cflags': [ '<(m32flag)' ],
    459             'ldflags': [ '<(m32flag)' ],
    460             'xcode_settings': {
    461               'ARCHS': [ 'i386' ],
    462             },
    463           }],
    464           ['_toolset=="target"', {
    465             'variables': {
    466               'm32flag': '<!(($(echo ${CXX_target:-<(CXX)}) -m32 -E - > /dev/null 2>&1 < /dev/null) && echo "-m32" || true)',
    467               'clang%': 0,
    468             },
    469             'conditions': [
    470               ['((OS!="android" and OS!="qnx") or clang==1) and \
    471                 nacl_target_arch!="nacl_x64"', {
    472                 'cflags': [ '<(m32flag)' ],
    473                 'ldflags': [ '<(m32flag)' ],
    474               }],
    475               ['OS=="android"', {
    476                 'android_enable_fdo': 1,
    477               }],
    478             ],
    479             'xcode_settings': {
    480               'ARCHS': [ 'i386' ],
    481             },
    482           }],
    483         ],
    484       }],
    485       ['(OS=="linux" or OS=="android") and \
    486         (v8_target_arch=="x64" or v8_target_arch=="arm64")', {
    487         # Check whether the host compiler and target compiler support the
    488         # '-m64' option and set it if so.
    489         'target_conditions': [
    490           ['_toolset=="host"', {
    491             'variables': {
    492               'm64flag': '<!(($(echo ${CXX_host:-$(which g++)}) -m64 -E - > /dev/null 2>&1 < /dev/null) && echo "-m64" || true)',
    493             },
    494             'cflags': [ '<(m64flag)' ],
    495             'ldflags': [ '<(m64flag)' ],
    496           }],
    497           ['_toolset=="target"', {
    498             'variables': {
    499               'm64flag': '<!(($(echo ${CXX_target:-<(CXX)}) -m64 -E - > /dev/null 2>&1 < /dev/null) && echo "-m64" || true)',
    500             },
    501             'conditions': [
    502               ['((OS!="android" and OS!="qnx") or clang==1)', {
    503                 'cflags': [ '<(m64flag)' ],
    504                 'ldflags': [ '<(m64flag)' ],
    505               }],
    506               ['OS=="android"', {
    507                 'android_enable_fdo': 1,
    508               }],
    509             ],
    510           }]
    511         ],
    512       }],
    513       ['OS=="freebsd" or OS=="openbsd"', {
    514         'cflags': [ '-I/usr/local/include' ],
    515       }],
    516       ['OS=="netbsd"', {
    517         'cflags': [ '-I/usr/pkg/include' ],
    518       }],
    519     ],  # conditions
    520     'configurations': {
    521       # Abstract configuration for v8_optimized_debug == 0.
    522       'DebugBase0': {
    523         'abstract': 1,
    524         'msvs_settings': {
    525           'VCCLCompilerTool': {
    526             'Optimization': '0',
    527             'conditions': [
    528               ['component=="shared_library"', {
    529                 'RuntimeLibrary': '3',  # /MDd
    530               }, {
    531                 'RuntimeLibrary': '1',  # /MTd
    532               }],
    533             ],
    534           },
    535           'VCLinkerTool': {
    536             'LinkIncremental': '2',
    537           },
    538         },
    539         'conditions': [
    540           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
    541             OS=="qnx"', {
    542             'cflags!': [
    543               '-O0',
    544               '-O3',
    545               '-O2',
    546               '-O1',
    547               '-Os',
    548             ],
    549             'cflags': [
    550               '-fdata-sections',
    551               '-ffunction-sections',
    552             ],
    553           }],
    554           ['OS=="mac"', {
    555             'xcode_settings': {
    556                'GCC_OPTIMIZATION_LEVEL': '0',  # -O0
    557             },
    558           }],
    559         ],
    560       },  # DebugBase0
    561       # Abstract configuration for v8_optimized_debug == 1.
    562       'DebugBase1': {
    563         'abstract': 1,
    564         'msvs_settings': {
    565           'VCCLCompilerTool': {
    566             'Optimization': '1',
    567             'InlineFunctionExpansion': '2',
    568             'EnableIntrinsicFunctions': 'true',
    569             'FavorSizeOrSpeed': '0',
    570             'StringPooling': 'true',
    571             'BasicRuntimeChecks': '0',
    572             'conditions': [
    573               ['component=="shared_library"', {
    574                 'RuntimeLibrary': '3',  # /MDd
    575               }, {
    576                 'RuntimeLibrary': '1',  # /MTd
    577               }],
    578             ],
    579           },
    580           'VCLinkerTool': {
    581             'LinkIncremental': '2',
    582           },
    583         },
    584         'conditions': [
    585           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
    586             OS=="qnx"', {
    587             'cflags!': [
    588               '-O0',
    589               '-O3', # TODO(2807) should be -O1.
    590               '-O2',
    591               '-Os',
    592             ],
    593             'cflags': [
    594               '-fdata-sections',
    595               '-ffunction-sections',
    596               '-O1', # TODO(2807) should be -O3.
    597             ],
    598             'conditions': [
    599               ['gcc_version==44 and clang==0', {
    600                 'cflags': [
    601                   # Avoid crashes with gcc 4.4 in the v8 test suite.
    602                   '-fno-tree-vrp',
    603                 ],
    604               }],
    605             ],
    606           }],
    607           ['OS=="mac"', {
    608             'xcode_settings': {
    609                'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
    610                'GCC_STRICT_ALIASING': 'YES',
    611             },
    612           }],
    613         ],
    614       },  # DebugBase1
    615       # Abstract configuration for v8_optimized_debug == 2.
    616       'DebugBase2': {
    617         'abstract': 1,
    618         'msvs_settings': {
    619           'VCCLCompilerTool': {
    620             'Optimization': '2',
    621             'InlineFunctionExpansion': '2',
    622             'EnableIntrinsicFunctions': 'true',
    623             'FavorSizeOrSpeed': '0',
    624             'StringPooling': 'true',
    625             'BasicRuntimeChecks': '0',
    626             'conditions': [
    627               ['component=="shared_library"', {
    628                 'RuntimeLibrary': '3',  #/MDd
    629               }, {
    630                 'RuntimeLibrary': '1',  #/MTd
    631               }],
    632               ['v8_target_arch=="x64"', {
    633                 # TODO(2207): remove this option once the bug is fixed.
    634                 'WholeProgramOptimization': 'true',
    635               }],
    636             ],
    637           },
    638           'VCLinkerTool': {
    639             'LinkIncremental': '1',
    640             'OptimizeReferences': '2',
    641             'EnableCOMDATFolding': '2',
    642           },
    643         },
    644         'conditions': [
    645           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
    646             OS=="qnx"', {
    647             'cflags!': [
    648               '-O0',
    649               '-O1',
    650               '-Os',
    651             ],
    652             'cflags': [
    653               '-fdata-sections',
    654               '-ffunction-sections',
    655             ],
    656             'defines': [
    657               'OPTIMIZED_DEBUG'
    658             ],
    659             'conditions': [
    660               # TODO(crbug.com/272548): Avoid -O3 in NaCl
    661               ['nacl_target_arch=="none"', {
    662                 'cflags': ['-O3'],
    663                 'cflags!': ['-O2'],
    664                 }, {
    665                 'cflags': ['-O2'],
    666                 'cflags!': ['-O3'],
    667               }],
    668               ['gcc_version==44 and clang==0', {
    669                 'cflags': [
    670                   # Avoid crashes with gcc 4.4 in the v8 test suite.
    671                   '-fno-tree-vrp',
    672                 ],
    673               }],
    674             ],
    675           }],
    676           ['OS=="mac"', {
    677             'xcode_settings': {
    678               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
    679               'GCC_STRICT_ALIASING': 'YES',
    680             },
    681           }],
    682         ],
    683       },  # DebugBase2
    684       # Common settings for the Debug configuration.
    685       'DebugBaseCommon': {
    686         'abstract': 1,
    687         'defines': [
    688           'ENABLE_DISASSEMBLER',
    689           'V8_ENABLE_CHECKS',
    690           'OBJECT_PRINT',
    691           'VERIFY_HEAP',
    692           'DEBUG'
    693         ],
    694         'conditions': [
    695           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
    696             OS=="qnx"', {
    697             'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
    698           }],
    699           ['OS=="linux" and v8_enable_backtrace==1', {
    700             # Support for backtrace_symbols.
    701             'ldflags': [ '-rdynamic' ],
    702           }],
    703           ['OS=="android"', {
    704             'variables': {
    705               'android_full_debug%': 1,
    706             },
    707             'conditions': [
    708               ['android_full_debug==0', {
    709                 # Disable full debug if we want a faster v8 in a debug build.
    710                 # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
    711                 'defines!': [
    712                   'DEBUG',
    713                 ],
    714               }],
    715             ],
    716           }],
    717         ],
    718       },  # DebugBaseCommon
    719       'Debug': {
    720         'inherit_from': ['DebugBaseCommon'],
    721         'conditions': [
    722           ['v8_optimized_debug==0', {
    723             'inherit_from': ['DebugBase0'],
    724           }],
    725           ['v8_optimized_debug==1', {
    726             'inherit_from': ['DebugBase1'],
    727           }],
    728           ['v8_optimized_debug==2', {
    729             'inherit_from': ['DebugBase2'],
    730           }],
    731         ],
    732       },  # Debug
    733       'Release': {
    734         'conditions': [
    735           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
    736             'cflags!': [
    737               '-Os',
    738             ],
    739             'cflags': [
    740               '-fdata-sections',
    741               '-ffunction-sections',
    742               '<(wno_array_bounds)',
    743             ],
    744             'conditions': [
    745               [ 'gcc_version==44 and clang==0', {
    746                 'cflags': [
    747                   # Avoid crashes with gcc 4.4 in the v8 test suite.
    748                   '-fno-tree-vrp',
    749                 ],
    750               }],
    751               # TODO(crbug.com/272548): Avoid -O3 in NaCl
    752               ['nacl_target_arch=="none"', {
    753                 'cflags': ['-O3'],
    754                 'cflags!': ['-O2'],
    755               }, {
    756                 'cflags': ['-O2'],
    757                 'cflags!': ['-O3'],
    758               }],
    759             ],
    760           }],
    761           ['OS=="android"', {
    762             'cflags!': [
    763               '-O3',
    764               '-Os',
    765             ],
    766             'cflags': [
    767               '-fdata-sections',
    768               '-ffunction-sections',
    769               '-O2',
    770             ],
    771             'conditions': [
    772               [ 'gcc_version==44 and clang==0', {
    773                 'cflags': [
    774                   # Avoid crashes with gcc 4.4 in the v8 test suite.
    775                   '-fno-tree-vrp',
    776                 ],
    777               }],
    778             ],
    779           }],
    780           ['OS=="mac"', {
    781             'xcode_settings': {
    782               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
    783 
    784               # -fstrict-aliasing.  Mainline gcc
    785               # enables this at -O2 and above,
    786               # but Apple gcc does not unless it
    787               # is specified explicitly.
    788               'GCC_STRICT_ALIASING': 'YES',
    789             },
    790           }],  # OS=="mac"
    791           ['OS=="win"', {
    792             'msvs_settings': {
    793               'VCCLCompilerTool': {
    794                 'Optimization': '2',
    795                 'InlineFunctionExpansion': '2',
    796                 'EnableIntrinsicFunctions': 'true',
    797                 'FavorSizeOrSpeed': '0',
    798                 'StringPooling': 'true',
    799                 'conditions': [
    800                   ['component=="shared_library"', {
    801                     'RuntimeLibrary': '2',  #/MD
    802                   }, {
    803                     'RuntimeLibrary': '0',  #/MT
    804                   }],
    805                   ['v8_target_arch=="x64"', {
    806                     # TODO(2207): remove this option once the bug is fixed.
    807                     'WholeProgramOptimization': 'true',
    808                   }],
    809                 ],
    810               },
    811               'VCLinkerTool': {
    812                 'LinkIncremental': '1',
    813                 'OptimizeReferences': '2',
    814                 'EnableCOMDATFolding': '2',
    815               },
    816             },
    817           }],  # OS=="win"
    818         ],  # conditions
    819       },  # Release
    820     },  # configurations
    821   },  # target_defaults
    822 }
    823