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     'clang%': 0,
     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_noprobe%': '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     'v8_enable_backtrace%': 0,
     59 
     60     # Enable profiling support. Only required on Windows.
     61     'v8_enable_prof%': 0,
     62 
     63     # Some versions of GCC 4.5 seem to need -fno-strict-aliasing.
     64     'v8_no_strict_aliasing%': 0,
     65 
     66     # Chrome needs this definition unconditionally. For standalone V8 builds,
     67     # it's handled in build/standalone.gypi.
     68     'want_separate_host_toolset%': 1,
     69 
     70     # Toolset the d8 binary should be compiled for. Possible values are 'host'
     71     # and 'target'. If you want to run v8 tests, it needs to be set to 'target'.
     72     # The setting is ignored if want_separate_host_toolset is 0.
     73     'v8_toolset_for_d8%': 'target',
     74 
     75     'host_os%': '<(OS)',
     76     'werror%': '-Werror',
     77     # For a shared library build, results in "libv8-<(soname_version).so".
     78     'soname_version%': '',
     79 
     80     # Allow to suppress the array bounds warning (default is no suppression).
     81     'wno_array_bounds%': '',
     82 
     83     # Link-Time Optimizations
     84     'use_lto%': 0,
     85 
     86     'variables': {
     87       # This is set when building the Android WebView inside the Android build
     88       # system, using the 'android' gyp backend.
     89       'android_webview_build%': 0,
     90     },
     91     # Copy it out one scope.
     92     'android_webview_build%': '<(android_webview_build)',
     93   },
     94   'conditions': [
     95     ['host_arch=="ia32" or host_arch=="x64" or clang==1', {
     96       'variables': {
     97         'host_cxx_is_biarch%': 1,
     98        },
     99      }, {
    100       'variables': {
    101         'host_cxx_is_biarch%': 0,
    102       },
    103     }],
    104     ['target_arch=="ia32" or target_arch=="x64" or target_arch=="x87" or \
    105       clang==1', {
    106       'variables': {
    107         'target_cxx_is_biarch%': 1,
    108        },
    109      }, {
    110       'variables': {
    111         'target_cxx_is_biarch%': 0,
    112       },
    113     }],
    114   ],
    115   'target_defaults': {
    116     'conditions': [
    117       ['v8_target_arch=="arm"', {
    118         'defines': [
    119           'V8_TARGET_ARCH_ARM',
    120         ],
    121         'conditions': [
    122           [ 'arm_version==7 or arm_version=="default"', {
    123             'defines': [
    124               'CAN_USE_ARMV7_INSTRUCTIONS',
    125             ],
    126           }],
    127           [ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', {
    128             'defines': [
    129               'CAN_USE_VFP3_INSTRUCTIONS',
    130             ],
    131           }],
    132           [ 'arm_fpu=="vfpv3"', {
    133             'defines': [
    134               'CAN_USE_VFP3_INSTRUCTIONS',
    135               'CAN_USE_VFP32DREGS',
    136             ],
    137           }],
    138           [ 'arm_fpu=="neon"', {
    139             'defines': [
    140               'CAN_USE_VFP3_INSTRUCTIONS',
    141               'CAN_USE_VFP32DREGS',
    142               'CAN_USE_NEON',
    143             ],
    144           }],
    145           [ 'arm_test_noprobe=="on"', {
    146             'defines': [
    147               'ARM_TEST_NO_FEATURE_PROBE',
    148             ],
    149           }],
    150         ],
    151         'target_conditions': [
    152           ['_toolset=="host"', {
    153             'conditions': [
    154               ['v8_target_arch==host_arch and android_webview_build==0', {
    155                 # Host built with an Arm CXX compiler.
    156                 'conditions': [
    157                   [ 'arm_version==7', {
    158                     'cflags': ['-march=armv7-a',],
    159                   }],
    160                   [ 'arm_version==7 or arm_version=="default"', {
    161                     'conditions': [
    162                       [ 'arm_fpu!="default"', {
    163                         'cflags': ['-mfpu=<(arm_fpu)',],
    164                       }],
    165                     ],
    166                   }],
    167                   [ 'arm_float_abi!="default"', {
    168                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
    169                   }],
    170                   [ 'arm_thumb==1', {
    171                     'cflags': ['-mthumb',],
    172                   }],
    173                   [ 'arm_thumb==0', {
    174                     'cflags': ['-marm',],
    175                   }],
    176                 ],
    177               }, {
    178                 # 'v8_target_arch!=host_arch'
    179                 # Host not built with an Arm CXX compiler (simulator build).
    180                 'conditions': [
    181                   [ 'arm_float_abi=="hard"', {
    182                     'defines': [
    183                       'USE_EABI_HARDFLOAT=1',
    184                     ],
    185                   }],
    186                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
    187                     'defines': [
    188                       'USE_EABI_HARDFLOAT=0',
    189                     ],
    190                   }],
    191                 ],
    192               }],
    193             ],
    194           }],  # _toolset=="host"
    195           ['_toolset=="target"', {
    196             'conditions': [
    197               ['v8_target_arch==target_arch and android_webview_build==0', {
    198                 # Target built with an Arm CXX compiler.
    199                 'conditions': [
    200                   [ 'arm_version==7', {
    201                     'cflags': ['-march=armv7-a',],
    202                   }],
    203                   [ 'arm_version==7 or arm_version=="default"', {
    204                     'conditions': [
    205                       [ 'arm_fpu!="default"', {
    206                         'cflags': ['-mfpu=<(arm_fpu)',],
    207                       }],
    208                     ],
    209                   }],
    210                   [ 'arm_float_abi!="default"', {
    211                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
    212                   }],
    213                   [ 'arm_thumb==1', {
    214                     'cflags': ['-mthumb',],
    215                   }],
    216                   [ 'arm_thumb==0', {
    217                     'cflags': ['-marm',],
    218                   }],
    219                 ],
    220               }, {
    221                 # 'v8_target_arch!=target_arch'
    222                 # Target not built with an Arm CXX compiler (simulator build).
    223                 'conditions': [
    224                   [ 'arm_float_abi=="hard"', {
    225                     'defines': [
    226                       'USE_EABI_HARDFLOAT=1',
    227                     ],
    228                   }],
    229                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
    230                     'defines': [
    231                       'USE_EABI_HARDFLOAT=0',
    232                     ],
    233                   }],
    234                 ],
    235               }],
    236               # Disable LTO for v8
    237               # v8 is optimized for speed, which takes precedence over
    238               # size optimization in LTO.
    239               ['use_lto==1', {
    240                 'cflags!': [
    241                   '-flto',
    242                   '-ffat-lto-objects',
    243                 ],
    244               }],
    245             ],
    246           }],  # _toolset=="target"
    247         ],
    248       }],  # v8_target_arch=="arm"
    249       ['v8_target_arch=="arm64"', {
    250         'defines': [
    251           'V8_TARGET_ARCH_ARM64',
    252         ],
    253       }],
    254       ['v8_target_arch=="ia32"', {
    255         'defines': [
    256           'V8_TARGET_ARCH_IA32',
    257         ],
    258       }],  # v8_target_arch=="ia32"
    259       ['v8_target_arch=="x87"', {
    260         'defines': [
    261           'V8_TARGET_ARCH_X87',
    262         ],
    263         'cflags': ['-march=i586'],
    264       }],  # v8_target_arch=="x87"
    265       ['v8_target_arch=="mips"', {
    266         'defines': [
    267           'V8_TARGET_ARCH_MIPS',
    268         ],
    269         'conditions': [
    270           [ 'v8_can_use_fpu_instructions=="true"', {
    271             'defines': [
    272               'CAN_USE_FPU_INSTRUCTIONS',
    273             ],
    274           }],
    275           [ 'v8_use_mips_abi_hardfloat=="true"', {
    276             'defines': [
    277               '__mips_hard_float=1',
    278               'CAN_USE_FPU_INSTRUCTIONS',
    279             ],
    280           }, {
    281             'defines': [
    282               '__mips_soft_float=1'
    283             ]
    284           }],
    285         ],
    286         'target_conditions': [
    287           ['_toolset=="target"', {
    288             'conditions': [
    289               ['v8_target_arch==target_arch and android_webview_build==0', {
    290                 # Target built with a Mips CXX compiler.
    291                 'cflags': ['-EB'],
    292                 'ldflags': ['-EB'],
    293                 'conditions': [
    294                   [ 'v8_use_mips_abi_hardfloat=="true"', {
    295                     'cflags': ['-mhard-float'],
    296                     'ldflags': ['-mhard-float'],
    297                   }, {
    298                     'cflags': ['-msoft-float'],
    299                     'ldflags': ['-msoft-float'],
    300                   }],
    301                   ['mips_arch_variant=="r6"', {
    302                     'defines': [
    303                       '_MIPS_ARCH_MIPS32R6',
    304                       'FPU_MODE_FP64',
    305                     ],
    306                     'cflags!': ['-mfp32', '-mfpxx'],
    307                     'cflags': ['-mips32r6', '-Wa,-mips32r6'],
    308                     'ldflags': [
    309                       '-mips32r6',
    310                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
    311                       '-Wl,--rpath=$(LD_R_PATH)',
    312                     ],
    313                   }],
    314                   ['mips_arch_variant=="r2"', {
    315                     'conditions': [
    316                       [ 'mips_fpu_mode=="fp64"', {
    317                         'defines': [
    318                           '_MIPS_ARCH_MIPS32R2',
    319                           'FPU_MODE_FP64',
    320                         ],
    321                         'cflags': ['-mfp64'],
    322                       }],
    323                       ['mips_fpu_mode=="fpxx"', {
    324                         'defines': [
    325                           '_MIPS_ARCH_MIPS32R2',
    326                           'FPU_MODE_FPXX',
    327                         ],
    328                         'cflags': ['-mfpxx'],
    329                       }],
    330                       ['mips_fpu_mode=="fp32"', {
    331                         'defines': [
    332                           '_MIPS_ARCH_MIPS32R2',
    333                           'FPU_MODE_FP32',
    334                         ],
    335                         'cflags': ['-mfp32'],
    336                       }],
    337                     ],
    338                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
    339                     'ldflags': ['-mips32r2'],
    340                   }],
    341                   ['mips_arch_variant=="r1"', {
    342                     'defines': [
    343                       'FPU_MODE_FP32',
    344                     ],
    345                     'cflags!': ['-mfp64', '-mfpxx'],
    346                     'cflags': ['-mips32', '-Wa,-mips32'],
    347                     'ldflags': ['-mips32'],
    348                   }],
    349                   ['mips_arch_variant=="rx"', {
    350                     'defines': [
    351                       '_MIPS_ARCH_MIPS32RX',
    352                       'FPU_MODE_FPXX',
    353                     ],
    354                     'cflags!': ['-mfp64', '-mfp32'],
    355                     'cflags': ['-mips32', '-Wa,-mips32', '-mfpxx'],
    356                     'ldflags': ['-mips32'],
    357                   }],
    358                 ],
    359               }, {
    360                 # 'v8_target_arch!=target_arch'
    361                 # Target not built with an MIPS CXX compiler (simulator build).
    362                 'conditions': [
    363                   ['mips_arch_variant=="r6"', {
    364                     'defines': [
    365                       '_MIPS_ARCH_MIPS32R6',
    366                       'FPU_MODE_FP64',
    367                     ],
    368                   }],
    369                   ['mips_arch_variant=="r2"', {
    370                     'conditions': [
    371                       [ 'mips_fpu_mode=="fp64"', {
    372                         'defines': [
    373                           '_MIPS_ARCH_MIPS32R2',
    374                           'FPU_MODE_FP64',
    375                         ],
    376                       }],
    377                       ['mips_fpu_mode=="fpxx"', {
    378                         'defines': [
    379                           '_MIPS_ARCH_MIPS32R2',
    380                           'FPU_MODE_FPXX',
    381                         ],
    382                       }],
    383                       ['mips_fpu_mode=="fp32"', {
    384                         'defines': [
    385                           '_MIPS_ARCH_MIPS32R2',
    386                           'FPU_MODE_FP32',
    387                         ],
    388                       }],
    389                     ],
    390                   }],
    391                   ['mips_arch_variant=="r1"', {
    392                     'defines': [
    393                       'FPU_MODE_FP32',
    394                     ],
    395                   }],
    396                   ['mips_arch_variant=="rx"', {
    397                     'defines': [
    398                       '_MIPS_ARCH_MIPS32RX',
    399                       'FPU_MODE_FPXX',
    400                     ],
    401                   }],
    402                 ],
    403               }],
    404             ],
    405           }],  #_toolset=="target"
    406           ['_toolset=="host"', {
    407             'conditions': [
    408               ['mips_arch_variant=="rx"', {
    409                 'defines': [
    410                   '_MIPS_ARCH_MIPS32RX',
    411                   'FPU_MODE_FPXX',
    412                 ],
    413               }],
    414               ['mips_arch_variant=="r6"', {
    415                 'defines': [
    416                   '_MIPS_ARCH_MIPS32R6',
    417                   'FPU_MODE_FP64',
    418                 ],
    419               }],
    420               ['mips_arch_variant=="r2"', {
    421                 'conditions': [
    422                   ['mips_fpu_mode=="fp64"', {
    423                     'defines': [
    424                       '_MIPS_ARCH_MIPS32R2',
    425                       'FPU_MODE_FP64',
    426                     ],
    427                   }],
    428                   ['mips_fpu_mode=="fpxx"', {
    429                     'defines': [
    430                       '_MIPS_ARCH_MIPS32R2',
    431                       'FPU_MODE_FPXX',
    432                     ],
    433                   }],
    434                   ['mips_fpu_mode=="fp32"', {
    435                     'defines': [
    436                       '_MIPS_ARCH_MIPS32R2',
    437                       'FPU_MODE_FP32'
    438                     ],
    439                   }],
    440                 ],
    441               }],
    442               ['mips_arch_variant=="r1"', {
    443                 'defines': ['FPU_MODE_FP32',],
    444               }],
    445             ]
    446           }],  #_toolset=="host"
    447         ],
    448       }],  # v8_target_arch=="mips"
    449       ['v8_target_arch=="mipsel"', {
    450         'defines': [
    451           'V8_TARGET_ARCH_MIPS',
    452         ],
    453         'conditions': [
    454           [ 'v8_can_use_fpu_instructions=="true"', {
    455             'defines': [
    456               'CAN_USE_FPU_INSTRUCTIONS',
    457             ],
    458           }],
    459           [ 'v8_use_mips_abi_hardfloat=="true"', {
    460             'defines': [
    461               '__mips_hard_float=1',
    462               'CAN_USE_FPU_INSTRUCTIONS',
    463             ],
    464           }, {
    465             'defines': [
    466               '__mips_soft_float=1'
    467             ],
    468           }],
    469         ],
    470         'target_conditions': [
    471           ['_toolset=="target"', {
    472             'conditions': [
    473               ['v8_target_arch==target_arch and android_webview_build==0', {
    474                 # Target built with a Mips CXX compiler.
    475                 'cflags': ['-EL'],
    476                 'ldflags': ['-EL'],
    477                 'conditions': [
    478                   [ 'v8_use_mips_abi_hardfloat=="true"', {
    479                     'cflags': ['-mhard-float'],
    480                     'ldflags': ['-mhard-float'],
    481                   }, {
    482                     'cflags': ['-msoft-float'],
    483                     'ldflags': ['-msoft-float'],
    484                   }],
    485                   ['mips_arch_variant=="r6"', {
    486                     'defines': [
    487                       '_MIPS_ARCH_MIPS32R6',
    488                       'FPU_MODE_FP64',
    489                     ],
    490                     'cflags!': ['-mfp32', '-mfpxx'],
    491                     'cflags': ['-mips32r6', '-Wa,-mips32r6'],
    492                     'ldflags': [
    493                       '-mips32r6',
    494                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
    495                       '-Wl,--rpath=$(LD_R_PATH)',
    496                     ],
    497                   }],
    498                   ['mips_arch_variant=="r2"', {
    499                     'conditions': [
    500                       [ 'mips_fpu_mode=="fp64"', {
    501                         'defines': [
    502                           '_MIPS_ARCH_MIPS32R2',
    503                           'FPU_MODE_FP64',
    504                         ],
    505                         'cflags': ['-mfp64'],
    506                       }],
    507                       ['mips_fpu_mode=="fpxx"', {
    508                         'defines': [
    509                           '_MIPS_ARCH_MIPS32R2',
    510                           'FPU_MODE_FPXX',
    511                         ],
    512                         'cflags': ['-mfpxx'],
    513                       }],
    514                       ['mips_fpu_mode=="fp32"', {
    515                         'defines': [
    516                           '_MIPS_ARCH_MIPS32R2',
    517                           'FPU_MODE_FP32',
    518                         ],
    519                         'cflags': ['-mfp32'],
    520                       }],
    521                     ],
    522                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
    523                     'ldflags': ['-mips32r2'],
    524                   }],
    525                   ['mips_arch_variant=="r1"', {
    526                     'cflags!': ['-mfp64', '-mfpxx'],
    527                     'cflags': ['-mips32', '-Wa,-mips32'],
    528                     'ldflags': ['-mips32'],
    529                   }],
    530                   ['mips_arch_variant=="rx"', {
    531                     'defines': [
    532                       '_MIPS_ARCH_MIPS32RX',
    533                       'FPU_MODE_FPXX',
    534                     ],
    535                     'cflags!': ['-mfp64', '-mfp32'],
    536                     'cflags': ['-mips32', '-Wa,-mips32', '-mfpxx'],
    537                     'ldflags': ['-mips32'],
    538                   }],
    539                   ['mips_arch_variant=="loongson"', {
    540                     'defines': [
    541                       '_MIPS_ARCH_LOONGSON',
    542                       'FPU_MODE_FP32',
    543                     ],
    544                     'cflags!': ['-mfp64', '-mfp32', '-mfpxx'],
    545                     'cflags': ['-mips3', '-Wa,-mips3'],
    546                   }],
    547                 ],
    548               }, {
    549                 # 'v8_target_arch!=target_arch'
    550                 # Target not built with an MIPS CXX compiler (simulator build).
    551                 'conditions': [
    552                   ['mips_arch_variant=="r6"', {
    553                     'defines': [
    554                       '_MIPS_ARCH_MIPS32R6',
    555                       'FPU_MODE_FP64',
    556                     ],
    557                   }],
    558                   ['mips_arch_variant=="r2"', {
    559                     'conditions': [
    560                       [ 'mips_fpu_mode=="fp64"', {
    561                         'defines': [
    562                           '_MIPS_ARCH_MIPS32R2',
    563                           'FPU_MODE_FP64',
    564                         ],
    565                       }],
    566                       ['mips_fpu_mode=="fpxx"', {
    567                         'defines': [
    568                           '_MIPS_ARCH_MIPS32R2',
    569                           'FPU_MODE_FPXX',
    570                         ],
    571                       }],
    572                       ['mips_fpu_mode=="fp32"', {
    573                         'defines': [
    574                           '_MIPS_ARCH_MIPS32R2',
    575                           'FPU_MODE_FP32',
    576                         ],
    577                       }],
    578                     ],
    579                   }],
    580                   ['mips_arch_variant=="r1"', {
    581                     'defines': [
    582                       'FPU_MODE_FP32',
    583                     ],
    584                   }],
    585                   ['mips_arch_variant=="rx"', {
    586                     'defines': [
    587                       '_MIPS_ARCH_MIPS32RX',
    588                       'FPU_MODE_FPXX',
    589                     ],
    590                   }],
    591                   ['mips_arch_variant=="loongson"', {
    592                     'defines': [
    593                       '_MIPS_ARCH_LOONGSON',
    594                       'FPU_MODE_FP32',
    595                     ],
    596                   }],
    597                 ],
    598               }],
    599             ],
    600           }], #_toolset=="target
    601           ['_toolset=="host"', {
    602             'conditions': [
    603               ['mips_arch_variant=="rx"', {
    604                 'defines': [
    605                   '_MIPS_ARCH_MIPS32RX',
    606                   'FPU_MODE_FPXX',
    607                 ],
    608               }],
    609               ['mips_arch_variant=="r6"', {
    610                 'defines': [
    611                   '_MIPS_ARCH_MIPS32R6',
    612                   'FPU_MODE_FP64',
    613                 ],
    614               }],
    615               ['mips_arch_variant=="r2"', {
    616                 'conditions': [
    617                   ['mips_fpu_mode=="fp64"', {
    618                     'defines': [
    619                       '_MIPS_ARCH_MIPS32R2',
    620                       'FPU_MODE_FP64',
    621                     ],
    622                   }],
    623                   ['mips_fpu_mode=="fpxx"', {
    624                     'defines': [
    625                       '_MIPS_ARCH_MIPS32R2',
    626                       'FPU_MODE_FPXX',
    627                     ],
    628                   }],
    629                   ['mips_fpu_mode=="fp32"', {
    630                     'defines': [
    631                       '_MIPS_ARCH_MIPS32R2',
    632                       'FPU_MODE_FP32'
    633                     ],
    634                   }],
    635                 ],
    636               }],
    637               ['mips_arch_variant=="r1"', {
    638                 'defines': ['FPU_MODE_FP32',],
    639               }],
    640               ['mips_arch_variant=="loongson"', {
    641                 'defines': [
    642                   '_MIPS_ARCH_LOONGSON',
    643                   'FPU_MODE_FP32',
    644                 ],
    645               }],
    646             ]
    647           }],
    648         ],
    649       }],  # v8_target_arch=="mipsel"
    650       ['v8_target_arch=="mips64el"', {
    651         'defines': [
    652           'V8_TARGET_ARCH_MIPS64',
    653         ],
    654         'conditions': [
    655           [ 'v8_can_use_fpu_instructions=="true"', {
    656             'defines': [
    657               'CAN_USE_FPU_INSTRUCTIONS',
    658             ],
    659           }],
    660           [ 'v8_use_mips_abi_hardfloat=="true"', {
    661             'defines': [
    662               '__mips_hard_float=1',
    663               'CAN_USE_FPU_INSTRUCTIONS',
    664             ],
    665           }, {
    666             'defines': [
    667               '__mips_soft_float=1'
    668             ],
    669           }],
    670          ],
    671         'target_conditions': [
    672           ['_toolset=="target"', {
    673             'conditions': [
    674               ['v8_target_arch==target_arch and android_webview_build==0', {
    675                 'cflags': ['-EL'],
    676                 'ldflags': ['-EL'],
    677                 'conditions': [
    678                   [ 'v8_use_mips_abi_hardfloat=="true"', {
    679                     'cflags': ['-mhard-float'],
    680                     'ldflags': ['-mhard-float'],
    681                   }, {
    682                     'cflags': ['-msoft-float'],
    683                     'ldflags': ['-msoft-float'],
    684                   }],
    685                   ['mips_arch_variant=="r6"', {
    686                     'defines': ['_MIPS_ARCH_MIPS64R6',],
    687                     'cflags': ['-mips64r6', '-mabi=64', '-Wa,-mips64r6'],
    688                     'ldflags': [
    689                       '-mips64r6', '-mabi=64',
    690                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
    691                       '-Wl,--rpath=$(LD_R_PATH)',
    692                     ],
    693                   }],
    694                   ['mips_arch_variant=="r2"', {
    695                     'defines': ['_MIPS_ARCH_MIPS64R2',],
    696                     'cflags': ['-mips64r2', '-mabi=64', '-Wa,-mips64r2'],
    697                     'ldflags': [
    698                       '-mips64r2', '-mabi=64',
    699                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
    700                       '-Wl,--rpath=$(LD_R_PATH)',
    701                     ],
    702                   }],
    703                 ],
    704               }, {
    705                 # 'v8_target_arch!=target_arch'
    706                 # Target not built with an MIPS CXX compiler (simulator build).
    707                 'conditions': [
    708                   ['mips_arch_variant=="r6"', {
    709                     'defines': ['_MIPS_ARCH_MIPS64R6',],
    710                   }],
    711                   ['mips_arch_variant=="r2"', {
    712                     'defines': ['_MIPS_ARCH_MIPS64R2',],
    713                   }],
    714                 ],
    715               }],
    716             ],
    717           }],  #'_toolset=="target"
    718           ['_toolset=="host"', {
    719             'conditions': [
    720               ['mips_arch_variant=="r6"', {
    721                 'defines': ['_MIPS_ARCH_MIPS64R6',],
    722               }],
    723               ['mips_arch_variant=="r2"', {
    724                 'defines': ['_MIPS_ARCH_MIPS64R2',],
    725               }],
    726             ],
    727           }],  #'_toolset=="host"
    728         ],
    729       }],  # v8_target_arch=="mips64el"
    730       ['v8_target_arch=="x64"', {
    731         'defines': [
    732           'V8_TARGET_ARCH_X64',
    733         ],
    734         'xcode_settings': {
    735           'ARCHS': [ 'x86_64' ],
    736         },
    737         'msvs_settings': {
    738           'VCLinkerTool': {
    739             'StackReserveSize': '2097152',
    740           },
    741         },
    742         'msvs_configuration_platform': 'x64',
    743       }],  # v8_target_arch=="x64"
    744       ['v8_target_arch=="x32"', {
    745         'defines': [
    746           # x32 port shares the source code with x64 port.
    747           'V8_TARGET_ARCH_X64',
    748           'V8_TARGET_ARCH_32_BIT',
    749         ],
    750         'cflags': [
    751           '-mx32',
    752           # Inhibit warning if long long type is used.
    753           '-Wno-long-long',
    754         ],
    755         'ldflags': [
    756           '-mx32',
    757         ],
    758       }],  # v8_target_arch=="x32"
    759       ['OS=="win"', {
    760         'defines': [
    761           'WIN32',
    762         ],
    763         # 4351: VS 2005 and later are warning us that they've fixed a bug
    764         #       present in VS 2003 and earlier.
    765         'msvs_disabled_warnings': [4351],
    766         'msvs_configuration_attributes': {
    767           'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
    768           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
    769           'CharacterSet': '1',
    770         },
    771       }],
    772       ['OS=="win" and v8_target_arch=="ia32"', {
    773         'msvs_settings': {
    774           'VCCLCompilerTool': {
    775             # Ensure no surprising artifacts from 80bit double math with x86.
    776             'AdditionalOptions': ['/arch:SSE2'],
    777           },
    778         },
    779       }],
    780       ['OS=="win" and v8_enable_prof==1', {
    781         'msvs_settings': {
    782           'VCLinkerTool': {
    783             'GenerateMapFile': 'true',
    784           },
    785         },
    786       }],
    787       ['(OS=="linux" or OS=="freebsd"  or OS=="openbsd" or OS=="solaris" \
    788          or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
    789         (v8_target_arch=="arm" or v8_target_arch=="ia32" or \
    790          v8_target_arch=="x87" or v8_target_arch=="mips" or \
    791          v8_target_arch=="mipsel")', {
    792         'target_conditions': [
    793           ['_toolset=="host"', {
    794             'conditions': [
    795               ['host_cxx_is_biarch==1', {
    796                 'cflags': [ '-m32' ],
    797                 'ldflags': [ '-m32' ]
    798               }],
    799             ],
    800             'xcode_settings': {
    801               'ARCHS': [ 'i386' ],
    802             },
    803           }],
    804           ['_toolset=="target"', {
    805             'conditions': [
    806               ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', {
    807                 'cflags': [ '-m32' ],
    808                 'ldflags': [ '-m32' ],
    809               }],
    810               # Enable feedback-directed optimisation when building in android.
    811               [ 'android_webview_build == 1', {
    812                 'aosp_build_settings': {
    813                   'LOCAL_FDO_SUPPORT': 'true',
    814                 },
    815               }],
    816             ],
    817             'xcode_settings': {
    818               'ARCHS': [ 'i386' ],
    819             },
    820           }],
    821         ],
    822       }],
    823       ['(OS=="linux" or OS=="android") and \
    824         (v8_target_arch=="x64" or v8_target_arch=="arm64")', {
    825         'target_conditions': [
    826           ['_toolset=="host"', {
    827             'conditions': [
    828               ['host_cxx_is_biarch==1', {
    829                 'cflags': [ '-m64' ],
    830                 'ldflags': [ '-m64' ]
    831               }],
    832              ],
    833            }],
    834            ['_toolset=="target"', {
    835              'conditions': [
    836                ['target_cxx_is_biarch==1', {
    837                  'cflags': [ '-m64' ],
    838                  'ldflags': [ '-m64' ],
    839                }],
    840                # Enable feedback-directed optimisation when building in android.
    841                [ 'android_webview_build == 1', {
    842                  'aosp_build_settings': {
    843                    'LOCAL_FDO_SUPPORT': 'true',
    844                  },
    845                }],
    846              ]
    847            }],
    848          ],
    849       }],
    850       ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
    851          or OS=="netbsd" or OS=="qnx"', {
    852         'conditions': [
    853           [ 'v8_no_strict_aliasing==1', {
    854             'cflags': [ '-fno-strict-aliasing' ],
    855           }],
    856         ],  # conditions
    857       }],
    858       ['OS=="solaris"', {
    859         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
    860       }],
    861       ['OS=="freebsd" or OS=="openbsd"', {
    862         'cflags': [ '-I/usr/local/include' ],
    863       }],
    864       ['OS=="netbsd"', {
    865         'cflags': [ '-I/usr/pkg/include' ],
    866       }],
    867     ],  # conditions
    868     'configurations': {
    869       # Abstract configuration for v8_optimized_debug == 0.
    870       'DebugBase0': {
    871         'abstract': 1,
    872         'msvs_settings': {
    873           'VCCLCompilerTool': {
    874             'Optimization': '0',
    875             'conditions': [
    876               ['component=="shared_library"', {
    877                 'RuntimeLibrary': '3',  # /MDd
    878               }, {
    879                 'RuntimeLibrary': '1',  # /MTd
    880               }],
    881             ],
    882           },
    883           'VCLinkerTool': {
    884             'LinkIncremental': '2',
    885           },
    886         },
    887         'conditions': [
    888           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
    889             OS=="qnx"', {
    890             'cflags!': [
    891               '-O0',
    892               '-O3',
    893               '-O2',
    894               '-O1',
    895               '-Os',
    896             ],
    897             'cflags': [
    898               '-fdata-sections',
    899               '-ffunction-sections',
    900             ],
    901           }],
    902           ['OS=="mac"', {
    903             'xcode_settings': {
    904                'GCC_OPTIMIZATION_LEVEL': '0',  # -O0
    905             },
    906           }],
    907         ],
    908       },  # DebugBase0
    909       # Abstract configuration for v8_optimized_debug == 1.
    910       'DebugBase1': {
    911         'abstract': 1,
    912         'msvs_settings': {
    913           'VCCLCompilerTool': {
    914             'Optimization': '1',
    915             'InlineFunctionExpansion': '2',
    916             'EnableIntrinsicFunctions': 'true',
    917             'FavorSizeOrSpeed': '0',
    918             'StringPooling': 'true',
    919             'BasicRuntimeChecks': '0',
    920             'conditions': [
    921               ['component=="shared_library"', {
    922                 'RuntimeLibrary': '3',  # /MDd
    923               }, {
    924                 'RuntimeLibrary': '1',  # /MTd
    925               }],
    926             ],
    927           },
    928           'VCLinkerTool': {
    929             'LinkIncremental': '2',
    930           },
    931         },
    932         'conditions': [
    933           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
    934             OS=="qnx"', {
    935             'cflags!': [
    936               '-O0',
    937               '-O3', # TODO(2807) should be -O1.
    938               '-O2',
    939               '-Os',
    940             ],
    941             'cflags': [
    942               '-fdata-sections',
    943               '-ffunction-sections',
    944               '-O1', # TODO(2807) should be -O3.
    945             ],
    946             'conditions': [
    947               ['gcc_version==44 and clang==0', {
    948                 'cflags': [
    949                   # Avoid crashes with gcc 4.4 in the v8 test suite.
    950                   '-fno-tree-vrp',
    951                 ],
    952               }],
    953             ],
    954           }],
    955           ['OS=="mac"', {
    956             'xcode_settings': {
    957                'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
    958                'GCC_STRICT_ALIASING': 'YES',
    959             },
    960           }],
    961         ],
    962       },  # DebugBase1
    963       # Abstract configuration for v8_optimized_debug == 2.
    964       'DebugBase2': {
    965         'abstract': 1,
    966         'msvs_settings': {
    967           'VCCLCompilerTool': {
    968             'Optimization': '2',
    969             'InlineFunctionExpansion': '2',
    970             'EnableIntrinsicFunctions': 'true',
    971             'FavorSizeOrSpeed': '0',
    972             'StringPooling': 'true',
    973             'BasicRuntimeChecks': '0',
    974             'conditions': [
    975               ['component=="shared_library"', {
    976                 'RuntimeLibrary': '3',  #/MDd
    977               }, {
    978                 'RuntimeLibrary': '1',  #/MTd
    979               }],
    980               ['v8_target_arch=="x64"', {
    981                 # TODO(2207): remove this option once the bug is fixed.
    982                 'WholeProgramOptimization': 'true',
    983               }],
    984             ],
    985           },
    986           'VCLinkerTool': {
    987             'LinkIncremental': '1',
    988             'OptimizeReferences': '2',
    989             'EnableCOMDATFolding': '2',
    990           },
    991         },
    992         'conditions': [
    993           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
    994             OS=="qnx"', {
    995             'cflags!': [
    996               '-O0',
    997               '-O1',
    998               '-Os',
    999             ],
   1000             'cflags': [
   1001               '-fdata-sections',
   1002               '-ffunction-sections',
   1003             ],
   1004             'defines': [
   1005               'OPTIMIZED_DEBUG'
   1006             ],
   1007             'conditions': [
   1008               # TODO(crbug.com/272548): Avoid -O3 in NaCl
   1009               ['nacl_target_arch=="none"', {
   1010                 'cflags': ['-O3'],
   1011                 'cflags!': ['-O2'],
   1012                 }, {
   1013                 'cflags': ['-O2'],
   1014                 'cflags!': ['-O3'],
   1015               }],
   1016               ['gcc_version==44 and clang==0', {
   1017                 'cflags': [
   1018                   # Avoid crashes with gcc 4.4 in the v8 test suite.
   1019                   '-fno-tree-vrp',
   1020                 ],
   1021               }],
   1022             ],
   1023           }],
   1024           ['OS=="mac"', {
   1025             'xcode_settings': {
   1026               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
   1027               'GCC_STRICT_ALIASING': 'YES',
   1028             },
   1029           }],
   1030         ],
   1031       },  # DebugBase2
   1032       # Common settings for the Debug configuration.
   1033       'DebugBaseCommon': {
   1034         'abstract': 1,
   1035         'defines': [
   1036           'ENABLE_DISASSEMBLER',
   1037           'V8_ENABLE_CHECKS',
   1038           'OBJECT_PRINT',
   1039           'VERIFY_HEAP',
   1040           'DEBUG'
   1041         ],
   1042         'conditions': [
   1043           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
   1044             OS=="qnx"', {
   1045             'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
   1046           }],
   1047           ['OS=="linux" and v8_enable_backtrace==1', {
   1048             # Support for backtrace_symbols.
   1049             'ldflags': [ '-rdynamic' ],
   1050           }],
   1051           ['OS=="android"', {
   1052             'variables': {
   1053               'android_full_debug%': 1,
   1054             },
   1055             'conditions': [
   1056               ['android_full_debug==0', {
   1057                 # Disable full debug if we want a faster v8 in a debug build.
   1058                 # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
   1059                 'defines!': [
   1060                   'DEBUG',
   1061                 ],
   1062               }],
   1063             ],
   1064           }],
   1065         ],
   1066       },  # DebugBaseCommon
   1067       'Debug': {
   1068         'inherit_from': ['DebugBaseCommon'],
   1069         'conditions': [
   1070           ['v8_optimized_debug==0', {
   1071             'inherit_from': ['DebugBase0'],
   1072           }],
   1073           ['v8_optimized_debug==1', {
   1074             'inherit_from': ['DebugBase1'],
   1075           }],
   1076           ['v8_optimized_debug==2', {
   1077             'inherit_from': ['DebugBase2'],
   1078           }],
   1079         ],
   1080       },  # Debug
   1081       'Release': {
   1082         'conditions': [
   1083           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
   1084             'cflags!': [
   1085               '-Os',
   1086             ],
   1087             'cflags': [
   1088               '-fdata-sections',
   1089               '-ffunction-sections',
   1090               '<(wno_array_bounds)',
   1091             ],
   1092             'conditions': [
   1093               [ 'gcc_version==44 and clang==0', {
   1094                 'cflags': [
   1095                   # Avoid crashes with gcc 4.4 in the v8 test suite.
   1096                   '-fno-tree-vrp',
   1097                 ],
   1098               }],
   1099               # TODO(crbug.com/272548): Avoid -O3 in NaCl
   1100               ['nacl_target_arch=="none"', {
   1101                 'cflags': ['-O3'],
   1102                 'cflags!': ['-O2'],
   1103               }, {
   1104                 'cflags': ['-O2'],
   1105                 'cflags!': ['-O3'],
   1106               }],
   1107             ],
   1108           }],
   1109           ['OS=="android"', {
   1110             'cflags!': [
   1111               '-O3',
   1112               '-Os',
   1113             ],
   1114             'cflags': [
   1115               '-fdata-sections',
   1116               '-ffunction-sections',
   1117               '-O2',
   1118             ],
   1119             'conditions': [
   1120               [ 'gcc_version==44 and clang==0', {
   1121                 'cflags': [
   1122                   # Avoid crashes with gcc 4.4 in the v8 test suite.
   1123                   '-fno-tree-vrp',
   1124                 ],
   1125               }],
   1126             ],
   1127           }],
   1128           ['OS=="mac"', {
   1129             'xcode_settings': {
   1130               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
   1131 
   1132               # -fstrict-aliasing.  Mainline gcc
   1133               # enables this at -O2 and above,
   1134               # but Apple gcc does not unless it
   1135               # is specified explicitly.
   1136               'GCC_STRICT_ALIASING': 'YES',
   1137             },
   1138           }],  # OS=="mac"
   1139           ['OS=="win"', {
   1140             'msvs_settings': {
   1141               'VCCLCompilerTool': {
   1142                 'Optimization': '2',
   1143                 'InlineFunctionExpansion': '2',
   1144                 'EnableIntrinsicFunctions': 'true',
   1145                 'FavorSizeOrSpeed': '0',
   1146                 'StringPooling': 'true',
   1147                 'conditions': [
   1148                   ['component=="shared_library"', {
   1149                     'RuntimeLibrary': '2',  #/MD
   1150                   }, {
   1151                     'RuntimeLibrary': '0',  #/MT
   1152                   }],
   1153                   ['v8_target_arch=="x64"', {
   1154                     # TODO(2207): remove this option once the bug is fixed.
   1155                     'WholeProgramOptimization': 'true',
   1156                   }],
   1157                 ],
   1158               },
   1159               'VCLinkerTool': {
   1160                 'LinkIncremental': '1',
   1161                 'OptimizeReferences': '2',
   1162                 'EnableCOMDATFolding': '2',
   1163               },
   1164             },
   1165           }],  # OS=="win"
   1166         ],  # conditions
   1167       },  # Release
   1168     },  # configurations
   1169   },  # target_defaults
   1170 }
   1171