Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::LoopChoiceNode Class Reference

#include <regexp.h>

Inheritance diagram for dart::LoopChoiceNode:
dart::ChoiceNode dart::RegExpNode dart::ZoneAllocated

Public Member Functions

 LoopChoiceNode (bool body_can_be_zero_length, bool read_backward, Zone *zone)
 
void AddLoopAlternative (GuardedAlternative alt)
 
void AddContinueAlternative (GuardedAlternative alt)
 
virtual void Emit (RegExpCompiler *compiler, Trace *trace)
 
virtual intptr_t EatsAtLeast (intptr_t still_to_find, intptr_t budget, bool not_at_start)
 
virtual void GetQuickCheckDetails (QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t characters_filled_in, bool not_at_start)
 
virtual void FillInBMInfo (intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
 
RegExpNodeloop_node ()
 
RegExpNodecontinue_node ()
 
bool body_can_be_zero_length ()
 
virtual bool read_backward ()
 
virtual void Accept (NodeVisitor *visitor)
 
virtual RegExpNodeFilterOneByte (intptr_t depth)
 
- Public Member Functions inherited from dart::ChoiceNode
 ChoiceNode (intptr_t expected_size, Zone *zone)
 
void AddAlternative (GuardedAlternative node)
 
ZoneGrowableArray< GuardedAlternative > * alternatives ()
 
intptr_t EatsAtLeastHelper (intptr_t still_to_find, intptr_t budget, RegExpNode *ignore_this_node, bool not_at_start)
 
bool being_calculated ()
 
bool not_at_start ()
 
void set_not_at_start ()
 
void set_being_calculated (bool b)
 
virtual bool try_to_emit_quick_check_for_alternative (bool is_first)
 
- Public Member Functions inherited from dart::RegExpNode
 RegExpNode (Zone *zone)
 
virtual ~RegExpNode ()
 
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)
 
virtual intptr_t GreedyLoopTextLength ()
 
virtual RegExpNodeGetSuccessorOfOmnivorousTextNode (RegExpCompiler *compiler)
 
RegExpNodereplacement ()
 
RegExpNodeset_replacement (RegExpNode *replacement)
 
void SaveBMInfo (BoyerMooreLookahead *bm, bool not_at_start, intptr_t offset)
 
BlockLabellabel ()
 
NodeInfoinfo ()
 
BoyerMooreLookaheadbm_info (bool not_at_start)
 
Zonezone () const
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Additional Inherited Members

- Static Public Attributes inherited from dart::RegExpNode
static constexpr intptr_t kNodeIsTooComplexForGreedyLoops = -1
 
static constexpr intptr_t kRecursionBudget = 200
 
static constexpr intptr_t kMaxCopiesCodeGenerated = 10
 
- Protected Types inherited from dart::RegExpNode
enum  LimitResult { DONE , CONTINUE }
 
- Protected Member Functions inherited from dart::ChoiceNode
intptr_t GreedyLoopTextLengthForAlternative (const GuardedAlternative *alternative)
 
- Protected Member Functions inherited from dart::RegExpNode
LimitResult LimitVersions (RegExpCompiler *compiler, Trace *trace)
 
void set_bm_info (bool not_at_start, BoyerMooreLookahead *bm)
 
- Protected Attributes inherited from dart::ChoiceNode
ZoneGrowableArray< GuardedAlternative > * alternatives_
 
- Protected Attributes inherited from dart::RegExpNode
RegExpNodereplacement_
 

Detailed Description

Definition at line 1010 of file regexp.h.

Constructor & Destructor Documentation

◆ LoopChoiceNode()

dart::LoopChoiceNode::LoopChoiceNode ( bool  body_can_be_zero_length,
bool  read_backward,
Zone zone 
)
inlineexplicit

Definition at line 1012 of file regexp.h.

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) {}
ChoiceNode(intptr_t expected_size, Zone *zone)
Definition regexp.h:896
virtual bool read_backward()
Definition regexp.h:1037
bool body_can_be_zero_length()
Definition regexp.h:1036
Zone * zone() const
Definition regexp.h:483

Member Function Documentation

◆ Accept()

void dart::LoopChoiceNode::Accept ( NodeVisitor visitor)
virtual

Reimplemented from dart::ChoiceNode.

Definition at line 835 of file regexp.cc.

835 {
836 visitor->VisitLoopChoice(this);
837}

◆ AddContinueAlternative()

void dart::LoopChoiceNode::AddContinueAlternative ( GuardedAlternative  alt)

Definition at line 2660 of file regexp.cc.

2660 {
2661 ASSERT(continue_node_ == nullptr);
2662 AddAlternative(alt);
2663 continue_node_ = alt.node();
2664}
#define ASSERT(E)

◆ AddLoopAlternative()

void dart::LoopChoiceNode::AddLoopAlternative ( GuardedAlternative  alt)

Definition at line 2654 of file regexp.cc.

2654 {
2655 ASSERT(loop_node_ == nullptr);
2656 AddAlternative(alt);
2657 loop_node_ = alt.node();
2658}

◆ body_can_be_zero_length()

bool dart::LoopChoiceNode::body_can_be_zero_length ( )
inline

Definition at line 1036 of file regexp.h.

1036{ return body_can_be_zero_length_; }

◆ continue_node()

RegExpNode * dart::LoopChoiceNode::continue_node ( )
inline

Definition at line 1035 of file regexp.h.

1035{ return continue_node_; }

◆ EatsAtLeast()

intptr_t dart::LoopChoiceNode::EatsAtLeast ( intptr_t  still_to_find,
intptr_t  budget,
bool  not_at_start 
)
virtual

Reimplemented from dart::ChoiceNode.

Definition at line 1576 of file regexp.cc.

1578 {
1579 return EatsAtLeastHelper(still_to_find, budget - 1, loop_node_, not_at_start);
1580}
intptr_t EatsAtLeastHelper(intptr_t still_to_find, intptr_t budget, RegExpNode *ignore_this_node, bool not_at_start)
Definition regexp.cc:1557
bool not_at_start()
Definition regexp.h:925

◆ Emit()

void dart::LoopChoiceNode::Emit ( RegExpCompiler compiler,
Trace trace 
)
virtual

Reimplemented from dart::ChoiceNode.

Definition at line 2666 of file regexp.cc.

2666 {
2667 RegExpMacroAssembler* macro_assembler = compiler->macro_assembler();
2668 if (trace->stop_node() == this) {
2669 // Back edge of greedy optimized loop node graph.
2670 intptr_t text_length =
2673 // Update the counter-based backtracking info on the stack. This is an
2674 // optimization for greedy loops (see below).
2675 ASSERT(trace->cp_offset() == text_length);
2676 macro_assembler->AdvanceCurrentPosition(text_length);
2677 macro_assembler->GoTo(trace->loop_label());
2678 return;
2679 }
2680 ASSERT(trace->stop_node() == nullptr);
2681 if (!trace->is_trivial()) {
2682 trace->Flush(compiler, this);
2683 return;
2684 }
2685 ChoiceNode::Emit(compiler, trace);
2686}
ZoneGrowableArray< GuardedAlternative > * alternatives_
Definition regexp.h:937
intptr_t GreedyLoopTextLengthForAlternative(const GuardedAlternative *alternative)
Definition regexp.cc:2632
virtual void Emit(RegExpCompiler *compiler, Trace *trace)
Definition regexp.cc:3127
static constexpr intptr_t kNodeIsTooComplexForGreedyLoops
Definition regexp.h:422

◆ FillInBMInfo()

void dart::LoopChoiceNode::FillInBMInfo ( intptr_t  offset,
intptr_t  budget,
BoyerMooreLookahead bm,
bool  not_at_start 
)
virtual

Reimplemented from dart::ChoiceNode.

Definition at line 2130 of file regexp.cc.

2133 {
2134 if (body_can_be_zero_length_ || budget <= 0) {
2135 bm->SetRest(offset);
2137 return;
2138 }
2141}
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition regexp.cc:5185
void SaveBMInfo(BoyerMooreLookahead *bm, bool not_at_start, intptr_t offset)
Definition regexp.h:465
Point offset

◆ FilterOneByte()

RegExpNode * dart::LoopChoiceNode::FilterOneByte ( intptr_t  depth)
virtual

Reimplemented from dart::ChoiceNode.

Definition at line 2033 of file regexp.cc.

2033 {
2034 if (info()->replacement_calculated) return replacement();
2035 if (depth < 0) return this;
2036 if (info()->visited) return this;
2037 {
2038 VisitMarker marker(info());
2039
2040 RegExpNode* continue_replacement = continue_node_->FilterOneByte(depth - 1);
2041 // If we can't continue after the loop then there is no sense in doing the
2042 // loop.
2043 if (continue_replacement == nullptr) return set_replacement(nullptr);
2044 }
2045
2046 return ChoiceNode::FilterOneByte(depth - 1);
2047}
static const char marker[]
virtual RegExpNode * FilterOneByte(intptr_t depth)
Definition regexp.cc:2049
NodeInfo * info()
Definition regexp.h:477
virtual RegExpNode * FilterOneByte(intptr_t depth)
Definition regexp.h:449
RegExpNode * set_replacement(RegExpNode *replacement)
Definition regexp.h:455
RegExpNode(Zone *zone)
Definition regexp.h:386
RegExpNode * replacement()
Definition regexp.h:451

◆ GetQuickCheckDetails()

void dart::LoopChoiceNode::GetQuickCheckDetails ( QuickCheckDetails details,
RegExpCompiler compiler,
intptr_t  characters_filled_in,
bool  not_at_start 
)
virtual

Reimplemented from dart::ChoiceNode.

Definition at line 2120 of file regexp.cc.

2123 {
2124 if (body_can_be_zero_length_ || info()->visited) return;
2125 VisitMarker marker(info());
2127 characters_filled_in, not_at_start);
2128}
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t characters_filled_in, bool not_at_start)
Definition regexp.cc:2143

◆ loop_node()

RegExpNode * dart::LoopChoiceNode::loop_node ( )
inline

Definition at line 1034 of file regexp.h.

1034{ return loop_node_; }

◆ read_backward()

virtual bool dart::LoopChoiceNode::read_backward ( )
inlinevirtual

Reimplemented from dart::ChoiceNode.

Definition at line 1037 of file regexp.h.

1037{ return read_backward_; }

The documentation for this class was generated from the following files: