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_CODE_COMMENTS_H_ |
6 | #define |
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 | // Code comments section layout: |
21 | // byte count content |
22 | // ------------------------------------------------------------------------ |
23 | // 4 size as uint32_t (only for sanity 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 { |
30 | uint32_t ; |
31 | std::string ; |
32 | uint32_t () const; |
33 | uint32_t () const; |
34 | }; |
35 | |
36 | class { |
37 | public: |
38 | V8_EXPORT_PRIVATE void (uint32_t pc_offset, std::string ); |
39 | void (Assembler* assm); |
40 | size_t () const; |
41 | uint32_t () const; |
42 | |
43 | private: |
44 | uint32_t = 0; |
45 | std::vector<CodeCommentEntry> ; |
46 | }; |
47 | |
48 | class V8_EXPORT_PRIVATE { |
49 | public: |
50 | (Address , |
51 | uint32_t ); |
52 | uint32_t () const; |
53 | const char* () const; |
54 | uint32_t () const; |
55 | uint32_t () const; |
56 | void (); |
57 | bool () const; |
58 | |
59 | private: |
60 | Address ; |
61 | uint32_t ; |
62 | Address ; |
63 | }; |
64 | |
65 | void (std::ostream& out, Address , |
66 | uint32_t ); |
67 | |
68 | } // namespace internal |
69 | } // namespace v8 |
70 | |
71 | #endif // V8_CODE_COMMENTS_H_ |
72 | |