v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
frame-constants-mips64.h
Go to the documentation of this file.
1// Copyright 2011 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_MIPS64_FRAME_CONSTANTS_MIPS64_H_
6#define V8_EXECUTION_MIPS64_FRAME_CONSTANTS_MIPS64_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 = 7;
34 static constexpr int kNumberOfSavedAllParamRegs = 13;
35
36 // On mips64, spilled registers are implicitly sorted backwards by number.
37 // We spill:
38 // a2, a3, a4, a5, a6, a7: param1, param2, ..., param6
39 // in the following FP-relative order: [a7, a6, a5, a4, a3, a2].
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 // {v0, v1, a0, a1, a2, a3, a4, a5, a6, a7, t0, t1, t2, s7}
68 static constexpr RegList kPushedGpRegs = {v0, v1, a0, a1, a2, a3, a4,
69 a5, a6, a7, t0, t1, t2, s7};
70 // {f0, f2, f4, f6, f8, f10, f12, f14, f16, f18, f20, f22, f24, f26}
71 static constexpr DoubleRegList kPushedFpRegs = {
72 f0, f2, f4, f6, f8, f10, f12, f14, f16, f18, f20, f22, f24, f26};
73
74 static constexpr int kNumPushedGpRegisters = kPushedGpRegs.Count();
75 static constexpr int kNumPushedFpRegisters = kPushedFpRegs.Count();
76
77 static constexpr int kLastPushedGpRegisterOffset =
79 static constexpr int kLastPushedFpRegisterOffset =
81
82 // Offsets are fp-relative.
83 static int GetPushedGpRegisterOffset(int reg_code) {
84 DCHECK_NE(0, kPushedGpRegs.bits() & (1 << reg_code));
85 uint32_t lower_regs =
86 kPushedGpRegs.bits() & ((uint32_t{1} << reg_code) - 1);
89 }
90
91 static int GetPushedFpRegisterOffset(int reg_code) {
92 DCHECK_NE(0, kPushedFpRegs.bits() & (1 << reg_code));
93 uint32_t lower_regs =
94 kPushedFpRegs.bits() & ((uint32_t{1} << reg_code) - 1);
97 }
98};
99
100} // namespace internal
101} // namespace v8
102
103#endif // V8_EXECUTION_MIPS64_FRAME_CONSTANTS_MIPS64_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