v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
regexp-interpreter.h
Go to the documentation of this file.
1
// Copyright 2011 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_REGEXP_INTERPRETER_H_
6
#define V8_REGEXP_REGEXP_INTERPRETER_H_
7
8
// A simple interpreter for the Irregexp byte code.
9
10
#include "
src/regexp/regexp.h
"
11
12
namespace
v8
{
13
namespace
internal
{
14
15
class
TrustedByteArray
;
16
17
class
V8_EXPORT_PRIVATE
IrregexpInterpreter
:
public
AllStatic
{
18
public
:
19
enum
Result
{
20
FAILURE
= RegExp::kInternalRegExpFailure,
21
SUCCESS
= RegExp::kInternalRegExpSuccess,
22
EXCEPTION
= RegExp::kInternalRegExpException,
23
RETRY = RegExp::kInternalRegExpRetry,
24
FALLBACK_TO_EXPERIMENTAL = RegExp::kInternalRegExpFallbackToExperimental,
25
};
26
27
// In case a StackOverflow occurs, a StackOverflowException is created and
28
// EXCEPTION is returned.
29
static
int
MatchForCallFromRuntime(
Isolate
* isolate,
30
DirectHandle<IrRegExpData>
regexp_data,
31
DirectHandle<String>
subject_string,
32
int
* output_registers,
33
int
output_register_count,
34
int
start_position);
35
36
// In case a StackOverflow occurs, EXCEPTION is returned. The caller is
37
// responsible for creating the exception.
38
//
39
// RETRY is returned if a retry through the runtime is needed (e.g. when
40
// interrupts have been scheduled or the regexp is marked for tier-up).
41
//
42
// Arguments input_start and input_end are unused. They are only passed to
43
// match the signature of the native irregex code.
44
//
45
// Arguments output_registers and output_register_count describe the results
46
// array, which will contain register values of all captures if one or more
47
// matches were found. In this case, the return value is the number of
48
// matches. For all other return codes, the results array remains unmodified.
49
static
int
MatchForCallFromJs(Address subject, int32_t start_position,
50
Address input_start, Address input_end,
51
int
* output_registers,
52
int32_t output_register_count,
53
RegExp::CallOrigin
call_origin,
54
Isolate
* isolate, Address regexp_data);
55
56
static
Result MatchInternal(
Isolate
* isolate,
57
Tagged<TrustedByteArray>
* code_array,
58
Tagged<String>
* subject_string,
59
int
* output_registers,
int
output_register_count,
60
int
total_register_count,
int
start_position,
61
RegExp::CallOrigin
call_origin,
62
uint32_t backtrack_limit);
63
64
private
:
65
static
int
Match(
Isolate
* isolate,
Tagged<IrRegExpData>
regexp_data,
66
Tagged<String>
subject_string,
int
* output_registers,
67
int
output_register_count,
int
start_position,
68
RegExp::CallOrigin
call_origin);
69
};
70
71
}
// namespace internal
72
}
// namespace v8
73
74
#endif
// V8_REGEXP_REGEXP_INTERPRETER_H_
v8::internal::AllStatic
Definition
globals.h:364
v8::internal::DirectHandle
Definition
handles.h:659
v8::internal::IrregexpInterpreter
Definition
regexp-interpreter.h:17
v8::internal::IrregexpInterpreter::Result
Result
Definition
regexp-interpreter.h:19
v8::internal::Isolate
Definition
isolate.h:586
v8::internal::RegExp::CallOrigin
CallOrigin
Definition
regexp.h:103
v8::internal::Tagged
Definition
waiter-queue-node.h:21
v8::internal::EXCEPTION
@ EXCEPTION
Definition
json-stringifier.cc:1907
v8::internal::SUCCESS
@ SUCCESS
Definition
json-stringifier.cc:1901
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8::internal::CopyAndForwardResult::FAILURE
@ FAILURE
v8::internal::TrustedByteArray
TrustedByteArray
Definition
js-regexp-inl.h:121
v8
Definition
api-arguments-inl.h:19
regexp.h
V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE
Definition
macros.h:460
src
regexp
regexp-interpreter.h
Generated on Sun Apr 6 2025 21:08:57 for v8 by
1.12.0