blob: 5aad54a69615b0fe9a527d85d4c770f14017f4b8 [file] [log] [blame]
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001// Copyright 2012 the V8 project authors. All rights reserved.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Steve Blocka7e24c12009-10-30 11:49:00 +00004
5#ifndef V8_X64_FRAMES_X64_H_
6#define V8_X64_FRAMES_X64_H_
7
8namespace v8 {
9namespace internal {
10
Ben Murdoch3ef787d2012-04-12 10:51:47 +010011const int kNumRegs = 16;
12const RegList kJSCallerSaved =
Steve Blocka7e24c12009-10-30 11:49:00 +000013 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
Ben Murdoch3ef787d2012-04-12 10:51:47 +010019const int kNumJSCallerSaved = 5;
Steve Blocka7e24c12009-10-30 11:49:00 +000020
Ben Murdochb0fe1622011-05-05 13:52:32 +010021// Number of registers for which space is reserved in safepoints.
Ben Murdoch3ef787d2012-04-12 10:51:47 +010022const int kNumSafepointRegisters = 16;
Ben Murdochb0fe1622011-05-05 13:52:32 +010023
24// ----------------------------------------------------
25
Steve Blocka7e24c12009-10-30 11:49:00 +000026class EntryFrameConstants : public AllStatic {
27 public:
Steve Block8defd9f2010-07-08 12:39:36 +010028#ifdef _WIN64
Ben Murdochb8a8cc12014-11-26 15:28:44 +000029 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;
Steve Block8defd9f2010-07-08 12:39:36 +010035#else
Ben Murdochb8a8cc12014-11-26 15:28:44 +000036 // We have 3 Push and 5 pushq in the JSEntryStub::GenerateBody.
37 static const int kCallerFPOffset = -3 * kPointerSize + -5 * kRegisterSize;
Steve Block8defd9f2010-07-08 12:39:36 +010038#endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +000039 static const int kArgvOffset = 6 * kPointerSize;
Steve Blocka7e24c12009-10-30 11:49:00 +000040};
41
Ben Murdochda12d292016-06-02 14:46:10 +010042class ExitFrameConstants : public TypedFrameConstants {
Steve Blocka7e24c12009-10-30 11:49:00 +000043 public:
Ben Murdochda12d292016-06-02 14:46:10 +010044 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);
Steve Blocka7e24c12009-10-30 11:49:00 +000047
48 static const int kCallerFPOffset = +0 * kPointerSize;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000049 static const int kCallerPCOffset = kFPOnStackSize;
Steve Blocka7e24c12009-10-30 11:49:00 +000050
51 // FP-relative displacement of the caller's SP. It points just
52 // below the saved PC.
Ben Murdochb8a8cc12014-11-26 15:28:44 +000053 static const int kCallerSPDisplacement = kCallerPCOffset + kPCOnStackSize;
Steve Blocka7e24c12009-10-30 11:49:00 +000054
Ben Murdochb8a8cc12014-11-26 15:28:44 +000055 static const int kConstantPoolOffset = 0; // Not used
Steve Blocka7e24c12009-10-30 11:49:00 +000056};
57
58
59class JavaScriptFrameConstants : public AllStatic {
60 public:
61 // FP-relative.
62 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000063 static const int kLastParameterOffset = kFPOnStackSize + kPCOnStackSize;
Ben Murdochda12d292016-06-02 14:46:10 +010064 static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
Steve Blocka7e24c12009-10-30 11:49:00 +000065
66 // Caller SP-relative.
67 static const int kParam0Offset = -2 * kPointerSize;
68 static const int kReceiverOffset = -1 * kPointerSize;
69};
70
71
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000072} // namespace internal
73} // namespace v8
Steve Blocka7e24c12009-10-30 11:49:00 +000074
75#endif // V8_X64_FRAMES_X64_H_