<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[245586] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/245586">245586</a></dd>
<dt>Author</dt> <dd>keith_miller@apple.com</dd>
<dt>Date</dt> <dd>2019-05-21 10:57:11 -0700 (Tue, 21 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Cleanup Yarr regexp code around paren contexts.
https://bugs.webkit.org/show_bug.cgi?id=198063

Reviewed by Yusuke Suzuki.

JSTests:

* stress/regexp-many-named-sequential-capture-groups.js: Added.
(i.s):
* stress/regexp-many-unnamed-sequential-capture-groups.js: Added.

Source/JavaScriptCore:

There are three refactoring changes around paren contexts:
1. Make EncodedMatchResult the same type as MatchResult on X86_64 and arm64 and uint64_t elsewhere.
2. All function pointer types for Yarr JIT generated code reserve space for paren contexts.
3. initParenContextFreeList should bail based on VM::patternContextBufferSize as that's the buffer size anyway.

* runtime/MatchResult.h:
(JSC::MatchResult::MatchResult):
* runtime/RegExpInlines.h:
(JSC::PatternContextBufferHolder::PatternContextBufferHolder):
(JSC::PatternContextBufferHolder::~PatternContextBufferHolder):
(JSC::PatternContextBufferHolder::size):
(JSC::RegExp::matchInline):
* runtime/VM.h:
* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::initParenContextFreeList):
* yarr/YarrJIT.h:
(JSC::Yarr::YarrCodeBlock::execute):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeMatchResulth">trunk/Source/JavaScriptCore/runtime/MatchResult.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeRegExpInlinesh">trunk/Source/JavaScriptCore/runtime/RegExpInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMh">trunk/Source/JavaScriptCore/runtime/VM.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreyarrYarrJITcpp">trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreyarrYarrJITh">trunk/Source/JavaScriptCore/yarr/YarrJIT.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkJSTestsstressregexpmanynamedsequentialcapturegroupsjs">trunk/JSTests/stress/regexp-many-named-sequential-capture-groups.js</a></li>
<li><a href="#trunkJSTestsstressregexpmanyunnamedsequentialcapturegroupsjs">trunk/JSTests/stress/regexp-many-unnamed-sequential-capture-groups.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (245585 => 245586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog  2019-05-21 17:50:37 UTC (rev 245585)
+++ trunk/JSTests/ChangeLog     2019-05-21 17:57:11 UTC (rev 245586)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2019-05-20  Keith Miller  <keith_miller@apple.com>
+
+        Cleanup Yarr regexp code around paren contexts.
+        https://bugs.webkit.org/show_bug.cgi?id=198063
+
+        Reviewed by Yusuke Suzuki.
+
+        * stress/regexp-many-named-sequential-capture-groups.js: Added.
+        (i.s):
+        * stress/regexp-many-unnamed-sequential-capture-groups.js: Added.
+
</ins><span class="cx"> 2019-05-17  Justin Michaud  <justin_michaud@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [WASM-References] Add support for Anyref in parameters and return types, Ref.null and Ref.is_null for Anyref values.
</span></span></pre></div>
<a id="trunkJSTestsstressregexpmanynamedsequentialcapturegroupsjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/stress/regexp-many-named-sequential-capture-groups.js (0 => 245586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/stress/regexp-many-named-sequential-capture-groups.js                              (rev 0)
+++ trunk/JSTests/stress/regexp-many-named-sequential-capture-groups.js 2019-05-21 17:57:11 UTC (rev 245586)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+let s = '';
+for (let i = 0; i < 1000; i++) {
+    s += `(?<foo${i}>a){0,2}`;
+}
+
+let r = new RegExp(s);
+for (let i = 0; i < 1000; i++)
+    ''.match(r);
</ins></span></pre></div>
<a id="trunkJSTestsstressregexpmanyunnamedsequentialcapturegroupsjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/stress/regexp-many-unnamed-sequential-capture-groups.js (0 => 245586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/stress/regexp-many-unnamed-sequential-capture-groups.js                            (rev 0)
+++ trunk/JSTests/stress/regexp-many-unnamed-sequential-capture-groups.js       2019-05-21 17:57:11 UTC (rev 245586)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+let s = '';
+for (let i = 0; i < 1000; i++) {
+    s += '(?:a){0,2}';
+}
+
+let r = new RegExp(s);
+for (let i = 0; i < 1000; i++)
+    ''.match(r);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (245585 => 245586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2019-05-21 17:50:37 UTC (rev 245585)
+++ trunk/Source/JavaScriptCore/ChangeLog       2019-05-21 17:57:11 UTC (rev 245586)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2019-05-20  Keith Miller  <keith_miller@apple.com>
+
+        Cleanup Yarr regexp code around paren contexts.
+        https://bugs.webkit.org/show_bug.cgi?id=198063
+
+        Reviewed by Yusuke Suzuki.
+
+        There are three refactoring changes around paren contexts:
+        1. Make EncodedMatchResult the same type as MatchResult on X86_64 and arm64 and uint64_t elsewhere.
+        2. All function pointer types for Yarr JIT generated code reserve space for paren contexts.
+        3. initParenContextFreeList should bail based on VM::patternContextBufferSize as that's the buffer size anyway.
+
+        * runtime/MatchResult.h:
+        (JSC::MatchResult::MatchResult):
+        * runtime/RegExpInlines.h:
+        (JSC::PatternContextBufferHolder::PatternContextBufferHolder):
+        (JSC::PatternContextBufferHolder::~PatternContextBufferHolder):
+        (JSC::PatternContextBufferHolder::size):
+        (JSC::RegExp::matchInline):
+        * runtime/VM.h:
+        * yarr/YarrJIT.cpp:
+        (JSC::Yarr::YarrGenerator::initParenContextFreeList):
+        * yarr/YarrJIT.h:
+        (JSC::Yarr::YarrCodeBlock::execute):
+
</ins><span class="cx"> 2019-05-20  Tadeu Zagallo  <tzagallo@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Only cache bytecode for API clients in data vaults
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeMatchResulth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/MatchResult.h (245585 => 245586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/MatchResult.h        2019-05-21 17:50:37 UTC (rev 245585)
+++ trunk/Source/JavaScriptCore/runtime/MatchResult.h   2019-05-21 17:57:11 UTC (rev 245586)
</span><span class="lines">@@ -30,7 +30,12 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><del>-typedef uint64_t EncodedMatchResult;
</del><ins>+struct MatchResult;
+#if CPU(ARM64) || CPU(X86_64)
+using EncodedMatchResult = MatchResult;
+#else
+using EncodedMatchResult = uint64_t;
+#endif
</ins><span class="cx"> 
</span><span class="cx"> struct MatchResult {
</span><span class="cx">     MatchResult()
</span><span class="lines">@@ -45,19 +50,13 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    explicit ALWAYS_INLINE MatchResult(EncodedMatchResult encoded)
</del><ins>+#if !(CPU(ARM64) || CPU(X86_64))
+    ALWAYS_INLINE MatchResult(EncodedMatchResult match)
+        : start(bitwise_cast<MatchResult>(match).start)
+        , end(bitwise_cast<MatchResult>(match).end)
</ins><span class="cx">     {
</span><del>-        union u {
-            uint64_t encoded;
-            struct s {
-                size_t start;
-                size_t end;
-            } split;
-        } value;
-        value.encoded = encoded;
-        start = value.split.start;
-        end = value.split.end;
</del><span class="cx">     }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     ALWAYS_INLINE static MatchResult failed()
</span><span class="cx">     {
</span><span class="lines">@@ -80,4 +79,6 @@
</span><span class="cx">     size_t end;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+static_assert(sizeof(MatchResult) == sizeof(EncodedMatchResult), "Match result and EncodedMatchResult should be the same size");
+
</ins><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeRegExpInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/RegExpInlines.h (245585 => 245586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/RegExpInlines.h      2019-05-21 17:50:37 UTC (rev 245585)
+++ trunk/Source/JavaScriptCore/runtime/RegExpInlines.h 2019-05-21 17:57:11 UTC (rev 245586)
</span><span class="lines">@@ -86,38 +86,36 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
</del><span class="cx"> class PatternContextBufferHolder {
</span><ins>+    WTF_FORBID_HEAP_ALLOCATION;
</ins><span class="cx"> public:
</span><span class="cx">     PatternContextBufferHolder(VM& vm, bool needBuffer)
</span><span class="cx">         : m_vm(vm)
</span><del>-        , m_needBuffer(needBuffer)
</del><span class="cx">     {
</span><del>-        if (m_needBuffer) {
</del><ins>+#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
+        if (needBuffer)
</ins><span class="cx">             m_buffer = m_vm.acquireRegExpPatternContexBuffer();
</span><del>-            m_size = VM::patternContextBufferSize;
-        } else {
-            m_buffer = nullptr;
-            m_size = 0;
-        }
</del><ins>+#endif
+
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ~PatternContextBufferHolder()
</span><span class="cx">     {
</span><del>-        if (m_needBuffer)
</del><ins>+#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
+        if (buffer())
</ins><span class="cx">             m_vm.releaseRegExpPatternContexBuffer();
</span><ins>+#else
+        UNUSED_PARAM(m_vm);
+#endif
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void* buffer() { return m_buffer; }
</span><del>-    unsigned size() { return m_size; }
</del><ins>+    unsigned size() { return buffer() ? VM::patternContextBufferSize : 0; }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     VM& m_vm;
</span><del>-    bool m_needBuffer;
</del><span class="cx">     void* m_buffer;
</span><del>-    unsigned m_size;
</del><span class="cx"> };
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> ALWAYS_INLINE void RegExp::compileIfNecessary(VM& vm, Yarr::YarrCharSize charSize)
</span><span class="cx"> {
</span><span class="lines">@@ -158,20 +156,12 @@
</span><span class="cx">     if (m_state == JITCode) {
</span><span class="cx">         {
</span><span class="cx">             ASSERT(m_regExpJITCode);
</span><del>-#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
</del><span class="cx">             PatternContextBufferHolder patternContextBufferHolder(vm, m_regExpJITCode->usesPatternContextBuffer());
</span><span class="cx"> 
</span><del>-#define EXTRA_JIT_PARAMS  , patternContextBufferHolder.buffer(), patternContextBufferHolder.size()
-#else
-#define EXTRA_JIT_PARAMS
-#endif
-
</del><span class="cx">             if (s.is8Bit())
</span><del>-                result = m_regExpJITCode->execute(s.characters8(), startOffset, s.length(), offsetVector EXTRA_JIT_PARAMS).start;
</del><ins>+                result = m_regExpJITCode->execute(s.characters8(), startOffset, s.length(), offsetVector, patternContextBufferHolder.buffer(), patternContextBufferHolder.size()).start;
</ins><span class="cx">             else
</span><del>-                result = m_regExpJITCode->execute(s.characters16(), startOffset, s.length(), offsetVector EXTRA_JIT_PARAMS).start;
-
-#undef EXTRA_JIT_PARAMS
</del><ins>+                result = m_regExpJITCode->execute(s.characters16(), startOffset, s.length(), offsetVector, patternContextBufferHolder.buffer(), patternContextBufferHolder.size()).start;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (result == Yarr::JSRegExpJITCodeFailure) {
</span><span class="lines">@@ -284,20 +274,11 @@
</span><span class="cx">     if (m_state == JITCode) {
</span><span class="cx">         {
</span><span class="cx">             ASSERT(m_regExpJITCode);
</span><del>-#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
</del><span class="cx">             PatternContextBufferHolder patternContextBufferHolder(vm, m_regExpJITCode->usesPatternContextBuffer());
</span><del>-
-#define EXTRA_JIT_PARAMS  , patternContextBufferHolder.buffer(), patternContextBufferHolder.size()
-#else
-#define EXTRA_JIT_PARAMS
-#endif
-
</del><span class="cx">             if (s.is8Bit())
</span><del>-                result = m_regExpJITCode->execute(s.characters8(), startOffset, s.length() EXTRA_JIT_PARAMS);
</del><ins>+                result = m_regExpJITCode->execute(s.characters8(), startOffset, s.length(), patternContextBufferHolder.buffer(), patternContextBufferHolder.size());
</ins><span class="cx">             else
</span><del>-                result = m_regExpJITCode->execute(s.characters16(), startOffset, s.length() EXTRA_JIT_PARAMS);
-
-#undef EXTRA_JIT_PARAMS
</del><ins>+                result = m_regExpJITCode->execute(s.characters16(), startOffset, s.length(), patternContextBufferHolder.buffer(), patternContextBufferHolder.size());
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(REGEXP_TRACING)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.h (245585 => 245586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.h 2019-05-21 17:50:37 UTC (rev 245585)
+++ trunk/Source/JavaScriptCore/runtime/VM.h    2019-05-21 17:57:11 UTC (rev 245586)
</span><span class="lines">@@ -799,6 +799,8 @@
</span><span class="cx">     Lock m_regExpPatternContextLock;
</span><span class="cx">     char* acquireRegExpPatternContexBuffer();
</span><span class="cx">     void releaseRegExpPatternContexBuffer();
</span><ins>+#else
+    static constexpr size_t patternContextBufferSize = 0; // Space allocated to save nested parenthesis context
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     Ref<CompactVariableMap> m_compactVariableMap;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreyarrYarrJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp (245585 => 245586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp     2019-05-21 17:50:37 UTC (rev 245585)
+++ trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp        2019-05-21 17:57:11 UTC (rev 245586)
</span><span class="lines">@@ -229,7 +229,7 @@
</span><span class="cx">         parenContextSize = WTF::roundUpToMultipleOf<sizeof(uintptr_t)>(parenContextSize);
</span><span class="cx"> 
</span><span class="cx">         // Check that the paren context is a reasonable size.
</span><del>-        if (parenContextSize > INT16_MAX)
</del><ins>+        if (parenContextSize > VM::patternContextBufferSize)
</ins><span class="cx">             m_abortExecution.append(jump());
</span><span class="cx"> 
</span><span class="cx">         Jump emptyFreeList = branchTestPtr(Zero, freelistRegister);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreyarrYarrJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/yarr/YarrJIT.h (245585 => 245586)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/yarr/YarrJIT.h       2019-05-21 17:50:37 UTC (rev 245585)
+++ trunk/Source/JavaScriptCore/yarr/YarrJIT.h  2019-05-21 17:57:11 UTC (rev 245586)
</span><span class="lines">@@ -38,10 +38,6 @@
</span><span class="cx"> #define YARR_CALL
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
-constexpr size_t patternContextBufferSize = 8192; // Space caller allocates to save nested parenthesis context
-#endif
-
</del><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> class VM;
</span><span class="lines">@@ -61,24 +57,11 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class YarrCodeBlock {
</span><del>-#if CPU(X86_64) || CPU(ARM64)
-#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
-    typedef MatchResult (*YarrJITCode8)(const LChar* input, unsigned start, unsigned length, int* output, void* freeParenContext, unsigned parenContextSize) YARR_CALL;
-    typedef MatchResult (*YarrJITCode16)(const UChar* input, unsigned start, unsigned length, int* output, void* freeParenContext, unsigned parenContextSize) YARR_CALL;
-    typedef MatchResult (*YarrJITCodeMatchOnly8)(const LChar* input, unsigned start, unsigned length, void*, void* freeParenContext, unsigned parenContextSize) YARR_CALL;
-    typedef MatchResult (*YarrJITCodeMatchOnly16)(const UChar* input, unsigned start, unsigned length, void*, void* freeParenContext, unsigned parenContextSize) YARR_CALL;
-#else
-    typedef MatchResult (*YarrJITCode8)(const LChar* input, unsigned start, unsigned length, int* output) YARR_CALL;
-    typedef MatchResult (*YarrJITCode16)(const UChar* input, unsigned start, unsigned length, int* output) YARR_CALL;
-    typedef MatchResult (*YarrJITCodeMatchOnly8)(const LChar* input, unsigned start, unsigned length) YARR_CALL;
-    typedef MatchResult (*YarrJITCodeMatchOnly16)(const UChar* input, unsigned start, unsigned length) YARR_CALL;
-#endif
-#else
-    typedef EncodedMatchResult (*YarrJITCode8)(const LChar* input, unsigned start, unsigned length, int* output) YARR_CALL;
-    typedef EncodedMatchResult (*YarrJITCode16)(const UChar* input, unsigned start, unsigned length, int* output) YARR_CALL;
-    typedef EncodedMatchResult (*YarrJITCodeMatchOnly8)(const LChar* input, unsigned start, unsigned length) YARR_CALL;
-    typedef EncodedMatchResult (*YarrJITCodeMatchOnly16)(const UChar* input, unsigned start, unsigned length) YARR_CALL;
-#endif
</del><ins>+    // Technically freeParenContext and parenContextSize are only used if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS) is set. Fortunately, all the calling conventions we support have caller save argument registers.
+    using YarrJITCode8 = EncodedMatchResult (*)(const LChar* input, unsigned start, unsigned length, int* output, void* freeParenContext, unsigned parenContextSize) YARR_CALL;
+    using YarrJITCode16 = EncodedMatchResult (*)(const UChar* input, unsigned start, unsigned length, int* output, void* freeParenContext, unsigned parenContextSize) YARR_CALL;
+    using YarrJITCodeMatchOnly8 = EncodedMatchResult (*)(const LChar* input, unsigned start, unsigned length, void*, void* freeParenContext, unsigned parenContextSize) YARR_CALL;
+    using YarrJITCodeMatchOnly16 = EncodedMatchResult (*)(const UChar* input, unsigned start, unsigned length, void*, void* freeParenContext, unsigned parenContextSize) YARR_CALL;
</ins><span class="cx"> 
</span><span class="cx"> public:
</span><span class="cx">     YarrCodeBlock() = default;
</span><span class="lines">@@ -96,9 +79,10 @@
</span><span class="cx">     void set8BitCodeMatchOnly(MacroAssemblerCodeRef<YarrMatchOnly8BitPtrTag> matchOnly) { m_matchOnly8 = matchOnly; }
</span><span class="cx">     void set16BitCodeMatchOnly(MacroAssemblerCodeRef<YarrMatchOnly16BitPtrTag> matchOnly) { m_matchOnly16 = matchOnly; }
</span><span class="cx"> 
</span><ins>+    bool usesPatternContextBuffer() { return m_usesPatternContextBuffer; }
</ins><span class="cx"> #if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
</span><del>-    bool usesPatternContextBuffer() { return m_usesPatternContextBuffer; }
</del><span class="cx">     void setUsesPatternContextBuffer() { m_usesPatternContextBuffer = true; }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     MatchResult execute(const LChar* input, unsigned start, unsigned length, int* output, void* freeParenContext, unsigned parenContextSize)
</span><span class="cx">     {
</span><span class="lines">@@ -123,32 +107,7 @@
</span><span class="cx">         ASSERT(has16BitCodeMatchOnly());
</span><span class="cx">         return MatchResult(untagCFunctionPtr<YarrJITCodeMatchOnly16, YarrMatchOnly16BitPtrTag>(m_matchOnly16.code().executableAddress())(input, start, length, 0, freeParenContext, parenContextSize));
</span><span class="cx">     }
</span><del>-#else
-    MatchResult execute(const LChar* input, unsigned start, unsigned length, int* output)
-    {
-        ASSERT(has8BitCode());
-        return MatchResult(reinterpret_cast<YarrJITCode8>(m_ref8.code().executableAddress())(input, start, length, output));
-    }
</del><span class="cx"> 
</span><del>-    MatchResult execute(const UChar* input, unsigned start, unsigned length, int* output)
-    {
-        ASSERT(has16BitCode());
-        return MatchResult(reinterpret_cast<YarrJITCode16>(m_ref16.code().executableAddress())(input, start, length, output));
-    }
-
-    MatchResult execute(const LChar* input, unsigned start, unsigned length)
-    {
-        ASSERT(has8BitCodeMatchOnly());
-        return MatchResult(reinterpret_cast<YarrJITCodeMatchOnly8>(m_matchOnly8.code().executableAddress())(input, start, length));
-    }
-
-    MatchResult execute(const UChar* input, unsigned start, unsigned length)
-    {
-        ASSERT(has16BitCodeMatchOnly());
-        return MatchResult(reinterpret_cast<YarrJITCodeMatchOnly16>(m_matchOnly16.code().executableAddress())(input, start, length));
-    }
-#endif
-
</del><span class="cx"> #if ENABLE(REGEXP_TRACING)
</span><span class="cx">     void *get8BitMatchOnlyAddr()
</span><span class="cx">     {
</span><span class="lines">@@ -202,9 +161,7 @@
</span><span class="cx">     MacroAssemblerCodeRef<Yarr16BitPtrTag> m_ref16;
</span><span class="cx">     MacroAssemblerCodeRef<YarrMatchOnly8BitPtrTag> m_matchOnly8;
</span><span class="cx">     MacroAssemblerCodeRef<YarrMatchOnly16BitPtrTag> m_matchOnly16;
</span><del>-#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
-    bool m_usesPatternContextBuffer;
-#endif
</del><ins>+    bool m_usesPatternContextBuffer { false };
</ins><span class="cx">     Optional<JITFailureReason> m_failureReason;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>