v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
frame-constants-riscv.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_RISCV_FRAME_CONSTANTS_RISCV_H_
6#define V8_EXECUTION_RISCV_FRAME_CONSTANTS_RISCV_H_
7
8#include "src/base/bits.h"
9#include "src/base/macros.h"
13
14namespace v8 {
15namespace internal {
16
17class EntryFrameConstants : public AllStatic {
18 public:
19 // This is the offset to where JSEntry pushes the current value of
20 // Isolate::c_entry_fp onto the stack.
21 static constexpr int kNextExitFrameFPOffset = -3 * kSystemPointerSize;
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 // Note that {kNumberOfSavedGpParamRegs} = arraysize(wasm::kGpParamRegisters)
33 // - 1, {kNumberOfSavedFpParamRegs} = arraysize(wasm::kFpParamRegisters). Here
34 // we use immediate values instead to avoid circular references (introduced by
35 // linkage_location.h, issue: v8:14035) and resultant compilation errors.
36 static constexpr int kNumberOfSavedGpParamRegs = 6;
37 static constexpr int kNumberOfSavedFpParamRegs = 8;
38 static constexpr int kNumberOfSavedAllParamRegs =
40 static constexpr int kInstanceSpillOffset =
42 static constexpr int kParameterSpillsOffset[] = {
46
47 // SP-relative.
48 static constexpr int kWasmInstanceDataOffset = 2 * kSystemPointerSize;
49 static constexpr int kDeclaredFunctionIndexOffset = 1 * kSystemPointerSize;
50 static constexpr int kNativeModuleOffset = 0;
51};
52
53class WasmLiftoffFrameConstants : public TypedFrameConstants {
54 public:
55 static constexpr int kFeedbackVectorOffset = 3 * kSystemPointerSize;
56 static constexpr int kInstanceDataOffset = 2 * kSystemPointerSize;
57};
58
59// Frame constructed by the {WasmDebugBreak} builtin.
60// After pushing the frame type marker, the builtin pushes all Liftoff cache
61// registers (see liftoff-assembler-defs.h).
62class WasmDebugBreakFrameConstants : public TypedFrameConstants {
63 public:
65
66 static constexpr DoubleRegList kPushedFpRegs =
68
69 static constexpr int kNumPushedGpRegisters = kPushedGpRegs.Count();
70 static constexpr int kNumPushedFpRegisters = kPushedFpRegs.Count();
71
72 static constexpr int kLastPushedGpRegisterOffset =
74 static constexpr int kLastPushedFpRegisterOffset =
76
77 // Offsets are fp-relative.
78 static int GetPushedGpRegisterOffset(int reg_code) {
79 DCHECK_NE(0, kPushedGpRegs.bits() & (1 << reg_code));
80 uint32_t lower_regs =
81 kPushedGpRegs.bits() & ((uint32_t{1} << reg_code) - 1);
84 }
85
86 static int GetPushedFpRegisterOffset(int reg_code) {
87 DCHECK_NE(0, kPushedFpRegs.bits() & (1 << reg_code));
88 uint32_t lower_regs =
89 kPushedFpRegs.bits() & ((uint32_t{1} << reg_code) - 1);
92 }
93};
94
95} // namespace internal
96} // namespace v8
97
98#endif // V8_EXECUTION_RISCV_FRAME_CONSTANTS_RISCV_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
constexpr DoubleRegList kLiftoffAssemblerFpCacheRegs
constexpr RegList kLiftoffAssemblerGpCacheRegs
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