Title: [149114] trunk/Source/_javascript_Core
Revision
149114
Author
[email protected]
Date
2013-04-25 09:18:43 -0700 (Thu, 25 Apr 2013)

Log Message

REGRESSION(r137994): Random crashes occur with SH4 JSC.
https://bugs.webkit.org/show_bug.cgi?id=115167.

Patch by Julien Brianceau <[email protected]> on 2013-04-25
Reviewed by Oliver Hunt.

Since r137994, uncommited pages could be inside the area of memory in
parameter of the cacheFlush function. That's why we have to flush each
page separately to avoid a fail of the whole flush, if an uncommited page
is in the area.

This patch is very similar to changeset 145194 made for ARMv7 architecture,
see https://bugs.webkit.org/show_bug.cgi?id=111441 for further information.

* assembler/SH4Assembler.h:
(JSC::SH4Assembler::cacheFlush):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (149113 => 149114)


--- trunk/Source/_javascript_Core/ChangeLog	2013-04-25 15:55:12 UTC (rev 149113)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-04-25 16:18:43 UTC (rev 149114)
@@ -1,3 +1,21 @@
+2013-04-25  Julien Brianceau  <[email protected]>
+
+        REGRESSION(r137994): Random crashes occur with SH4 JSC.
+        https://bugs.webkit.org/show_bug.cgi?id=115167.
+
+        Reviewed by Oliver Hunt.
+
+        Since r137994, uncommited pages could be inside the area of memory in
+        parameter of the cacheFlush function. That's why we have to flush each
+        page separately to avoid a fail of the whole flush, if an uncommited page
+        is in the area.
+
+        This patch is very similar to changeset 145194 made for ARMv7 architecture,
+        see https://bugs.webkit.org/show_bug.cgi?id=111441 for further information.
+
+        * assembler/SH4Assembler.h:
+        (JSC::SH4Assembler::cacheFlush):
+
 2013-04-24  Mark Lam  <[email protected]>
 
         Add watchdog timer polling for the DFG.

Modified: trunk/Source/_javascript_Core/assembler/SH4Assembler.h (149113 => 149114)


--- trunk/Source/_javascript_Core/assembler/SH4Assembler.h	2013-04-25 15:55:12 UTC (rev 149113)
+++ trunk/Source/_javascript_Core/assembler/SH4Assembler.h	2013-04-25 16:18:43 UTC (rev 149114)
@@ -1583,13 +1583,21 @@
 
     static void cacheFlush(void* code, size_t size)
     {
-#if !OS(LINUX)
-#error "The cacheFlush support is missing on this platform."
-#elif defined CACHEFLUSH_D_L2
-        syscall(__NR_cacheflush, reinterpret_cast<unsigned>(code), size, CACHEFLUSH_D_WB | CACHEFLUSH_I | CACHEFLUSH_D_L2);
+#if OS(LINUX)
+        // Flush each page separately, otherwise the whole flush will fail if an uncommited page is in the area.
+        unsigned currentPage = reinterpret_cast<unsigned>(code) & ~(pageSize() - 1);
+        unsigned lastPage = (reinterpret_cast<unsigned>(code) + size) & ~(pageSize() - 1);
+        do {
+#if defined CACHEFLUSH_D_L2
+            syscall(__NR_cacheflush, currentPage, pageSize(), CACHEFLUSH_D_WB | CACHEFLUSH_I | CACHEFLUSH_D_L2);
 #else
-        syscall(__NR_cacheflush, reinterpret_cast<unsigned>(code), size, CACHEFLUSH_D_WB | CACHEFLUSH_I);
+            syscall(__NR_cacheflush, currentPage, pageSize(), CACHEFLUSH_D_WB | CACHEFLUSH_I);
 #endif
+            currentPage += pageSize();
+        } while (lastPage >= currentPage);
+#else
+#error "The cacheFlush support is missing on this platform."
+#endif
     }
 
     void prefix(uint16_t pre)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to