// Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_REGEXP_EXPERIMENTAL_EXPERIMENTAL_H_ #define V8_REGEXP_EXPERIMENTAL_EXPERIMENTAL_H_ #include "src/regexp/regexp.h" namespace v8 { namespace internal { class ExperimentalRegExp final : public AllStatic { public: // Initialization & Compilation // ------------------------------------------------------------------------- // Check whether a parsed regexp pattern can be compiled and executed by the // EXPERIMENTAL engine. // TODO(mbid, v8:10765): This walks the RegExpTree, but it could also be // checked on the fly in the parser. Not done currently because walking the // AST again is more flexible and less error prone (but less performant). static bool CanBeHandled(RegExpTree* tree, JSRegExp::Flags flags, int capture_count); static void Initialize(Isolate* isolate, Handle re, Handle pattern, JSRegExp::Flags flags, int capture_count); static bool IsCompiled(Handle re, Isolate* isolate); V8_WARN_UNUSED_RESULT static bool Compile(Isolate* isolate, Handle re); // Execution: static int32_t MatchForCallFromJs(Address subject, int32_t start_position, Address input_start, Address input_end, int* output_registers, int32_t output_register_count, Address backtrack_stack, RegExp::CallOrigin call_origin, Isolate* isolate, Address regexp); static MaybeHandle Exec(Isolate* isolate, Handle regexp, Handle subject, int index, Handle last_match_info); static int32_t ExecRaw(Isolate* isolate, JSRegExp regexp, String subject, int32_t* output_registers, int32_t output_register_count, int32_t subject_index); static constexpr bool kSupportsUnicode = false; }; } // namespace internal } // namespace v8 #endif // V8_REGEXP_EXPERIMENTAL_EXPERIMENTAL_H_