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_X64_FRAME_CONSTANTS_X64_H_
6 #define V8_X64_FRAME_CONSTANTS_X64_H_
7 
8 namespace v8 {
9 namespace internal {
10 
11 class EntryFrameConstants : public AllStatic {
12  public:
13 #ifdef _WIN64
14   static constexpr int kCalleeSaveXMMRegisters = 10;
15   static constexpr int kXMMRegisterSize = 16;
16   static constexpr int kXMMRegistersBlockSize =
17       kXMMRegisterSize * kCalleeSaveXMMRegisters;
18   static constexpr int kCallerFPOffset =
19       -3 * kPointerSize + -7 * kRegisterSize - kXMMRegistersBlockSize;
20 #else
21   // We have 3 Push and 5 pushq in the JSEntryStub::GenerateBody.
22   static constexpr int kCallerFPOffset = -3 * kPointerSize + -5 * kRegisterSize;
23 #endif
24   static constexpr int kArgvOffset = 6 * kPointerSize;
25 };
26 
27 class ExitFrameConstants : public TypedFrameConstants {
28  public:
29   static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
30   static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
31   DEFINE_TYPED_FRAME_SIZES(2);
32 
33   static constexpr int kCallerFPOffset = +0 * kPointerSize;
34   static constexpr int kCallerPCOffset = kFPOnStackSize;
35 
36   // FP-relative displacement of the caller's SP.  It points just
37   // below the saved PC.
38   static constexpr int kCallerSPDisplacement = kCallerPCOffset + kPCOnStackSize;
39 
40   static constexpr int kConstantPoolOffset = 0;  // Not used
41 };
42 
43 class JavaScriptFrameConstants : public AllStatic {
44  public:
45   // FP-relative.
46   static constexpr int kLocal0Offset =
47       StandardFrameConstants::kExpressionsOffset;
48   static constexpr int kLastParameterOffset = kFPOnStackSize + kPCOnStackSize;
49   static constexpr int kFunctionOffset =
50       StandardFrameConstants::kFunctionOffset;
51 
52   // Caller SP-relative.
53   static constexpr int kParam0Offset = -2 * kPointerSize;
54   static constexpr int kReceiverOffset = -1 * kPointerSize;
55 };
56 
57 }  // namespace internal
58 }  // namespace v8
59 
60 #endif  // V8_X64_FRAME_CONSTANTS_X64_H_
61