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

Unified Diff: third_party/tcmalloc/chromium/src/getpc.h

Issue 14321006: Adds TCMalloc support for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Always use phtread_once Created 7 years, 7 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: third_party/tcmalloc/chromium/src/getpc.h
diff --git a/third_party/tcmalloc/chromium/src/getpc.h b/third_party/tcmalloc/chromium/src/getpc.h
index 9fb2e162beb22621406918ec017f2dd3bc2ea073..c5183bf0adba86f8d5ecb13a30e81de032905839 100644
--- a/third_party/tcmalloc/chromium/src/getpc.h
+++ b/third_party/tcmalloc/chromium/src/getpc.h
@@ -62,6 +62,8 @@
#elif defined(HAVE_CYGWIN_SIGNAL_H)
#include <cygwin/signal.h>
typedef ucontext ucontext_t;
+#elif defined(__ANDROID__)
+#include <unwind.h>
#endif
@@ -109,7 +111,8 @@ struct CallUnrollInfo {
// then, is to do the magic call-unrolling for systems that support it.
// -- Special case 1: linux x86, for which we have CallUnrollInfo
-#if defined(__linux) && defined(__i386) && defined(__GNUC__)
+#if defined(__linux) && defined(__i386) && defined(__GNUC__) && \
+ !defined(__ANDROID__)
static const CallUnrollInfo callunrollinfo[] = {
// Entry to a function: push %ebp; mov %esp,%ebp
// Top-of-stack contains the caller IP.
@@ -171,7 +174,16 @@ inline void* GetPC(const struct ucontext_t& signal_ucontext) {
RAW_LOG(ERROR, "GetPC is not yet implemented on Windows\n");
return NULL;
}
+#elif defined(__ANDROID__)
+typedef struct _Unwind_Context ucontext_t;
+inline void* GetPC(const ucontext_t& signal_ucontext) {
+ // Bionic doesn't export ucontext, see
+ // https://code.google.com/p/android/issues/detail?id=34784.
+ return reinterpret_cast<void*>(_Unwind_GetIP(
+ const_cast<ucontext_t*>(&signal_ucontext)));
+}
+//
// Normal cases. If this doesn't compile, it's probably because
// PC_FROM_UCONTEXT is the empty string. You need to figure out
// the right value for your system, and add it to the list in
« no previous file with comments | « third_party/tcmalloc/chromium/src/config_android.h ('k') | third_party/tcmalloc/chromium/src/libc_override_gcc_and_weak.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698