v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
platform-embedded-file-writer-aix.cc
Go to the documentation of this file.
1// Copyright 2019 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
6
8
9namespace v8 {
10namespace internal {
11
12#define SYMBOL_PREFIX ""
13
14namespace {
15
16const char* DirectiveAsString(DataDirective directive) {
17 switch (directive) {
18 case kByte:
19 return ".byte";
20 case kLong:
21 return ".long";
22 case kQuad:
23 return ".llong";
24 default:
26 }
27}
28
29} // namespace
30
32 fprintf(fp_, ".csect [GL], 6\n");
33}
34
36 fprintf(fp_, ".csect[RO]\n");
37}
38
40 uint32_t value) {
42 fprintf(fp_, ".align 2\n");
43 fprintf(fp_, "%s:\n", name);
45 fprintf(fp_, "%d\n", value);
46 Newline();
47}
48
50 // These symbols are not visible outside of the final binary, this allows for
51 // reduced binary size, and less work for the dynamic linker.
52 fprintf(fp_, ".globl %s, hidden\n", name);
53}
54
56#if V8_TARGET_ARCH_X64
57 // On x64 use 64-bytes code alignment to allow 64-bytes loop header alignment.
58 static_assert((1 << 6) >= kCodeAlignment);
59 fprintf(fp_, ".align 6\n");
60#elif V8_TARGET_ARCH_PPC64
61 // 64 byte alignment is needed on ppc64 to make sure p10 prefixed instructions
62 // don't cross 64-byte boundaries.
63 static_assert((1 << 6) >= kCodeAlignment);
64 fprintf(fp_, ".align 6\n");
65#else
66 static_assert((1 << 5) >= kCodeAlignment);
67 fprintf(fp_, ".align 5\n");
68#endif
69}
70
72 static_assert((1 << 3) >= InstructionStream::kMetadataAlignment);
73 fprintf(fp_, ".align 3\n");
74}
75
77 fprintf(fp_, "// %s\n", string);
78}
79
81 // .global is required on AIX, if the label is used/referenced in another file
82 // later to be linked.
83 fprintf(fp_, ".globl %s\n", name);
84 fprintf(fp_, "%s:\n", name);
85}
86
88 int line) {
89 fprintf(fp_, ".xline %d, \"%s\"\n", line, filename);
90}
91
92// TODO(mmarchini): investigate emitting size annotations for AIX
94 uint32_t size) {
95 Newline();
98 }
99 fprintf(fp_, ".csect %s[DS]\n", name); // function descriptor
100 fprintf(fp_, "%s:\n", name);
101 fprintf(fp_, ".llong .%s, 0, 0\n", name);
102 SectionText();
103 fprintf(fp_, ".%s:\n", name);
104}
105
107
109
111 int fileid, const char* filename) {
112 // File name cannot be declared with an identifier on AIX.
113 // We use the SourceInfo method to emit debug info in
114 //.xline <line-number> <file-name> format.
115}
116
118
120 DataDirective directive) {
121 return fprintf(fp_, " %s ", DirectiveAsString(directive));
122}
123
125 // PPC uses a fixed 4 byte instruction set, using .long
126 // to prevent any unnecessary padding.
127 return kLong;
128}
129
130#undef SYMBOL_PREFIX
131
132} // namespace internal
133} // namespace v8
static constexpr int kMetadataAlignment
void DeclareExternalFilename(int fileid, const char *filename) override
void DeclareFunctionBegin(const char *name, uint32_t size) override
void DeclareUint32(const char *name, uint32_t value) override
void SourceInfo(int fileid, const char *filename, int line) override
#define ENABLE_CONTROL_FLOW_INTEGRITY_BOOL
Definition globals.h:167
std::string filename
constexpr intptr_t kCodeAlignment
Definition globals.h:964