11cb0ef41Sopenharmony_ci// Copyright 2020 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_REGEXP_EXPERIMENTAL_EXPERIMENTAL_INTERPRETER_H_ 61cb0ef41Sopenharmony_ci#define V8_REGEXP_EXPERIMENTAL_EXPERIMENTAL_INTERPRETER_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include "src/regexp/experimental/experimental-bytecode.h" 91cb0ef41Sopenharmony_ci#include "src/regexp/regexp.h" 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_cinamespace v8 { 121cb0ef41Sopenharmony_cinamespace internal { 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciclass ByteArray; 151cb0ef41Sopenharmony_ciclass String; 161cb0ef41Sopenharmony_ciclass Zone; 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciclass ExperimentalRegExpInterpreter final : public AllStatic { 191cb0ef41Sopenharmony_ci public: 201cb0ef41Sopenharmony_ci // Executes a bytecode program in breadth-first NFA mode, without 211cb0ef41Sopenharmony_ci // backtracking, to find matching substrings. Trys to find up to 221cb0ef41Sopenharmony_ci // `max_match_num` matches in `input`, starting at `start_index`. Returns 231cb0ef41Sopenharmony_ci // the actual number of matches found. The boundaries of matching subranges 241cb0ef41Sopenharmony_ci // are written to `matches_out`. Provided in variants for one-byte and 251cb0ef41Sopenharmony_ci // two-byte strings. 261cb0ef41Sopenharmony_ci static int FindMatches(Isolate* isolate, RegExp::CallOrigin call_origin, 271cb0ef41Sopenharmony_ci ByteArray bytecode, int capture_count, String input, 281cb0ef41Sopenharmony_ci int start_index, int32_t* output_registers, 291cb0ef41Sopenharmony_ci int output_register_count, Zone* zone); 301cb0ef41Sopenharmony_ci}; 311cb0ef41Sopenharmony_ci 321cb0ef41Sopenharmony_ci} // namespace internal 331cb0ef41Sopenharmony_ci} // namespace v8 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ci#endif // V8_REGEXP_EXPERIMENTAL_EXPERIMENTAL_INTERPRETER_H_ 36