1// Copyright 2020 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef V8_REGEXP_EXPERIMENTAL_EXPERIMENTAL_INTERPRETER_H_ 6#define V8_REGEXP_EXPERIMENTAL_EXPERIMENTAL_INTERPRETER_H_ 7 8#include "src/regexp/experimental/experimental-bytecode.h" 9#include "src/regexp/regexp.h" 10 11namespace v8 { 12namespace internal { 13 14class ByteArray; 15class String; 16class Zone; 17 18class ExperimentalRegExpInterpreter final : public AllStatic { 19 public: 20 // Executes a bytecode program in breadth-first NFA mode, without 21 // backtracking, to find matching substrings. Trys to find up to 22 // `max_match_num` matches in `input`, starting at `start_index`. Returns 23 // the actual number of matches found. The boundaries of matching subranges 24 // are written to `matches_out`. Provided in variants for one-byte and 25 // two-byte strings. 26 static int FindMatches(Isolate* isolate, RegExp::CallOrigin call_origin, 27 ByteArray bytecode, int capture_count, String input, 28 int start_index, int32_t* output_registers, 29 int output_register_count, Zone* zone); 30}; 31 32} // namespace internal 33} // namespace v8 34 35#endif // V8_REGEXP_EXPERIMENTAL_EXPERIMENTAL_INTERPRETER_H_ 36