1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
8 # This code gets run a lot and debugged rarely, so it should be fast
9 # by default. See http://crbug.com/388949.
10 'debug_optimize': '2',
11 'win_debug_Optimization': '0',
12 # Run time checks are incompatible with any level of optimizations.
13 'win_debug_RuntimeChecks': '0',
17 'tcmalloc_dir': '../../third_party/tcmalloc/chromium',
18 'use_vtable_verify%': 0,
21 # Only executables and not libraries should depend on the
22 # allocator target; only the application (the final executable)
23 # knows what allocator makes sense.
25 'target_name': 'allocator',
26 'type': 'static_library',
27 # Make sure the allocation library is optimized to
28 # the hilt in official builds.
32 'direct_dependent_settings': {
37 'IgnoreDefaultLibraryNames': ['libcmtd.lib', 'libcmt.lib'],
38 'AdditionalDependencies': [
39 '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib'
48 'PERFTOOLS_DLL_DECL=',
54 '../third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
57 # TODO(sgk): merge this with build/common.gypi settings
59 'AdditionalOptions': ['/ignore:4006,4221'],
62 'AdditionalOptions': ['/ignore:4006'],
69 'RuntimeLibrary': '0',
73 # Provide a way to force disable debugallocation in Debug builds,
74 # e.g. for profiling (it's more rare to profile Debug builds,
75 # but people sometimes need to do that).
76 'disable_debugallocation%': 0,
79 ['disable_debugallocation==0', {
81 # Use debugallocation for Debug builds to catch problems early
82 # and cleanly, http://crbug.com/30715 .
83 'TCMALLOC_FOR_DEBUGALLOCATION',
90 ['use_allocator=="tcmalloc"', {
91 # Disable the heap checker in tcmalloc.
97 '<(tcmalloc_dir)/src/base',
98 '<(tcmalloc_dir)/src',
102 # Generated for our configuration from tcmalloc's build
104 '<(tcmalloc_dir)/src/config.h',
105 '<(tcmalloc_dir)/src/config_android.h',
106 '<(tcmalloc_dir)/src/config_linux.h',
107 '<(tcmalloc_dir)/src/config_win.h',
109 # all tcmalloc native and forked files
110 '<(tcmalloc_dir)/src/addressmap-inl.h',
111 '<(tcmalloc_dir)/src/base/abort.cc',
112 '<(tcmalloc_dir)/src/base/abort.h',
113 '<(tcmalloc_dir)/src/base/arm_instruction_set_select.h',
114 '<(tcmalloc_dir)/src/base/atomicops-internals-linuxppc.h',
115 '<(tcmalloc_dir)/src/base/atomicops-internals-arm-generic.h',
116 '<(tcmalloc_dir)/src/base/atomicops-internals-arm-v6plus.h',
117 '<(tcmalloc_dir)/src/base/atomicops-internals-macosx.h',
118 '<(tcmalloc_dir)/src/base/atomicops-internals-windows.h',
119 '<(tcmalloc_dir)/src/base/atomicops-internals-x86.cc',
120 '<(tcmalloc_dir)/src/base/atomicops-internals-x86.h',
121 '<(tcmalloc_dir)/src/base/atomicops.h',
122 '<(tcmalloc_dir)/src/base/basictypes.h',
123 '<(tcmalloc_dir)/src/base/commandlineflags.h',
124 '<(tcmalloc_dir)/src/base/cycleclock.h',
125 # We don't list dynamic_annotations.c since its copy is already
126 # present in the dynamic_annotations target.
127 '<(tcmalloc_dir)/src/base/dynamic_annotations.h',
128 '<(tcmalloc_dir)/src/base/elf_mem_image.cc',
129 '<(tcmalloc_dir)/src/base/elf_mem_image.h',
130 '<(tcmalloc_dir)/src/base/elfcore.h',
131 '<(tcmalloc_dir)/src/base/googleinit.h',
132 '<(tcmalloc_dir)/src/base/linux_syscall_support.h',
133 '<(tcmalloc_dir)/src/base/linuxthreads.cc',
134 '<(tcmalloc_dir)/src/base/linuxthreads.h',
135 '<(tcmalloc_dir)/src/base/logging.cc',
136 '<(tcmalloc_dir)/src/base/logging.h',
137 '<(tcmalloc_dir)/src/base/low_level_alloc.cc',
138 '<(tcmalloc_dir)/src/base/low_level_alloc.h',
139 '<(tcmalloc_dir)/src/base/simple_mutex.h',
140 '<(tcmalloc_dir)/src/base/spinlock.cc',
141 '<(tcmalloc_dir)/src/base/spinlock.h',
142 '<(tcmalloc_dir)/src/base/spinlock_internal.cc',
143 '<(tcmalloc_dir)/src/base/spinlock_internal.h',
144 '<(tcmalloc_dir)/src/base/spinlock_linux-inl.h',
145 '<(tcmalloc_dir)/src/base/spinlock_posix-inl.h',
146 '<(tcmalloc_dir)/src/base/spinlock_win32-inl.h',
147 '<(tcmalloc_dir)/src/base/stl_allocator.h',
148 '<(tcmalloc_dir)/src/base/synchronization_profiling.h',
149 '<(tcmalloc_dir)/src/base/sysinfo.cc',
150 '<(tcmalloc_dir)/src/base/sysinfo.h',
151 '<(tcmalloc_dir)/src/base/thread_annotations.h',
152 '<(tcmalloc_dir)/src/base/thread_lister.c',
153 '<(tcmalloc_dir)/src/base/thread_lister.h',
154 '<(tcmalloc_dir)/src/base/vdso_support.cc',
155 '<(tcmalloc_dir)/src/base/vdso_support.h',
156 '<(tcmalloc_dir)/src/central_freelist.cc',
157 '<(tcmalloc_dir)/src/central_freelist.h',
158 '<(tcmalloc_dir)/src/common.cc',
159 '<(tcmalloc_dir)/src/common.h',
160 '<(tcmalloc_dir)/src/debugallocation.cc',
161 '<(tcmalloc_dir)/src/deep-heap-profile.cc',
162 '<(tcmalloc_dir)/src/deep-heap-profile.h',
163 '<(tcmalloc_dir)/src/free_list.cc',
164 '<(tcmalloc_dir)/src/free_list.h',
165 '<(tcmalloc_dir)/src/getpc.h',
166 '<(tcmalloc_dir)/src/gperftools/heap-checker.h',
167 '<(tcmalloc_dir)/src/gperftools/heap-profiler.h',
168 '<(tcmalloc_dir)/src/gperftools/malloc_extension.h',
169 '<(tcmalloc_dir)/src/gperftools/malloc_extension_c.h',
170 '<(tcmalloc_dir)/src/gperftools/malloc_hook.h',
171 '<(tcmalloc_dir)/src/gperftools/malloc_hook_c.h',
172 '<(tcmalloc_dir)/src/gperftools/profiler.h',
173 '<(tcmalloc_dir)/src/gperftools/stacktrace.h',
174 '<(tcmalloc_dir)/src/gperftools/tcmalloc.h',
175 '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
176 '<(tcmalloc_dir)/src/heap-checker.cc',
177 '<(tcmalloc_dir)/src/heap-profile-table.cc',
178 '<(tcmalloc_dir)/src/heap-profile-table.h',
179 '<(tcmalloc_dir)/src/heap-profiler.cc',
180 '<(tcmalloc_dir)/src/internal_logging.cc',
181 '<(tcmalloc_dir)/src/internal_logging.h',
182 '<(tcmalloc_dir)/src/libc_override.h',
183 '<(tcmalloc_dir)/src/libc_override_gcc_and_weak.h',
184 '<(tcmalloc_dir)/src/libc_override_glibc.h',
185 '<(tcmalloc_dir)/src/libc_override_osx.h',
186 '<(tcmalloc_dir)/src/libc_override_redefine.h',
187 '<(tcmalloc_dir)/src/linked_list.h',
188 '<(tcmalloc_dir)/src/malloc_extension.cc',
189 '<(tcmalloc_dir)/src/malloc_hook-inl.h',
190 '<(tcmalloc_dir)/src/malloc_hook.cc',
191 '<(tcmalloc_dir)/src/malloc_hook_mmap_freebsd.h',
192 '<(tcmalloc_dir)/src/malloc_hook_mmap_linux.h',
193 '<(tcmalloc_dir)/src/maybe_threads.cc',
194 '<(tcmalloc_dir)/src/maybe_threads.h',
195 '<(tcmalloc_dir)/src/memfs_malloc.cc',
196 '<(tcmalloc_dir)/src/memory_region_map.cc',
197 '<(tcmalloc_dir)/src/memory_region_map.h',
198 '<(tcmalloc_dir)/src/packed-cache-inl.h',
199 '<(tcmalloc_dir)/src/page_heap.cc',
200 '<(tcmalloc_dir)/src/page_heap.h',
201 '<(tcmalloc_dir)/src/page_heap_allocator.h',
202 '<(tcmalloc_dir)/src/pagemap.h',
203 '<(tcmalloc_dir)/src/profile-handler.cc',
204 '<(tcmalloc_dir)/src/profile-handler.h',
205 '<(tcmalloc_dir)/src/profiledata.cc',
206 '<(tcmalloc_dir)/src/profiledata.h',
207 '<(tcmalloc_dir)/src/profiler.cc',
208 '<(tcmalloc_dir)/src/raw_printer.cc',
209 '<(tcmalloc_dir)/src/raw_printer.h',
210 '<(tcmalloc_dir)/src/sampler.cc',
211 '<(tcmalloc_dir)/src/sampler.h',
212 '<(tcmalloc_dir)/src/span.cc',
213 '<(tcmalloc_dir)/src/span.h',
214 '<(tcmalloc_dir)/src/stack_trace_table.cc',
215 '<(tcmalloc_dir)/src/stack_trace_table.h',
216 '<(tcmalloc_dir)/src/stacktrace.cc',
217 '<(tcmalloc_dir)/src/stacktrace_arm-inl.h',
218 '<(tcmalloc_dir)/src/stacktrace_config.h',
219 '<(tcmalloc_dir)/src/stacktrace_generic-inl.h',
220 '<(tcmalloc_dir)/src/stacktrace_libunwind-inl.h',
221 '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h',
222 '<(tcmalloc_dir)/src/stacktrace_win32-inl.h',
223 '<(tcmalloc_dir)/src/stacktrace_with_context.cc',
224 '<(tcmalloc_dir)/src/stacktrace_x86-inl.h',
225 '<(tcmalloc_dir)/src/static_vars.cc',
226 '<(tcmalloc_dir)/src/static_vars.h',
227 '<(tcmalloc_dir)/src/symbolize.cc',
228 '<(tcmalloc_dir)/src/symbolize.h',
229 '<(tcmalloc_dir)/src/system-alloc.cc',
230 '<(tcmalloc_dir)/src/system-alloc.h',
231 '<(tcmalloc_dir)/src/tcmalloc.cc',
232 '<(tcmalloc_dir)/src/tcmalloc_guard.h',
233 '<(tcmalloc_dir)/src/thread_cache.cc',
234 '<(tcmalloc_dir)/src/thread_cache.h',
236 'debugallocation_shim.cc',
238 # sources! means that these are not compiled directly.
240 # We simply don't use these, but list them above so that IDE
241 # users can view the full available source for reference, etc.
242 '<(tcmalloc_dir)/src/addressmap-inl.h',
243 '<(tcmalloc_dir)/src/base/atomicops-internals-linuxppc.h',
244 '<(tcmalloc_dir)/src/base/atomicops-internals-macosx.h',
245 '<(tcmalloc_dir)/src/base/atomicops-internals-x86-msvc.h',
246 '<(tcmalloc_dir)/src/base/atomicops-internals-x86.h',
247 '<(tcmalloc_dir)/src/base/atomicops.h',
248 '<(tcmalloc_dir)/src/base/basictypes.h',
249 '<(tcmalloc_dir)/src/base/commandlineflags.h',
250 '<(tcmalloc_dir)/src/base/cycleclock.h',
251 '<(tcmalloc_dir)/src/base/elf_mem_image.h',
252 '<(tcmalloc_dir)/src/base/elfcore.h',
253 '<(tcmalloc_dir)/src/base/googleinit.h',
254 '<(tcmalloc_dir)/src/base/linux_syscall_support.h',
255 '<(tcmalloc_dir)/src/base/simple_mutex.h',
256 '<(tcmalloc_dir)/src/base/spinlock_linux-inl.h',
257 '<(tcmalloc_dir)/src/base/spinlock_posix-inl.h',
258 '<(tcmalloc_dir)/src/base/spinlock_win32-inl.h',
259 '<(tcmalloc_dir)/src/base/stl_allocator.h',
260 '<(tcmalloc_dir)/src/base/thread_annotations.h',
261 '<(tcmalloc_dir)/src/getpc.h',
262 '<(tcmalloc_dir)/src/gperftools/heap-checker.h',
263 '<(tcmalloc_dir)/src/gperftools/heap-profiler.h',
264 '<(tcmalloc_dir)/src/gperftools/malloc_extension.h',
265 '<(tcmalloc_dir)/src/gperftools/malloc_extension_c.h',
266 '<(tcmalloc_dir)/src/gperftools/malloc_hook.h',
267 '<(tcmalloc_dir)/src/gperftools/malloc_hook_c.h',
268 '<(tcmalloc_dir)/src/gperftools/profiler.h',
269 '<(tcmalloc_dir)/src/gperftools/stacktrace.h',
270 '<(tcmalloc_dir)/src/gperftools/tcmalloc.h',
271 '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
272 '<(tcmalloc_dir)/src/heap-checker.cc',
273 '<(tcmalloc_dir)/src/libc_override.h',
274 '<(tcmalloc_dir)/src/libc_override_gcc_and_weak.h',
275 '<(tcmalloc_dir)/src/libc_override_glibc.h',
276 '<(tcmalloc_dir)/src/libc_override_osx.h',
277 '<(tcmalloc_dir)/src/libc_override_redefine.h',
278 '<(tcmalloc_dir)/src/malloc_hook_mmap_freebsd.h',
279 '<(tcmalloc_dir)/src/malloc_hook_mmap_linux.h',
280 '<(tcmalloc_dir)/src/memfs_malloc.cc',
281 '<(tcmalloc_dir)/src/packed-cache-inl.h',
282 '<(tcmalloc_dir)/src/page_heap_allocator.h',
283 '<(tcmalloc_dir)/src/pagemap.h',
284 '<(tcmalloc_dir)/src/stacktrace_arm-inl.h',
285 '<(tcmalloc_dir)/src/stacktrace_config.h',
286 '<(tcmalloc_dir)/src/stacktrace_generic-inl.h',
287 '<(tcmalloc_dir)/src/stacktrace_libunwind-inl.h',
288 '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h',
289 '<(tcmalloc_dir)/src/stacktrace_win32-inl.h',
290 '<(tcmalloc_dir)/src/stacktrace_with_context.cc',
291 '<(tcmalloc_dir)/src/stacktrace_x86-inl.h',
292 '<(tcmalloc_dir)/src/tcmalloc_guard.h',
294 # Included by debugallocation_shim.cc.
295 '<(tcmalloc_dir)/src/debugallocation.cc',
296 '<(tcmalloc_dir)/src/tcmalloc.cc',
304 ['OS=="linux" and clang_type_profiler==1', {
306 'type_profiler_tcmalloc',
308 # It is undoing dependencies and cflags_cc for type_profiler which
309 # build/common.gypi injects into all targets.
314 '-fintercept-allocation-functions',
322 'allocator_shim_win.cc',
323 'generic_allocators.cc',
325 # sources! means that these are not compiled directly.
327 # Included by allocator_shim_win.cc for maximal inlining.
328 'generic_allocators.cc',
334 '<(tcmalloc_dir)/src/base/thread_lister.c',
335 '<(tcmalloc_dir)/src/base/thread_lister.h',
336 '<(tcmalloc_dir)/src/profiledata.cc',
337 '<(tcmalloc_dir)/src/profiledata.h',
338 '<(tcmalloc_dir)/src/profile-handler.cc',
339 '<(tcmalloc_dir)/src/profile-handler.h',
340 '<(tcmalloc_dir)/src/profiler.cc',
343 ['OS=="linux" or OS=="freebsd" or OS=="solaris" or OS=="android"', {
345 '<(tcmalloc_dir)/src/system-alloc.h',
347 # We enable all warnings by default, but upstream disables a few.
348 # Keep "-Wno-*" flags in sync with upstream by comparing against:
349 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.am
352 '-Wno-unused-result',
355 '-fvisibility=hidden',
359 # Don't let linker rip this symbol out, otherwise the heap&cpu
360 # profilers will not initialize properly on startup.
361 '-Wl,-uIsHeapProfilerRunning,-uProfilerStart',
362 # Do the same for heap leak checker.
363 '-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_MMapPKvS0_jiiix,-u_Z22InitialMallocHook_SbrkPKvi',
364 '-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_MMapPKvS0_miiil,-u_Z22InitialMallocHook_SbrkPKvl',
365 '-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakChecker14UnIgnoreObjectEPKv',
368 [ 'use_vtable_verify==1', {
370 '-fvtable-verify=preinit',
373 ['order_profiling != 0', {
374 'target_conditions' : [
375 ['_toolset=="target"', {
376 'cflags!': [ '-finstrument-functions' ],
383 # This library is linked in to src/base.gypi:base and allocator_unittests
384 # It can't depend on either and nothing else should depend on it - all
385 # other code should use the interfaced provided by base.
386 'target_name': 'allocator_extension_thunks',
387 'type': 'static_library',
389 'allocator_extension_thunks.cc',
390 'allocator_extension_thunks.h',
392 'toolsets': ['host', 'target'],
397 ['OS=="linux" and clang_type_profiler==1', {
398 # It is undoing dependencies and cflags_cc for type_profiler which
399 # build/common.gypi injects into all targets.
404 '-fintercept-allocation-functions',
414 'target_name': 'libcmt',
418 'action_name': 'libcmt',
423 '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib',
428 '$(VCInstallDir)lib',
429 '<(SHARED_INTERMEDIATE_DIR)/allocator',
436 'target_name': 'allocator_unittests',
437 'type': 'executable',
440 'allocator_extension_thunks',
441 '../../testing/gtest.gyp:gtest',
448 'allocator_unittest.cc',
449 '../profiler/alternate_timer.cc',
450 '../profiler/alternate_timer.h',
455 ['OS=="win" and target_arch=="ia32"', {
458 'target_name': 'allocator_extension_thunks_win64',
459 'type': 'static_library',
461 'allocator_extension_thunks.cc',
462 'allocator_extension_thunks.h',
464 'toolsets': ['host', 'target'],
470 'msvs_target_platform': 'x64',
476 ['OS=="linux" and clang_type_profiler==1', {
477 # Some targets in this section undo dependencies and cflags_cc for
478 # type_profiler which build/common.gypi injects into all targets.
481 'target_name': 'type_profiler',
482 'type': 'static_library',
487 '-fintercept-allocation-functions',
495 'type_profiler_control.h',
497 'toolsets': ['host', 'target'],
500 'target_name': 'type_profiler_tcmalloc',
501 'type': 'static_library',
506 '-fintercept-allocation-functions',
509 '<(tcmalloc_dir)/src',
513 'type_profiler_tcmalloc.cc',
514 'type_profiler_tcmalloc.h',
515 '<(tcmalloc_dir)/src/gperftools/type_profiler_map.h',
516 '<(tcmalloc_dir)/src/type_profiler_map.cc',
520 'target_name': 'type_profiler_unittests',
521 'type': 'executable',
523 '../../testing/gtest.gyp:gtest',
526 'type_profiler_tcmalloc',
532 'type_profiler_control.cc',
533 'type_profiler_control.h',
534 'type_profiler_unittest.cc',
538 'target_name': 'type_profiler_map_unittests',
539 'type': 'executable',
541 '../../testing/gtest.gyp:gtest',
549 '-fintercept-allocation-functions',
552 '<(tcmalloc_dir)/src',
556 'type_profiler_map_unittest.cc',
557 '<(tcmalloc_dir)/src/gperftools/type_profiler_map.h',
558 '<(tcmalloc_dir)/src/type_profiler_map.cc',
563 ['use_allocator=="tcmalloc"', {
566 'target_name': 'tcmalloc_unittest',
567 'type': 'executable',
569 'tcmalloc_unittest.cc',
572 '<(tcmalloc_dir)/src',
576 '../../testing/gtest.gyp:gtest',