Index: src/platform-linux.cc |
diff --git a/src/platform-linux.cc b/src/platform-linux.cc |
index f7d8609b978bc01076e4e8d14d177addc66fe0bc..b42c3ef91333a530ca24df4fcbfd7801bdb10c22 100644 |
--- a/src/platform-linux.cc |
+++ b/src/platform-linux.cc |
@@ -397,6 +397,30 @@ void OS::LogSharedLibraryAddresses() { |
} |
+static const char kGCFakeMmap[] = "/tmp/__v8_gc__"; |
+ |
+ |
+void OS::SignalCodeMovingGC() { |
+#ifdef ENABLE_LOGGING_AND_PROFILING |
+ // Support for ll_prof.py. |
+ // |
+ // The Linux profiler built into the kernel logs all mmap's with |
+ // PROT_EXEC so that analysis tools can properly attribute ticks. We |
+ // do a mmap with a name known by ll_prof.py and immediately munmap |
+ // it. This injects a GC marker into the stream of events generated |
+ // by the kernel and allows us to synchronize V8 code log and the |
+ // kernel log. |
+ int size = sysconf(_SC_PAGESIZE); |
+ FILE* f = fopen(kGCFakeMmap, "w+"); |
+ void* addr = mmap(NULL, size, PROT_READ | PROT_EXEC, MAP_PRIVATE, |
+ fileno(f), 0); |
+ ASSERT(addr != MAP_FAILED); |
+ munmap(addr, size); |
+ fclose(f); |
+#endif |
+} |
+ |
+ |
int OS::StackWalk(Vector<OS::StackFrame> frames) { |
// backtrace is a glibc extension. |
#ifdef __GLIBC__ |