Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
regexp.h
Go to the documentation of this file.
1// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_REGEXP_H_
6#define RUNTIME_VM_REGEXP_H_
7
8#include "platform/unicode.h"
9
10#include "vm/object.h"
11#include "vm/regexp_assembler.h"
12#include "vm/splay-tree.h"
13
14namespace dart {
15
16class NodeVisitor;
17class RegExpCompiler;
18class RegExpMacroAssembler;
19class RegExpNode;
20class RegExpTree;
21class BoyerMooreLookahead;
22
23// Represents code units in the range from from_ to to_, both ends are
24// inclusive.
26 public:
27 CharacterRange() : from_(0), to_(0) {}
28 CharacterRange(int32_t from, int32_t to) : from_(from), to_(to) {}
29
30 static void AddClassEscape(uint16_t type,
32 // Add class escapes with case equivalent closure for \w and \W if necessary.
33 static void AddClassEscape(uint16_t type,
35 bool add_unicode_case_equivalents);
37 static inline CharacterRange Singleton(int32_t value) {
38 return CharacterRange(value, value);
39 }
40 static inline CharacterRange Range(int32_t from, int32_t to) {
41 ASSERT(from <= to);
42 return CharacterRange(from, to);
43 }
44 static inline CharacterRange Everything() {
46 }
48 CharacterRange range) {
49 auto list = new (zone) ZoneGrowableArray<CharacterRange>(1);
50 list->Add(range);
51 return list;
52 }
53 bool Contains(int32_t i) const { return from_ <= i && i <= to_; }
54 int32_t from() const { return from_; }
55 void set_from(int32_t value) { from_ = value; }
56 int32_t to() const { return to_; }
57 void set_to(int32_t value) { to_ = value; }
58 bool is_valid() const { return from_ <= to_; }
59 bool IsEverything(int32_t max) const { return from_ == 0 && to_ >= max; }
60 bool IsSingleton() const { return (from_ == to_); }
62 bool is_one_byte,
63 Zone* zone);
68 Zone* zone);
69 // Whether a range list is in canonical form: Ranges ordered by from value,
70 // and ranges non-overlapping and non-adjacent.
72 // Convert range list to canonical form. The characters covered by the ranges
73 // will still be the same, but no character is in more than one range, and
74 // adjacent ranges are merged. The resulting list may be shorter than the
75 // original, but cannot be longer.
77 // Negate the contents of a character range in canonical form.
80 static constexpr intptr_t kStartMarker = (1 << 24);
81 static constexpr intptr_t kPayloadMask = (1 << 24) - 1;
82
83 private:
84 int32_t from_;
85 int32_t to_;
86
87 DISALLOW_ALLOCATION();
88};
89
90// A set of unsigned integers that behaves especially well on small
91// integers (< 32). May do zone-allocation.
92class OutSet : public ZoneAllocated {
93 public:
94 OutSet() : first_(0), remaining_(nullptr), successors_(nullptr) {}
95 OutSet* Extend(unsigned value, Zone* zone);
96 bool Get(unsigned value) const;
97 static constexpr unsigned kFirstLimit = 32;
98
99 private:
100 // Destructively set a value in this set. In most cases you want
101 // to use Extend instead to ensure that only one instance exists
102 // that contains the same values.
103 void Set(unsigned value, Zone* zone);
104
105 // The successors are a list of sets that contain the same values
106 // as this set and the one more value that is not present in this
107 // set.
108 ZoneGrowableArray<OutSet*>* successors() { return successors_; }
109
110 OutSet(uint32_t first, ZoneGrowableArray<unsigned>* remaining)
111 : first_(first), remaining_(remaining), successors_(nullptr) {}
112 uint32_t first_;
113 ZoneGrowableArray<unsigned>* remaining_;
114 ZoneGrowableArray<OutSet*>* successors_;
115 friend class Trace;
116};
117
118// A mapping from integers, specified as ranges, to a set of integers.
119// Used for mapping character ranges to choices.
120class ChoiceTable : public ValueObject {
121 public:
122 explicit ChoiceTable(Zone* zone) : tree_(zone) {}
123
124 class Entry {
125 public:
126 Entry() : from_(0), to_(0), out_set_(nullptr) {}
127 Entry(int32_t from, int32_t to, OutSet* out_set)
128 : from_(from), to_(to), out_set_(out_set) {
129 ASSERT(from <= to);
130 }
131 int32_t from() { return from_; }
132 int32_t to() { return to_; }
133 void set_to(int32_t value) { to_ = value; }
134 void AddValue(int value, Zone* zone) {
135 out_set_ = out_set_->Extend(value, zone);
136 }
137 OutSet* out_set() { return out_set_; }
138
139 private:
140 int32_t from_;
141 int32_t to_;
142 OutSet* out_set_;
143 };
144
145 class Config {
146 public:
147 typedef int32_t Key;
148 typedef Entry Value;
149 static const int32_t kNoKey;
150 static const Entry NoValue() { return Value(); }
151 static inline int Compare(int32_t a, int32_t b) {
152 if (a == b)
153 return 0;
154 else if (a < b)
155 return -1;
156 else
157 return 1;
158 }
159 };
160
161 void AddRange(CharacterRange range, int32_t value, Zone* zone);
162 OutSet* Get(int32_t value);
163 void Dump();
164
165 template <typename Callback>
166 void ForEach(Callback* callback) {
167 return tree()->ForEach(callback);
168 }
169
170 private:
171 // There can't be a static empty set since it allocates its
172 // successors in a zone and caches them.
173 OutSet* empty() { return &empty_; }
174 OutSet empty_;
175 ZoneSplayTree<Config>* tree() { return &tree_; }
176 ZoneSplayTree<Config> tree_;
177};
178
179// Categorizes character ranges into BMP, non-BMP, lead, and trail surrogates.
181 public:
183 void Call(uint32_t from, ChoiceTable::Entry entry);
184
187 return lead_surrogates_;
188 }
190 return trail_surrogates_;
191 }
192 ZoneGrowableArray<CharacterRange>* non_bmp() const { return non_bmp_; }
193
194 private:
195 static constexpr int kBase = 0;
196 // Separate ranges into
197 static constexpr int kBmpCodePoints = 1;
198 static constexpr int kLeadSurrogates = 2;
199 static constexpr int kTrailSurrogates = 3;
200 static constexpr int kNonBmpCodePoints = 4;
201
202 Zone* zone_;
203 ChoiceTable table_;
205 ZoneGrowableArray<CharacterRange>* lead_surrogates_;
206 ZoneGrowableArray<CharacterRange>* trail_surrogates_;
208};
209
210#define FOR_EACH_NODE_TYPE(VISIT) \
211 VISIT(End) \
212 VISIT(Action) \
213 VISIT(Choice) \
214 VISIT(BackReference) \
215 VISIT(Assertion) \
216 VISIT(Text)
217
218#define FOR_EACH_REG_EXP_TREE_TYPE(VISIT) \
219 VISIT(Disjunction) \
220 VISIT(Alternative) \
221 VISIT(Assertion) \
222 VISIT(CharacterClass) \
223 VISIT(Atom) \
224 VISIT(Quantifier) \
225 VISIT(Capture) \
226 VISIT(Lookaround) \
227 VISIT(BackReference) \
228 VISIT(Empty) \
229 VISIT(Text)
230
231#define FORWARD_DECLARE(Name) class RegExp##Name;
233#undef FORWARD_DECLARE
234
236 public:
238
241
242 intptr_t cp_offset() const { return cp_offset_; }
243 void set_cp_offset(intptr_t cp_offset) { cp_offset_ = cp_offset; }
244 intptr_t length() const;
245
246 TextType text_type() const { return text_type_; }
247
248 RegExpTree* tree() const { return tree_; }
249
250 RegExpAtom* atom() const {
251 ASSERT(text_type() == ATOM);
252 return reinterpret_cast<RegExpAtom*>(tree());
253 }
254
257 return reinterpret_cast<RegExpCharacterClass*>(tree());
258 }
259
260 private:
262 : cp_offset_(-1), text_type_(text_type), tree_(tree) {}
263
264 intptr_t cp_offset_;
265 TextType text_type_;
266 RegExpTree* tree_;
267
268 DISALLOW_ALLOCATION();
269};
270
271class Trace;
272struct PreloadState;
273class GreedyLoopState;
274class AlternativeGenerationList;
275
276struct NodeInfo {
286
287 // Returns true if the interests and assumptions of this node
288 // matches the given one.
295
296 // Updates the interests of this node given the interests of the
297 // node preceding it.
304
309
310 // Sets the interests of this node to include the interests of the
311 // following node.
317
319 being_analyzed = false;
320 been_analyzed = false;
321 }
322
325
326 // These bits are set of this node has to know what the preceding
327 // character was.
331
332 bool at_end : 1;
333 bool visited : 1;
335};
336
337// Details of a quick mask-compare check that can look ahead in the
338// input stream.
340 public:
342 : characters_(0), mask_(0), value_(0), cannot_match_(false) {}
343 explicit QuickCheckDetails(intptr_t characters)
344 : characters_(characters), mask_(0), value_(0), cannot_match_(false) {}
345 bool Rationalize(bool one_byte);
346 // Merge in the information from another branch of an alternation.
347 void Merge(QuickCheckDetails* other, intptr_t from_index);
348 // Advance the current position by some amount.
349 void Advance(intptr_t by, bool one_byte);
350 void Clear();
351 bool cannot_match() { return cannot_match_; }
352 void set_cannot_match() { cannot_match_ = true; }
353 struct Position {
355 uint16_t mask;
356 uint16_t value;
358 };
359 intptr_t characters() { return characters_; }
360 void set_characters(intptr_t characters) { characters_ = characters; }
361 Position* positions(intptr_t index) {
362 ASSERT(index >= 0);
363 ASSERT(index < characters_);
364 return positions_ + index;
365 }
366 uint32_t mask() { return mask_; }
367 uint32_t value() { return value_; }
368
369 private:
370 // How many characters do we have quick check information from. This is
371 // the same for all branches of a choice node.
372 intptr_t characters_;
373 Position positions_[4];
374 // These values are the condensate of the above array after Rationalize().
375 uint32_t mask_;
376 uint32_t value_;
377 // If set to true, there is no way this quick check can match at all.
378 // E.g., if it requires to be at the start of the input, and isn't.
379 bool cannot_match_;
380
381 DISALLOW_ALLOCATION();
382};
383
384class RegExpNode : public ZoneAllocated {
385 public:
387 : replacement_(nullptr), trace_count_(0), zone_(zone) {
388 bm_info_[0] = bm_info_[1] = nullptr;
389 }
390 virtual ~RegExpNode();
391 virtual void Accept(NodeVisitor* visitor) = 0;
392 // Generates a goto to this node or actually generates the code at this point.
393 virtual void Emit(RegExpCompiler* compiler, Trace* trace) = 0;
394 // How many characters must this node consume at a minimum in order to
395 // succeed. If we have found at least 'still_to_find' characters that
396 // must be consumed there is no need to ask any following nodes whether
397 // they are sure to eat any more characters. The not_at_start argument is
398 // used to indicate that we know we are not at the start of the input. In
399 // this case anchored branches will always fail and can be ignored when
400 // determining how many characters are consumed on success.
401 virtual intptr_t EatsAtLeast(intptr_t still_to_find,
402 intptr_t budget,
403 bool not_at_start) = 0;
404 // Emits some quick code that checks whether the preloaded characters match.
405 // Falls through on certain failure, jumps to the label on possible success.
406 // If the node cannot make a quick check it does nothing and returns false.
408 Trace* bounds_check_trace,
409 Trace* trace,
410 bool preload_has_checked_bounds,
411 BlockLabel* on_possible_success,
412 QuickCheckDetails* details_return,
413 bool fall_through_on_failure);
414 // For a given number of characters this returns a mask and a value. The
415 // next n characters are anded with the mask and compared with the value.
416 // A comparison failure indicates the node cannot match the next n characters.
417 // A comparison success indicates the node may match.
420 intptr_t characters_filled_in,
421 bool not_at_start) = 0;
422 static constexpr intptr_t kNodeIsTooComplexForGreedyLoops = -1;
423 virtual intptr_t GreedyLoopTextLength() {
425 }
426 // Only returns the successor for a text node of length 1 that matches any
427 // character and that has no guards on it.
430 return nullptr;
431 }
432
433 // Collects information on the possible code units (mod 128) that can match if
434 // we look forward. This is used for a Boyer-Moore-like string searching
435 // implementation. TODO(erikcorry): This should share more code with
436 // EatsAtLeast, GetQuickCheckDetails. The budget argument is used to limit
437 // the number of nodes we are willing to look at in order to create this data.
438 static constexpr intptr_t kRecursionBudget = 200;
439 virtual void FillInBMInfo(intptr_t offset,
440 intptr_t budget,
442 bool not_at_start) {
443 UNREACHABLE();
444 }
445
446 // If we know that the input is one-byte then there are some nodes that can
447 // never match. This method returns a node that can be substituted for
448 // itself, or nullptr if the node can never match.
449 virtual RegExpNode* FilterOneByte(intptr_t depth) { return this; }
450 // Helper for FilterOneByte.
452 ASSERT(info()->replacement_calculated);
453 return replacement_;
454 }
458 return replacement; // For convenience.
459 }
460
461 // We want to avoid recalculating the lookahead info, so we store it on the
462 // node. Only info that is for this node is stored. We can tell that the
463 // info is for this node when offset == 0, so the information is calculated
464 // relative to this node.
465 void SaveBMInfo(BoyerMooreLookahead* bm, bool not_at_start, intptr_t offset) {
466 if (offset == 0) set_bm_info(not_at_start, bm);
467 }
468
469 BlockLabel* label() { return &label_; }
470 // If non-generic code is generated for a node (i.e. the node is not at the
471 // start of the trace) then it cannot be reused. This variable sets a limit
472 // on how often we allow that to happen before we insist on starting a new
473 // trace and generating generic code for a node that can be reused by flushing
474 // the deferred actions in the current trace and generating a goto.
475 static constexpr intptr_t kMaxCopiesCodeGenerated = 10;
476
477 NodeInfo* info() { return &info_; }
478
479 BoyerMooreLookahead* bm_info(bool not_at_start) {
480 return bm_info_[not_at_start ? 1 : 0];
481 }
482
483 Zone* zone() const { return zone_; }
484
485 protected:
488
490
491 void set_bm_info(bool not_at_start, BoyerMooreLookahead* bm) {
492 bm_info_[not_at_start ? 1 : 0] = bm;
493 }
494
495 private:
496 static constexpr intptr_t kFirstCharBudget = 10;
497 BlockLabel label_;
498 NodeInfo info_;
499 // This variable keeps track of how many times code has been generated for
500 // this node (in different traces). We don't keep track of where the
501 // generated code is located unless the code is generated at the start of
502 // a trace, in which case it is generic and can be reused by flushing the
503 // deferred operations in the current trace and generating a goto.
504 intptr_t trace_count_;
505 BoyerMooreLookahead* bm_info_[2];
506 Zone* zone_;
507};
508
509// A simple closed interval.
510class Interval {
511 public:
512 Interval() : from_(kNone), to_(kNone) {}
513 Interval(intptr_t from, intptr_t to) : from_(from), to_(to) {}
514
516 if (that.from_ == kNone)
517 return *this;
518 else if (from_ == kNone)
519 return that;
520 else
521 return Interval(Utils::Minimum(from_, that.from_),
522 Utils::Maximum(to_, that.to_));
523 }
524 bool Contains(intptr_t value) const {
525 return (from_ <= value) && (value <= to_);
526 }
527 bool is_empty() const { return from_ == kNone; }
528 intptr_t from() const { return from_; }
529 intptr_t to() const { return to_; }
530 static Interval Empty() { return Interval(); }
531 static constexpr intptr_t kNone = -1;
532
533 private:
534 intptr_t from_;
535 intptr_t to_;
536
537 DISALLOW_ALLOCATION();
538};
539
540class SeqRegExpNode : public RegExpNode {
541 public:
544 RegExpNode* on_success() { return on_success_; }
545 void set_on_success(RegExpNode* node) { on_success_ = node; }
546 virtual RegExpNode* FilterOneByte(intptr_t depth);
547 virtual void FillInBMInfo(intptr_t offset,
548 intptr_t budget,
550 bool not_at_start) {
551 on_success_->FillInBMInfo(offset, budget - 1, bm, not_at_start);
552 if (offset == 0) set_bm_info(not_at_start, bm);
553 }
554
555 protected:
556 RegExpNode* FilterSuccessor(intptr_t depth);
557
558 private:
559 RegExpNode* on_success_;
560};
561
562class ActionNode : public SeqRegExpNode {
563 public:
573 static ActionNode* SetRegister(intptr_t reg,
574 intptr_t val,
577 static ActionNode* StorePosition(intptr_t reg,
578 bool is_capture,
581 static ActionNode* BeginSubmatch(intptr_t stack_pointer_reg,
582 intptr_t position_reg,
584 static ActionNode* PositiveSubmatchSuccess(intptr_t stack_pointer_reg,
585 intptr_t restore_reg,
586 intptr_t clear_capture_count,
587 intptr_t clear_capture_from,
590 intptr_t repetition_register,
591 intptr_t repetition_limit,
593 virtual void Accept(NodeVisitor* visitor);
594 virtual void Emit(RegExpCompiler* compiler, Trace* trace);
595 virtual intptr_t EatsAtLeast(intptr_t still_to_find,
596 intptr_t budget,
597 bool not_at_start);
600 intptr_t filled_in,
601 bool not_at_start) {
602 return on_success()->GetQuickCheckDetails(details, compiler, filled_in,
603 not_at_start);
604 }
605 virtual void FillInBMInfo(intptr_t offset,
606 intptr_t budget,
608 bool not_at_start);
609 ActionType action_type() { return action_type_; }
610 // TODO(erikcorry): We should allow some action nodes in greedy loops.
611 virtual intptr_t GreedyLoopTextLength() {
613 }
614
615 private:
616 union {
617 struct {
618 intptr_t reg;
619 intptr_t value;
621 struct {
622 intptr_t reg;
624 struct {
625 intptr_t reg;
628 struct {
634 struct {
639 struct {
640 intptr_t range_from;
641 intptr_t range_to;
643 } data_;
644 ActionNode(ActionType action_type, RegExpNode* on_success)
645 : SeqRegExpNode(on_success), action_type_(action_type) {}
646 ActionType action_type_;
647 friend class DotPrinter;
648};
649
650class TextNode : public SeqRegExpNode {
651 public:
657 bool read_backward,
660 elms_(new(zone()) ZoneGrowableArray<TextElement>(1)),
661 read_backward_(read_backward) {
662 elms_->Add(TextElement::CharClass(that));
663 }
664 // Create TextNode for a single character class for the given ranges.
667 bool read_backward,
670 // Create TextNode for a surrogate pair with a range given for the
671 // lead and the trail surrogate each.
673 CharacterRange trail,
674 bool read_backward,
677 virtual void Accept(NodeVisitor* visitor);
678 virtual void Emit(RegExpCompiler* compiler, Trace* trace);
679 virtual intptr_t EatsAtLeast(intptr_t still_to_find,
680 intptr_t budget,
681 bool not_at_start);
682 virtual void GetQuickCheckDetails(QuickCheckDetails* details,
684 intptr_t characters_filled_in,
685 bool not_at_start);
687 bool read_backward() { return read_backward_; }
688 void MakeCaseIndependent(bool is_one_byte);
689 virtual intptr_t GreedyLoopTextLength();
692 virtual void FillInBMInfo(intptr_t offset,
693 intptr_t budget,
695 bool not_at_start);
696 void CalculateOffsets();
697 virtual RegExpNode* FilterOneByte(intptr_t depth);
698
699 private:
700 enum TextEmitPassType {
701 NON_LATIN1_MATCH, // Check for characters that can't match.
702 SIMPLE_CHARACTER_MATCH, // Case-dependent single character check.
703 NON_LETTER_CHARACTER_MATCH, // Check characters that have no case equivs.
704 CASE_CHARACTER_MATCH, // Case-independent single character check.
705 CHARACTER_CLASS_MATCH // Character class.
706 };
707 static bool SkipPass(intptr_t pass, bool ignore_case);
708 static constexpr intptr_t kFirstRealPass = SIMPLE_CHARACTER_MATCH;
709 static constexpr intptr_t kLastPass = CHARACTER_CLASS_MATCH;
710 void TextEmitPass(RegExpCompiler* compiler,
711 TextEmitPassType pass,
712 bool preloaded,
713 Trace* trace,
714 bool first_element_checked,
715 intptr_t* checked_up_to);
716 intptr_t Length();
717 ZoneGrowableArray<TextElement>* elms_;
718 bool read_backward_;
719};
720
722 public:
745 virtual void Accept(NodeVisitor* visitor);
746 virtual void Emit(RegExpCompiler* compiler, Trace* trace);
747 virtual intptr_t EatsAtLeast(intptr_t still_to_find,
748 intptr_t budget,
749 bool not_at_start);
750 virtual void GetQuickCheckDetails(QuickCheckDetails* details,
752 intptr_t filled_in,
753 bool not_at_start);
754 virtual void FillInBMInfo(intptr_t offset,
755 intptr_t budget,
757 bool not_at_start);
758 AssertionType assertion_type() { return assertion_type_; }
759
760 private:
761 void EmitBoundaryCheck(RegExpCompiler* compiler, Trace* trace);
762 enum IfPrevious { kIsNonWord, kIsWord };
763 void BacktrackIfPrevious(RegExpCompiler* compiler,
764 Trace* trace,
765 IfPrevious backtrack_if_previous);
766 AssertionNode(AssertionType t, RegExpNode* on_success)
767 : SeqRegExpNode(on_success), assertion_type_(t) {}
768 AssertionType assertion_type_;
769};
770
772 public:
773 BackReferenceNode(intptr_t start_reg,
774 intptr_t end_reg,
776 bool read_backward,
779 start_reg_(start_reg),
780 end_reg_(end_reg),
781 flags_(flags),
782 read_backward_(read_backward) {}
783 virtual void Accept(NodeVisitor* visitor);
784 intptr_t start_register() { return start_reg_; }
785 intptr_t end_register() { return end_reg_; }
786 bool read_backward() { return read_backward_; }
787 virtual void Emit(RegExpCompiler* compiler, Trace* trace);
788 virtual intptr_t EatsAtLeast(intptr_t still_to_find,
789 intptr_t recursion_depth,
790 bool not_at_start);
793 intptr_t characters_filled_in,
794 bool not_at_start) {
795 return;
796 }
797 virtual void FillInBMInfo(intptr_t offset,
798 intptr_t budget,
800 bool not_at_start);
801
802 private:
803 intptr_t start_reg_;
804 intptr_t end_reg_;
805 RegExpFlags flags_;
806 bool read_backward_;
807};
808
809class EndNode : public RegExpNode {
810 public:
813 : RegExpNode(zone), action_(action) {}
814 virtual void Accept(NodeVisitor* visitor);
815 virtual void Emit(RegExpCompiler* compiler, Trace* trace);
816 virtual intptr_t EatsAtLeast(intptr_t still_to_find,
817 intptr_t recursion_depth,
818 bool not_at_start) {
819 return 0;
820 }
823 intptr_t characters_filled_in,
824 bool not_at_start) {
825 // Returning 0 from EatsAtLeast should ensure we never get here.
826 UNREACHABLE();
827 }
828 virtual void FillInBMInfo(intptr_t offset,
829 intptr_t budget,
831 bool not_at_start) {
832 // Returning 0 from EatsAtLeast should ensure we never get here.
833 UNREACHABLE();
834 }
835
836 private:
837 Action action_;
838};
839
841 public:
842 NegativeSubmatchSuccess(intptr_t stack_pointer_reg,
843 intptr_t position_reg,
844 intptr_t clear_capture_count,
845 intptr_t clear_capture_start,
846 Zone* zone)
848 stack_pointer_register_(stack_pointer_reg),
849 current_position_register_(position_reg),
850 clear_capture_count_(clear_capture_count),
851 clear_capture_start_(clear_capture_start) {}
852 virtual void Emit(RegExpCompiler* compiler, Trace* trace);
853
854 private:
855 intptr_t stack_pointer_register_;
856 intptr_t current_position_register_;
857 intptr_t clear_capture_count_;
858 intptr_t clear_capture_start_;
859};
860
861class Guard : public ZoneAllocated {
862 public:
863 enum Relation { LT, GEQ };
864 Guard(intptr_t reg, Relation op, intptr_t value)
865 : reg_(reg), op_(op), value_(value) {}
866 intptr_t reg() { return reg_; }
867 Relation op() { return op_; }
868 intptr_t value() { return value_; }
869
870 private:
871 intptr_t reg_;
872 Relation op_;
873 intptr_t value_;
874};
875
877 public:
879 : node_(node), guards_(nullptr) {}
880 void AddGuard(Guard* guard, Zone* zone);
881 RegExpNode* node() const { return node_; }
882 void set_node(RegExpNode* node) { node_ = node; }
883 ZoneGrowableArray<Guard*>* guards() const { return guards_; }
884
885 private:
886 RegExpNode* node_;
888
889 DISALLOW_ALLOCATION();
890};
891
892struct AlternativeGeneration;
893
894class ChoiceNode : public RegExpNode {
895 public:
896 explicit ChoiceNode(intptr_t expected_size, Zone* zone)
897 : RegExpNode(zone),
899 ZoneGrowableArray<GuardedAlternative>(expected_size)),
900 not_at_start_(false),
901 being_calculated_(false) {}
902 virtual void Accept(NodeVisitor* visitor);
903 void AddAlternative(GuardedAlternative node) { alternatives()->Add(node); }
907 virtual void Emit(RegExpCompiler* compiler, Trace* trace);
908 virtual intptr_t EatsAtLeast(intptr_t still_to_find,
909 intptr_t budget,
910 bool not_at_start);
911 intptr_t EatsAtLeastHelper(intptr_t still_to_find,
912 intptr_t budget,
913 RegExpNode* ignore_this_node,
914 bool not_at_start);
915 virtual void GetQuickCheckDetails(QuickCheckDetails* details,
917 intptr_t characters_filled_in,
918 bool not_at_start);
919 virtual void FillInBMInfo(intptr_t offset,
920 intptr_t budget,
922 bool not_at_start);
923
924 bool being_calculated() { return being_calculated_; }
925 bool not_at_start() { return not_at_start_; }
926 void set_not_at_start() { not_at_start_ = true; }
927 void set_being_calculated(bool b) { being_calculated_ = b; }
928 virtual bool try_to_emit_quick_check_for_alternative(bool is_first) {
929 return true;
930 }
931 virtual RegExpNode* FilterOneByte(intptr_t depth);
932 virtual bool read_backward() { return false; }
933
934 protected:
936 const GuardedAlternative* alternative);
938
939 private:
940 friend class Analysis;
941 void GenerateGuard(RegExpMacroAssembler* macro_assembler,
942 Guard* guard,
943 Trace* trace);
944 intptr_t CalculatePreloadCharacters(RegExpCompiler* compiler,
945 intptr_t eats_at_least);
946 void EmitOutOfLineContinuation(RegExpCompiler* compiler,
947 Trace* trace,
948 GuardedAlternative alternative,
949 AlternativeGeneration* alt_gen,
950 intptr_t preload_characters,
951 bool next_expects_preload);
952 void SetUpPreLoad(RegExpCompiler* compiler,
953 Trace* current_trace,
954 PreloadState* preloads);
955 void AssertGuardsMentionRegisters(Trace* trace);
956 intptr_t EmitOptimizedUnanchoredSearch(RegExpCompiler* compiler,
957 Trace* trace);
958 Trace* EmitGreedyLoop(RegExpCompiler* compiler,
959 Trace* trace,
961 PreloadState* preloads,
962 GreedyLoopState* greedy_loop_state,
963 intptr_t text_length);
964 void EmitChoices(RegExpCompiler* compiler,
966 intptr_t first_choice,
967 Trace* trace,
968 PreloadState* preloads);
969 // If true, this node is never checked at the start of the input.
970 // Allows a new trace to start with at_start() set to false.
971 bool not_at_start_;
972 bool being_calculated_;
973};
974
976 public:
978 GuardedAlternative then_do_this,
979 Zone* zone)
980 : ChoiceNode(2, zone) {
981 AddAlternative(this_must_fail);
982 AddAlternative(then_do_this);
983 }
984 virtual intptr_t EatsAtLeast(intptr_t still_to_find,
985 intptr_t budget,
986 bool not_at_start);
987 virtual void GetQuickCheckDetails(QuickCheckDetails* details,
989 intptr_t characters_filled_in,
990 bool not_at_start);
991 virtual void FillInBMInfo(intptr_t offset,
992 intptr_t budget,
994 bool not_at_start) {
995 (*alternatives_)[1].node()->FillInBMInfo(offset, budget - 1, bm,
997 if (offset == 0) set_bm_info(not_at_start, bm);
998 }
999 // For a negative lookahead we don't emit the quick check for the
1000 // alternative that is expected to fail. This is because quick check code
1001 // starts by loading enough characters for the alternative that takes fewest
1002 // characters, but on a negative lookahead the negative branch did not take
1003 // part in that calculation (EatsAtLeast) so the assumptions don't hold.
1004 virtual bool try_to_emit_quick_check_for_alternative(bool is_first) {
1005 return !is_first;
1006 }
1007 virtual RegExpNode* FilterOneByte(intptr_t depth);
1008};
1009
1011 public:
1013 bool read_backward,
1014 Zone* zone)
1015 : ChoiceNode(2, zone),
1016 loop_node_(nullptr),
1017 continue_node_(nullptr),
1018 body_can_be_zero_length_(body_can_be_zero_length),
1019 read_backward_(read_backward) {}
1022 virtual void Emit(RegExpCompiler* compiler, Trace* trace);
1023 virtual intptr_t EatsAtLeast(intptr_t still_to_find,
1024 intptr_t budget,
1025 bool not_at_start);
1026 virtual void GetQuickCheckDetails(QuickCheckDetails* details,
1028 intptr_t characters_filled_in,
1029 bool not_at_start);
1030 virtual void FillInBMInfo(intptr_t offset,
1031 intptr_t budget,
1033 bool not_at_start);
1034 RegExpNode* loop_node() { return loop_node_; }
1035 RegExpNode* continue_node() { return continue_node_; }
1036 bool body_can_be_zero_length() { return body_can_be_zero_length_; }
1037 virtual bool read_backward() { return read_backward_; }
1038 virtual void Accept(NodeVisitor* visitor);
1039 virtual RegExpNode* FilterOneByte(intptr_t depth);
1040
1041 private:
1042 // AddAlternative is made private for loop nodes because alternatives
1043 // should not be added freely, we need to keep track of which node
1044 // goes back to the node itself.
1045 void AddAlternative(GuardedAlternative node) {
1047 }
1048
1049 RegExpNode* loop_node_;
1050 RegExpNode* continue_node_;
1051 bool body_can_be_zero_length_;
1052 bool read_backward_;
1053};
1054
1055// Improve the speed that we scan for an initial point where a non-anchored
1056// regexp can match by using a Boyer-Moore-like table. This is done by
1057// identifying non-greedy non-capturing loops in the nodes that eat any
1058// character one at a time. For example in the middle of the regexp
1059// /foo[\s\S]*?bar/ we find such a loop. There is also such a loop implicitly
1060// inserted at the start of any non-anchored regexp.
1061//
1062// When we have found such a loop we look ahead in the nodes to find the set of
1063// characters that can come at given distances. For example for the regexp
1064// /.?foo/ we know that there are at least 3 characters ahead of us, and the
1065// sets of characters that can occur are [any, [f, o], [o]]. We find a range in
1066// the lookahead info where the set of characters is reasonably constrained. In
1067// our example this is from index 1 to 2 (0 is not constrained). We can now
1068// look 3 characters ahead and if we don't find one of [f, o] (the union of
1069// [f, o] and [o]) then we can skip forwards by the range size (in this case 2).
1070//
1071// For Unicode input strings we do the same, but modulo 128.
1072//
1073// We also look at the first string fed to the regexp and use that to get a hint
1074// of the character frequencies in the inputs. This affects the assessment of
1075// whether the set of characters is 'reasonably constrained'.
1076//
1077// We also have another lookahead mechanism (called quick check in the code),
1078// which uses a wide load of multiple characters followed by a mask and compare
1079// to determine whether a match is possible at this point.
1084 kLatticeUnknown = 3 // Can also mean both in and out.
1086
1090
1092 const intptr_t* ranges,
1093 intptr_t ranges_size,
1094 Interval new_range);
1095
1097 public:
1099 : map_(new(zone) ZoneGrowableArray<bool>(kMapSize)),
1100 map_count_(0),
1101 w_(kNotYet),
1102 s_(kNotYet),
1103 d_(kNotYet),
1104 surrogate_(kNotYet) {
1105 for (intptr_t i = 0; i < kMapSize; i++) {
1106 map_->Add(false);
1107 }
1108 }
1109
1110 bool& at(intptr_t i) { return (*map_)[i]; }
1111
1112 static constexpr intptr_t kMapSize = 128;
1113 static constexpr intptr_t kMask = kMapSize - 1;
1114
1115 intptr_t map_count() const { return map_count_; }
1116
1117 void Set(intptr_t character);
1118 void SetInterval(const Interval& interval);
1119 void SetAll();
1120 bool is_non_word() { return w_ == kLatticeOut; }
1121 bool is_word() { return w_ == kLatticeIn; }
1122
1123 private:
1125 intptr_t map_count_; // Number of set bits in the map.
1126 ContainedInLattice w_; // The \w character class.
1127 ContainedInLattice s_; // The \s character class.
1128 ContainedInLattice d_; // The \d character class.
1129 ContainedInLattice surrogate_; // Surrogate UTF-16 code units.
1130};
1131
1133 public:
1135
1136 intptr_t length() { return length_; }
1137 intptr_t max_char() { return max_char_; }
1138 RegExpCompiler* compiler() { return compiler_; }
1139
1140 intptr_t Count(intptr_t map_number) {
1141 return bitmaps_->At(map_number)->map_count();
1142 }
1143
1144 BoyerMoorePositionInfo* at(intptr_t i) { return bitmaps_->At(i); }
1145
1146 void Set(intptr_t map_number, intptr_t character) {
1147 if (character > max_char_) return;
1148 BoyerMoorePositionInfo* info = bitmaps_->At(map_number);
1149 info->Set(character);
1150 }
1151
1152 void SetInterval(intptr_t map_number, const Interval& interval) {
1153 if (interval.from() > max_char_) return;
1154 BoyerMoorePositionInfo* info = bitmaps_->At(map_number);
1155 if (interval.to() > max_char_) {
1156 info->SetInterval(Interval(interval.from(), max_char_));
1157 } else {
1158 info->SetInterval(interval);
1159 }
1160 }
1161
1162 void SetAll(intptr_t map_number) { bitmaps_->At(map_number)->SetAll(); }
1163
1164 void SetRest(intptr_t from_map) {
1165 for (intptr_t i = from_map; i < length_; i++)
1166 SetAll(i);
1167 }
1169
1170 private:
1171 // This is the value obtained by EatsAtLeast. If we do not have at least this
1172 // many characters left in the sample string then the match is bound to fail.
1173 // Therefore it is OK to read a character this far ahead of the current match
1174 // point.
1175 intptr_t length_;
1176 RegExpCompiler* compiler_;
1177 // 0xff for Latin1, 0xffff for UTF-16.
1178 intptr_t max_char_;
1180
1181 intptr_t GetSkipTable(intptr_t min_lookahead,
1182 intptr_t max_lookahead,
1183 const TypedData& boolean_skip_table);
1184 bool FindWorthwhileInterval(intptr_t* from, intptr_t* to);
1185 intptr_t FindBestInterval(intptr_t max_number_of_chars,
1186 intptr_t old_biggest_points,
1187 intptr_t* from,
1188 intptr_t* to);
1189};
1190
1191// There are many ways to generate code for a node. This class encapsulates
1192// the current way we should be generating. In other words it encapsulates
1193// the current state of the code generator. The effect of this is that we
1194// generate code for paths that the matcher can take through the regular
1195// expression. A given node in the regexp can be code-generated several times
1196// as it can be part of several traces. For example for the regexp:
1197// /foo(bar|ip)baz/ the code to match baz will be generated twice, once as part
1198// of the foo-bar-baz trace and once as part of the foo-ip-baz trace. The code
1199// to match foo is generated only once (the traces have a common prefix). The
1200// code to store the capture is deferred and generated (twice) after the places
1201// where baz has been matched.
1202class Trace {
1203 public:
1204 // A value for a property that is either known to be true, know to be false,
1205 // or not known.
1206 enum TriBool { UNKNOWN = -1, FALSE_VALUE = 0, TRUE_VALUE = 1 };
1207
1209 public:
1211 : action_type_(action_type), reg_(reg), next_(nullptr) {}
1212 DeferredAction* next() { return next_; }
1213 bool Mentions(intptr_t reg);
1214 intptr_t reg() { return reg_; }
1215 ActionNode::ActionType action_type() { return action_type_; }
1216
1217 private:
1218 ActionNode::ActionType action_type_;
1219 intptr_t reg_;
1220 DeferredAction* next_;
1221 friend class Trace;
1222
1224 };
1225
1227 public:
1228 DeferredCapture(intptr_t reg, bool is_capture, Trace* trace)
1229 : DeferredAction(ActionNode::STORE_POSITION, reg),
1230 cp_offset_(trace->cp_offset()),
1231 is_capture_(is_capture) {}
1232 intptr_t cp_offset() { return cp_offset_; }
1233 bool is_capture() { return is_capture_; }
1234
1235 private:
1236 intptr_t cp_offset_;
1237 bool is_capture_;
1238 void set_cp_offset(intptr_t cp_offset) { cp_offset_ = cp_offset; }
1239 };
1240
1242 public:
1243 DeferredSetRegister(intptr_t reg, intptr_t value)
1244 : DeferredAction(ActionNode::SET_REGISTER, reg), value_(value) {}
1245 intptr_t value() { return value_; }
1246
1247 private:
1248 intptr_t value_;
1249 };
1250
1252 public:
1254 : DeferredAction(ActionNode::CLEAR_CAPTURES, -1), range_(range) {}
1255 Interval range() { return range_; }
1256
1257 private:
1258 Interval range_;
1259 };
1260
1262 public:
1264 : DeferredAction(ActionNode::INCREMENT_REGISTER, reg) {}
1265 };
1266
1268 : cp_offset_(0),
1269 actions_(nullptr),
1270 backtrack_(nullptr),
1271 stop_node_(nullptr),
1272 loop_label_(nullptr),
1273 characters_preloaded_(0),
1274 bound_checked_up_to_(0),
1275 flush_budget_(100),
1276 at_start_(UNKNOWN) {}
1277
1278 // End the trace. This involves flushing the deferred actions in the trace
1279 // and pushing a backtrack location onto the backtrack stack. Once this is
1280 // done we can start a new trace or go to one that has already been
1281 // generated.
1282 void Flush(RegExpCompiler* compiler, RegExpNode* successor);
1283 intptr_t cp_offset() { return cp_offset_; }
1284 DeferredAction* actions() { return actions_; }
1285 // A trivial trace is one that has no deferred actions or other state that
1286 // affects the assumptions used when generating code. There is no recorded
1287 // backtrack location in a trivial trace, so with a trivial trace we will
1288 // generate code that, on a failure to match, gets the backtrack location
1289 // from the backtrack stack rather than using a direct jump instruction. We
1290 // always start code generation with a trivial trace and non-trivial traces
1291 // are created as we emit code for nodes or add to the list of deferred
1292 // actions in the trace. The location of the code generated for a node using
1293 // a trivial trace is recorded in a label in the node so that gotos can be
1294 // generated to that code.
1295 bool is_trivial() {
1296 return backtrack_ == nullptr && actions_ == nullptr && cp_offset_ == 0 &&
1297 characters_preloaded_ == 0 && bound_checked_up_to_ == 0 &&
1298 quick_check_performed_.characters() == 0 && at_start_ == UNKNOWN;
1299 }
1300 TriBool at_start() { return at_start_; }
1301 void set_at_start(TriBool at_start) { at_start_ = at_start; }
1302 BlockLabel* backtrack() { return backtrack_; }
1303 BlockLabel* loop_label() { return loop_label_; }
1304 RegExpNode* stop_node() { return stop_node_; }
1305 intptr_t characters_preloaded() { return characters_preloaded_; }
1306 intptr_t bound_checked_up_to() { return bound_checked_up_to_; }
1307 intptr_t flush_budget() { return flush_budget_; }
1308 QuickCheckDetails* quick_check_performed() { return &quick_check_performed_; }
1309 bool mentions_reg(intptr_t reg);
1310 // Returns true if a deferred position store exists to the specified
1311 // register and stores the offset in the out-parameter. Otherwise
1312 // returns false.
1313 bool GetStoredPosition(intptr_t reg, intptr_t* cp_offset);
1314 // These set methods and AdvanceCurrentPositionInTrace should be used only on
1315 // new traces - the intention is that traces are immutable after creation.
1316 void add_action(DeferredAction* new_action) {
1317 ASSERT(new_action->next_ == nullptr);
1318 new_action->next_ = actions_;
1319 actions_ = new_action;
1320 }
1322 void set_stop_node(RegExpNode* node) { stop_node_ = node; }
1323 void set_loop_label(BlockLabel* label) { loop_label_ = label; }
1325 characters_preloaded_ = count;
1326 }
1327 void set_bound_checked_up_to(intptr_t to) { bound_checked_up_to_ = to; }
1328 void set_flush_budget(intptr_t to) { flush_budget_ = to; }
1330 quick_check_performed_ = *d;
1331 }
1334
1335 private:
1336 intptr_t FindAffectedRegisters(OutSet* affected_registers, Zone* zone);
1337 void PerformDeferredActions(RegExpMacroAssembler* macro,
1338 intptr_t max_register,
1339 const OutSet& affected_registers,
1340 OutSet* registers_to_pop,
1341 OutSet* registers_to_clear,
1342 Zone* zone);
1343 void RestoreAffectedRegisters(RegExpMacroAssembler* macro,
1344 intptr_t max_register,
1345 const OutSet& registers_to_pop,
1346 const OutSet& registers_to_clear);
1347 intptr_t cp_offset_;
1348 DeferredAction* actions_;
1349 BlockLabel* backtrack_;
1350 RegExpNode* stop_node_;
1351 BlockLabel* loop_label_;
1352 intptr_t characters_preloaded_;
1353 intptr_t bound_checked_up_to_;
1354 QuickCheckDetails quick_check_performed_;
1355 intptr_t flush_budget_;
1356 TriBool at_start_;
1357
1358 DISALLOW_ALLOCATION();
1359};
1360
1362 public:
1363 explicit GreedyLoopState(bool not_at_start);
1364
1365 BlockLabel* label() { return &label_; }
1366 Trace* counter_backtrack_trace() { return &counter_backtrack_trace_; }
1367
1368 private:
1369 BlockLabel label_;
1370 Trace counter_backtrack_trace_;
1371};
1372
1383
1384class NodeVisitor : public ValueObject {
1385 public:
1386 virtual ~NodeVisitor() {}
1387#define DECLARE_VISIT(Type) virtual void Visit##Type(Type##Node* that) = 0;
1389#undef DECLARE_VISIT
1390 virtual void VisitLoopChoice(LoopChoiceNode* that) { VisitChoice(that); }
1391};
1392
1393// Assertion propagation moves information about assertions such as
1394// \b to the affected nodes. For instance, in /.\b./ information must
1395// be propagated to the first '.' that whatever follows needs to know
1396// if it matched a word or a non-word, and to the second '.' that it
1397// has to check if it succeeds a word or non-word. In this case the
1398// result will be something like:
1399//
1400// +-------+ +------------+
1401// | . | | . |
1402// +-------+ ---> +------------+
1403// | word? | | check word |
1404// +-------+ +------------+
1405class Analysis : public NodeVisitor {
1406 public:
1407 explicit Analysis(bool is_one_byte)
1408 : is_one_byte_(is_one_byte), error_message_(nullptr) {}
1409 void EnsureAnalyzed(RegExpNode* node);
1410
1411#define DECLARE_VISIT(Type) virtual void Visit##Type(Type##Node* that);
1413#undef DECLARE_VISIT
1414 virtual void VisitLoopChoice(LoopChoiceNode* that);
1415
1416 bool has_failed() { return error_message_ != nullptr; }
1417 const char* error_message() {
1418 ASSERT(error_message_ != nullptr);
1419 return error_message_;
1420 }
1421 void fail(const char* error_message) { error_message_ = error_message; }
1422
1423 private:
1424 bool is_one_byte_;
1425 const char* error_message_;
1426
1428};
1429
1432 : tree(nullptr),
1433 node(nullptr),
1434 simple(true),
1436 capture_name_map(Array::Handle(Array::null())),
1437 error(String::Handle(String::null())),
1438 capture_count(0) {}
1446};
1447
1448class RegExpEngine : public AllStatic {
1449 public:
1451 explicit CompilationResult(const char* error_message)
1453#if !defined(DART_PRECOMPILED_RUNTIME)
1454 backtrack_goto(nullptr),
1455 graph_entry(nullptr),
1456 num_blocks(-1),
1457 num_stack_locals(-1),
1458#endif
1459 bytecode(nullptr),
1460 num_registers(-1) {
1461 }
1462
1464 : error_message(nullptr),
1465#if !defined(DART_PRECOMPILED_RUNTIME)
1466 backtrack_goto(nullptr),
1467 graph_entry(nullptr),
1468 num_blocks(-1),
1469 num_stack_locals(-1),
1470#endif
1473 }
1474
1475#if !defined(DART_PRECOMPILED_RUNTIME)
1477 GraphEntryInstr* graph_entry,
1478 intptr_t num_blocks,
1479 intptr_t num_stack_locals,
1480 intptr_t num_registers)
1481 : error_message(nullptr),
1482 backtrack_goto(backtrack_goto),
1483 graph_entry(graph_entry),
1484 num_blocks(num_blocks),
1485 num_stack_locals(num_stack_locals),
1486 bytecode(nullptr) {}
1487#endif
1488
1489 const char* error_message;
1490
1493 NOT_IN_PRECOMPILED(const intptr_t num_blocks);
1494 NOT_IN_PRECOMPILED(const intptr_t num_stack_locals);
1495
1498 };
1499
1500#if !defined(DART_PRECOMPILED_RUNTIME)
1502 RegExpCompileData* input,
1503 const ParsedFunction* parsed_function,
1504 const ZoneGrowableArray<const ICData*>& ic_data_array,
1505 intptr_t osr_id);
1506#endif
1507
1509 const RegExp& regexp,
1510 bool is_one_byte,
1511 bool sticky,
1512 Zone* zone);
1513
1514 static RegExpPtr CreateRegExp(Thread* thread,
1515 const String& pattern,
1517
1518 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case);
1519};
1520
1522 Zone* zone,
1523 const RegExp& regexp,
1524 intptr_t specialization_cid,
1525 bool sticky,
1526 const Object& owner);
1527
1528} // namespace dart
1529
1530#endif // RUNTIME_VM_REGEXP_H_
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
int count
#define UNREACHABLE()
Definition assert.h:248
intptr_t clear_register_from
Definition regexp.h:632
intptr_t reg
Definition regexp.h:618
intptr_t range_to
Definition regexp.h:641
intptr_t clear_register_count
Definition regexp.h:631
intptr_t value
Definition regexp.h:619
intptr_t range_from
Definition regexp.h:640
static ActionNode * BeginSubmatch(intptr_t stack_pointer_reg, intptr_t position_reg, RegExpNode *on_success)
Definition regexp.cc:792
static ActionNode * EmptyMatchCheck(intptr_t start_register, intptr_t repetition_register, intptr_t repetition_limit, RegExpNode *on_success)
Definition regexp.cc:816
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t filled_in, bool not_at_start)
Definition regexp.h:598
@ POSITIVE_SUBMATCH_SUCCESS
Definition regexp.h:569
intptr_t start_register
Definition regexp.h:635
virtual intptr_t GreedyLoopTextLength()
Definition regexp.h:611
struct dart::ActionNode::@201::@207 u_clear_captures
intptr_t repetition_register
Definition regexp.h:636
static ActionNode * SetRegister(intptr_t reg, intptr_t val, RegExpNode *on_success)
Definition regexp.cc:756
virtual void Accept(NodeVisitor *visitor)
static ActionNode * PositiveSubmatchSuccess(intptr_t stack_pointer_reg, intptr_t restore_reg, intptr_t clear_capture_count, intptr_t clear_capture_from, RegExpNode *on_success)
Definition regexp.cc:802
intptr_t repetition_limit
Definition regexp.h:637
virtual intptr_t EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start)
Definition regexp.cc:1473
intptr_t stack_pointer_register
Definition regexp.h:629
friend class DotPrinter
Definition regexp.h:647
struct dart::ActionNode::@201::@206 u_empty_match_check
static ActionNode * IncrementRegister(intptr_t reg, RegExpNode *on_success)
Definition regexp.cc:766
static ActionNode * ClearCaptures(Interval range, RegExpNode *on_success)
Definition regexp.cc:784
struct dart::ActionNode::@201::@205 u_submatch
virtual void Emit(RegExpCompiler *compiler, Trace *trace)
Definition regexp.cc:3407
struct dart::ActionNode::@201::@203 u_increment_register
ActionType action_type()
Definition regexp.h:609
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition regexp.cc:1481
struct dart::ActionNode::@201::@204 u_position_register
struct dart::ActionNode::@201::@202 u_store_register
static ActionNode * StorePosition(intptr_t reg, bool is_capture, RegExpNode *on_success)
Definition regexp.cc:774
intptr_t current_position_register
Definition regexp.h:630
void fail(const char *error_message)
Definition regexp.h:1421
void EnsureAnalyzed(RegExpNode *node)
Definition regexp.cc:5092
const char * error_message()
Definition regexp.h:1417
virtual void VisitLoopChoice(LoopChoiceNode *that)
Definition regexp.cc:5146
Analysis(bool is_one_byte)
Definition regexp.h:1407
bool has_failed()
Definition regexp.h:1416
static AssertionNode * AfterNewline(RegExpNode *on_success)
Definition regexp.h:742
virtual void Accept(NodeVisitor *visitor)
virtual intptr_t EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start)
Definition regexp.cc:1493
static AssertionNode * AtNonBoundary(RegExpNode *on_success)
Definition regexp.h:739
static AssertionNode * AtStart(RegExpNode *on_success)
Definition regexp.h:733
static AssertionNode * AtEnd(RegExpNode *on_success)
Definition regexp.h:730
static AssertionNode * AtBoundary(RegExpNode *on_success)
Definition regexp.h:736
AssertionType assertion_type()
Definition regexp.h:758
virtual void Emit(RegExpCompiler *compiler, Trace *trace)
Definition regexp.cc:2316
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t filled_in, bool not_at_start)
Definition regexp.cc:2304
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition regexp.cc:1506
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition regexp.cc:5172
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t characters_filled_in, bool not_at_start)
Definition regexp.h:791
intptr_t end_register()
Definition regexp.h:785
intptr_t start_register()
Definition regexp.h:784
virtual void Accept(NodeVisitor *visitor)
virtual void Emit(RegExpCompiler *compiler, Trace *trace)
Definition regexp.cc:3527
BackReferenceNode(intptr_t start_reg, intptr_t end_reg, RegExpFlags flags, bool read_backward, RegExpNode *on_success)
Definition regexp.h:773
virtual intptr_t EatsAtLeast(intptr_t still_to_find, intptr_t recursion_depth, bool not_at_start)
Definition regexp.cc:1516
void Add(const T &value)
Convenience wrapper around a BlockEntryInstr pointer.
void SetAll(intptr_t map_number)
Definition regexp.h:1162
RegExpCompiler * compiler()
Definition regexp.h:1138
void SetInterval(intptr_t map_number, const Interval &interval)
Definition regexp.h:1152
void Set(intptr_t map_number, intptr_t character)
Definition regexp.h:1146
intptr_t Count(intptr_t map_number)
Definition regexp.h:1140
void SetRest(intptr_t from_map)
Definition regexp.h:1164
void EmitSkipInstructions(RegExpMacroAssembler *masm)
Definition regexp.cc:2948
BoyerMoorePositionInfo * at(intptr_t i)
Definition regexp.h:1144
static constexpr intptr_t kMapSize
Definition regexp.h:1112
BoyerMoorePositionInfo(Zone *zone)
Definition regexp.h:1098
intptr_t map_count() const
Definition regexp.h:1115
void SetInterval(const Interval &interval)
Definition regexp.cc:2792
static constexpr intptr_t kMask
Definition regexp.h:1113
bool & at(intptr_t i)
Definition regexp.h:1110
CharacterRange(int32_t from, int32_t to)
Definition regexp.h:28
static constexpr intptr_t kPayloadMask
Definition regexp.h:81
bool IsEverything(int32_t max) const
Definition regexp.h:59
static bool IsCanonical(ZoneGrowableArray< CharacterRange > *ranges)
Definition regexp.cc:4772
static void AddClassEscape(uint16_t type, ZoneGrowableArray< CharacterRange > *ranges)
Definition regexp.cc:4651
bool IsSingleton() const
Definition regexp.h:60
static CharacterRange Range(int32_t from, int32_t to)
Definition regexp.h:40
static CharacterRange Everything()
Definition regexp.h:44
bool Contains(int32_t i) const
Definition regexp.h:53
static CharacterRange Singleton(int32_t value)
Definition regexp.h:37
int32_t to() const
Definition regexp.h:56
static void Split(ZoneGrowableArray< CharacterRange > *base, GrowableArray< const intptr_t > overlay, ZoneGrowableArray< CharacterRange > **included, ZoneGrowableArray< CharacterRange > **excluded, Zone *zone)
static GrowableArray< const intptr_t > GetWordBounds()
void set_from(int32_t value)
Definition regexp.h:55
static constexpr intptr_t kStartMarker
Definition regexp.h:80
int32_t from() const
Definition regexp.h:54
void set_to(int32_t value)
Definition regexp.h:57
bool is_valid() const
Definition regexp.h:58
static void AddCaseEquivalents(ZoneGrowableArray< CharacterRange > *ranges, bool is_one_byte, Zone *zone)
Definition regexp.cc:4691
static void Negate(ZoneGrowableArray< CharacterRange > *src, ZoneGrowableArray< CharacterRange > *dst)
Definition regexp.cc:4912
static ZoneGrowableArray< CharacterRange > * List(Zone *zone, CharacterRange range)
Definition regexp.h:47
virtual bool try_to_emit_quick_check_for_alternative(bool is_first)
Definition regexp.h:928
virtual intptr_t EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start)
Definition regexp.cc:1582
ChoiceNode(intptr_t expected_size, Zone *zone)
Definition regexp.h:896
ZoneGrowableArray< GuardedAlternative > * alternatives_
Definition regexp.h:937
virtual RegExpNode * FilterOneByte(intptr_t depth)
Definition regexp.cc:2049
void set_not_at_start()
Definition regexp.h:926
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition regexp.cc:5185
intptr_t EatsAtLeastHelper(intptr_t still_to_find, intptr_t budget, RegExpNode *ignore_this_node, bool not_at_start)
Definition regexp.cc:1557
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t characters_filled_in, bool not_at_start)
Definition regexp.cc:2143
void AddAlternative(GuardedAlternative node)
Definition regexp.h:903
void set_being_calculated(bool b)
Definition regexp.h:927
intptr_t GreedyLoopTextLengthForAlternative(const GuardedAlternative *alternative)
Definition regexp.cc:2632
bool being_calculated()
Definition regexp.h:924
ZoneGrowableArray< GuardedAlternative > * alternatives()
Definition regexp.h:904
virtual void Emit(RegExpCompiler *compiler, Trace *trace)
Definition regexp.cc:3127
virtual bool read_backward()
Definition regexp.h:932
bool not_at_start()
Definition regexp.h:925
virtual void Accept(NodeVisitor *visitor)
static const Entry NoValue()
Definition regexp.h:150
static int Compare(int32_t a, int32_t b)
Definition regexp.h:151
static const int32_t kNoKey
Definition regexp.h:149
void set_to(int32_t value)
Definition regexp.h:133
Entry(int32_t from, int32_t to, OutSet *out_set)
Definition regexp.h:127
void AddValue(int value, Zone *zone)
Definition regexp.h:134
OutSet * Get(int32_t value)
Definition regexp.cc:5079
ChoiceTable(Zone *zone)
Definition regexp.h:122
void AddRange(CharacterRange range, int32_t value, Zone *zone)
Definition regexp.cc:4989
void ForEach(Callback *callback)
Definition regexp.h:166
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t characters_filled_in, bool not_at_start)
Definition regexp.h:821
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition regexp.h:828
virtual intptr_t EatsAtLeast(intptr_t still_to_find, intptr_t recursion_depth, bool not_at_start)
Definition regexp.h:816
EndNode(Action action, Zone *zone)
Definition regexp.h:812
virtual void Emit(RegExpCompiler *compiler, Trace *trace)
Definition regexp.cc:728
@ NEGATIVE_SUBMATCH_SUCCESS
Definition regexp.h:811
virtual void Accept(NodeVisitor *visitor)
Trace * counter_backtrack_trace()
Definition regexp.h:1366
BlockLabel * label()
Definition regexp.h:1365
intptr_t reg()
Definition regexp.h:866
intptr_t value()
Definition regexp.h:868
Guard(intptr_t reg, Relation op, intptr_t value)
Definition regexp.h:864
Relation op()
Definition regexp.h:867
RegExpNode * node() const
Definition regexp.h:881
GuardedAlternative(RegExpNode *node)
Definition regexp.h:878
void set_node(RegExpNode *node)
Definition regexp.h:882
ZoneGrowableArray< Guard * > * guards() const
Definition regexp.h:883
void AddGuard(Guard *guard, Zone *zone)
Definition regexp.cc:751
bool Contains(intptr_t value) const
Definition regexp.h:524
intptr_t to() const
Definition regexp.h:529
intptr_t from() const
Definition regexp.h:528
Interval(intptr_t from, intptr_t to)
Definition regexp.h:513
static constexpr intptr_t kNone
Definition regexp.h:531
bool is_empty() const
Definition regexp.h:527
static Interval Empty()
Definition regexp.h:530
Interval Union(Interval that)
Definition regexp.h:515
virtual intptr_t EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start)
Definition regexp.cc:1576
virtual void Accept(NodeVisitor *visitor)
Definition regexp.cc:835
void AddContinueAlternative(GuardedAlternative alt)
Definition regexp.cc:2660
virtual bool read_backward()
Definition regexp.h:1037
RegExpNode * loop_node()
Definition regexp.h:1034
bool body_can_be_zero_length()
Definition regexp.h:1036
RegExpNode * continue_node()
Definition regexp.h:1035
LoopChoiceNode(bool body_can_be_zero_length, bool read_backward, Zone *zone)
Definition regexp.h:1012
virtual void Emit(RegExpCompiler *compiler, Trace *trace)
Definition regexp.cc:2666
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition regexp.cc:2130
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t characters_filled_in, bool not_at_start)
Definition regexp.cc:2120
void AddLoopAlternative(GuardedAlternative alt)
Definition regexp.cc:2654
virtual RegExpNode * FilterOneByte(intptr_t depth)
Definition regexp.cc:2033
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition regexp.h:991
virtual intptr_t EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start)
Definition regexp.cc:1536
virtual RegExpNode * FilterOneByte(intptr_t depth)
Definition regexp.cc:2099
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t characters_filled_in, bool not_at_start)
Definition regexp.cc:1546
virtual bool try_to_emit_quick_check_for_alternative(bool is_first)
Definition regexp.h:1004
NegativeLookaroundChoiceNode(GuardedAlternative this_must_fail, GuardedAlternative then_do_this, Zone *zone)
Definition regexp.h:977
virtual void Emit(RegExpCompiler *compiler, Trace *trace)
Definition regexp.cc:702
NegativeSubmatchSuccess(intptr_t stack_pointer_reg, intptr_t position_reg, intptr_t clear_capture_count, intptr_t clear_capture_start, Zone *zone)
Definition regexp.h:842
virtual ~NodeVisitor()
Definition regexp.h:1386
virtual void VisitLoopChoice(LoopChoiceNode *that)
Definition regexp.h:1390
OutSet * Extend(unsigned value, Zone *zone)
Definition regexp.cc:4947
bool Get(unsigned value) const
Definition regexp.cc:4977
static constexpr unsigned kFirstLimit
Definition regexp.h:97
intptr_t characters()
Definition regexp.h:359
Position * positions(intptr_t index)
Definition regexp.h:361
void set_characters(intptr_t characters)
Definition regexp.h:360
bool Rationalize(bool one_byte)
Definition regexp.cc:1598
QuickCheckDetails(intptr_t characters)
Definition regexp.h:343
void Advance(intptr_t by, bool one_byte)
Definition regexp.cc:1871
void Merge(QuickCheckDetails *other, intptr_t from_index)
Definition regexp.cc:1892
static void DotPrint(const char *label, RegExpNode *node, bool ignore_case)
static CompilationResult CompileBytecode(RegExpCompileData *data, const RegExp &regexp, bool is_one_byte, bool sticky, Zone *zone)
Definition regexp.cc:5414
static CompilationResult CompileIR(RegExpCompileData *input, const ParsedFunction *parsed_function, const ZoneGrowableArray< const ICData * > &ic_data_array, intptr_t osr_id)
Definition regexp.cc:5298
static RegExpPtr CreateRegExp(Thread *thread, const String &pattern, RegExpFlags flags)
Definition regexp.cc:5573
static constexpr intptr_t kMaxCopiesCodeGenerated
Definition regexp.h:475
virtual void Accept(NodeVisitor *visitor)=0
virtual void Emit(RegExpCompiler *compiler, Trace *trace)=0
void SaveBMInfo(BoyerMooreLookahead *bm, bool not_at_start, intptr_t offset)
Definition regexp.h:465
RegExpNode * replacement_
Definition regexp.h:487
NodeInfo * info()
Definition regexp.h:477
static constexpr intptr_t kNodeIsTooComplexForGreedyLoops
Definition regexp.h:422
virtual ~RegExpNode()
Definition regexp.cc:1429
virtual RegExpNode * FilterOneByte(intptr_t depth)
Definition regexp.h:449
LimitResult LimitVersions(RegExpCompiler *compiler, Trace *trace)
Definition regexp.cc:1431
virtual RegExpNode * GetSuccessorOfOmnivorousTextNode(RegExpCompiler *compiler)
Definition regexp.h:428
BlockLabel * label()
Definition regexp.h:469
bool EmitQuickCheck(RegExpCompiler *compiler, Trace *bounds_check_trace, Trace *trace, bool preload_has_checked_bounds, BlockLabel *on_possible_success, QuickCheckDetails *details_return, bool fall_through_on_failure)
Definition regexp.cc:1621
Zone * zone() const
Definition regexp.h:483
void set_bm_info(bool not_at_start, BoyerMooreLookahead *bm)
Definition regexp.h:491
BoyerMooreLookahead * bm_info(bool not_at_start)
Definition regexp.h:479
RegExpNode * set_replacement(RegExpNode *replacement)
Definition regexp.h:455
virtual intptr_t GreedyLoopTextLength()
Definition regexp.h:423
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition regexp.h:439
RegExpNode(Zone *zone)
Definition regexp.h:386
static constexpr intptr_t kRecursionBudget
Definition regexp.h:438
virtual intptr_t EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start)=0
RegExpNode * replacement()
Definition regexp.h:451
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t characters_filled_in, bool not_at_start)=0
RegExpNode * on_success()
Definition regexp.h:544
SeqRegExpNode(RegExpNode *on_success)
Definition regexp.h:542
void set_on_success(RegExpNode *node)
Definition regexp.h:545
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition regexp.h:547
virtual RegExpNode * FilterOneByte(intptr_t depth)
Definition regexp.cc:1931
RegExpNode * FilterSuccessor(intptr_t depth)
Definition regexp.cc:1939
static TextElement CharClass(RegExpCharacterClass *char_class)
Definition regexp.cc:229
TextType text_type() const
Definition regexp.h:246
RegExpCharacterClass * char_class() const
Definition regexp.h:255
intptr_t length() const
Definition regexp.cc:233
static TextElement Atom(RegExpAtom *atom)
Definition regexp.cc:225
intptr_t cp_offset() const
Definition regexp.h:242
RegExpAtom * atom() const
Definition regexp.h:250
RegExpTree * tree() const
Definition regexp.h:248
void set_cp_offset(intptr_t cp_offset)
Definition regexp.h:243
virtual void Accept(NodeVisitor *visitor)
virtual RegExpNode * FilterOneByte(intptr_t depth)
Definition regexp.cc:1977
virtual void Emit(RegExpCompiler *compiler, Trace *trace)
Definition regexp.cc:2514
virtual RegExpNode * GetSuccessorOfOmnivorousTextNode(RegExpCompiler *compiler)
Definition regexp.cc:2604
TextNode(ZoneGrowableArray< TextElement > *elms, bool read_backward, RegExpNode *on_success)
Definition regexp.h:652
virtual intptr_t GreedyLoopTextLength()
Definition regexp.cc:2599
static TextNode * CreateForCharacterRanges(ZoneGrowableArray< CharacterRange > *ranges, bool read_backward, RegExpNode *on_success, RegExpFlags flags)
Definition regexp.cc:2480
TextNode(RegExpCharacterClass *that, bool read_backward, RegExpNode *on_success)
Definition regexp.h:656
bool read_backward()
Definition regexp.h:687
virtual intptr_t EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start)
Definition regexp.cc:1524
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition regexp.cc:5203
ZoneGrowableArray< TextElement > * elements()
Definition regexp.h:686
void MakeCaseIndependent(bool is_one_byte)
Definition regexp.cc:2581
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t characters_filled_in, bool not_at_start)
Definition regexp.cc:1700
static TextNode * CreateForSurrogatePair(CharacterRange lead, CharacterRange trail, bool read_backward, RegExpNode *on_success, RegExpFlags flags)
Definition regexp.cc:2491
void CalculateOffsets()
Definition regexp.cc:5104
DeferredAction(ActionNode::ActionType action_type, intptr_t reg)
Definition regexp.h:1210
DeferredAction * next()
Definition regexp.h:1212
bool Mentions(intptr_t reg)
Definition regexp.cc:461
ActionNode::ActionType action_type()
Definition regexp.h:1215
DeferredCapture(intptr_t reg, bool is_capture, Trace *trace)
Definition regexp.h:1228
DeferredClearCaptures(Interval range)
Definition regexp.h:1253
DeferredSetRegister(intptr_t reg, intptr_t value)
Definition regexp.h:1243
intptr_t characters_preloaded()
Definition regexp.h:1305
QuickCheckDetails * quick_check_performed()
Definition regexp.h:1308
bool GetStoredPosition(intptr_t reg, intptr_t *cp_offset)
Definition regexp.cc:478
void set_loop_label(BlockLabel *label)
Definition regexp.h:1323
void InvalidateCurrentCharacter()
Definition regexp.cc:2558
void set_at_start(TriBool at_start)
Definition regexp.h:1301
void set_bound_checked_up_to(intptr_t to)
Definition regexp.h:1327
BlockLabel * loop_label()
Definition regexp.h:1303
void Flush(RegExpCompiler *compiler, RegExpNode *successor)
Definition regexp.cc:649
void set_characters_preloaded(intptr_t count)
Definition regexp.h:1324
bool mentions_reg(intptr_t reg)
Definition regexp.cc:470
RegExpNode * stop_node()
Definition regexp.h:1304
void set_stop_node(RegExpNode *node)
Definition regexp.h:1322
intptr_t cp_offset()
Definition regexp.h:1283
bool is_trivial()
Definition regexp.h:1295
BlockLabel * backtrack()
Definition regexp.h:1302
intptr_t bound_checked_up_to()
Definition regexp.h:1306
TriBool at_start()
Definition regexp.h:1300
void set_quick_check_performed(QuickCheckDetails *d)
Definition regexp.h:1329
DeferredAction * actions()
Definition regexp.h:1284
intptr_t flush_budget()
Definition regexp.h:1307
void add_action(DeferredAction *new_action)
Definition regexp.h:1316
void set_flush_budget(intptr_t to)
Definition regexp.h:1328
void AdvanceCurrentPositionInTrace(intptr_t by, RegExpCompiler *compiler)
Definition regexp.cc:2562
void set_backtrack(BlockLabel *backtrack)
Definition regexp.h:1321
ZoneGrowableArray< CharacterRange > * lead_surrogates()
Definition regexp.h:186
ZoneGrowableArray< CharacterRange > * trail_surrogates()
Definition regexp.h:189
ZoneGrowableArray< CharacterRange > * non_bmp() const
Definition regexp.h:192
ZoneGrowableArray< CharacterRange > * bmp()
Definition regexp.h:185
void Call(uint32_t from, ChoiceTable::Entry entry)
Definition regexp.cc:3939
static constexpr int32_t kMaxCodePoint
Definition unicode.h:18
static constexpr T Maximum(T x, T y)
Definition utils.h:26
static T Minimum(T x, T y)
Definition utils.h:21
#define DECLARE_VISIT(type, attrs)
#define ASSERT(E)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition main.cc:19
static bool b
struct MyStruct a[10]
FlutterSemanticsFlag flags
if(end==-1)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
uint8_t value
static float max(float r, float g, float b)
Definition hsl.cpp:49
unibrow::Mapping< unibrow::Ecma262Canonicalize > Canonicalize
ContainedInLattice AddRange(ContainedInLattice containment, const int32_t *ranges, intptr_t ranges_length, Interval new_range)
Definition regexp.cc:36
void CreateSpecializedFunction(Thread *thread, Zone *zone, const RegExp &regexp, intptr_t specialization_cid, bool sticky, const Object &owner)
Definition regexp.cc:5523
ContainedInLattice Combine(ContainedInLattice a, ContainedInLattice b)
Definition regexp.h:1087
static int8_t data[kExtLength]
ContainedInLattice
Definition regexp.h:1080
@ kLatticeOut
Definition regexp.h:1083
@ kLatticeUnknown
Definition regexp.h:1084
@ kNotYet
Definition regexp.h:1081
@ kLatticeIn
Definition regexp.h:1082
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName)
Definition globals.h:593
#define DISALLOW_ALLOCATION()
Definition globals.h:604
#define FOR_EACH_REG_EXP_TREE_TYPE(VISIT)
Definition regexp.h:218
#define FORWARD_DECLARE(Name)
Definition regexp.h:231
#define FOR_EACH_NODE_TYPE(VISIT)
Definition regexp.h:210
Point offset
bool Matches(NodeInfo *that)
Definition regexp.h:289
bool been_analyzed
Definition regexp.h:324
bool being_analyzed
Definition regexp.h:323
void AddFromFollowing(NodeInfo *that)
Definition regexp.h:312
bool follows_word_interest
Definition regexp.h:328
bool follows_newline_interest
Definition regexp.h:329
void AddFromPreceding(NodeInfo *that)
Definition regexp.h:298
bool replacement_calculated
Definition regexp.h:334
bool HasLookbehind()
Definition regexp.h:305
void ResetCompilationState()
Definition regexp.h:318
bool follows_start_interest
Definition regexp.h:330
static constexpr intptr_t kEatsAtLeastNotYetInitialized
Definition regexp.h:1374
bool preload_is_current_
Definition regexp.h:1375
intptr_t preload_characters_
Definition regexp.h:1377
bool preload_has_checked_bounds_
Definition regexp.h:1376
intptr_t eats_at_least_
Definition regexp.h:1378
RegExpNode * node
Definition regexp.h:1440
RegExpTree * tree
Definition regexp.h:1439
NOT_IN_PRECOMPILED(const intptr_t num_blocks)
CompilationResult(TypedData *bytecode, intptr_t num_registers)
Definition regexp.h:1463
NOT_IN_PRECOMPILED(IndirectGotoInstr *backtrack_goto)
CompilationResult(IndirectGotoInstr *backtrack_goto, GraphEntryInstr *graph_entry, intptr_t num_blocks, intptr_t num_stack_locals, intptr_t num_registers)
Definition regexp.h:1476
NOT_IN_PRECOMPILED(const intptr_t num_stack_locals)
NOT_IN_PRECOMPILED(GraphEntryInstr *graph_entry)
CompilationResult(const char *error_message)
Definition regexp.h:1451
WORD ATOM