V8 Project
v8::internal::RegExpExpansionLimiter Class Reference
+ Collaboration diagram for v8::internal::RegExpExpansionLimiter:

Public Member Functions

 RegExpExpansionLimiter (RegExpCompiler *compiler, int factor)
 
 ~RegExpExpansionLimiter ()
 
bool ok_to_expand ()
 

Static Public Attributes

static const int kMaxExpansionFactor = 6
 

Private Member Functions

 DISALLOW_IMPLICIT_CONSTRUCTORS (RegExpExpansionLimiter)
 

Private Attributes

RegExpCompilercompiler_
 
int saved_expansion_factor_
 
bool ok_to_expand_
 

Detailed Description

Definition at line 4871 of file jsregexp.cc.

Constructor & Destructor Documentation

◆ RegExpExpansionLimiter()

v8::internal::RegExpExpansionLimiter::RegExpExpansionLimiter ( RegExpCompiler compiler,
int  factor 
)
inline

Definition at line 4874 of file jsregexp.cc.

4875  : compiler_(compiler),
4876  saved_expansion_factor_(compiler->current_expansion_factor()),
4878  DCHECK(factor > 0);
4879  if (ok_to_expand_) {
4880  if (factor > kMaxExpansionFactor) {
4881  // Avoid integer overflow of the current expansion factor.
4882  ok_to_expand_ = false;
4883  compiler->set_current_expansion_factor(kMaxExpansionFactor + 1);
4884  } else {
4885  int new_factor = saved_expansion_factor_ * factor;
4886  ok_to_expand_ = (new_factor <= kMaxExpansionFactor);
4887  compiler->set_current_expansion_factor(new_factor);
4888  }
4889  }
4890  }
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, kMaxExpansionFactor, ok_to_expand_, saved_expansion_factor_, and v8::internal::RegExpCompiler::set_current_expansion_factor().

+ Here is the call graph for this function:

◆ ~RegExpExpansionLimiter()

v8::internal::RegExpExpansionLimiter::~RegExpExpansionLimiter ( )
inline

Definition at line 4892 of file jsregexp.cc.

References compiler_, saved_expansion_factor_, and v8::internal::RegExpCompiler::set_current_expansion_factor().

+ Here is the call graph for this function:

Member Function Documentation

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::RegExpExpansionLimiter::DISALLOW_IMPLICIT_CONSTRUCTORS ( RegExpExpansionLimiter  )
private

◆ ok_to_expand()

bool v8::internal::RegExpExpansionLimiter::ok_to_expand ( )
inline

Definition at line 4896 of file jsregexp.cc.

4896 { return ok_to_expand_; }

References ok_to_expand_.

Member Data Documentation

◆ compiler_

RegExpCompiler* v8::internal::RegExpExpansionLimiter::compiler_
private

Definition at line 4899 of file jsregexp.cc.

Referenced by ~RegExpExpansionLimiter().

◆ kMaxExpansionFactor

const int v8::internal::RegExpExpansionLimiter::kMaxExpansionFactor = 6
static

Definition at line 4873 of file jsregexp.cc.

Referenced by RegExpExpansionLimiter().

◆ ok_to_expand_

bool v8::internal::RegExpExpansionLimiter::ok_to_expand_
private

Definition at line 4901 of file jsregexp.cc.

Referenced by ok_to_expand(), and RegExpExpansionLimiter().

◆ saved_expansion_factor_

int v8::internal::RegExpExpansionLimiter::saved_expansion_factor_
private

Definition at line 4900 of file jsregexp.cc.

Referenced by RegExpExpansionLimiter(), and ~RegExpExpansionLimiter().


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