V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
regexp-macro-assembler-irregexp-inl.h
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_MACRO_ASSEMBLER_IRREGEXP_INL_H_
6 #define V8_REGEXP_REGEXP_MACRO_ASSEMBLER_IRREGEXP_INL_H_
7 
8 #ifdef V8_INTERPRETED_REGEXP
9 
10 #include "src/regexp/regexp-macro-assembler-irregexp.h"
11 
12 #include "src/ast/ast.h"
13 #include "src/regexp/bytecodes-irregexp.h"
14 
15 namespace v8 {
16 namespace internal {
17 
18 void RegExpMacroAssemblerIrregexp::Emit(uint32_t byte,
19  uint32_t twenty_four_bits) {
20  uint32_t word = ((twenty_four_bits << BYTECODE_SHIFT) | byte);
21  DCHECK(pc_ <= buffer_.length());
22  if (pc_ + 3 >= buffer_.length()) {
23  Expand();
24  }
25  *reinterpret_cast<uint32_t*>(buffer_.start() + pc_) = word;
26  pc_ += 4;
27 }
28 
29 
30 void RegExpMacroAssemblerIrregexp::Emit16(uint32_t word) {
31  DCHECK(pc_ <= buffer_.length());
32  if (pc_ + 1 >= buffer_.length()) {
33  Expand();
34  }
35  *reinterpret_cast<uint16_t*>(buffer_.start() + pc_) = word;
36  pc_ += 2;
37 }
38 
39 
40 void RegExpMacroAssemblerIrregexp::Emit8(uint32_t word) {
41  DCHECK(pc_ <= buffer_.length());
42  if (pc_ == buffer_.length()) {
43  Expand();
44  }
45  *reinterpret_cast<unsigned char*>(buffer_.start() + pc_) = word;
46  pc_ += 1;
47 }
48 
49 
50 void RegExpMacroAssemblerIrregexp::Emit32(uint32_t word) {
51  DCHECK(pc_ <= buffer_.length());
52  if (pc_ + 3 >= buffer_.length()) {
53  Expand();
54  }
55  *reinterpret_cast<uint32_t*>(buffer_.start() + pc_) = word;
56  pc_ += 4;
57 }
58 
59 } // namespace internal
60 } // namespace v8
61 
62 #endif // V8_INTERPRETED_REGEXP
63 
64 #endif // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_IRREGEXP_INL_H_
Definition: libplatform.h:13