Title: [245511] trunk/Source/_javascript_Core
Revision
245511
Author
[email protected]
Date
2019-05-19 23:08:47 -0700 (Sun, 19 May 2019)

Log Message

Add support for %pid in dumpJITMemoryPath
https://bugs.webkit.org/show_bug.cgi?id=198026

Reviewed by Saam Barati.

This is necessary when using dumpJITMemory with Safari. Otherwise, multiple WebContent
processes will try to write to the same file at the same time, which will crash since
the file is open with exclusive locking.

* jit/ExecutableAllocator.cpp:
(JSC::dumpJITMemory):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (245510 => 245511)


--- trunk/Source/_javascript_Core/ChangeLog	2019-05-20 03:40:24 UTC (rev 245510)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-05-20 06:08:47 UTC (rev 245511)
@@ -1,3 +1,17 @@
+2019-05-19  Tadeu Zagallo  <[email protected]>
+
+        Add support for %pid in dumpJITMemoryPath
+        https://bugs.webkit.org/show_bug.cgi?id=198026
+
+        Reviewed by Saam Barati.
+
+        This is necessary when using dumpJITMemory with Safari. Otherwise, multiple WebContent
+        processes will try to write to the same file at the same time, which will crash since
+        the file is open with exclusive locking.
+
+        * jit/ExecutableAllocator.cpp:
+        (JSC::dumpJITMemory):
+
 2019-05-18  Tadeu Zagallo  <[email protected]>
 
         Add extra information to dumpJITMemory

Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp (245510 => 245511)


--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2019-05-20 03:40:24 UTC (rev 245510)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2019-05-20 06:08:47 UTC (rev 245511)
@@ -31,8 +31,10 @@
 #include "CodeProfiling.h"
 #include "ExecutableAllocationFuzz.h"
 #include "JSCInlines.h"
+#include <wtf/FileSystem.h>
 #include <wtf/MetaAllocator.h>
 #include <wtf/PageReservation.h>
+#include <wtf/ProcessID.h>
 #include <wtf/SystemTracing.h>
 #include <wtf/WorkQueue.h>
 
@@ -566,7 +568,9 @@
     static bool needsToFlush = false;
     static auto flush = [](const AbstractLocker&) {
         if (fd == -1) {
-            fd = open(Options::dumpJITMemoryPath(), O_CREAT | O_TRUNC | O_APPEND | O_WRONLY | O_EXLOCK | O_NONBLOCK, 0666);
+            String path = Options::dumpJITMemoryPath();
+            path = path.replace("%pid", String::number(getCurrentProcessID()));
+            fd = open(FileSystem::fileSystemRepresentation(path).data(), O_CREAT | O_TRUNC | O_APPEND | O_WRONLY | O_EXLOCK | O_NONBLOCK, 0666);
             RELEASE_ASSERT(fd != -1);
         }
         write(fd, buffer, offset);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to