YARR: JIT RegExps with back references
authormsaboff@apple.com <msaboff@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Sep 2018 21:18:58 +0000 (21:18 +0000)
committermsaboff@apple.com <msaboff@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Sep 2018 21:18:58 +0000 (21:18 +0000)
commit3c6e1c6fe4278d3abab245b1e6017fbe1dea4c12
tree5a80b4d80198639283548ca12105b4c7e062a166
parentf8270cd0e9bd2b7808f40b183ae27dd658bdc775
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235636 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
Source/JavaScriptCore/runtime/RegExp.cpp
Source/JavaScriptCore/yarr/YarrCanonicalize.h
Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.cpp
Source/JavaScriptCore/yarr/YarrCanonicalizeUCS2.js
Source/JavaScriptCore/yarr/YarrJIT.cpp
Source/JavaScriptCore/yarr/YarrJIT.h
Source/JavaScriptCore/yarr/YarrPattern.h
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h