| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // |
| 3 // Copyright IBM Corp. 2012, 2013. All rights reserved. |
| 4 // |
| 2 // Use of this source code is governed by a BSD-style license that can be | 5 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 6 // found in the LICENSE file. |
| 4 | 7 |
| 5 #ifndef V8_ARM_FRAMES_ARM_H_ | 8 #ifndef V8_PPC_FRAMES_PPC_H_ |
| 6 #define V8_ARM_FRAMES_ARM_H_ | 9 #define V8_PPC_FRAMES_PPC_H_ |
| 7 | 10 |
| 8 namespace v8 { | 11 namespace v8 { |
| 9 namespace internal { | 12 namespace internal { |
| 10 | 13 |
| 11 | 14 |
| 12 // The ARM ABI does not specify the usage of register r9, which may be reserved | |
| 13 // as the static base or thread register on some platforms, in which case we | |
| 14 // leave it alone. Adjust the value of kR9Available accordingly: | |
| 15 const int kR9Available = 1; // 1 if available to us, 0 if reserved | |
| 16 | |
| 17 | |
| 18 // Register list in load/store instructions | 15 // Register list in load/store instructions |
| 19 // Note that the bit values must match those used in actual instruction encoding | 16 // Note that the bit values must match those used in actual instruction encoding |
| 20 const int kNumRegs = 16; | 17 const int kNumRegs = 32; |
| 21 | 18 |
| 22 | 19 |
| 23 // Caller-saved/arguments registers | 20 // Caller-saved/arguments registers |
| 24 const RegList kJSCallerSaved = | 21 const RegList kJSCallerSaved = |
| 25 1 << 0 | // r0 a1 | 22 1 << 3 | // r3 a1 |
| 26 1 << 1 | // r1 a2 | 23 1 << 4 | // r4 a2 |
| 27 1 << 2 | // r2 a3 | 24 1 << 5 | // r5 a3 |
| 28 1 << 3; // r3 a4 | 25 1 << 6 | // r6 a4 |
| 26 1 << 7 | // r7 a5 |
| 27 1 << 8 | // r8 a6 |
| 28 1 << 9 | // r9 a7 |
| 29 1 << 10 | // r10 a8 |
| 30 1 << 11; |
| 29 | 31 |
| 30 const int kNumJSCallerSaved = 4; | 32 const int kNumJSCallerSaved = 9; |
| 31 | 33 |
| 32 // Return the code of the n-th caller-saved register available to JavaScript | 34 // Return the code of the n-th caller-saved register available to JavaScript |
| 33 // e.g. JSCallerSavedReg(0) returns r0.code() == 0 | 35 // e.g. JSCallerSavedReg(0) returns r0.code() == 0 |
| 34 int JSCallerSavedCode(int n); | 36 int JSCallerSavedCode(int n); |
| 35 | 37 |
| 36 | 38 |
| 37 // Callee-saved registers preserved when switching from C to JavaScript | 39 // Callee-saved registers preserved when switching from C to JavaScript |
| 40 // N.B. Do not bother saving all non-volatiles -- only those that v8 |
| 41 // modifies without saving/restoring inline. |
| 38 const RegList kCalleeSaved = | 42 const RegList kCalleeSaved = |
| 39 1 << 4 | // r4 v1 | 43 1 << 14 | // r14 (general use) |
| 40 1 << 5 | // r5 v2 | 44 1 << 15 | // r15 (general use) |
| 41 1 << 6 | // r6 v3 | 45 1 << 16 | // r16 (general use) |
| 42 1 << 7 | // r7 v4 (cp in JavaScript code) | 46 1 << 17 | // r17 (general use) |
| 43 1 << 8 | // r8 v5 (pp in JavaScript code) | 47 1 << 18 | // r18 (general use / cp in Javascript code) |
| 44 kR9Available << 9 | // r9 v6 | 48 1 << 19 | // r19 (roots array in Javascript code) |
| 45 1 << 10 | // r10 v7 | 49 #if V8_OOL_CONSTANT_POOL |
| 46 1 << 11; // r11 v8 (fp in JavaScript code) | 50 1 << 20 | // r20 (constant pool array in Javascript code) |
| 47 | 51 #endif |
| 48 // When calling into C++ (only for C++ calls that can't cause a GC). | 52 1 << 31; // r31 (fp in Javascript code) |
| 49 // The call code will take care of lr, fp, etc. | |
| 50 const RegList kCallerSaved = | |
| 51 1 << 0 | // r0 | |
| 52 1 << 1 | // r1 | |
| 53 1 << 2 | // r2 | |
| 54 1 << 3 | // r3 | |
| 55 1 << 9; // r9 | |
| 56 | 53 |
| 57 | 54 |
| 58 const int kNumCalleeSaved = 7 + kR9Available; | 55 #if V8_OOL_CONSTANT_POOL |
| 59 | 56 const int kNumCalleeSaved = 8; |
| 60 // Double registers d8 to d15 are callee-saved. | 57 #else |
| 61 const int kNumDoubleCalleeSaved = 8; | 58 const int kNumCalleeSaved = 7; |
| 62 | 59 #endif |
| 63 | 60 |
| 64 // Number of registers for which space is reserved in safepoints. Must be a | 61 // Number of registers for which space is reserved in safepoints. Must be a |
| 65 // multiple of 8. | 62 // multiple of 8. |
| 66 // TODO(regis): Only 8 registers may actually be sufficient. Revisit. | 63 // TODO(regis): Only 8 registers may actually be sufficient. Revisit. |
| 67 const int kNumSafepointRegisters = 16; | 64 const int kNumSafepointRegisters = 32; |
| 68 | 65 |
| 69 // Define the list of registers actually saved at safepoints. | 66 // Define the list of registers actually saved at safepoints. |
| 70 // Note that the number of saved registers may be smaller than the reserved | 67 // Note that the number of saved registers may be smaller than the reserved |
| 71 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters. | 68 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters. |
| 72 const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved; | 69 const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved; |
| 73 const int kNumSafepointSavedRegisters = kNumJSCallerSaved + kNumCalleeSaved; | 70 const int kNumSafepointSavedRegisters = kNumJSCallerSaved + kNumCalleeSaved; |
| 74 | 71 |
| 72 // The following constants describe the stack frame linkage area as |
| 73 // defined by the ABI. Note that kNumRequiredStackFrameSlots must |
| 74 // satisfy alignment requirements (rounding up if required). |
| 75 #if V8_TARGET_ARCH_PPC64 && V8_TARGET_LITTLE_ENDIAN |
| 76 // [0] back chain |
| 77 // [1] condition register save area |
| 78 // [2] link register save area |
| 79 // [3] TOC save area |
| 80 // [4] Parameter1 save area |
| 81 // ... |
| 82 // [11] Parameter8 save area |
| 83 // [12] Parameter9 slot (if necessary) |
| 84 // ... |
| 85 const int kNumRequiredStackFrameSlots = 12; |
| 86 const int kStackFrameLRSlot = 2; |
| 87 const int kStackFrameExtraParamSlot = 12; |
| 88 #elif V8_OS_AIX || V8_TARGET_ARCH_PPC64 |
| 89 // [0] back chain |
| 90 // [1] condition register save area |
| 91 // [2] link register save area |
| 92 // [3] reserved for compiler |
| 93 // [4] reserved by binder |
| 94 // [5] TOC save area |
| 95 // [6] Parameter1 save area |
| 96 // ... |
| 97 // [13] Parameter8 save area |
| 98 // [14] Parameter9 slot (if necessary) |
| 99 // ... |
| 100 #if V8_TARGET_ARCH_PPC64 |
| 101 const int kNumRequiredStackFrameSlots = 14; |
| 102 #else |
| 103 const int kNumRequiredStackFrameSlots = 16; |
| 104 #endif |
| 105 const int kStackFrameLRSlot = 2; |
| 106 const int kStackFrameExtraParamSlot = 14; |
| 107 #else |
| 108 // [0] back chain |
| 109 // [1] link register save area |
| 110 // [2] Parameter9 slot (if necessary) |
| 111 // ... |
| 112 const int kNumRequiredStackFrameSlots = 4; |
| 113 const int kStackFrameLRSlot = 1; |
| 114 const int kStackFrameExtraParamSlot = 2; |
| 115 #endif |
| 116 |
| 75 // ---------------------------------------------------- | 117 // ---------------------------------------------------- |
| 76 | 118 |
| 77 | 119 |
| 78 class EntryFrameConstants : public AllStatic { | 120 class EntryFrameConstants : public AllStatic { |
| 79 public: | 121 public: |
| 80 static const int kCallerFPOffset = | 122 static const int kCallerFPOffset = |
| 81 -(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize); | 123 -(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize); |
| 82 }; | 124 }; |
| 83 | 125 |
| 84 | 126 |
| 85 class ExitFrameConstants : public AllStatic { | 127 class ExitFrameConstants : public AllStatic { |
| 86 public: | 128 public: |
| 87 static const int kFrameSize = FLAG_enable_ool_constant_pool ? | 129 #if V8_OOL_CONSTANT_POOL |
| 88 3 * kPointerSize : 2 * kPointerSize; | 130 static const int kFrameSize = 3 * kPointerSize; |
| 89 | 131 static const int kConstantPoolOffset = -3 * kPointerSize; |
| 90 static const int kConstantPoolOffset = FLAG_enable_ool_constant_pool ? | 132 #else |
| 91 -3 * kPointerSize : 0; | 133 static const int kFrameSize = 2 * kPointerSize; |
| 92 static const int kCodeOffset = -2 * kPointerSize; | 134 static const int kConstantPoolOffset = 0; // Not used. |
| 93 static const int kSPOffset = -1 * kPointerSize; | 135 #endif |
| 136 static const int kCodeOffset = -2 * kPointerSize; |
| 137 static const int kSPOffset = -1 * kPointerSize; |
| 94 | 138 |
| 95 // The caller fields are below the frame pointer on the stack. | 139 // The caller fields are below the frame pointer on the stack. |
| 96 static const int kCallerFPOffset = 0 * kPointerSize; | 140 static const int kCallerFPOffset = 0 * kPointerSize; |
| 97 // The calling JS function is below FP. | 141 // The calling JS function is below FP. |
| 98 static const int kCallerPCOffset = 1 * kPointerSize; | 142 static const int kCallerPCOffset = 1 * kPointerSize; |
| 99 | 143 |
| 100 // FP-relative displacement of the caller's SP. It points just | 144 // FP-relative displacement of the caller's SP. It points just |
| 101 // below the saved PC. | 145 // below the saved PC. |
| 102 static const int kCallerSPDisplacement = 2 * kPointerSize; | 146 static const int kCallerSPDisplacement = 2 * kPointerSize; |
| 103 }; | 147 }; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 196 } |
| 153 | 197 |
| 154 | 198 |
| 155 inline void StackHandler::SetFp(Address slot, Address fp) { | 199 inline void StackHandler::SetFp(Address slot, Address fp) { |
| 156 Memory::Address_at(slot) = fp; | 200 Memory::Address_at(slot) = fp; |
| 157 } | 201 } |
| 158 | 202 |
| 159 | 203 |
| 160 } } // namespace v8::internal | 204 } } // namespace v8::internal |
| 161 | 205 |
| 162 #endif // V8_ARM_FRAMES_ARM_H_ | 206 #endif // V8_PPC_FRAMES_PPC_H_ |
| OLD | NEW |