Upstream version 9.38.198.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     '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     # Default arch variant for MIPS.
59     'mips_arch_variant%': 'r2',
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     '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             ],
237           }],  # _toolset=="target"
238         ],
239       }],  # v8_target_arch=="arm"
240       ['v8_target_arch=="arm64"', {
241         'defines': [
242           'V8_TARGET_ARCH_ARM64',
243         ],
244       }],
245       ['v8_target_arch=="ia32"', {
246         'defines': [
247           'V8_TARGET_ARCH_IA32',
248         ],
249       }],  # v8_target_arch=="ia32"
250       ['v8_target_arch=="x87"', {
251         'defines': [
252           'V8_TARGET_ARCH_X87',
253         ],
254         'cflags': ['-march=i586'],
255       }],  # v8_target_arch=="x87"
256       ['v8_target_arch=="mips"', {
257         'defines': [
258           'V8_TARGET_ARCH_MIPS',
259         ],
260         'conditions': [
261           ['v8_target_arch==target_arch and android_webview_build==0', {
262             # Target built with a Mips CXX compiler.
263             'target_conditions': [
264               ['_toolset=="target"', {
265                 'cflags': ['-EB'],
266                 'ldflags': ['-EB'],
267                 'conditions': [
268                   [ 'v8_use_mips_abi_hardfloat=="true"', {
269                     'cflags': ['-mhard-float'],
270                     'ldflags': ['-mhard-float'],
271                   }, {
272                     'cflags': ['-msoft-float'],
273                     'ldflags': ['-msoft-float'],
274                   }],
275                   ['mips_arch_variant=="r2"', {
276                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
277                   }],
278                   ['mips_arch_variant=="r1"', {
279                     'cflags': ['-mips32', '-Wa,-mips32'],
280                   }],
281                 ],
282               }],
283             ],
284           }],
285           [ 'v8_can_use_fpu_instructions=="true"', {
286             'defines': [
287               'CAN_USE_FPU_INSTRUCTIONS',
288             ],
289           }],
290           [ 'v8_use_mips_abi_hardfloat=="true"', {
291             'defines': [
292               '__mips_hard_float=1',
293               'CAN_USE_FPU_INSTRUCTIONS',
294             ],
295           }, {
296             'defines': [
297               '__mips_soft_float=1'
298             ],
299           }],
300           ['mips_arch_variant=="r2"', {
301             'defines': ['_MIPS_ARCH_MIPS32R2',],
302           }],
303         ],
304       }],  # v8_target_arch=="mips"
305       ['v8_target_arch=="mipsel"', {
306         'defines': [
307           'V8_TARGET_ARCH_MIPS',
308         ],
309         'conditions': [
310           ['v8_target_arch==target_arch and android_webview_build==0', {
311             # Target built with a Mips CXX compiler.
312             'target_conditions': [
313               ['_toolset=="target"', {
314                 'cflags': ['-EL'],
315                 'ldflags': ['-EL'],
316                 'conditions': [
317                   [ 'v8_use_mips_abi_hardfloat=="true"', {
318                     'cflags': ['-mhard-float'],
319                     'ldflags': ['-mhard-float'],
320                   }, {
321                     'cflags': ['-msoft-float'],
322                     'ldflags': ['-msoft-float'],
323                   }],
324                   ['mips_arch_variant=="r2"', {
325                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
326                   }],
327                   ['mips_arch_variant=="r1"', {
328                     'cflags': ['-mips32', '-Wa,-mips32'],
329                  }],
330                   ['mips_arch_variant=="loongson"', {
331                     'cflags': ['-mips3', '-Wa,-mips3'],
332                   }],
333                 ],
334               }],
335             ],
336           }],
337           [ 'v8_can_use_fpu_instructions=="true"', {
338             'defines': [
339               'CAN_USE_FPU_INSTRUCTIONS',
340             ],
341           }],
342           [ 'v8_use_mips_abi_hardfloat=="true"', {
343             'defines': [
344               '__mips_hard_float=1',
345               'CAN_USE_FPU_INSTRUCTIONS',
346             ],
347           }, {
348             'defines': [
349               '__mips_soft_float=1'
350             ],
351           }],
352           ['mips_arch_variant=="r2"', {
353             'defines': ['_MIPS_ARCH_MIPS32R2',],
354           }],
355           ['mips_arch_variant=="loongson"', {
356             'defines': ['_MIPS_ARCH_LOONGSON',],
357           }],
358         ],
359       }],  # v8_target_arch=="mipsel"
360       ['v8_target_arch=="mips64el"', {
361         'defines': [
362           'V8_TARGET_ARCH_MIPS64',
363         ],
364         'conditions': [
365           ['v8_target_arch==target_arch and android_webview_build==0', {
366             # Target built with a Mips CXX compiler.
367             'target_conditions': [
368               ['_toolset=="target"', {
369                 'cflags': ['-EL'],
370                 'ldflags': ['-EL'],
371                 'conditions': [
372                   [ 'v8_use_mips_abi_hardfloat=="true"', {
373                     'cflags': ['-mhard-float'],
374                     'ldflags': ['-mhard-float'],
375                   }, {
376                     'cflags': ['-msoft-float'],
377                     'ldflags': ['-msoft-float'],
378                   }],
379                   ['mips_arch_variant=="r6"', {
380                     'cflags': ['-mips64r6', '-mabi=64', '-Wa,-mips64r6'],
381                     'ldflags': [
382                       '-mips64r6', '-mabi=64',
383                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
384                       '-Wl,--rpath=$(LD_R_PATH)',
385                     ],
386                   }],
387                   ['mips_arch_variant=="r2"', {
388                     'cflags': ['-mips64r2', '-mabi=64', '-Wa,-mips64r2'],
389                     'ldflags': [
390                       '-mips64r2', '-mabi=64',
391                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
392                       '-Wl,--rpath=$(LD_R_PATH)',
393                     ],
394                   }],
395                 ],
396               }],
397             ],
398           }],
399           [ 'v8_can_use_fpu_instructions=="true"', {
400             'defines': [
401               'CAN_USE_FPU_INSTRUCTIONS',
402             ],
403           }],
404           [ 'v8_use_mips_abi_hardfloat=="true"', {
405             'defines': [
406               '__mips_hard_float=1',
407               'CAN_USE_FPU_INSTRUCTIONS',
408             ],
409           }, {
410             'defines': [
411               '__mips_soft_float=1'
412             ],
413           }],
414           ['mips_arch_variant=="r6"', {
415             'defines': ['_MIPS_ARCH_MIPS64R6',],
416           }],
417           ['mips_arch_variant=="r2"', {
418             'defines': ['_MIPS_ARCH_MIPS64R2',],
419           }],
420         ],
421       }],  # v8_target_arch=="mips64el"
422       ['v8_target_arch=="x64"', {
423         'defines': [
424           'V8_TARGET_ARCH_X64',
425         ],
426         'xcode_settings': {
427           'ARCHS': [ 'x86_64' ],
428         },
429         'msvs_settings': {
430           'VCLinkerTool': {
431             'StackReserveSize': '2097152',
432           },
433         },
434         'msvs_configuration_platform': 'x64',
435       }],  # v8_target_arch=="x64"
436       ['v8_target_arch=="x32"', {
437         'defines': [
438           # x32 port shares the source code with x64 port.
439           'V8_TARGET_ARCH_X64',
440           'V8_TARGET_ARCH_32_BIT',
441         ],
442         'cflags': [
443           '-mx32',
444           # Inhibit warning if long long type is used.
445           '-Wno-long-long',
446         ],
447         'ldflags': [
448           '-mx32',
449         ],
450       }],  # v8_target_arch=="x32"
451       ['OS=="win"', {
452         'defines': [
453           'WIN32',
454         ],
455         # 4351: VS 2005 and later are warning us that they've fixed a bug
456         #       present in VS 2003 and earlier.
457         'msvs_disabled_warnings': [4351],
458         'msvs_configuration_attributes': {
459           'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
460           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
461           'CharacterSet': '1',
462         },
463       }],
464       ['OS=="win" and v8_target_arch=="ia32"', {
465         'msvs_settings': {
466           'VCCLCompilerTool': {
467             # Ensure no surprising artifacts from 80bit double math with x86.
468             'AdditionalOptions': ['/arch:SSE2'],
469           },
470         },
471       }],
472       ['OS=="win" and v8_enable_prof==1', {
473         'msvs_settings': {
474           'VCLinkerTool': {
475             'GenerateMapFile': 'true',
476           },
477         },
478       }],
479       ['(OS=="linux" or OS=="freebsd"  or OS=="openbsd" or OS=="solaris" \
480          or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
481         (v8_target_arch=="arm" or v8_target_arch=="ia32" or \
482          v8_target_arch=="x87" or v8_target_arch=="mips" or \
483          v8_target_arch=="mipsel")', {
484         'target_conditions': [
485           ['_toolset=="host"', {
486             'conditions': [
487               ['host_cxx_is_biarch==1', {
488                 'cflags': [ '-m32' ],
489                 'ldflags': [ '-m32' ]
490               }],
491             ],
492             'xcode_settings': {
493               'ARCHS': [ 'i386' ],
494             },
495           }],
496           ['_toolset=="target"', {
497             'conditions': [
498               ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', {
499                 'cflags': [ '-m32' ],
500                 'ldflags': [ '-m32' ],
501               }],
502             ],
503             'xcode_settings': {
504               'ARCHS': [ 'i386' ],
505             },
506           }],
507         ],
508       }],
509       ['(OS=="linux" or OS=="android") and \
510         (v8_target_arch=="x64" or v8_target_arch=="arm64")', {
511         'target_conditions': [
512           ['_toolset=="host"', {
513             'conditions': [
514               ['host_cxx_is_biarch==1', {
515                 'cflags': [ '-m64' ],
516                 'ldflags': [ '-m64' ]
517               }],
518              ],
519            }],
520            ['_toolset=="target"', {
521              'conditions': [
522                ['target_cxx_is_biarch==1', {
523                  'cflags': [ '-m64' ],
524                  'ldflags': [ '-m64' ],
525                }],
526              ]
527            }],
528          ],
529       }],
530       ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
531          or OS=="netbsd" or OS=="qnx"', {
532         'conditions': [
533           [ 'v8_no_strict_aliasing==1', {
534             'cflags': [ '-fno-strict-aliasing' ],
535           }],
536         ],  # conditions
537       }],
538       ['OS=="solaris"', {
539         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
540       }],
541       ['OS=="freebsd" or OS=="openbsd"', {
542         'cflags': [ '-I/usr/local/include' ],
543       }],
544       ['OS=="netbsd"', {
545         'cflags': [ '-I/usr/pkg/include' ],
546       }],
547     ],  # conditions
548     'configurations': {
549       # Abstract configuration for v8_optimized_debug == 0.
550       'DebugBase0': {
551         'abstract': 1,
552         'msvs_settings': {
553           'VCCLCompilerTool': {
554             'Optimization': '0',
555             'conditions': [
556               ['component=="shared_library"', {
557                 'RuntimeLibrary': '3',  # /MDd
558               }, {
559                 'RuntimeLibrary': '1',  # /MTd
560               }],
561             ],
562           },
563           'VCLinkerTool': {
564             'LinkIncremental': '2',
565           },
566         },
567         'conditions': [
568           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
569             OS=="qnx"', {
570             'cflags!': [
571               '-O0',
572               '-O3',
573               '-O2',
574               '-O1',
575               '-Os',
576             ],
577             'cflags': [
578               '-fdata-sections',
579               '-ffunction-sections',
580             ],
581           }],
582           ['OS=="mac"', {
583             'xcode_settings': {
584                'GCC_OPTIMIZATION_LEVEL': '0',  # -O0
585             },
586           }],
587         ],
588       },  # DebugBase0
589       # Abstract configuration for v8_optimized_debug == 1.
590       'DebugBase1': {
591         'abstract': 1,
592         'msvs_settings': {
593           'VCCLCompilerTool': {
594             'Optimization': '1',
595             'InlineFunctionExpansion': '2',
596             'EnableIntrinsicFunctions': 'true',
597             'FavorSizeOrSpeed': '0',
598             'StringPooling': 'true',
599             'BasicRuntimeChecks': '0',
600             'conditions': [
601               ['component=="shared_library"', {
602                 'RuntimeLibrary': '3',  # /MDd
603               }, {
604                 'RuntimeLibrary': '1',  # /MTd
605               }],
606             ],
607           },
608           'VCLinkerTool': {
609             'LinkIncremental': '2',
610           },
611         },
612         'conditions': [
613           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
614             OS=="qnx"', {
615             'cflags!': [
616               '-O0',
617               '-O3', # TODO(2807) should be -O1.
618               '-O2',
619               '-Os',
620             ],
621             'cflags': [
622               '-fdata-sections',
623               '-ffunction-sections',
624               '-O1', # TODO(2807) should be -O3.
625             ],
626             'conditions': [
627               ['gcc_version==44 and clang==0', {
628                 'cflags': [
629                   # Avoid crashes with gcc 4.4 in the v8 test suite.
630                   '-fno-tree-vrp',
631                 ],
632               }],
633             ],
634           }],
635           ['OS=="mac"', {
636             'xcode_settings': {
637                'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
638                'GCC_STRICT_ALIASING': 'YES',
639             },
640           }],
641         ],
642       },  # DebugBase1
643       # Abstract configuration for v8_optimized_debug == 2.
644       'DebugBase2': {
645         'abstract': 1,
646         'msvs_settings': {
647           'VCCLCompilerTool': {
648             'Optimization': '2',
649             'InlineFunctionExpansion': '2',
650             'EnableIntrinsicFunctions': 'true',
651             'FavorSizeOrSpeed': '0',
652             'StringPooling': 'true',
653             'BasicRuntimeChecks': '0',
654             'conditions': [
655               ['component=="shared_library"', {
656                 'RuntimeLibrary': '3',  #/MDd
657               }, {
658                 'RuntimeLibrary': '1',  #/MTd
659               }],
660               ['v8_target_arch=="x64"', {
661                 # TODO(2207): remove this option once the bug is fixed.
662                 'WholeProgramOptimization': 'true',
663               }],
664             ],
665           },
666           'VCLinkerTool': {
667             'LinkIncremental': '1',
668             'OptimizeReferences': '2',
669             'EnableCOMDATFolding': '2',
670           },
671         },
672         'conditions': [
673           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
674             OS=="qnx"', {
675             'cflags!': [
676               '-O0',
677               '-O1',
678               '-Os',
679             ],
680             'cflags': [
681               '-fdata-sections',
682               '-ffunction-sections',
683             ],
684             'defines': [
685               'OPTIMIZED_DEBUG'
686             ],
687             'conditions': [
688               # TODO(crbug.com/272548): Avoid -O3 in NaCl
689               ['nacl_target_arch=="none"', {
690                 'cflags': ['-O3'],
691                 'cflags!': ['-O2'],
692                 }, {
693                 'cflags': ['-O2'],
694                 'cflags!': ['-O3'],
695               }],
696               ['gcc_version==44 and clang==0', {
697                 'cflags': [
698                   # Avoid crashes with gcc 4.4 in the v8 test suite.
699                   '-fno-tree-vrp',
700                 ],
701               }],
702             ],
703           }],
704           ['OS=="mac"', {
705             'xcode_settings': {
706               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
707               'GCC_STRICT_ALIASING': 'YES',
708             },
709           }],
710         ],
711       },  # DebugBase2
712       # Common settings for the Debug configuration.
713       'DebugBaseCommon': {
714         'abstract': 1,
715         'defines': [
716           'ENABLE_DISASSEMBLER',
717           'V8_ENABLE_CHECKS',
718           'OBJECT_PRINT',
719           'VERIFY_HEAP',
720           'DEBUG'
721         ],
722         'conditions': [
723           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
724             OS=="qnx"', {
725             'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
726           }],
727           ['OS=="linux" and v8_enable_backtrace==1', {
728             # Support for backtrace_symbols.
729             'ldflags': [ '-rdynamic' ],
730           }],
731           ['OS=="android"', {
732             'variables': {
733               'android_full_debug%': 1,
734             },
735             'conditions': [
736               ['android_full_debug==0', {
737                 # Disable full debug if we want a faster v8 in a debug build.
738                 # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
739                 'defines!': [
740                   'DEBUG',
741                 ],
742               }],
743             ],
744           }],
745         ],
746       },  # DebugBaseCommon
747       'Debug': {
748         'inherit_from': ['DebugBaseCommon'],
749         'conditions': [
750           ['v8_optimized_debug==0', {
751             'inherit_from': ['DebugBase0'],
752           }],
753           ['v8_optimized_debug==1', {
754             'inherit_from': ['DebugBase1'],
755           }],
756           ['v8_optimized_debug==2', {
757             'inherit_from': ['DebugBase2'],
758           }],
759         ],
760       },  # Debug
761       'Release': {
762         'conditions': [
763           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
764             'cflags!': [
765               '-Os',
766             ],
767             'cflags': [
768               '-fdata-sections',
769               '-ffunction-sections',
770               '<(wno_array_bounds)',
771             ],
772             'conditions': [
773               [ 'gcc_version==44 and clang==0', {
774                 'cflags': [
775                   # Avoid crashes with gcc 4.4 in the v8 test suite.
776                   '-fno-tree-vrp',
777                 ],
778               }],
779               # TODO(crbug.com/272548): Avoid -O3 in NaCl
780               ['nacl_target_arch=="none"', {
781                 'cflags': ['-O3'],
782                 'cflags!': ['-O2'],
783               }, {
784                 'cflags': ['-O2'],
785                 'cflags!': ['-O3'],
786               }],
787             ],
788           }],
789           ['OS=="android"', {
790             'cflags!': [
791               '-O3',
792               '-Os',
793             ],
794             'cflags': [
795               '-fdata-sections',
796               '-ffunction-sections',
797               '-O2',
798             ],
799             'conditions': [
800               [ 'gcc_version==44 and clang==0', {
801                 'cflags': [
802                   # Avoid crashes with gcc 4.4 in the v8 test suite.
803                   '-fno-tree-vrp',
804                 ],
805               }],
806             ],
807           }],
808           ['OS=="mac"', {
809             'xcode_settings': {
810               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
811
812               # -fstrict-aliasing.  Mainline gcc
813               # enables this at -O2 and above,
814               # but Apple gcc does not unless it
815               # is specified explicitly.
816               'GCC_STRICT_ALIASING': 'YES',
817             },
818           }],  # OS=="mac"
819           ['OS=="win"', {
820             'msvs_settings': {
821               'VCCLCompilerTool': {
822                 'Optimization': '2',
823                 'InlineFunctionExpansion': '2',
824                 'EnableIntrinsicFunctions': 'true',
825                 'FavorSizeOrSpeed': '0',
826                 'StringPooling': 'true',
827                 'conditions': [
828                   ['component=="shared_library"', {
829                     'RuntimeLibrary': '2',  #/MD
830                   }, {
831                     'RuntimeLibrary': '0',  #/MT
832                   }],
833                   ['v8_target_arch=="x64"', {
834                     # TODO(2207): remove this option once the bug is fixed.
835                     'WholeProgramOptimization': 'true',
836                   }],
837                 ],
838               },
839               'VCLinkerTool': {
840                 'LinkIncremental': '1',
841                 'OptimizeReferences': '2',
842                 'EnableCOMDATFolding': '2',
843               },
844             },
845           }],  # OS=="win"
846         ],  # conditions
847       },  # Release
848     },  # configurations
849   },  # target_defaults
850 }