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 'direct_dependent_settings': {
32 'IgnoreDefaultLibraryNames': ['libcmtd.lib', 'libcmt.lib'],
33 'AdditionalDependencies': [
34 '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib'
43 'PERFTOOLS_DLL_DECL=',
49 '../third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
52 # TODO(sgk): merge this with build/common.gypi settings
54 'AdditionalOptions': ['/ignore:4006,4221'],
57 'AdditionalOptions': ['/ignore:4006'],
64 'RuntimeLibrary': '0',
68 # Provide a way to force disable debugallocation in Debug builds,
69 # e.g. for profiling (it's more rare to profile Debug builds,
70 # but people sometimes need to do that).
71 'disable_debugallocation%': 0,
74 ['disable_debugallocation==0', {
76 # Use debugallocation for Debug builds to catch problems early
77 # and cleanly, http://crbug.com/30715 .
78 'TCMALLOC_FOR_DEBUGALLOCATION',
85 ['use_allocator=="tcmalloc"', {
86 # Disable the heap checker in tcmalloc.
92 '<(tcmalloc_dir)/src/base',
93 '<(tcmalloc_dir)/src',
97 # Generated for our configuration from tcmalloc's build
99 '<(tcmalloc_dir)/src/config.h',
100 '<(tcmalloc_dir)/src/config_android.h',
101 '<(tcmalloc_dir)/src/config_linux.h',
102 '<(tcmalloc_dir)/src/config_win.h',
104 # all tcmalloc native and forked files
105 '<(tcmalloc_dir)/src/addressmap-inl.h',
106 '<(tcmalloc_dir)/src/base/abort.cc',
107 '<(tcmalloc_dir)/src/base/abort.h',
108 '<(tcmalloc_dir)/src/base/arm_instruction_set_select.h',
109 '<(tcmalloc_dir)/src/base/atomicops-internals-arm-generic.h',
110 '<(tcmalloc_dir)/src/base/atomicops-internals-arm-v6plus.h',
111 '<(tcmalloc_dir)/src/base/atomicops-internals-linuxppc.h',
112 '<(tcmalloc_dir)/src/base/atomicops-internals-macosx.h',
113 '<(tcmalloc_dir)/src/base/atomicops-internals-windows.h',
114 '<(tcmalloc_dir)/src/base/atomicops-internals-x86.cc',
115 '<(tcmalloc_dir)/src/base/atomicops-internals-x86.h',
116 '<(tcmalloc_dir)/src/base/atomicops.h',
117 '<(tcmalloc_dir)/src/base/basictypes.h',
118 '<(tcmalloc_dir)/src/base/commandlineflags.h',
119 '<(tcmalloc_dir)/src/base/cycleclock.h',
120 # We don't list dynamic_annotations.c since its copy is already
121 # present in the dynamic_annotations target.
122 '<(tcmalloc_dir)/src/base/dynamic_annotations.h',
123 '<(tcmalloc_dir)/src/base/elf_mem_image.cc',
124 '<(tcmalloc_dir)/src/base/elf_mem_image.h',
125 '<(tcmalloc_dir)/src/base/elfcore.h',
126 '<(tcmalloc_dir)/src/base/googleinit.h',
127 '<(tcmalloc_dir)/src/base/linux_syscall_support.h',
128 '<(tcmalloc_dir)/src/base/linuxthreads.cc',
129 '<(tcmalloc_dir)/src/base/linuxthreads.h',
130 '<(tcmalloc_dir)/src/base/logging.cc',
131 '<(tcmalloc_dir)/src/base/logging.h',
132 '<(tcmalloc_dir)/src/base/low_level_alloc.cc',
133 '<(tcmalloc_dir)/src/base/low_level_alloc.h',
134 '<(tcmalloc_dir)/src/base/simple_mutex.h',
135 '<(tcmalloc_dir)/src/base/spinlock.cc',
136 '<(tcmalloc_dir)/src/base/spinlock.h',
137 '<(tcmalloc_dir)/src/base/spinlock_internal.cc',
138 '<(tcmalloc_dir)/src/base/spinlock_internal.h',
139 '<(tcmalloc_dir)/src/base/spinlock_linux-inl.h',
140 '<(tcmalloc_dir)/src/base/spinlock_posix-inl.h',
141 '<(tcmalloc_dir)/src/base/spinlock_win32-inl.h',
142 '<(tcmalloc_dir)/src/base/stl_allocator.h',
143 '<(tcmalloc_dir)/src/base/synchronization_profiling.h',
144 '<(tcmalloc_dir)/src/base/sysinfo.cc',
145 '<(tcmalloc_dir)/src/base/sysinfo.h',
146 '<(tcmalloc_dir)/src/base/thread_annotations.h',
147 '<(tcmalloc_dir)/src/base/thread_lister.c',
148 '<(tcmalloc_dir)/src/base/thread_lister.h',
149 '<(tcmalloc_dir)/src/base/vdso_support.cc',
150 '<(tcmalloc_dir)/src/base/vdso_support.h',
151 '<(tcmalloc_dir)/src/central_freelist.cc',
152 '<(tcmalloc_dir)/src/central_freelist.h',
153 '<(tcmalloc_dir)/src/common.cc',
154 '<(tcmalloc_dir)/src/common.h',
155 '<(tcmalloc_dir)/src/debugallocation.cc',
156 '<(tcmalloc_dir)/src/deep-heap-profile.cc',
157 '<(tcmalloc_dir)/src/deep-heap-profile.h',
158 '<(tcmalloc_dir)/src/free_list.cc',
159 '<(tcmalloc_dir)/src/free_list.h',
160 '<(tcmalloc_dir)/src/getpc.h',
161 '<(tcmalloc_dir)/src/gperftools/heap-checker.h',
162 '<(tcmalloc_dir)/src/gperftools/heap-profiler.h',
163 '<(tcmalloc_dir)/src/gperftools/malloc_extension.h',
164 '<(tcmalloc_dir)/src/gperftools/malloc_extension_c.h',
165 '<(tcmalloc_dir)/src/gperftools/malloc_hook.h',
166 '<(tcmalloc_dir)/src/gperftools/malloc_hook_c.h',
167 '<(tcmalloc_dir)/src/gperftools/profiler.h',
168 '<(tcmalloc_dir)/src/gperftools/stacktrace.h',
169 '<(tcmalloc_dir)/src/gperftools/tcmalloc.h',
170 '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
171 '<(tcmalloc_dir)/src/heap-checker.cc',
172 '<(tcmalloc_dir)/src/heap-profile-table.cc',
173 '<(tcmalloc_dir)/src/heap-profile-table.h',
174 '<(tcmalloc_dir)/src/heap-profiler.cc',
175 '<(tcmalloc_dir)/src/internal_logging.cc',
176 '<(tcmalloc_dir)/src/internal_logging.h',
177 '<(tcmalloc_dir)/src/libc_override.h',
178 '<(tcmalloc_dir)/src/libc_override_gcc_and_weak.h',
179 '<(tcmalloc_dir)/src/libc_override_glibc.h',
180 '<(tcmalloc_dir)/src/libc_override_osx.h',
181 '<(tcmalloc_dir)/src/libc_override_redefine.h',
182 '<(tcmalloc_dir)/src/linked_list.h',
183 '<(tcmalloc_dir)/src/malloc_extension.cc',
184 '<(tcmalloc_dir)/src/malloc_hook-inl.h',
185 '<(tcmalloc_dir)/src/malloc_hook.cc',
186 '<(tcmalloc_dir)/src/malloc_hook_mmap_freebsd.h',
187 '<(tcmalloc_dir)/src/malloc_hook_mmap_linux.h',
188 '<(tcmalloc_dir)/src/maybe_threads.cc',
189 '<(tcmalloc_dir)/src/maybe_threads.h',
190 '<(tcmalloc_dir)/src/memfs_malloc.cc',
191 '<(tcmalloc_dir)/src/memory_region_map.cc',
192 '<(tcmalloc_dir)/src/memory_region_map.h',
193 '<(tcmalloc_dir)/src/packed-cache-inl.h',
194 '<(tcmalloc_dir)/src/page_heap.cc',
195 '<(tcmalloc_dir)/src/page_heap.h',
196 '<(tcmalloc_dir)/src/page_heap_allocator.h',
197 '<(tcmalloc_dir)/src/pagemap.h',
198 '<(tcmalloc_dir)/src/profile-handler.cc',
199 '<(tcmalloc_dir)/src/profile-handler.h',
200 '<(tcmalloc_dir)/src/profiledata.cc',
201 '<(tcmalloc_dir)/src/profiledata.h',
202 '<(tcmalloc_dir)/src/profiler.cc',
203 '<(tcmalloc_dir)/src/raw_printer.cc',
204 '<(tcmalloc_dir)/src/raw_printer.h',
205 '<(tcmalloc_dir)/src/sampler.cc',
206 '<(tcmalloc_dir)/src/sampler.h',
207 '<(tcmalloc_dir)/src/span.cc',
208 '<(tcmalloc_dir)/src/span.h',
209 '<(tcmalloc_dir)/src/stack_trace_table.cc',
210 '<(tcmalloc_dir)/src/stack_trace_table.h',
211 '<(tcmalloc_dir)/src/stacktrace.cc',
212 '<(tcmalloc_dir)/src/stacktrace_arm-inl.h',
213 '<(tcmalloc_dir)/src/stacktrace_config.h',
214 '<(tcmalloc_dir)/src/stacktrace_generic-inl.h',
215 '<(tcmalloc_dir)/src/stacktrace_libunwind-inl.h',
216 '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h',
217 '<(tcmalloc_dir)/src/stacktrace_win32-inl.h',
218 '<(tcmalloc_dir)/src/stacktrace_with_context.cc',
219 '<(tcmalloc_dir)/src/stacktrace_x86-inl.h',
220 '<(tcmalloc_dir)/src/static_vars.cc',
221 '<(tcmalloc_dir)/src/static_vars.h',
222 '<(tcmalloc_dir)/src/symbolize.cc',
223 '<(tcmalloc_dir)/src/symbolize.h',
224 '<(tcmalloc_dir)/src/system-alloc.cc',
225 '<(tcmalloc_dir)/src/system-alloc.h',
226 '<(tcmalloc_dir)/src/tcmalloc.cc',
227 '<(tcmalloc_dir)/src/tcmalloc_guard.h',
228 '<(tcmalloc_dir)/src/thread_cache.cc',
229 '<(tcmalloc_dir)/src/thread_cache.h',
231 'debugallocation_shim.cc',
233 # sources! means that these are not compiled directly.
235 # We simply don't use these, but list them above so that IDE
236 # users can view the full available source for reference, etc.
237 '<(tcmalloc_dir)/src/addressmap-inl.h',
238 '<(tcmalloc_dir)/src/base/atomicops-internals-linuxppc.h',
239 '<(tcmalloc_dir)/src/base/atomicops-internals-macosx.h',
240 '<(tcmalloc_dir)/src/base/atomicops-internals-x86-msvc.h',
241 '<(tcmalloc_dir)/src/base/atomicops-internals-x86.h',
242 '<(tcmalloc_dir)/src/base/atomicops.h',
243 '<(tcmalloc_dir)/src/base/basictypes.h',
244 '<(tcmalloc_dir)/src/base/commandlineflags.h',
245 '<(tcmalloc_dir)/src/base/cycleclock.h',
246 '<(tcmalloc_dir)/src/base/elf_mem_image.h',
247 '<(tcmalloc_dir)/src/base/elfcore.h',
248 '<(tcmalloc_dir)/src/base/googleinit.h',
249 '<(tcmalloc_dir)/src/base/linux_syscall_support.h',
250 '<(tcmalloc_dir)/src/base/simple_mutex.h',
251 '<(tcmalloc_dir)/src/base/spinlock_linux-inl.h',
252 '<(tcmalloc_dir)/src/base/spinlock_posix-inl.h',
253 '<(tcmalloc_dir)/src/base/spinlock_win32-inl.h',
254 '<(tcmalloc_dir)/src/base/stl_allocator.h',
255 '<(tcmalloc_dir)/src/base/thread_annotations.h',
256 '<(tcmalloc_dir)/src/getpc.h',
257 '<(tcmalloc_dir)/src/gperftools/heap-checker.h',
258 '<(tcmalloc_dir)/src/gperftools/heap-profiler.h',
259 '<(tcmalloc_dir)/src/gperftools/malloc_extension.h',
260 '<(tcmalloc_dir)/src/gperftools/malloc_extension_c.h',
261 '<(tcmalloc_dir)/src/gperftools/malloc_hook.h',
262 '<(tcmalloc_dir)/src/gperftools/malloc_hook_c.h',
263 '<(tcmalloc_dir)/src/gperftools/profiler.h',
264 '<(tcmalloc_dir)/src/gperftools/stacktrace.h',
265 '<(tcmalloc_dir)/src/gperftools/tcmalloc.h',
266 '<(tcmalloc_dir)/src/heap-checker-bcad.cc',
267 '<(tcmalloc_dir)/src/heap-checker.cc',
268 '<(tcmalloc_dir)/src/libc_override.h',
269 '<(tcmalloc_dir)/src/libc_override_gcc_and_weak.h',
270 '<(tcmalloc_dir)/src/libc_override_glibc.h',
271 '<(tcmalloc_dir)/src/libc_override_osx.h',
272 '<(tcmalloc_dir)/src/libc_override_redefine.h',
273 '<(tcmalloc_dir)/src/malloc_hook_mmap_freebsd.h',
274 '<(tcmalloc_dir)/src/malloc_hook_mmap_linux.h',
275 '<(tcmalloc_dir)/src/memfs_malloc.cc',
276 '<(tcmalloc_dir)/src/packed-cache-inl.h',
277 '<(tcmalloc_dir)/src/page_heap_allocator.h',
278 '<(tcmalloc_dir)/src/pagemap.h',
279 '<(tcmalloc_dir)/src/stacktrace_arm-inl.h',
280 '<(tcmalloc_dir)/src/stacktrace_config.h',
281 '<(tcmalloc_dir)/src/stacktrace_generic-inl.h',
282 '<(tcmalloc_dir)/src/stacktrace_libunwind-inl.h',
283 '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h',
284 '<(tcmalloc_dir)/src/stacktrace_win32-inl.h',
285 '<(tcmalloc_dir)/src/stacktrace_with_context.cc',
286 '<(tcmalloc_dir)/src/stacktrace_x86-inl.h',
287 '<(tcmalloc_dir)/src/tcmalloc_guard.h',
289 # Included by debugallocation_shim.cc.
290 '<(tcmalloc_dir)/src/debugallocation.cc',
291 '<(tcmalloc_dir)/src/tcmalloc.cc',
299 ['OS=="linux" and clang_type_profiler==1', {
301 'type_profiler_tcmalloc',
303 # It is undoing dependencies and cflags_cc for type_profiler which
304 # build/common.gypi injects into all targets.
309 '-fintercept-allocation-functions',
317 'allocator_shim_win.cc',
323 '<(tcmalloc_dir)/src/base/thread_lister.c',
324 '<(tcmalloc_dir)/src/base/thread_lister.h',
325 '<(tcmalloc_dir)/src/profile-handler.cc',
326 '<(tcmalloc_dir)/src/profile-handler.h',
327 '<(tcmalloc_dir)/src/profiledata.cc',
328 '<(tcmalloc_dir)/src/profiledata.h',
329 '<(tcmalloc_dir)/src/profiler.cc',
332 ['OS=="linux" or OS=="freebsd" or OS=="solaris" or OS=="android"', {
334 '<(tcmalloc_dir)/src/system-alloc.h',
336 # We enable all warnings by default, but upstream disables a few.
337 # Keep "-Wno-*" flags in sync with upstream by comparing against:
338 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.am
341 '-Wno-unused-result',
344 '-fvisibility=hidden',
348 # Don't let linker rip this symbol out, otherwise the heap&cpu
349 # profilers will not initialize properly on startup.
350 '-Wl,-uIsHeapProfilerRunning,-uProfilerStart',
351 # Do the same for heap leak checker.
352 '-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_MMapPKvS0_jiiix,-u_Z22InitialMallocHook_SbrkPKvi',
353 '-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_MMapPKvS0_miiil,-u_Z22InitialMallocHook_SbrkPKvl',
354 '-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakChecker14UnIgnoreObjectEPKv',
357 [ 'use_vtable_verify==1', {
359 '-fvtable-verify=preinit',
362 ['order_profiling != 0', {
363 'target_conditions' : [
364 ['_toolset=="target"', {
365 'cflags!': [ '-finstrument-functions' ],
372 # This library is linked in to src/base.gypi:base and allocator_unittests
373 # It can't depend on either and nothing else should depend on it - all
374 # other code should use the interfaced provided by base.
375 'target_name': 'allocator_extension_thunks',
376 'type': 'static_library',
378 'allocator_extension_thunks.cc',
379 'allocator_extension_thunks.h',
381 'toolsets': ['host', 'target'],
386 ['OS=="linux" and clang_type_profiler==1', {
387 # It is undoing dependencies and cflags_cc for type_profiler which
388 # build/common.gypi injects into all targets.
393 '-fintercept-allocation-functions',
403 'target_name': 'libcmt',
407 'action_name': 'libcmt',
412 '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib',
417 '$(VCInstallDir)lib',
418 '<(SHARED_INTERMEDIATE_DIR)/allocator',
425 'target_name': 'allocator_unittests',
426 'type': 'executable',
429 'allocator_extension_thunks',
430 '../../testing/gtest.gyp:gtest',
437 '../profiler/alternate_timer.cc',
438 '../profiler/alternate_timer.h',
439 'allocator_unittest.cc',
444 ['OS=="win" and target_arch=="ia32"', {
447 'target_name': 'allocator_extension_thunks_win64',
448 'type': 'static_library',
450 'allocator_extension_thunks.cc',
451 'allocator_extension_thunks.h',
453 'toolsets': ['host', 'target'],
459 'msvs_target_platform': 'x64',
465 ['OS=="linux" and clang_type_profiler==1', {
466 # Some targets in this section undo dependencies and cflags_cc for
467 # type_profiler which build/common.gypi injects into all targets.
470 'target_name': 'type_profiler',
471 'type': 'static_library',
476 '-fintercept-allocation-functions',
484 'type_profiler_control.h',
486 'toolsets': ['host', 'target'],
489 'target_name': 'type_profiler_tcmalloc',
490 'type': 'static_library',
495 '-fintercept-allocation-functions',
498 '<(tcmalloc_dir)/src',
502 '<(tcmalloc_dir)/src/gperftools/type_profiler_map.h',
503 '<(tcmalloc_dir)/src/type_profiler_map.cc',
504 'type_profiler_tcmalloc.cc',
505 'type_profiler_tcmalloc.h',
509 'target_name': 'type_profiler_unittests',
510 'type': 'executable',
512 '../../testing/gtest.gyp:gtest',
515 'type_profiler_tcmalloc',
521 'type_profiler_control.cc',
522 'type_profiler_control.h',
523 'type_profiler_unittest.cc',
527 'target_name': 'type_profiler_map_unittests',
528 'type': 'executable',
530 '../../testing/gtest.gyp:gtest',
538 '-fintercept-allocation-functions',
541 '<(tcmalloc_dir)/src',
545 '<(tcmalloc_dir)/src/gperftools/type_profiler_map.h',
546 '<(tcmalloc_dir)/src/type_profiler_map.cc',
547 'type_profiler_map_unittest.cc',
552 ['use_allocator=="tcmalloc"', {
555 'target_name': 'tcmalloc_unittest',
556 'type': 'executable',
558 'tcmalloc_unittest.cc',
561 '<(tcmalloc_dir)/src',
565 '../../testing/gtest.gyp:gtest',