• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_FRAMES_X64_H_
6 #define V8_X64_FRAMES_X64_H_
7 
8 namespace v8 {
9 namespace internal {
10 
11 const int kNumRegs = 16;
12 const RegList kJSCallerSaved =
13     1 << 0 |  // rax
14     1 << 1 |  // rcx
15     1 << 2 |  // rdx
16     1 << 3 |  // rbx - used as a caller-saved register in JavaScript code
17     1 << 7;   // rdi - callee function
18 
19 const int kNumJSCallerSaved = 5;
20 
21 // Number of registers for which space is reserved in safepoints.
22 const int kNumSafepointRegisters = 16;
23 
24 // ----------------------------------------------------
25 
26 class EntryFrameConstants : public AllStatic {
27  public:
28 #ifdef _WIN64
29   static const int kCalleeSaveXMMRegisters = 10;
30   static const int kXMMRegisterSize = 16;
31   static const int kXMMRegistersBlockSize =
32       kXMMRegisterSize * kCalleeSaveXMMRegisters;
33   static const int kCallerFPOffset =
34       -3 * kPointerSize + -7 * kRegisterSize - kXMMRegistersBlockSize;
35 #else
36   // We have 3 Push and 5 pushq in the JSEntryStub::GenerateBody.
37   static const int kCallerFPOffset = -3 * kPointerSize + -5 * kRegisterSize;
38 #endif
39   static const int kArgvOffset     = 6 * kPointerSize;
40 };
41 
42 class ExitFrameConstants : public TypedFrameConstants {
43  public:
44   static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
45   static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
46   DEFINE_TYPED_FRAME_SIZES(2);
47 
48   static const int kCallerFPOffset  = +0 * kPointerSize;
49   static const int kCallerPCOffset  = kFPOnStackSize;
50 
51   // FP-relative displacement of the caller's SP.  It points just
52   // below the saved PC.
53   static const int kCallerSPDisplacement = kCallerPCOffset + kPCOnStackSize;
54 
55   static const int kConstantPoolOffset   = 0;  // Not used
56 };
57 
58 
59 class JavaScriptFrameConstants : public AllStatic {
60  public:
61   // FP-relative.
62   static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
63   static const int kLastParameterOffset = kFPOnStackSize + kPCOnStackSize;
64   static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
65 
66   // Caller SP-relative.
67   static const int kParam0Offset   = -2 * kPointerSize;
68   static const int kReceiverOffset = -1 * kPointerSize;
69 };
70 
71 
72 }  // namespace internal
73 }  // namespace v8
74 
75 #endif  // V8_X64_FRAMES_X64_H_
76