Commit 1682a876 authored by Gus Caplan's avatar Gus Caplan Committed by Commit Bot

[regexp] Refactor experimental instruction emits and labels

This is some general cleanup for the experimental regexp implementation.
DeferredLabels have been merged into Labels, label APIs more closely
resemble other parts of V8, and instruction codegen has been moved into
its own class.

Bug: v8:10765
Change-Id: I139c0a0df30e539ee39eae70fc206e6406d898b1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2433058Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Gus Caplan <snek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70230}
parent 5d7a29c9
...@@ -106,21 +106,21 @@ struct RegExpInstruction { ...@@ -106,21 +106,21 @@ struct RegExpInstruction {
uc16 max; // Inclusive. uc16 max; // Inclusive.
}; };
static RegExpInstruction ConsumeRange(Uc16Range consume_range) { static RegExpInstruction ConsumeRange(uc16 min, uc16 max) {
RegExpInstruction result; RegExpInstruction result;
result.opcode = CONSUME_RANGE; result.opcode = CONSUME_RANGE;
result.payload.consume_range = consume_range; result.payload.consume_range = Uc16Range{min, max};
return result; return result;
} }
static RegExpInstruction ConsumeAnyChar() { static RegExpInstruction ConsumeAnyChar() {
return ConsumeRange(Uc16Range{0x0000, 0xFFFF}); return ConsumeRange(0x0000, 0xFFFF);
} }
static RegExpInstruction Fail() { static RegExpInstruction Fail() {
// This is encoded as the empty CONSUME_RANGE of characters 0xFFFF <= c <= // This is encoded as the empty CONSUME_RANGE of characters 0xFFFF <= c <=
// 0x0000. // 0x0000.
return ConsumeRange(Uc16Range{0xFFFF, 0x0000}); return ConsumeRange(0xFFFF, 0x0000);
} }
static RegExpInstruction Fork(int32_t alt_index) { static RegExpInstruction Fork(int32_t alt_index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment