V8 Project
v8::internal::LoopChoiceNode Class Reference

#include <jsregexp.h>

+ Inheritance diagram for v8::internal::LoopChoiceNode:
+ Collaboration diagram for v8::internal::LoopChoiceNode:

Public Member Functions

 LoopChoiceNode (bool body_can_be_zero_length, Zone *zone)
 
void AddLoopAlternative (GuardedAlternative alt)
 
void AddContinueAlternative (GuardedAlternative alt)
 
virtual void Emit (RegExpCompiler *compiler, Trace *trace)
 
virtual int EatsAtLeast (int still_to_find, int budget, bool not_at_start)
 
virtual void GetQuickCheckDetails (QuickCheckDetails *details, RegExpCompiler *compiler, int characters_filled_in, bool not_at_start)
 
virtual void FillInBMInfo (int offset, int budget, BoyerMooreLookahead *bm, bool not_at_start)
 
RegExpNodeloop_node ()
 
RegExpNodecontinue_node ()
 
bool body_can_be_zero_length ()
 
virtual void Accept (NodeVisitor *visitor)
 
virtual RegExpNodeFilterOneByte (int depth, bool ignore_case)
 
- Public Member Functions inherited from v8::internal::ChoiceNode
 ChoiceNode (int expected_size, Zone *zone)
 
void AddAlternative (GuardedAlternative node)
 
ZoneList< GuardedAlternative > * alternatives ()
 
DispatchTableGetTable (bool ignore_case)
 
int EatsAtLeastHelper (int still_to_find, int 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 v8::internal::RegExpNode
 RegExpNode (Zone *zone)
 
virtual ~RegExpNode ()
 
bool EmitQuickCheck (RegExpCompiler *compiler, Trace *bounds_check_trace, Trace *trace, bool preload_has_checked_bounds, Label *on_possible_success, QuickCheckDetails *details_return, bool fall_through_on_failure)
 
virtual int GreedyLoopTextLength ()
 
virtual RegExpNodeGetSuccessorOfOmnivorousTextNode (RegExpCompiler *compiler)
 
RegExpNodereplacement ()
 
RegExpNodeset_replacement (RegExpNode *replacement)
 
void SaveBMInfo (BoyerMooreLookahead *bm, bool not_at_start, int offset)
 
Label * label ()
 
NodeInfoinfo ()
 
BoyerMooreLookaheadbm_info (bool not_at_start)
 
Zonezone () const
 
- Public Member Functions inherited from v8::internal::ZoneObject
 INLINE (void *operator new(size_t size, Zone *zone))
 
void operator delete (void *, size_t)
 
void operator delete (void *pointer, Zone *zone)
 

Private Member Functions

void AddAlternative (GuardedAlternative node)
 

Private Attributes

RegExpNodeloop_node_
 
RegExpNodecontinue_node_
 
bool body_can_be_zero_length_
 

Additional Inherited Members

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

Detailed Description

Definition at line 1165 of file jsregexp.h.

Constructor & Destructor Documentation

◆ LoopChoiceNode()

v8::internal::LoopChoiceNode::LoopChoiceNode ( bool  body_can_be_zero_length,
Zone zone 
)
inlineexplicit

Definition at line 1167 of file jsregexp.h.

1168  : ChoiceNode(2, zone),
1169  loop_node_(NULL),
1172  { }
ChoiceNode(int expected_size, Zone *zone)
Definition: jsregexp.h:1053
Zone * zone() const
Definition: jsregexp.h:668
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL

Member Function Documentation

◆ Accept()

void v8::internal::LoopChoiceNode::Accept ( NodeVisitor visitor)
virtual

Reimplemented from v8::internal::ChoiceNode.

Definition at line 1559 of file jsregexp.cc.

1559  {
1560  visitor->VisitLoopChoice(this);
1561 }

References v8::internal::NodeVisitor::VisitLoopChoice().

+ Here is the call graph for this function:

◆ AddAlternative()

void v8::internal::LoopChoiceNode::AddAlternative ( GuardedAlternative  node)
inlineprivate

Definition at line 1195 of file jsregexp.h.

1195  {
1197  }
void AddAlternative(GuardedAlternative node)
Definition: jsregexp.h:1061

References v8::internal::ChoiceNode::AddAlternative().

+ Here is the call graph for this function:

◆ AddContinueAlternative()

void v8::internal::LoopChoiceNode::AddContinueAlternative ( GuardedAlternative  alt)

Definition at line 3476 of file jsregexp.cc.

3476  {
3478  AddAlternative(alt);
3479  continue_node_ = alt.node();
3480 }
void AddAlternative(GuardedAlternative node)
Definition: jsregexp.h:1195
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206

References DCHECK_EQ, v8::internal::GuardedAlternative::node(), and NULL.

+ Here is the call graph for this function:

◆ AddLoopAlternative()

void v8::internal::LoopChoiceNode::AddLoopAlternative ( GuardedAlternative  alt)

Definition at line 3469 of file jsregexp.cc.

3469  {
3471  AddAlternative(alt);
3472  loop_node_ = alt.node();
3473 }

References DCHECK_EQ, v8::internal::GuardedAlternative::node(), and NULL.

+ Here is the call graph for this function:

◆ body_can_be_zero_length()

bool v8::internal::LoopChoiceNode::body_can_be_zero_length ( )
inline

Definition at line 1187 of file jsregexp.h.

1187 { return body_can_be_zero_length_; }

References body_can_be_zero_length_.

◆ continue_node()

RegExpNode* v8::internal::LoopChoiceNode::continue_node ( )
inline

Definition at line 1186 of file jsregexp.h.

1186 { return continue_node_; }

References continue_node_.

◆ EatsAtLeast()

int v8::internal::LoopChoiceNode::EatsAtLeast ( int  still_to_find,
int  budget,
bool  not_at_start 
)
virtual

Reimplemented from v8::internal::ChoiceNode.

Definition at line 2390 of file jsregexp.cc.

2392  {
2393  return EatsAtLeastHelper(still_to_find,
2394  budget - 1,
2395  loop_node_,
2396  not_at_start);
2397 }
int EatsAtLeastHelper(int still_to_find, int budget, RegExpNode *ignore_this_node, bool not_at_start)
Definition: jsregexp.cc:2370

◆ Emit()

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

Reimplemented from v8::internal::ChoiceNode.

Definition at line 3483 of file jsregexp.cc.

3483  {
3484  RegExpMacroAssembler* macro_assembler = compiler->macro_assembler();
3485  if (trace->stop_node() == this) {
3486  // Back edge of greedy optimized loop node graph.
3487  int text_length =
3489  DCHECK(text_length != kNodeIsTooComplexForGreedyLoops);
3490  // Update the counter-based backtracking info on the stack. This is an
3491  // optimization for greedy loops (see below).
3492  DCHECK(trace->cp_offset() == text_length);
3493  macro_assembler->AdvanceCurrentPosition(text_length);
3494  macro_assembler->GoTo(trace->loop_label());
3495  return;
3496  }
3497  DCHECK(trace->stop_node() == NULL);
3498  if (!trace->is_trivial()) {
3499  trace->Flush(compiler, this);
3500  return;
3501  }
3502  ChoiceNode::Emit(compiler, trace);
3503 }
ZoneList< GuardedAlternative > * alternatives_
Definition: jsregexp.h:1092
int GreedyLoopTextLengthForAlternative(GuardedAlternative *alternative)
Definition: jsregexp.cc:3446
virtual void Emit(RegExpCompiler *compiler, Trace *trace)
Definition: jsregexp.cc:3933
static const int kNodeIsTooComplexForGreedyLoops
Definition: jsregexp.h:607
#define DCHECK(condition)
Definition: logging.h:205

References v8::internal::RegExpMacroAssembler::AdvanceCurrentPosition(), v8::internal::Trace::cp_offset(), DCHECK, v8::internal::ChoiceNode::Emit(), v8::internal::Trace::Flush(), v8::internal::RegExpMacroAssembler::GoTo(), v8::internal::Trace::is_trivial(), v8::internal::Trace::loop_label(), v8::internal::RegExpCompiler::macro_assembler(), NULL, and v8::internal::Trace::stop_node().

+ Here is the call graph for this function:

◆ FillInBMInfo()

void v8::internal::LoopChoiceNode::FillInBMInfo ( int  offset,
int  budget,
BoyerMooreLookahead bm,
bool  not_at_start 
)
virtual

Reimplemented from v8::internal::ChoiceNode.

Definition at line 2948 of file jsregexp.cc.

2951  {
2952  if (body_can_be_zero_length_ || budget <= 0) {
2953  bm->SetRest(offset);
2954  SaveBMInfo(bm, not_at_start, offset);
2955  return;
2956  }
2957  ChoiceNode::FillInBMInfo(offset, budget - 1, bm, not_at_start);
2958  SaveBMInfo(bm, not_at_start, offset);
2959 }
virtual void FillInBMInfo(int offset, int budget, BoyerMooreLookahead *bm, bool not_at_start)
Definition: jsregexp.cc:5836
void SaveBMInfo(BoyerMooreLookahead *bm, bool not_at_start, int offset)
Definition: jsregexp.h:650

References v8::internal::ChoiceNode::FillInBMInfo(), and v8::internal::BoyerMooreLookahead::SetRest().

+ Here is the call graph for this function:

◆ FilterOneByte()

RegExpNode * v8::internal::LoopChoiceNode::FilterOneByte ( int  depth,
bool  ignore_case 
)
virtual

Reimplemented from v8::internal::ChoiceNode.

Definition at line 2843 of file jsregexp.cc.

2843  {
2844  if (info()->replacement_calculated) return replacement();
2845  if (depth < 0) return this;
2846  if (info()->visited) return this;
2847  {
2848  VisitMarker marker(info());
2849 
2850  RegExpNode* continue_replacement =
2851  continue_node_->FilterOneByte(depth - 1, ignore_case);
2852  // If we can't continue after the loop then there is no sense in doing the
2853  // loop.
2854  if (continue_replacement == NULL) return set_replacement(NULL);
2855  }
2856 
2857  return ChoiceNode::FilterOneByte(depth - 1, ignore_case);
2858 }
virtual RegExpNode * FilterOneByte(int depth, bool ignore_case)
Definition: jsregexp.cc:2861
RegExpNode * replacement()
Definition: jsregexp.h:636
RegExpNode * set_replacement(RegExpNode *replacement)
Definition: jsregexp.h:640
virtual RegExpNode * FilterOneByte(int depth, bool ignore_case)
Definition: jsregexp.h:632
RegExpNode(Zone *zone)
Definition: jsregexp.h:573

References v8::internal::RegExpNode::FilterOneByte(), v8::internal::ChoiceNode::FilterOneByte(), and NULL.

+ Here is the call graph for this function:

◆ GetQuickCheckDetails()

void v8::internal::LoopChoiceNode::GetQuickCheckDetails ( QuickCheckDetails details,
RegExpCompiler compiler,
int  characters_filled_in,
bool  not_at_start 
)
virtual

Reimplemented from v8::internal::ChoiceNode.

Definition at line 2935 of file jsregexp.cc.

2938  {
2939  if (body_can_be_zero_length_ || info()->visited) return;
2940  VisitMarker marker(info());
2941  return ChoiceNode::GetQuickCheckDetails(details,
2942  compiler,
2943  characters_filled_in,
2944  not_at_start);
2945 }
virtual void GetQuickCheckDetails(QuickCheckDetails *details, RegExpCompiler *compiler, int characters_filled_in, bool not_at_start)
Definition: jsregexp.cc:2962

References v8::internal::ChoiceNode::GetQuickCheckDetails().

+ Here is the call graph for this function:

◆ loop_node()

RegExpNode* v8::internal::LoopChoiceNode::loop_node ( )
inline

Definition at line 1185 of file jsregexp.h.

1185 { return loop_node_; }

References loop_node_.

Referenced by v8::internal::Analysis::VisitLoopChoice().

+ Here is the caller graph for this function:

Member Data Documentation

◆ body_can_be_zero_length_

bool v8::internal::LoopChoiceNode::body_can_be_zero_length_
private

Definition at line 1201 of file jsregexp.h.

Referenced by body_can_be_zero_length().

◆ continue_node_

RegExpNode* v8::internal::LoopChoiceNode::continue_node_
private

Definition at line 1200 of file jsregexp.h.

Referenced by continue_node().

◆ loop_node_

RegExpNode* v8::internal::LoopChoiceNode::loop_node_
private

Definition at line 1199 of file jsregexp.h.

Referenced by loop_node().


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