Commit c1e32791 authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

[regexp] Allow empty ranges in GetQuickCheckDetails

A follow-up to crrev.com/c/3240782.

Drive-by: extend JSRegExp printing.

Fixed: chromium:1263327
Bug: v8:11069
Change-Id: Iff64ded27ca93641f0f572df2ce0a9f846948f7f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3245110
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarMathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77536}
parent e53e9c10
......@@ -688,9 +688,11 @@ void JSPromise::JSPromisePrint(std::ostream& os) {
}
void JSRegExp::JSRegExpPrint(std::ostream& os) {
Isolate* isolate = GetIsolate();
JSObjectPrintHeader(os, *this, "JSRegExp");
os << "\n - data: " << Brief(data());
os << "\n - source: " << Brief(source());
os << "\n - flags: " << Brief(*JSRegExp::StringFromFlags(isolate, flags()));
JSObjectPrintBody(os, *this);
}
......
......@@ -1669,12 +1669,14 @@ void TextNode::GetQuickCheckDetails(QuickCheckDetails* details,
details->positions(characters_filled_in);
RegExpCharacterClass* tree = elm.char_class();
ZoneList<CharacterRange>* ranges = tree->ranges(zone());
DCHECK(!ranges->is_empty());
if (tree->is_negated()) {
if (tree->is_negated() || ranges->is_empty()) {
// A quick check uses multi-character mask and compare. There is no
// useful way to incorporate a negative char class into this scheme
// so we just conservatively create a mask and value that will always
// succeed.
// Likewise for empty ranges (empty ranges can occur e.g. when
// compiling for one-byte subjects and impossible (non-one-byte) ranges
// have been removed).
pos->mask = 0;
pos->value = 0;
} else {
......
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertNull(/.?\ud833{6,}/gsu.exec());
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