Title: [231343] trunk
Revision
231343
Author
[email protected]
Date
2018-05-03 18:11:47 -0700 (Thu, 03 May 2018)

Log Message

OSR entry pruning of Program Bytecodes doesn't take into account try/catch
https://bugs.webkit.org/show_bug.cgi?id=185281

Reviewed by Saam Barati.

JSTests:

New regression test.

* stress/baseline-osrentry-catch-is-reachable.js: Added.
(i.j.catch):

Source/_javascript_Core:

When we compute bytecode block reachability, we need to take into account blocks
containing try/catch.

* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (231342 => 231343)


--- trunk/JSTests/ChangeLog	2018-05-04 01:00:18 UTC (rev 231342)
+++ trunk/JSTests/ChangeLog	2018-05-04 01:11:47 UTC (rev 231343)
@@ -1,3 +1,15 @@
+2018-05-03  Michael Saboff  <[email protected]>
+
+        OSR entry pruning of Program Bytecodes doesn't take into account try/catch
+        https://bugs.webkit.org/show_bug.cgi?id=185281
+
+        Reviewed by Saam Barati.
+
+        New regression test.
+
+        * stress/baseline-osrentry-catch-is-reachable.js: Added.
+        (i.j.catch):
+
 2018-05-03  Ryan Haddad  <[email protected]>
 
         Unreviewed, rolling out r231197.

Added: trunk/JSTests/stress/baseline-osrentry-catch-is-reachable.js (0 => 231343)


--- trunk/JSTests/stress/baseline-osrentry-catch-is-reachable.js	                        (rev 0)
+++ trunk/JSTests/stress/baseline-osrentry-catch-is-reachable.js	2018-05-04 01:11:47 UTC (rev 231343)
@@ -0,0 +1,17 @@
+// Regression test for bug 185281. This should terminate without throwing.
+
+// These values are added to increase bytecode count.
+let foo = {};
+foo.x = null;
+foo.y = null;
+let z = null;
+let z2 = {};
+
+for (var i = 0; i <= 10; i++) {
+    for (var j = 0; j <= 100; j++) {
+        try {
+            xxx;
+            for (;;) {}
+        } catch (e) {}
+    }
+}

Modified: trunk/Source/_javascript_Core/ChangeLog (231342 => 231343)


--- trunk/Source/_javascript_Core/ChangeLog	2018-05-04 01:00:18 UTC (rev 231342)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-05-04 01:11:47 UTC (rev 231343)
@@ -1,3 +1,16 @@
+2018-05-03  Michael Saboff  <[email protected]>
+
+        OSR entry pruning of Program Bytecodes doesn't take into account try/catch
+        https://bugs.webkit.org/show_bug.cgi?id=185281
+
+        Reviewed by Saam Barati.
+
+        When we compute bytecode block reachability, we need to take into account blocks
+        containing try/catch.
+
+        * jit/JIT.cpp:
+        (JSC::JIT::privateCompileMainPass):
+
 2018-05-03  Dominik Infuehr  <[email protected]>
 
         ARM: Wrong offset for operand rt in disassembler

Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (231342 => 231343)


--- trunk/Source/_javascript_Core/jit/JIT.cpp	2018-05-04 01:00:18 UTC (rev 231342)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp	2018-05-04 01:11:47 UTC (rev 231343)
@@ -30,6 +30,7 @@
 #include "JIT.h"
 
 #include "BytecodeGraph.h"
+#include "BytecodeLivenessAnalysis.h"
 #include "CodeBlock.h"
 #include "CodeBlockWithJITType.h"
 #include "DFGCapabilities.h"
@@ -219,9 +220,22 @@
             GraphNodeWorklist<BytecodeBasicBlock*> worklist;
             startBytecodeOffset = UINT_MAX;
             worklist.push(block);
+
             while (BytecodeBasicBlock* block = worklist.pop()) {
                 startBytecodeOffset = std::min(startBytecodeOffset, block->leaderOffset());
                 worklist.pushAll(block->successors());
+
+                // Also add catch blocks for bytecodes that throw.
+                if (m_codeBlock->numberOfExceptionHandlers()) {
+                    for (unsigned bytecodeOffset = block->leaderOffset(); bytecodeOffset < block->leaderOffset() + block->totalLength();) {
+                        OpcodeID opcodeID = Interpreter::getOpcodeID(instructionsBegin[bytecodeOffset].u.opcode);
+                        if (auto* handler = m_codeBlock->handlerForBytecodeOffset(bytecodeOffset))
+                            worklist.push(graph.findBasicBlockWithLeaderOffset(handler->target));
+
+                        unsigned opcodeLength = opcodeLengths[opcodeID];
+                        bytecodeOffset += opcodeLength;
+                    }
+                }
             }
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to