yangguo@chromium.org | 659ceec | 2012-01-26 07:37:54 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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. |
| 27 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 28 | #ifndef V8_IA32_FRAMES_IA32_H_ |
| 29 | #define V8_IA32_FRAMES_IA32_H_ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 30 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 31 | namespace v8 { |
| 32 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 33 | |
| 34 | |
| 35 | // Register lists |
| 36 | // Note that the bit values must match those used in actual instruction encoding |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 37 | const int kNumRegs = 8; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 38 | |
| 39 | |
| 40 | // Caller-saved registers |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 41 | const RegList kJSCallerSaved = |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 42 | 1 << 0 | // eax |
| 43 | 1 << 1 | // ecx |
| 44 | 1 << 2 | // edx |
| 45 | 1 << 3 | // ebx - used as a caller-saved register in JavaScript code |
| 46 | 1 << 7; // edi - callee function |
| 47 | |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 48 | const int kNumJSCallerSaved = 5; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 49 | |
| 50 | typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved]; |
| 51 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 52 | |
| 53 | // Number of registers for which space is reserved in safepoints. |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 54 | const int kNumSafepointRegisters = 8; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 55 | |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 56 | const int kNoAlignmentPadding = 0; |
| 57 | const int kAlignmentPaddingPushed = 2; |
| 58 | const int kAlignmentZapValue = 0x12345678; // Not heap object tagged. |
| 59 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 60 | // ---------------------------------------------------- |
| 61 | |
| 62 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 63 | class EntryFrameConstants : public AllStatic { |
| 64 | public: |
| 65 | static const int kCallerFPOffset = -6 * kPointerSize; |
| 66 | |
| 67 | static const int kFunctionArgOffset = +3 * kPointerSize; |
| 68 | static const int kReceiverArgOffset = +4 * kPointerSize; |
| 69 | static const int kArgcOffset = +5 * kPointerSize; |
| 70 | static const int kArgvOffset = +6 * kPointerSize; |
| 71 | }; |
| 72 | |
| 73 | |
| 74 | class ExitFrameConstants : public AllStatic { |
| 75 | public: |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 76 | static const int kCodeOffset = -2 * kPointerSize; |
| 77 | static const int kSPOffset = -1 * kPointerSize; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 78 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 79 | static const int kCallerFPOffset = 0 * kPointerSize; |
| 80 | static const int kCallerPCOffset = +1 * kPointerSize; |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 81 | |
| 82 | // FP-relative displacement of the caller's SP. It points just |
| 83 | // below the saved PC. |
| 84 | static const int kCallerSPDisplacement = +2 * kPointerSize; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 88 | class JavaScriptFrameConstants : public AllStatic { |
| 89 | public: |
| 90 | // FP-relative. |
| 91 | static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset; |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 92 | static const int kLastParameterOffset = +2 * kPointerSize; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 93 | static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; |
| 94 | |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 95 | // Caller SP-relative. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 96 | static const int kParam0Offset = -2 * kPointerSize; |
| 97 | static const int kReceiverOffset = -1 * kPointerSize; |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 98 | |
| 99 | static const int kDynamicAlignmentStateOffset = kLocal0Offset; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | |
| 103 | class ArgumentsAdaptorFrameConstants : public AllStatic { |
| 104 | public: |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 105 | // FP-relative. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 106 | static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset; |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 107 | |
yangguo@chromium.org | 659ceec | 2012-01-26 07:37:54 +0000 | [diff] [blame] | 108 | static const int kFrameSize = |
| 109 | StandardFrameConstants::kFixedFrameSize + kPointerSize; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 113 | class ConstructFrameConstants : public AllStatic { |
| 114 | public: |
| 115 | // FP-relative. |
| 116 | static const int kImplicitReceiverOffset = -5 * kPointerSize; |
| 117 | static const int kConstructorOffset = kMinInt; |
| 118 | static const int kLengthOffset = -4 * kPointerSize; |
| 119 | static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; |
| 120 | |
| 121 | static const int kFrameSize = |
| 122 | StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize; |
| 123 | }; |
| 124 | |
| 125 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 126 | class InternalFrameConstants : public AllStatic { |
| 127 | public: |
ulan@chromium.org | 750145a | 2013-03-07 15:14:13 +0000 | [diff] [blame] | 128 | // FP-relative. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 129 | static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; |
| 130 | }; |
| 131 | |
| 132 | |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 133 | inline Object* JavaScriptFrame::function_slot_object() const { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 134 | const int offset = JavaScriptFrameConstants::kFunctionOffset; |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 135 | return Memory::Object_at(fp() + offset); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 139 | } } // namespace v8::internal |
| 140 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 141 | #endif // V8_IA32_FRAMES_IA32_H_ |