v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
frame-constants-ia32.h
Go to the documentation of this file.
1// Copyright 2012 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_IA32_FRAME_CONSTANTS_IA32_H_
6#define V8_EXECUTION_IA32_FRAME_CONSTANTS_IA32_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 = -6 * 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 // EntryFrame is used by JSEntry, JSConstructEntry and JSRunMicrotasksEntry.
29 // All of them take |root_register_value| as the first parameter.
30 static constexpr int kRootRegisterValueOffset = +2 * kSystemPointerSize;
31
32 // Rest of parameters passed to JSEntry and JSConstructEntry.
33 static constexpr int kNewTargetArgOffset = +3 * kSystemPointerSize;
34 static constexpr int kFunctionArgOffset = +4 * kSystemPointerSize;
35 static constexpr int kReceiverArgOffset = +5 * kSystemPointerSize;
36 static constexpr int kArgcOffset = +6 * kSystemPointerSize;
37 static constexpr int kArgvOffset = +7 * kSystemPointerSize;
38
39 // Rest of parameters passed to JSRunMicrotasksEntry.
40 static constexpr int kMicrotaskQueueArgOffset = +3 * kSystemPointerSize;
41};
42
44 public:
45 // Number of gp parameters, without the instance.
46 static constexpr int kNumberOfSavedGpParamRegs = 3;
47 static constexpr int kNumberOfSavedFpParamRegs = 6;
48
49 // There's one spilled value (which doesn't need visiting) below the instance.
50 static constexpr int kInstanceSpillOffset =
52
53 static constexpr int kParameterSpillsOffset[] = {
56
57 // SP-relative.
58 static constexpr int kWasmInstanceDataOffset = 2 * kSystemPointerSize;
59 static constexpr int kDeclaredFunctionIndexOffset = 1 * kSystemPointerSize;
60 static constexpr int kNativeModuleOffset = 0;
61};
62
63class WasmLiftoffFrameConstants : public TypedFrameConstants {
64 public:
65 static constexpr int kFeedbackVectorOffset = 3 * kSystemPointerSize;
66 static constexpr int kInstanceDataOffset = 2 * kSystemPointerSize;
67};
68
69// Frame constructed by the {WasmDebugBreak} builtin.
70// After pushing the frame type marker, the builtin pushes all Liftoff cache
71// registers (see liftoff-assembler-defs.h).
72class WasmDebugBreakFrameConstants : public TypedFrameConstants {
73 public:
74 // Omit ebx, which is the root register.
75 static constexpr RegList kPushedGpRegs = {eax, ecx, edx, esi, edi};
76
77 // Omit xmm0, which is not an allocatable fp register.
78 // Omit xmm7, which is the kScratchDoubleReg.
79 static constexpr DoubleRegList kPushedFpRegs = {xmm1, xmm2, xmm3,
80 xmm4, xmm5, xmm6};
81
82 static constexpr int kNumPushedGpRegisters = kPushedGpRegs.Count();
83 static constexpr int kNumPushedFpRegisters = kPushedFpRegs.Count();
84
85 static constexpr int kLastPushedGpRegisterOffset =
87 static constexpr int kLastPushedFpRegisterOffset =
89
90 // Offsets are fp-relative.
91 static int GetPushedGpRegisterOffset(int reg_code) {
92 DCHECK_NE(0, kPushedGpRegs.bits() & (1 << reg_code));
93 uint32_t lower_regs =
94 kPushedGpRegs.bits() & ((uint32_t{1} << reg_code) - 1);
97 }
98
99 static int GetPushedFpRegisterOffset(int reg_code) {
100 DCHECK_NE(0, kPushedFpRegs.bits() & (1 << reg_code));
101 uint32_t lower_regs =
102 kPushedFpRegs.bits() & ((uint32_t{1} << reg_code) - 1);
105 }
106};
107
108} // namespace internal
109} // namespace v8
110
111#endif // V8_EXECUTION_IA32_FRAME_CONSTANTS_IA32_H_
static constexpr int kNextFastCallFrameFPOffset
static constexpr int kRootRegisterValueOffset
static constexpr int kMicrotaskQueueArgOffset
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
constexpr int kSimd128Size
Definition globals.h:706
RegListBase< Register > RegList
Definition reglist-arm.h:14
constexpr int kSystemPointerSize
Definition globals.h:410
#define DCHECK_NE(v1, v2)
Definition logging.h:486