| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 static const int kNumJSCallerSaved = 5; | 48 static const int kNumJSCallerSaved = 5; |
| 49 | 49 |
| 50 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved]; | 50 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved]; |
| 51 | 51 |
| 52 // ---------------------------------------------------- | 52 // ---------------------------------------------------- |
| 53 | 53 |
| 54 | 54 |
| 55 class StackHandlerConstants : public AllStatic { | 55 class StackHandlerConstants : public AllStatic { |
| 56 public: | 56 public: |
| 57 static const int kNextOffset = 0 * kPointerSize; | 57 static const int kNextOffset = 0 * kPointerSize; |
| 58 static const int kPPOffset = 1 * kPointerSize; | 58 static const int kFPOffset = 1 * kPointerSize; |
| 59 static const int kFPOffset = 2 * kPointerSize; | |
| 60 | 59 |
| 61 // TODO(1233780): Get rid of the code slot in stack handlers. | 60 static const int kStateOffset = 2 * kPointerSize; |
| 62 static const int kCodeOffset = 3 * kPointerSize; | 61 static const int kPCOffset = 3 * kPointerSize; |
| 63 | |
| 64 static const int kStateOffset = 4 * kPointerSize; | |
| 65 static const int kPCOffset = 5 * kPointerSize; | |
| 66 | 62 |
| 67 static const int kAddressDisplacement = -1 * kPointerSize; | 63 static const int kAddressDisplacement = -1 * kPointerSize; |
| 68 static const int kSize = kPCOffset + kPointerSize; | 64 static const int kSize = kPCOffset + kPointerSize; |
| 69 }; | 65 }; |
| 70 | 66 |
| 71 | 67 |
| 72 class EntryFrameConstants : public AllStatic { | 68 class EntryFrameConstants : public AllStatic { |
| 73 public: | 69 public: |
| 74 static const int kCallerFPOffset = -6 * kPointerSize; | 70 static const int kCallerFPOffset = -6 * kPointerSize; |
| 75 | 71 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; | 125 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; |
| 130 }; | 126 }; |
| 131 | 127 |
| 132 | 128 |
| 133 inline Object* JavaScriptFrame::function_slot_object() const { | 129 inline Object* JavaScriptFrame::function_slot_object() const { |
| 134 const int offset = JavaScriptFrameConstants::kFunctionOffset; | 130 const int offset = JavaScriptFrameConstants::kFunctionOffset; |
| 135 return Memory::Object_at(fp() + offset); | 131 return Memory::Object_at(fp() + offset); |
| 136 } | 132 } |
| 137 | 133 |
| 138 | 134 |
| 139 // ---------------------------------------------------- | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 // C Entry frames: | |
| 145 | |
| 146 // lower | Stack | | |
| 147 // addresses | ^ | | |
| 148 // | | | | |
| 149 // | | | |
| 150 // +-------------+ | |
| 151 // | entry_pc | | |
| 152 // +-------------+ <--+ entry_sp | |
| 153 // . | | |
| 154 // . | | |
| 155 // . | | |
| 156 // +-------------+ | | |
| 157 // -3 | entry_sp --+----+ | |
| 158 // e +-------------+ | |
| 159 // n -2 | C function | | |
| 160 // t +-------------+ | |
| 161 // r -1 | caller_pp | | |
| 162 // y +-------------+ <--- fp (frame pointer, ebp) | |
| 163 // 0 | caller_fp | | |
| 164 // f +-------------+ | |
| 165 // r 1 | caller_pc | | |
| 166 // a +-------------+ <--- caller_sp (stack pointer, esp) | |
| 167 // m 2 | | | |
| 168 // e | arguments | | |
| 169 // | | | |
| 170 // +- - - - - - -+ | |
| 171 // | argument0 | | |
| 172 // +=============+ | |
| 173 // | | | |
| 174 // | caller | | |
| 175 // higher | expressions | | |
| 176 // addresses | | | |
| 177 | |
| 178 | |
| 179 // Proper JS frames: | |
| 180 | |
| 181 // lower | Stack | | |
| 182 // addresses | ^ | | |
| 183 // | | | | |
| 184 // | | | |
| 185 // ----------- +=============+ <--- sp (stack pointer, esp) | |
| 186 // | function | | |
| 187 // +-------------+ | |
| 188 // | | | |
| 189 // | expressions | | |
| 190 // | | | |
| 191 // +-------------+ | |
| 192 // a | | | |
| 193 // c | locals | | |
| 194 // t | | | |
| 195 // i +- - - - - - -+ <--- | |
| 196 // v -4 | local0 | ^ | |
| 197 // a +-------------+ | | |
| 198 // t -3 | code | | | |
| 199 // i +-------------+ | | |
| 200 // o -2 | context | | kLocal0Offset | |
| 201 // n +-------------+ | | |
| 202 // -1 | caller_pp | v | |
| 203 // f +-------------+ <--- fp (frame pointer, ebp) | |
| 204 // r 0 | caller_fp | | |
| 205 // a +-------------+ | |
| 206 // m 1 | caller_pc | | |
| 207 // e +-------------+ <--- caller_sp (incl. parameters) | |
| 208 // 2 | | | |
| 209 // | parameters | | |
| 210 // | | | |
| 211 // +- - - - - - -+ <--- | |
| 212 // -2 | parameter0 | ^ | |
| 213 // +-------------+ | kParam0Offset | |
| 214 // -1 | receiver | v | |
| 215 // ----------- +=============+ <--- pp (parameter pointer, edi) | |
| 216 // 0 | function | | |
| 217 // +-------------+ | |
| 218 // | | | |
| 219 // | caller | | |
| 220 // higher | expressions | | |
| 221 // addresses | | | |
| 222 | |
| 223 | |
| 224 // JS entry frames: When calling from C to JS, we construct two extra | |
| 225 // frames: An entry frame (C) and a trampoline frame (JS). The | |
| 226 // following pictures shows the two frames: | |
| 227 | |
| 228 // lower | Stack | | |
| 229 // addresses | ^ | | |
| 230 // | | | | |
| 231 // | | | |
| 232 // ----------- +=============+ <--- sp (stack pointer, esp) | |
| 233 // | | | |
| 234 // | parameters | | |
| 235 // t | | | |
| 236 // r +- - - - - - -+ | |
| 237 // a | parameter0 | | |
| 238 // m +-------------+ | |
| 239 // p | receiver | | |
| 240 // o +-------------+ <--- | |
| 241 // l | function | ^ | |
| 242 // i +-------------+ | | |
| 243 // n -3 | code | | kLocal0Offset | |
| 244 // e +-------------+ | |
| 245 // -2 | NULL | context is always NULL | |
| 246 // +-------------+ | |
| 247 // f -1 | NULL | caller pp is always NULL for entry frames | |
| 248 // r +-------------+ <--- fp (frame pointer, ebp) | |
| 249 // a 0 | caller fp | | |
| 250 // m +-------------+ | |
| 251 // e 1 | caller pc | | |
| 252 // +-------------+ <--- caller_sp (incl. parameters) | |
| 253 // | 0 | | |
| 254 // ----------- +=============+ <--- pp (parameter pointer, edi) | |
| 255 // | 0 | | |
| 256 // +-------------+ <--- | |
| 257 // . ^ | |
| 258 // . | try-handler (HandlerOffsets::kSize) | |
| 259 // . v | |
| 260 // +-------------+ <--- | |
| 261 // -5 | next top pp | | |
| 262 // +-------------+ | |
| 263 // e -4 | next top fp | | |
| 264 // n +-------------+ <--- | |
| 265 // t -3 | ebx | ^ | |
| 266 // r +-------------+ | | |
| 267 // y -2 | esi | | callee-saved registers | |
| 268 // +-------------+ | | |
| 269 // -1 | edi | v | |
| 270 // f +-------------+ <--- fp | |
| 271 // r 0 | caller fp | | |
| 272 // a +-------------+ pp == NULL (parameter pointer) | |
| 273 // m 1 | caller pc | | |
| 274 // e +-------------+ <--- caller sp | |
| 275 // 2 | code entry | ^ | |
| 276 // +-------------+ | | |
| 277 // 3 | function | | | |
| 278 // +-------------+ | arguments passed from C code | |
| 279 // 4 | receiver | | | |
| 280 // +-------------+ | | |
| 281 // 5 | argc | | | |
| 282 // +-------------+ | | |
| 283 // 6 | argv | v | |
| 284 // +-------------+ <--- | |
| 285 // | | | |
| 286 // higher | | | |
| 287 // addresses | | | |
| 288 | |
| 289 | |
| 290 } } // namespace v8::internal | 135 } } // namespace v8::internal |
| 291 | 136 |
| 292 #endif // V8_IA32_FRAMES_IA32_H_ | 137 #endif // V8_IA32_FRAMES_IA32_H_ |
| OLD | NEW |