Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Attributes | List of all members
dart::RegExpExpansionLimiter Class Reference
Inheritance diagram for dart::RegExpExpansionLimiter:
dart::ValueObject

Public Member Functions

 RegExpExpansionLimiter (RegExpCompiler *compiler, intptr_t factor)
 
 ~RegExpExpansionLimiter ()
 
bool ok_to_expand ()
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Static Public Attributes

static constexpr intptr_t kMaxExpansionFactor = 6
 

Detailed Description

Definition at line 4223 of file regexp.cc.

Constructor & Destructor Documentation

◆ RegExpExpansionLimiter()

dart::RegExpExpansionLimiter::RegExpExpansionLimiter ( RegExpCompiler compiler,
intptr_t  factor 
)
inline

Definition at line 4226 of file regexp.cc.

4227 : compiler_(compiler),
4228 saved_expansion_factor_(compiler->current_expansion_factor()),
4229 ok_to_expand_(saved_expansion_factor_ <= kMaxExpansionFactor) {
4230 ASSERT(factor > 0);
4231 if (ok_to_expand_) {
4232 if (factor > kMaxExpansionFactor) {
4233 // Avoid integer overflow of the current expansion factor.
4234 ok_to_expand_ = false;
4235 compiler->set_current_expansion_factor(kMaxExpansionFactor + 1);
4236 } else {
4237 intptr_t new_factor = saved_expansion_factor_ * factor;
4238 ok_to_expand_ = (new_factor <= kMaxExpansionFactor);
4239 compiler->set_current_expansion_factor(new_factor);
4240 }
4241 }
4242 }
static constexpr intptr_t kMaxExpansionFactor
Definition: regexp.cc:4225
#define ASSERT(E)

◆ ~RegExpExpansionLimiter()

dart::RegExpExpansionLimiter::~RegExpExpansionLimiter ( )
inline

Definition at line 4244 of file regexp.cc.

4244 {
4245 compiler_->set_current_expansion_factor(saved_expansion_factor_);
4246 }
void set_current_expansion_factor(intptr_t value)
Definition: regexp.cc:349

Member Function Documentation

◆ ok_to_expand()

bool dart::RegExpExpansionLimiter::ok_to_expand ( )
inline

Definition at line 4248 of file regexp.cc.

4248{ return ok_to_expand_; }

Member Data Documentation

◆ kMaxExpansionFactor

constexpr intptr_t dart::RegExpExpansionLimiter::kMaxExpansionFactor = 6
staticconstexpr

Definition at line 4225 of file regexp.cc.


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