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
9// Include the non-inl header before the rest of the headers.
10
12
13namespace v8 {
14namespace internal {
15
16void 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
21void 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
27 DCHECK(pc_ <= static_cast<int>(buffer_.size()));
28 if (pc_ + 1 >= static_cast<int>(buffer_.size())) {
30 }
31 *reinterpret_cast<uint16_t*>(buffer_.data() + pc_) = word;
32 pc_ += 2;
33}
34
35void RegExpBytecodeGenerator::Emit8(uint32_t word) {
36 DCHECK(pc_ <= static_cast<int>(buffer_.size()));
37 if (pc_ == static_cast<int>(buffer_.size())) {
39 }
40 *reinterpret_cast<unsigned char*>(buffer_.data() + pc_) = word;
41 pc_ += 1;
42}
43
45 DCHECK(pc_ <= static_cast<int>(buffer_.size()));
46 if (pc_ + 3 >= static_cast<int>(buffer_.size())) {
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_
const int BYTECODE_SHIFT
#define DCHECK(condition)
Definition logging.h:482