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_IA32_FRAMES_IA32_H_ |
| 6 | #define V8_IA32_FRAMES_IA32_H_ |
| 7 | |
| 8 | namespace v8 { |
| 9 | namespace internal { |
| 10 | |
| 11 | |
| 12 | // Register lists |
| 13 | // Note that the bit values must match those used in actual instruction encoding |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 14 | const int kNumRegs = 8; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 15 | |
| 16 | |
| 17 | // Caller-saved registers |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 18 | const RegList kJSCallerSaved = |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 19 | 1 << 0 | // eax |
| 20 | 1 << 1 | // ecx |
| 21 | 1 << 2 | // edx |
| 22 | 1 << 3 | // ebx - used as a caller-saved register in JavaScript code |
| 23 | 1 << 7; // edi - callee function |
| 24 | |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 25 | const int kNumJSCallerSaved = 5; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 26 | |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 27 | |
| 28 | // Number of registers for which space is reserved in safepoints. |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 29 | const int kNumSafepointRegisters = 8; |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 30 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 31 | const int kNoAlignmentPadding = 0; |
| 32 | const int kAlignmentPaddingPushed = 2; |
| 33 | const int kAlignmentZapValue = 0x12345678; // Not heap object tagged. |
| 34 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 35 | // ---------------------------------------------------- |
| 36 | |
| 37 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 38 | class EntryFrameConstants : public AllStatic { |
| 39 | public: |
| 40 | static const int kCallerFPOffset = -6 * kPointerSize; |
| 41 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame^] | 42 | static const int kNewTargetArgOffset = +2 * kPointerSize; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 43 | static const int kFunctionArgOffset = +3 * kPointerSize; |
| 44 | static const int kReceiverArgOffset = +4 * kPointerSize; |
| 45 | static const int kArgcOffset = +5 * kPointerSize; |
| 46 | static const int kArgvOffset = +6 * kPointerSize; |
| 47 | }; |
| 48 | |
| 49 | |
| 50 | class ExitFrameConstants : public AllStatic { |
| 51 | public: |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 52 | static const int kFrameSize = 2 * kPointerSize; |
| 53 | |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 54 | static const int kCodeOffset = -2 * kPointerSize; |
| 55 | static const int kSPOffset = -1 * kPointerSize; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 56 | |
| 57 | static const int kCallerFPOffset = 0 * kPointerSize; |
| 58 | static const int kCallerPCOffset = +1 * kPointerSize; |
| 59 | |
| 60 | // FP-relative displacement of the caller's SP. It points just |
| 61 | // below the saved PC. |
| 62 | static const int kCallerSPDisplacement = +2 * kPointerSize; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 63 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 64 | static const int kConstantPoolOffset = 0; // Not used |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | |
| 68 | class JavaScriptFrameConstants : public AllStatic { |
| 69 | public: |
| 70 | // FP-relative. |
| 71 | static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset; |
Ben Murdoch | 8b112d2 | 2011-06-08 16:22:53 +0100 | [diff] [blame] | 72 | static const int kLastParameterOffset = +2 * kPointerSize; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 73 | static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; |
| 74 | |
| 75 | // Caller SP-relative. |
| 76 | static const int kParam0Offset = -2 * kPointerSize; |
| 77 | static const int kReceiverOffset = -1 * kPointerSize; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 78 | |
| 79 | static const int kDynamicAlignmentStateOffset = kLocal0Offset; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame^] | 83 | } // namespace internal |
| 84 | } // namespace v8 |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 85 | |
| 86 | #endif // V8_IA32_FRAMES_IA32_H_ |