Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 4 | |
| 5 | #ifndef V8_X64_FRAMES_X64_H_ |
| 6 | #define V8_X64_FRAMES_X64_H_ |
| 7 | |
| 8 | namespace v8 { |
| 9 | namespace internal { |
| 10 | |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 11 | const int kNumRegs = 16; |
| 12 | const RegList kJSCallerSaved = |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 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 | |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 19 | const int kNumJSCallerSaved = 5; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 20 | |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 21 | // Number of registers for which space is reserved in safepoints. |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 22 | const int kNumSafepointRegisters = 16; |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 23 | |
| 24 | // ---------------------------------------------------- |
| 25 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 26 | class EntryFrameConstants : public AllStatic { |
| 27 | public: |
Steve Block | 8defd9f | 2010-07-08 12:39:36 +0100 | [diff] [blame] | 28 | #ifdef _WIN64 |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 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; |
Steve Block | 8defd9f | 2010-07-08 12:39:36 +0100 | [diff] [blame] | 35 | #else |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 36 | // We have 3 Push and 5 pushq in the JSEntryStub::GenerateBody. |
| 37 | static const int kCallerFPOffset = -3 * kPointerSize + -5 * kRegisterSize; |
Steve Block | 8defd9f | 2010-07-08 12:39:36 +0100 | [diff] [blame] | 38 | #endif |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 39 | static const int kArgvOffset = 6 * kPointerSize; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 40 | }; |
| 41 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame^] | 42 | class ExitFrameConstants : public TypedFrameConstants { |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 43 | public: |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame^] | 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); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 47 | |
| 48 | static const int kCallerFPOffset = +0 * kPointerSize; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 49 | static const int kCallerPCOffset = kFPOnStackSize; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 50 | |
| 51 | // FP-relative displacement of the caller's SP. It points just |
| 52 | // below the saved PC. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 53 | static const int kCallerSPDisplacement = kCallerPCOffset + kPCOnStackSize; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 54 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 55 | static const int kConstantPoolOffset = 0; // Not used |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | |
| 59 | class JavaScriptFrameConstants : public AllStatic { |
| 60 | public: |
| 61 | // FP-relative. |
| 62 | static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 63 | static const int kLastParameterOffset = kFPOnStackSize + kPCOnStackSize; |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame^] | 64 | static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 65 | |
| 66 | // Caller SP-relative. |
| 67 | static const int kParam0Offset = -2 * kPointerSize; |
| 68 | static const int kReceiverOffset = -1 * kPointerSize; |
| 69 | }; |
| 70 | |
| 71 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 72 | } // namespace internal |
| 73 | } // namespace v8 |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 74 | |
| 75 | #endif // V8_X64_FRAMES_X64_H_ |