Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | List of all members
dart::AssertionNode Class Reference

#include <regexp.h>

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

Public Types

enum  AssertionType {
  AT_END , AT_START , AT_BOUNDARY , AT_NON_BOUNDARY ,
  AFTER_NEWLINE
}
 

Public Member Functions

virtual void Accept (NodeVisitor *visitor)
 
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 filled_in, bool not_at_start)
 
virtual void FillInBMInfo (intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
 
AssertionType assertion_type ()
 
- 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)
 

Static Public Member Functions

static AssertionNodeAtEnd (RegExpNode *on_success)
 
static AssertionNodeAtStart (RegExpNode *on_success)
 
static AssertionNodeAtBoundary (RegExpNode *on_success)
 
static AssertionNodeAtNonBoundary (RegExpNode *on_success)
 
static AssertionNodeAfterNewline (RegExpNode *on_success)
 

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 721 of file regexp.h.

Member Enumeration Documentation

◆ AssertionType

Enumerator
AT_END 
AT_START 
AT_BOUNDARY 
AT_NON_BOUNDARY 
AFTER_NEWLINE 

Definition at line 723 of file regexp.h.

Member Function Documentation

◆ Accept()

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

Implements dart::RegExpNode.

◆ AfterNewline()

static AssertionNode * dart::AssertionNode::AfterNewline ( RegExpNode on_success)
inlinestatic

Definition at line 742 of file regexp.h.

742 {
743 return new (on_success->zone()) AssertionNode(AFTER_NEWLINE, on_success);
744 }
Zone * zone() const
Definition: regexp.h:483
RegExpNode * on_success()
Definition: regexp.h:544

◆ assertion_type()

AssertionType dart::AssertionNode::assertion_type ( )
inline

Definition at line 758 of file regexp.h.

758{ return assertion_type_; }

◆ AtBoundary()

static AssertionNode * dart::AssertionNode::AtBoundary ( RegExpNode on_success)
inlinestatic

Definition at line 736 of file regexp.h.

736 {
737 return new (on_success->zone()) AssertionNode(AT_BOUNDARY, on_success);
738 }

◆ AtEnd()

static AssertionNode * dart::AssertionNode::AtEnd ( RegExpNode on_success)
inlinestatic

Definition at line 730 of file regexp.h.

730 {
731 return new (on_success->zone()) AssertionNode(AT_END, on_success);
732 }

◆ AtNonBoundary()

static AssertionNode * dart::AssertionNode::AtNonBoundary ( RegExpNode on_success)
inlinestatic

Definition at line 739 of file regexp.h.

739 {
740 return new (on_success->zone()) AssertionNode(AT_NON_BOUNDARY, on_success);
741 }

◆ AtStart()

static AssertionNode * dart::AssertionNode::AtStart ( RegExpNode on_success)
inlinestatic

Definition at line 733 of file regexp.h.

733 {
734 return new (on_success->zone()) AssertionNode(AT_START, on_success);
735 }

◆ EatsAtLeast()

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

Implements dart::RegExpNode.

Definition at line 1493 of file regexp.cc.

1495 {
1496 if (budget <= 0) return 0;
1497 // If we know we are not at the start and we are asked "how many characters
1498 // will you match if you succeed?" then we can answer anything since false
1499 // implies false. So lets just return the max answer (still_to_find) since
1500 // that won't prevent us from preloading a lot of characters for the other
1501 // branches in the node graph.
1502 if (assertion_type() == AT_START && not_at_start) return still_to_find;
1503 return on_success()->EatsAtLeast(still_to_find, budget - 1, not_at_start);
1504}
AssertionType assertion_type()
Definition: regexp.h:758
virtual intptr_t EatsAtLeast(intptr_t still_to_find, intptr_t budget, bool not_at_start)=0

◆ Emit()

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

Implements dart::RegExpNode.

Definition at line 2316 of file regexp.cc.

2316 {
2317 RegExpMacroAssembler* assembler = compiler->macro_assembler();
2318 switch (assertion_type_) {
2319 case AT_END: {
2320 BlockLabel ok;
2321 assembler->CheckPosition(trace->cp_offset(), &ok);
2322 assembler->GoTo(trace->backtrack());
2323 assembler->BindBlock(&ok);
2324 break;
2325 }
2326 case AT_START: {
2327 if (trace->at_start() == Trace::FALSE_VALUE) {
2328 assembler->GoTo(trace->backtrack());
2329 return;
2330 }
2331 if (trace->at_start() == Trace::UNKNOWN) {
2332 assembler->CheckNotAtStart(trace->cp_offset(), trace->backtrack());
2333 Trace at_start_trace = *trace;
2334 at_start_trace.set_at_start(Trace::TRUE_VALUE);
2335 on_success()->Emit(compiler, &at_start_trace);
2336 return;
2337 }
2338 } break;
2339 case AFTER_NEWLINE:
2340 EmitHat(compiler, on_success(), trace);
2341 return;
2342 case AT_BOUNDARY:
2343 case AT_NON_BOUNDARY: {
2344 EmitBoundaryCheck(compiler, trace);
2345 return;
2346 }
2347 }
2348 on_success()->Emit(compiler, trace);
2349}
static bool ok(int result)
virtual void Emit(RegExpCompiler *compiler, Trace *trace)=0
@ FALSE_VALUE
Definition: regexp.h:1206
@ TRUE_VALUE
Definition: regexp.h:1206
static void EmitHat(RegExpCompiler *compiler, RegExpNode *on_success, Trace *trace)
Definition: regexp.cc:2188

◆ FillInBMInfo()

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

Reimplemented from dart::SeqRegExpNode.

Definition at line 1506 of file regexp.cc.

1509 {
1510 // Match the behaviour of EatsAtLeast on this node.
1511 if (assertion_type() == AT_START && not_at_start) return;
1512 on_success()->FillInBMInfo(offset, budget - 1, bm, not_at_start);
1513 SaveBMInfo(bm, not_at_start, offset);
1514}
void SaveBMInfo(BoyerMooreLookahead *bm, bool not_at_start, intptr_t offset)
Definition: regexp.h:465
virtual void FillInBMInfo(intptr_t offset, intptr_t budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition: regexp.h:439
SeparatedVector2 offset

◆ GetQuickCheckDetails()

void dart::AssertionNode::GetQuickCheckDetails ( QuickCheckDetails details,
RegExpCompiler compiler,
intptr_t  filled_in,
bool  not_at_start 
)
virtual

Implements dart::RegExpNode.

Definition at line 2304 of file regexp.cc.

2307 {
2308 if (assertion_type_ == AT_START && not_at_start) {
2309 details->set_cannot_match();
2310 return;
2311 }
2312 return on_success()->GetQuickCheckDetails(details, compiler, filled_in,
2313 not_at_start);
2314}
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, intptr_t characters_filled_in, bool not_at_start)=0

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