WebKit Bugzilla
Attachment 370151 Details for
Bug 197998
: Add extra information to dumpJITMemory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197998-20190517232810.patch (text/plain), 7.01 KB, created by
Tadeu Zagallo
on 2019-05-17 14:28:11 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tadeu Zagallo
Created:
2019-05-17 14:28:11 PDT
Size:
7.01 KB
patch
obsolete
>Subversion Revision: 245317 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 312863185dc8be5ea8d89570fd5919333e6c814d..aa063e4558f693651e30a3ce7f332811941c634f 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,19 @@ >+2019-05-17 Tadeu Zagallo <tzagallo@apple.com> >+ >+ Add extra information to dumpJITMemory >+ https://bugs.webkit.org/show_bug.cgi?id=197998 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add ktrace events around the memory dump and mach_absolute_time to link the >+ events with the entries in the dump. Additionally, add a background queue >+ to flush on a configurable interval, since the atexit callback does not work >+ in every situation. >+ >+ * jit/ExecutableAllocator.cpp: >+ (JSC::dumpJITMemory): >+ * runtime/Options.h: >+ > 2019-05-14 Keith Miller <keith_miller@apple.com> > > Fix issue with byteOffset on ARM64E >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 6bc60aa7e4bf74aa275461c4ac185caa4d982601..287422512745a6dc1088c4ff6bdc55f6eb21c74c 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,14 @@ >+2019-05-17 Tadeu Zagallo <tzagallo@apple.com> >+ >+ Add extra information to dumpJITMemory >+ https://bugs.webkit.org/show_bug.cgi?id=197998 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a new trace point code for JSC::dumpJITMemory >+ >+ * wtf/SystemTracing.h: >+ > 2019-05-14 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r245281. >diff --git a/Source/JavaScriptCore/jit/ExecutableAllocator.cpp b/Source/JavaScriptCore/jit/ExecutableAllocator.cpp >index 7230cb7eef8c9f53cbb1a91248cbcc8ce06706eb..77796370c2c1e4109d1d1485c2587bdaf718be53 100644 >--- a/Source/JavaScriptCore/jit/ExecutableAllocator.cpp >+++ b/Source/JavaScriptCore/jit/ExecutableAllocator.cpp >@@ -33,8 +33,11 @@ > #include "JSCInlines.h" > #include <wtf/MetaAllocator.h> > #include <wtf/PageReservation.h> >+#include <wtf/SystemTracing.h> >+#include <wtf/WorkQueue.h> > > #if OS(DARWIN) >+#include <mach/mach_time.h> > #include <sys/mman.h> > #endif > >@@ -559,37 +562,60 @@ void dumpJITMemory(const void* dst, const void* src, size_t size) > static uint8_t* buffer; > static constexpr size_t bufferSize = fixedExecutableMemoryPoolSize; > static size_t offset = 0; >+ static Lock dumpJITMemoryLock; >+ static bool needsToFlush = false; > static auto flush = [] { >+ ASSERT(dumpJITMemoryLock.isLocked()); > if (fd == -1) { > fd = open(Options::dumpJITMemoryPath(), O_CREAT | O_TRUNC | O_APPEND | O_WRONLY | O_EXLOCK | O_NONBLOCK, 0666); > RELEASE_ASSERT(fd != -1); > } > write(fd, buffer, offset); > offset = 0; >+ needsToFlush = false; > }; > >- static Lock dumpJITMemoryLock; > static std::once_flag once; >+ static LazyNeverDestroyed<Ref<WorkQueue>> flushQueue; > std::call_once(once, [] { > buffer = bitwise_cast<uint8_t*>(malloc(bufferSize)); >+ flushQueue.construct(WorkQueue::create("jsc.dumpJITMemory.queue", WorkQueue::Type::Serial, WorkQueue::QOS::Background)); > std::atexit([] { > LockHolder locker(dumpJITMemoryLock); > flush(); > close(fd); >+ fd = -1; > }); > }); > >+ static auto enqueueFlush = []() { >+ if (needsToFlush) >+ return; >+ >+ needsToFlush = true; >+ flushQueue.get()->dispatchAfter(Seconds(Options::dumpJITMemoryFlushInterval()), [] { >+ LockHolder locker(dumpJITMemoryLock); >+ if (!needsToFlush) >+ return; >+ flush(); >+ }); >+ }; >+ > static auto write = [](const void* src, size_t size) { > if (UNLIKELY(offset + size > bufferSize)) > flush(); > memcpy(buffer + offset, src, size); > offset += size; >+ enqueueFlush(); > }; > > LockHolder locker(dumpJITMemoryLock); >+ uint64_t time = mach_absolute_time(); > uint64_t dst64 = bitwise_cast<uintptr_t>(dst); >- write(&dst64, sizeof(dst64)); > uint64_t size64 = size; >+ TraceScope(DumpJITMemoryStart, DumpJITMemoryStop, time, dst64, size64); >+ write(&time, sizeof(time)); >+ write(&dst64, sizeof(dst64)); > write(&size64, sizeof(size64)); > write(src, size); > #else >diff --git a/Source/JavaScriptCore/runtime/Options.h b/Source/JavaScriptCore/runtime/Options.h >index 6bc150021a3a5003e8bb14a482ce1930562fc5d8..76a6a2d2cce84669503d04bc41c57b62fff21784 100644 >--- a/Source/JavaScriptCore/runtime/Options.h >+++ b/Source/JavaScriptCore/runtime/Options.h >@@ -518,6 +518,7 @@ constexpr bool enableWebAssemblyStreamingApi = false; > v(bool, validateAbstractInterpreterState, false, Restricted, nullptr) \ > v(double, validateAbstractInterpreterStateProbability, 0.5, Normal, nullptr) \ > v(optionString, dumpJITMemoryPath, nullptr, Restricted, nullptr) \ >+ v(double, dumpJITMemoryFlushInterval, 10, Restricted, nullptr) \ > > > enum OptionEquivalence { >diff --git a/Source/WTF/wtf/SystemTracing.h b/Source/WTF/wtf/SystemTracing.h >index bcce0f9c77d157104d84f63e42cd50cbb2d7836c..75fdea986b8e92bd9821cab03d8f0fce56feb828 100644 >--- a/Source/WTF/wtf/SystemTracing.h >+++ b/Source/WTF/wtf/SystemTracing.h >@@ -47,6 +47,8 @@ enum TracePointCode { > WebAssemblyCompileEnd, > WebAssemblyExecuteStart, > WebAssemblyExecuteEnd, >+ DumpJITMemoryStart, >+ DumpJITMemoryStop, > > WebCoreRange = 5000, > MainResourceLoadDidStartProvisional, >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 40a60b502837efb3b0b6ea60ebf362d4c5cf61d9..0482bff9ed04be7c5b7cbfa76926387b82d8d68e 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,14 @@ >+2019-05-17 Tadeu Zagallo <tzagallo@apple.com> >+ >+ Add extra information to dumpJITMemory >+ https://bugs.webkit.org/show_bug.cgi?id=197998 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add description for the new dumpJITMemory trace point code. >+ >+ * Tracing/SystemTracePoints.plist: >+ > 2019-05-14 Andy Estes <aestes@apple.com> > > [Apple Pay] Payment APIs should be completely disabled in web views into which clients have injected user scripts >diff --git a/Tools/Tracing/SystemTracePoints.plist b/Tools/Tracing/SystemTracePoints.plist >index c140e91dd0f82d8be1e8e3e6af1da55fcd156304..ad281569215a0d8ad1892d223ae00e046788f5ea 100644 >--- a/Tools/Tracing/SystemTracePoints.plist >+++ b/Tools/Tracing/SystemTracePoints.plist >@@ -43,6 +43,18 @@ > <key>CodeEnd</key> > <string>2506</string> > </dict> >+ <dict> >+ <key>Name</key> >+ <string>Dump JIT Memory</string> >+ <key>Type</key> >+ <string>Interval</string> >+ <key>Component</key> >+ <string>47</string> >+ <key>CodeBegin</key> >+ <string>2507</string> >+ <key>CodeEnd</key> >+ <string>2508</string> >+ </dict> > <dict> > <key>Name</key> > <string>Main Resource Load</string>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197998
:
370142
|
370151
|
370188