Repository navigation
Commit b92d6a6
committed
Extend first-character filter to support some rope strings
https://bugs.webkit.org/show_bug.cgi?id=328389
rdar://190653722
Reviewed by Yusuke Suzuki.
The first-character filter added in 317836@main lets DFG and FTL
quickly bail out when a regex mismatches on the 0th byte, without
calling into C++.
This patch extends that to two new scenarios:
1. DFG and FTL can now read the first byte of 8-bit substring ropes;
previously, any rope access would require an operation call.
This doesn't cover 16-bit strings or concatenation ropes.
2. DFG RegExpMatchFast now references the first-character table
at codegen time for known regexes. Previously RegExpMatchFast
always lowered to an operation call.
FTL already had to know how to read substring ropes in order to do
string switch lowering, so this patch pulls out that logic into a shared
helper.
Altogether this patch speeds up lexer-style code which tries a chain of
anchored patterns on successive slices.
Test: regexp-anchored-first-char-filter-substring-rope.js
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileRegExpMatchFast):
(JSC::DFG::SpeculativeJIT::emitSwitchStringOnString):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::emitRegExpAnchoredFirstCharacterFilterGuards):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* JSTests/stress/regexp-anchored-first-char-filter-substring-rope.js: Added.
(shouldBe):
(match):
(check):
(i.re.lastIndex.i.100.0.valueOf):
(k.lastIndexes.push.k.0.valueOf):
(exec):
(classify.scan):
(classify):
Canonical link: https://commits.webkit.org/324726@main1 parent adc1832 commit b92d6a6
4 files changed
Lines changed: 219 additions & 20 deletions
File tree
- JSTests/stress
- Source/JavaScriptCore
- dfg
- ftl
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12833 | 12833 | | |
12834 | 12834 | | |
12835 | 12835 | | |
12836 | | - | |
12837 | 12836 | | |
12838 | 12837 | | |
12839 | 12838 | | |
12840 | 12839 | | |
| 12840 | + | |
| 12841 | + | |
12841 | 12842 | | |
12842 | 12843 | | |
12843 | 12844 | | |
| |||
13757 | 13758 | | |
13758 | 13759 | | |
13759 | 13760 | | |
| 13761 | + | |
| 13762 | + | |
| 13763 | + | |
| 13764 | + | |
| 13765 | + | |
| 13766 | + | |
| 13767 | + | |
| 13768 | + | |
| 13769 | + | |
| 13770 | + | |
| 13771 | + | |
| 13772 | + | |
| 13773 | + | |
| 13774 | + | |
| 13775 | + | |
| 13776 | + | |
| 13777 | + | |
| 13778 | + | |
| 13779 | + | |
| 13780 | + | |
| 13781 | + | |
| 13782 | + | |
| 13783 | + | |
| 13784 | + | |
| 13785 | + | |
| 13786 | + | |
| 13787 | + | |
| 13788 | + | |
| 13789 | + | |
| 13790 | + | |
| 13791 | + | |
| 13792 | + | |
| 13793 | + | |
| 13794 | + | |
13760 | 13795 | | |
13761 | 13796 | | |
13762 | 13797 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9752 | 9752 | | |
9753 | 9753 | | |
9754 | 9754 | | |
9755 | | - | |
| 9755 | + | |
9756 | 9756 | | |
9757 | | - | |
| 9757 | + | |
9758 | 9758 | | |
9759 | 9759 | | |
9760 | 9760 | | |
9761 | 9761 | | |
9762 | 9762 | | |
9763 | 9763 | | |
| 9764 | + | |
| 9765 | + | |
| 9766 | + | |
| 9767 | + | |
| 9768 | + | |
| 9769 | + | |
| 9770 | + | |
| 9771 | + | |
| 9772 | + | |
| 9773 | + | |
| 9774 | + | |
| 9775 | + | |
| 9776 | + | |
| 9777 | + | |
| 9778 | + | |
| 9779 | + | |
| 9780 | + | |
9764 | 9781 | | |
9765 | 9782 | | |
9766 | 9783 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19351 | 19351 | | |
19352 | 19352 | | |
19353 | 19353 | | |
| 19354 | + | |
| 19355 | + | |
| 19356 | + | |
| 19357 | + | |
| 19358 | + | |
| 19359 | + | |
| 19360 | + | |
| 19361 | + | |
| 19362 | + | |
| 19363 | + | |
| 19364 | + | |
| 19365 | + | |
| 19366 | + | |
| 19367 | + | |
| 19368 | + | |
| 19369 | + | |
| 19370 | + | |
| 19371 | + | |
| 19372 | + | |
| 19373 | + | |
19354 | 19374 | | |
19355 | 19375 | | |
19356 | 19376 | | |
| |||
19378 | 19398 | | |
19379 | 19399 | | |
19380 | 19400 | | |
| 19401 | + | |
| 19402 | + | |
| 19403 | + | |
| 19404 | + | |
| 19405 | + | |
19381 | 19406 | | |
19382 | 19407 | | |
19383 | 19408 | | |
19384 | 19409 | | |
19385 | 19410 | | |
19386 | | - | |
| 19411 | + | |
19387 | 19412 | | |
19388 | 19413 | | |
19389 | 19414 | | |
| |||
19394 | 19419 | | |
19395 | 19420 | | |
19396 | 19421 | | |
19397 | | - | |
19398 | | - | |
| 19422 | + | |
| 19423 | + | |
19399 | 19424 | | |
19400 | | - | |
| 19425 | + | |
19401 | 19426 | | |
19402 | | - | |
| 19427 | + | |
| 19428 | + | |
| 19429 | + | |
| 19430 | + | |
| 19431 | + | |
| 19432 | + | |
| 19433 | + | |
| 19434 | + | |
| 19435 | + | |
| 19436 | + | |
| 19437 | + | |
| 19438 | + | |
| 19439 | + | |
| 19440 | + | |
| 19441 | + | |
| 19442 | + | |
| 19443 | + | |
| 19444 | + | |
| 19445 | + | |
| 19446 | + | |
| 19447 | + | |
| 19448 | + | |
| 19449 | + | |
| 19450 | + | |
| 19451 | + | |
19403 | 19452 | | |
19404 | 19453 | | |
19405 | 19454 | | |
| |||
24229 | 24278 | | |
24230 | 24279 | | |
24231 | 24280 | | |
24232 | | - | |
24233 | | - | |
24234 | | - | |
| 24281 | + | |
| 24282 | + | |
24235 | 24283 | | |
24236 | 24284 | | |
24237 | | - | |
24238 | | - | |
24239 | | - | |
24240 | | - | |
24241 | | - | |
24242 | | - | |
24243 | | - | |
24244 | | - | |
24245 | | - | |
| 24285 | + | |
24246 | 24286 | | |
24247 | 24287 | | |
24248 | 24288 | | |
| |||
0 commit comments