6 #ifndef V8_REGEXP_JSREGEXP_INL_H_ 7 #define V8_REGEXP_JSREGEXP_INL_H_ 9 #include "src/allocation.h" 10 #include "src/objects.h" 11 #include "src/objects/js-regexp-inl.h" 12 #include "src/regexp/jsregexp.h" 18 RegExpImpl::GlobalCache::~GlobalCache() {
21 if (register_array_size_ > Isolate::kJSRegexpStaticOffsetsVectorSize) {
22 DeleteArray(register_array_);
27 int32_t* RegExpImpl::GlobalCache::FetchNext() {
28 current_match_index_++;
29 if (current_match_index_ >= num_matches_) {
32 if (num_matches_ < max_matches_) {
38 ®ister_array_[(current_match_index_ - 1) * registers_per_match_];
39 int last_end_index = last_match[1];
41 if (regexp_->TypeTag() == JSRegExp::ATOM) {
43 RegExpImpl::AtomExecRaw(isolate_, regexp_, subject_, last_end_index,
44 register_array_, register_array_size_);
46 int last_start_index = last_match[0];
47 if (last_start_index == last_end_index) {
49 last_end_index = AdvanceZeroLength(last_end_index);
51 if (last_end_index > subject_->length()) {
55 num_matches_ = RegExpImpl::IrregexpExecRaw(
56 isolate_, regexp_, subject_, last_end_index, register_array_,
57 register_array_size_);
60 if (num_matches_ <= 0)
return nullptr;
61 current_match_index_ = 0;
62 return register_array_;
64 return ®ister_array_[current_match_index_ * registers_per_match_];
69 int32_t* RegExpImpl::GlobalCache::LastSuccessfulMatch() {
70 int index = current_match_index_ * registers_per_match_;
71 if (num_matches_ == 0) {
73 index -= registers_per_match_;
75 return ®ister_array_[index];
78 RegExpEngine::CompilationResult::CompilationResult(Isolate* isolate,
79 const char* error_message)
80 : error_message(error_message),
81 code(ReadOnlyRoots(isolate).the_hole_value()) {}
86 #endif // V8_REGEXP_JSREGEXP_INL_H_