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

Public Member Functions

 RegExpCompiler (int capture_count, bool ignore_case, bool is_one_byte, Zone *zone)
 
int AllocateRegister ()
 
RegExpEngine::CompilationResult Assemble (RegExpMacroAssembler *assembler, RegExpNode *start, int capture_count, Handle< String > pattern)
 
void AddWork (RegExpNode *node)
 
RegExpMacroAssemblermacro_assembler ()
 
EndNodeaccept ()
 
int recursion_depth ()
 
void IncrementRecursionDepth ()
 
void DecrementRecursionDepth ()
 
void SetRegExpTooBig ()
 
bool ignore_case ()
 
bool one_byte ()
 
FrequencyCollatorfrequency_collator ()
 
int current_expansion_factor ()
 
void set_current_expansion_factor (int value)
 
Zonezone () const
 

Static Public Attributes

static const int kImplementationOffset = 0
 
static const int kNumberOfRegistersOffset = 0
 
static const int kCodeOffset = 1
 
static const int kMaxRecursion = 100
 
static const int kNoRegister = -1
 

Private Attributes

EndNodeaccept_
 
int next_register_
 
List< RegExpNode * > * work_list_
 
int recursion_depth_
 
RegExpMacroAssemblermacro_assembler_
 
bool ignore_case_
 
bool one_byte_
 
bool reg_exp_too_big_
 
int current_expansion_factor_
 
FrequencyCollator frequency_collator_
 
Zonezone_
 

Detailed Description

Definition at line 993 of file jsregexp.cc.

Constructor & Destructor Documentation

◆ RegExpCompiler()

v8::internal::RegExpCompiler::RegExpCompiler ( int  capture_count,
bool  ignore_case,
bool  is_one_byte,
Zone zone 
)

Definition at line 1073 of file jsregexp.cc.

1075  : next_register_(2 * (capture_count + 1)),
1076  work_list_(NULL),
1077  recursion_depth_(0),
1080  reg_exp_too_big_(false),
1083  zone_(zone) {
1084  accept_ = new(zone) EndNode(EndNode::ACCEPT, zone);
1086 }
FrequencyCollator frequency_collator_
Definition: jsregexp.cc:1050
List< RegExpNode * > * work_list_
Definition: jsregexp.cc:1043
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(condition)
Definition: logging.h:205

References v8::internal::EndNode::ACCEPT, accept_, DCHECK, v8::internal::RegExpMacroAssembler::kMaxRegister, next_register_, and zone().

+ Here is the call graph for this function:

Member Function Documentation

◆ accept()

EndNode* v8::internal::RegExpCompiler::accept ( )
inline

Definition at line 1018 of file jsregexp.cc.

1018 { return accept_; }

Referenced by v8::internal::RegExpEngine::Compile().

+ Here is the caller graph for this function:

◆ AddWork()

void v8::internal::RegExpCompiler::AddWork ( RegExpNode node)
inline

Definition at line 1011 of file jsregexp.cc.

1011 { work_list_->Add(node); }

Referenced by v8::internal::RegExpNode::LimitVersions().

+ Here is the caller graph for this function:

◆ AllocateRegister()

int v8::internal::RegExpCompiler::AllocateRegister ( )
inline

Definition at line 998 of file jsregexp.cc.

998  {
1000  reg_exp_too_big_ = true;
1001  return next_register_;
1002  }
1003  return next_register_++;
1004  }

References v8::internal::RegExpMacroAssembler::kMaxRegister.

◆ Assemble()

RegExpEngine::CompilationResult v8::internal::RegExpCompiler::Assemble ( RegExpMacroAssembler assembler,
RegExpNode start,
int  capture_count,
Handle< String pattern 
)

Definition at line 1089 of file jsregexp.cc.

1093  {
1094  Heap* heap = pattern->GetHeap();
1095 
1096  bool use_slow_safe_regexp_compiler = false;
1097  if (heap->total_regexp_code_generated() >
1099  heap->isolate()->memory_allocator()->SizeExecutable() >
1101  use_slow_safe_regexp_compiler = true;
1102  }
1103 
1104  macro_assembler->set_slow_safe(use_slow_safe_regexp_compiler);
1105 
1106 #ifdef DEBUG
1107  if (FLAG_trace_regexp_assembler)
1108  macro_assembler_ = new RegExpMacroAssemblerTracer(macro_assembler);
1109  else
1110 #endif
1112 
1113  List <RegExpNode*> work_list(0);
1114  work_list_ = &work_list;
1115  Label fail;
1117  Trace new_trace;
1118  start->Emit(this, &new_trace);
1119  macro_assembler_->Bind(&fail);
1121  while (!work_list.is_empty()) {
1122  work_list.RemoveLast()->Emit(this, &new_trace);
1123  }
1125 
1126  Handle<HeapObject> code = macro_assembler_->GetCode(pattern);
1127  heap->IncreaseTotalRegexpCodeGenerated(code->Size());
1128  work_list_ = NULL;
1129 #ifdef DEBUG
1130  if (FLAG_print_code) {
1131  CodeTracer::Scope trace_scope(heap->isolate()->GetCodeTracer());
1132  OFStream os(trace_scope.file());
1133  Handle<Code>::cast(code)->Disassemble(pattern->ToCString().get(), os);
1134  }
1135  if (FLAG_trace_regexp_assembler) {
1136  delete macro_assembler_;
1137  }
1138 #endif
1139  return RegExpEngine::CompilationResult(*code, next_register_);
1140 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
RegExpMacroAssembler * macro_assembler()
Definition: jsregexp.cc:1017
RegExpMacroAssembler * macro_assembler_
Definition: jsregexp.cc:1045
static const int kRegWxpCompiledLimit
Definition: jsregexp.h:216
static const int kRegExpExecutableMemoryLimit
Definition: jsregexp.h:215
virtual void Bind(Label *label)=0
virtual void PushBacktrack(Label *label)=0
virtual Handle< HeapObject > GetCode(Handle< String > source)=0
Isolate * isolate() const
Definition: zone.h:68
static void Trace(const char *msg,...)
Definition: scheduler.cc:21
static RegExpEngine::CompilationResult IrregexpRegExpTooBig(Isolate *isolate)
Definition: jsregexp.cc:1066

References v8::internal::RegExpMacroAssembler::Bind(), v8::internal::Handle< T >::cast(), v8::internal::RegExpNode::Emit(), v8::internal::RegExpMacroAssembler::Fail(), v8::internal::RegExpMacroAssembler::GetCode(), v8::internal::Isolate::GetCodeTracer(), v8::internal::Heap::IncreaseTotalRegexpCodeGenerated(), v8::internal::IrregexpRegExpTooBig(), v8::internal::Heap::isolate(), v8::internal::Zone::isolate(), v8::internal::RegExpImpl::kRegExpExecutableMemoryLimit, v8::internal::RegExpImpl::kRegWxpCompiledLimit, macro_assembler(), macro_assembler_, v8::internal::Isolate::memory_allocator(), next_register_, NULL, v8::internal::RegExpMacroAssembler::PushBacktrack(), reg_exp_too_big_, v8::internal::RegExpMacroAssembler::set_slow_safe(), v8::internal::MemoryAllocator::SizeExecutable(), v8::internal::Heap::total_regexp_code_generated(), work_list_, and zone_.

Referenced by v8::internal::RegExpEngine::Compile().

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

◆ current_expansion_factor()

int v8::internal::RegExpCompiler::current_expansion_factor ( )
inline

Definition at line 1031 of file jsregexp.cc.

1031 { return current_expansion_factor_; }

◆ DecrementRecursionDepth()

void v8::internal::RegExpCompiler::DecrementRecursionDepth ( )
inline

Definition at line 1023 of file jsregexp.cc.

1023 { recursion_depth_--; }

◆ frequency_collator()

FrequencyCollator* v8::internal::RegExpCompiler::frequency_collator ( )
inline

Definition at line 1029 of file jsregexp.cc.

1029 { return &frequency_collator_; }

Referenced by v8::internal::RegExpEngine::Compile(), and v8::internal::BoyerMooreLookahead::FindBestInterval().

+ Here is the caller graph for this function:

◆ ignore_case()

bool v8::internal::RegExpCompiler::ignore_case ( )
inline

Definition at line 1027 of file jsregexp.cc.

1027 { return ignore_case_; }

Referenced by v8::internal::TextNode::Emit(), v8::internal::BackReferenceNode::Emit(), v8::internal::TextNode::FillInBMInfo(), and v8::internal::TextNode::GetQuickCheckDetails().

+ Here is the caller graph for this function:

◆ IncrementRecursionDepth()

void v8::internal::RegExpCompiler::IncrementRecursionDepth ( )
inline

Definition at line 1022 of file jsregexp.cc.

1022 { recursion_depth_++; }

Referenced by v8::internal::RecursionCheck::RecursionCheck().

+ Here is the caller graph for this function:

◆ macro_assembler()

◆ one_byte()

◆ recursion_depth()

int v8::internal::RegExpCompiler::recursion_depth ( )
inline

Definition at line 1021 of file jsregexp.cc.

1021 { return recursion_depth_; }

Referenced by v8::internal::RegExpNode::LimitVersions().

+ Here is the caller graph for this function:

◆ set_current_expansion_factor()

void v8::internal::RegExpCompiler::set_current_expansion_factor ( int  value)
inline

Definition at line 1032 of file jsregexp.cc.

1032  {
1033  current_expansion_factor_ = value;
1034  }

Referenced by v8::internal::RegExpExpansionLimiter::RegExpExpansionLimiter(), and v8::internal::RegExpExpansionLimiter::~RegExpExpansionLimiter().

+ Here is the caller graph for this function:

◆ SetRegExpTooBig()

void v8::internal::RegExpCompiler::SetRegExpTooBig ( )
inline

Definition at line 1025 of file jsregexp.cc.

1025 { reg_exp_too_big_ = true; }

Referenced by v8::internal::Trace::AdvanceCurrentPositionInTrace(), and v8::internal::TextNode::Emit().

+ Here is the caller graph for this function:

◆ zone()

Zone* v8::internal::RegExpCompiler::zone ( ) const
inline

Definition at line 1036 of file jsregexp.cc.

1036 { return zone_; }

Referenced by v8::internal::Trace::Flush(), and RegExpCompiler().

+ Here is the caller graph for this function:

Member Data Documentation

◆ accept_

EndNode* v8::internal::RegExpCompiler::accept_
private

Definition at line 1041 of file jsregexp.cc.

Referenced by RegExpCompiler().

◆ current_expansion_factor_

int v8::internal::RegExpCompiler::current_expansion_factor_
private

Definition at line 1049 of file jsregexp.cc.

◆ frequency_collator_

FrequencyCollator v8::internal::RegExpCompiler::frequency_collator_
private

Definition at line 1050 of file jsregexp.cc.

◆ ignore_case_

bool v8::internal::RegExpCompiler::ignore_case_
private

Definition at line 1046 of file jsregexp.cc.

◆ kCodeOffset

const int v8::internal::RegExpCompiler::kCodeOffset = 1
static

Definition at line 1015 of file jsregexp.cc.

◆ kImplementationOffset

const int v8::internal::RegExpCompiler::kImplementationOffset = 0
static

Definition at line 1013 of file jsregexp.cc.

◆ kMaxRecursion

const int v8::internal::RegExpCompiler::kMaxRecursion = 100
static

◆ kNoRegister

const int v8::internal::RegExpCompiler::kNoRegister = -1
static

◆ kNumberOfRegistersOffset

const int v8::internal::RegExpCompiler::kNumberOfRegistersOffset = 0
static

Definition at line 1014 of file jsregexp.cc.

◆ macro_assembler_

RegExpMacroAssembler* v8::internal::RegExpCompiler::macro_assembler_
private

Definition at line 1045 of file jsregexp.cc.

Referenced by Assemble().

◆ next_register_

int v8::internal::RegExpCompiler::next_register_
private

Definition at line 1042 of file jsregexp.cc.

Referenced by Assemble(), and RegExpCompiler().

◆ one_byte_

bool v8::internal::RegExpCompiler::one_byte_
private

Definition at line 1047 of file jsregexp.cc.

◆ recursion_depth_

int v8::internal::RegExpCompiler::recursion_depth_
private

Definition at line 1044 of file jsregexp.cc.

◆ reg_exp_too_big_

bool v8::internal::RegExpCompiler::reg_exp_too_big_
private

Definition at line 1048 of file jsregexp.cc.

Referenced by Assemble().

◆ work_list_

List<RegExpNode*>* v8::internal::RegExpCompiler::work_list_
private

Definition at line 1043 of file jsregexp.cc.

Referenced by Assemble().

◆ zone_

Zone* v8::internal::RegExpCompiler::zone_
private

Definition at line 1051 of file jsregexp.cc.

Referenced by Assemble().


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