| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_X64_FRAMES_X64_H_ | 28 #include "a64/constants-a64.h" |
| 29 #define V8_X64_FRAMES_X64_H_ | 29 #include "a64/assembler-a64.h" |
| 30 |
| 31 #ifndef V8_A64_FRAMES_A64_H_ |
| 32 #define V8_A64_FRAMES_A64_H_ |
| 30 | 33 |
| 31 namespace v8 { | 34 namespace v8 { |
| 32 namespace internal { | 35 namespace internal { |
| 33 | 36 |
| 34 const int kNumRegs = 16; | 37 const int kNumRegs = kNumberOfRegisters; |
| 35 const RegList kJSCallerSaved = | 38 // Registers x0-x17 are caller-saved. |
| 36 1 << 0 | // rax | 39 const int kNumJSCallerSaved = 18; |
| 37 1 << 1 | // rcx | 40 const RegList kJSCallerSaved = 0x3ffff; |
| 38 1 << 2 | // rdx | |
| 39 1 << 3 | // rbx - used as a caller-saved register in JavaScript code | |
| 40 1 << 7; // rdi - callee function | |
| 41 | |
| 42 const int kNumJSCallerSaved = 5; | |
| 43 | |
| 44 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved]; | 41 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved]; |
| 45 | 42 |
| 46 // Number of registers for which space is reserved in safepoints. | 43 // Number of registers for which space is reserved in safepoints. Must be a |
| 47 const int kNumSafepointRegisters = 16; | 44 // multiple of eight. |
| 45 // TODO(all): Refine this number. |
| 46 const int kNumSafepointRegisters = 32; |
| 48 | 47 |
| 49 // ---------------------------------------------------- | 48 // Define the list of registers actually saved at safepoints. |
| 49 // Note that the number of saved registers may be smaller than the reserved |
| 50 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters. |
| 51 const RegList kSafepointSavedRegisters = |
| 52 CPURegList::GetSafepointSavedRegisters().list(); |
| 53 const int kNumSafepointSavedRegisters = |
| 54 CPURegList::GetSafepointSavedRegisters().Count(); |
| 50 | 55 |
| 51 class EntryFrameConstants : public AllStatic { | 56 class EntryFrameConstants : public AllStatic { |
| 52 public: | 57 public: |
| 53 #ifdef _WIN64 | 58 static const int kCallerFPOffset = -3 * kPointerSize; |
| 54 static const int kCalleeSaveXMMRegisters = 10; | |
| 55 static const int kXMMRegisterSize = 16; | |
| 56 static const int kXMMRegistersBlockSize = | |
| 57 kXMMRegisterSize * kCalleeSaveXMMRegisters; | |
| 58 static const int kCallerFPOffset = | |
| 59 -10 * kPointerSize - kXMMRegistersBlockSize; | |
| 60 #else | |
| 61 static const int kCallerFPOffset = -8 * kPointerSize; | |
| 62 #endif | |
| 63 static const int kArgvOffset = 6 * kPointerSize; | |
| 64 }; | 59 }; |
| 65 | 60 |
| 66 | 61 |
| 67 class ExitFrameConstants : public AllStatic { | 62 class ExitFrameConstants : public AllStatic { |
| 68 public: | 63 public: |
| 69 static const int kCodeOffset = -2 * kPointerSize; | 64 static const int kCallerSPDisplacement = 2 * kPointerSize; |
| 70 static const int kSPOffset = -1 * kPointerSize; | 65 static const int kCallerPCOffset = 1 * kPointerSize; |
| 71 | 66 static const int kCallerFPOffset = 0 * kPointerSize; // <- fp |
| 72 static const int kCallerFPOffset = +0 * kPointerSize; | 67 static const int kSPOffset = -1 * kPointerSize; |
| 73 static const int kCallerPCOffset = +1 * kPointerSize; | 68 static const int kCodeOffset = -2 * kPointerSize; |
| 74 | 69 static const int kCallerSavedRegsOffset = -3 * kPointerSize; |
| 75 // FP-relative displacement of the caller's SP. It points just | |
| 76 // below the saved PC. | |
| 77 static const int kCallerSPDisplacement = +2 * kPointerSize; | |
| 78 }; | 70 }; |
| 79 | 71 |
| 80 | 72 |
| 81 class JavaScriptFrameConstants : public AllStatic { | 73 class JavaScriptFrameConstants : public AllStatic { |
| 82 public: | 74 public: |
| 83 // FP-relative. | 75 // FP-relative. |
| 84 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset; | 76 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset; |
| 85 static const int kLastParameterOffset = +2 * kPointerSize; | 77 |
| 78 // There are two words on the stack (saved fp and saved lr) between fp and |
| 79 // the arguments. |
| 80 static const int kLastParameterOffset = 2 * kPointerSize; |
| 81 |
| 86 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; | 82 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; |
| 87 | |
| 88 // Caller SP-relative. | |
| 89 static const int kParam0Offset = -2 * kPointerSize; | |
| 90 static const int kReceiverOffset = -1 * kPointerSize; | |
| 91 }; | 83 }; |
| 92 | 84 |
| 93 | 85 |
| 94 class ArgumentsAdaptorFrameConstants : public AllStatic { | 86 class ArgumentsAdaptorFrameConstants : public AllStatic { |
| 95 public: | 87 public: |
| 96 // FP-relative. | 88 // FP-relative. |
| 97 static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset; | 89 static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset; |
| 98 | 90 |
| 99 static const int kFrameSize = | 91 static const int kFrameSize = |
| 100 StandardFrameConstants::kFixedFrameSize + kPointerSize; | 92 StandardFrameConstants::kFixedFrameSize + kPointerSize; |
| 101 }; | 93 }; |
| 102 | 94 |
| 103 | 95 |
| 104 class ConstructFrameConstants : public AllStatic { | 96 class ConstructFrameConstants : public AllStatic { |
| 105 public: | 97 public: |
| 106 // FP-relative. | 98 // FP-relative. |
| 107 static const int kImplicitReceiverOffset = -5 * kPointerSize; | 99 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; |
| 108 static const int kConstructorOffset = kMinInt; | |
| 109 static const int kLengthOffset = -4 * kPointerSize; | 100 static const int kLengthOffset = -4 * kPointerSize; |
| 110 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; | 101 static const int kConstructorOffset = -5 * kPointerSize; |
| 102 static const int kImplicitReceiverOffset = -6 * kPointerSize; |
| 111 | 103 |
| 112 static const int kFrameSize = | 104 static const int kFrameSize = |
| 113 StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize; | 105 StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize; |
| 114 }; | 106 }; |
| 115 | 107 |
| 116 | 108 |
| 117 class InternalFrameConstants : public AllStatic { | 109 class InternalFrameConstants : public AllStatic { |
| 118 public: | 110 public: |
| 119 // FP-relative. | 111 // FP-relative. |
| 120 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; | 112 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; |
| 121 }; | 113 }; |
| 122 | 114 |
| 123 | 115 |
| 124 inline Object* JavaScriptFrame::function_slot_object() const { | 116 inline Object* JavaScriptFrame::function_slot_object() const { |
| 125 const int offset = JavaScriptFrameConstants::kFunctionOffset; | 117 const int offset = JavaScriptFrameConstants::kFunctionOffset; |
| 126 return Memory::Object_at(fp() + offset); | 118 return Memory::Object_at(fp() + offset); |
| 127 } | 119 } |
| 128 | 120 |
| 121 |
| 129 } } // namespace v8::internal | 122 } } // namespace v8::internal |
| 130 | 123 |
| 131 #endif // V8_X64_FRAMES_X64_H_ | 124 #endif // V8_A64_FRAMES_A64_H_ |
| OLD | NEW |