V8 Project
v8::internal::BoyerMoorePositionInfo Class Reference

#include <jsregexp.h>

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

Public Member Functions

 BoyerMoorePositionInfo (Zone *zone)
 
boolat (int i)
 
int map_count () const
 
void Set (int character)
 
void SetInterval (const Interval &interval)
 
void SetAll ()
 
bool is_non_word ()
 
bool is_word ()
 
- 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)
 

Static Public Attributes

static const int kMapSize = 128
 
static const int kMask = kMapSize - 1
 

Private Attributes

ZoneList< bool > * map_
 
int map_count_
 
ContainedInLattice w_
 
ContainedInLattice s_
 
ContainedInLattice d_
 
ContainedInLattice surrogate_
 

Detailed Description

Definition at line 1249 of file jsregexp.h.

Constructor & Destructor Documentation

◆ BoyerMoorePositionInfo()

v8::internal::BoyerMoorePositionInfo::BoyerMoorePositionInfo ( Zone zone)
inlineexplicit

Definition at line 1251 of file jsregexp.h.

1252  : map_(new(zone) ZoneList<bool>(kMapSize, zone)),
1253  map_count_(0),
1254  w_(kNotYet),
1255  s_(kNotYet),
1256  d_(kNotYet),
1257  surrogate_(kNotYet) {
1258  for (int i = 0; i < kMapSize; i++) {
1259  map_->Add(false, zone);
1260  }
1261  }
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
Definition: list-inl.h:17

References v8::internal::List< T, AllocationPolicy >::Add(), kMapSize, and map_.

+ Here is the call graph for this function:

Member Function Documentation

◆ at()

bool& v8::internal::BoyerMoorePositionInfo::at ( int  i)
inline

Definition at line 1263 of file jsregexp.h.

1263 { return map_->at(i); }
T & at(int i) const
Definition: list.h:69

References v8::internal::List< T, AllocationPolicy >::at(), and map_.

+ Here is the call graph for this function:

◆ is_non_word()

bool v8::internal::BoyerMoorePositionInfo::is_non_word ( )
inline

Definition at line 1273 of file jsregexp.h.

1273 { return w_ == kLatticeOut; }

References v8::internal::kLatticeOut, and w_.

Referenced by v8::internal::AssertionNode::EmitBoundaryCheck().

+ Here is the caller graph for this function:

◆ is_word()

bool v8::internal::BoyerMoorePositionInfo::is_word ( )
inline

Definition at line 1274 of file jsregexp.h.

1274 { return w_ == kLatticeIn; }

References v8::internal::kLatticeIn, and w_.

Referenced by v8::internal::AssertionNode::EmitBoundaryCheck().

+ Here is the caller graph for this function:

◆ map_count()

int v8::internal::BoyerMoorePositionInfo::map_count ( ) const
inline

Definition at line 1268 of file jsregexp.h.

1268 { return map_count_; }

References map_count_.

◆ Set()

void v8::internal::BoyerMoorePositionInfo::Set ( int  character)

Definition at line 3595 of file jsregexp.cc.

3595  {
3596  SetInterval(Interval(character, character));
3597 }
void SetInterval(const Interval &interval)
Definition: jsregexp.cc:3600

Referenced by v8::internal::BoyerMooreLookahead::Set().

+ Here is the caller graph for this function:

◆ SetAll()

void v8::internal::BoyerMoorePositionInfo::SetAll ( )

Definition at line 3624 of file jsregexp.cc.

3624  {
3625  s_ = w_ = d_ = kLatticeUnknown;
3626  if (map_count_ != kMapSize) {
3627  map_count_ = kMapSize;
3628  for (int i = 0; i < kMapSize; i++) map_->at(i) = true;
3629  }
3630 }

References v8::internal::kLatticeUnknown.

◆ SetInterval()

void v8::internal::BoyerMoorePositionInfo::SetInterval ( const Interval interval)

Definition at line 3600 of file jsregexp.cc.

3600  {
3601  s_ = AddRange(s_, kSpaceRanges, kSpaceRangeCount, interval);
3602  w_ = AddRange(w_, kWordRanges, kWordRangeCount, interval);
3603  d_ = AddRange(d_, kDigitRanges, kDigitRangeCount, interval);
3604  surrogate_ =
3606  if (interval.to() - interval.from() >= kMapSize - 1) {
3607  if (map_count_ != kMapSize) {
3608  map_count_ = kMapSize;
3609  for (int i = 0; i < kMapSize; i++) map_->at(i) = true;
3610  }
3611  return;
3612  }
3613  for (int i = interval.from(); i <= interval.to(); i++) {
3614  int mod_character = (i & kMask);
3615  if (!map_->at(mod_character)) {
3616  map_count_++;
3617  map_->at(mod_character) = true;
3618  }
3619  if (map_count_ == kMapSize) return;
3620  }
3621 }
static const int kSurrogateRanges[]
Definition: jsregexp.cc:3588
static const int kWordRanges[]
Definition: jsregexp.cc:3583
static const int kSpaceRanges[]
Definition: jsregexp.cc:3577
static const int kSpaceRangeCount
Definition: jsregexp.cc:3581
static const int kDigitRanges[]
Definition: jsregexp.cc:3586
static const int kWordRangeCount
Definition: jsregexp.cc:3585
static const int kSurrogateRangeCount
Definition: jsregexp.cc:3589
static const int kDigitRangeCount
Definition: jsregexp.cc:3587
ContainedInLattice AddRange(ContainedInLattice containment, const int *ranges, int ranges_length, Interval new_range)
Definition: jsregexp.cc:99

References v8::internal::AddRange(), v8::internal::Interval::from(), v8::internal::kDigitRangeCount, v8::internal::kDigitRanges, v8::internal::kSpaceRangeCount, v8::internal::kSpaceRanges, v8::internal::kSurrogateRangeCount, v8::internal::kSurrogateRanges, v8::internal::kWordRangeCount, v8::internal::kWordRanges, and v8::internal::Interval::to().

Referenced by v8::internal::BoyerMooreLookahead::SetInterval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ d_

ContainedInLattice v8::internal::BoyerMoorePositionInfo::d_
private

Definition at line 1281 of file jsregexp.h.

◆ kMapSize

const int v8::internal::BoyerMoorePositionInfo::kMapSize = 128
static

Definition at line 1265 of file jsregexp.h.

Referenced by BoyerMoorePositionInfo().

◆ kMask

const int v8::internal::BoyerMoorePositionInfo::kMask = kMapSize - 1
static

Definition at line 1266 of file jsregexp.h.

◆ map_

ZoneList<bool>* v8::internal::BoyerMoorePositionInfo::map_
private

Definition at line 1277 of file jsregexp.h.

Referenced by at(), and BoyerMoorePositionInfo().

◆ map_count_

int v8::internal::BoyerMoorePositionInfo::map_count_
private

Definition at line 1278 of file jsregexp.h.

Referenced by map_count().

◆ s_

ContainedInLattice v8::internal::BoyerMoorePositionInfo::s_
private

Definition at line 1280 of file jsregexp.h.

◆ surrogate_

ContainedInLattice v8::internal::BoyerMoorePositionInfo::surrogate_
private

Definition at line 1282 of file jsregexp.h.

◆ w_

ContainedInLattice v8::internal::BoyerMoorePositionInfo::w_
private

Definition at line 1279 of file jsregexp.h.

Referenced by is_non_word(), and is_word().


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