v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
frame-constants-loong64.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_EXECUTION_LOONG64_FRAME_CONSTANTS_LOONG64_H_
6#define V8_EXECUTION_LOONG64_FRAME_CONSTANTS_LOONG64_H_
7
8#include "src/base/bits.h"
9#include "src/base/macros.h"
12
13namespace v8 {
14namespace internal {
15
16class EntryFrameConstants : public AllStatic {
17 public:
18 // This is the offset to where JSEntry pushes the current value of
19 // Isolate::c_entry_fp onto the stack.
20 static constexpr int kNextExitFrameFPOffset = -3 * kSystemPointerSize;
21
22 // The offsets for storing the FP and PC of fast API calls.
23 static constexpr int kNextFastCallFrameFPOffset =
25 static constexpr int kNextFastCallFramePCOffset =
27};
28
29class WasmLiftoffSetupFrameConstants : public TypedFrameConstants {
30 public:
31 // Number of gp parameters, without the instance.
32 static constexpr int kNumberOfSavedGpParamRegs = 6;
33 static constexpr int kNumberOfSavedFpParamRegs = 8;
34 static constexpr int kNumberOfSavedAllParamRegs = 14;
35
36 // On loong64, spilled registers are implicitly sorted backwards by number.
37 // We spill:
38 // a0, a2, a3, a4, a5, a6: param1, param2, ..., param6
39 // in the following FP-relative order: [a6, a5, a4, a3, a2, a0].
40 // The instance slot is in position '0', the first spill slot is at '1'.
41 // See wasm::kGpParamRegisters and Builtins::Generate_WasmCompileLazy.
42 static constexpr int kInstanceSpillOffset =
44
45 static constexpr int kParameterSpillsOffset[] = {
49
50 // SP-relative.
51 static constexpr int kWasmInstanceDataOffset = 2 * kSystemPointerSize;
52 static constexpr int kDeclaredFunctionIndexOffset = 1 * kSystemPointerSize;
53 static constexpr int kNativeModuleOffset = 0;
54};
55
56class WasmLiftoffFrameConstants : public TypedFrameConstants {
57 public:
58 static constexpr int kFeedbackVectorOffset = 3 * kSystemPointerSize;
59 static constexpr int kInstanceDataOffset = 2 * kSystemPointerSize;
60};
61
62// Frame constructed by the {WasmDebugBreak} builtin.
63// After pushing the frame type marker, the builtin pushes all Liftoff cache
64// registers (see liftoff-assembler-defs.h).
65class WasmDebugBreakFrameConstants : public TypedFrameConstants {
66 public:
67 // {a0 ... a7, t0 ... t5, s0, s1, s2, s5, s7}
68 static constexpr RegList kPushedGpRegs = {a0, a1, a2, a3, a4, a5, a6,
69 a7, t0, t1, t2, t3, t4, t5,
70 s0, s1, s2, s5, s7};
71 // {f0, f1, f2, ... f27, f28}
72 static constexpr DoubleRegList kPushedFpRegs = {
73 f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
74 f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28};
75
76 static constexpr int kNumPushedGpRegisters = kPushedGpRegs.Count();
77 static constexpr int kNumPushedFpRegisters = kPushedFpRegs.Count();
78
79 static constexpr int kLastPushedGpRegisterOffset =
81 static constexpr int kLastPushedFpRegisterOffset =
83
84 // Offsets are fp-relative.
85 static int GetPushedGpRegisterOffset(int reg_code) {
86 DCHECK_NE(0, kPushedGpRegs.bits() & (1 << reg_code));
87 uint32_t lower_regs =
88 kPushedGpRegs.bits() & ((uint32_t{1} << reg_code) - 1);
91 }
92
93 static int GetPushedFpRegisterOffset(int reg_code) {
94 DCHECK_NE(0, kPushedFpRegs.bits() & (1 << reg_code));
95 uint32_t lower_regs =
96 kPushedFpRegs.bits() & ((uint32_t{1} << reg_code) - 1);
99 }
100};
101
102} // namespace internal
103} // namespace v8
104
105#endif // V8_EXECUTION_LOONG64_FRAME_CONSTANTS_LOONG64_H_
static constexpr int kNextFastCallFrameFPOffset
static constexpr int kNextExitFrameFPOffset
static constexpr int kNextFastCallFramePCOffset
constexpr unsigned Count() const
constexpr storage_t bits() const
static constexpr int kFixedFrameSizeFromFp
static constexpr DoubleRegList kPushedFpRegs
#define TYPED_FRAME_PUSHED_VALUE_OFFSET(x)
constexpr unsigned CountPopulation(T value)
Definition bits.h:26
RegListBase< DoubleRegister > DoubleRegList
Definition reglist-arm.h:15
RegListBase< Register > RegList
Definition reglist-arm.h:14
constexpr int kSystemPointerSize
Definition globals.h:410
constexpr int kDoubleSize
Definition globals.h:407
#define DCHECK_NE(v1, v2)
Definition logging.h:486