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_IA32_FRAME_CONSTANTS_IA32_H_
6 #define V8_IA32_FRAME_CONSTANTS_IA32_H_
7 
8 #include "src/base/macros.h"
9 #include "src/frame-constants.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 class EntryFrameConstants : public AllStatic {
15  public:
16   static constexpr int kCallerFPOffset = -6 * kPointerSize;
17 
18   static constexpr int kNewTargetArgOffset = +2 * kPointerSize;
19   static constexpr int kFunctionArgOffset = +3 * kPointerSize;
20   static constexpr int kReceiverArgOffset = +4 * kPointerSize;
21   static constexpr int kArgcOffset = +5 * kPointerSize;
22   static constexpr int kArgvOffset = +6 * kPointerSize;
23 };
24 
25 class ExitFrameConstants : public TypedFrameConstants {
26  public:
27   static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
28   static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
29   DEFINE_TYPED_FRAME_SIZES(2);
30 
31   static constexpr int kCallerFPOffset = 0 * kPointerSize;
32   static constexpr int kCallerPCOffset = +1 * kPointerSize;
33 
34   // FP-relative displacement of the caller's SP.  It points just
35   // below the saved PC.
36   static constexpr int kCallerSPDisplacement = +2 * kPointerSize;
37 
38   static constexpr int kConstantPoolOffset = 0;  // Not used
39 };
40 
41 class WasmCompileLazyFrameConstants : public TypedFrameConstants {
42  public:
43   static constexpr int kNumberOfSavedGpParamRegs = 5;
44   static constexpr int kNumberOfSavedFpParamRegs = 6;
45 
46   // FP-relative.
47   static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
48   static constexpr int kFixedFrameSizeFromFp =
49       TypedFrameConstants::kFixedFrameSizeFromFp +
50       kNumberOfSavedGpParamRegs * kPointerSize +
51       kNumberOfSavedFpParamRegs * kSimd128Size;
52 };
53 
54 class JavaScriptFrameConstants : public AllStatic {
55  public:
56   // FP-relative.
57   static constexpr int kLocal0Offset =
58       StandardFrameConstants::kExpressionsOffset;
59   static constexpr int kLastParameterOffset = +2 * kPointerSize;
60   static constexpr int kFunctionOffset =
61       StandardFrameConstants::kFunctionOffset;
62 
63   // Caller SP-relative.
64   static constexpr int kParam0Offset = -2 * kPointerSize;
65   static constexpr int kReceiverOffset = -1 * kPointerSize;
66 };
67 
68 }  // namespace internal
69 }  // namespace v8
70 
71 #endif  // V8_IA32_FRAME_CONSTANTS_IA32_H_
72