v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
regexp-bytecode-generator-inl.h
Go to the documentation of this file.
1
// Copyright 2008-2009 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_BYTECODE_GENERATOR_INL_H_
6
#define V8_REGEXP_REGEXP_BYTECODE_GENERATOR_INL_H_
7
8
#include "
src/regexp/regexp-bytecode-generator.h
"
9
// Include the non-inl header before the rest of the headers.
10
11
#include "
src/regexp/regexp-bytecodes.h
"
12
13
namespace
v8
{
14
namespace
internal
{
15
16
void
RegExpBytecodeGenerator::Emit
(uint32_t
byte
, uint32_t twenty_four_bits) {
17
DCHECK
(is_uint24(twenty_four_bits));
18
Emit32
((twenty_four_bits <<
BYTECODE_SHIFT
) |
byte
);
19
}
20
21
void
RegExpBytecodeGenerator::Emit
(uint32_t
byte
, int32_t twenty_four_bits) {
22
DCHECK
(is_int24(twenty_four_bits));
23
Emit32
((
static_cast<
uint32_t
>
(twenty_four_bits) <<
BYTECODE_SHIFT
) |
byte
);
24
}
25
26
void
RegExpBytecodeGenerator::Emit16
(uint32_t word) {
27
DCHECK
(
pc_
<=
static_cast<
int
>
(
buffer_
.
size
()));
28
if
(
pc_
+ 1 >=
static_cast<
int
>
(
buffer_
.
size
())) {
29
ExpandBuffer
();
30
}
31
*
reinterpret_cast<
uint16_t*
>
(
buffer_
.
data
() +
pc_
) = word;
32
pc_
+= 2;
33
}
34
35
void
RegExpBytecodeGenerator::Emit8
(uint32_t word) {
36
DCHECK
(
pc_
<=
static_cast<
int
>
(
buffer_
.
size
()));
37
if
(
pc_
==
static_cast<
int
>
(
buffer_
.
size
())) {
38
ExpandBuffer
();
39
}
40
*
reinterpret_cast<
unsigned
char
*
>
(
buffer_
.
data
() +
pc_
) = word;
41
pc_
+= 1;
42
}
43
44
void
RegExpBytecodeGenerator::Emit32
(uint32_t word) {
45
DCHECK
(
pc_
<=
static_cast<
int
>
(
buffer_
.
size
()));
46
if
(
pc_
+ 3 >=
static_cast<
int
>
(
buffer_
.
size
())) {
47
ExpandBuffer
();
48
}
49
*
reinterpret_cast<
uint32_t*
>
(
buffer_
.
data
() +
pc_
) = word;
50
pc_
+= 4;
51
}
52
53
}
// namespace internal
54
}
// namespace v8
55
56
#endif
// V8_REGEXP_REGEXP_BYTECODE_GENERATOR_INL_H_
v8::internal::RegExpBytecodeGenerator::buffer_
ZoneVector< uint8_t > buffer_
Definition
regexp-bytecode-generator.h:121
v8::internal::RegExpBytecodeGenerator::pc_
int pc_
Definition
regexp-bytecode-generator.h:124
v8::internal::RegExpBytecodeGenerator::Emit
void Emit(uint32_t bc, uint32_t arg)
Definition
regexp-bytecode-generator-inl.h:16
v8::internal::RegExpBytecodeGenerator::Emit8
void Emit8(uint32_t x)
Definition
regexp-bytecode-generator-inl.h:35
v8::internal::RegExpBytecodeGenerator::Emit32
void Emit32(uint32_t x)
Definition
regexp-bytecode-generator-inl.h:44
v8::internal::RegExpBytecodeGenerator::Emit16
void Emit16(uint32_t x)
Definition
regexp-bytecode-generator-inl.h:26
v8::internal::RegExpBytecodeGenerator::ExpandBuffer
void ExpandBuffer()
Definition
regexp-bytecode-generator.cc:417
v8::internal::ZoneVector::data
T * data()
Definition
zone-containers.h:242
v8::internal::ZoneVector::size
size_t size() const
Definition
zone-containers.h:238
v8::internal::BYTECODE_SHIFT
const int BYTECODE_SHIFT
Definition
regexp-bytecodes.h:27
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
regexp-bytecode-generator.h
regexp-bytecodes.h
DCHECK
#define DCHECK(condition)
Definition
logging.h:482
src
regexp
regexp-bytecode-generator-inl.h
Generated on Sun Apr 6 2025 21:08:56 for v8 by
1.12.0