<!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>[235636] trunk/Source</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/235636">235636</a></dd>
<dt>Author</dt> <dd>msaboff@apple.com</dd>
<dt>Date</dt> <dd>2018-09-04 14:18:58 -0700 (Tue, 04 Sep 2018)</dd>
</dl>

<h3>Log Message</h3>
<pre>YARR: JIT RegExps with back references
https://bugs.webkit.org/show_bug.cgi?id=180874

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

Implemented JIT'ed back references for all counted types.  The only type of back references
not handled in the JIT are 16bit matches that ignore case.  Such support would require the
canonicalization that is currently handled in the Yarr interpreter via a C funtion call.
The back reference processing for surrogate pairs is implemented by individually comparing
each surrogate ala memcmp.

Added a generated canonicalization table for the LChar (8bit) domain to process case
ignored back references.

Added macro assembler load16(ExtendedAddress) for indexed access to the canonicalization table.

Added a new JIT failure reason for forward references as the check to JIT expressions with
forward references we're handled synonimously those containing back references.

This change is only enabled for 64 bit platforms.

* assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::load16):
* assembler/MacroAssemblerX86_64.h:
(JSC::MacroAssemblerX86_64::load16):
* runtime/RegExp.cpp:
(JSC::RegExp::compile):
(JSC::RegExp::compileMatchOnly):
* yarr/YarrCanonicalize.h:
* yarr/YarrCanonicalizeUCS2.cpp:
* yarr/YarrCanonicalizeUCS2.js:
(set characters.hex.set string_appeared_here):
* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::checkNotEnoughInput):
(JSC::Yarr::YarrGenerator::readCharacterDontDecodeSurrogates):
(JSC::Yarr::YarrGenerator::matchBackreference):
(JSC::Yarr::YarrGenerator::generateBackReference):
(JSC::Yarr::YarrGenerator::backtrackBackReference):
(JSC::Yarr::YarrGenerator::generateTerm):
(JSC::Yarr::YarrGenerator::backtrackTerm):
(JSC::Yarr::YarrGenerator::compile):
(JSC::Yarr::dumpCompileFailure):
* yarr/YarrJIT.h:
* yarr/YarrPattern.h:
(JSC::Yarr::BackTrackInfoBackReference::beginIndex):
(JSC::Yarr::BackTrackInfoBackReference::matchAmountIndex):

Source/WTF:

Added ENABLE_YARR_JIT_BACKREFERENCES to enable RegExp JIT'ing of back references
for 64 bit platforms only.

* wtf/Platform.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerARM64h">trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerX86_64h">trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeRegExpcpp">trunk/Source/JavaScriptCore/runtime/RegExp.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreyarrYarrCanonicalizeh">trunk/Source/JavaScriptCore/yarr/YarrCanonicalize.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreyarrYarrCanonicalizeUCS2cpp">trunk/Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreyarrYarrCanonicalizeUCS2js">trunk/Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.js</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>
<li><a href="#trunkSourceJavaScriptCoreyarrYarrPatternh">trunk/Source/JavaScriptCore/yarr/YarrPattern.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfPlatformh">trunk/Source/WTF/wtf/Platform.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/JavaScriptCore/ChangeLog       2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2018-09-04  Michael Saboff  <msaboff@apple.com>
+
+        YARR: JIT RegExps with back references
+        https://bugs.webkit.org/show_bug.cgi?id=180874
+
+        Reviewed by Filip Pizlo.
+
+        Implemented JIT'ed back references for all counted types.  The only type of back references
+        not handled in the JIT are 16bit matches that ignore case.  Such support would require the
+        canonicalization that is currently handled in the Yarr interpreter via a C funtion call.
+        The back reference processing for surrogate pairs is implemented by individually comparing
+        each surrogate ala memcmp.
+
+        Added a generated canonicalization table for the LChar (8bit) domain to process case
+        ignored back references.
+
+        Added macro assembler load16(ExtendedAddress) for indexed access to the canonicalization table.
+
+        Added a new JIT failure reason for forward references as the check to JIT expressions with
+        forward references we're handled synonimously those containing back references.
+
+        This change is only enabled for 64 bit platforms.
+
+        * assembler/MacroAssemblerARM64.h:
+        (JSC::MacroAssemblerARM64::load16):
+        * assembler/MacroAssemblerX86_64.h:
+        (JSC::MacroAssemblerX86_64::load16):
+        * runtime/RegExp.cpp:
+        (JSC::RegExp::compile):
+        (JSC::RegExp::compileMatchOnly):
+        * yarr/YarrCanonicalize.h:
+        * yarr/YarrCanonicalizeUCS2.cpp:
+        * yarr/YarrCanonicalizeUCS2.js:
+        (set characters.hex.set string_appeared_here):
+        * yarr/YarrJIT.cpp:
+        (JSC::Yarr::YarrGenerator::checkNotEnoughInput):
+        (JSC::Yarr::YarrGenerator::readCharacterDontDecodeSurrogates):
+        (JSC::Yarr::YarrGenerator::matchBackreference):
+        (JSC::Yarr::YarrGenerator::generateBackReference):
+        (JSC::Yarr::YarrGenerator::backtrackBackReference):
+        (JSC::Yarr::YarrGenerator::generateTerm):
+        (JSC::Yarr::YarrGenerator::backtrackTerm):
+        (JSC::Yarr::YarrGenerator::compile):
+        (JSC::Yarr::dumpCompileFailure):
+        * yarr/YarrJIT.h:
+        * yarr/YarrPattern.h:
+        (JSC::Yarr::BackTrackInfoBackReference::beginIndex):
+        (JSC::Yarr::BackTrackInfoBackReference::matchAmountIndex):
+
</ins><span class="cx"> 2018-09-04  Mark Lam  <mark.lam@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Make the jsc shell print, printErr, and debug functions more robust.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj     2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -9966,7 +9966,7 @@
</span><span class="cx">                  );
</span><span class="cx">                  runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                  shellPath = /bin/sh;
</span><del>-                       shellScript = "set -e\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_offset_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/LLIntDesiredOffsets.h\" \"${ARCHS} C_LOOP\"\n";
</del><ins>+                        shellScript = "set -e\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${CURRENT_ARCH}\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_offset_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${CURRENT_ARCH}/LLIntDesiredOffsets.h\" \"${ARCHS} C_LOOP\"\n";
</ins><span class="cx">           };
</span><span class="cx">          1A02D9A81B34A882000D1522 /* Add Symlink in /System/Library/PrivateFrameworks */ = {
</span><span class="cx">                  isa = PBXShellScriptBuildPhase;
</span><span class="lines">@@ -10660,6 +10660,7 @@
</span><span class="cx">                  buildSettings = {
</span><span class="cx">                          HEADER_SEARCH_PATHS = (
</span><span class="cx">                                  "\"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"",
</span><ins>+                                       "\"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${CURRENT_ARCH}\"",
</ins><span class="cx">                                   "\"$(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders\"",
</span><span class="cx">                                  "$(inherited)",
</span><span class="cx">                          );
</span><span class="lines">@@ -10672,6 +10673,7 @@
</span><span class="cx">                  buildSettings = {
</span><span class="cx">                          HEADER_SEARCH_PATHS = (
</span><span class="cx">                                  "\"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"",
</span><ins>+                                       "\"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${CURRENT_ARCH}\"",
</ins><span class="cx">                                   "\"$(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders\"",
</span><span class="cx">                                  "$(inherited)",
</span><span class="cx">                          );
</span><span class="lines">@@ -10684,6 +10686,7 @@
</span><span class="cx">                  buildSettings = {
</span><span class="cx">                          HEADER_SEARCH_PATHS = (
</span><span class="cx">                                  "\"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"",
</span><ins>+                                       "\"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${CURRENT_ARCH}\"",
</ins><span class="cx">                                   "\"$(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders\"",
</span><span class="cx">                                  "$(inherited)",
</span><span class="cx">                          );
</span><span class="lines">@@ -10696,6 +10699,7 @@
</span><span class="cx">                  buildSettings = {
</span><span class="cx">                          HEADER_SEARCH_PATHS = (
</span><span class="cx">                                  "\"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"",
</span><ins>+                                       "\"${BUILT_PRODUCTS_DIR}/LLIntOffsets/${CURRENT_ARCH}\"",
</ins><span class="cx">                                   "\"$(JAVASCRIPTCORE_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders\"",
</span><span class="cx">                                  "$(inherited)",
</span><span class="cx">                          );
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerARM64h"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h      2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h 2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -1218,7 +1218,15 @@
</span><span class="cx">         m_assembler.add<64>(memoryTempRegister, memoryTempRegister, address.index, Assembler::UXTX, address.scale);
</span><span class="cx">         m_assembler.ldrh(dest, address.base, memoryTempRegister);
</span><span class="cx">     }
</span><del>-    
</del><ins>+
+    void load16(ExtendedAddress address, RegisterID dest)
+    {
+        moveToCachedReg(TrustedImmPtr(reinterpret_cast<void*>(address.offset)), cachedMemoryTempRegister());
+        m_assembler.ldrh(dest, memoryTempRegister, address.base, Assembler::UXTX, 1);
+        if (dest == memoryTempRegister)
+            cachedMemoryTempRegister().invalidate();
+    }
+
</ins><span class="cx">     void load16Unaligned(ImplicitAddress address, RegisterID dest)
</span><span class="cx">     {
</span><span class="cx">         load16(address, dest);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerX86_64h"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h     2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h        2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -100,6 +100,23 @@
</span><span class="cx">         load8(dest, dest);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    void load16(ExtendedAddress address, RegisterID dest)
+    {
+        TrustedImmPtr addr(reinterpret_cast<void*>(address.offset));
+        MacroAssemblerX86Common::move(addr, scratchRegister());
+        MacroAssemblerX86Common::load16(BaseIndex(scratchRegister(), address.base, TimesTwo), dest);
+    }
+
+    void load16(BaseIndex address, RegisterID dest)
+    {
+        MacroAssemblerX86Common::load16(address, dest);
+    }
+
+    void load16(Address address, RegisterID dest)
+    {
+        MacroAssemblerX86Common::load16(address, dest);
+    }
+
</ins><span class="cx">     void load32(const void* address, RegisterID dest)
</span><span class="cx">     {
</span><span class="cx">         if (dest == X86Registers::eax)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeRegExpcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/RegExp.cpp (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/RegExp.cpp   2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/JavaScriptCore/runtime/RegExp.cpp      2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -305,7 +305,11 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(YARR_JIT)
</span><del>-    if (!pattern.m_containsBackreferences && !pattern.containsUnsignedLengthPattern() && VM::canUseRegExpJIT()) {
</del><ins>+    if (!pattern.containsUnsignedLengthPattern() && VM::canUseRegExpJIT()
+#if !ENABLE(YARR_JIT_BACKREFERENCES)
+        && !pattern.m_containsBackreferences
+#endif
+        ) {
</ins><span class="cx">         Yarr::jitCompile(pattern, m_patternString, charSize, vm, m_regExpJITCode);
</span><span class="cx">         if (!m_regExpJITCode.failureReason()) {
</span><span class="cx">             m_state = JITCode;
</span><span class="lines">@@ -361,7 +365,11 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(YARR_JIT)
</span><del>-    if (!pattern.m_containsBackreferences && !pattern.containsUnsignedLengthPattern() && VM::canUseRegExpJIT()) {
</del><ins>+    if (!pattern.containsUnsignedLengthPattern() && VM::canUseRegExpJIT()
+#if !ENABLE(YARR_JIT_BACKREFERENCES)
+        && !pattern.m_containsBackreferences
+#endif
+        ) {
</ins><span class="cx">         Yarr::jitCompile(pattern, m_patternString, charSize, vm, m_regExpJITCode, Yarr::MatchOnly);
</span><span class="cx">         if (!m_regExpJITCode.failureReason()) {
</span><span class="cx">             m_state = JITCode;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreyarrYarrCanonicalizeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/yarr/YarrCanonicalize.h (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/yarr/YarrCanonicalize.h      2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/JavaScriptCore/yarr/YarrCanonicalize.h 2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> extern const size_t UCS2_CANONICALIZATION_RANGES;
</span><span class="cx"> extern const UChar32* const ucs2CharacterSetInfo[];
</span><span class="cx"> extern const CanonicalizationRange ucs2RangeInfo[];
</span><ins>+extern const uint16_t canonicalTableLChar[256];
</ins><span class="cx"> 
</span><span class="cx"> extern const size_t UNICODE_CANONICALIZATION_RANGES;
</span><span class="cx"> extern const UChar32* const unicodeCharacterSetInfo[];
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreyarrYarrCanonicalizeUCS2cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.cpp (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.cpp        2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.cpp   2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -533,5 +533,24 @@
</span><span class="cx">     { 0xff5b, 0xffff, 0x0000, CanonicalizeUnique },
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+const uint16_t canonicalTableLChar[256] = {
+    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+    0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+    0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+    0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+    0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+    0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0x39c, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+    0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+    0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x178
+};
+
</ins><span class="cx"> } } // JSC::Yarr
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreyarrYarrCanonicalizeUCS2js"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.js (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.js 2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.js    2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -183,6 +183,24 @@
</span><span class="cx">     }
</span><span class="cx">     print("};");
</span><span class="cx">     print();
</span><ins>+    // Create canonical table for LChar domain
+    let line = "const uint16_t canonicalTableLChar[256] = {";
+    for (let i = 0; i < 256; i++) {
+        if (!(i % 16)) {
+            print(line);
+            line = "    ";
+        }
+        let canonicalChar = canonicalize(i);
+        line = line + (canonicalChar < 16 ? "0x0" : "0x") + canonicalChar.toString(16);
+        if ((i % 16) != 15)
+            line += ", ";
+        else if (i != 255)
+            line += ",";
+    }
+    print(line);
+    print("};");
+    print();
+    
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> printHeader();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreyarrYarrJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp     2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp        2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -464,6 +464,12 @@
</span><span class="cx">         return branch32(BelowOrEqual, index, length);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    Jump checkNotEnoughInput(RegisterID additionalAmount)
+    {
+        add32(index, additionalAmount);
+        return branch32(Above, additionalAmount, length);
+    }
+
</ins><span class="cx">     Jump checkInput()
</span><span class="cx">     {
</span><span class="cx">         return branch32(BelowOrEqual, index, length);
</span><span class="lines">@@ -546,6 +552,16 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    void readCharacterDontDecodeSurrogates(Checked<unsigned> negativeCharacterOffset, RegisterID resultReg, RegisterID indexReg = index)
+    {
+        BaseIndex address = negativeOffsetIndexedAddress(negativeCharacterOffset, resultReg, indexReg);
+        
+        if (m_charSize == Char8)
+            load8(address, resultReg);
+        else
+            load16Unaligned(address, resultReg);
+    }
+    
</ins><span class="cx">     void readCharacter(Checked<unsigned> negativeCharacterOffset, RegisterID resultReg, RegisterID indexReg = index)
</span><span class="cx">     {
</span><span class="cx">         BaseIndex address = negativeOffsetIndexedAddress(negativeCharacterOffset, resultReg, indexReg);
</span><span class="lines">@@ -1106,6 +1122,228 @@
</span><span class="cx">         backtrackTermDefault(opIndex);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+#if ENABLE(YARR_JIT_BACKREFERENCES)
+    void matchBackreference(size_t opIndex, JumpList& characterMatchFails, RegisterID character, RegisterID patternIndex, RegisterID patternCharacter)
+    {
+        YarrOp& op = m_ops[opIndex];
+        PatternTerm* term = op.m_term;
+        unsigned subpatternId = term->backReferenceSubpatternId;
+
+        Label loop(this);
+
+            readCharacterDontDecodeSurrogates(0, patternCharacter, patternIndex);
+            readCharacterDontDecodeSurrogates(m_checkedOffset - term->inputPosition, character);
+        
+        if (!m_pattern.ignoreCase())
+            characterMatchFails.append(branch32(NotEqual, character, patternCharacter));
+        else {
+            Jump charactersMatch = branch32(Equal, character, patternCharacter);
+            ExtendedAddress characterTableEntry(character, reinterpret_cast<intptr_t>(&canonicalTableLChar));
+            load16(characterTableEntry, character);
+            ExtendedAddress patternTableEntry(patternCharacter, reinterpret_cast<intptr_t>(&canonicalTableLChar));
+            load16(patternTableEntry, patternCharacter);
+            characterMatchFails.append(branch32(NotEqual, character, patternCharacter));
+            charactersMatch.link(this);
+        }
+
+        
+        add32(TrustedImm32(1), index);
+        add32(TrustedImm32(1), patternIndex);
+        
+        branch32(NotEqual, patternIndex, Address(output, ((subpatternId << 1) + 1) * sizeof(int))).linkTo(loop, this);
+    }
+
+    void generateBackReference(size_t opIndex)
+    {
+        YarrOp& op = m_ops[opIndex];
+        PatternTerm* term = op.m_term;
+
+        if (m_pattern.ignoreCase() && m_charSize != Char8) {
+            m_failureReason = JITFailureReason::BackReference;
+            return;
+        }
+
+        unsigned subpatternId = term->backReferenceSubpatternId;
+        unsigned parenthesesFrameLocation = term->frameLocation;
+
+        const RegisterID characterOrTemp = regT0;
+        const RegisterID patternIndex = regT1;
+        const RegisterID patternTemp = regT2;
+
+        storeToFrame(index, parenthesesFrameLocation + BackTrackInfoBackReference::beginIndex());
+        if (term->quantityType != QuantifierFixedCount || term->quantityMaxCount != 1)
+            storeToFrame(TrustedImm32(0), parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex());
+
+        JumpList matches;
+
+        if (term->quantityType != QuantifierNonGreedy) {
+            load32(Address(output, (subpatternId << 1) * sizeof(int)), patternIndex);
+            load32(Address(output, ((subpatternId << 1) + 1) * sizeof(int)), patternTemp);
+
+            // An empty match is successful without consuming characters
+            if (term->quantityType != QuantifierFixedCount || term->quantityMaxCount != 1) {
+                matches.append(branch32(Equal, TrustedImm32(-1), patternIndex));
+                matches.append(branch32(Equal, patternIndex, patternTemp));
+            } else {
+                Jump zeroLengthMatch = branch32(Equal, TrustedImm32(-1), patternIndex);
+                Jump tryNonZeroMatch = branch32(NotEqual, patternIndex, patternTemp);
+                zeroLengthMatch.link(this);
+                storeToFrame(TrustedImm32(1), parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex());
+                matches.append(jump());
+                tryNonZeroMatch.link(this);
+            }
+        }
+
+        switch (term->quantityType) {
+        case QuantifierFixedCount: {
+            Label outerLoop(this);
+
+            // PatternTemp should contain pattern end index at this point
+            sub32(patternIndex, patternTemp);
+            if (m_checkedOffset - term->inputPosition)
+                sub32(Imm32((m_checkedOffset - term->inputPosition).unsafeGet()), patternTemp);
+            op.m_jumps.append(checkNotEnoughInput(patternTemp));
+
+            matchBackreference(opIndex, op.m_jumps, characterOrTemp, patternIndex, patternTemp);
+
+            if (term->quantityMaxCount != 1) {
+                loadFromFrame(parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex(), characterOrTemp);
+                add32(TrustedImm32(1), characterOrTemp);
+                storeToFrame(characterOrTemp, parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex());
+                matches.append(branch32(Equal, Imm32(term->quantityMaxCount.unsafeGet()), characterOrTemp));
+                load32(Address(output, (subpatternId << 1) * sizeof(int)), patternIndex);
+                load32(Address(output, ((subpatternId << 1) + 1) * sizeof(int)), patternTemp);
+                jump(outerLoop);
+            }
+            matches.link(this);
+            break;
+        }
+
+        case QuantifierGreedy: {
+            JumpList incompleteMatches;
+
+            Label outerLoop(this);
+
+            // PatternTemp should contain pattern end index at this point
+            sub32(patternIndex, patternTemp);
+            if (m_checkedOffset - term->inputPosition)
+                sub32(Imm32((m_checkedOffset - term->inputPosition).unsafeGet()), patternTemp);
+            matches.append(checkNotEnoughInput(patternTemp));
+
+            matchBackreference(opIndex, incompleteMatches, characterOrTemp, patternIndex, patternTemp);
+
+            loadFromFrame(parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex(), characterOrTemp);
+            add32(TrustedImm32(1), characterOrTemp);
+            storeToFrame(characterOrTemp, parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex());
+            if (term->quantityMaxCount != quantifyInfinite)
+                matches.append(branch32(Equal, Imm32(term->quantityMaxCount.unsafeGet()), characterOrTemp));
+            load32(Address(output, (subpatternId << 1) * sizeof(int)), patternIndex);
+            load32(Address(output, ((subpatternId << 1) + 1) * sizeof(int)), patternTemp);
+
+            // Store current index in frame for restoring after a partial match
+            storeToFrame(index, parenthesesFrameLocation + BackTrackInfoBackReference::beginIndex());
+            jump(outerLoop);
+
+            incompleteMatches.link(this);
+            loadFromFrame(parenthesesFrameLocation + BackTrackInfoBackReference::beginIndex(), index);
+
+            matches.link(this);
+            op.m_reentry = label();
+            break;
+        }
+
+        case QuantifierNonGreedy: {
+            JumpList incompleteMatches;
+
+            matches.append(jump());
+
+            op.m_reentry = label();
+
+            load32(Address(output, (subpatternId << 1) * sizeof(int)), patternIndex);
+            load32(Address(output, ((subpatternId << 1) + 1) * sizeof(int)), patternTemp);
+
+            // An empty match is successful without consuming characters
+            Jump zeroLengthMatch = branch32(Equal, TrustedImm32(-1), patternIndex);
+            Jump tryNonZeroMatch = branch32(NotEqual, patternIndex, patternTemp);
+            zeroLengthMatch.link(this);
+            storeToFrame(TrustedImm32(1), parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex());
+            matches.append(jump());
+            tryNonZeroMatch.link(this);
+
+            // Check if we have input remaining to match
+            sub32(patternIndex, patternTemp);
+            if (m_checkedOffset - term->inputPosition)
+                sub32(Imm32((m_checkedOffset - term->inputPosition).unsafeGet()), patternTemp);
+            matches.append(checkNotEnoughInput(patternTemp));
+
+            storeToFrame(index, parenthesesFrameLocation + BackTrackInfoBackReference::beginIndex());
+
+            matchBackreference(opIndex, incompleteMatches, characterOrTemp, patternIndex, patternTemp);
+
+            matches.append(jump());
+
+            incompleteMatches.link(this);
+            loadFromFrame(parenthesesFrameLocation + BackTrackInfoBackReference::beginIndex(), index);
+
+            matches.link(this);
+            break;
+        }
+        }
+    }
+    void backtrackBackReference(size_t opIndex)
+    {
+        YarrOp& op = m_ops[opIndex];
+        PatternTerm* term = op.m_term;
+
+        unsigned subpatternId = term->backReferenceSubpatternId;
+
+        m_backtrackingState.link(this);
+        op.m_jumps.link(this);
+
+        JumpList failures;
+
+        unsigned parenthesesFrameLocation = term->frameLocation;
+        switch (term->quantityType) {
+        case QuantifierFixedCount:
+            loadFromFrame(parenthesesFrameLocation + BackTrackInfoBackReference::beginIndex(), index);
+            break;
+
+        case QuantifierGreedy: {
+            const RegisterID matchAmount = regT0;
+            const RegisterID patternStartIndex = regT1;
+            const RegisterID patternEndIndexOrLen = regT2;
+
+            loadFromFrame(parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex(), matchAmount);
+            failures.append(branchTest32(Zero, matchAmount));
+
+            load32(Address(output, (subpatternId << 1) * sizeof(int)), patternStartIndex);
+            load32(Address(output, ((subpatternId << 1) + 1) * sizeof(int)), patternEndIndexOrLen);
+            sub32(patternStartIndex, patternEndIndexOrLen);
+            sub32(patternEndIndexOrLen, index);
+
+            sub32(TrustedImm32(1), matchAmount);
+            storeToFrame(matchAmount, parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex());
+            jump(op.m_reentry);
+            break;
+        }
+
+        case QuantifierNonGreedy: {
+            const RegisterID matchAmount = regT0;
+
+            loadFromFrame(parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex(), matchAmount);
+            if (term->quantityMaxCount != quantifyInfinite)
+                failures.append(branch32(AboveOrEqual, Imm32(term->quantityMaxCount.unsafeGet()), matchAmount));
+            add32(TrustedImm32(1), matchAmount);
+            storeToFrame(matchAmount, parenthesesFrameLocation + BackTrackInfoBackReference::matchAmountIndex());
+            jump(op.m_reentry);
+            break;
+        }
+        }
+        failures.link(this);
+        m_backtrackingState.fallthrough();
+    }
+#endif
+
</ins><span class="cx">     void generatePatternCharacterOnce(size_t opIndex)
</span><span class="cx">     {
</span><span class="cx">         YarrOp& op = m_ops[opIndex];
</span><span class="lines">@@ -1854,13 +2092,19 @@
</span><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         case PatternTerm::TypeForwardReference:
</span><ins>+            m_failureReason = JITFailureReason::ForwardReference;
</ins><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         case PatternTerm::TypeParenthesesSubpattern:
</span><span class="cx">         case PatternTerm::TypeParentheticalAssertion:
</span><span class="cx">             RELEASE_ASSERT_NOT_REACHED();
</span><ins>+
</ins><span class="cx">         case PatternTerm::TypeBackReference:
</span><ins>+#if ENABLE(YARR_JIT_BACKREFERENCES)
+            generateBackReference(opIndex);
+#else
</ins><span class="cx">             m_failureReason = JITFailureReason::BackReference;
</span><ins>+#endif
</ins><span class="cx">             break;
</span><span class="cx">         case PatternTerm::TypeDotStarEnclosure:
</span><span class="cx">             generateDotStarEnclosure(opIndex);
</span><span class="lines">@@ -1920,6 +2164,7 @@
</span><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         case PatternTerm::TypeForwardReference:
</span><ins>+            m_failureReason = JITFailureReason::ForwardReference;
</ins><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         case PatternTerm::TypeParenthesesSubpattern:
</span><span class="lines">@@ -1926,13 +2171,17 @@
</span><span class="cx">         case PatternTerm::TypeParentheticalAssertion:
</span><span class="cx">             RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx"> 
</span><ins>+        case PatternTerm::TypeBackReference:
+#if ENABLE(YARR_JIT_BACKREFERENCES)
+            backtrackBackReference(opIndex);
+#else
+            m_failureReason = JITFailureReason::BackReference;
+#endif
+            break;
+
</ins><span class="cx">         case PatternTerm::TypeDotStarEnclosure:
</span><span class="cx">             backtrackDotStarEnclosure(opIndex);
</span><span class="cx">             break;
</span><del>-
-        case PatternTerm::TypeBackReference:
-            m_failureReason = JITFailureReason::BackReference;
-            break;
</del><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -3566,6 +3815,15 @@
</span><span class="cx">         }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+        if (m_pattern.m_containsBackreferences
+#if ENABLE(YARR_JIT_BACKREFERENCES)
+            && (compileMode == MatchOnly || (m_pattern.ignoreCase() && m_charSize != Char8))
+#endif
+            ) {
+                codeBlock.setFallBackWithFailureReason(JITFailureReason::BackReference);
+                return;
+        }
+
</ins><span class="cx">         // We need to compile before generating code since we set flags based on compilation that
</span><span class="cx">         // are used during generation.
</span><span class="cx">         opCompileBody(m_pattern.m_body);
</span><span class="lines">@@ -3713,6 +3971,11 @@
</span><span class="cx">                 out.print("Assert EOL");
</span><span class="cx">                 break;
</span><span class="cx"> 
</span><ins>+            case PatternTerm::TypeBackReference:
+                out.printf("BackReference pattern #%u", term->backReferenceSubpatternId);
+                term->dumpQuantifier(out);
+                break;
+
</ins><span class="cx">             case PatternTerm::TypePatternCharacter:
</span><span class="cx">                 out.print("TypePatternCharacter ");
</span><span class="cx">                 dumpUChar32(out, term->patternCharacter);
</span><span class="lines">@@ -3739,7 +4002,9 @@
</span><span class="cx">                 break;
</span><span class="cx"> 
</span><span class="cx">             case PatternTerm::TypeForwardReference:
</span><del>-            case PatternTerm::TypeBackReference:
</del><ins>+                out.print("TypeForwardReference <not handled>");
+                break;
+
</ins><span class="cx">             case PatternTerm::TypeParenthesesSubpattern:
</span><span class="cx">             case PatternTerm::TypeParentheticalAssertion:
</span><span class="cx">                 RELEASE_ASSERT_NOT_REACHED();
</span><span class="lines">@@ -3853,7 +4118,7 @@
</span><span class="cx">             return(0);
</span><span class="cx"> 
</span><span class="cx">         case OpParentheticalAssertionEnd:
</span><del>-            out.print("OpParentheticalAssertionEnd%s\n", term->invert() ? " inverted" : "");
</del><ins>+            out.printf("OpParentheticalAssertionEnd%s\n", term->invert() ? " inverted" : "");
</ins><span class="cx">             return(0);
</span><span class="cx"> 
</span><span class="cx">         case OpMatchFailed:
</span><span class="lines">@@ -3917,8 +4182,11 @@
</span><span class="cx">         dataLog("Can't JIT a pattern decoding surrogate pairs\n");
</span><span class="cx">         break;
</span><span class="cx">     case JITFailureReason::BackReference:
</span><del>-        dataLog("Can't JIT a pattern containing back references\n");
</del><ins>+        dataLog("Can't JIT some patterns containing back references\n");
</ins><span class="cx">         break;
</span><ins>+    case JITFailureReason::ForwardReference:
+        dataLog("Can't JIT a pattern containing forward references\n");
+        break;
</ins><span class="cx">     case JITFailureReason::VariableCountedParenthesisWithNonZeroMinimum:
</span><span class="cx">         dataLog("Can't JIT a pattern containing a variable counted parenthesis with a non-zero minimum\n");
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreyarrYarrJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/yarr/YarrJIT.h (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/yarr/YarrJIT.h       2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/JavaScriptCore/yarr/YarrJIT.h  2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> enum class JITFailureReason : uint8_t {
</span><span class="cx">     DecodeSurrogatePair,
</span><span class="cx">     BackReference,
</span><ins>+    ForwardReference,
</ins><span class="cx">     VariableCountedParenthesisWithNonZeroMinimum,
</span><span class="cx">     ParenthesizedSubpattern,
</span><span class="cx">     FixedCountParenthesizedSubpattern,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreyarrYarrPatternh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/yarr/YarrPattern.h (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/yarr/YarrPattern.h   2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/JavaScriptCore/yarr/YarrPattern.h      2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -555,8 +555,8 @@
</span><span class="cx">         uintptr_t begin; // Not really needed for greedy quantifiers.
</span><span class="cx">         uintptr_t matchAmount; // Not really needed for fixed quantifiers.
</span><span class="cx"> 
</span><del>-        unsigned beginIndex() { return offsetof(BackTrackInfoBackReference, begin) / sizeof(uintptr_t); }
-        unsigned matchAmountIndex() { return offsetof(BackTrackInfoBackReference, matchAmount) / sizeof(uintptr_t); }
</del><ins>+        static unsigned beginIndex() { return offsetof(BackTrackInfoBackReference, begin) / sizeof(uintptr_t); }
+        static unsigned matchAmountIndex() { return offsetof(BackTrackInfoBackReference, matchAmount) / sizeof(uintptr_t); }
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     struct BackTrackInfoAlternative {
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/WTF/ChangeLog  2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2018-09-04  Michael Saboff  <msaboff@apple.com>
+
+        YARR: JIT RegExps with back references
+        https://bugs.webkit.org/show_bug.cgi?id=180874
+
+        Reviewed by Filip Pizlo.
+
+        Added ENABLE_YARR_JIT_BACKREFERENCES to enable RegExp JIT'ing of back references
+        for 64 bit platforms only.
+
+        * wtf/Platform.h:
+
</ins><span class="cx"> 2018-08-31  Antti Koivisto  <antti@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Replace OptionSet |= and -= operators with add() and remove() functions
</span></span></pre></div>
<a id="trunkSourceWTFwtfPlatformh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Platform.h (235635 => 235636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Platform.h  2018-09-04 21:18:22 UTC (rev 235635)
+++ trunk/Source/WTF/wtf/Platform.h     2018-09-04 21:18:58 UTC (rev 235636)
</span><span class="lines">@@ -973,8 +973,9 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(YARR_JIT)
</span><span class="cx"> #if CPU(ARM64) || (CPU(X86_64) && !OS(WINDOWS))
</span><del>-/* Enable JIT'ing Regular Expressions that have nested parenthesis. */
</del><ins>+/* Enable JIT'ing Regular Expressions that have nested parenthesis and back references. */
</ins><span class="cx"> #define ENABLE_YARR_JIT_ALL_PARENS_EXPRESSIONS 1
</span><ins>+#define ENABLE_YARR_JIT_BACKREFERENCES 1
</ins><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>