Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::BackReferenceNode Class Reference

#include <regexp.h>

Inheritance diagram for dart::BackReferenceNode:
dart::SeqRegExpNode dart::RegExpNode dart::ZoneAllocated

Public Member Functions

 BackReferenceNode (intptr_t start_reg, intptr_t end_reg, RegExpFlags flags, bool read_backward, RegExpNode *on_success)
 
virtual void Accept (NodeVisitor *visitor)
 
intptr_t start_register ()
 
intptr_t end_register ()
 
bool read_backward ()
 
virtual void Emit (RegExpCompiler *compiler, Trace *trace)
 
virtual intptr_t EatsAtLeast (intptr_t still_to_find, intptr_t recursion_depth, 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)
 
- Public Member Functions inherited from dart::SeqRegExpNode
 SeqRegExpNode (RegExpNode *on_success)
 
RegExpNodeon_success ()
 
void set_on_success (RegExpNode *node)
 
virtual RegExpNodeFilterOneByte (intptr_t depth)
 
virtual void FillInBMInfo (intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
 
- Public Member Functions inherited from dart::RegExpNode
 RegExpNode (Zone *zone)
 
virtual ~RegExpNode ()
 
virtual void Accept (NodeVisitor *visitor)=0
 
virtual void Emit (RegExpCompiler *compiler, Trace *trace)=0
 
virtual intptr_t EatsAtLeast (intptr_t still_to_find, intptr_t budget, bool not_at_start)=0
 
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 void GetQuickCheckDetails (QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t characters_filled_in, bool not_at_start)=0
 
virtual intptr_t GreedyLoopTextLength ()
 
virtual RegExpNodeGetSuccessorOfOmnivorousTextNode (RegExpCompiler *compiler)
 
virtual void FillInBMInfo (intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
 
virtual RegExpNodeFilterOneByte (intptr_t depth)
 
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::SeqRegExpNode
RegExpNodeFilterSuccessor (intptr_t depth)
 
- 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::RegExpNode
RegExpNodereplacement_
 

Detailed Description

Definition at line 771 of file regexp.h.

Constructor & Destructor Documentation

◆ BackReferenceNode()

dart::BackReferenceNode::BackReferenceNode ( intptr_t  start_reg,
intptr_t  end_reg,
RegExpFlags  flags,
bool  read_backward,
RegExpNode on_success 
)
inline

Definition at line 773 of file regexp.h.

779 start_reg_(start_reg),
780 end_reg_(end_reg),
781 flags_(flags),
782 read_backward_(read_backward) {}
RegExpNode * on_success()
Definition: regexp.h:544
SeqRegExpNode(RegExpNode *on_success)
Definition: regexp.h:542
FlutterSemanticsFlag flags

Member Function Documentation

◆ Accept()

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

Implements dart::RegExpNode.

◆ EatsAtLeast()

intptr_t dart::BackReferenceNode::EatsAtLeast ( intptr_t  still_to_find,
intptr_t  recursion_depth,
bool  not_at_start 
)
virtual

Implements dart::RegExpNode.

Definition at line 1516 of file regexp.cc.

1518 {
1519 if (read_backward()) return 0;
1520 if (budget <= 0) return 0;
1521 return on_success()->EatsAtLeast(still_to_find, budget - 1, not_at_start);
1522}
virtual intptr_t EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start)=0

◆ Emit()

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

Implements dart::RegExpNode.

Definition at line 3527 of file regexp.cc.

3527 {
3528 RegExpMacroAssembler* assembler = compiler->macro_assembler();
3529 if (!trace->is_trivial()) {
3530 trace->Flush(compiler, this);
3531 return;
3532 }
3533
3534 LimitResult limit_result = LimitVersions(compiler, trace);
3535 if (limit_result == DONE) return;
3536 ASSERT(limit_result == CONTINUE);
3537
3538 RecursionCheck rc(compiler);
3539
3540 ASSERT(start_reg_ + 1 == end_reg_);
3541 if (flags_.IgnoreCase()) {
3542 assembler->CheckNotBackReferenceIgnoreCase(
3543 start_reg_, read_backward(), flags_.IsUnicode(), trace->backtrack());
3544 } else {
3545 assembler->CheckNotBackReference(start_reg_, read_backward(),
3546 trace->backtrack());
3547 }
3548 // We are going to advance backward, so we may end up at the start.
3549 if (read_backward()) trace->set_at_start(Trace::UNKNOWN);
3550
3551 // Check that the back reference does not end inside a surrogate pair.
3552 if (flags_.IsUnicode() && !compiler->one_byte()) {
3553 assembler->CheckNotInSurrogatePair(trace->cp_offset(), trace->backtrack());
3554 }
3555
3556 on_success()->Emit(compiler, trace);
3557}
bool IsUnicode() const
Definition: object.h:12725
bool IgnoreCase() const
Definition: object.h:12723
virtual void Emit(RegExpCompiler *compiler, Trace *trace)=0
LimitResult LimitVersions(RegExpCompiler *compiler, Trace *trace)
Definition: regexp.cc:1431
#define ASSERT(E)

◆ end_register()

intptr_t dart::BackReferenceNode::end_register ( )
inline

Definition at line 785 of file regexp.h.

785{ return end_reg_; }

◆ FillInBMInfo()

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

Reimplemented from dart::SeqRegExpNode.

Definition at line 5172 of file regexp.cc.

5175 {
5176 // Working out the set of characters that a backreference can match is too
5177 // hard, so we just say that any character can match.
5178 bm->SetRest(offset);
5179 SaveBMInfo(bm, not_at_start, offset);
5180}
void SaveBMInfo(BoyerMooreLookahead *bm, bool not_at_start, intptr_t offset)
Definition: regexp.h:465
SeparatedVector2 offset

◆ GetQuickCheckDetails()

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

Implements dart::RegExpNode.

Definition at line 791 of file regexp.h.

794 {
795 return;
796 }

◆ read_backward()

bool dart::BackReferenceNode::read_backward ( )
inline

Definition at line 786 of file regexp.h.

786{ return read_backward_; }

◆ start_register()

intptr_t dart::BackReferenceNode::start_register ( )
inline

Definition at line 784 of file regexp.h.

784{ return start_reg_; }

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