V8 Project
v8::internal::RegExpImpl::GlobalCache Class Reference

#include <jsregexp.h>

+ Collaboration diagram for v8::internal::RegExpImpl::GlobalCache:

Public Member Functions

 GlobalCache (Handle< JSRegExp > regexp, Handle< String > subject, bool is_global, Isolate *isolate)
 
 INLINE (~GlobalCache())
 
 INLINE (int32_t *FetchNext())
 
 INLINE (int32_t *LastSuccessfulMatch())
 
 INLINE (bool HasException())
 

Private Attributes

int num_matches_
 
int max_matches_
 
int current_match_index_
 
int registers_per_match_
 
int32_t * register_array_
 
int register_array_size_
 
Handle< JSRegExpregexp_
 
Handle< Stringsubject_
 

Detailed Description

Definition at line 128 of file jsregexp.h.

Constructor & Destructor Documentation

◆ GlobalCache()

v8::internal::RegExpImpl::GlobalCache::GlobalCache ( Handle< JSRegExp regexp,
Handle< String subject,
bool  is_global,
Isolate isolate 
)

Definition at line 685 of file jsregexp.cc.

691  regexp_(regexp),
692  subject_(subject) {
693 #ifdef V8_INTERPRETED_REGEXP
694  bool interpreted = true;
695 #else
696  bool interpreted = false;
697 #endif // V8_INTERPRETED_REGEXP
698 
699  if (regexp_->TypeTag() == JSRegExp::ATOM) {
700  static const int kAtomRegistersPerMatch = 2;
701  registers_per_match_ = kAtomRegistersPerMatch;
702  // There is no distinction between interpreted and native for atom regexps.
703  interpreted = false;
704  } else {
706  if (registers_per_match_ < 0) {
707  num_matches_ = -1; // Signal exception.
708  return;
709  }
710  }
711 
712  if (is_global && !interpreted) {
716  } else {
717  // Global loop in interpreted regexp is not implemented. We choose
718  // the size of the offsets vector so that it can only store one match.
720  max_matches_ = 1;
721  }
722 
724  register_array_ = NewArray<int32_t>(register_array_size_);
725  } else {
726  register_array_ = isolate->jsregexp_static_offsets_vector();
727  }
728 
729  // Set state so that fetching the results the first time triggers a call
730  // to the compiled regexp.
733  DCHECK(registers_per_match_ >= 2); // Each match has at least one capture.
735  int32_t* last_match =
737  last_match[0] = -1;
738  last_match[1] = 0;
739 }
static const int kJSRegexpStaticOffsetsVectorSize
Definition: isolate.h:984
static int IrregexpPrepare(Handle< JSRegExp > regexp, Handle< String > subject)
Definition: jsregexp.cc:503
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
#define DCHECK_GE(v1, v2)
Definition: logging.h:208
#define DCHECK(condition)
Definition: logging.h:205
int int32_t
Definition: unicode.cc:24
static LifetimePosition Max(LifetimePosition a, LifetimePosition b)

References v8::internal::JSRegExp::ATOM, current_match_index_, DCHECK, DCHECK_GE, v8::internal::RegExpImpl::IrregexpPrepare(), v8::internal::Isolate::kJSRegexpStaticOffsetsVectorSize, v8::internal::Max(), max_matches_, num_matches_, regexp_, register_array_, register_array_size_, registers_per_match_, and subject_.

+ Here is the call graph for this function:

Member Function Documentation

◆ INLINE() [1/4]

v8::internal::RegExpImpl::GlobalCache::INLINE ( bool   HasException())
inline

Definition at line 145 of file jsregexp.h.

145 { return num_matches_ < 0; }

References num_matches_.

◆ INLINE() [2/4]

v8::internal::RegExpImpl::GlobalCache::INLINE ( int32_t *  FetchNext())

◆ INLINE() [3/4]

v8::internal::RegExpImpl::GlobalCache::INLINE ( int32_t *  LastSuccessfulMatch())

◆ INLINE() [4/4]

v8::internal::RegExpImpl::GlobalCache::INLINE ( GlobalCache())

Member Data Documentation

◆ current_match_index_

int v8::internal::RegExpImpl::GlobalCache::current_match_index_
private

Definition at line 150 of file jsregexp.h.

Referenced by GlobalCache().

◆ max_matches_

int v8::internal::RegExpImpl::GlobalCache::max_matches_
private

Definition at line 149 of file jsregexp.h.

Referenced by GlobalCache().

◆ num_matches_

int v8::internal::RegExpImpl::GlobalCache::num_matches_
private

Definition at line 148 of file jsregexp.h.

Referenced by GlobalCache(), and INLINE().

◆ regexp_

Handle<JSRegExp> v8::internal::RegExpImpl::GlobalCache::regexp_
private

Definition at line 155 of file jsregexp.h.

Referenced by GlobalCache().

◆ register_array_

int32_t* v8::internal::RegExpImpl::GlobalCache::register_array_
private

Definition at line 153 of file jsregexp.h.

Referenced by GlobalCache().

◆ register_array_size_

int v8::internal::RegExpImpl::GlobalCache::register_array_size_
private

Definition at line 154 of file jsregexp.h.

Referenced by GlobalCache().

◆ registers_per_match_

int v8::internal::RegExpImpl::GlobalCache::registers_per_match_
private

Definition at line 151 of file jsregexp.h.

Referenced by GlobalCache().

◆ subject_

Handle<String> v8::internal::RegExpImpl::GlobalCache::subject_
private

Definition at line 156 of file jsregexp.h.

Referenced by GlobalCache().


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