v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
code-comments.h
Go to the documentation of this file.
1
// Copyright 2018 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_CODEGEN_CODE_COMMENTS_H_
6
#define V8_CODEGEN_CODE_COMMENTS_H_
7
8
#include <ostream>
9
#include <string>
10
#include <vector>
11
12
#include "
include/v8-internal.h
"
13
#include "
src/base/macros.h
"
14
15
namespace
v8
{
16
namespace
internal
{
17
18
class
Assembler;
19
20
// InstructionStream comments section layout:
21
// byte count content
22
// ------------------------------------------------------------------------
23
// 4 size as uint32_t (only for a check)
24
// [Inline array of CodeCommentEntry in increasing pc_offset order]
25
// ┌ 4 pc_offset of entry as uint32_t
26
// ├ 4 length of the comment including terminating '\0'
27
// └ <variable length> characters of the comment including terminating '\0'
28
29
struct
CodeCommentEntry
{
30
uint32_t
pc_offset
;
31
std::string
comment
;
32
uint32_t
comment_length
()
const
;
33
uint32_t
size
()
const
;
34
};
35
36
class
CodeCommentsWriter
{
37
public
:
38
V8_EXPORT_PRIVATE
void
Add
(uint32_t
pc_offset
, std::string comment);
39
void
Emit
(
Assembler
* assm);
40
size_t
entry_count
()
const
;
41
uint32_t
section_size
()
const
;
42
43
private
:
44
uint32_t
byte_count_
= 0;
45
std::vector<CodeCommentEntry>
comments_
;
46
};
47
48
class
V8_EXPORT_PRIVATE
CodeCommentsIterator
{
49
public
:
50
CodeCommentsIterator
(Address code_comments_start,
51
uint32_t code_comments_size);
52
uint32_t
size
()
const
;
53
const
char
* GetComment()
const
;
54
uint32_t GetCommentSize()
const
;
55
uint32_t GetPCOffset()
const
;
56
void
Next();
57
bool
HasCurrent()
const
;
58
59
private
:
60
Address
code_comments_start_
;
61
uint32_t
code_comments_size_
;
62
Address
current_entry_
;
63
};
64
65
}
// namespace internal
66
}
// namespace v8
67
68
#endif
// V8_CODEGEN_CODE_COMMENTS_H_
v8::internal::Assembler
Definition
assembler-x64.h:484
v8::internal::CodeCommentsIterator
Definition
code-comments.h:48
v8::internal::CodeCommentsIterator::code_comments_start_
Address code_comments_start_
Definition
code-comments.h:60
v8::internal::CodeCommentsIterator::current_entry_
Address current_entry_
Definition
code-comments.h:62
v8::internal::CodeCommentsIterator::code_comments_size_
uint32_t code_comments_size_
Definition
code-comments.h:61
v8::internal::CodeCommentsWriter
Definition
code-comments.h:36
v8::internal::CodeCommentsWriter::entry_count
size_t entry_count() const
Definition
code-comments.cc:85
v8::internal::CodeCommentsWriter::Add
V8_EXPORT_PRIVATE void Add(uint32_t pc_offset, std::string comment)
Definition
code-comments.cc:79
v8::internal::CodeCommentsWriter::byte_count_
uint32_t byte_count_
Definition
code-comments.h:44
v8::internal::CodeCommentsWriter::comments_
std::vector< CodeCommentEntry > comments_
Definition
code-comments.h:45
v8::internal::CodeCommentsWriter::section_size
uint32_t section_size() const
Definition
code-comments.cc:86
v8::internal::CodeCommentsWriter::Emit
void Emit(Assembler *assm)
Definition
code-comments.cc:66
pc_offset
int pc_offset
Definition
liftoff-compiler.cc:9470
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
size
int size
Definition
setup-heap-internal.cc:131
macros.h
V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE
Definition
macros.h:460
v8::internal::CodeCommentEntry
Definition
code-comments.h:29
v8::internal::CodeCommentEntry::comment_length
uint32_t comment_length() const
Definition
code-comments.cc:22
v8::internal::CodeCommentEntry::size
uint32_t size() const
Definition
code-comments.cc:26
v8::internal::CodeCommentEntry::pc_offset
uint32_t pc_offset
Definition
code-comments.h:30
v8::internal::CodeCommentEntry::comment
std::string comment
Definition
code-comments.h:31
v8-internal.h
src
codegen
code-comments.h
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0