Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: src/regexp/regexp-ast.h

Issue 2813893002: [regexp] Consider surrogate pairs when optimizing disjunctions (Closed)
Patch Set: DCHECK(!IsLeadSurrogate) Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/regexp/jsregexp.cc ('k') | src/regexp/regexp-parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp/regexp-ast.h
diff --git a/src/regexp/regexp-ast.h b/src/regexp/regexp-ast.h
index fbe3ebfc72ad24a1174a64224bb46cce43937dd3..7065ecd96cf1e36def561e3aca07bc2563bdd59b 100644
--- a/src/regexp/regexp-ast.h
+++ b/src/regexp/regexp-ast.h
@@ -291,9 +291,20 @@ class RegExpAssertion final : public RegExpTree {
class RegExpCharacterClass final : public RegExpTree {
public:
- RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated)
- : set_(ranges), is_negated_(is_negated) {}
- explicit RegExpCharacterClass(uc16 type) : set_(type), is_negated_(false) {}
+ // NEGATED: The character class is negated and should match everything but
+ // the specified ranges.
+ // CONTAINS_SPLIT_SURROGATE: The character class contains part of a split
+ // surrogate and should not be unicode-desugared (crbug.com/641091).
+ enum Flag {
+ NEGATED = 1 << 0,
+ CONTAINS_SPLIT_SURROGATE = 1 << 1,
+ };
+ typedef base::Flags<Flag> Flags;
+
+ explicit RegExpCharacterClass(ZoneList<CharacterRange>* ranges,
+ Flags flags = Flags())
+ : set_(ranges), flags_(flags) {}
+ explicit RegExpCharacterClass(uc16 type) : set_(type), flags_(0) {}
void* Accept(RegExpVisitor* visitor, void* data) override;
RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
RegExpCharacterClass* AsCharacterClass() override;
@@ -322,11 +333,14 @@ class RegExpCharacterClass final : public RegExpTree {
// * : All characters, for advancing unanchored regexp
uc16 standard_type() { return set_.standard_set_type(); }
ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); }
- bool is_negated() { return is_negated_; }
+ bool is_negated() const { return (flags_ & NEGATED) != 0; }
+ bool contains_split_surrogate() const {
+ return (flags_ & CONTAINS_SPLIT_SURROGATE) != 0;
+ }
private:
CharacterSet set_;
- bool is_negated_;
+ const Flags flags_;
};
« no previous file with comments | « src/regexp/jsregexp.cc ('k') | src/regexp/regexp-parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698