v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
experimental.h
Go to the documentation of this file.
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_H_
6#define V8_REGEXP_EXPERIMENTAL_EXPERIMENTAL_H_
7
9#include "src/regexp/regexp.h"
10
11namespace v8 {
12namespace internal {
13
14class ExperimentalRegExp final : public AllStatic {
15 public:
16 // Initialization & Compilation
17 // -------------------------------------------------------------------------
18 // Check whether a parsed regexp pattern can be compiled and executed by the
19 // EXPERIMENTAL engine.
20 // TODO(mbid, v8:10765): This walks the RegExpTree, but it could also be
21 // checked on the fly in the parser. Not done currently because walking the
22 // AST again is more flexible and less error prone (but less performant).
24 RegExpFlags flags, int capture_count);
25 static void Initialize(Isolate* isolate, DirectHandle<JSRegExp> re,
27 int capture_count);
28 static bool IsCompiled(DirectHandle<IrRegExpData> re_data, Isolate* isolate);
30 static bool Compile(Isolate* isolate, DirectHandle<IrRegExpData> re_data);
31
32 // Execution:
33 static int32_t MatchForCallFromJs(Address subject, int32_t start_position,
34 Address input_start, Address input_end,
35 int* output_registers,
36 int32_t output_register_count,
38 Isolate* isolate, Address regexp_data);
39 static std::optional<int> Exec(Isolate* isolate,
41 DirectHandle<String> subject, int index,
42 int32_t* result_offsets_vector,
43 uint32_t result_offsets_vector_length);
44 static int32_t ExecRaw(Isolate* isolate, RegExp::CallOrigin call_origin,
45 Tagged<IrRegExpData> regexp_data,
46 Tagged<String> subject, int32_t* output_registers,
47 int32_t output_register_count, int32_t subject_index);
48
49 // Compile and execute a regexp with the experimental engine, regardless of
50 // its type tag. The regexp itself is not changed (apart from lastIndex).
51 static std::optional<int> OneshotExec(Isolate* isolate,
53 DirectHandle<String> subject, int index,
54 int32_t* result_offsets_vector,
55 uint32_t result_offsets_vector_length);
56 static int32_t OneshotExecRaw(Isolate* isolate,
59 int32_t* output_registers,
60 int32_t output_register_count,
61 int32_t subject_index);
62
63 static constexpr bool kSupportsUnicode = false;
64};
65
66} // namespace internal
67} // namespace v8
68
69#endif // V8_REGEXP_EXPERIMENTAL_EXPERIMENTAL_H_
static int32_t ExecRaw(Isolate *isolate, RegExp::CallOrigin call_origin, Tagged< IrRegExpData > regexp_data, Tagged< String > subject, int32_t *output_registers, int32_t output_register_count, int32_t subject_index)
static void Initialize(Isolate *isolate, DirectHandle< JSRegExp > re, DirectHandle< String > pattern, RegExpFlags flags, int capture_count)
static int32_t MatchForCallFromJs(Address subject, int32_t start_position, Address input_start, Address input_end, int *output_registers, int32_t output_register_count, RegExp::CallOrigin call_origin, Isolate *isolate, Address regexp_data)
static bool CanBeHandled(RegExpTree *tree, DirectHandle< String > pattern, RegExpFlags flags, int capture_count)
static bool IsCompiled(DirectHandle< IrRegExpData > re_data, Isolate *isolate)
static constexpr bool kSupportsUnicode
static V8_WARN_UNUSED_RESULT bool Compile(Isolate *isolate, DirectHandle< IrRegExpData > re_data)
static std::optional< int > Exec(Isolate *isolate, DirectHandle< IrRegExpData > regexp_data, DirectHandle< String > subject, int index, int32_t *result_offsets_vector, uint32_t result_offsets_vector_length)
static std::optional< int > OneshotExec(Isolate *isolate, DirectHandle< IrRegExpData > regexp_data, DirectHandle< String > subject, int index, int32_t *result_offsets_vector, uint32_t result_offsets_vector_length)
static int32_t OneshotExecRaw(Isolate *isolate, DirectHandle< IrRegExpData > regexp_data, DirectHandle< String > subject, int32_t *output_registers, int32_t output_register_count, int32_t subject_index)
std::string pattern
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:671