diff options
author | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 21:30:20 +0000 |
---|---|---|
committer | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 21:30:20 +0000 |
commit | 59c098679b18b4b8f731cf7041f4506616327663 (patch) | |
tree | ffca9b31063c8916cbcb148643b0db889659c3ae | |
parent | f1c225c9ecc8b8d682af60e27858835ef365337e (diff) | |
download | chromium_src-59c098679b18b4b8f731cf7041f4506616327663.zip chromium_src-59c098679b18b4b8f731cf7041f4506616327663.tar.gz chromium_src-59c098679b18b4b8f731cf7041f4506616327663.tar.bz2 |
Start pulling tcmalloc into the build. Not using it yet
with this checkin.
Review URL: http://codereview.chromium.org/79085
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14128 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | DEPS | 3 | ||||
-rw-r--r-- | third_party/tcmalloc/config.h | 267 | ||||
-rw-r--r-- | third_party/tcmalloc/prep_libc.sh | 37 | ||||
-rw-r--r-- | third_party/tcmalloc/tcmalloc.vcproj | 236 |
4 files changed, 543 insertions, 0 deletions
@@ -36,6 +36,9 @@ deps = { "src/third_party/WebKit/WebKitLibraries": Var("webkit_trunk") + "/WebKitLibraries@" + Var("webkit_revision"), + + "src/third_party/tcmalloc/tcmalloc": + "http://google-perftools.googlecode.com/svn/trunk@70", } diff --git a/third_party/tcmalloc/config.h b/third_party/tcmalloc/config.h new file mode 100644 index 0000000..9f4efa8 --- /dev/null +++ b/third_party/tcmalloc/config.h @@ -0,0 +1,267 @@ +/* A manual version of config.h fit for windows machines. */ + +/* Sometimes we accidentally #include this config.h instead of the one + in .. -- this is particularly true for msys/mingw, which uses the + unix config.h but also runs code in the windows directory. + */ +#ifdef __MINGW32__ +#include "../config.h" +#define GOOGLE_PERFTOOLS_WINDOWS_CONFIG_H_ +#endif + +#ifndef GOOGLE_PERFTOOLS_WINDOWS_CONFIG_H_ +#define GOOGLE_PERFTOOLS_WINDOWS_CONFIG_H_ + +/* define this if you are linking tcmalloc statically and overriding the + * default allocators. + * For instructions on how to use this mode, see + * http://groups.google.com/group/google-perftools/browse_thread/thread/41cd3710af85e57b + */ +#define WIN32_OVERRIDE_ALLOCATORS + +/* the location of <hash_map> */ +#define HASH_MAP_H <hash_map> + +/* the namespace of hash_map/hash_set */ +#define HASH_NAMESPACE stdext + +/* the location of <hash_set> */ +#define HASH_SET_H <hash_set> + +/* Define to 1 if your libc has a snprintf implementation */ +#define HAVE_SNPRINTF + +/* Define to 1 if compiler supports __builtin_stack_pointer */ +#undef HAVE_BUILTIN_STACK_POINTER + +/* Define to 1 if you have the <conflict-signal.h> header file. */ +#undef HAVE_CONFLICT_SIGNAL_H + +/* Define to 1 if you have the declaration of `cfree', and to 0 if you don't. + */ +#undef HAVE_DECL_CFREE + +/* Define to 1 if you have the declaration of `memalign', and to 0 if you + don't. */ +#undef HAVE_DECL_MEMALIGN + +/* Define to 1 if you have the declaration of `posix_memalign', and to 0 if + you don't. */ +#undef HAVE_DECL_POSIX_MEMALIGN + +/* Define to 1 if you have the declaration of `pvalloc', and to 0 if you + don't. */ +#undef HAVE_DECL_PVALLOC + +/* Define to 1 if you have the declaration of `uname', and to 0 if you don't. + */ +#undef HAVE_DECL_UNAME + +/* Define to 1 if you have the declaration of `valloc', and to 0 if you don't. + */ +#undef HAVE_DECL_VALLOC + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if the system has the type `Elf32_Versym'. */ +#undef HAVE_ELF32_VERSYM + +/* Define to 1 if you have the <execinfo.h> header file. */ +#undef HAVE_EXECINFO_H + +/* Define to 1 if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `geteuid' function. */ +#undef HAVE_GETEUID + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 /* we define it in windows/port.cc */ + +/* Define to 1 if you have the <glob.h> header file. */ +#undef HAVE_GLOB_H + +/* Define to 1 if you have the <grp.h> header file. */ +#undef HAVE_GRP_H + +/* define if the compiler has hash_map */ +#define HAVE_HASH_MAP 1 + +/* define if the compiler has hash_set */ +#define HAVE_HASH_SET 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <libunwind.h> header file. */ +#undef HAVE_LIBUNWIND_H + +/* Define to 1 if you have the <linux/ptrace.h> header file. */ +#undef HAVE_LINUX_PTRACE_H + +/* Define to 1 if you have the <malloc.h> header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* define if the compiler implements namespaces */ +#define HAVE_NAMESPACES 1 + +/* define if libc has program_invocation_name */ +#undef HAVE_PROGRAM_INVOCATION_NAME + +/* Define if you have POSIX threads libraries and header files. */ +#undef HAVE_PTHREAD + +/* Define to 1 if you have the <pwd.h> header file. */ +#undef HAVE_PWD_H + +/* Define to 1 if you have the `sbrk' function. */ +#undef HAVE_SBRK + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if the system has the type `struct mallinfo'. */ +#undef HAVE_STRUCT_MALLINFO + +/* Define to 1 if you have the <sys/prctl.h> header file. */ +#undef HAVE_SYS_PRCTL_H + +/* Define to 1 if you have the <sys/resource.h> header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/syscall.h> header file. */ +#undef HAVE_SYS_SYSCALL_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <sys/wait.h> header file. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if compiler supports __thread */ +#undef HAVE_TLS + +/* Define to 1 if you have the <ucontext.h> header file. */ +#undef HAVE_UCONTEXT_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the <unwind.h> header file. */ +#undef HAVE_UNWIND_H + +/* define if your compiler has __attribute__ */ +#undef HAVE___ATTRIBUTE__ + +/* Define to 1 if the system has the type `__int64'. */ +#define HAVE___INT64 1 + +/* prefix where we look for installed files */ +#undef INSTALL_PREFIX + +/* Define to 1 if int32_t is equivalent to intptr_t */ +#undef INT32_EQUALS_INTPTR + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* How to access the PC from a struct ucontext */ +#undef PC_FROM_UCONTEXT + +/* Always the empty-string on non-windows systems. On windows, should be + "__declspec(dllexport)". This way, when we compile the dll, we export our + functions/classes. It's safe to define this here because config.h is only + used internally, to compile the DLL, and every DLL source file #includes + "config.h" before anything else. */ +#ifndef PERFTOOLS_DLL_DECL +# define PERFTOOLS_IS_A_DLL 1 /* not set if you're statically linking */ +# define PERFTOOLS_DLL_DECL __declspec(dllexport) +# define PERFTOOLS_DLL_DECL_FOR_UNITTESTS __declspec(dllimport) +#endif + +/* printf format code for printing a size_t and ssize_t */ +#define PRIdS "Id" + +/* printf format code for printing a size_t and ssize_t */ +#define PRIuS "Iu" + +/* printf format code for printing a size_t and ssize_t */ +#define PRIxS "Ix" + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +#undef PTHREAD_CREATE_JOINABLE + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* the namespace where STL code like vector<> is defined */ +#define STL_NAMESPACE std + +/* Version number of package */ +#undef VERSION + +/* C99 says: define this to get the PRI... macros from stdint.h */ +#ifndef __STDC_FORMAT_MACROS +# define __STDC_FORMAT_MACROS 1 +#endif + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +// --------------------------------------------------------------------- +// Extra stuff not found in config.h.in + +// This must be defined before the windows.h is included. It's needed +// for mutex.h, to give access to the TryLock method. +#ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0400 +#endif + +// TODO(csilvers): include windows/port.h in every relevant source file instead? +#include "windows/port.h" + +#endif /* GOOGLE_PERFTOOLS_WINDOWS_CONFIG_H_ */ diff --git a/third_party/tcmalloc/prep_libc.sh b/third_party/tcmalloc/prep_libc.sh new file mode 100644 index 0000000..b3e1b82 --- /dev/null +++ b/third_party/tcmalloc/prep_libc.sh @@ -0,0 +1,37 @@ +#!/bin/sh -x +# This script takes libcmt.lib for VS2005 and removes the allocation related +# functions from it. +# +# Usage: prep_libcmt.bat <VCInstallDir> <OutputFile> +# +# VCInstallDir is the path where VC is installed, typically: +# C:\Program Files\Microsoft Visual Studio 8\VC\ +# +# OutputFile is the directory where the modified libcmt file should be stored. +# + +LIBCMT="${1}\\libcmt.lib" +LIBCMTPDB="${1}\\libcmt.pdb" +OUTDIR=$2 +OUTCMT="${2}\\libcmt.lib" + +mkdir $OUTDIR +cp "$LIBCMT" "$OUTDIR" +cp "$LIBCMTPDB" "$OUTDIR" +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\malloc.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\free.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\realloc.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\calloc.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\new.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\delete.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\new2.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\delete2.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\align.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\msize.obj $OUTCMT + +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\heapinit.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\expand.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\heapchk.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\heapwalk.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\heapmin.obj $OUTCMT +LIB /IGNORE:4006,4221 /REMOVE:build\\intel\\mt_obj\\sbheap.obj $OUTCMT diff --git a/third_party/tcmalloc/tcmalloc.vcproj b/third_party/tcmalloc/tcmalloc.vcproj new file mode 100644 index 0000000..f7ca19f --- /dev/null +++ b/third_party/tcmalloc/tcmalloc.vcproj @@ -0,0 +1,236 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="tcmalloc"
+ ProjectGUID="{C564F145-9172-42C3-BFCB-60FDEA124321}"
+ RootNamespace="tcmalloc"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\$(ProjectName)"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\..\build\debug.vsprops;..\..\build\external_code.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;tcmalloc\src\windows;tcmalloc\src\base;tcmalloc\src"
+ MinimalRebuild="false"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="0"
+ ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalOptions="/ignore:4221"
+ OutputFile="$(OutDir)\lib\$(ProjectName).lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="$(ProjectDir)..\..\third_party\cygwin\setup_env.bat && set INTDIR=$(IntDir) && set OUTDIR=$(OutDir) && bash -c "\"./prep_libc.sh\" \"$(VCInstallDir)lib\" \"`cygpath -m \"${INTDIR}\"`\"""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\..\build\release.vsprops;..\..\build\external_code.vsprops"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=".;tcmalloc\src\windows;tcmalloc\src\base;tcmalloc\src"
+ MinimalRebuild="false"
+ ProgramDataBaseFileName="$(IntDir)\$(ProjectName)\vc80.pdb"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalOptions="/ignore:4221"
+ OutputFile="$(OutDir)\lib\$(ProjectName).lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="$(ProjectDir)..\..\third_party\cygwin\setup_env.bat && set INTDIR=$(IntDir) && set OUTDIR=$(OutDir) && bash -c "\"./prep_libc.sh\" \"$(VCInstallDir)lib\" \"`cygpath -m \"${INTDIR}\"`\"""
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="tcmalloc"
+ >
+ <Filter
+ Name="src"
+ >
+ <File
+ RelativePath="tcmalloc\src\central_freelist.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\common.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\heap-profile-table.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\internal_logging.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\malloc_extension.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\malloc_hook.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\page_heap.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\sampler.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\span.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\stack_trace_table.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\stacktrace.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\static_vars.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\thread_cache.cc"
+ >
+ </File>
+ <Filter
+ Name="windows"
+ >
+ <File
+ RelativePath=".\tcmalloc\src\windows\override_functions.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\windows\port.cc"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="base"
+ >
+ <File
+ RelativePath="tcmalloc\src\base\dynamic_annotations.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\base\logging.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\base\low_level_alloc.cc"
+ >
+ </File>
+ <File
+ RelativePath="tcmalloc\src\base\sysinfo.cc"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
|