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