frames-x64.h 2.32 KB
Newer Older
1
// Copyright 2012 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4

5 6 7
#ifndef V8_X64_FRAMES_X64_H_
#define V8_X64_FRAMES_X64_H_

8 9
namespace v8 {
namespace internal {
10

11 12
const int kNumRegs = 16;
const RegList kJSCallerSaved =
13 14 15 16 17 18
    1 << 0 |  // rax
    1 << 1 |  // rcx
    1 << 2 |  // rdx
    1 << 3 |  // rbx - used as a caller-saved register in JavaScript code
    1 << 7;   // rdi - callee function

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 27
class EntryFrameConstants : public AllStatic {
 public:
28
#ifdef _WIN64
29 30 31 32 33
  static const int kCalleeSaveXMMRegisters = 10;
  static const int kXMMRegisterSize = 16;
  static const int kXMMRegistersBlockSize =
      kXMMRegisterSize * kCalleeSaveXMMRegisters;
  static const int kCallerFPOffset =
34
      -3 * kPointerSize + -7 * kRegisterSize - kXMMRegistersBlockSize;
35
#else
36 37
  // We have 3 Push and 5 pushq in the JSEntryStub::GenerateBody.
  static const int kCallerFPOffset = -3 * kPointerSize + -5 * kRegisterSize;
38
#endif
39
  static const int kArgvOffset     = 6 * kPointerSize;
40 41 42 43 44
};


class ExitFrameConstants : public AllStatic {
 public:
45 46
  static const int kFrameSize       = 2 * kPointerSize;

47
  static const int kCodeOffset      = -2 * kPointerSize;
48 49
  static const int kSPOffset        = -1 * kPointerSize;

50
  static const int kCallerFPOffset  = +0 * kPointerSize;
51
  static const int kCallerPCOffset  = kFPOnStackSize;
52 53 54

  // FP-relative displacement of the caller's SP.  It points just
  // below the saved PC.
55
  static const int kCallerSPDisplacement = kCallerPCOffset + kPCOnStackSize;
56 57

  static const int kConstantPoolOffset   = 0;  // Not used
58 59 60 61 62
};


class JavaScriptFrameConstants : public AllStatic {
 public:
63
  // FP-relative.
64
  static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
65
  static const int kLastParameterOffset = kFPOnStackSize + kPCOnStackSize;
66 67
  static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;

68
  // Caller SP-relative.
69
  static const int kParam0Offset   = -2 * kPointerSize;
70 71 72 73
  static const int kReceiverOffset = -1 * kPointerSize;
};


74 75
}  // namespace internal
}  // namespace v8
76 77

#endif  // V8_X64_FRAMES_X64_H_