v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
baseline-assembler-inl.h
Go to the documentation of this file.
1// Copyright 2021 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_BASELINE_BASELINE_ASSEMBLER_INL_H_
6#define V8_BASELINE_BASELINE_ASSEMBLER_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
11#include <type_traits>
12#include <unordered_map>
13
18#include "src/objects/map.h"
19
20#if V8_TARGET_ARCH_X64
22#elif V8_TARGET_ARCH_ARM64
24#elif V8_TARGET_ARCH_IA32
26#elif V8_TARGET_ARCH_ARM
28#elif V8_TARGET_ARCH_PPC64
30#elif V8_TARGET_ARCH_S390X
32#elif V8_TARGET_ARCH_RISCV32 || V8_TARGET_ARCH_RISCV64
34#elif V8_TARGET_ARCH_MIPS64
36#elif V8_TARGET_ARCH_LOONG64
38#else
39#error Unsupported target architecture.
40#endif
41
42namespace v8 {
43namespace internal {
44namespace baseline {
45
46#define __ masm_->
47
49 __ GetCode(isolate, desc);
50}
51int BaselineAssembler::pc_offset() const { return __ pc_offset(); }
54void BaselineAssembler::RecordComment(const char* string) {
55 if (!v8_flags.code_comments) return;
56 __ RecordComment(string);
57}
61 __ CallRuntime(function, nargs);
62}
63
65 // BaselineAssemblerOptions defines how builtin calls are generated.
66 __ CallBuiltin(builtin);
67}
68
70 // BaselineAssemblerOptions defines how builtin tail calls are generated.
71 __ TailCallBuiltin(builtin);
72}
73
80
82 __ LoadMap(output, value);
83}
85 __ LoadRoot(output, index);
86}
88 __ LoadNativeContextSlot(output, index);
89}
90
92 return __ Move(output, RegisterFrameOperand(source));
93}
95 return __ LoadRoot(output, source);
96}
98 __ Move(output, source);
99}
101 __ Move(output, operand);
102}
104 __ Move(output, value);
105}
106
109 __ SmiUntag(output, value);
110}
111
113 int32_t index) {
114 LoadTaggedField(output, array,
116}
117
119 __ LoadMap(prototype, object);
120 LoadTaggedField(prototype, prototype, Map::kPrototypeOffset);
121}
132 interpreter::Register source) {
133 Move(output, source);
134}
136 Register value) {
137 Move(output, value);
138}
139
141 Move(output, FeedbackCellOperand());
142 ScratchRegisterScope scratch_scope(this);
143 Register scratch = scratch_scope.AcquireScratch();
144 __ AssertFeedbackCell(output, scratch);
145}
146
147template <typename Field>
151
153 BaselineAssembler* assembler)
154 : assembler_(assembler)
155#ifdef V8_CODE_COMMENTS
156 ,
157 comment_(assembler->masm(), "EnsureAccumulatorPreservedScope")
158#endif
159{
161}
162
169
170#undef __
171
172} // namespace baseline
173} // namespace internal
174} // namespace v8
175
176#endif // V8_BASELINE_BASELINE_ASSEMBLER_INL_H_
V8_INLINE void RecordComment(const char *string)
void CallRuntime(Runtime::FunctionId function, int nargs)
void LoadFixedArrayElement(Register output, Register array, int32_t index)
static MemOperand RegisterFrameOperand(interpreter::Register interpreter_register)
void Move(Register output, Register source)
void LoadMap(Register output, Register value)
void Move(Register output, Tagged< Smi > value)
void LoadRegister(Register output, interpreter::Register source)
void LoadTaggedField(Register output, Register source, int offset)
void StoreRegister(interpreter::Register output, Register value)
void LoadNativeContextSlot(Register output, uint32_t index)
void LoadPrototype(Register prototype, Register object)
void GetCode(LocalIsolate *isolate, CodeDesc *desc)
void LoadRoot(Register output, RootIndex index)
static constexpr Register current_context()
static constexpr Register function_closure()
BytecodeAssembler & assembler_
LiftoffRegister reg
constexpr int kTaggedSize
Definition globals.h:542
constexpr Register kInterpreterAccumulatorRegister
V8_EXPORT_PRIVATE FlagValues v8_flags
#define OFFSET_OF_DATA_START(Type)