Title: [185071] trunk/Source/WebCore
Revision
185071
Author
benja...@webkit.org
Date
2015-06-01 12:42:43 -0700 (Mon, 01 Jun 2015)

Log Message

[CSS JIT] Fail to compile when we are out of executable memory
https://bugs.webkit.org/show_bug.cgi?id=145483
rdar://problem/21166612

Patch by Benjamin Poulain <bpoul...@apple.com> on 2015-06-01
Reviewed by Andreas Kling.

We should use a soft failure when the Linker fails to allocate
executable memory for the CSS JIT. We will just fallback to slow
code when that happen, better slow CSS than crashing.

Credit to Chris for finding this problem.

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::compile):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (185070 => 185071)


--- trunk/Source/WebCore/ChangeLog	2015-06-01 19:31:34 UTC (rev 185070)
+++ trunk/Source/WebCore/ChangeLog	2015-06-01 19:42:43 UTC (rev 185071)
@@ -1,3 +1,20 @@
+2015-06-01  Benjamin Poulain  <bpoul...@apple.com>
+
+        [CSS JIT] Fail to compile when we are out of executable memory
+        https://bugs.webkit.org/show_bug.cgi?id=145483
+        rdar://problem/21166612
+
+        Reviewed by Andreas Kling.
+
+        We should use a soft failure when the Linker fails to allocate
+        executable memory for the CSS JIT. We will just fallback to slow
+        code when that happen, better slow CSS than crashing.
+
+        Credit to Chris for finding this problem.
+
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
+
 2015-06-01  Chris Dumez  <cdu...@apple.com>
 
         ASSERT(revalidatingResource.inCache()) in MemoryCache when reloading tumblr.com

Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (185070 => 185071)


--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp	2015-06-01 19:31:34 UTC (rev 185070)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp	2015-06-01 19:42:43 UTC (rev 185071)
@@ -1243,7 +1243,15 @@
         return SelectorCompilationStatus::CannotCompile;
     }
 
-    JSC::LinkBuffer linkBuffer(*vm, m_assembler, CSS_CODE_ID);
+    JSC::LinkBuffer linkBuffer(*vm, m_assembler, CSS_CODE_ID, JSC::JITCompilationCanFail);
+    if (!linkBuffer.isValid()) {
+        // This could be SelectorCompilationStatus::NotCompiled but that would cause us to re-enter
+        // the CSS JIT every time we evaluate that selector.
+        // If we failed to allocate the buffer, we have bigger problems than CSS performance, it is fine
+        // to be slower.
+        return SelectorCompilationStatus::CannotCompile;
+    }
+
     for (unsigned i = 0; i < m_functionCalls.size(); i++)
         linkBuffer.link(m_functionCalls[i].first, m_functionCalls[i].second);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to