Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2845)

Unified Diff: build/common.gypi

Issue 10411047: Type profiler by intercepting 'new' and 'delete' expressions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reflected the comments #17-#19. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/common.gypi
diff --git a/build/common.gypi b/build/common.gypi
index 3f64fa96e10e8cb83e6fac866efed49dcd81935c..e7b8271c0d11c5a63800da4939114966080a3535 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -253,6 +253,13 @@
# See http://clang.llvm.org/docs/ThreadSanitizer.html
'tsan%': 0,
+ # Use a modified version of Clang to intercept allocated types and sizes
+ # for allocated objects. -fintercept-allocated-type only works with the
+ # modified clang, but clang_use_allocated_type=1 implies clang=1
Alexander Potapenko 2012/08/08 11:27:14 Nit: period at the end of the line.
Dai Mikurube (NOT FULLTIME) 2012/08/09 10:23:54 Done.
+ # TODO(dmikurube): Add a link to a description page.
+ # TODO(dmikurube): Support mac with another AllocatedTypeMap store.
+ 'clang_use_allocated_type%': 0,
+
# Set to true to instrument the code with function call logger.
# See src/third_party/cygprofile/cyg-profile.cc for details.
'order_profiling%': 0,
@@ -588,6 +595,7 @@
'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
'asan%': '<(asan)',
'tsan%': '<(tsan)',
+ 'clang_use_allocated_type%': '<(clang_use_allocated_type)',
'order_profiling%': '<(order_profiling)',
'order_text_section%': '<(order_text_section)',
'enable_extensions%': '<(enable_extensions)',
@@ -1188,6 +1196,12 @@
'clang%': 1,
}],
+ ['clang_use_allocated_type==1', {
+ 'clang%': 1,
+ 'clang_use_chrome_plugins%': 0,
+ 'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_x64',
+ }],
+
# On valgrind bots, override the optimizer settings so we don't inline too
# much and make the stacks harder to figure out.
#
@@ -1593,6 +1607,31 @@
}],
], # conditions for 'target_defaults'
'target_conditions': [
+ ['_type=="executable" or _type=="loadable_module"', {
+ 'target_conditions': [
+ # Some binaries doesn't use tcmalloc. We use empty interceptors
+ # for these binaries since the allocated type mapping is recorded
+ # in a tcmalloc-dependent data structure.
+ ['_target_name=="mksnapshot" or _target_name=="protoc" or _target_name=="ppGoogleNaClPluginChrome"', {
+ # Ignore allocated types.
+ 'conditions': [
+ ['clang_use_allocated_type==1', {
+ 'dependencies': [
+ '<!(realpath <(DEPTH)/base/allocator/allocator.gyp)' + ':allocated_type_ignore#target',
+ ]},
+ ],
+ ]}, {
+ # Store allocated types in TCMalloc's allocated_type_map (extended).
+ 'conditions': [
+ ['clang_use_allocated_type==1', {
+ 'dependencies': [
+ '<!(realpath <(DEPTH)/base/allocator/allocator.gyp)' + ':allocated_type_tcmalloc#target',
+ ]},
+ ],
+ ]},
+ ]
+ ]},
+ ],
['enable_wexit_time_destructors==1', {
'conditions': [
[ 'clang==1', {
@@ -2339,6 +2378,22 @@
'-fcolor-diagnostics',
],
}],
+ ['clang_use_allocated_type==1', {
+ 'cflags_cc!': ['-fno-rtti'],
+ 'cflags_cc+': ['-gline-tables-only'],
+ 'target_conditions': [
+ ['_target_name!="allocator" and _target_name!="allocator_extension_thunks" and _target_name!="libcmt" and _target_name!="allocator_extension_thunks_win64" and _target_name!="allocated_type_log" and _target_name!="allocated_type_ignore" and _target_name!="allocated_type_tcmalloc"', {
+ 'cflags_cc+': [
+ '-frtti',
+ '-fintercept-allocation-functions',
+ '-I../../base/allocator',
+ '-include',
+ 'allocated_type.h',
+ ],
+ }],
+ ],
+ 'defines': ['USE_ALLOCATED_TYPE'],
+ }],
['asan==1', {
'target_conditions': [
['_toolset=="target"', {

Powered by Google App Engine
This is Rietveld 408576698